Compare commits

..

1 Commits

Author SHA1 Message Date
dependabot[bot]
503945c9b3 chore(deps): bump actions/setup-python from 4 to 5
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4 to 5.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-11 06:40:12 +00:00
51 changed files with 17 additions and 233 deletions

View File

@@ -29,7 +29,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'

View File

@@ -3,10 +3,6 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [2.34.6](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.34.5...@standardnotes/analytics@2.34.6) (2023-12-11)
**Note:** Version bump only for package @standardnotes/analytics
## [2.34.5](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.34.4...@standardnotes/analytics@2.34.5) (2023-12-07)
### Bug Fixes

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/analytics",
"version": "2.34.6",
"version": "2.34.5",
"engines": {
"node": ">=18.0.0 <21.0.0"
},

View File

@@ -3,16 +3,6 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [1.89.0](https://github.com/standardnotes/server/compare/@standardnotes/api-gateway@1.88.4...@standardnotes/api-gateway@1.89.0) (2023-12-12)
### Features
* **syncing-server:** add extended revisions frequency for free users ([#965](https://github.com/standardnotes/server/issues/965)) ([398c10c](https://github.com/standardnotes/server/commit/398c10ce4b8e357728a8b4f354b3bf6ccc8e438d))
## [1.88.4](https://github.com/standardnotes/server/compare/@standardnotes/api-gateway@1.88.3...@standardnotes/api-gateway@1.88.4) (2023-12-11)
**Note:** Version bump only for package @standardnotes/api-gateway
## [1.88.3](https://github.com/standardnotes/server/compare/@standardnotes/api-gateway@1.88.2...@standardnotes/api-gateway@1.88.3) (2023-12-08)
### Bug Fixes

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/api-gateway",
"version": "1.89.0",
"version": "1.88.3",
"engines": {
"node": ">=18.0.0 <21.0.0"
},

View File

@@ -5,7 +5,6 @@ import { BaseMiddleware } from 'inversify-express-utils'
import { verify } from 'jsonwebtoken'
import { Logger } from 'winston'
import { ConnectionValidationResponse, IAuthClient, WebsocketConnectionAuthorizationHeader } from '@standardnotes/grpc'
import { RoleName } from '@standardnotes/domain-core'
export class GRPCWebSocketAuthMiddleware extends BaseMiddleware {
constructor(
@@ -97,8 +96,6 @@ export class GRPCWebSocketAuthMiddleware extends BaseMiddleware {
response.locals.user = decodedToken.user
response.locals.session = decodedToken.session
response.locals.roles = decodedToken.roles
response.locals.isFreeUser =
decodedToken.roles.length === 1 && decodedToken.roles[0].name === RoleName.NAMES.CoreUser
} catch (error) {
this.logger.error(
`Could not pass the request to websocket connection validation on underlying service: ${

View File

@@ -31,7 +31,6 @@ export class GRPCSyncingServerServiceProxy {
if (response.locals.session) {
metadata.set('x-session-uuid', response.locals.session.uuid)
}
metadata.set('x-is-free-user', response.locals.isFreeUser ? 'true' : 'false')
this.syncingClient.syncItems(syncRequest, metadata, (error, syncResponse) => {
if (error) {

View File

@@ -3,28 +3,6 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.176.5](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.176.4...@standardnotes/auth-server@1.176.5) (2023-12-12)
### Bug Fixes
* **auth:** add user uuid context to sign in emails log context ([cfbe2bb](https://github.com/standardnotes/server/commit/cfbe2bbac60e9014d7ba0967e4b996fba7dc8629))
## [1.176.4](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.176.3...@standardnotes/auth-server@1.176.4) (2023-12-11)
### Bug Fixes
* **auth:** generate new recovery codes when enabling mfa ([#964](https://github.com/standardnotes/server/issues/964)) ([031fa71](https://github.com/standardnotes/server/commit/031fa71e7d86221ec7fb0f4b21c62454646564e2))
## [1.176.3](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.176.2...@standardnotes/auth-server@1.176.3) (2023-12-11)
**Note:** Version bump only for package @standardnotes/auth-server
## [1.176.2](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.176.1...@standardnotes/auth-server@1.176.2) (2023-12-11)
### Bug Fixes
* **auth:** error log meta on triggering email backups ([4ab61b9](https://github.com/standardnotes/server/commit/4ab61b94a4aee361399a76c9f2b6b977c4832b06))
## [1.176.1](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.176.0...@standardnotes/auth-server@1.176.1) (2023-12-07)
### Bug Fixes

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/auth-server",
"version": "1.176.5",
"version": "1.176.1",
"engines": {
"node": ">=18.0.0 <21.0.0"
},

View File

@@ -1269,7 +1269,6 @@ export class ContainerConfigLoader {
container.get<DomainEventPublisherInterface>(TYPES.Auth_DomainEventPublisher),
container.get<DomainEventFactoryInterface>(TYPES.Auth_DomainEventFactory),
container.get<TriggerEmailBackupForUser>(TYPES.Auth_TriggerEmailBackupForUser),
container.get<GenerateRecoveryCodes>(TYPES.Auth_GenerateRecoveryCodes),
),
)
container

View File

@@ -159,7 +159,6 @@ export class DomainEventFactory implements DomainEventFactoryInterface {
level: string
body: string
subject: string
userUuid?: string
}): EmailRequestedEvent {
return {
type: 'EMAIL_REQUESTED',

View File

@@ -31,7 +31,6 @@ export interface DomainEventFactoryInterface {
level: string
body: string
subject: string
userUuid?: string
}): EmailRequestedEvent
createListedAccountRequestedEvent(userUuid: string, userEmail: string): ListedAccountRequestedEvent
createUserRegisteredEvent(dto: {

View File

@@ -35,7 +35,6 @@ export class UserInvitedToSharedVaultEventHandler implements DomainEventHandlerI
subject: getSubject(),
messageIdentifier: 'USER_INVITED_TO_SHARED_VAULT',
userEmail: user.email,
userUuid: user.uuid,
}),
)
}

View File

@@ -131,7 +131,6 @@ export class SignIn implements UseCaseInterface {
),
messageIdentifier: 'SIGN_IN',
subject: getSubject(user.email),
userUuid: user.uuid,
}),
)
} catch (error) {

View File

@@ -39,9 +39,7 @@ export class TriggerEmailBackupForAllUsers implements UseCaseInterface<void> {
})
/* istanbul ignore next */
if (result.isFailed()) {
this.logger.error(`Failed to trigger email backup for user: ${result.getError()}`, {
userId: setting.props.userUuid.value,
})
this.logger.error(`Failed to trigger email backup for user ${setting.props.userUuid.value}`)
failedUsers++
}
}

View File

@@ -7,7 +7,6 @@ import {
import { EmailBackupFrequency, LogSessionUserAgentOption, MuteMarketingEmailsOption } from '@standardnotes/settings'
import { SettingName, Result } from '@standardnotes/domain-core'
import { GenerateRecoveryCodes } from '../GenerateRecoveryCodes/GenerateRecoveryCodes'
import { TriggerPostSettingUpdateActions } from './TriggerPostSettingUpdateActions'
import { DomainEventFactoryInterface } from '../../Event/DomainEventFactoryInterface'
import { TriggerEmailBackupForUser } from '../TriggerEmailBackupForUser/TriggerEmailBackupForUser'
@@ -16,20 +15,11 @@ describe('TriggerPostSettingUpdateActions', () => {
let domainEventPublisher: DomainEventPublisherInterface
let domainEventFactory: DomainEventFactoryInterface
let triggerEmailBackupForUser: TriggerEmailBackupForUser
let generateRecoveryCodes: GenerateRecoveryCodes
const createUseCase = () =>
new TriggerPostSettingUpdateActions(
domainEventPublisher,
domainEventFactory,
triggerEmailBackupForUser,
generateRecoveryCodes,
)
new TriggerPostSettingUpdateActions(domainEventPublisher, domainEventFactory, triggerEmailBackupForUser)
beforeEach(() => {
generateRecoveryCodes = {} as jest.Mocked<GenerateRecoveryCodes>
generateRecoveryCodes.execute = jest.fn().mockReturnValue(Result.ok())
triggerEmailBackupForUser = {} as jest.Mocked<TriggerEmailBackupForUser>
triggerEmailBackupForUser.execute = jest.fn().mockReturnValue(Result.ok())
@@ -111,15 +101,4 @@ describe('TriggerPostSettingUpdateActions', () => {
username: 'test@test.te',
})
})
it('should generate new recovery codes upon enabling mfa setting', async () => {
await createUseCase().execute({
updatedSettingName: SettingName.NAMES.MfaSecret,
userUuid: '4-5-6',
userEmail: 'test@test.te',
unencryptedValue: '123',
})
expect(generateRecoveryCodes.execute).toHaveBeenCalled()
})
})

View File

@@ -5,7 +5,6 @@ import { EmailBackupFrequency, LogSessionUserAgentOption } from '@standardnotes/
import { TriggerPostSettingUpdateActionsDTO } from './TriggerPostSettingUpdateActionsDTO'
import { DomainEventFactoryInterface } from '../../Event/DomainEventFactoryInterface'
import { TriggerEmailBackupForUser } from '../TriggerEmailBackupForUser/TriggerEmailBackupForUser'
import { GenerateRecoveryCodes } from '../GenerateRecoveryCodes/GenerateRecoveryCodes'
export class TriggerPostSettingUpdateActions implements UseCaseInterface<void> {
private readonly emailSettingToSubscriptionRejectionLevelMap: Map<string, string> = new Map([
@@ -19,7 +18,6 @@ export class TriggerPostSettingUpdateActions implements UseCaseInterface<void> {
private domainEventPublisher: DomainEventPublisherInterface,
private domainEventFactory: DomainEventFactoryInterface,
private triggerEmailBackupForUser: TriggerEmailBackupForUser,
private generateRecoveryCodes: GenerateRecoveryCodes,
) {}
async execute(dto: TriggerPostSettingUpdateActionsDTO): Promise<Result<void>> {
@@ -37,12 +35,6 @@ export class TriggerPostSettingUpdateActions implements UseCaseInterface<void> {
await this.triggerSessionUserAgentCleanup(dto.userEmail, dto.userUuid)
}
if (this.isEnablingMFASetting(dto.updatedSettingName, dto.unencryptedValue)) {
await this.generateRecoveryCodes.execute({
userUuid: dto.userUuid,
})
}
return Result.ok()
}
@@ -62,10 +54,6 @@ export class TriggerPostSettingUpdateActions implements UseCaseInterface<void> {
)
}
private isEnablingMFASetting(settingName: string, newValue: string | null): boolean {
return settingName === SettingName.NAMES.MfaSecret && newValue !== null
}
private isDisablingSessionUserAgentLogging(settingName: string, newValue: string | null): boolean {
return SettingName.NAMES.LogSessionUserAgent === settingName && LogSessionUserAgentOption.Disabled === newValue
}

View File

@@ -3,10 +3,6 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.22.5](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.22.4...@standardnotes/domain-events-infra@1.22.5) (2023-12-11)
**Note:** Version bump only for package @standardnotes/domain-events-infra
## [1.22.4](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.22.3...@standardnotes/domain-events-infra@1.22.4) (2023-12-01)
### Bug Fixes

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/domain-events-infra",
"version": "1.22.5",
"version": "1.22.4",
"engines": {
"node": ">=18.0.0 <21.0.0"
},

View File

@@ -3,12 +3,6 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [2.138.2](https://github.com/standardnotes/server/compare/@standardnotes/domain-events@2.138.1...@standardnotes/domain-events@2.138.2) (2023-12-11)
### Bug Fixes
* **syncing-server:** add user uuid for the emails requesting backup ([7b0ea0a](https://github.com/standardnotes/server/commit/7b0ea0a06975902e01951b13c84e941827dedd84))
## [2.138.1](https://github.com/standardnotes/server/compare/@standardnotes/domain-events@2.138.0...@standardnotes/domain-events@2.138.1) (2023-11-28)
**Note:** Version bump only for package @standardnotes/domain-events

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/domain-events",
"version": "2.138.2",
"version": "2.138.1",
"engines": {
"node": ">=18.0.0 <21.0.0"
},

View File

@@ -12,5 +12,4 @@ export interface EmailRequestedEventPayload {
attachmentFileName: string
attachmentContentType: string
}>
userUuid?: string
}

View File

@@ -3,10 +3,6 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.36.6](https://github.com/standardnotes/server/compare/@standardnotes/files-server@1.36.5...@standardnotes/files-server@1.36.6) (2023-12-11)
**Note:** Version bump only for package @standardnotes/files-server
## [1.36.5](https://github.com/standardnotes/server/compare/@standardnotes/files-server@1.36.4...@standardnotes/files-server@1.36.5) (2023-12-07)
### Bug Fixes

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/files-server",
"version": "1.36.6",
"version": "1.36.5",
"engines": {
"node": ">=18.0.0 <21.0.0"
},

View File

@@ -3,22 +3,6 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.22.20](https://github.com/standardnotes/server/compare/@standardnotes/home-server@1.22.19...@standardnotes/home-server@1.22.20) (2023-12-12)
**Note:** Version bump only for package @standardnotes/home-server
## [1.22.19](https://github.com/standardnotes/server/compare/@standardnotes/home-server@1.22.18...@standardnotes/home-server@1.22.19) (2023-12-11)
**Note:** Version bump only for package @standardnotes/home-server
## [1.22.18](https://github.com/standardnotes/server/compare/@standardnotes/home-server@1.22.17...@standardnotes/home-server@1.22.18) (2023-12-11)
**Note:** Version bump only for package @standardnotes/home-server
## [1.22.17](https://github.com/standardnotes/server/compare/@standardnotes/home-server@1.22.16...@standardnotes/home-server@1.22.17) (2023-12-11)
**Note:** Version bump only for package @standardnotes/home-server
## [1.22.16](https://github.com/standardnotes/server/compare/@standardnotes/home-server@1.22.15...@standardnotes/home-server@1.22.16) (2023-12-08)
**Note:** Version bump only for package @standardnotes/home-server

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/home-server",
"version": "1.22.20",
"version": "1.22.16",
"engines": {
"node": ">=18.0.0 <21.0.0"
},

View File

@@ -3,10 +3,6 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.51.6](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.51.5...@standardnotes/revisions-server@1.51.6) (2023-12-11)
**Note:** Version bump only for package @standardnotes/revisions-server
## [1.51.5](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.51.4...@standardnotes/revisions-server@1.51.5) (2023-12-07)
### Bug Fixes

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/revisions-server",
"version": "1.51.6",
"version": "1.51.5",
"engines": {
"node": ">=18.0.0 <21.0.0"
},

View File

@@ -3,10 +3,6 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.27.11](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.27.10...@standardnotes/scheduler-server@1.27.11) (2023-12-11)
**Note:** Version bump only for package @standardnotes/scheduler-server
## [1.27.10](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.27.9...@standardnotes/scheduler-server@1.27.10) (2023-12-07)
### Bug Fixes

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/scheduler-server",
"version": "1.27.11",
"version": "1.27.10",
"engines": {
"node": ">=18.0.0 <21.0.0"
},

View File

@@ -3,24 +3,6 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [1.129.0](https://github.com/standardnotes/server/compare/@standardnotes/syncing-server@1.128.2...@standardnotes/syncing-server@1.129.0) (2023-12-12)
### Features
* **syncing-server:** add extended revisions frequency for free users ([#965](https://github.com/standardnotes/server/issues/965)) ([398c10c](https://github.com/standardnotes/server/commit/398c10ce4b8e357728a8b4f354b3bf6ccc8e438d))
## [1.128.2](https://github.com/standardnotes/server/compare/@standardnotes/syncing-server@1.128.1...@standardnotes/syncing-server@1.128.2) (2023-12-11)
### Bug Fixes
* **syncing-server:** add user uuid for the emails requesting backup ([7b0ea0a](https://github.com/standardnotes/server/commit/7b0ea0a06975902e01951b13c84e941827dedd84))
## [1.128.1](https://github.com/standardnotes/server/compare/@standardnotes/syncing-server@1.128.0...@standardnotes/syncing-server@1.128.1) (2023-12-11)
### Bug Fixes
* **syncing-server:** logs meta for email with backup requested ([597ff13](https://github.com/standardnotes/server/commit/597ff13393965a6d6f3a35e12d41d648543d35b7))
# [1.128.0](https://github.com/standardnotes/server/compare/@standardnotes/syncing-server@1.127.9...@standardnotes/syncing-server@1.128.0) (2023-12-08)
### Features

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/syncing-server",
"version": "1.129.0",
"version": "1.128.0",
"engines": {
"node": ">=18.0.0 <21.0.0"
},

View File

@@ -458,9 +458,6 @@ export class ContainerConfigLoader {
container
.bind(TYPES.Sync_REVISIONS_FREQUENCY)
.toConstantValue(env.get('REVISIONS_FREQUENCY', true) ? +env.get('REVISIONS_FREQUENCY', true) : 300)
container
.bind(TYPES.Sync_FREE_REVISIONS_FREQUENCY)
.toConstantValue(env.get('FREE_REVISIONS_FREQUENCY', true) ? +env.get('FREE_REVISIONS_FREQUENCY', true) : 86_400)
container.bind(TYPES.Sync_VERSION).toConstantValue(env.get('VERSION', true) ?? 'development')
container
.bind(TYPES.Sync_CONTENT_SIZE_TRANSFER_LIMIT)
@@ -604,7 +601,6 @@ export class ContainerConfigLoader {
container.get<TimerInterface>(TYPES.Sync_Timer),
container.get<DomainEventPublisherInterface>(TYPES.Sync_DomainEventPublisher),
container.get<DomainEventFactoryInterface>(TYPES.Sync_DomainEventFactory),
container.get<number>(TYPES.Sync_FREE_REVISIONS_FREQUENCY),
container.get<number>(TYPES.Sync_REVISIONS_FREQUENCY),
container.get<DetermineSharedVaultOperationOnItem>(TYPES.Sync_DetermineSharedVaultOperationOnItem),
container.get<AddNotificationsForUsers>(TYPES.Sync_AddNotificationsForUsers),

View File

@@ -34,7 +34,6 @@ const TYPES = {
Sync_S3_BACKUP_BUCKET_NAME: Symbol.for('Sync_S3_BACKUP_BUCKET_NAME'),
Sync_EMAIL_ATTACHMENT_MAX_BYTE_SIZE: Symbol.for('Sync_EMAIL_ATTACHMENT_MAX_BYTE_SIZE'),
Sync_REVISIONS_FREQUENCY: Symbol.for('Sync_REVISIONS_FREQUENCY'),
Sync_FREE_REVISIONS_FREQUENCY: Symbol.for('Sync_FREE_REVISIONS_FREQUENCY'),
Sync_VERSION: Symbol.for('Sync_VERSION'),
Sync_CONTENT_SIZE_TRANSFER_LIMIT: Symbol.for('Sync_CONTENT_SIZE_TRANSFER_LIMIT'),
Sync_MAX_ITEMS_LIMIT: Symbol.for('Sync_MAX_ITEMS_LIMIT'),

View File

@@ -329,7 +329,6 @@ export class DomainEventFactory implements DomainEventFactoryInterface {
attachmentFileName: string
attachmentContentType: string
}>
userUuid?: string
}): EmailRequestedEvent {
return {
type: 'EMAIL_REQUESTED',

View File

@@ -74,7 +74,6 @@ export interface DomainEventFactoryInterface {
attachmentFileName: string
attachmentContentType: string
}>
userUuid?: string
}): EmailRequestedEvent
createDuplicateItemSyncedEvent(dto: { itemUuid: string; userUuid: string }): DuplicateItemSyncedEvent
createItemRevisionCreationRequested(dto: { itemUuid: string; userUuid: string }): ItemRevisionCreationRequestedEvent

View File

@@ -81,13 +81,10 @@ export class EmailBackupRequestedEventHandler implements DomainEventHandlerInter
attachmentContentType: 'application/json',
},
],
userUuid: event.payload.userUuid,
}),
)
}
this.logger.info('Email with backup requested for user', {
userId: event.payload.userUuid,
})
this.logger.info(`Email with backup requested for user ${event.payload.userUuid}`)
}
}

View File

@@ -113,7 +113,6 @@ describe('SaveItems', () => {
readOnlyAccess: false,
sessionUuid: 'session-uuid',
snjsVersion: '2.200.0',
isFreeUser: false,
})
expect(result.isFailed()).toBeFalsy()
@@ -138,7 +137,6 @@ describe('SaveItems', () => {
readOnlyAccess: false,
sessionUuid: 'session-uuid',
snjsVersion: '2.200.0',
isFreeUser: false,
})
expect(result.isFailed()).toBeFalsy()
@@ -163,7 +161,6 @@ describe('SaveItems', () => {
readOnlyAccess: false,
sessionUuid: 'session-uuid',
snjsVersion: '2.200.0',
isFreeUser: false,
})
expect(result.isFailed()).toBeFalsy()
@@ -185,7 +182,6 @@ describe('SaveItems', () => {
readOnlyAccess: true,
sessionUuid: 'session-uuid',
snjsVersion: '2.200.0',
isFreeUser: false,
})
expect(result.isFailed()).toBeFalsy()
@@ -208,7 +204,6 @@ describe('SaveItems', () => {
readOnlyAccess: false,
sessionUuid: 'session-uuid',
snjsVersion: '2.200.0',
isFreeUser: false,
})
expect(result.isFailed()).toBeFalsy()
@@ -227,7 +222,6 @@ describe('SaveItems', () => {
readOnlyAccess: false,
sessionUuid: 'session-uuid',
snjsVersion: '2.200.0',
isFreeUser: false,
})
expect(result.isFailed()).toBeFalsy()
@@ -246,12 +240,10 @@ describe('SaveItems', () => {
readOnlyAccess: false,
sessionUuid: 'session-uuid',
snjsVersion: '2.200.0',
isFreeUser: false,
})
expect(result.isFailed()).toBeFalsy()
expect(updateExistingItem.execute).toHaveBeenCalledWith({
isFreeUser: false,
itemHash: itemHash1,
existingItem: savedItem,
sessionUuid: 'session-uuid',
@@ -292,12 +284,10 @@ describe('SaveItems', () => {
readOnlyAccess: false,
sessionUuid: 'session-uuid',
snjsVersion: '2.200.0',
isFreeUser: false,
})
expect(result.isFailed()).toBeFalsy()
expect(updateExistingItem.execute).toHaveBeenCalledWith({
isFreeUser: false,
itemHash: itemHash1,
existingItem: savedItem,
sessionUuid: 'session-uuid',
@@ -320,7 +310,6 @@ describe('SaveItems', () => {
readOnlyAccess: false,
sessionUuid: 'session-uuid',
snjsVersion: '2.200.0',
isFreeUser: false,
})
expect(result.isFailed()).toBeFalsy()
@@ -345,7 +334,6 @@ describe('SaveItems', () => {
readOnlyAccess: false,
sessionUuid: 'session-uuid',
snjsVersion: '2.200.0',
isFreeUser: false,
})
expect(result.isFailed()).toBeFalsy()
@@ -391,7 +379,6 @@ describe('SaveItems', () => {
readOnlyAccess: false,
sessionUuid: 'session-uuid',
snjsVersion: '2.200.0',
isFreeUser: false,
})
expect(result.isFailed()).toBeFalsy()

View File

@@ -84,7 +84,6 @@ export class SaveItems implements UseCaseInterface<SaveItemsResult> {
itemHash,
sessionUuid: dto.sessionUuid,
performingUserUuid: dto.userUuid,
isFreeUser: dto.isFreeUser,
})
if (udpatedItemOrError.isFailed()) {
this.logger.error(

View File

@@ -7,5 +7,4 @@ export interface SaveItemsDTO {
readOnlyAccess: boolean
sessionUuid: string | null
snjsVersion: string
isFreeUser: boolean
}

View File

@@ -156,7 +156,6 @@ describe('SyncItems', () => {
apiVersion: ApiVersion.v20200115,
sessionUuid: null,
snjsVersion: '1.2.3',
isFreeUser: false,
})
expect(result.getValue()).toEqual({
conflicts: [],
@@ -182,7 +181,6 @@ describe('SyncItems', () => {
userUuid: '1-2-3',
apiVersion: '20200115',
snjsVersion: '1.2.3',
isFreeUser: false,
readOnlyAccess: false,
sessionUuid: null,
})
@@ -207,7 +205,6 @@ describe('SyncItems', () => {
apiVersion: ApiVersion.v20200115,
sessionUuid: null,
snjsVersion: '1.2.3',
isFreeUser: false,
})
} catch (error) {
caughtError = error
@@ -227,7 +224,6 @@ describe('SyncItems', () => {
contentType: 'Note',
apiVersion: ApiVersion.v20200115,
snjsVersion: '1.2.3',
isFreeUser: false,
})
expect(result.getValue()).toEqual({
conflicts: [],
@@ -253,7 +249,6 @@ describe('SyncItems', () => {
contentType: 'Note',
apiVersion: ApiVersion.v20200115,
snjsVersion: '1.2.3',
isFreeUser: false,
sharedVaultUuids: ['00000000-0000-0000-0000-000000000000'],
})
expect(result.getValue()).toEqual({
@@ -306,7 +301,6 @@ describe('SyncItems', () => {
contentType: 'Note',
apiVersion: ApiVersion.v20200115,
snjsVersion: '1.2.3',
isFreeUser: false,
})
expect(result.getValue()).toEqual({
@@ -346,7 +340,6 @@ describe('SyncItems', () => {
contentType: 'Note',
apiVersion: ApiVersion.v20200115,
snjsVersion: '1.2.3',
isFreeUser: false,
})
expect(result.isFailed()).toBeTruthy()
@@ -367,7 +360,6 @@ describe('SyncItems', () => {
contentType: 'Note',
apiVersion: ApiVersion.v20200115,
snjsVersion: '1.2.3',
isFreeUser: false,
})
expect(result.isFailed()).toBeTruthy()
@@ -388,7 +380,6 @@ describe('SyncItems', () => {
contentType: 'Note',
apiVersion: ApiVersion.v20200115,
snjsVersion: '1.2.3',
isFreeUser: false,
})
expect(result.isFailed()).toBeTruthy()
@@ -409,7 +400,6 @@ describe('SyncItems', () => {
contentType: 'Note',
apiVersion: ApiVersion.v20200115,
snjsVersion: '1.2.3',
isFreeUser: false,
})
expect(result.isFailed()).toBeTruthy()
@@ -430,7 +420,6 @@ describe('SyncItems', () => {
contentType: 'Note',
apiVersion: ApiVersion.v20200115,
snjsVersion: '1.2.3',
isFreeUser: false,
})
expect(result.isFailed()).toBeTruthy()
@@ -451,7 +440,6 @@ describe('SyncItems', () => {
contentType: 'Note',
apiVersion: ApiVersion.v20200115,
snjsVersion: '1.2.3',
isFreeUser: false,
})
expect(result.isFailed()).toBeTruthy()

View File

@@ -47,7 +47,6 @@ export class SyncItems implements UseCaseInterface<SyncItemsResponse> {
readOnlyAccess: dto.readOnlyAccess,
sessionUuid: dto.sessionUuid,
snjsVersion: dto.snjsVersion,
isFreeUser: dto.isFreeUser,
})
if (saveItemsResultOrError.isFailed()) {
return Result.fail(saveItemsResultOrError.getError())

View File

@@ -13,5 +13,4 @@ export type SyncItemsDTO = {
snjsVersion: string
readOnlyAccess: boolean
sessionUuid: string | null
isFreeUser: boolean
}

View File

@@ -38,7 +38,6 @@ describe('UpdateExistingItem', () => {
timer,
domainEventPublisher,
domainEventFactory,
86_400,
5,
determineSharedVaultOperationOnItem,
addNotificationsForUsers,
@@ -138,7 +137,6 @@ describe('UpdateExistingItem', () => {
itemHash: itemHash1,
sessionUuid: '00000000-0000-0000-0000-000000000000',
performingUserUuid: '00000000-0000-0000-0000-000000000000',
isFreeUser: false,
})
expect(result.isFailed()).toBeFalsy()
@@ -153,7 +151,6 @@ describe('UpdateExistingItem', () => {
itemHash: itemHash1,
sessionUuid: 'invalid-uuid',
performingUserUuid: '00000000-0000-0000-0000-000000000000',
isFreeUser: false,
})
expect(result.isFailed()).toBeTruthy()
@@ -170,7 +167,6 @@ describe('UpdateExistingItem', () => {
}).getValue(),
sessionUuid: '00000000-0000-0000-0000-000000000000',
performingUserUuid: '00000000-0000-0000-0000-000000000000',
isFreeUser: false,
})
expect(result.isFailed()).toBeTruthy()
@@ -187,7 +183,6 @@ describe('UpdateExistingItem', () => {
}).getValue(),
sessionUuid: '00000000-0000-0000-0000-000000000000',
performingUserUuid: '00000000-0000-0000-0000-000000000000',
isFreeUser: false,
})
expect(result.isFailed()).toBeFalsy()
@@ -211,7 +206,6 @@ describe('UpdateExistingItem', () => {
}).getValue(),
sessionUuid: '00000000-0000-0000-0000-000000000000',
performingUserUuid: '00000000-0000-0000-0000-000000000000',
isFreeUser: false,
})
expect(result.isFailed()).toBeFalsy()
@@ -230,7 +224,6 @@ describe('UpdateExistingItem', () => {
}).getValue(),
sessionUuid: '00000000-0000-0000-0000-000000000000',
performingUserUuid: '00000000-0000-0000-0000-000000000000',
isFreeUser: false,
})
expect(result.isFailed()).toBeTruthy()
@@ -248,7 +241,6 @@ describe('UpdateExistingItem', () => {
}).getValue(),
sessionUuid: '00000000-0000-0000-0000-000000000000',
performingUserUuid: '00000000-0000-0000-0000-000000000000',
isFreeUser: false,
})
expect(result.isFailed()).toBeFalsy()
@@ -268,7 +260,6 @@ describe('UpdateExistingItem', () => {
}).getValue(),
sessionUuid: '00000000-0000-0000-0000-000000000000',
performingUserUuid: '00000000-0000-0000-0000-000000000000',
isFreeUser: false,
})
expect(result.isFailed()).toBeFalsy()
@@ -289,7 +280,6 @@ describe('UpdateExistingItem', () => {
}).getValue(),
sessionUuid: '00000000-0000-0000-0000-000000000000',
performingUserUuid: '00000000-0000-0000-0000-000000000000',
isFreeUser: false,
})
expect(result.isFailed()).toBeFalsy()
@@ -310,7 +300,6 @@ describe('UpdateExistingItem', () => {
}).getValue(),
sessionUuid: '00000000-0000-0000-0000-000000000000',
performingUserUuid: '00000000-0000-0000-0000-000000000000',
isFreeUser: false,
})
expect(result.isFailed()).toBeFalsy()
@@ -334,7 +323,6 @@ describe('UpdateExistingItem', () => {
}).getValue(),
sessionUuid: '00000000-0000-0000-0000-000000000000',
performingUserUuid: '00000000-0000-0000-0000-000000000000',
isFreeUser: false,
})
expect(result.isFailed()).toBeTruthy()
@@ -359,7 +347,6 @@ describe('UpdateExistingItem', () => {
}).getValue(),
sessionUuid: '00000000-0000-0000-0000-000000000000',
performingUserUuid: '00000000-0000-0000-0000-000000000000',
isFreeUser: false,
})
expect(result.isFailed()).toBeTruthy()
@@ -374,7 +361,6 @@ describe('UpdateExistingItem', () => {
itemHash: itemHash1,
sessionUuid: '00000000-0000-0000-0000-000000000000',
performingUserUuid: 'invalid-uuid',
isFreeUser: false,
})
expect(result.isFailed()).toBeTruthy()
})
@@ -393,7 +379,6 @@ describe('UpdateExistingItem', () => {
itemHash,
sessionUuid: '00000000-0000-0000-0000-000000000000',
performingUserUuid: '00000000-0000-0000-0000-000000000000',
isFreeUser: false,
})
expect(result.isFailed()).toBeFalsy()
expect(item1.props.sharedVaultAssociation).not.toBeUndefined()
@@ -420,7 +405,6 @@ describe('UpdateExistingItem', () => {
itemHash,
sessionUuid: '00000000-0000-0000-0000-000000000000',
performingUserUuid: '00000000-0000-0000-0000-000000000000',
isFreeUser: false,
})
expect(result.isFailed()).toBeFalsy()
@@ -458,7 +442,6 @@ describe('UpdateExistingItem', () => {
itemHash,
sessionUuid: '00000000-0000-0000-0000-000000000000',
performingUserUuid: '00000000-0000-0000-0000-000000000000',
isFreeUser: false,
})
expect(result.isFailed()).toBeFalsy()
@@ -487,7 +470,6 @@ describe('UpdateExistingItem', () => {
itemHash,
sessionUuid: '00000000-0000-0000-0000-000000000000',
performingUserUuid: '00000000-0000-0000-0000-000000000000',
isFreeUser: false,
})
expect(result.isFailed()).toBeTruthy()
mock.mockRestore()
@@ -508,7 +490,6 @@ describe('UpdateExistingItem', () => {
itemHash,
sessionUuid: '00000000-0000-0000-0000-000000000000',
performingUserUuid: '00000000-0000-0000-0000-000000000000',
isFreeUser: false,
})
expect(result.isFailed()).toBeTruthy()
})
@@ -540,7 +521,6 @@ describe('UpdateExistingItem', () => {
itemHash,
sessionUuid: '00000000-0000-0000-0000-000000000000',
performingUserUuid: '00000000-0000-0000-0000-000000000000',
isFreeUser: false,
})
expect(result.isFailed()).toBeTruthy()
})
@@ -575,7 +555,6 @@ describe('UpdateExistingItem', () => {
itemHash,
sessionUuid: '00000000-0000-0000-0000-000000000000',
performingUserUuid: '00000000-0000-0000-0000-000000000000',
isFreeUser: false,
})
expect(result.isFailed()).toBeTruthy()
@@ -597,7 +576,6 @@ describe('UpdateExistingItem', () => {
itemHash,
sessionUuid: '00000000-0000-0000-0000-000000000000',
performingUserUuid: '00000000-0000-0000-0000-000000000000',
isFreeUser: false,
})
expect(result.isFailed()).toBeTruthy()
})
@@ -617,7 +595,6 @@ describe('UpdateExistingItem', () => {
itemHash,
sessionUuid: '00000000-0000-0000-0000-000000000000',
performingUserUuid: '00000000-0000-0000-0000-000000000000',
isFreeUser: false,
})
expect(result.isFailed()).toBeFalsy()
expect(item1.props.keySystemAssociation).not.toBeUndefined()
@@ -639,7 +616,6 @@ describe('UpdateExistingItem', () => {
itemHash,
sessionUuid: '00000000-0000-0000-0000-000000000000',
performingUserUuid: '00000000-0000-0000-0000-000000000000',
isFreeUser: false,
})
expect(result.isFailed()).toBeFalsy()
@@ -660,7 +636,6 @@ describe('UpdateExistingItem', () => {
itemHash,
sessionUuid: '00000000-0000-0000-0000-000000000000',
performingUserUuid: '00000000-0000-0000-0000-000000000000',
isFreeUser: false,
})
expect(result.isFailed()).toBeTruthy()
})
@@ -683,7 +658,6 @@ describe('UpdateExistingItem', () => {
itemHash,
sessionUuid: '00000000-0000-0000-0000-000000000000',
performingUserUuid: '00000000-0000-0000-0000-000000000000',
isFreeUser: false,
})
expect(result.isFailed()).toBeTruthy()
mock.mockRestore()

View File

@@ -31,8 +31,7 @@ export class UpdateExistingItem implements UseCaseInterface<Item> {
private timer: TimerInterface,
private domainEventPublisher: DomainEventPublisherInterface,
private domainEventFactory: DomainEventFactoryInterface,
private freeRevisionFrequency: number,
private premiumRevisionFrequency: number,
private revisionFrequency: number,
private determineSharedVaultOperationOnItem: DetermineSharedVaultOperationOnItem,
private addNotificationForUsers: AddNotificationsForUsers,
private removeNotificationsForUser: RemoveNotificationsForUser,
@@ -170,10 +169,7 @@ export class UpdateExistingItem implements UseCaseInterface<Item> {
await this.itemRepository.update(dto.existingItem)
/* istanbul ignore next */
const revisionsFrequency = dto.isFreeUser ? this.freeRevisionFrequency : this.premiumRevisionFrequency
if (secondsFromLastUpdate >= revisionsFrequency) {
if (secondsFromLastUpdate >= this.revisionFrequency) {
if (
dto.existingItem.props.contentType.value !== null &&
[ContentType.TYPES.Note, ContentType.TYPES.File].includes(dto.existingItem.props.contentType.value)

View File

@@ -6,5 +6,4 @@ export interface UpdateExistingItemDTO {
itemHash: ItemHash
sessionUuid: string | null
performingUserUuid: string
isFreeUser: boolean
}

View File

@@ -70,7 +70,6 @@ export class BaseItemsController extends BaseHttpController {
readOnlyAccess: response.locals.readOnlyAccess,
sessionUuid: response.locals.session ? response.locals.session.uuid : null,
sharedVaultUuids,
isFreeUser: response.locals.isFreeUser,
})
if (syncResult.isFailed()) {
return this.json({ error: { message: syncResult.getError() } }, HttpStatusCode.BadRequest)

View File

@@ -3,7 +3,6 @@ import { BaseMiddleware } from 'inversify-express-utils'
import { verify } from 'jsonwebtoken'
import { CrossServiceTokenData } from '@standardnotes/security'
import * as winston from 'winston'
import { RoleName } from '@standardnotes/domain-core'
export class InversifyExpressAuthMiddleware extends BaseMiddleware {
constructor(
@@ -27,8 +26,6 @@ export class InversifyExpressAuthMiddleware extends BaseMiddleware {
response.locals.user = decodedToken.user
response.locals.roles = decodedToken.roles
response.locals.isFreeUser =
decodedToken.roles.length === 1 && decodedToken.roles[0].name === RoleName.NAMES.CoreUser
response.locals.session = decodedToken.session
response.locals.readOnlyAccess = decodedToken.session?.readonly_access ?? false
response.locals.sharedVaultOwnerContext = decodedToken.shared_vault_owner_context

View File

@@ -88,7 +88,6 @@ export class SyncingServer implements ISyncingServer {
readOnlyAccess: call.metadata.get('x-read-only-access').pop() === 'true',
sessionUuid: call.metadata.get('x-session-uuid').pop() as string,
sharedVaultUuids,
isFreeUser: call.metadata.get('x-is-free-user').pop() === 'true',
})
if (syncResult.isFailed()) {
const metadata = new grpc.Metadata()

View File

@@ -3,10 +3,6 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.22.2](https://github.com/standardnotes/server/compare/@standardnotes/websockets-server@1.22.1...@standardnotes/websockets-server@1.22.2) (2023-12-11)
**Note:** Version bump only for package @standardnotes/websockets-server
## [1.22.1](https://github.com/standardnotes/server/compare/@standardnotes/websockets-server@1.22.0...@standardnotes/websockets-server@1.22.1) (2023-12-07)
### Bug Fixes

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/websockets-server",
"version": "1.22.2",
"version": "1.22.1",
"engines": {
"node": ">=18.0.0 <21.0.0"
},