@volcanicminds/typeorm 2.3.0 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { QueryRunner } from 'typeorm';
|
|
2
2
|
export declare function isImplemented(): boolean;
|
|
3
|
-
export declare function synchronizeSchemas(): Promise<boolean>;
|
|
3
|
+
export declare function synchronizeSchemas(runner?: QueryRunner): Promise<boolean>;
|
|
4
4
|
export declare function retrieveBy(entityName: string, entityId: string, runner?: QueryRunner): Promise<any>;
|
|
5
|
-
export declare function addChange(entityName: string, entityId: string, status: string, userId: string, contents:
|
|
5
|
+
export declare function addChange(entityName: string, entityId: string, status: string, userId: string, contents: unknown, changeEntity?: string, runner?: QueryRunner): Promise<any>;
|
|
6
6
|
//# sourceMappingURL=dataBaseManager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataBaseManager.d.ts","sourceRoot":"","sources":["../../../lib/loader/dataBaseManager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dataBaseManager.d.ts","sourceRoot":"","sources":["../../../lib/loader/dataBaseManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAGrC,wBAAgB,aAAa,YAE5B;AAED,wBAAsB,kBAAkB,CAAC,MAAM,CAAC,EAAE,WAAW,oBAY5D;AAED,wBAAsB,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,gBAY1F;AAED,wBAAsB,SAAS,CAC7B,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,OAAO,EACjB,YAAY,SAAW,EACvB,MAAM,CAAC,EAAE,WAAW,gBAgBrB"}
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import * as log from '../util/logger.js';
|
|
2
|
-
import { ServiceError } from '../util/error.js';
|
|
3
2
|
export function isImplemented() {
|
|
4
3
|
return true;
|
|
5
4
|
}
|
|
6
|
-
export async function synchronizeSchemas() {
|
|
7
|
-
if (global.multiTenant?.enabled) {
|
|
8
|
-
throw new ServiceError('Schema synchronization is not supported in multi-tenant mode.', 400);
|
|
9
|
-
}
|
|
5
|
+
export async function synchronizeSchemas(runner) {
|
|
10
6
|
try {
|
|
11
|
-
|
|
7
|
+
if (runner) {
|
|
8
|
+
await runner.connection.synchronize();
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
await global.connection.synchronize();
|
|
12
|
+
}
|
|
12
13
|
return true;
|
|
13
14
|
}
|
|
14
15
|
catch (error) {
|
|
16
|
+
log.error(`Volcanic-TypeORM: ${error}`);
|
|
15
17
|
throw error;
|
|
16
18
|
}
|
|
17
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataBaseManager.js","sourceRoot":"","sources":["../../../lib/loader/dataBaseManager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dataBaseManager.js","sourceRoot":"","sources":["../../../lib/loader/dataBaseManager.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,GAAG,MAAM,mBAAmB,CAAA;AAExC,MAAM,UAAU,aAAa;IAC3B,OAAO,IAAI,CAAA;AACb,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,MAAoB;IAC3D,IAAI,CAAC;QACH,IAAI,MAAM,EAAE,CAAC;YACX,MAAM,MAAM,CAAC,UAAU,CAAC,WAAW,EAAE,CAAA;QACvC,CAAC;aAAM,CAAC;YACN,MAAM,MAAM,CAAC,UAAU,CAAC,WAAW,EAAE,CAAA;QACvC,CAAC;QACD,OAAO,IAAI,CAAA;IACb,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CAAC,KAAK,CAAC,qBAAqB,KAAK,EAAE,CAA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M,EAAE,QAAQ,EAAE,CAAC,CAAA;QAC9G,OAAO,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;IACpD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,CAAC,CAAC,YAAY,IAAI,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;YACrC,GAAG,CAAC,KAAK,CAAC,qBAAqB,YAAY,6BAA6B,CAAC,CAAA;QAC3E,CAAC;QACD,MAAM,KAAK,CAAA;IACb,CAAC;AACH,CAAC"}
|
|
@@ -1,22 +1,20 @@
|
|
|
1
|
-
/* eslint-disable no-useless-catch */
|
|
2
1
|
import { QueryRunner } from 'typeorm'
|
|
3
2
|
import * as log from '../util/logger.js'
|
|
4
|
-
import { ServiceError } from '../util/error.js'
|
|
5
3
|
|
|
6
4
|
export function isImplemented() {
|
|
7
5
|
return true
|
|
8
6
|
}
|
|
9
7
|
|
|
10
|
-
export async function synchronizeSchemas() {
|
|
11
|
-
// Block execution in multi-tenant mode to prevent partial schema updates
|
|
12
|
-
if ((global as any).multiTenant?.enabled) {
|
|
13
|
-
throw new ServiceError('Schema synchronization is not supported in multi-tenant mode.', 400)
|
|
14
|
-
}
|
|
15
|
-
|
|
8
|
+
export async function synchronizeSchemas(runner?: QueryRunner) {
|
|
16
9
|
try {
|
|
17
|
-
|
|
10
|
+
if (runner) {
|
|
11
|
+
await runner.connection.synchronize()
|
|
12
|
+
} else {
|
|
13
|
+
await global.connection.synchronize()
|
|
14
|
+
}
|
|
18
15
|
return true
|
|
19
16
|
} catch (error) {
|
|
17
|
+
log.error(`Volcanic-TypeORM: ${error}`)
|
|
20
18
|
throw error
|
|
21
19
|
}
|
|
22
20
|
}
|
|
@@ -40,7 +38,7 @@ export async function addChange(
|
|
|
40
38
|
entityId: string,
|
|
41
39
|
status: string,
|
|
42
40
|
userId: string,
|
|
43
|
-
contents:
|
|
41
|
+
contents: unknown,
|
|
44
42
|
changeEntity = 'Change',
|
|
45
43
|
runner?: QueryRunner
|
|
46
44
|
) {
|