diff --git a/.pnp.cjs b/.pnp.cjs index f55fb180b..e005bd5cf 100755 --- a/.pnp.cjs +++ b/.pnp.cjs @@ -5442,7 +5442,7 @@ const RAW_RUNTIME_STATE = ["prettier", "npm:2.8.8"],\ ["reflect-metadata", "npm:0.1.13"],\ ["ts-jest", "virtual:fd909b174d079e30b336c4ce72c38a88c1e447767b1a8dd7655e07719a1e31b97807f0931368724fc78897ff15e6a6d00b83316c0f76d11f85111f342e08bb79#npm:29.1.0"],\ - ["typeorm", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:0.3.16"],\ + ["typeorm", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:0.3.17"],\ ["typescript", "patch:typescript@npm%3A5.0.4#optional!builtin::version=5.0.4&hash=b5f058"],\ ["winston", "npm:3.9.0"]\ ],\ @@ -5572,7 +5572,7 @@ const RAW_RUNTIME_STATE = ["reflect-metadata", "npm:0.1.13"],\ ["sqlite3", "virtual:31b5a94a105c89c9294c3d524a7f8929fe63ee5a2efadf21951ca4c0cfd2ecf02e8f4ef5a066bbda091f1e3a56e57c6749069a080618c96b22e51131a330fc4a#npm:5.1.6"],\ ["ts-jest", "virtual:fd909b174d079e30b336c4ce72c38a88c1e447767b1a8dd7655e07719a1e31b97807f0931368724fc78897ff15e6a6d00b83316c0f76d11f85111f342e08bb79#npm:29.1.0"],\ - ["typeorm", "virtual:31b5a94a105c89c9294c3d524a7f8929fe63ee5a2efadf21951ca4c0cfd2ecf02e8f4ef5a066bbda091f1e3a56e57c6749069a080618c96b22e51131a330fc4a#npm:0.3.16"],\ + ["typeorm", "virtual:31b5a94a105c89c9294c3d524a7f8929fe63ee5a2efadf21951ca4c0cfd2ecf02e8f4ef5a066bbda091f1e3a56e57c6749069a080618c96b22e51131a330fc4a#npm:0.3.17"],\ ["typescript", "patch:typescript@npm%3A5.0.4#optional!builtin::version=5.0.4&hash=b5f058"],\ ["ua-parser-js", "npm:1.0.35"],\ ["uuid", "npm:9.0.0"],\ @@ -5697,7 +5697,7 @@ const RAW_RUNTIME_STATE = ["prettier", "npm:2.8.8"],\ ["reflect-metadata", "npm:0.1.13"],\ ["ts-jest", "virtual:fd909b174d079e30b336c4ce72c38a88c1e447767b1a8dd7655e07719a1e31b97807f0931368724fc78897ff15e6a6d00b83316c0f76d11f85111f342e08bb79#npm:29.1.0"],\ - ["typeorm", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:0.3.16"],\ + ["typeorm", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:0.3.17"],\ ["typescript", "patch:typescript@npm%3A5.0.4#optional!builtin::version=5.0.4&hash=b5f058"],\ ["winston", "npm:3.9.0"]\ ],\ @@ -5896,7 +5896,7 @@ const RAW_RUNTIME_STATE = ["reflect-metadata", "npm:0.1.13"],\ ["sqlite3", "virtual:31b5a94a105c89c9294c3d524a7f8929fe63ee5a2efadf21951ca4c0cfd2ecf02e8f4ef5a066bbda091f1e3a56e57c6749069a080618c96b22e51131a330fc4a#npm:5.1.6"],\ ["ts-jest", "virtual:fd909b174d079e30b336c4ce72c38a88c1e447767b1a8dd7655e07719a1e31b97807f0931368724fc78897ff15e6a6d00b83316c0f76d11f85111f342e08bb79#npm:29.1.0"],\ - ["typeorm", "virtual:365b8c88cdf194291829ee28b79556e2328175d26a621363e703848100bea0042e9500db2a1206c9bbc3a4a76a1d169639ef774b2ea3a1a98584a9936b58c6be#npm:0.3.16"],\ + ["typeorm", "virtual:365b8c88cdf194291829ee28b79556e2328175d26a621363e703848100bea0042e9500db2a1206c9bbc3a4a76a1d169639ef774b2ea3a1a98584a9936b58c6be#npm:0.3.17"],\ ["typescript", "patch:typescript@npm%3A5.0.4#optional!builtin::version=5.0.4&hash=b5f058"],\ ["winston", "npm:3.9.0"]\ ],\ @@ -5935,7 +5935,7 @@ const RAW_RUNTIME_STATE = ["prettier", "npm:2.8.8"],\ ["reflect-metadata", "npm:0.1.13"],\ ["ts-jest", "virtual:fd909b174d079e30b336c4ce72c38a88c1e447767b1a8dd7655e07719a1e31b97807f0931368724fc78897ff15e6a6d00b83316c0f76d11f85111f342e08bb79#npm:29.1.0"],\ - ["typeorm", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:0.3.16"],\ + ["typeorm", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:0.3.17"],\ ["typescript", "patch:typescript@npm%3A5.0.4#optional!builtin::version=5.0.4&hash=b5f058"],\ ["winston", "npm:3.9.0"]\ ],\ @@ -6094,7 +6094,7 @@ const RAW_RUNTIME_STATE = ["semver", "npm:7.5.1"],\ ["sqlite3", "virtual:31b5a94a105c89c9294c3d524a7f8929fe63ee5a2efadf21951ca4c0cfd2ecf02e8f4ef5a066bbda091f1e3a56e57c6749069a080618c96b22e51131a330fc4a#npm:5.1.6"],\ ["ts-jest", "virtual:fd909b174d079e30b336c4ce72c38a88c1e447767b1a8dd7655e07719a1e31b97807f0931368724fc78897ff15e6a6d00b83316c0f76d11f85111f342e08bb79#npm:29.1.0"],\ - ["typeorm", "virtual:365b8c88cdf194291829ee28b79556e2328175d26a621363e703848100bea0042e9500db2a1206c9bbc3a4a76a1d169639ef774b2ea3a1a98584a9936b58c6be#npm:0.3.16"],\ + ["typeorm", "virtual:365b8c88cdf194291829ee28b79556e2328175d26a621363e703848100bea0042e9500db2a1206c9bbc3a4a76a1d169639ef774b2ea3a1a98584a9936b58c6be#npm:0.3.17"],\ ["typescript", "patch:typescript@npm%3A5.0.4#optional!builtin::version=5.0.4&hash=b5f058"],\ ["ua-parser-js", "npm:1.0.35"],\ ["uuid", "npm:9.0.0"],\ @@ -6174,7 +6174,7 @@ const RAW_RUNTIME_STATE = ["prettier", "npm:2.8.8"],\ ["reflect-metadata", "npm:0.1.13"],\ ["ts-jest", "virtual:fd909b174d079e30b336c4ce72c38a88c1e447767b1a8dd7655e07719a1e31b97807f0931368724fc78897ff15e6a6d00b83316c0f76d11f85111f342e08bb79#npm:29.1.0"],\ - ["typeorm", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:0.3.16"],\ + ["typeorm", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:0.3.17"],\ ["typescript", "patch:typescript@npm%3A5.0.4#optional!builtin::version=5.0.4&hash=b5f058"],\ ["winston", "npm:3.9.0"]\ ],\ @@ -17059,17 +17059,17 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["typeorm", [\ - ["npm:0.3.16", {\ - "packageLocation": "./.yarn/cache/typeorm-npm-0.3.16-5ac12a7afc-19803f935e.zip/node_modules/typeorm/",\ + ["npm:0.3.17", {\ + "packageLocation": "./.yarn/cache/typeorm-npm-0.3.17-f8c2578e7f-bae071e097.zip/node_modules/typeorm/",\ "packageDependencies": [\ - ["typeorm", "npm:0.3.16"]\ + ["typeorm", "npm:0.3.17"]\ ],\ "linkType": "SOFT"\ }],\ - ["virtual:31b5a94a105c89c9294c3d524a7f8929fe63ee5a2efadf21951ca4c0cfd2ecf02e8f4ef5a066bbda091f1e3a56e57c6749069a080618c96b22e51131a330fc4a#npm:0.3.16", {\ - "packageLocation": "./.yarn/__virtual__/typeorm-virtual-3f6407120b/0/cache/typeorm-npm-0.3.16-5ac12a7afc-19803f935e.zip/node_modules/typeorm/",\ + ["virtual:31b5a94a105c89c9294c3d524a7f8929fe63ee5a2efadf21951ca4c0cfd2ecf02e8f4ef5a066bbda091f1e3a56e57c6749069a080618c96b22e51131a330fc4a#npm:0.3.17", {\ + "packageLocation": "./.yarn/__virtual__/typeorm-virtual-39f2df0bb4/0/cache/typeorm-npm-0.3.17-f8c2578e7f-bae071e097.zip/node_modules/typeorm/",\ "packageDependencies": [\ - ["typeorm", "virtual:31b5a94a105c89c9294c3d524a7f8929fe63ee5a2efadf21951ca4c0cfd2ecf02e8f4ef5a066bbda091f1e3a56e57c6749069a080618c96b22e51131a330fc4a#npm:0.3.16"],\ + ["typeorm", "virtual:31b5a94a105c89c9294c3d524a7f8929fe63ee5a2efadf21951ca4c0cfd2ecf02e8f4ef5a066bbda091f1e3a56e57c6749069a080618c96b22e51131a330fc4a#npm:0.3.17"],\ ["@google-cloud/spanner", null],\ ["@sap/hana-client", null],\ ["@sqltools/formatter", "npm:1.2.5"],\ @@ -17158,10 +17158,10 @@ const RAW_RUNTIME_STATE = ],\ "linkType": "HARD"\ }],\ - ["virtual:365b8c88cdf194291829ee28b79556e2328175d26a621363e703848100bea0042e9500db2a1206c9bbc3a4a76a1d169639ef774b2ea3a1a98584a9936b58c6be#npm:0.3.16", {\ - "packageLocation": "./.yarn/__virtual__/typeorm-virtual-6adc0d3ce7/0/cache/typeorm-npm-0.3.16-5ac12a7afc-19803f935e.zip/node_modules/typeorm/",\ + ["virtual:365b8c88cdf194291829ee28b79556e2328175d26a621363e703848100bea0042e9500db2a1206c9bbc3a4a76a1d169639ef774b2ea3a1a98584a9936b58c6be#npm:0.3.17", {\ + "packageLocation": "./.yarn/__virtual__/typeorm-virtual-bfb7ebf128/0/cache/typeorm-npm-0.3.17-f8c2578e7f-bae071e097.zip/node_modules/typeorm/",\ "packageDependencies": [\ - ["typeorm", "virtual:365b8c88cdf194291829ee28b79556e2328175d26a621363e703848100bea0042e9500db2a1206c9bbc3a4a76a1d169639ef774b2ea3a1a98584a9936b58c6be#npm:0.3.16"],\ + ["typeorm", "virtual:365b8c88cdf194291829ee28b79556e2328175d26a621363e703848100bea0042e9500db2a1206c9bbc3a4a76a1d169639ef774b2ea3a1a98584a9936b58c6be#npm:0.3.17"],\ ["@google-cloud/spanner", null],\ ["@sap/hana-client", null],\ ["@sqltools/formatter", "npm:1.2.5"],\ @@ -17250,10 +17250,10 @@ const RAW_RUNTIME_STATE = ],\ "linkType": "HARD"\ }],\ - ["virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:0.3.16", {\ - "packageLocation": "./.yarn/__virtual__/typeorm-virtual-fc9b7b780b/0/cache/typeorm-npm-0.3.16-5ac12a7afc-19803f935e.zip/node_modules/typeorm/",\ + ["virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:0.3.17", {\ + "packageLocation": "./.yarn/__virtual__/typeorm-virtual-bfa664706d/0/cache/typeorm-npm-0.3.17-f8c2578e7f-bae071e097.zip/node_modules/typeorm/",\ "packageDependencies": [\ - ["typeorm", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:0.3.16"],\ + ["typeorm", "virtual:c66bf20e88479ada0172094776519a9f51acc4731d22079b60a295bcec7ea42d5545cbce58a77a50d932bf953298799135e99707486e343da6d99ba1d167bdbd#npm:0.3.17"],\ ["@google-cloud/spanner", null],\ ["@sap/hana-client", null],\ ["@sqltools/formatter", "npm:1.2.5"],\ diff --git a/.yarn/cache/typeorm-npm-0.3.16-5ac12a7afc-19803f935e.zip b/.yarn/cache/typeorm-npm-0.3.17-f8c2578e7f-bae071e097.zip similarity index 96% rename from .yarn/cache/typeorm-npm-0.3.16-5ac12a7afc-19803f935e.zip rename to .yarn/cache/typeorm-npm-0.3.17-f8c2578e7f-bae071e097.zip index 8ce4c4d54..4b0a23621 100644 Binary files a/.yarn/cache/typeorm-npm-0.3.16-5ac12a7afc-19803f935e.zip and b/.yarn/cache/typeorm-npm-0.3.17-f8c2578e7f-bae071e097.zip differ diff --git a/packages/analytics/package.json b/packages/analytics/package.json index 180f0b8ae..66cb5de7e 100644 --- a/packages/analytics/package.json +++ b/packages/analytics/package.json @@ -53,7 +53,7 @@ "mixpanel": "^0.17.0", "mysql2": "^3.0.1", "reflect-metadata": "^0.1.13", - "typeorm": "^0.3.15", + "typeorm": "^0.3.17", "winston": "^3.8.1" }, "optionalDependencies": { diff --git a/packages/auth/package.json b/packages/auth/package.json index 33d112840..9a5cf4544 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -69,7 +69,7 @@ "prettyjson": "^1.2.5", "reflect-metadata": "0.1.13", "sqlite3": "^5.1.6", - "typeorm": "^0.3.15", + "typeorm": "^0.3.17", "ua-parser-js": "^1.0.35", "uuid": "^9.0.0", "winston": "^3.8.1" diff --git a/packages/event-store/package.json b/packages/event-store/package.json index 12265555d..e64a13be3 100644 --- a/packages/event-store/package.json +++ b/packages/event-store/package.json @@ -42,7 +42,7 @@ "ioredis": "^5.2.4", "mysql2": "^3.0.1", "reflect-metadata": "0.1.13", - "typeorm": "^0.3.15", + "typeorm": "^0.3.17", "winston": "^3.8.1" }, "optionalDependencies": { diff --git a/packages/revisions/package.json b/packages/revisions/package.json index d27fae62a..d94475714 100644 --- a/packages/revisions/package.json +++ b/packages/revisions/package.json @@ -45,7 +45,7 @@ "mysql2": "^3.0.1", "reflect-metadata": "0.1.13", "sqlite3": "^5.1.6", - "typeorm": "^0.3.15", + "typeorm": "^0.3.17", "winston": "^3.8.1" }, "devDependencies": { diff --git a/packages/revisions/src/Domain/Handler/ItemDumpedEventHandler.spec.ts b/packages/revisions/src/Domain/Handler/ItemDumpedEventHandler.spec.ts index 242f62310..a2a3d7984 100644 --- a/packages/revisions/src/Domain/Handler/ItemDumpedEventHandler.spec.ts +++ b/packages/revisions/src/Domain/Handler/ItemDumpedEventHandler.spec.ts @@ -22,7 +22,7 @@ describe('ItemDumpedEventHandler', () => { dumpRepository.removeDump = jest.fn() revisionRepository = {} as jest.Mocked - revisionRepository.save = jest.fn() + revisionRepository.insert = jest.fn() revisionRepositoryResolver = {} as jest.Mocked revisionRepositoryResolver.resolve = jest.fn().mockReturnValue(revisionRepository) @@ -37,7 +37,7 @@ describe('ItemDumpedEventHandler', () => { it('should save a revision from file dump', async () => { await createHandler().handle(event) - expect(revisionRepository.save).toHaveBeenCalled() + expect(revisionRepository.insert).toHaveBeenCalled() expect(dumpRepository.removeDump).toHaveBeenCalled() }) @@ -46,7 +46,7 @@ describe('ItemDumpedEventHandler', () => { await createHandler().handle(event) - expect(revisionRepository.save).not.toHaveBeenCalled() + expect(revisionRepository.insert).not.toHaveBeenCalled() expect(dumpRepository.removeDump).toHaveBeenCalled() }) @@ -55,7 +55,7 @@ describe('ItemDumpedEventHandler', () => { await createHandler().handle(event) - expect(revisionRepository.save).not.toHaveBeenCalled() + expect(revisionRepository.insert).not.toHaveBeenCalled() expect(dumpRepository.removeDump).toHaveBeenCalled() }) }) diff --git a/packages/revisions/src/Domain/Handler/ItemDumpedEventHandler.ts b/packages/revisions/src/Domain/Handler/ItemDumpedEventHandler.ts index cdfc9fdde..5038f2b83 100644 --- a/packages/revisions/src/Domain/Handler/ItemDumpedEventHandler.ts +++ b/packages/revisions/src/Domain/Handler/ItemDumpedEventHandler.ts @@ -28,7 +28,7 @@ export class ItemDumpedEventHandler implements DomainEventHandlerInterface { const revisionRepository = this.revisionRepositoryResolver.resolve(roleNames) - await revisionRepository.save(revision) + await revisionRepository.insert(revision) await this.dumpRepository.removeDump(event.payload.fileDumpPath) } diff --git a/packages/revisions/src/Domain/Revision/RevisionRepositoryInterface.ts b/packages/revisions/src/Domain/Revision/RevisionRepositoryInterface.ts index efe27fe62..f94798345 100644 --- a/packages/revisions/src/Domain/Revision/RevisionRepositoryInterface.ts +++ b/packages/revisions/src/Domain/Revision/RevisionRepositoryInterface.ts @@ -12,5 +12,5 @@ export interface RevisionRepositoryInterface { findMetadataByItemId(itemUuid: Uuid, userUuid: Uuid): Promise> updateUserUuid(itemUuid: Uuid, userUuid: Uuid): Promise findByUserUuid(dto: { userUuid: Uuid; offset?: number; limit?: number }): Promise> - save(revision: Revision): Promise + insert(revision: Revision): Promise } diff --git a/packages/revisions/src/Domain/UseCase/CopyRevisions/CopyRevisions.spec.ts b/packages/revisions/src/Domain/UseCase/CopyRevisions/CopyRevisions.spec.ts index e94c65573..96d397a87 100644 --- a/packages/revisions/src/Domain/UseCase/CopyRevisions/CopyRevisions.spec.ts +++ b/packages/revisions/src/Domain/UseCase/CopyRevisions/CopyRevisions.spec.ts @@ -13,7 +13,7 @@ describe('CopyRevisions', () => { beforeEach(() => { revisionRepository = {} as jest.Mocked revisionRepository.findByItemUuid = jest.fn().mockReturnValue([{} as jest.Mocked]) - revisionRepository.save = jest.fn() + revisionRepository.insert = jest.fn() revisionRepositoryResolver = {} as jest.Mocked revisionRepositoryResolver.resolve = jest.fn().mockReturnValue(revisionRepository) @@ -52,7 +52,7 @@ describe('CopyRevisions', () => { }) expect(result.isFailed()).toBeFalsy() - expect(revisionRepository.save).toHaveBeenCalled() + expect(revisionRepository.insert).toHaveBeenCalled() expect(result.getValue()).toEqual('Revisions copied') }) diff --git a/packages/revisions/src/Domain/UseCase/CopyRevisions/CopyRevisions.ts b/packages/revisions/src/Domain/UseCase/CopyRevisions/CopyRevisions.ts index 4d37f9aa9..10f3a540b 100644 --- a/packages/revisions/src/Domain/UseCase/CopyRevisions/CopyRevisions.ts +++ b/packages/revisions/src/Domain/UseCase/CopyRevisions/CopyRevisions.ts @@ -43,7 +43,7 @@ export class CopyRevisions implements UseCaseInterface { const revisionCopy = revisionCopyOrError.getValue() - await revisionRepository.save(revisionCopy) + await revisionRepository.insert(revisionCopy) } return Result.ok('Revisions copied') diff --git a/packages/revisions/src/Domain/UseCase/Transition/TransitionRevisionsFromPrimaryToSecondaryDatabaseForUser/TransitionRevisionsFromPrimaryToSecondaryDatabaseForUser.spec.ts b/packages/revisions/src/Domain/UseCase/Transition/TransitionRevisionsFromPrimaryToSecondaryDatabaseForUser/TransitionRevisionsFromPrimaryToSecondaryDatabaseForUser.spec.ts index 4e6195499..79cc97eee 100644 --- a/packages/revisions/src/Domain/UseCase/Transition/TransitionRevisionsFromPrimaryToSecondaryDatabaseForUser/TransitionRevisionsFromPrimaryToSecondaryDatabaseForUser.spec.ts +++ b/packages/revisions/src/Domain/UseCase/Transition/TransitionRevisionsFromPrimaryToSecondaryDatabaseForUser/TransitionRevisionsFromPrimaryToSecondaryDatabaseForUser.spec.ts @@ -96,7 +96,7 @@ describe('TransitionRevisionsFromPrimaryToSecondaryDatabaseForUser', () => { primaryRevisionRepository.removeByUserUuid = jest.fn().mockResolvedValue(undefined) secondaryRevisionRepository = {} as jest.Mocked - secondaryRevisionRepository.save = jest.fn().mockResolvedValue(true) + secondaryRevisionRepository.insert = jest.fn().mockResolvedValue(true) secondaryRevisionRepository.removeByUserUuid = jest.fn().mockResolvedValue(undefined) secondaryRevisionRepository.countByUserUuid = jest.fn().mockResolvedValue(2) secondaryRevisionRepository.findOneByUuid = jest @@ -155,9 +155,9 @@ describe('TransitionRevisionsFromPrimaryToSecondaryDatabaseForUser', () => { limit: 1, offset: 1, }) - expect((secondaryRevisionRepository as RevisionRepositoryInterface).save).toHaveBeenCalledTimes(2) - expect((secondaryRevisionRepository as RevisionRepositoryInterface).save).toHaveBeenCalledWith(primaryRevision1) - expect((secondaryRevisionRepository as RevisionRepositoryInterface).save).toHaveBeenCalledWith(primaryRevision2) + expect((secondaryRevisionRepository as RevisionRepositoryInterface).insert).toHaveBeenCalledTimes(2) + expect((secondaryRevisionRepository as RevisionRepositoryInterface).insert).toHaveBeenCalledWith(primaryRevision1) + expect((secondaryRevisionRepository as RevisionRepositoryInterface).insert).toHaveBeenCalledWith(primaryRevision2) expect((secondaryRevisionRepository as RevisionRepositoryInterface).removeByUserUuid).not.toHaveBeenCalled() expect(primaryRevisionRepository.removeByUserUuid).toHaveBeenCalledTimes(1) }) @@ -229,7 +229,7 @@ describe('TransitionRevisionsFromPrimaryToSecondaryDatabaseForUser', () => { }) it('should return an error for a specific revision if it errors when saving to secondary database', async () => { - ;(secondaryRevisionRepository as RevisionRepositoryInterface).save = jest + ;(secondaryRevisionRepository as RevisionRepositoryInterface).insert = jest .fn() .mockResolvedValueOnce(true) .mockRejectedValueOnce(new Error('error')) @@ -395,7 +395,7 @@ describe('TransitionRevisionsFromPrimaryToSecondaryDatabaseForUser', () => { }) it('should fail if a revisions did not save in the secondary database', async () => { - ;(secondaryRevisionRepository as RevisionRepositoryInterface).save = jest.fn().mockResolvedValue(false) + ;(secondaryRevisionRepository as RevisionRepositoryInterface).insert = jest.fn().mockResolvedValue(false) const useCase = createUseCase() diff --git a/packages/revisions/src/Domain/UseCase/Transition/TransitionRevisionsFromPrimaryToSecondaryDatabaseForUser/TransitionRevisionsFromPrimaryToSecondaryDatabaseForUser.ts b/packages/revisions/src/Domain/UseCase/Transition/TransitionRevisionsFromPrimaryToSecondaryDatabaseForUser/TransitionRevisionsFromPrimaryToSecondaryDatabaseForUser.ts index 0ed50bd32..7a37eaf63 100644 --- a/packages/revisions/src/Domain/UseCase/Transition/TransitionRevisionsFromPrimaryToSecondaryDatabaseForUser/TransitionRevisionsFromPrimaryToSecondaryDatabaseForUser.ts +++ b/packages/revisions/src/Domain/UseCase/Transition/TransitionRevisionsFromPrimaryToSecondaryDatabaseForUser/TransitionRevisionsFromPrimaryToSecondaryDatabaseForUser.ts @@ -90,7 +90,7 @@ export class TransitionRevisionsFromPrimaryToSecondaryDatabaseForUser implements for (const revision of revisions) { try { - const didSave = await (this.secondRevisionsRepository as RevisionRepositoryInterface).save(revision) + const didSave = await (this.secondRevisionsRepository as RevisionRepositoryInterface).insert(revision) if (!didSave) { return Result.fail(`Failed to save revision ${revision.id.toString()} to secondary database`) } diff --git a/packages/revisions/src/Infra/TypeORM/MongoDB/MongoDBRevisionRepository.ts b/packages/revisions/src/Infra/TypeORM/MongoDB/MongoDBRevisionRepository.ts index 91009752a..b88a08646 100644 --- a/packages/revisions/src/Infra/TypeORM/MongoDB/MongoDBRevisionRepository.ts +++ b/packages/revisions/src/Infra/TypeORM/MongoDB/MongoDBRevisionRepository.ts @@ -123,19 +123,11 @@ export class MongoDBRevisionRepository implements RevisionRepositoryInterface { ) } - async save(revision: Revision): Promise { + async insert(revision: Revision): Promise { const persistence = this.revisionMapper.toProjection(revision) - const { _id, ...rest } = persistence + const insertResult = await this.mongoRepository.insertOne(persistence) - const updateResult = await this.mongoRepository.updateOne( - { _id: { $eq: _id } }, - { - $set: rest, - }, - { upsert: true }, - ) - - return updateResult.acknowledged + return insertResult.acknowledged } } diff --git a/packages/revisions/src/Infra/TypeORM/SQL/SQLRevisionRepository.ts b/packages/revisions/src/Infra/TypeORM/SQL/SQLRevisionRepository.ts index c89684d10..2a503cc4e 100644 --- a/packages/revisions/src/Infra/TypeORM/SQL/SQLRevisionRepository.ts +++ b/packages/revisions/src/Infra/TypeORM/SQL/SQLRevisionRepository.ts @@ -106,10 +106,10 @@ export class SQLRevisionRepository implements RevisionRepositoryInterface { return this.revisionMapper.toDomain(SQLRevision) } - async save(revision: Revision): Promise { + async insert(revision: Revision): Promise { const SQLRevision = this.revisionMapper.toProjection(revision) - await this.ormRepository.save(SQLRevision) + await this.ormRepository.insert(SQLRevision) return true } diff --git a/packages/scheduler/package.json b/packages/scheduler/package.json index 4bc0cf99d..034f3ab44 100644 --- a/packages/scheduler/package.json +++ b/packages/scheduler/package.json @@ -37,7 +37,7 @@ "ioredis": "^5.2.4", "mysql2": "^3.0.1", "reflect-metadata": "^0.1.13", - "typeorm": "^0.3.15", + "typeorm": "^0.3.17", "winston": "^3.8.1" }, "devDependencies": { diff --git a/packages/syncing-server/package.json b/packages/syncing-server/package.json index b7b59e712..d11a86c61 100644 --- a/packages/syncing-server/package.json +++ b/packages/syncing-server/package.json @@ -56,7 +56,7 @@ "reflect-metadata": "0.1.13", "semver": "^7.5.1", "sqlite3": "^5.1.6", - "typeorm": "^0.3.15", + "typeorm": "^0.3.17", "ua-parser-js": "^1.0.35", "uuid": "^9.0.0", "winston": "^3.8.1" diff --git a/packages/websockets/package.json b/packages/websockets/package.json index b5a327542..b1e7428d8 100644 --- a/packages/websockets/package.json +++ b/packages/websockets/package.json @@ -39,7 +39,7 @@ "ioredis": "^5.2.4", "mysql2": "^3.0.1", "reflect-metadata": "0.1.13", - "typeorm": "^0.3.15", + "typeorm": "^0.3.17", "winston": "^3.8.1" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index 5399ea191..f537f41b7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4309,7 +4309,7 @@ __metadata: prettier: "npm:^2.8.8" reflect-metadata: "npm:^0.1.13" ts-jest: "npm:^29.1.0" - typeorm: "npm:^0.3.15" + typeorm: "npm:^0.3.17" typescript: "npm:^5.0.4" winston: "npm:^3.8.1" dependenciesMeta: @@ -4448,7 +4448,7 @@ __metadata: reflect-metadata: "npm:0.1.13" sqlite3: "npm:^5.1.6" ts-jest: "npm:^29.1.0" - typeorm: "npm:^0.3.15" + typeorm: "npm:^0.3.17" typescript: "npm:^5.0.4" ua-parser-js: "npm:^1.0.35" uuid: "npm:^9.0.0" @@ -4575,7 +4575,7 @@ __metadata: prettier: "npm:^2.8.8" reflect-metadata: "npm:0.1.13" ts-jest: "npm:^29.1.0" - typeorm: "npm:^0.3.15" + typeorm: "npm:^0.3.17" typescript: "npm:^5.0.4" winston: "npm:^3.8.1" dependenciesMeta: @@ -4773,7 +4773,7 @@ __metadata: reflect-metadata: "npm:0.1.13" sqlite3: "npm:^5.1.6" ts-jest: "npm:^29.1.0" - typeorm: "npm:^0.3.15" + typeorm: "npm:^0.3.17" typescript: "npm:^5.0.4" winston: "npm:^3.8.1" dependenciesMeta: @@ -4817,7 +4817,7 @@ __metadata: prettier: "npm:^2.8.8" reflect-metadata: "npm:^0.1.13" ts-jest: "npm:^29.1.0" - typeorm: "npm:^0.3.15" + typeorm: "npm:^0.3.17" typescript: "npm:^5.0.4" winston: "npm:^3.8.1" dependenciesMeta: @@ -4977,7 +4977,7 @@ __metadata: semver: "npm:^7.5.1" sqlite3: "npm:^5.1.6" ts-jest: "npm:^29.1.0" - typeorm: "npm:^0.3.15" + typeorm: "npm:^0.3.17" typescript: "npm:^5.0.4" ua-parser-js: "npm:^1.0.35" uuid: "npm:^9.0.0" @@ -5059,7 +5059,7 @@ __metadata: prettier: "npm:^2.8.8" reflect-metadata: "npm:0.1.13" ts-jest: "npm:^29.1.0" - typeorm: "npm:^0.3.15" + typeorm: "npm:^0.3.17" typescript: "npm:^5.0.4" winston: "npm:^3.8.1" dependenciesMeta: @@ -14508,9 +14508,9 @@ __metadata: languageName: node linkType: hard -"typeorm@npm:^0.3.15": - version: 0.3.16 - resolution: "typeorm@npm:0.3.16" +"typeorm@npm:^0.3.17": + version: 0.3.17 + resolution: "typeorm@npm:0.3.17" dependencies: "@sqltools/formatter": "npm:^1.2.5" app-root-path: "npm:^3.1.0" @@ -14584,7 +14584,7 @@ __metadata: typeorm: cli.js typeorm-ts-node-commonjs: cli-ts-node-commonjs.js typeorm-ts-node-esm: cli-ts-node-esm.js - checksum: 19803f935e2733982d04d505226092aa6aa109d233b5616f7c87d2acc578647590514c1580ff611499846bdfb90d901f388fd1700717bf0d4d36482fcdfa4304 + checksum: bae071e0974f5befaec4238be2056f6c27858ac68713118be242759cc3321f469da55b544f0b16306fe48cc4d178ce4ba86628853dfb5403fb23c37b8a935817 languageName: node linkType: hard