@webiny/api-headless-cms-sql 0.0.0-unstable.9f53ea597d → 6.6.0-alpha.0
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 +39 -26
- package/features/entryTableManager/EntryTableManager.js.map +1 -1
- package/features/modelSchemaManager/ModelSchemaManager.js +0 -1
- package/features/modelSchemaManager/ModelSchemaManager.js.map +1 -1
- package/index.d.ts +4 -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 +15 -0
- package/operations/entry/SqlCreateEntryRevisionFrom.js +55 -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 +25 -0
- package/operations/entry/SqlGetEntry.js +56 -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 +25 -0
- package/operations/entry/SqlGetUniqueFieldValues.js +58 -0
- package/operations/entry/SqlGetUniqueFieldValues.js.map +1 -0
- package/operations/entry/SqlListEntries.d.ts +25 -0
- package/operations/entry/SqlListEntries.js +52 -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 +23 -0
- package/operations/entry/queryHelpers.js +105 -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/operations/model/mappers.js +2 -4
- package/operations/model/mappers.js.map +1 -1
- package/operations/model/types.d.ts +0 -1
- package/operations/model/types.js +1 -2
- package/operations/model/types.js.map +1 -1
- package/package.json +14 -11
- package/operations/entry/index.d.ts +0 -13
- package/operations/entry/index.js +0 -362
- 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
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { CreateModelStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/model/CreateModelStorageOperation.js";
|
|
2
|
+
import { TableNameResolver } from "../../features/tableNameResolver/abstractions.js";
|
|
3
|
+
import { ModelSchemaManager } from "../../features/modelSchemaManager/abstractions.js";
|
|
4
|
+
import { modelToRow } from "./mappers.js";
|
|
5
|
+
import { KnexClient } from "@webiny/api-core-sql";
|
|
6
|
+
class SqlCreateModelImpl {
|
|
7
|
+
constructor(knex, tableNameResolver, modelSchemaManager){
|
|
8
|
+
this.knex = knex;
|
|
9
|
+
this.modelSchemaManager = modelSchemaManager;
|
|
10
|
+
this.tableName = tableNameResolver.resolve("models");
|
|
11
|
+
}
|
|
12
|
+
async execute(params) {
|
|
13
|
+
const model = params.model;
|
|
14
|
+
const row = modelToRow(model);
|
|
15
|
+
await this.modelSchemaManager.ensure(this.tableName);
|
|
16
|
+
await this.knex.client(this.tableName).insert(row);
|
|
17
|
+
return model;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
const SqlCreateModel = CreateModelStorageOperation.createImplementation({
|
|
21
|
+
implementation: SqlCreateModelImpl,
|
|
22
|
+
dependencies: [
|
|
23
|
+
KnexClient,
|
|
24
|
+
TableNameResolver,
|
|
25
|
+
ModelSchemaManager
|
|
26
|
+
]
|
|
27
|
+
});
|
|
28
|
+
export { SqlCreateModel };
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=SqlCreateModel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations/model/SqlCreateModel.js","sources":["../../../src/operations/model/SqlCreateModel.ts"],"sourcesContent":["import type { CmsModelStorageOperationsCreateParams } from \"@webiny/api-headless-cms/types/index.js\";\nimport type { IModelRow } from \"./types.js\";\nimport { CreateModelStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/model/CreateModelStorageOperation.js\";\nimport { TableNameResolver } from \"~/features/tableNameResolver/abstractions.js\";\nimport { ModelSchemaManager } from \"~/features/modelSchemaManager/abstractions.js\";\nimport { modelToRow } from \"./mappers.js\";\nimport { KnexClient } from \"@webiny/api-core-sql\";\n\nclass SqlCreateModelImpl implements CreateModelStorageOperation.Interface {\n private tableName: string;\n\n constructor(\n private knex: KnexClient.Interface,\n tableNameResolver: TableNameResolver.Interface,\n private modelSchemaManager: ModelSchemaManager.Interface\n ) {\n this.tableName = tableNameResolver.resolve(\"models\");\n }\n\n async execute(params: CmsModelStorageOperationsCreateParams) {\n const model = params.model;\n const row = modelToRow(model);\n\n await this.modelSchemaManager.ensure(this.tableName);\n await this.knex.client<IModelRow>(this.tableName).insert(row);\n\n return model;\n }\n}\n\nexport const SqlCreateModel = CreateModelStorageOperation.createImplementation({\n implementation: SqlCreateModelImpl,\n dependencies: [KnexClient, TableNameResolver, ModelSchemaManager]\n});\n"],"names":["SqlCreateModelImpl","knex","tableNameResolver","modelSchemaManager","params","model","row","modelToRow","SqlCreateModel","CreateModelStorageOperation","KnexClient","TableNameResolver","ModelSchemaManager"],"mappings":";;;;;AAQA,MAAMA;IAGF,YACYC,IAA0B,EAClCC,iBAA8C,EACtCC,kBAAgD,CAC1D;aAHUF,IAAI,GAAJA;aAEAE,kBAAkB,GAAlBA;QAER,IAAI,CAAC,SAAS,GAAGD,kBAAkB,OAAO,CAAC;IAC/C;IAEA,MAAM,QAAQE,MAA6C,EAAE;QACzD,MAAMC,QAAQD,OAAO,KAAK;QAC1B,MAAME,MAAMC,WAAWF;QAEvB,MAAM,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS;QACnD,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAY,IAAI,CAAC,SAAS,EAAE,MAAM,CAACC;QAEzD,OAAOD;IACX;AACJ;AAEO,MAAMG,iBAAiBC,4BAA4B,oBAAoB,CAAC;IAC3E,gBAAgBT;IAChB,cAAc;QAACU;QAAYC;QAAmBC;KAAmB;AACrE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { CmsModelStorageOperationsDeleteParams } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
+
import { DeleteModelStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/model/DeleteModelStorageOperation.js";
|
|
3
|
+
import { TableNameResolver } from "../../features/tableNameResolver/abstractions.js";
|
|
4
|
+
import { ModelSchemaManager } from "../../features/modelSchemaManager/abstractions.js";
|
|
5
|
+
import { KnexClient } from "@webiny/api-core-sql";
|
|
6
|
+
declare class SqlDeleteModelImpl implements DeleteModelStorageOperation.Interface {
|
|
7
|
+
private knex;
|
|
8
|
+
private modelSchemaManager;
|
|
9
|
+
private tableName;
|
|
10
|
+
constructor(knex: KnexClient.Interface, tableNameResolver: TableNameResolver.Interface, modelSchemaManager: ModelSchemaManager.Interface);
|
|
11
|
+
execute(params: CmsModelStorageOperationsDeleteParams): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
export declare const SqlDeleteModel: typeof SqlDeleteModelImpl & {
|
|
14
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/model/DeleteModelStorageOperation.js").IDeleteModelStorageOperation>;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { DeleteModelStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/model/DeleteModelStorageOperation.js";
|
|
2
|
+
import { TableNameResolver } from "../../features/tableNameResolver/abstractions.js";
|
|
3
|
+
import { ModelSchemaManager } from "../../features/modelSchemaManager/abstractions.js";
|
|
4
|
+
import { KnexClient } from "@webiny/api-core-sql";
|
|
5
|
+
class SqlDeleteModelImpl {
|
|
6
|
+
constructor(knex, tableNameResolver, modelSchemaManager){
|
|
7
|
+
this.knex = knex;
|
|
8
|
+
this.modelSchemaManager = modelSchemaManager;
|
|
9
|
+
this.tableName = tableNameResolver.resolve("models");
|
|
10
|
+
}
|
|
11
|
+
async execute(params) {
|
|
12
|
+
await this.modelSchemaManager.ensure(this.tableName);
|
|
13
|
+
await this.knex.client(this.tableName).where("modelId", params.model.modelId).delete();
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
const SqlDeleteModel = DeleteModelStorageOperation.createImplementation({
|
|
17
|
+
implementation: SqlDeleteModelImpl,
|
|
18
|
+
dependencies: [
|
|
19
|
+
KnexClient,
|
|
20
|
+
TableNameResolver,
|
|
21
|
+
ModelSchemaManager
|
|
22
|
+
]
|
|
23
|
+
});
|
|
24
|
+
export { SqlDeleteModel };
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=SqlDeleteModel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations/model/SqlDeleteModel.js","sources":["../../../src/operations/model/SqlDeleteModel.ts"],"sourcesContent":["import type { CmsModelStorageOperationsDeleteParams } from \"@webiny/api-headless-cms/types/index.js\";\nimport type { IModelRow } from \"./types.js\";\nimport { DeleteModelStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/model/DeleteModelStorageOperation.js\";\nimport { TableNameResolver } from \"~/features/tableNameResolver/abstractions.js\";\nimport { ModelSchemaManager } from \"~/features/modelSchemaManager/abstractions.js\";\nimport { KnexClient } from \"@webiny/api-core-sql\";\n\nclass SqlDeleteModelImpl implements DeleteModelStorageOperation.Interface {\n private tableName: string;\n\n constructor(\n private knex: KnexClient.Interface,\n tableNameResolver: TableNameResolver.Interface,\n private modelSchemaManager: ModelSchemaManager.Interface\n ) {\n this.tableName = tableNameResolver.resolve(\"models\");\n }\n\n async execute(params: CmsModelStorageOperationsDeleteParams) {\n await this.modelSchemaManager.ensure(this.tableName);\n await this.knex\n .client<IModelRow>(this.tableName)\n .where(\"modelId\", params.model.modelId)\n .delete();\n }\n}\n\nexport const SqlDeleteModel = DeleteModelStorageOperation.createImplementation({\n implementation: SqlDeleteModelImpl,\n dependencies: [KnexClient, TableNameResolver, ModelSchemaManager]\n});\n"],"names":["SqlDeleteModelImpl","knex","tableNameResolver","modelSchemaManager","params","SqlDeleteModel","DeleteModelStorageOperation","KnexClient","TableNameResolver","ModelSchemaManager"],"mappings":";;;;AAOA,MAAMA;IAGF,YACYC,IAA0B,EAClCC,iBAA8C,EACtCC,kBAAgD,CAC1D;aAHUF,IAAI,GAAJA;aAEAE,kBAAkB,GAAlBA;QAER,IAAI,CAAC,SAAS,GAAGD,kBAAkB,OAAO,CAAC;IAC/C;IAEA,MAAM,QAAQE,MAA6C,EAAE;QACzD,MAAM,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS;QACnD,MAAM,IAAI,CAAC,IAAI,CACV,MAAM,CAAY,IAAI,CAAC,SAAS,EAChC,KAAK,CAAC,WAAWA,OAAO,KAAK,CAAC,OAAO,EACrC,MAAM;IACf;AACJ;AAEO,MAAMC,iBAAiBC,4BAA4B,oBAAoB,CAAC;IAC3E,gBAAgBN;IAChB,cAAc;QAACO;QAAYC;QAAmBC;KAAmB;AACrE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { CmsModelStorageOperationsGetParams } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
+
import { GetModelStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/model/GetModelStorageOperation.js";
|
|
3
|
+
import { TableNameResolver } from "../../features/tableNameResolver/abstractions.js";
|
|
4
|
+
import { ModelSchemaManager } from "../../features/modelSchemaManager/abstractions.js";
|
|
5
|
+
import { KnexClient } from "@webiny/api-core-sql";
|
|
6
|
+
declare class SqlGetModelImpl implements GetModelStorageOperation.Interface {
|
|
7
|
+
private knex;
|
|
8
|
+
private modelSchemaManager;
|
|
9
|
+
private tableName;
|
|
10
|
+
constructor(knex: KnexClient.Interface, tableNameResolver: TableNameResolver.Interface, modelSchemaManager: ModelSchemaManager.Interface);
|
|
11
|
+
execute(params: CmsModelStorageOperationsGetParams): Promise<import("@webiny/api-headless-cms/types/model.js").StorageCmsModel | null>;
|
|
12
|
+
}
|
|
13
|
+
export declare const SqlGetModel: typeof SqlGetModelImpl & {
|
|
14
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/model/GetModelStorageOperation.js").IGetModelStorageOperation>;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { GetModelStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/model/GetModelStorageOperation.js";
|
|
2
|
+
import { TableNameResolver } from "../../features/tableNameResolver/abstractions.js";
|
|
3
|
+
import { ModelSchemaManager } from "../../features/modelSchemaManager/abstractions.js";
|
|
4
|
+
import { rowToModel } from "./mappers.js";
|
|
5
|
+
import { KnexClient } from "@webiny/api-core-sql";
|
|
6
|
+
class SqlGetModelImpl {
|
|
7
|
+
constructor(knex, tableNameResolver, modelSchemaManager){
|
|
8
|
+
this.knex = knex;
|
|
9
|
+
this.modelSchemaManager = modelSchemaManager;
|
|
10
|
+
this.tableName = tableNameResolver.resolve("models");
|
|
11
|
+
}
|
|
12
|
+
async execute(params) {
|
|
13
|
+
await this.modelSchemaManager.ensure(this.tableName);
|
|
14
|
+
const row = await this.knex.client(this.tableName).where("modelId", params.modelId).where("tenant", params.tenant).first();
|
|
15
|
+
if (!row) return null;
|
|
16
|
+
return rowToModel(row);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
const SqlGetModel = GetModelStorageOperation.createImplementation({
|
|
20
|
+
implementation: SqlGetModelImpl,
|
|
21
|
+
dependencies: [
|
|
22
|
+
KnexClient,
|
|
23
|
+
TableNameResolver,
|
|
24
|
+
ModelSchemaManager
|
|
25
|
+
]
|
|
26
|
+
});
|
|
27
|
+
export { SqlGetModel };
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=SqlGetModel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations/model/SqlGetModel.js","sources":["../../../src/operations/model/SqlGetModel.ts"],"sourcesContent":["import type { CmsModelStorageOperationsGetParams } from \"@webiny/api-headless-cms/types/index.js\";\nimport type { IModelRow } from \"./types.js\";\nimport { GetModelStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/model/GetModelStorageOperation.js\";\nimport { TableNameResolver } from \"~/features/tableNameResolver/abstractions.js\";\nimport { ModelSchemaManager } from \"~/features/modelSchemaManager/abstractions.js\";\nimport { rowToModel } from \"./mappers.js\";\nimport { KnexClient } from \"@webiny/api-core-sql\";\n\nclass SqlGetModelImpl implements GetModelStorageOperation.Interface {\n private tableName: string;\n\n constructor(\n private knex: KnexClient.Interface,\n tableNameResolver: TableNameResolver.Interface,\n private modelSchemaManager: ModelSchemaManager.Interface\n ) {\n this.tableName = tableNameResolver.resolve(\"models\");\n }\n\n async execute(params: CmsModelStorageOperationsGetParams) {\n await this.modelSchemaManager.ensure(this.tableName);\n\n const row = await this.knex\n .client<IModelRow>(this.tableName)\n .where(\"modelId\", params.modelId)\n .where(\"tenant\", params.tenant)\n .first();\n\n if (!row) {\n return null;\n }\n\n return rowToModel(row);\n }\n}\n\nexport const SqlGetModel = GetModelStorageOperation.createImplementation({\n implementation: SqlGetModelImpl,\n dependencies: [KnexClient, TableNameResolver, ModelSchemaManager]\n});\n"],"names":["SqlGetModelImpl","knex","tableNameResolver","modelSchemaManager","params","row","rowToModel","SqlGetModel","GetModelStorageOperation","KnexClient","TableNameResolver","ModelSchemaManager"],"mappings":";;;;;AAQA,MAAMA;IAGF,YACYC,IAA0B,EAClCC,iBAA8C,EACtCC,kBAAgD,CAC1D;aAHUF,IAAI,GAAJA;aAEAE,kBAAkB,GAAlBA;QAER,IAAI,CAAC,SAAS,GAAGD,kBAAkB,OAAO,CAAC;IAC/C;IAEA,MAAM,QAAQE,MAA0C,EAAE;QACtD,MAAM,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS;QAEnD,MAAMC,MAAM,MAAM,IAAI,CAAC,IAAI,CACtB,MAAM,CAAY,IAAI,CAAC,SAAS,EAChC,KAAK,CAAC,WAAWD,OAAO,OAAO,EAC/B,KAAK,CAAC,UAAUA,OAAO,MAAM,EAC7B,KAAK;QAEV,IAAI,CAACC,KACD,OAAO;QAGX,OAAOC,WAAWD;IACtB;AACJ;AAEO,MAAME,cAAcC,yBAAyB,oBAAoB,CAAC;IACrE,gBAAgBR;IAChB,cAAc;QAACS;QAAYC;QAAmBC;KAAmB;AACrE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { CmsModelStorageOperationsListParams } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
+
import { ListModelsStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/model/ListModelsStorageOperation.js";
|
|
3
|
+
import { TableNameResolver } from "../../features/tableNameResolver/abstractions.js";
|
|
4
|
+
import { ModelSchemaManager } from "../../features/modelSchemaManager/abstractions.js";
|
|
5
|
+
import { KnexClient } from "@webiny/api-core-sql";
|
|
6
|
+
declare class SqlListModelsImpl implements ListModelsStorageOperation.Interface {
|
|
7
|
+
private knex;
|
|
8
|
+
private modelSchemaManager;
|
|
9
|
+
private tableName;
|
|
10
|
+
constructor(knex: KnexClient.Interface, tableNameResolver: TableNameResolver.Interface, modelSchemaManager: ModelSchemaManager.Interface);
|
|
11
|
+
execute(params: CmsModelStorageOperationsListParams): Promise<import("@webiny/api-headless-cms/types/model.js").StorageCmsModel[]>;
|
|
12
|
+
}
|
|
13
|
+
export declare const SqlListModels: typeof SqlListModelsImpl & {
|
|
14
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/model/ListModelsStorageOperation.js").IListModelsStorageOperation>;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ListModelsStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/model/ListModelsStorageOperation.js";
|
|
2
|
+
import { TableNameResolver } from "../../features/tableNameResolver/abstractions.js";
|
|
3
|
+
import { ModelSchemaManager } from "../../features/modelSchemaManager/abstractions.js";
|
|
4
|
+
import { rowToModel } from "./mappers.js";
|
|
5
|
+
import { KnexClient } from "@webiny/api-core-sql";
|
|
6
|
+
class SqlListModelsImpl {
|
|
7
|
+
constructor(knex, tableNameResolver, modelSchemaManager){
|
|
8
|
+
this.knex = knex;
|
|
9
|
+
this.modelSchemaManager = modelSchemaManager;
|
|
10
|
+
this.tableName = tableNameResolver.resolve("models");
|
|
11
|
+
}
|
|
12
|
+
async execute(params) {
|
|
13
|
+
await this.modelSchemaManager.ensure(this.tableName);
|
|
14
|
+
const { where } = params;
|
|
15
|
+
const qb = this.knex.client(this.tableName).where("tenant", where.tenant);
|
|
16
|
+
qb.orderBy("modelId", "asc");
|
|
17
|
+
const rows = await qb.select();
|
|
18
|
+
return rows.map(rowToModel);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
const SqlListModels = ListModelsStorageOperation.createImplementation({
|
|
22
|
+
implementation: SqlListModelsImpl,
|
|
23
|
+
dependencies: [
|
|
24
|
+
KnexClient,
|
|
25
|
+
TableNameResolver,
|
|
26
|
+
ModelSchemaManager
|
|
27
|
+
]
|
|
28
|
+
});
|
|
29
|
+
export { SqlListModels };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=SqlListModels.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations/model/SqlListModels.js","sources":["../../../src/operations/model/SqlListModels.ts"],"sourcesContent":["import type { CmsModelStorageOperationsListParams } from \"@webiny/api-headless-cms/types/index.js\";\nimport type { IModelRow } from \"./types.js\";\nimport { ListModelsStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/model/ListModelsStorageOperation.js\";\nimport { TableNameResolver } from \"~/features/tableNameResolver/abstractions.js\";\nimport { ModelSchemaManager } from \"~/features/modelSchemaManager/abstractions.js\";\nimport { rowToModel } from \"./mappers.js\";\nimport { KnexClient } from \"@webiny/api-core-sql\";\n\nclass SqlListModelsImpl implements ListModelsStorageOperation.Interface {\n private tableName: string;\n\n constructor(\n private knex: KnexClient.Interface,\n tableNameResolver: TableNameResolver.Interface,\n private modelSchemaManager: ModelSchemaManager.Interface\n ) {\n this.tableName = tableNameResolver.resolve(\"models\");\n }\n\n async execute(params: CmsModelStorageOperationsListParams) {\n await this.modelSchemaManager.ensure(this.tableName);\n\n const { where } = params;\n const qb = this.knex.client<IModelRow>(this.tableName).where(\"tenant\", where.tenant);\n\n qb.orderBy(\"modelId\", \"asc\");\n\n const rows = await qb.select<IModelRow[]>();\n\n return rows.map(rowToModel);\n }\n}\n\nexport const SqlListModels = ListModelsStorageOperation.createImplementation({\n implementation: SqlListModelsImpl,\n dependencies: [KnexClient, TableNameResolver, ModelSchemaManager]\n});\n"],"names":["SqlListModelsImpl","knex","tableNameResolver","modelSchemaManager","params","where","qb","rows","rowToModel","SqlListModels","ListModelsStorageOperation","KnexClient","TableNameResolver","ModelSchemaManager"],"mappings":";;;;;AAQA,MAAMA;IAGF,YACYC,IAA0B,EAClCC,iBAA8C,EACtCC,kBAAgD,CAC1D;aAHUF,IAAI,GAAJA;aAEAE,kBAAkB,GAAlBA;QAER,IAAI,CAAC,SAAS,GAAGD,kBAAkB,OAAO,CAAC;IAC/C;IAEA,MAAM,QAAQE,MAA2C,EAAE;QACvD,MAAM,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS;QAEnD,MAAM,EAAEC,KAAK,EAAE,GAAGD;QAClB,MAAME,KAAK,IAAI,CAAC,IAAI,CAAC,MAAM,CAAY,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,UAAUD,MAAM,MAAM;QAEnFC,GAAG,OAAO,CAAC,WAAW;QAEtB,MAAMC,OAAO,MAAMD,GAAG,MAAM;QAE5B,OAAOC,KAAK,GAAG,CAACC;IACpB;AACJ;AAEO,MAAMC,gBAAgBC,2BAA2B,oBAAoB,CAAC;IACzE,gBAAgBV;IAChB,cAAc;QAACW;QAAYC;QAAmBC;KAAmB;AACrE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { CmsModelStorageOperationsUpdateParams } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
+
import { UpdateModelStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/model/UpdateModelStorageOperation.js";
|
|
3
|
+
import { TableNameResolver } from "../../features/tableNameResolver/abstractions.js";
|
|
4
|
+
import { ModelSchemaManager } from "../../features/modelSchemaManager/abstractions.js";
|
|
5
|
+
import { KnexClient } from "@webiny/api-core-sql";
|
|
6
|
+
declare class SqlUpdateModelImpl implements UpdateModelStorageOperation.Interface {
|
|
7
|
+
private knex;
|
|
8
|
+
private modelSchemaManager;
|
|
9
|
+
private tableName;
|
|
10
|
+
constructor(knex: KnexClient.Interface, tableNameResolver: TableNameResolver.Interface, modelSchemaManager: ModelSchemaManager.Interface);
|
|
11
|
+
execute(params: CmsModelStorageOperationsUpdateParams): Promise<import("@webiny/api-headless-cms/types/model.js").StorageCmsModel>;
|
|
12
|
+
}
|
|
13
|
+
export declare const SqlUpdateModel: typeof SqlUpdateModelImpl & {
|
|
14
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/model/UpdateModelStorageOperation.js").IUpdateModelStorageOperation>;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { UpdateModelStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/model/UpdateModelStorageOperation.js";
|
|
2
|
+
import { TableNameResolver } from "../../features/tableNameResolver/abstractions.js";
|
|
3
|
+
import { ModelSchemaManager } from "../../features/modelSchemaManager/abstractions.js";
|
|
4
|
+
import { modelToRow } from "./mappers.js";
|
|
5
|
+
import { KnexClient } from "@webiny/api-core-sql";
|
|
6
|
+
class SqlUpdateModelImpl {
|
|
7
|
+
constructor(knex, tableNameResolver, modelSchemaManager){
|
|
8
|
+
this.knex = knex;
|
|
9
|
+
this.modelSchemaManager = modelSchemaManager;
|
|
10
|
+
this.tableName = tableNameResolver.resolve("models");
|
|
11
|
+
}
|
|
12
|
+
async execute(params) {
|
|
13
|
+
const model = params.model;
|
|
14
|
+
const row = modelToRow(model);
|
|
15
|
+
await this.modelSchemaManager.ensure(this.tableName);
|
|
16
|
+
await this.knex.client(this.tableName).where("modelId", model.modelId).update(row);
|
|
17
|
+
return model;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
const SqlUpdateModel = UpdateModelStorageOperation.createImplementation({
|
|
21
|
+
implementation: SqlUpdateModelImpl,
|
|
22
|
+
dependencies: [
|
|
23
|
+
KnexClient,
|
|
24
|
+
TableNameResolver,
|
|
25
|
+
ModelSchemaManager
|
|
26
|
+
]
|
|
27
|
+
});
|
|
28
|
+
export { SqlUpdateModel };
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=SqlUpdateModel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations/model/SqlUpdateModel.js","sources":["../../../src/operations/model/SqlUpdateModel.ts"],"sourcesContent":["import type { CmsModelStorageOperationsUpdateParams } from \"@webiny/api-headless-cms/types/index.js\";\nimport type { IModelRow } from \"./types.js\";\nimport { UpdateModelStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/model/UpdateModelStorageOperation.js\";\nimport { TableNameResolver } from \"~/features/tableNameResolver/abstractions.js\";\nimport { ModelSchemaManager } from \"~/features/modelSchemaManager/abstractions.js\";\nimport { modelToRow } from \"./mappers.js\";\nimport { KnexClient } from \"@webiny/api-core-sql\";\n\nclass SqlUpdateModelImpl implements UpdateModelStorageOperation.Interface {\n private tableName: string;\n\n constructor(\n private knex: KnexClient.Interface,\n tableNameResolver: TableNameResolver.Interface,\n private modelSchemaManager: ModelSchemaManager.Interface\n ) {\n this.tableName = tableNameResolver.resolve(\"models\");\n }\n\n async execute(params: CmsModelStorageOperationsUpdateParams) {\n const model = params.model;\n const row = modelToRow(model);\n\n await this.modelSchemaManager.ensure(this.tableName);\n await this.knex\n .client<IModelRow>(this.tableName)\n .where(\"modelId\", model.modelId)\n .update(row);\n\n return model;\n }\n}\n\nexport const SqlUpdateModel = UpdateModelStorageOperation.createImplementation({\n implementation: SqlUpdateModelImpl,\n dependencies: [KnexClient, TableNameResolver, ModelSchemaManager]\n});\n"],"names":["SqlUpdateModelImpl","knex","tableNameResolver","modelSchemaManager","params","model","row","modelToRow","SqlUpdateModel","UpdateModelStorageOperation","KnexClient","TableNameResolver","ModelSchemaManager"],"mappings":";;;;;AAQA,MAAMA;IAGF,YACYC,IAA0B,EAClCC,iBAA8C,EACtCC,kBAAgD,CAC1D;aAHUF,IAAI,GAAJA;aAEAE,kBAAkB,GAAlBA;QAER,IAAI,CAAC,SAAS,GAAGD,kBAAkB,OAAO,CAAC;IAC/C;IAEA,MAAM,QAAQE,MAA6C,EAAE;QACzD,MAAMC,QAAQD,OAAO,KAAK;QAC1B,MAAME,MAAMC,WAAWF;QAEvB,MAAM,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS;QACnD,MAAM,IAAI,CAAC,IAAI,CACV,MAAM,CAAY,IAAI,CAAC,SAAS,EAChC,KAAK,CAAC,WAAWA,MAAM,OAAO,EAC9B,MAAM,CAACC;QAEZ,OAAOD;IACX;AACJ;AAEO,MAAMG,iBAAiBC,4BAA4B,oBAAoB,CAAC;IAC3E,gBAAgBT;IAChB,cAAc;QAACU;QAAYC;QAAmBC;KAAmB;AACrE"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/api/index.js";
|
|
2
|
+
import { SqlGetModel } from "./SqlGetModel.js";
|
|
3
|
+
import { SqlListModels } from "./SqlListModels.js";
|
|
4
|
+
import { SqlCreateModel } from "./SqlCreateModel.js";
|
|
5
|
+
import { SqlUpdateModel } from "./SqlUpdateModel.js";
|
|
6
|
+
import { SqlDeleteModel } from "./SqlDeleteModel.js";
|
|
7
|
+
const SqlModelStorageOpsFeature = createFeature({
|
|
8
|
+
name: "cms.sql.modelStorageOps",
|
|
9
|
+
register: (container)=>{
|
|
10
|
+
container.register(SqlGetModel);
|
|
11
|
+
container.register(SqlListModels);
|
|
12
|
+
container.register(SqlCreateModel);
|
|
13
|
+
container.register(SqlUpdateModel);
|
|
14
|
+
container.register(SqlDeleteModel);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
export { SqlModelStorageOpsFeature };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations/model/feature.js","sources":["../../../src/operations/model/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api/index.js\";\nimport { SqlGetModel } from \"./SqlGetModel.js\";\nimport { SqlListModels } from \"./SqlListModels.js\";\nimport { SqlCreateModel } from \"./SqlCreateModel.js\";\nimport { SqlUpdateModel } from \"./SqlUpdateModel.js\";\nimport { SqlDeleteModel } from \"./SqlDeleteModel.js\";\n\nexport const SqlModelStorageOpsFeature = createFeature({\n name: \"cms.sql.modelStorageOps\",\n register: container => {\n container.register(SqlGetModel);\n container.register(SqlListModels);\n container.register(SqlCreateModel);\n container.register(SqlUpdateModel);\n container.register(SqlDeleteModel);\n }\n});\n"],"names":["SqlModelStorageOpsFeature","createFeature","container","SqlGetModel","SqlListModels","SqlCreateModel","SqlUpdateModel","SqlDeleteModel"],"mappings":";;;;;;AAOO,MAAMA,4BAA4BC,cAAc;IACnD,MAAM;IACN,UAAUC,CAAAA;QACNA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE;QACnBF,UAAU,QAAQ,CAACG;QACnBH,UAAU,QAAQ,CAACI;QACnBJ,UAAU,QAAQ,CAACK;IACvB;AACJ"}
|
|
@@ -21,8 +21,7 @@ const modelToRow = (model)=>({
|
|
|
21
21
|
createdBy_type: model.createdBy?.type ?? null,
|
|
22
22
|
createdBy: model.createdBy ? JSON.stringify(model.createdBy) : null,
|
|
23
23
|
createdOn: model.createdOn ?? null,
|
|
24
|
-
savedOn: model.savedOn ?? null
|
|
25
|
-
settings: model.settings ? JSON.stringify(model.settings) : null
|
|
24
|
+
savedOn: model.savedOn ?? null
|
|
26
25
|
});
|
|
27
26
|
const rowToModel = (row)=>({
|
|
28
27
|
tenant: row.tenant,
|
|
@@ -44,8 +43,7 @@ const rowToModel = (row)=>({
|
|
|
44
43
|
authorization: row.authorization ? JSON.parse(row.authorization) : void 0,
|
|
45
44
|
createdBy: row.createdBy ? JSON.parse(row.createdBy) : void 0,
|
|
46
45
|
createdOn: row.createdOn ?? void 0,
|
|
47
|
-
savedOn: row.savedOn ?? void 0
|
|
48
|
-
settings: row.settings ? JSON.parse(row.settings) : void 0
|
|
46
|
+
savedOn: row.savedOn ?? void 0
|
|
49
47
|
});
|
|
50
48
|
export { modelToRow, rowToModel };
|
|
51
49
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations/model/mappers.js","sources":["../../../src/operations/model/mappers.ts"],"sourcesContent":["import type { StorageCmsModel } from \"@webiny/api-headless-cms/types/index.js\";\nimport type { IModelRow } from \"./types.js\";\n\nexport const modelToRow = (model: StorageCmsModel): IModelRow => {\n return {\n tenant: model.tenant,\n modelId: model.modelId,\n name: model.name,\n singularApiName: model.singularApiName,\n pluralApiName: model.pluralApiName,\n group: model.group,\n icon: model.icon ? JSON.stringify(model.icon) : null,\n description: model.description ?? null,\n fields: JSON.stringify(model.fields),\n layout: JSON.stringify(model.layout),\n tags: model.tags ? JSON.stringify(model.tags) : null,\n titleFieldId: model.titleFieldId,\n descriptionFieldId: model.descriptionFieldId ?? null,\n imageFieldId: model.imageFieldId ?? null,\n isPrivate: model.isPrivate ?? false,\n isPlugin: model.isPlugin ?? false,\n authorization: model.authorization != null ? JSON.stringify(model.authorization) : null,\n createdBy_id: model.createdBy?.id ?? null,\n createdBy_displayName: model.createdBy?.displayName ?? null,\n createdBy_type: model.createdBy?.type ?? null,\n createdBy: model.createdBy ? JSON.stringify(model.createdBy) : null,\n createdOn: model.createdOn ?? null,\n savedOn: model.savedOn ?? null
|
|
1
|
+
{"version":3,"file":"operations/model/mappers.js","sources":["../../../src/operations/model/mappers.ts"],"sourcesContent":["import type { StorageCmsModel } from \"@webiny/api-headless-cms/types/index.js\";\nimport type { IModelRow } from \"./types.js\";\n\nexport const modelToRow = (model: StorageCmsModel): IModelRow => {\n return {\n tenant: model.tenant,\n modelId: model.modelId,\n name: model.name,\n singularApiName: model.singularApiName,\n pluralApiName: model.pluralApiName,\n group: model.group,\n icon: model.icon ? JSON.stringify(model.icon) : null,\n description: model.description ?? null,\n fields: JSON.stringify(model.fields),\n layout: JSON.stringify(model.layout),\n tags: model.tags ? JSON.stringify(model.tags) : null,\n titleFieldId: model.titleFieldId,\n descriptionFieldId: model.descriptionFieldId ?? null,\n imageFieldId: model.imageFieldId ?? null,\n isPrivate: model.isPrivate ?? false,\n isPlugin: model.isPlugin ?? false,\n authorization: model.authorization != null ? JSON.stringify(model.authorization) : null,\n createdBy_id: model.createdBy?.id ?? null,\n createdBy_displayName: model.createdBy?.displayName ?? null,\n createdBy_type: model.createdBy?.type ?? null,\n createdBy: model.createdBy ? JSON.stringify(model.createdBy) : null,\n createdOn: model.createdOn ?? null,\n savedOn: model.savedOn ?? null\n };\n};\n\nexport const rowToModel = (row: IModelRow): StorageCmsModel => {\n return {\n tenant: row.tenant,\n modelId: row.modelId,\n name: row.name,\n singularApiName: row.singularApiName,\n pluralApiName: row.pluralApiName,\n group: row.group,\n icon: row.icon ? JSON.parse(row.icon) : null,\n description: row.description || null,\n fields: JSON.parse(row.fields),\n layout: JSON.parse(row.layout),\n tags: row.tags ? JSON.parse(row.tags) : undefined,\n titleFieldId: row.titleFieldId,\n descriptionFieldId: row.descriptionFieldId,\n imageFieldId: row.imageFieldId,\n isPrivate: row.isPrivate,\n isPlugin: row.isPlugin,\n authorization: row.authorization ? JSON.parse(row.authorization) : undefined,\n createdBy: row.createdBy ? JSON.parse(row.createdBy) : undefined,\n createdOn: row.createdOn ?? undefined,\n savedOn: row.savedOn ?? undefined\n };\n};\n"],"names":["modelToRow","model","JSON","rowToModel","row","undefined"],"mappings":"AAGO,MAAMA,aAAa,CAACC,QAChB;QACH,QAAQA,MAAM,MAAM;QACpB,SAASA,MAAM,OAAO;QACtB,MAAMA,MAAM,IAAI;QAChB,iBAAiBA,MAAM,eAAe;QACtC,eAAeA,MAAM,aAAa;QAClC,OAAOA,MAAM,KAAK;QAClB,MAAMA,MAAM,IAAI,GAAGC,KAAK,SAAS,CAACD,MAAM,IAAI,IAAI;QAChD,aAAaA,MAAM,WAAW,IAAI;QAClC,QAAQC,KAAK,SAAS,CAACD,MAAM,MAAM;QACnC,QAAQC,KAAK,SAAS,CAACD,MAAM,MAAM;QACnC,MAAMA,MAAM,IAAI,GAAGC,KAAK,SAAS,CAACD,MAAM,IAAI,IAAI;QAChD,cAAcA,MAAM,YAAY;QAChC,oBAAoBA,MAAM,kBAAkB,IAAI;QAChD,cAAcA,MAAM,YAAY,IAAI;QACpC,WAAWA,MAAM,SAAS,IAAI;QAC9B,UAAUA,MAAM,QAAQ,IAAI;QAC5B,eAAeA,AAAuB,QAAvBA,MAAM,aAAa,GAAWC,KAAK,SAAS,CAACD,MAAM,aAAa,IAAI;QACnF,cAAcA,MAAM,SAAS,EAAE,MAAM;QACrC,uBAAuBA,MAAM,SAAS,EAAE,eAAe;QACvD,gBAAgBA,MAAM,SAAS,EAAE,QAAQ;QACzC,WAAWA,MAAM,SAAS,GAAGC,KAAK,SAAS,CAACD,MAAM,SAAS,IAAI;QAC/D,WAAWA,MAAM,SAAS,IAAI;QAC9B,SAASA,MAAM,OAAO,IAAI;IAC9B;AAGG,MAAME,aAAa,CAACC,MAChB;QACH,QAAQA,IAAI,MAAM;QAClB,SAASA,IAAI,OAAO;QACpB,MAAMA,IAAI,IAAI;QACd,iBAAiBA,IAAI,eAAe;QACpC,eAAeA,IAAI,aAAa;QAChC,OAAOA,IAAI,KAAK;QAChB,MAAMA,IAAI,IAAI,GAAGF,KAAK,KAAK,CAACE,IAAI,IAAI,IAAI;QACxC,aAAaA,IAAI,WAAW,IAAI;QAChC,QAAQF,KAAK,KAAK,CAACE,IAAI,MAAM;QAC7B,QAAQF,KAAK,KAAK,CAACE,IAAI,MAAM;QAC7B,MAAMA,IAAI,IAAI,GAAGF,KAAK,KAAK,CAACE,IAAI,IAAI,IAAIC;QACxC,cAAcD,IAAI,YAAY;QAC9B,oBAAoBA,IAAI,kBAAkB;QAC1C,cAAcA,IAAI,YAAY;QAC9B,WAAWA,IAAI,SAAS;QACxB,UAAUA,IAAI,QAAQ;QACtB,eAAeA,IAAI,aAAa,GAAGF,KAAK,KAAK,CAACE,IAAI,aAAa,IAAIC;QACnE,WAAWD,IAAI,SAAS,GAAGF,KAAK,KAAK,CAACE,IAAI,SAAS,IAAIC;QACvD,WAAWD,IAAI,SAAS,IAAIC;QAC5B,SAASD,IAAI,OAAO,IAAIC;IAC5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations/model/types.js","sources":["../../../src/operations/model/types.ts"],"sourcesContent":["import type { StorageCmsModel } from \"@webiny/api-headless-cms/types/index.js\";\n\n/* SQL row representation of StorageCmsModel. */\nexport interface IModelRow {\n tenant: string;\n modelId: string;\n name: string;\n singularApiName: string;\n pluralApiName: string;\n group: string;\n icon: string | null;\n description: string | null;\n fields: string;\n layout: string;\n tags: string | null;\n titleFieldId: string;\n descriptionFieldId: string | null;\n imageFieldId: string | null;\n isPrivate: boolean;\n isPlugin: boolean;\n authorization: string | null;\n createdBy_id: string | null;\n createdBy_displayName: string | null;\n createdBy_type: string | null;\n createdBy: string | null;\n createdOn: string | null;\n savedOn: string | null;\n
|
|
1
|
+
{"version":3,"file":"operations/model/types.js","sources":["../../../src/operations/model/types.ts"],"sourcesContent":["import type { StorageCmsModel } from \"@webiny/api-headless-cms/types/index.js\";\n\n/* SQL row representation of StorageCmsModel. */\nexport interface IModelRow {\n tenant: string;\n modelId: string;\n name: string;\n singularApiName: string;\n pluralApiName: string;\n group: string;\n icon: string | null;\n description: string | null;\n fields: string;\n layout: string;\n tags: string | null;\n titleFieldId: string;\n descriptionFieldId: string | null;\n imageFieldId: string | null;\n isPrivate: boolean;\n isPlugin: boolean;\n authorization: string | null;\n createdBy_id: string | null;\n createdBy_displayName: string | null;\n createdBy_type: string | null;\n createdBy: string | null;\n createdOn: string | null;\n savedOn: string | null;\n}\n\n/* Validated against StorageCmsModel — TypeScript errors if StorageCmsModel gains a new field. */\nconst MODEL_COLUMN_MAP: Record<keyof StorageCmsModel, true> = {\n name: true,\n modelId: true,\n singularApiName: true,\n pluralApiName: true,\n tenant: true,\n group: true,\n icon: true,\n description: true,\n fields: true,\n layout: true,\n tags: true,\n titleFieldId: true,\n descriptionFieldId: true,\n imageFieldId: true,\n isPrivate: true,\n authorization: true,\n isPlugin: true,\n createdOn: true,\n savedOn: true,\n createdBy: true\n};\n\nexport const MODEL_COLUMNS = Object.keys(MODEL_COLUMN_MAP) as (keyof StorageCmsModel)[];\n"],"names":["MODEL_COLUMN_MAP","MODEL_COLUMNS","Object"],"mappings":"AA8BA,MAAMA,mBAAwD;IAC1D,MAAM;IACN,SAAS;IACT,iBAAiB;IACjB,eAAe;IACf,QAAQ;IACR,OAAO;IACP,MAAM;IACN,aAAa;IACb,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,cAAc;IACd,oBAAoB;IACpB,cAAc;IACd,WAAW;IACX,eAAe;IACf,UAAU;IACV,WAAW;IACX,SAAS;IACT,WAAW;AACf;AAEO,MAAMC,gBAAgBC,OAAO,IAAI,CAACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/api-headless-cms-sql",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.6.0-alpha.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./index.js",
|
|
@@ -22,20 +22,23 @@
|
|
|
22
22
|
"description": "SQL storage operations for Headless CMS API.",
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@webiny/api-core-sql": "
|
|
26
|
-
"@webiny/api-headless-cms": "
|
|
27
|
-
"@webiny/api-headless-cms-storage": "
|
|
28
|
-
"@webiny/db-utils": "
|
|
29
|
-
"@webiny/feature": "
|
|
30
|
-
"@webiny/handler": "
|
|
31
|
-
"@webiny/
|
|
32
|
-
"@webiny/utils": "0.0.0-unstable.9f53ea597d",
|
|
25
|
+
"@webiny/api-core-sql": "6.6.0-alpha.0",
|
|
26
|
+
"@webiny/api-headless-cms": "6.6.0-alpha.0",
|
|
27
|
+
"@webiny/api-headless-cms-storage": "6.6.0-alpha.0",
|
|
28
|
+
"@webiny/db-utils": "6.6.0-alpha.0",
|
|
29
|
+
"@webiny/feature": "6.6.0-alpha.0",
|
|
30
|
+
"@webiny/handler": "6.6.0-alpha.0",
|
|
31
|
+
"@webiny/utils": "6.6.0-alpha.0",
|
|
33
32
|
"knex": "3.3.0"
|
|
34
33
|
},
|
|
35
34
|
"devDependencies": {
|
|
36
|
-
"@
|
|
37
|
-
"@
|
|
35
|
+
"@electric-sql/pglite": "0.5.4",
|
|
36
|
+
"@electric-sql/pglite-socket": "0.2.7",
|
|
37
|
+
"@webiny/build-tools": "6.6.0-alpha.0",
|
|
38
|
+
"@webiny/di": "1.0.2",
|
|
39
|
+
"@webiny/project-utils": "6.6.0-alpha.0",
|
|
38
40
|
"better-sqlite3": "13.0.1",
|
|
41
|
+
"pg": "8.22.0",
|
|
39
42
|
"typescript": "7.0.2",
|
|
40
43
|
"vitest": "4.1.10"
|
|
41
44
|
},
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { CmsEntryStorageOperations } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
-
import type { PluginsContainer } from "@webiny/plugins";
|
|
3
|
-
import type { CmsContext } from "../../types.js";
|
|
4
|
-
import type { EntryTableManager } from "../../features/entryTableManager/abstractions.js";
|
|
5
|
-
import { KnexClient } from "@webiny/api-core-sql";
|
|
6
|
-
interface CreateEntriesStorageOperationsParams {
|
|
7
|
-
knex: KnexClient.Interface;
|
|
8
|
-
entryTableManager: EntryTableManager.Interface;
|
|
9
|
-
container: CmsContext["container"];
|
|
10
|
-
plugins: PluginsContainer;
|
|
11
|
-
}
|
|
12
|
-
export declare const createEntriesStorageOperations: (params: CreateEntriesStorageOperationsParams) => CmsEntryStorageOperations;
|
|
13
|
-
export {};
|