Compare commits

..

2 Commits

17 changed files with 46 additions and 38 deletions

View File

@@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.141.2](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.141.1...@standardnotes/auth-server@1.141.2) (2023-09-11)
### Bug Fixes
* **auth:** remove transitioning upon sign out ([#819](https://github.com/standardnotes/server/issues/819)) ([330bff0](https://github.com/standardnotes/server/commit/330bff0124f5f49c3441304d166ea43c21fea7bc))
## [1.141.1](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.141.0...@standardnotes/auth-server@1.141.1) (2023-09-11)
### Bug Fixes

View File

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

View File

@@ -983,7 +983,6 @@ export class ContainerConfigLoader {
container.get(TYPES.Auth_GenerateRecoveryCodes),
container.get(TYPES.Auth_Logger),
container.get(TYPES.Auth_SessionService),
container.get(TYPES.Auth_TRANSITION_MODE_ENABLED),
),
)
container

View File

@@ -27,7 +27,6 @@ describe('AuthController', () => {
let doGenerateRecoveryCodes: GenerateRecoveryCodes
let logger: Logger
let sessionService: SessionServiceInterface
let transitionModeEnabled: boolean
const createController = () =>
new AuthController(
@@ -40,7 +39,6 @@ describe('AuthController', () => {
doGenerateRecoveryCodes,
logger,
sessionService,
transitionModeEnabled,
)
beforeEach(() => {
@@ -66,8 +64,6 @@ describe('AuthController', () => {
sessionService = {} as jest.Mocked<SessionServiceInterface>
sessionService.deleteSessionByToken = jest.fn().mockReturnValue('1-2-3')
transitionModeEnabled = false
})
it('should register a user', async () => {

View File

@@ -37,7 +37,6 @@ export class AuthController implements UserServerInterface {
private doGenerateRecoveryCodes: GenerateRecoveryCodes,
private logger: Logger,
private sessionService: SessionServiceInterface,
private transitionModeEnabled: boolean,
) {}
async update(_params: UserUpdateRequestParams): Promise<HttpResponse<UserUpdateResponse>> {
@@ -227,14 +226,6 @@ export class AuthController implements UserServerInterface {
let headers = undefined
if (userUuid !== null) {
headers = new Map([['x-invalidate-cache', userUuid]])
if (this.transitionModeEnabled) {
await this.domainEventPublisher.publish(
this.domainEventFactory.createTransitionRequestedEvent({
userUuid,
}),
)
}
}
return {

View File

@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.15.35](https://github.com/standardnotes/server/compare/@standardnotes/home-server@1.15.34...@standardnotes/home-server@1.15.35) (2023-09-11)
**Note:** Version bump only for package @standardnotes/home-server
## [1.15.34](https://github.com/standardnotes/server/compare/@standardnotes/home-server@1.15.33...@standardnotes/home-server@1.15.34) (2023-09-11)
**Note:** Version bump only for package @standardnotes/home-server

View File

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

View File

@@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.33.7](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.33.6...@standardnotes/revisions-server@1.33.7) (2023-09-11)
### Bug Fixes
* **auth:** remove transitioning upon sign out ([#819](https://github.com/standardnotes/server/issues/819)) ([330bff0](https://github.com/standardnotes/server/commit/330bff0124f5f49c3441304d166ea43c21fea7bc))
## [1.33.6](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.33.5...@standardnotes/revisions-server@1.33.6) (2023-09-11)
### Bug Fixes

View File

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

View File

@@ -350,6 +350,7 @@ export class ContainerConfigLoader {
: null,
container.get<TimerInterface>(TYPES.Revisions_Timer),
container.get<winston.Logger>(TYPES.Revisions_Logger),
env.get('MIGRATION_BATCH_SIZE', true) ? +env.get('MIGRATION_BATCH_SIZE', true) : 100,
),
)
container

View File

@@ -22,6 +22,7 @@ describe('TransitionRevisionsFromPrimaryToSecondaryDatabaseForUser', () => {
secondaryRevisionRepository,
timer,
logger,
1,
)
beforeEach(() => {

View File

@@ -11,6 +11,7 @@ export class TransitionRevisionsFromPrimaryToSecondaryDatabaseForUser implements
private secondRevisionsRepository: RevisionRepositoryInterface | null,
private timer: TimerInterface,
private logger: Logger,
private pageSize: number,
) {}
async execute(dto: TransitionRevisionsFromPrimaryToSecondaryDatabaseForUserDTO): Promise<Result<void>> {
@@ -83,13 +84,12 @@ export class TransitionRevisionsFromPrimaryToSecondaryDatabaseForUser implements
try {
const totalRevisionsCountForUser = await this.primaryRevisionsRepository.countByUserUuid(userUuid)
let totalRevisionsCountTransitionedToSecondary = 0
const pageSize = 1
const totalPages = Math.ceil(totalRevisionsCountForUser / pageSize)
const totalPages = Math.ceil(totalRevisionsCountForUser / this.pageSize)
for (let currentPage = 1; currentPage <= totalPages; currentPage++) {
const query = {
userUuid: userUuid,
offset: (currentPage - 1) * pageSize,
limit: pageSize,
offset: (currentPage - 1) * this.pageSize,
limit: this.pageSize,
}
const revisions = await this.primaryRevisionsRepository.findByUserUuid(query)
@@ -153,13 +153,12 @@ export class TransitionRevisionsFromPrimaryToSecondaryDatabaseForUser implements
try {
const totalRevisionsCountForUserInPrimary = await this.primaryRevisionsRepository.countByUserUuid(userUuid)
const pageSize = 1
const totalPages = Math.ceil(totalRevisionsCountForUserInPrimary / pageSize)
const totalPages = Math.ceil(totalRevisionsCountForUserInPrimary / this.pageSize)
for (let currentPage = 1; currentPage <= totalPages; currentPage++) {
const query = {
userUuid: userUuid,
offset: (currentPage - 1) * pageSize,
limit: pageSize,
offset: (currentPage - 1) * this.pageSize,
limit: this.pageSize,
}
const revisions = await this.primaryRevisionsRepository.findByUserUuid(query)

View File

@@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.95.2](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.95.1...@standardnotes/syncing-server@1.95.2) (2023-09-11)
### Bug Fixes
* **auth:** remove transitioning upon sign out ([#819](https://github.com/standardnotes/syncing-server-js/issues/819)) ([330bff0](https://github.com/standardnotes/syncing-server-js/commit/330bff0124f5f49c3441304d166ea43c21fea7bc))
## [1.95.1](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.95.0...@standardnotes/syncing-server@1.95.1) (2023-09-11)
### Bug Fixes

View File

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

View File

@@ -833,6 +833,7 @@ export class ContainerConfigLoader {
isSecondaryDatabaseEnabled ? container.get<ItemRepositoryInterface>(TYPES.Sync_MongoDBItemRepository) : null,
container.get<TimerInterface>(TYPES.Sync_Timer),
container.get<Logger>(TYPES.Sync_Logger),
env.get('MIGRATION_BATCH_SIZE', true) ? +env.get('MIGRATION_BATCH_SIZE', true) : 100,
),
)
container

View File

@@ -22,6 +22,7 @@ describe('TransitionItemsFromPrimaryToSecondaryDatabaseForUser', () => {
secondaryItemRepository,
timer,
logger,
1,
)
beforeEach(() => {

View File

@@ -12,6 +12,7 @@ export class TransitionItemsFromPrimaryToSecondaryDatabaseForUser implements Use
private secondaryItemRepository: ItemRepositoryInterface | null,
private timer: TimerInterface,
private logger: Logger,
private pageSize: number,
) {}
async execute(dto: TransitionItemsFromPrimaryToSecondaryDatabaseForUserDTO): Promise<Result<void>> {
@@ -92,14 +93,12 @@ export class TransitionItemsFromPrimaryToSecondaryDatabaseForUser implements Use
private async migrateItemsForUser(userUuid: Uuid): Promise<Result<void>> {
try {
const totalItemsCountForUser = await this.primaryItemRepository.countAll({ userUuid: userUuid.value })
const pageSize = 1
const totalPages = totalItemsCountForUser
let currentPage = 1
for (currentPage; currentPage <= totalPages; currentPage++) {
const totalPages = Math.ceil(totalItemsCountForUser / this.pageSize)
for (let currentPage = 1; currentPage <= totalPages; currentPage++) {
const query: ItemQuery = {
userUuid: userUuid.value,
offset: currentPage - 1,
limit: pageSize,
offset: (currentPage - 1) * this.pageSize,
limit: this.pageSize,
}
const items = await this.primaryItemRepository.findAll(query)
@@ -140,14 +139,12 @@ export class TransitionItemsFromPrimaryToSecondaryDatabaseForUser implements Use
)
}
const pageSize = 1
const totalPages = totalItemsCountForUserInPrimary
let currentPage = 1
for (currentPage; currentPage <= totalPages; currentPage++) {
const totalPages = Math.ceil(totalItemsCountForUserInPrimary / this.pageSize)
for (let currentPage = 1; currentPage <= totalPages; currentPage++) {
const query: ItemQuery = {
userUuid: userUuid.value,
offset: currentPage - 1,
limit: pageSize,
offset: (currentPage - 1) * this.pageSize,
limit: this.pageSize,
}
const items = await this.primaryItemRepository.findAll(query)