@contember/engine-system-api 1.2.1 → 1.3.0-alpha.2
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.
- package/dist/src/SystemContainer.d.ts +1 -12
- package/dist/src/SystemContainer.d.ts.map +1 -1
- package/dist/src/SystemContainer.js +1 -6
- package/dist/src/SystemContainer.js.map +1 -1
- package/dist/src/bin/runMigrations.d.ts +2 -0
- package/dist/src/bin/runMigrations.d.ts.map +1 -0
- package/dist/src/bin/runMigrations.js +31 -0
- package/dist/src/bin/runMigrations.js.map +1 -0
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -3
- package/dist/src/index.js.map +1 -1
- package/dist/src/migrations/2018-08-04-102200-init.d.ts +3 -0
- package/dist/src/migrations/2018-08-04-102200-init.d.ts.map +1 -0
- package/dist/src/migrations/2018-08-04-102200-init.js +37 -0
- package/dist/src/migrations/2018-08-04-102200-init.js.map +1 -0
- package/dist/src/migrations/2018-08-05-130501-trigger-event-function.d.ts +3 -0
- package/dist/src/migrations/2018-08-05-130501-trigger-event-function.d.ts.map +1 -0
- package/dist/src/migrations/2018-08-05-130501-trigger-event-function.js +99 -0
- package/dist/src/migrations/2018-08-05-130501-trigger-event-function.js.map +1 -0
- package/dist/src/migrations/2019-01-14-143432-event-trx-id.d.ts +3 -0
- package/dist/src/migrations/2019-01-14-143432-event-trx-id.d.ts.map +1 -0
- package/dist/src/migrations/2019-01-14-143432-event-trx-id.js +17 -0
- package/dist/src/migrations/2019-01-14-143432-event-trx-id.js.map +1 -0
- package/dist/src/migrations/2019-02-04-154500-event-rebase.d.ts +3 -0
- package/dist/src/migrations/2019-02-04-154500-event-rebase.d.ts.map +1 -0
- package/dist/src/migrations/2019-02-04-154500-event-rebase.js +59 -0
- package/dist/src/migrations/2019-02-04-154500-event-rebase.js.map +1 -0
- package/dist/src/migrations/2019-03-18-104147-event-run-migration-struct.d.ts +3 -0
- package/dist/src/migrations/2019-03-18-104147-event-run-migration-struct.d.ts.map +1 -0
- package/dist/src/migrations/2019-03-18-104147-event-run-migration-struct.js +12 -0
- package/dist/src/migrations/2019-03-18-104147-event-run-migration-struct.js.map +1 -0
- package/dist/src/migrations/2019-07-29-103000-trigger-event-function-fix.d.ts +3 -0
- package/dist/src/migrations/2019-07-29-103000-trigger-event-function-fix.d.ts.map +1 -0
- package/dist/src/migrations/2019-07-29-103000-trigger-event-function-fix.js +66 -0
- package/dist/src/migrations/2019-07-29-103000-trigger-event-function-fix.js.map +1 -0
- package/dist/src/migrations/2019-11-28-100000-missing-setting-fallback.d.ts +3 -0
- package/dist/src/migrations/2019-11-28-100000-missing-setting-fallback.d.ts.map +1 -0
- package/dist/src/migrations/2019-11-28-100000-missing-setting-fallback.js +21 -0
- package/dist/src/migrations/2019-11-28-100000-missing-setting-fallback.js.map +1 -0
- package/dist/src/migrations/2021-03-23-110000-timestamp-fix.d.ts +3 -0
- package/dist/src/migrations/2021-03-23-110000-timestamp-fix.d.ts.map +1 -0
- package/dist/src/migrations/2021-03-23-110000-timestamp-fix.js +15 -0
- package/dist/src/migrations/2021-03-23-110000-timestamp-fix.js.map +1 -0
- package/dist/src/migrations/2021-05-07-155800-event-log-rework.js +2 -2
- package/dist/src/migrations/2021-12-21-155500-events-up.d.ts +3 -0
- package/dist/src/migrations/2021-12-21-155500-events-up.d.ts.map +1 -0
- package/dist/src/migrations/2021-12-21-155500-events-up.js +15 -0
- package/dist/src/migrations/2021-12-21-155500-events-up.js.map +1 -0
- package/dist/src/migrations/2022-02-08-132600-fn-search-path.d.ts +3 -0
- package/dist/src/migrations/2022-02-08-132600-fn-search-path.d.ts.map +1 -0
- package/dist/src/migrations/2022-02-08-132600-fn-search-path.js +16 -0
- package/dist/src/migrations/2022-02-08-132600-fn-search-path.js.map +1 -0
- package/dist/src/migrations/2022-02-08-140500-drop-deadcode.d.ts +3 -0
- package/dist/src/migrations/2022-02-08-140500-drop-deadcode.d.ts.map +1 -0
- package/dist/src/migrations/2022-02-08-140500-drop-deadcode.js +11 -0
- package/dist/src/migrations/2022-02-08-140500-drop-deadcode.js.map +1 -0
- package/dist/src/migrations/2022-02-08-144400-dynamic-stage-schema.d.ts +3 -0
- package/dist/src/migrations/2022-02-08-144400-dynamic-stage-schema.d.ts.map +1 -0
- package/dist/src/migrations/2022-02-08-144400-dynamic-stage-schema.js +50 -0
- package/dist/src/migrations/2022-02-08-144400-dynamic-stage-schema.js.map +1 -0
- package/dist/src/migrations/2022-10-03-110000-table-on-delete.d.ts +4 -0
- package/dist/src/migrations/2022-10-03-110000-table-on-delete.d.ts.map +1 -0
- package/dist/src/migrations/2022-10-03-110000-table-on-delete.js +56 -0
- package/dist/src/migrations/2022-10-03-110000-table-on-delete.js.map +1 -0
- package/dist/src/migrations/runner.d.ts +16 -3
- package/dist/src/migrations/runner.d.ts.map +1 -1
- package/dist/src/migrations/runner.js +64 -10
- package/dist/src/migrations/runner.js.map +1 -1
- package/dist/src/migrations/snapshot-factory.d.ts +6 -0
- package/dist/src/migrations/snapshot-factory.d.ts.map +1 -0
- package/dist/src/migrations/snapshot-factory.js +46 -0
- package/dist/src/migrations/snapshot-factory.js.map +1 -0
- package/dist/src/migrations/snapshot.d.ts +3 -0
- package/dist/src/migrations/snapshot.d.ts.map +1 -0
- package/dist/src/migrations/snapshot.js +172 -0
- package/dist/src/migrations/snapshot.js.map +1 -0
- package/dist/src/model/ProjectInitializer.d.ts +6 -10
- package/dist/src/model/ProjectInitializer.d.ts.map +1 -1
- package/dist/src/model/ProjectInitializer.js +11 -29
- package/dist/src/model/ProjectInitializer.js.map +1 -1
- package/dist/src/model/database/DatabaseContext.d.ts +5 -4
- package/dist/src/model/database/DatabaseContext.d.ts.map +1 -1
- package/dist/src/model/database/DatabaseContext.js +7 -7
- package/dist/src/model/database/DatabaseContext.js.map +1 -1
- package/dist/src/model/dtos/ExecutedMigration.d.ts +2 -1
- package/dist/src/model/dtos/ExecutedMigration.d.ts.map +1 -1
- package/dist/src/model/dtos/ExecutedMigration.js +2 -1
- package/dist/src/model/dtos/ExecutedMigration.js.map +1 -1
- package/dist/src/model/events/EventResponseBuilder.d.ts +2 -2
- package/dist/src/model/events/EventResponseBuilder.d.ts.map +1 -1
- package/dist/src/model/events/EventResponseBuilder.js +10 -10
- package/dist/src/model/events/EventResponseBuilder.js.map +1 -1
- package/dist/src/model/events/EventResponseHelper.d.ts +1 -1
- package/dist/src/model/events/EventResponseHelper.d.ts.map +1 -1
- package/dist/src/model/events/index.d.ts +1 -0
- package/dist/src/model/events/index.d.ts.map +1 -1
- package/dist/src/model/events/index.js +1 -0
- package/dist/src/model/events/index.js.map +1 -1
- package/dist/src/model/events/types.d.ts +56 -0
- package/dist/src/model/events/types.d.ts.map +1 -0
- package/dist/src/model/events/types.js +51 -0
- package/dist/src/model/events/types.js.map +1 -0
- package/dist/src/model/helpers/index.d.ts +0 -1
- package/dist/src/model/helpers/index.d.ts.map +1 -1
- package/dist/src/model/helpers/index.js +0 -1
- package/dist/src/model/helpers/index.js.map +1 -1
- package/dist/src/model/migrations/ProjectMigrator.js +1 -1
- package/dist/src/model/migrations/ProjectMigrator.js.map +1 -1
- package/dist/src/model/migrations/SchemaVersionBuilder.d.ts +18 -0
- package/dist/src/model/migrations/SchemaVersionBuilder.d.ts.map +1 -1
- package/dist/src/model/migrations/SchemaVersionBuilder.js +5 -4
- package/dist/src/model/migrations/SchemaVersionBuilder.js.map +1 -1
- package/dist/src/model/queries/events/EventQueryHelpers.d.ts +2 -2
- package/dist/src/model/queries/events/EventQueryHelpers.d.ts.map +1 -1
- package/dist/src/model/queries/events/EventQueryHelpers.js +7 -7
- package/dist/src/model/queries/events/EventQueryHelpers.js.map +1 -1
- package/dist/src/model/queries/events/EventsQuery.d.ts +2 -2
- package/dist/src/model/queries/events/EventsQuery.d.ts.map +1 -1
- package/dist/src/model/queries/events/EventsQuery.js.map +1 -1
- package/dist/src/model/queries/migrations/ExecutedMigrationsQueryHelper.d.ts +1 -0
- package/dist/src/model/queries/migrations/ExecutedMigrationsQueryHelper.d.ts.map +1 -1
- package/dist/src/model/queries/migrations/ExecutedMigrationsQueryHelper.js +2 -1
- package/dist/src/model/queries/migrations/ExecutedMigrationsQueryHelper.js.map +1 -1
- package/dist/src/tsconfig.tsbuildinfo +1 -1
- package/dist/tests/cases/migrations/2022-10-03-110000-table-on-delete.test.d.ts +2 -0
- package/dist/tests/cases/migrations/2022-10-03-110000-table-on-delete.test.d.ts.map +1 -0
- package/dist/tests/cases/migrations/2022-10-03-110000-table-on-delete.test.js +40 -0
- package/dist/tests/cases/migrations/2022-10-03-110000-table-on-delete.test.js.map +1 -0
- package/dist/tests/tsconfig.tsbuildinfo +1 -1
- package/package.json +13 -14
- package/src/SystemContainer.ts +0 -15
- package/src/bin/runMigrations.ts +35 -0
- package/src/index.ts +0 -2
- package/src/migrations/{2018-08-04-102200-init.sql → 2018-08-04-102200-init.ts} +8 -0
- package/src/migrations/{2018-08-05-130501-trigger-event-function.sql → 2018-08-05-130501-trigger-event-function.ts} +8 -0
- package/src/migrations/{2019-01-14-143432-event-trx-id.sql → 2019-01-14-143432-event-trx-id.ts} +8 -0
- package/src/migrations/{2019-02-04-154500-event-rebase.sql → 2019-02-04-154500-event-rebase.ts} +9 -0
- package/src/migrations/2019-03-18-104147-event-run-migration-struct.ts +11 -0
- package/src/migrations/{2019-07-29-103000-trigger-event-function-fix.sql → 2019-07-29-103000-trigger-event-function-fix.ts} +8 -0
- package/src/migrations/{2019-11-28-100000-missing-setting-fallback.sql → 2019-11-28-100000-missing-setting-fallback.ts} +8 -0
- package/src/migrations/{2021-03-23-110000-timestamp-fix.sql → 2021-03-23-110000-timestamp-fix.ts} +8 -0
- package/src/migrations/2021-05-07-155800-event-log-rework.ts +2 -2
- package/src/migrations/{2021-12-21-155500-events-up.sql → 2021-12-21-155500-events-up.ts} +8 -0
- package/src/migrations/{2022-02-08-132600-fn-search-path.sql → 2022-02-08-132600-fn-search-path.ts} +8 -0
- package/src/migrations/2022-02-08-140500-drop-deadcode.ts +10 -0
- package/src/migrations/{2022-02-08-144400-dynamic-stage-schema.sql → 2022-02-08-144400-dynamic-stage-schema.ts} +8 -0
- package/src/migrations/2022-10-03-110000-table-on-delete.ts +66 -0
- package/src/migrations/runner.ts +79 -15
- package/src/migrations/snapshot-factory.ts +45 -0
- package/src/migrations/snapshot-template-end.txt +1 -0
- package/src/migrations/snapshot-template-start.txt +2 -0
- package/src/migrations/snapshot.ts +169 -0
- package/src/model/ProjectInitializer.ts +15 -50
- package/src/model/database/DatabaseContext.ts +12 -8
- package/src/model/dtos/ExecutedMigration.ts +1 -0
- package/src/model/events/EventResponseBuilder.ts +3 -3
- package/src/model/events/EventResponseHelper.ts +1 -1
- package/src/model/events/index.ts +1 -0
- package/src/model/events/types.ts +63 -0
- package/src/model/helpers/index.ts +0 -1
- package/src/model/migrations/ProjectMigrator.ts +1 -1
- package/src/model/migrations/SchemaVersionBuilder.ts +3 -2
- package/src/model/queries/events/EventQueryHelpers.ts +2 -2
- package/src/model/queries/events/EventsQuery.ts +2 -2
- package/src/model/queries/migrations/ExecutedMigrationsQueryHelper.ts +3 -1
- package/src/tsconfig.json +10 -33
- package/tests/cases/migrations/2022-10-03-110000-table-on-delete.test.ts +42 -0
- package/tests/tsconfig.json +2 -6
- package/tsconfig.json +2 -6
- package/dist/src/model/helpers/SystemVariablesSetupHelper.d.ts +0 -5
- package/dist/src/model/helpers/SystemVariablesSetupHelper.d.ts.map +0 -1
- package/dist/src/model/helpers/SystemVariablesSetupHelper.js +0 -15
- package/dist/src/model/helpers/SystemVariablesSetupHelper.js.map +0 -1
- package/dist/tests/cases/integration/systemApi/projectInitializer.test.d.ts +0 -2
- package/dist/tests/cases/integration/systemApi/projectInitializer.test.d.ts.map +0 -1
- package/dist/tests/cases/integration/systemApi/projectInitializer.test.js +0 -26
- package/dist/tests/cases/integration/systemApi/projectInitializer.test.js.map +0 -1
- package/src/migrations/2019-03-18-104147-event-run-migration-struct.sql +0 -3
- package/src/migrations/2022-02-08-140500-drop-deadcode.sql +0 -2
- package/src/model/helpers/SystemVariablesSetupHelper.ts +0 -14
- package/tests/cases/integration/systemApi/projectInitializer.test.ts +0 -31
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const engine_api_tester_1 = require("@contember/engine-api-tester");
|
|
4
|
-
const vitest_1 = require("vitest");
|
|
5
|
-
const logger_1 = require("@contember/logger");
|
|
6
|
-
const logger = (0, logger_1.createLogger)(new logger_1.JsonStreamLoggerHandler(process.stderr));
|
|
7
|
-
(0, vitest_1.test)('create stage', async () => {
|
|
8
|
-
const prodStage = {
|
|
9
|
-
name: 'Prod',
|
|
10
|
-
slug: 'prod',
|
|
11
|
-
};
|
|
12
|
-
const project = {
|
|
13
|
-
slug: 'example-project',
|
|
14
|
-
stages: [prodStage],
|
|
15
|
-
};
|
|
16
|
-
const tester = await engine_api_tester_1.ApiTester.create({
|
|
17
|
-
project: {
|
|
18
|
-
stages: [prodStage],
|
|
19
|
-
},
|
|
20
|
-
});
|
|
21
|
-
await tester.systemContainer.projectInitializer.initialize(tester.databaseContextFactory, project, logger);
|
|
22
|
-
const createdStagesA = await tester.stages.refreshCreatedStages();
|
|
23
|
-
vitest_1.assert.ok(createdStagesA.has('prod'));
|
|
24
|
-
await tester.cleanup();
|
|
25
|
-
});
|
|
26
|
-
//# sourceMappingURL=projectInitializer.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"projectInitializer.test.js","sourceRoot":"","sources":["../../../../../tests/cases/integration/systemApi/projectInitializer.test.ts"],"names":[],"mappings":";;AAAA,oEAAwD;AAExD,mCAAqC;AACrC,8CAAyE;AAGzE,MAAM,MAAM,GAAG,IAAA,qBAAY,EAAC,IAAI,gCAAuB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAA;AAExE,IAAA,aAAI,EAAC,cAAc,EAAE,KAAK,IAAI,EAAE;IAC/B,MAAM,SAAS,GAAgB;QAC9B,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,MAAM;KACZ,CAAA;IACD,MAAM,OAAO,GAAkB;QAC9B,IAAI,EAAE,iBAAiB;QACvB,MAAM,EAAE,CAAC,SAAS,CAAC;KACnB,CAAA;IAED,MAAM,MAAM,GAAG,MAAM,6BAAS,CAAC,MAAM,CAAC;QACrC,OAAO,EAAE;YACR,MAAM,EAAE,CAAC,SAAS,CAAC;SACnB;KACD,CAAC,CAAA;IAEF,MAAM,MAAM,CAAC,eAAe,CAAC,kBAAkB,CAAC,UAAU,CAAC,MAAM,CAAC,sBAAsB,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;IAC1G,MAAM,cAAc,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,oBAAoB,EAAE,CAAA;IACjE,eAAM,CAAC,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAA;IAErC,MAAM,MAAM,CAAC,OAAO,EAAE,CAAA;AACvB,CAAC,CAAC,CAAA"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Client } from '@contember/database'
|
|
2
|
-
import { UuidProvider } from '../../utils'
|
|
3
|
-
|
|
4
|
-
export const unnamedIdentity = '00000000-0000-0000-0000-000000000000'
|
|
5
|
-
|
|
6
|
-
export async function setupSystemVariables(db: Client, identityId: string, providers: UuidProvider) {
|
|
7
|
-
await Promise.all([
|
|
8
|
-
await db.query('SELECT set_config(?, ?, false)', [
|
|
9
|
-
'tenant.identity_id', // todo rename to system.identity_id
|
|
10
|
-
identityId,
|
|
11
|
-
]),
|
|
12
|
-
await db.query('SELECT set_config(?, ?, false)', ['system.transaction_id', providers.uuid()]),
|
|
13
|
-
])
|
|
14
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { ApiTester } from '@contember/engine-api-tester'
|
|
2
|
-
import { ProjectConfig, StageConfig } from '../../../../src'
|
|
3
|
-
import { assert, test } from 'vitest'
|
|
4
|
-
import { createLogger, JsonStreamLoggerHandler } from '@contember/logger'
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const logger = createLogger(new JsonStreamLoggerHandler(process.stderr))
|
|
8
|
-
|
|
9
|
-
test('create stage', async () => {
|
|
10
|
-
const prodStage: StageConfig = {
|
|
11
|
-
name: 'Prod',
|
|
12
|
-
slug: 'prod',
|
|
13
|
-
}
|
|
14
|
-
const project: ProjectConfig = {
|
|
15
|
-
slug: 'example-project',
|
|
16
|
-
stages: [prodStage],
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const tester = await ApiTester.create({
|
|
20
|
-
project: {
|
|
21
|
-
stages: [prodStage],
|
|
22
|
-
},
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
await tester.systemContainer.projectInitializer.initialize(tester.databaseContextFactory, project, logger)
|
|
26
|
-
const createdStagesA = await tester.stages.refreshCreatedStages()
|
|
27
|
-
assert.ok(createdStagesA.has('prod'))
|
|
28
|
-
|
|
29
|
-
await tester.cleanup()
|
|
30
|
-
})
|
|
31
|
-
|