@webiny/api-headless-cms-sql 0.0.0-unstable.a4f3e4ea8b → 0.0.0-unstable.d0f34a8194
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/features/entryTableManager/EntryTableManager.d.ts +2 -0
- package/features/entryTableManager/EntryTableManager.js +43 -26
- package/features/entryTableManager/EntryTableManager.js.map +1 -1
- package/features/groupSchemaManager/GroupSchemaManager.js +5 -1
- package/features/groupSchemaManager/GroupSchemaManager.js.map +1 -1
- package/features/modelSchemaManager/ModelSchemaManager.js +5 -1
- package/features/modelSchemaManager/ModelSchemaManager.js.map +1 -1
- package/index.d.ts +9 -1
- package/index.js +24 -71
- package/index.js.map +1 -1
- package/operations/entry/SqlCreateEntry.d.ts +15 -0
- package/operations/entry/SqlCreateEntry.js +35 -0
- package/operations/entry/SqlCreateEntry.js.map +1 -0
- package/operations/entry/SqlCreateEntryRevisionFrom.d.ts +16 -0
- package/operations/entry/SqlCreateEntryRevisionFrom.js +58 -0
- package/operations/entry/SqlCreateEntryRevisionFrom.js.map +1 -0
- package/operations/entry/SqlDeleteEntry.d.ts +15 -0
- package/operations/entry/SqlDeleteEntry.js +29 -0
- package/operations/entry/SqlDeleteEntry.js.map +1 -0
- package/operations/entry/SqlDeleteEntryRevision.d.ts +15 -0
- package/operations/entry/SqlDeleteEntryRevision.js +39 -0
- package/operations/entry/SqlDeleteEntryRevision.js.map +1 -0
- package/operations/entry/SqlDeleteMultipleEntries.d.ts +15 -0
- package/operations/entry/SqlDeleteMultipleEntries.js +29 -0
- package/operations/entry/SqlDeleteMultipleEntries.js.map +1 -0
- package/operations/entry/SqlGetEntriesByIds.d.ts +15 -0
- package/operations/entry/SqlGetEntriesByIds.js +35 -0
- package/operations/entry/SqlGetEntriesByIds.js.map +1 -0
- package/operations/entry/SqlGetEntry.d.ts +27 -0
- package/operations/entry/SqlGetEntry.js +65 -0
- package/operations/entry/SqlGetEntry.js.map +1 -0
- package/operations/entry/SqlGetLatestEntriesByIds.d.ts +15 -0
- package/operations/entry/SqlGetLatestEntriesByIds.js +37 -0
- package/operations/entry/SqlGetLatestEntriesByIds.js.map +1 -0
- package/operations/entry/SqlGetLatestRevisionByEntryId.d.ts +15 -0
- package/operations/entry/SqlGetLatestRevisionByEntryId.js +32 -0
- package/operations/entry/SqlGetLatestRevisionByEntryId.js.map +1 -0
- package/operations/entry/SqlGetPreviousRevision.d.ts +15 -0
- package/operations/entry/SqlGetPreviousRevision.js +30 -0
- package/operations/entry/SqlGetPreviousRevision.js.map +1 -0
- package/operations/entry/SqlGetPublishedEntriesByIds.d.ts +15 -0
- package/operations/entry/SqlGetPublishedEntriesByIds.js +37 -0
- package/operations/entry/SqlGetPublishedEntriesByIds.js.map +1 -0
- package/operations/entry/SqlGetPublishedRevisionByEntryId.d.ts +15 -0
- package/operations/entry/SqlGetPublishedRevisionByEntryId.js +32 -0
- package/operations/entry/SqlGetPublishedRevisionByEntryId.js.map +1 -0
- package/operations/entry/SqlGetRevisionById.d.ts +15 -0
- package/operations/entry/SqlGetRevisionById.js +30 -0
- package/operations/entry/SqlGetRevisionById.js.map +1 -0
- package/operations/entry/SqlGetRevisions.d.ts +15 -0
- package/operations/entry/SqlGetRevisions.js +31 -0
- package/operations/entry/SqlGetRevisions.js.map +1 -0
- package/operations/entry/SqlGetUniqueFieldValues.d.ts +27 -0
- package/operations/entry/SqlGetUniqueFieldValues.js +67 -0
- package/operations/entry/SqlGetUniqueFieldValues.js.map +1 -0
- package/operations/entry/SqlListEntries.d.ts +27 -0
- package/operations/entry/SqlListEntries.js +61 -0
- package/operations/entry/SqlListEntries.js.map +1 -0
- package/operations/entry/SqlMoveEntry.d.ts +14 -0
- package/operations/entry/SqlMoveEntry.js +30 -0
- package/operations/entry/SqlMoveEntry.js.map +1 -0
- package/operations/entry/SqlMoveToBin.d.ts +14 -0
- package/operations/entry/SqlMoveToBin.js +35 -0
- package/operations/entry/SqlMoveToBin.js.map +1 -0
- package/operations/entry/SqlPublishEntry.d.ts +15 -0
- package/operations/entry/SqlPublishEntry.js +51 -0
- package/operations/entry/SqlPublishEntry.js.map +1 -0
- package/operations/entry/SqlRestoreFromBin.d.ts +14 -0
- package/operations/entry/SqlRestoreFromBin.js +36 -0
- package/operations/entry/SqlRestoreFromBin.js.map +1 -0
- package/operations/entry/SqlUnpublishEntry.d.ts +15 -0
- package/operations/entry/SqlUnpublishEntry.js +38 -0
- package/operations/entry/SqlUnpublishEntry.js.map +1 -0
- package/operations/entry/SqlUpdateEntry.d.ts +15 -0
- package/operations/entry/SqlUpdateEntry.js +36 -0
- package/operations/entry/SqlUpdateEntry.js.map +1 -0
- package/operations/entry/feature.d.ts +4 -0
- package/operations/entry/feature.js +53 -0
- package/operations/entry/feature.js.map +1 -0
- package/operations/entry/queryHelpers.d.ts +30 -0
- package/operations/entry/queryHelpers.js +107 -0
- package/operations/entry/queryHelpers.js.map +1 -0
- package/operations/group/SqlCreateGroup.d.ts +16 -0
- package/operations/group/SqlCreateGroup.js +28 -0
- package/operations/group/SqlCreateGroup.js.map +1 -0
- package/operations/group/SqlDeleteGroup.d.ts +16 -0
- package/operations/group/SqlDeleteGroup.js +26 -0
- package/operations/group/SqlDeleteGroup.js.map +1 -0
- package/operations/group/SqlGetGroup.d.ts +16 -0
- package/operations/group/SqlGetGroup.js +29 -0
- package/operations/group/SqlGetGroup.js.map +1 -0
- package/operations/group/SqlListGroups.d.ts +16 -0
- package/operations/group/SqlListGroups.js +43 -0
- package/operations/group/SqlListGroups.js.map +1 -0
- package/operations/group/SqlUpdateGroup.d.ts +16 -0
- package/operations/group/SqlUpdateGroup.js +28 -0
- package/operations/group/SqlUpdateGroup.js.map +1 -0
- package/operations/group/feature.d.ts +4 -0
- package/operations/group/feature.js +19 -0
- package/operations/group/feature.js.map +1 -0
- package/operations/model/SqlCreateModel.d.ts +16 -0
- package/operations/model/SqlCreateModel.js +30 -0
- package/operations/model/SqlCreateModel.js.map +1 -0
- package/operations/model/SqlDeleteModel.d.ts +16 -0
- package/operations/model/SqlDeleteModel.js +26 -0
- package/operations/model/SqlDeleteModel.js.map +1 -0
- package/operations/model/SqlGetModel.d.ts +16 -0
- package/operations/model/SqlGetModel.js +29 -0
- package/operations/model/SqlGetModel.js.map +1 -0
- package/operations/model/SqlListModels.d.ts +16 -0
- package/operations/model/SqlListModels.js +31 -0
- package/operations/model/SqlListModels.js.map +1 -0
- package/operations/model/SqlUpdateModel.d.ts +16 -0
- package/operations/model/SqlUpdateModel.js +30 -0
- package/operations/model/SqlUpdateModel.js.map +1 -0
- package/operations/model/feature.d.ts +4 -0
- package/operations/model/feature.js +19 -0
- package/operations/model/feature.js.map +1 -0
- package/package.json +16 -13
- package/operations/entry/index.d.ts +0 -13
- package/operations/entry/index.js +0 -373
- package/operations/entry/index.js.map +0 -1
- package/operations/group/index.d.ts +0 -5
- package/operations/group/index.js +0 -58
- package/operations/group/index.js.map +0 -1
- package/operations/model/index.d.ts +0 -5
- package/operations/model/index.js +0 -50
- package/operations/model/index.js.map +0 -1
- package/types.d.ts +0 -10
- package/types.js +0 -0
|
@@ -5,9 +5,11 @@ declare class EntryTableManagerImpl implements EntryTableManagerAbstraction.Inte
|
|
|
5
5
|
private readonly knex;
|
|
6
6
|
private readonly tableName;
|
|
7
7
|
private initialized;
|
|
8
|
+
private initPromise?;
|
|
8
9
|
constructor(knex: KnexClient.Interface, tableNameResolver: TableNameResolver.Interface);
|
|
9
10
|
reset(): void;
|
|
10
11
|
ensureTable(): Promise<void>;
|
|
12
|
+
private doEnsureTable;
|
|
11
13
|
getTableName(): string;
|
|
12
14
|
private createTable;
|
|
13
15
|
}
|
|
@@ -12,9 +12,17 @@ class EntryTableManagerImpl {
|
|
|
12
12
|
}
|
|
13
13
|
reset() {
|
|
14
14
|
this.initialized = false;
|
|
15
|
+
this.initPromise = void 0;
|
|
15
16
|
}
|
|
16
17
|
async ensureTable() {
|
|
17
18
|
if (this.initialized) return;
|
|
19
|
+
if (!this.initPromise) this.initPromise = this.doEnsureTable().catch((err)=>{
|
|
20
|
+
this.initPromise = void 0;
|
|
21
|
+
throw err;
|
|
22
|
+
});
|
|
23
|
+
return this.initPromise;
|
|
24
|
+
}
|
|
25
|
+
async doEnsureTable() {
|
|
18
26
|
const exists = await this.knex.client.schema.hasTable(this.tableName);
|
|
19
27
|
if (!exists) await this.createTable();
|
|
20
28
|
this.initialized = true;
|
|
@@ -23,32 +31,41 @@ class EntryTableManagerImpl {
|
|
|
23
31
|
return this.tableName;
|
|
24
32
|
}
|
|
25
33
|
async createTable() {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
34
|
+
try {
|
|
35
|
+
await this.knex.client.schema.createTable(this.tableName, (table)=>{
|
|
36
|
+
table.text("id").notNullable();
|
|
37
|
+
table.text("entryId").notNullable();
|
|
38
|
+
table.text("modelId").notNullable();
|
|
39
|
+
table.text("tenant").notNullable();
|
|
40
|
+
table.integer("version").notNullable();
|
|
41
|
+
table.boolean("isLatest").defaultTo(false);
|
|
42
|
+
table.boolean("isPublished").defaultTo(false);
|
|
43
|
+
table.boolean("wbyDeleted").defaultTo(false);
|
|
44
|
+
table.text("data").notNullable();
|
|
45
|
+
table.primary([
|
|
46
|
+
"tenant",
|
|
47
|
+
"id"
|
|
48
|
+
]);
|
|
49
|
+
table.index([
|
|
50
|
+
"tenant",
|
|
51
|
+
"modelId",
|
|
52
|
+
"isLatest"
|
|
53
|
+
]);
|
|
54
|
+
table.index([
|
|
55
|
+
"tenant",
|
|
56
|
+
"modelId",
|
|
57
|
+
"isPublished"
|
|
58
|
+
]);
|
|
59
|
+
table.index([
|
|
60
|
+
"tenant",
|
|
61
|
+
"modelId",
|
|
62
|
+
"entryId"
|
|
63
|
+
]);
|
|
64
|
+
});
|
|
65
|
+
} catch (err) {
|
|
66
|
+
if (await this.knex.client.schema.hasTable(this.tableName)) return;
|
|
67
|
+
throw err;
|
|
68
|
+
}
|
|
52
69
|
}
|
|
53
70
|
}
|
|
54
71
|
const EntryTableManager_EntryTableManager = EntryTableManager.createImplementation({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/entryTableManager/EntryTableManager.js","sources":["../../../src/features/entryTableManager/EntryTableManager.ts"],"sourcesContent":["import { KnexClient } from \"@webiny/api-core-sql\";\nimport { EntryTableManager as EntryTableManagerAbstraction } from \"./abstractions.js\";\nimport { TableNameResolver } from \"~/features/tableNameResolver/abstractions.js\";\n\nclass EntryTableManagerImpl implements EntryTableManagerAbstraction.Interface {\n private readonly knex;\n private readonly tableName;\n private initialized = false;\n\n constructor(knex: KnexClient.Interface, tableNameResolver: TableNameResolver.Interface) {\n this.knex = knex;\n this.tableName = tableNameResolver.resolve(\"entries\");\n\n const g = globalThis as Record<string, unknown>;\n const managers = (g.__sqlTableManagers ??= []) as EntryTableManagerAbstraction.Interface[];\n managers.push(this);\n }\n\n public reset(): void {\n this.initialized = false;\n }\n\n public async ensureTable(): Promise<void> {\n if (this.initialized) {\n return;\n }\n\n const exists = await this.knex.client.schema.hasTable(this.tableName);\n\n if (!exists) {\n await this.createTable();\n }\n\n this.initialized = true;\n }\n\n public getTableName(): string {\n return this.tableName;\n }\n\n private async createTable(): Promise<void> {\n await this.knex.client.schema.createTable(this.tableName, table => {\n
|
|
1
|
+
{"version":3,"file":"features/entryTableManager/EntryTableManager.js","sources":["../../../src/features/entryTableManager/EntryTableManager.ts"],"sourcesContent":["import { KnexClient } from \"@webiny/api-core-sql\";\nimport { EntryTableManager as EntryTableManagerAbstraction } from \"./abstractions.js\";\nimport { TableNameResolver } from \"~/features/tableNameResolver/abstractions.js\";\n\nclass EntryTableManagerImpl implements EntryTableManagerAbstraction.Interface {\n private readonly knex;\n private readonly tableName;\n private initialized = false;\n private initPromise?: Promise<void>;\n\n constructor(knex: KnexClient.Interface, tableNameResolver: TableNameResolver.Interface) {\n this.knex = knex;\n this.tableName = tableNameResolver.resolve(\"entries\");\n\n const g = globalThis as Record<string, unknown>;\n const managers = (g.__sqlTableManagers ??= []) as EntryTableManagerAbstraction.Interface[];\n managers.push(this);\n }\n\n public reset(): void {\n this.initialized = false;\n this.initPromise = undefined;\n }\n\n public async ensureTable(): Promise<void> {\n if (this.initialized) {\n return;\n }\n // Memoize the in-flight init so concurrent callers (e.g. Promise.all entry creates) share a\n // single hasTable+createTable and don't race into \"table already exists\". Clear on failure\n // so a later call can retry.\n if (!this.initPromise) {\n this.initPromise = this.doEnsureTable().catch(err => {\n this.initPromise = undefined;\n throw err;\n });\n }\n return this.initPromise;\n }\n\n private async doEnsureTable(): Promise<void> {\n const exists = await this.knex.client.schema.hasTable(this.tableName);\n\n if (!exists) {\n await this.createTable();\n }\n\n this.initialized = true;\n }\n\n public getTableName(): string {\n return this.tableName;\n }\n\n private async createTable(): Promise<void> {\n try {\n await this.knex.client.schema.createTable(this.tableName, table => {\n table.text(\"id\").notNullable();\n table.text(\"entryId\").notNullable();\n table.text(\"modelId\").notNullable();\n table.text(\"tenant\").notNullable();\n table.integer(\"version\").notNullable();\n table.boolean(\"isLatest\").defaultTo(false);\n table.boolean(\"isPublished\").defaultTo(false);\n table.boolean(\"wbyDeleted\").defaultTo(false);\n table.text(\"data\").notNullable();\n\n table.primary([\"tenant\", \"id\"]);\n\n table.index([\"tenant\", \"modelId\", \"isLatest\"]);\n table.index([\"tenant\", \"modelId\", \"isPublished\"]);\n table.index([\"tenant\", \"modelId\", \"entryId\"]);\n });\n } catch (err) {\n // The entries table is shared across all EntryTableManager instances (one per request\n // container), so another instance/connection may create it concurrently. If it now\n // exists, that's success; otherwise the failure is real.\n if (await this.knex.client.schema.hasTable(this.tableName)) {\n return;\n }\n throw err;\n }\n }\n}\n\nexport const EntryTableManager = EntryTableManagerAbstraction.createImplementation({\n implementation: EntryTableManagerImpl,\n dependencies: [KnexClient, TableNameResolver]\n});\n"],"names":["EntryTableManagerImpl","knex","tableNameResolver","g","globalThis","managers","undefined","err","exists","table","EntryTableManager","EntryTableManagerAbstraction","KnexClient","TableNameResolver"],"mappings":";;;AAIA,MAAMA;IAMF,YAAYC,IAA0B,EAAEC,iBAA8C,CAAE;aAHhF,WAAW,GAAG;QAIlB,IAAI,CAAC,IAAI,GAAGD;QACZ,IAAI,CAAC,SAAS,GAAGC,kBAAkB,OAAO,CAAC;QAE3C,MAAMC,IAAIC;QACV,MAAMC,WAAYF,EAAE,kBAAkB,KAAK,EAAE;QAC7CE,SAAS,IAAI,CAAC,IAAI;IACtB;IAEO,QAAc;QACjB,IAAI,CAAC,WAAW,GAAG;QACnB,IAAI,CAAC,WAAW,GAAGC;IACvB;IAEA,MAAa,cAA6B;QACtC,IAAI,IAAI,CAAC,WAAW,EAChB;QAKJ,IAAI,CAAC,IAAI,CAAC,WAAW,EACjB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,aAAa,GAAG,KAAK,CAACC,CAAAA;YAC1C,IAAI,CAAC,WAAW,GAAGD;YACnB,MAAMC;QACV;QAEJ,OAAO,IAAI,CAAC,WAAW;IAC3B;IAEA,MAAc,gBAA+B;QACzC,MAAMC,SAAS,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS;QAEpE,IAAI,CAACA,QACD,MAAM,IAAI,CAAC,WAAW;QAG1B,IAAI,CAAC,WAAW,GAAG;IACvB;IAEO,eAAuB;QAC1B,OAAO,IAAI,CAAC,SAAS;IACzB;IAEA,MAAc,cAA6B;QACvC,IAAI;YACA,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,EAAEC,CAAAA;gBACtDA,MAAM,IAAI,CAAC,MAAM,WAAW;gBAC5BA,MAAM,IAAI,CAAC,WAAW,WAAW;gBACjCA,MAAM,IAAI,CAAC,WAAW,WAAW;gBACjCA,MAAM,IAAI,CAAC,UAAU,WAAW;gBAChCA,MAAM,OAAO,CAAC,WAAW,WAAW;gBACpCA,MAAM,OAAO,CAAC,YAAY,SAAS,CAAC;gBACpCA,MAAM,OAAO,CAAC,eAAe,SAAS,CAAC;gBACvCA,MAAM,OAAO,CAAC,cAAc,SAAS,CAAC;gBACtCA,MAAM,IAAI,CAAC,QAAQ,WAAW;gBAE9BA,MAAM,OAAO,CAAC;oBAAC;oBAAU;iBAAK;gBAE9BA,MAAM,KAAK,CAAC;oBAAC;oBAAU;oBAAW;iBAAW;gBAC7CA,MAAM,KAAK,CAAC;oBAAC;oBAAU;oBAAW;iBAAc;gBAChDA,MAAM,KAAK,CAAC;oBAAC;oBAAU;oBAAW;iBAAU;YAChD;QACJ,EAAE,OAAOF,KAAK;YAIV,IAAI,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,GACrD;YAEJ,MAAMA;QACV;IACJ;AACJ;AAEO,MAAMG,sCAAoBC,kBAAAA,oBAAiD,CAAC;IAC/E,gBAAgBX;IAChB,cAAc;QAACY;QAAYC;KAAkB;AACjD"}
|
|
@@ -15,7 +15,7 @@ class GroupSchemaManagerImpl {
|
|
|
15
15
|
if (this.verified.has(tableName)) return;
|
|
16
16
|
const exists = await this.knex.client.schema.hasTable(tableName);
|
|
17
17
|
if (!exists) await this.knex.client.schema.createTable(tableName, (table)=>{
|
|
18
|
-
table.text("id").
|
|
18
|
+
table.text("id").notNullable();
|
|
19
19
|
table.text("name").notNullable();
|
|
20
20
|
table.text("slug").notNullable();
|
|
21
21
|
table.text("tenant").notNullable();
|
|
@@ -29,6 +29,10 @@ class GroupSchemaManagerImpl {
|
|
|
29
29
|
table.text("savedOn");
|
|
30
30
|
table.boolean("isPrivate").notNullable().defaultTo(false);
|
|
31
31
|
table.boolean("isPlugin").notNullable().defaultTo(false);
|
|
32
|
+
table.primary([
|
|
33
|
+
"tenant",
|
|
34
|
+
"id"
|
|
35
|
+
]);
|
|
32
36
|
});
|
|
33
37
|
this.verified.add(tableName);
|
|
34
38
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/groupSchemaManager/GroupSchemaManager.js","sources":["../../../src/features/groupSchemaManager/GroupSchemaManager.ts"],"sourcesContent":["import { KnexClient } from \"@webiny/api-core-sql\";\nimport { GroupSchemaManager as GroupSchemaManagerAbstraction } from \"./abstractions.js\";\n\nclass GroupSchemaManagerImpl implements GroupSchemaManagerAbstraction.Interface {\n private readonly knex;\n private readonly verified = new Set<string>();\n\n constructor(knex: KnexClient.Interface) {\n this.knex = knex;\n\n const g = globalThis as Record<string, unknown>;\n const managers = (g.__sqlTableManagers ??= []) as GroupSchemaManagerAbstraction.Interface[];\n managers.push(this);\n }\n\n public reset(): void {\n this.verified.clear();\n }\n\n public async ensure(tableName: string): Promise<void> {\n if (this.verified.has(tableName)) {\n return;\n }\n\n const exists = await this.knex.client.schema.hasTable(tableName);\n\n if (!exists) {\n await this.knex.client.schema.createTable(tableName, table => {\n table.text(\"id\").
|
|
1
|
+
{"version":3,"file":"features/groupSchemaManager/GroupSchemaManager.js","sources":["../../../src/features/groupSchemaManager/GroupSchemaManager.ts"],"sourcesContent":["import { KnexClient } from \"@webiny/api-core-sql\";\nimport { GroupSchemaManager as GroupSchemaManagerAbstraction } from \"./abstractions.js\";\n\nclass GroupSchemaManagerImpl implements GroupSchemaManagerAbstraction.Interface {\n private readonly knex;\n private readonly verified = new Set<string>();\n\n constructor(knex: KnexClient.Interface) {\n this.knex = knex;\n\n const g = globalThis as Record<string, unknown>;\n const managers = (g.__sqlTableManagers ??= []) as GroupSchemaManagerAbstraction.Interface[];\n managers.push(this);\n }\n\n public reset(): void {\n this.verified.clear();\n }\n\n public async ensure(tableName: string): Promise<void> {\n if (this.verified.has(tableName)) {\n return;\n }\n\n const exists = await this.knex.client.schema.hasTable(tableName);\n\n if (!exists) {\n await this.knex.client.schema.createTable(tableName, table => {\n table.text(\"id\").notNullable();\n table.text(\"name\").notNullable();\n table.text(\"slug\").notNullable();\n table.text(\"tenant\").notNullable();\n table.text(\"description\");\n table.text(\"icon\");\n table.text(\"createdBy_id\");\n table.text(\"createdBy_displayName\");\n table.text(\"createdBy_type\");\n table.text(\"createdBy\");\n table.text(\"createdOn\");\n table.text(\"savedOn\");\n table.boolean(\"isPrivate\").notNullable().defaultTo(false);\n table.boolean(\"isPlugin\").notNullable().defaultTo(false);\n\n table.primary([\"tenant\", \"id\"]);\n });\n }\n\n this.verified.add(tableName);\n }\n}\n\nexport const GroupSchemaManager = GroupSchemaManagerAbstraction.createImplementation({\n implementation: GroupSchemaManagerImpl,\n dependencies: [KnexClient]\n});\n"],"names":["GroupSchemaManagerImpl","knex","Set","g","globalThis","managers","tableName","exists","table","GroupSchemaManager","GroupSchemaManagerAbstraction","KnexClient"],"mappings":";;AAGA,MAAMA;IAIF,YAAYC,IAA0B,CAAE;aAFvB,QAAQ,GAAG,IAAIC;QAG5B,IAAI,CAAC,IAAI,GAAGD;QAEZ,MAAME,IAAIC;QACV,MAAMC,WAAYF,EAAE,kBAAkB,KAAK,EAAE;QAC7CE,SAAS,IAAI,CAAC,IAAI;IACtB;IAEO,QAAc;QACjB,IAAI,CAAC,QAAQ,CAAC,KAAK;IACvB;IAEA,MAAa,OAAOC,SAAiB,EAAiB;QAClD,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAACA,YAClB;QAGJ,MAAMC,SAAS,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAACD;QAEtD,IAAI,CAACC,QACD,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,CAACD,WAAWE,CAAAA;YACjDA,MAAM,IAAI,CAAC,MAAM,WAAW;YAC5BA,MAAM,IAAI,CAAC,QAAQ,WAAW;YAC9BA,MAAM,IAAI,CAAC,QAAQ,WAAW;YAC9BA,MAAM,IAAI,CAAC,UAAU,WAAW;YAChCA,MAAM,IAAI,CAAC;YACXA,MAAM,IAAI,CAAC;YACXA,MAAM,IAAI,CAAC;YACXA,MAAM,IAAI,CAAC;YACXA,MAAM,IAAI,CAAC;YACXA,MAAM,IAAI,CAAC;YACXA,MAAM,IAAI,CAAC;YACXA,MAAM,IAAI,CAAC;YACXA,MAAM,OAAO,CAAC,aAAa,WAAW,GAAG,SAAS,CAAC;YACnDA,MAAM,OAAO,CAAC,YAAY,WAAW,GAAG,SAAS,CAAC;YAElDA,MAAM,OAAO,CAAC;gBAAC;gBAAU;aAAK;QAClC;QAGJ,IAAI,CAAC,QAAQ,CAAC,GAAG,CAACF;IACtB;AACJ;AAEO,MAAMG,wCAAqBC,mBAAAA,oBAAkD,CAAC;IACjF,gBAAgBV;IAChB,cAAc;QAACW;KAAW;AAC9B"}
|
|
@@ -15,7 +15,7 @@ class ModelSchemaManagerImpl {
|
|
|
15
15
|
if (this.verified.has(tableName)) return;
|
|
16
16
|
const exists = await this.knex.client.schema.hasTable(tableName);
|
|
17
17
|
if (!exists) await this.knex.client.schema.createTable(tableName, (table)=>{
|
|
18
|
-
table.text("modelId").
|
|
18
|
+
table.text("modelId").notNullable();
|
|
19
19
|
table.text("tenant").notNullable();
|
|
20
20
|
table.text("name").notNullable();
|
|
21
21
|
table.text("singularApiName").notNullable();
|
|
@@ -39,6 +39,10 @@ class ModelSchemaManagerImpl {
|
|
|
39
39
|
table.text("createdOn");
|
|
40
40
|
table.text("savedOn");
|
|
41
41
|
table.text("settings");
|
|
42
|
+
table.primary([
|
|
43
|
+
"tenant",
|
|
44
|
+
"modelId"
|
|
45
|
+
]);
|
|
42
46
|
});
|
|
43
47
|
this.verified.add(tableName);
|
|
44
48
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/modelSchemaManager/ModelSchemaManager.js","sources":["../../../src/features/modelSchemaManager/ModelSchemaManager.ts"],"sourcesContent":["import { KnexClient } from \"@webiny/api-core-sql\";\nimport { ModelSchemaManager as ModelSchemaManagerAbstraction } from \"./abstractions.js\";\n\nclass ModelSchemaManagerImpl implements ModelSchemaManagerAbstraction.Interface {\n private readonly knex;\n private readonly verified = new Set<string>();\n\n constructor(knex: KnexClient.Interface) {\n this.knex = knex;\n\n const g = globalThis as Record<string, unknown>;\n const managers = (g.__sqlTableManagers ??= []) as ModelSchemaManagerAbstraction.Interface[];\n managers.push(this);\n }\n\n public reset(): void {\n this.verified.clear();\n }\n\n public async ensure(tableName: string): Promise<void> {\n if (this.verified.has(tableName)) {\n return;\n }\n\n const exists = await this.knex.client.schema.hasTable(tableName);\n\n if (!exists) {\n await this.knex.client.schema.createTable(tableName, table => {\n table.text(\"modelId\").
|
|
1
|
+
{"version":3,"file":"features/modelSchemaManager/ModelSchemaManager.js","sources":["../../../src/features/modelSchemaManager/ModelSchemaManager.ts"],"sourcesContent":["import { KnexClient } from \"@webiny/api-core-sql\";\nimport { ModelSchemaManager as ModelSchemaManagerAbstraction } from \"./abstractions.js\";\n\nclass ModelSchemaManagerImpl implements ModelSchemaManagerAbstraction.Interface {\n private readonly knex;\n private readonly verified = new Set<string>();\n\n constructor(knex: KnexClient.Interface) {\n this.knex = knex;\n\n const g = globalThis as Record<string, unknown>;\n const managers = (g.__sqlTableManagers ??= []) as ModelSchemaManagerAbstraction.Interface[];\n managers.push(this);\n }\n\n public reset(): void {\n this.verified.clear();\n }\n\n public async ensure(tableName: string): Promise<void> {\n if (this.verified.has(tableName)) {\n return;\n }\n\n const exists = await this.knex.client.schema.hasTable(tableName);\n\n if (!exists) {\n await this.knex.client.schema.createTable(tableName, table => {\n table.text(\"modelId\").notNullable();\n table.text(\"tenant\").notNullable();\n table.text(\"name\").notNullable();\n table.text(\"singularApiName\").notNullable();\n table.text(\"pluralApiName\").notNullable();\n table.text(\"group\").notNullable();\n table.text(\"icon\");\n table.text(\"description\");\n table.text(\"fields\").notNullable();\n table.text(\"layout\").notNullable();\n table.text(\"tags\");\n table.text(\"titleFieldId\").notNullable();\n table.text(\"descriptionFieldId\");\n table.text(\"imageFieldId\");\n table.boolean(\"isPrivate\").notNullable().defaultTo(false);\n table.boolean(\"isPlugin\").notNullable().defaultTo(false);\n table.text(\"authorization\");\n table.text(\"createdBy_id\");\n table.text(\"createdBy_displayName\");\n table.text(\"createdBy_type\");\n table.text(\"createdBy\");\n table.text(\"createdOn\");\n table.text(\"savedOn\");\n table.text(\"settings\");\n\n table.primary([\"tenant\", \"modelId\"]);\n });\n }\n\n this.verified.add(tableName);\n }\n}\n\nexport const ModelSchemaManager = ModelSchemaManagerAbstraction.createImplementation({\n implementation: ModelSchemaManagerImpl,\n dependencies: [KnexClient]\n});\n"],"names":["ModelSchemaManagerImpl","knex","Set","g","globalThis","managers","tableName","exists","table","ModelSchemaManager","ModelSchemaManagerAbstraction","KnexClient"],"mappings":";;AAGA,MAAMA;IAIF,YAAYC,IAA0B,CAAE;aAFvB,QAAQ,GAAG,IAAIC;QAG5B,IAAI,CAAC,IAAI,GAAGD;QAEZ,MAAME,IAAIC;QACV,MAAMC,WAAYF,EAAE,kBAAkB,KAAK,EAAE;QAC7CE,SAAS,IAAI,CAAC,IAAI;IACtB;IAEO,QAAc;QACjB,IAAI,CAAC,QAAQ,CAAC,KAAK;IACvB;IAEA,MAAa,OAAOC,SAAiB,EAAiB;QAClD,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAACA,YAClB;QAGJ,MAAMC,SAAS,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAACD;QAEtD,IAAI,CAACC,QACD,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,CAACD,WAAWE,CAAAA;YACjDA,MAAM,IAAI,CAAC,WAAW,WAAW;YACjCA,MAAM,IAAI,CAAC,UAAU,WAAW;YAChCA,MAAM,IAAI,CAAC,QAAQ,WAAW;YAC9BA,MAAM,IAAI,CAAC,mBAAmB,WAAW;YACzCA,MAAM,IAAI,CAAC,iBAAiB,WAAW;YACvCA,MAAM,IAAI,CAAC,SAAS,WAAW;YAC/BA,MAAM,IAAI,CAAC;YACXA,MAAM,IAAI,CAAC;YACXA,MAAM,IAAI,CAAC,UAAU,WAAW;YAChCA,MAAM,IAAI,CAAC,UAAU,WAAW;YAChCA,MAAM,IAAI,CAAC;YACXA,MAAM,IAAI,CAAC,gBAAgB,WAAW;YACtCA,MAAM,IAAI,CAAC;YACXA,MAAM,IAAI,CAAC;YACXA,MAAM,OAAO,CAAC,aAAa,WAAW,GAAG,SAAS,CAAC;YACnDA,MAAM,OAAO,CAAC,YAAY,WAAW,GAAG,SAAS,CAAC;YAClDA,MAAM,IAAI,CAAC;YACXA,MAAM,IAAI,CAAC;YACXA,MAAM,IAAI,CAAC;YACXA,MAAM,IAAI,CAAC;YACXA,MAAM,IAAI,CAAC;YACXA,MAAM,IAAI,CAAC;YACXA,MAAM,IAAI,CAAC;YACXA,MAAM,IAAI,CAAC;YAEXA,MAAM,OAAO,CAAC;gBAAC;gBAAU;aAAU;QACvC;QAGJ,IAAI,CAAC,QAAQ,CAAC,GAAG,CAACF;IACtB;AACJ;AAEO,MAAMG,wCAAqBC,mBAAAA,oBAAkD,CAAC;IACjF,gBAAgBV;IAChB,cAAc;QAACW;KAAW;AAC9B"}
|
package/index.d.ts
CHANGED
|
@@ -4,5 +4,13 @@ interface ISqlStorageOperationsConfig {
|
|
|
4
4
|
tableNamePrefix?: string;
|
|
5
5
|
tableNameSuffix?: string;
|
|
6
6
|
}
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* SQL CMS storage. Register it once, in the root container. Table naming and the table managers (which
|
|
9
|
+
* remember the tables they have checked) live for the process; the storage operations are transient,
|
|
10
|
+
* and the filter registries are container scoped, so each request (child) container gets its own.
|
|
11
|
+
*/
|
|
12
|
+
export declare const HeadlessCmsSqlFeature: {
|
|
13
|
+
name: string;
|
|
14
|
+
register(container: import("@webiny/di").Container, context: ISqlStorageOperationsConfig): void;
|
|
15
|
+
};
|
|
8
16
|
export {};
|
package/index.js
CHANGED
|
@@ -1,81 +1,34 @@
|
|
|
1
|
-
import { createGroupsStorageOperations } from "./operations/group/index.js";
|
|
2
|
-
import { createModelsStorageOperations } from "./operations/model/index.js";
|
|
3
|
-
import { createEntriesStorageOperations } from "./operations/entry/index.js";
|
|
4
|
-
import { createRegisterExtensionPlugin } from "@webiny/handler";
|
|
5
1
|
import { createFeature } from "@webiny/feature/api/index.js";
|
|
6
|
-
import { StorageOperationsFactory } from "@webiny/api-headless-cms/exports/api/cms/storage.js";
|
|
7
2
|
import { GroupSchemaManagerFeature } from "./features/groupSchemaManager/feature.js";
|
|
8
3
|
import { ModelSchemaManagerFeature } from "./features/modelSchemaManager/feature.js";
|
|
9
4
|
import { EntryTableManagerFeature } from "./features/entryTableManager/feature.js";
|
|
10
|
-
import {
|
|
11
|
-
import { ModelSchemaManager } from "./features/modelSchemaManager/abstractions.js";
|
|
12
|
-
import { EntryTableManager } from "./features/entryTableManager/abstractions.js";
|
|
13
|
-
import { TableNameResolver, TableNameResolverConfig } from "./features/tableNameResolver/abstractions.js";
|
|
5
|
+
import { TableNameResolverConfig } from "./features/tableNameResolver/abstractions.js";
|
|
14
6
|
import { TableNameResolverFeature } from "./features/tableNameResolver/feature.js";
|
|
15
7
|
import { ValueFilterFeature } from "@webiny/db-utils";
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
createLocationFolderIdPathPlugin(),
|
|
29
|
-
createDatetimeTransformValuePlugin()
|
|
30
|
-
]);
|
|
31
|
-
const groups = createGroupsStorageOperations(knex, tableNameResolver, groupSchemaManager);
|
|
32
|
-
const models = createModelsStorageOperations(knex, tableNameResolver, modelSchemaManager);
|
|
33
|
-
const entries = createEntriesStorageOperations({
|
|
34
|
-
knex,
|
|
35
|
-
entryTableManager,
|
|
36
|
-
container,
|
|
37
|
-
plugins
|
|
38
|
-
});
|
|
39
|
-
return {
|
|
40
|
-
name: "sql",
|
|
41
|
-
beforeInit: async ()=>{},
|
|
42
|
-
groups,
|
|
43
|
-
models,
|
|
44
|
-
entries
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
class SqlStorageOperationsFactoryImpl {
|
|
48
|
-
async create(context) {
|
|
49
|
-
return createSqlStorageOperations({
|
|
50
|
-
plugins: context.plugins,
|
|
51
|
-
container: context.container
|
|
8
|
+
import { FilterRegistriesFeature } from "@webiny/api-headless-cms-storage";
|
|
9
|
+
import { SqlGroupStorageOpsFeature } from "./operations/group/feature.js";
|
|
10
|
+
import { SqlModelStorageOpsFeature } from "./operations/model/feature.js";
|
|
11
|
+
import { SqlEntryStorageOpsFeature } from "./operations/entry/feature.js";
|
|
12
|
+
const HeadlessCmsSqlFeature = createFeature({
|
|
13
|
+
name: "cms.storageOperations.sql",
|
|
14
|
+
register: (container, config)=>{
|
|
15
|
+
const sharedTables = "true" === process.env.WEBINY_SHARED_TABLES;
|
|
16
|
+
container.registerInstance(TableNameResolverConfig, {
|
|
17
|
+
sharedTables,
|
|
18
|
+
tableNamePrefix: config.tableNamePrefix,
|
|
19
|
+
tableNameSuffix: config.tableNameSuffix
|
|
52
20
|
});
|
|
21
|
+
TableNameResolverFeature.register(container);
|
|
22
|
+
ValueFilterFeature.register(container);
|
|
23
|
+
GroupSchemaManagerFeature.register(container);
|
|
24
|
+
ModelSchemaManagerFeature.register(container);
|
|
25
|
+
EntryTableManagerFeature.register(container);
|
|
26
|
+
FilterRegistriesFeature.register(container);
|
|
27
|
+
SqlGroupStorageOpsFeature.register(container);
|
|
28
|
+
SqlModelStorageOpsFeature.register(container);
|
|
29
|
+
SqlEntryStorageOpsFeature.register(container);
|
|
53
30
|
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const storageOperationsFeature = createFeature({
|
|
57
|
-
name: "cms.storageOperations.sql",
|
|
58
|
-
register: (container)=>{
|
|
59
|
-
const sharedTables = "true" === process.env.WEBINY_SHARED_TABLES;
|
|
60
|
-
container.registerInstance(TableNameResolverConfig, {
|
|
61
|
-
sharedTables,
|
|
62
|
-
tableNamePrefix: config.tableNamePrefix,
|
|
63
|
-
tableNameSuffix: config.tableNameSuffix
|
|
64
|
-
});
|
|
65
|
-
TableNameResolverFeature.register(container);
|
|
66
|
-
ValueFilterFeature.register(container);
|
|
67
|
-
GroupSchemaManagerFeature.register(container);
|
|
68
|
-
ModelSchemaManagerFeature.register(container);
|
|
69
|
-
EntryTableManagerFeature.register(container);
|
|
70
|
-
container.registerFactory(StorageOperationsFactory, ()=>new SqlStorageOperationsFactoryImpl());
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
const plugin = createRegisterExtensionPlugin((context)=>storageOperationsFeature.register(context.container));
|
|
74
|
-
plugin.name = "cms.registerSqlStorageOperations";
|
|
75
|
-
return [
|
|
76
|
-
plugin
|
|
77
|
-
];
|
|
78
|
-
};
|
|
79
|
-
export { registerSqlStorageOperations };
|
|
31
|
+
});
|
|
32
|
+
export { HeadlessCmsSqlFeature };
|
|
80
33
|
|
|
81
34
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api/index.js\";\nimport { GroupSchemaManagerFeature } from \"~/features/groupSchemaManager/feature.js\";\nimport { ModelSchemaManagerFeature } from \"~/features/modelSchemaManager/feature.js\";\nimport { EntryTableManagerFeature } from \"~/features/entryTableManager/feature.js\";\nimport { TableNameResolverConfig } from \"~/features/tableNameResolver/abstractions.js\";\nimport type { Knex } from \"knex\";\nimport { TableNameResolverFeature } from \"~/features/tableNameResolver/feature.js\";\nimport { ValueFilterFeature } from \"@webiny/db-utils\";\nimport { FilterRegistriesFeature } from \"@webiny/api-headless-cms-storage\";\nimport { SqlGroupStorageOpsFeature } from \"~/operations/group/feature.js\";\nimport { SqlModelStorageOpsFeature } from \"~/operations/model/feature.js\";\nimport { SqlEntryStorageOpsFeature } from \"~/operations/entry/feature.js\";\n\ninterface ISqlStorageOperationsConfig {\n knex: Knex;\n tableNamePrefix?: string;\n tableNameSuffix?: string;\n}\n\n/**\n * SQL CMS storage. Register it once, in the root container. Table naming and the table managers (which\n * remember the tables they have checked) live for the process; the storage operations are transient,\n * and the filter registries are container scoped, so each request (child) container gets its own.\n */\nexport const HeadlessCmsSqlFeature = createFeature<ISqlStorageOperationsConfig>({\n name: \"cms.storageOperations.sql\",\n register: (container, config) => {\n const sharedTables = process.env.WEBINY_SHARED_TABLES === \"true\";\n\n container.registerInstance(TableNameResolverConfig, {\n sharedTables,\n tableNamePrefix: config.tableNamePrefix,\n tableNameSuffix: config.tableNameSuffix\n });\n\n TableNameResolverFeature.register(container);\n ValueFilterFeature.register(container);\n GroupSchemaManagerFeature.register(container);\n ModelSchemaManagerFeature.register(container);\n EntryTableManagerFeature.register(container);\n\n FilterRegistriesFeature.register(container);\n SqlGroupStorageOpsFeature.register(container);\n SqlModelStorageOpsFeature.register(container);\n SqlEntryStorageOpsFeature.register(container);\n }\n});\n"],"names":["HeadlessCmsSqlFeature","createFeature","container","config","sharedTables","process","TableNameResolverConfig","TableNameResolverFeature","ValueFilterFeature","GroupSchemaManagerFeature","ModelSchemaManagerFeature","EntryTableManagerFeature","FilterRegistriesFeature","SqlGroupStorageOpsFeature","SqlModelStorageOpsFeature","SqlEntryStorageOpsFeature"],"mappings":";;;;;;;;;;;AAwBO,MAAMA,wBAAwBC,cAA2C;IAC5E,MAAM;IACN,UAAU,CAACC,WAAWC;QAClB,MAAMC,eAAeC,AAAqC,WAArCA,QAAQ,GAAG,CAAC,oBAAoB;QAErDH,UAAU,gBAAgB,CAACI,yBAAyB;YAChDF;YACA,iBAAiBD,OAAO,eAAe;YACvC,iBAAiBA,OAAO,eAAe;QAC3C;QAEAI,yBAAyB,QAAQ,CAACL;QAClCM,mBAAmB,QAAQ,CAACN;QAC5BO,0BAA0B,QAAQ,CAACP;QACnCQ,0BAA0B,QAAQ,CAACR;QACnCS,yBAAyB,QAAQ,CAACT;QAElCU,wBAAwB,QAAQ,CAACV;QACjCW,0BAA0B,QAAQ,CAACX;QACnCY,0BAA0B,QAAQ,CAACZ;QACnCa,0BAA0B,QAAQ,CAACb;IACvC;AACJ"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { CmsEntryStorageOperationsCreateParams, CmsEntryValues, CmsModel } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
+
import { CreateEntryStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/CreateEntryStorageOperation.js";
|
|
3
|
+
import { KnexClient } from "@webiny/api-core-sql";
|
|
4
|
+
import { EntryTableManager } from "../../features/entryTableManager/abstractions.js";
|
|
5
|
+
declare class SqlCreateEntryImpl implements CreateEntryStorageOperation.Interface {
|
|
6
|
+
private readonly entryTableManager;
|
|
7
|
+
private readonly knex;
|
|
8
|
+
constructor(knexClient: KnexClient.Interface, entryTableManager: EntryTableManager.Interface);
|
|
9
|
+
private query;
|
|
10
|
+
execute<T extends CmsEntryValues>(_model: CmsModel, params: CmsEntryStorageOperationsCreateParams<T>): Promise<import("@webiny/api-headless-cms/types/types.js").CmsStorageEntry<T>>;
|
|
11
|
+
}
|
|
12
|
+
export declare const SqlCreateEntry: typeof SqlCreateEntryImpl & {
|
|
13
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/entry/CreateEntryStorageOperation.js").ICreateEntryStorageOperation>;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { CreateEntryStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/CreateEntryStorageOperation.js";
|
|
2
|
+
import { KnexClient } from "@webiny/api-core-sql";
|
|
3
|
+
import { EntryTableManager } from "../../features/entryTableManager/abstractions.js";
|
|
4
|
+
import { entryToRow } from "./mappers.js";
|
|
5
|
+
import { createEntryQuery } from "./queryHelpers.js";
|
|
6
|
+
class SqlCreateEntryImpl {
|
|
7
|
+
constructor(knexClient, entryTableManager){
|
|
8
|
+
this.entryTableManager = entryTableManager;
|
|
9
|
+
this.knex = knexClient.client;
|
|
10
|
+
}
|
|
11
|
+
query() {
|
|
12
|
+
return createEntryQuery(this.knex, this.entryTableManager.getTableName());
|
|
13
|
+
}
|
|
14
|
+
async execute(_model, params) {
|
|
15
|
+
await this.entryTableManager.ensureTable();
|
|
16
|
+
const storageEntry = structuredClone(params.storageEntry);
|
|
17
|
+
storageEntry.isLatest = true;
|
|
18
|
+
storageEntry.isPublished = "published" === storageEntry.status;
|
|
19
|
+
const row = entryToRow(storageEntry);
|
|
20
|
+
await this.query().insert(row);
|
|
21
|
+
delete storageEntry.isLatest;
|
|
22
|
+
delete storageEntry.isPublished;
|
|
23
|
+
return storageEntry;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
const SqlCreateEntry = CreateEntryStorageOperation.createImplementation({
|
|
27
|
+
implementation: SqlCreateEntryImpl,
|
|
28
|
+
dependencies: [
|
|
29
|
+
KnexClient,
|
|
30
|
+
EntryTableManager
|
|
31
|
+
]
|
|
32
|
+
});
|
|
33
|
+
export { SqlCreateEntry };
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=SqlCreateEntry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations/entry/SqlCreateEntry.js","sources":["../../../src/operations/entry/SqlCreateEntry.ts"],"sourcesContent":["import type { Knex } from \"knex\";\nimport type {\n CmsEntryStorageOperationsCreateParams,\n CmsEntryValues,\n CmsModel\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { CreateEntryStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/CreateEntryStorageOperation.js\";\nimport { KnexClient } from \"@webiny/api-core-sql\";\nimport { EntryTableManager } from \"~/features/entryTableManager/abstractions.js\";\nimport type { IEntryRow } from \"./types.js\";\nimport { entryToRow } from \"./mappers.js\";\nimport { createEntryQuery } from \"./queryHelpers.js\";\n\nclass SqlCreateEntryImpl implements CreateEntryStorageOperation.Interface {\n private readonly knex: Knex;\n\n public constructor(\n knexClient: KnexClient.Interface,\n private readonly entryTableManager: EntryTableManager.Interface\n ) {\n this.knex = knexClient.client;\n }\n\n private query(): Knex.QueryBuilder<IEntryRow> {\n return createEntryQuery(this.knex, this.entryTableManager.getTableName());\n }\n\n async execute<T extends CmsEntryValues>(\n _model: CmsModel,\n params: CmsEntryStorageOperationsCreateParams<T>\n ) {\n await this.entryTableManager.ensureTable();\n\n const storageEntry = structuredClone(params.storageEntry);\n storageEntry.isLatest = true;\n storageEntry.isPublished = storageEntry.status === \"published\";\n\n const row = entryToRow(storageEntry);\n await this.query().insert(row);\n\n delete storageEntry.isLatest;\n delete storageEntry.isPublished;\n return storageEntry;\n }\n}\n\nexport const SqlCreateEntry = CreateEntryStorageOperation.createImplementation({\n implementation: SqlCreateEntryImpl,\n dependencies: [KnexClient, EntryTableManager]\n});\n"],"names":["SqlCreateEntryImpl","knexClient","entryTableManager","createEntryQuery","_model","params","storageEntry","structuredClone","row","entryToRow","SqlCreateEntry","CreateEntryStorageOperation","KnexClient","EntryTableManager"],"mappings":";;;;;AAaA,MAAMA;IAGF,YACIC,UAAgC,EACfC,iBAA8C,CACjE;aADmBA,iBAAiB,GAAjBA;QAEjB,IAAI,CAAC,IAAI,GAAGD,WAAW,MAAM;IACjC;IAEQ,QAAsC;QAC1C,OAAOE,iBAAiB,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,iBAAiB,CAAC,YAAY;IAC1E;IAEA,MAAM,QACFC,MAAgB,EAChBC,MAAgD,EAClD;QACE,MAAM,IAAI,CAAC,iBAAiB,CAAC,WAAW;QAExC,MAAMC,eAAeC,gBAAgBF,OAAO,YAAY;QACxDC,aAAa,QAAQ,GAAG;QACxBA,aAAa,WAAW,GAAGA,AAAwB,gBAAxBA,aAAa,MAAM;QAE9C,MAAME,MAAMC,WAAWH;QACvB,MAAM,IAAI,CAAC,KAAK,GAAG,MAAM,CAACE;QAE1B,OAAOF,aAAa,QAAQ;QAC5B,OAAOA,aAAa,WAAW;QAC/B,OAAOA;IACX;AACJ;AAEO,MAAMI,iBAAiBC,4BAA4B,oBAAoB,CAAC;IAC3E,gBAAgBX;IAChB,cAAc;QAACY;QAAYC;KAAkB;AACjD"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { CmsEntryStorageOperationsCreateRevisionFromParams, CmsEntryValues, CmsModel } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
+
import { CreateEntryRevisionFromStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/CreateEntryRevisionFromStorageOperation.js";
|
|
3
|
+
import { KnexClient } from "@webiny/api-core-sql";
|
|
4
|
+
import { EntryTableManager } from "../../features/entryTableManager/abstractions.js";
|
|
5
|
+
declare class SqlCreateEntryRevisionFromImpl implements CreateEntryRevisionFromStorageOperation.Interface {
|
|
6
|
+
private readonly entryTableManager;
|
|
7
|
+
private readonly knex;
|
|
8
|
+
constructor(knexClient: KnexClient.Interface, entryTableManager: EntryTableManager.Interface);
|
|
9
|
+
private query;
|
|
10
|
+
private modelQuery;
|
|
11
|
+
execute<T extends CmsEntryValues>(model: CmsModel, params: CmsEntryStorageOperationsCreateRevisionFromParams<T>): Promise<import("@webiny/api-headless-cms/types/types.js").CmsEntry<T>>;
|
|
12
|
+
}
|
|
13
|
+
export declare const SqlCreateEntryRevisionFrom: typeof SqlCreateEntryRevisionFromImpl & {
|
|
14
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/entry/CreateEntryRevisionFromStorageOperation.js").ICreateEntryRevisionFromStorageOperation>;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { CreateEntryRevisionFromStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/CreateEntryRevisionFromStorageOperation.js";
|
|
2
|
+
import { KnexClient } from "@webiny/api-core-sql";
|
|
3
|
+
import { EntryTableManager } from "../../features/entryTableManager/abstractions.js";
|
|
4
|
+
import { entryToRow } from "./mappers.js";
|
|
5
|
+
import { createEntryQuery, createModelEntryQuery } from "./queryHelpers.js";
|
|
6
|
+
class SqlCreateEntryRevisionFromImpl {
|
|
7
|
+
constructor(knexClient, entryTableManager){
|
|
8
|
+
this.entryTableManager = entryTableManager;
|
|
9
|
+
this.knex = knexClient.client;
|
|
10
|
+
}
|
|
11
|
+
query() {
|
|
12
|
+
return createEntryQuery(this.knex, this.entryTableManager.getTableName());
|
|
13
|
+
}
|
|
14
|
+
modelQuery(model) {
|
|
15
|
+
return createModelEntryQuery(this.knex, this.entryTableManager.getTableName(), model);
|
|
16
|
+
}
|
|
17
|
+
async execute(model, params) {
|
|
18
|
+
await this.entryTableManager.ensureTable();
|
|
19
|
+
const isPublished = "published" === params.entry.status;
|
|
20
|
+
const oldLatestRows = await this.modelQuery(model).andWhere("entryId", params.entry.entryId).andWhere("isLatest", true);
|
|
21
|
+
for (const row of oldLatestRows){
|
|
22
|
+
const parsed = JSON.parse(row.data);
|
|
23
|
+
parsed.isLatest = false;
|
|
24
|
+
await this.modelQuery(model).andWhere("id", row.id).update({
|
|
25
|
+
isLatest: false,
|
|
26
|
+
data: JSON.stringify(parsed)
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
if (isPublished) {
|
|
30
|
+
const oldPublishedRows = await this.modelQuery(model).andWhere("entryId", params.entry.entryId).andWhere("isPublished", true);
|
|
31
|
+
for (const row of oldPublishedRows){
|
|
32
|
+
const parsed = JSON.parse(row.data);
|
|
33
|
+
parsed.isPublished = false;
|
|
34
|
+
parsed.status = "unpublished";
|
|
35
|
+
await this.modelQuery(model).andWhere("id", row.id).update({
|
|
36
|
+
isPublished: false,
|
|
37
|
+
data: JSON.stringify(parsed)
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
const se = params.storageEntry;
|
|
42
|
+
se.isLatest = true;
|
|
43
|
+
se.isPublished = isPublished;
|
|
44
|
+
const row = entryToRow(se);
|
|
45
|
+
await this.query().insert(row);
|
|
46
|
+
return params.entry;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const SqlCreateEntryRevisionFrom = CreateEntryRevisionFromStorageOperation.createImplementation({
|
|
50
|
+
implementation: SqlCreateEntryRevisionFromImpl,
|
|
51
|
+
dependencies: [
|
|
52
|
+
KnexClient,
|
|
53
|
+
EntryTableManager
|
|
54
|
+
]
|
|
55
|
+
});
|
|
56
|
+
export { SqlCreateEntryRevisionFrom };
|
|
57
|
+
|
|
58
|
+
//# sourceMappingURL=SqlCreateEntryRevisionFrom.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations/entry/SqlCreateEntryRevisionFrom.js","sources":["../../../src/operations/entry/SqlCreateEntryRevisionFrom.ts"],"sourcesContent":["import type { Knex } from \"knex\";\nimport type {\n CmsEntryStorageOperationsCreateRevisionFromParams,\n CmsEntryValues,\n CmsModel,\n CmsStorageEntry\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { CreateEntryRevisionFromStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/CreateEntryRevisionFromStorageOperation.js\";\nimport { KnexClient } from \"@webiny/api-core-sql\";\nimport { EntryTableManager } from \"~/features/entryTableManager/abstractions.js\";\nimport type { IEntryRow } from \"./types.js\";\nimport { entryToRow } from \"./mappers.js\";\nimport { createEntryQuery, createModelEntryQuery } from \"./queryHelpers.js\";\n\nclass SqlCreateEntryRevisionFromImpl implements CreateEntryRevisionFromStorageOperation.Interface {\n private readonly knex: Knex;\n\n public constructor(\n knexClient: KnexClient.Interface,\n private readonly entryTableManager: EntryTableManager.Interface\n ) {\n this.knex = knexClient.client;\n }\n\n private query(): Knex.QueryBuilder<IEntryRow> {\n return createEntryQuery(this.knex, this.entryTableManager.getTableName());\n }\n\n private modelQuery(model: CmsModel): Knex.QueryBuilder<IEntryRow> {\n return createModelEntryQuery(this.knex, this.entryTableManager.getTableName(), model);\n }\n\n async execute<T extends CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsCreateRevisionFromParams<T>\n ) {\n await this.entryTableManager.ensureTable();\n\n const isPublished = params.entry.status === \"published\";\n\n const oldLatestRows = await this.modelQuery(model)\n .andWhere(\"entryId\", params.entry.entryId)\n .andWhere(\"isLatest\", true);\n\n for (const row of oldLatestRows) {\n const parsed = JSON.parse(row.data);\n parsed.isLatest = false;\n\n await this.modelQuery(model)\n .andWhere(\"id\", row.id)\n .update({ isLatest: false, data: JSON.stringify(parsed) });\n }\n\n if (isPublished) {\n const oldPublishedRows = await this.modelQuery(model)\n .andWhere(\"entryId\", params.entry.entryId)\n .andWhere(\"isPublished\", true);\n\n for (const row of oldPublishedRows) {\n const parsed = JSON.parse(row.data);\n parsed.isPublished = false;\n parsed.status = \"unpublished\";\n\n await this.modelQuery(model)\n .andWhere(\"id\", row.id)\n .update({ isPublished: false, data: JSON.stringify(parsed) });\n }\n }\n\n const se = params.storageEntry as CmsStorageEntry;\n se.isLatest = true;\n se.isPublished = isPublished;\n\n const row = entryToRow(se);\n await this.query().insert(row);\n\n return params.entry;\n }\n}\n\nexport const SqlCreateEntryRevisionFrom =\n CreateEntryRevisionFromStorageOperation.createImplementation({\n implementation: SqlCreateEntryRevisionFromImpl,\n dependencies: [KnexClient, EntryTableManager]\n });\n"],"names":["SqlCreateEntryRevisionFromImpl","knexClient","entryTableManager","createEntryQuery","model","createModelEntryQuery","params","isPublished","oldLatestRows","row","parsed","JSON","oldPublishedRows","se","entryToRow","SqlCreateEntryRevisionFrom","CreateEntryRevisionFromStorageOperation","KnexClient","EntryTableManager"],"mappings":";;;;;AAcA,MAAMA;IAGF,YACIC,UAAgC,EACfC,iBAA8C,CACjE;aADmBA,iBAAiB,GAAjBA;QAEjB,IAAI,CAAC,IAAI,GAAGD,WAAW,MAAM;IACjC;IAEQ,QAAsC;QAC1C,OAAOE,iBAAiB,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,iBAAiB,CAAC,YAAY;IAC1E;IAEQ,WAAWC,KAAe,EAAgC;QAC9D,OAAOC,sBAAsB,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,iBAAiB,CAAC,YAAY,IAAID;IACnF;IAEA,MAAM,QACFA,KAAe,EACfE,MAA4D,EAC9D;QACE,MAAM,IAAI,CAAC,iBAAiB,CAAC,WAAW;QAExC,MAAMC,cAAcD,AAAwB,gBAAxBA,OAAO,KAAK,CAAC,MAAM;QAEvC,MAAME,gBAAgB,MAAM,IAAI,CAAC,UAAU,CAACJ,OACvC,QAAQ,CAAC,WAAWE,OAAO,KAAK,CAAC,OAAO,EACxC,QAAQ,CAAC,YAAY;QAE1B,KAAK,MAAMG,OAAOD,cAAe;YAC7B,MAAME,SAASC,KAAK,KAAK,CAACF,IAAI,IAAI;YAClCC,OAAO,QAAQ,GAAG;YAElB,MAAM,IAAI,CAAC,UAAU,CAACN,OACjB,QAAQ,CAAC,MAAMK,IAAI,EAAE,EACrB,MAAM,CAAC;gBAAE,UAAU;gBAAO,MAAME,KAAK,SAAS,CAACD;YAAQ;QAChE;QAEA,IAAIH,aAAa;YACb,MAAMK,mBAAmB,MAAM,IAAI,CAAC,UAAU,CAACR,OAC1C,QAAQ,CAAC,WAAWE,OAAO,KAAK,CAAC,OAAO,EACxC,QAAQ,CAAC,eAAe;YAE7B,KAAK,MAAMG,OAAOG,iBAAkB;gBAChC,MAAMF,SAASC,KAAK,KAAK,CAACF,IAAI,IAAI;gBAClCC,OAAO,WAAW,GAAG;gBACrBA,OAAO,MAAM,GAAG;gBAEhB,MAAM,IAAI,CAAC,UAAU,CAACN,OACjB,QAAQ,CAAC,MAAMK,IAAI,EAAE,EACrB,MAAM,CAAC;oBAAE,aAAa;oBAAO,MAAME,KAAK,SAAS,CAACD;gBAAQ;YACnE;QACJ;QAEA,MAAMG,KAAKP,OAAO,YAAY;QAC9BO,GAAG,QAAQ,GAAG;QACdA,GAAG,WAAW,GAAGN;QAEjB,MAAME,MAAMK,WAAWD;QACvB,MAAM,IAAI,CAAC,KAAK,GAAG,MAAM,CAACJ;QAE1B,OAAOH,OAAO,KAAK;IACvB;AACJ;AAEO,MAAMS,6BACTC,wCAAwC,oBAAoB,CAAC;IACzD,gBAAgBhB;IAChB,cAAc;QAACiB;QAAYC;KAAkB;AACjD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { CmsEntryStorageOperationsDeleteParams, CmsModel } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
+
import { DeleteEntryStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/DeleteEntryStorageOperation.js";
|
|
3
|
+
import { KnexClient } from "@webiny/api-core-sql";
|
|
4
|
+
import { EntryTableManager } from "../../features/entryTableManager/abstractions.js";
|
|
5
|
+
declare class SqlDeleteEntryImpl implements DeleteEntryStorageOperation.Interface {
|
|
6
|
+
private readonly entryTableManager;
|
|
7
|
+
private readonly knex;
|
|
8
|
+
constructor(knexClient: KnexClient.Interface, entryTableManager: EntryTableManager.Interface);
|
|
9
|
+
private modelQuery;
|
|
10
|
+
execute(model: CmsModel, params: CmsEntryStorageOperationsDeleteParams): Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
export declare const SqlDeleteEntry: typeof SqlDeleteEntryImpl & {
|
|
13
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/entry/DeleteEntryStorageOperation.js").IDeleteEntryStorageOperation>;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { DeleteEntryStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/DeleteEntryStorageOperation.js";
|
|
2
|
+
import { KnexClient } from "@webiny/api-core-sql";
|
|
3
|
+
import { EntryTableManager } from "../../features/entryTableManager/abstractions.js";
|
|
4
|
+
import { parseIdentifier } from "@webiny/utils";
|
|
5
|
+
import { createModelEntryQuery } from "./queryHelpers.js";
|
|
6
|
+
class SqlDeleteEntryImpl {
|
|
7
|
+
constructor(knexClient, entryTableManager){
|
|
8
|
+
this.entryTableManager = entryTableManager;
|
|
9
|
+
this.knex = knexClient.client;
|
|
10
|
+
}
|
|
11
|
+
modelQuery(model) {
|
|
12
|
+
return createModelEntryQuery(this.knex, this.entryTableManager.getTableName(), model);
|
|
13
|
+
}
|
|
14
|
+
async execute(model, params) {
|
|
15
|
+
await this.entryTableManager.ensureTable();
|
|
16
|
+
const { id: entryId } = parseIdentifier(params.entry.id);
|
|
17
|
+
await this.modelQuery(model).andWhere("entryId", entryId).delete();
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
const SqlDeleteEntry = DeleteEntryStorageOperation.createImplementation({
|
|
21
|
+
implementation: SqlDeleteEntryImpl,
|
|
22
|
+
dependencies: [
|
|
23
|
+
KnexClient,
|
|
24
|
+
EntryTableManager
|
|
25
|
+
]
|
|
26
|
+
});
|
|
27
|
+
export { SqlDeleteEntry };
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=SqlDeleteEntry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations/entry/SqlDeleteEntry.js","sources":["../../../src/operations/entry/SqlDeleteEntry.ts"],"sourcesContent":["import type { Knex } from \"knex\";\nimport type {\n CmsEntryStorageOperationsDeleteParams,\n CmsModel\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { DeleteEntryStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/DeleteEntryStorageOperation.js\";\nimport { KnexClient } from \"@webiny/api-core-sql\";\nimport { EntryTableManager } from \"~/features/entryTableManager/abstractions.js\";\nimport { parseIdentifier } from \"@webiny/utils\";\nimport type { IEntryRow } from \"./types.js\";\nimport { createModelEntryQuery } from \"./queryHelpers.js\";\n\nclass SqlDeleteEntryImpl implements DeleteEntryStorageOperation.Interface {\n private readonly knex: Knex;\n\n public constructor(\n knexClient: KnexClient.Interface,\n private readonly entryTableManager: EntryTableManager.Interface\n ) {\n this.knex = knexClient.client;\n }\n\n private modelQuery(model: CmsModel): Knex.QueryBuilder<IEntryRow> {\n return createModelEntryQuery(this.knex, this.entryTableManager.getTableName(), model);\n }\n\n async execute(model: CmsModel, params: CmsEntryStorageOperationsDeleteParams) {\n await this.entryTableManager.ensureTable();\n\n const { id: entryId } = parseIdentifier(params.entry.id);\n\n await this.modelQuery(model).andWhere(\"entryId\", entryId).delete();\n }\n}\n\nexport const SqlDeleteEntry = DeleteEntryStorageOperation.createImplementation({\n implementation: SqlDeleteEntryImpl,\n dependencies: [KnexClient, EntryTableManager]\n});\n"],"names":["SqlDeleteEntryImpl","knexClient","entryTableManager","model","createModelEntryQuery","params","entryId","parseIdentifier","SqlDeleteEntry","DeleteEntryStorageOperation","KnexClient","EntryTableManager"],"mappings":";;;;;AAYA,MAAMA;IAGF,YACIC,UAAgC,EACfC,iBAA8C,CACjE;aADmBA,iBAAiB,GAAjBA;QAEjB,IAAI,CAAC,IAAI,GAAGD,WAAW,MAAM;IACjC;IAEQ,WAAWE,KAAe,EAAgC;QAC9D,OAAOC,sBAAsB,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,iBAAiB,CAAC,YAAY,IAAID;IACnF;IAEA,MAAM,QAAQA,KAAe,EAAEE,MAA6C,EAAE;QAC1E,MAAM,IAAI,CAAC,iBAAiB,CAAC,WAAW;QAExC,MAAM,EAAE,IAAIC,OAAO,EAAE,GAAGC,gBAAgBF,OAAO,KAAK,CAAC,EAAE;QAEvD,MAAM,IAAI,CAAC,UAAU,CAACF,OAAO,QAAQ,CAAC,WAAWG,SAAS,MAAM;IACpE;AACJ;AAEO,MAAME,iBAAiBC,4BAA4B,oBAAoB,CAAC;IAC3E,gBAAgBT;IAChB,cAAc;QAACU;QAAYC;KAAkB;AACjD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { CmsEntryStorageOperationsDeleteRevisionParams, CmsEntryValues, CmsModel } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
+
import { DeleteEntryRevisionStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/DeleteEntryRevisionStorageOperation.js";
|
|
3
|
+
import { KnexClient } from "@webiny/api-core-sql";
|
|
4
|
+
import { EntryTableManager } from "../../features/entryTableManager/abstractions.js";
|
|
5
|
+
declare class SqlDeleteEntryRevisionImpl implements DeleteEntryRevisionStorageOperation.Interface {
|
|
6
|
+
private readonly entryTableManager;
|
|
7
|
+
private readonly knex;
|
|
8
|
+
constructor(knexClient: KnexClient.Interface, entryTableManager: EntryTableManager.Interface);
|
|
9
|
+
private modelQuery;
|
|
10
|
+
execute<T extends CmsEntryValues>(model: CmsModel, params: CmsEntryStorageOperationsDeleteRevisionParams<T>): Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
export declare const SqlDeleteEntryRevision: typeof SqlDeleteEntryRevisionImpl & {
|
|
13
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/entry/DeleteEntryRevisionStorageOperation.js").IDeleteEntryRevisionStorageOperation>;
|
|
14
|
+
};
|
|
15
|
+
export {};
|