@webiny/api-headless-cms-sql 0.0.0-unstable.0d717d18dd → 0.0.0-unstable.a4f3e4ea8b

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.
Files changed (126) hide show
  1. package/features/entryTableManager/EntryTableManager.d.ts +0 -2
  2. package/features/entryTableManager/EntryTableManager.js +26 -39
  3. package/features/entryTableManager/EntryTableManager.js.map +1 -1
  4. package/index.d.ts +1 -4
  5. package/index.js +71 -24
  6. package/index.js.map +1 -1
  7. package/operations/entry/index.d.ts +13 -0
  8. package/operations/entry/index.js +373 -0
  9. package/operations/entry/index.js.map +1 -0
  10. package/operations/group/index.d.ts +5 -0
  11. package/operations/group/index.js +58 -0
  12. package/operations/group/index.js.map +1 -0
  13. package/operations/model/index.d.ts +5 -0
  14. package/operations/model/index.js +50 -0
  15. package/operations/model/index.js.map +1 -0
  16. package/package.json +12 -15
  17. package/types.d.ts +10 -0
  18. package/types.js +0 -0
  19. package/operations/entry/SqlCreateEntry.d.ts +0 -15
  20. package/operations/entry/SqlCreateEntry.js +0 -35
  21. package/operations/entry/SqlCreateEntry.js.map +0 -1
  22. package/operations/entry/SqlCreateEntryRevisionFrom.d.ts +0 -15
  23. package/operations/entry/SqlCreateEntryRevisionFrom.js +0 -55
  24. package/operations/entry/SqlCreateEntryRevisionFrom.js.map +0 -1
  25. package/operations/entry/SqlDeleteEntry.d.ts +0 -15
  26. package/operations/entry/SqlDeleteEntry.js +0 -29
  27. package/operations/entry/SqlDeleteEntry.js.map +0 -1
  28. package/operations/entry/SqlDeleteEntryRevision.d.ts +0 -15
  29. package/operations/entry/SqlDeleteEntryRevision.js +0 -39
  30. package/operations/entry/SqlDeleteEntryRevision.js.map +0 -1
  31. package/operations/entry/SqlDeleteMultipleEntries.d.ts +0 -15
  32. package/operations/entry/SqlDeleteMultipleEntries.js +0 -29
  33. package/operations/entry/SqlDeleteMultipleEntries.js.map +0 -1
  34. package/operations/entry/SqlGetEntriesByIds.d.ts +0 -15
  35. package/operations/entry/SqlGetEntriesByIds.js +0 -35
  36. package/operations/entry/SqlGetEntriesByIds.js.map +0 -1
  37. package/operations/entry/SqlGetEntry.d.ts +0 -25
  38. package/operations/entry/SqlGetEntry.js +0 -56
  39. package/operations/entry/SqlGetEntry.js.map +0 -1
  40. package/operations/entry/SqlGetLatestEntriesByIds.d.ts +0 -15
  41. package/operations/entry/SqlGetLatestEntriesByIds.js +0 -37
  42. package/operations/entry/SqlGetLatestEntriesByIds.js.map +0 -1
  43. package/operations/entry/SqlGetLatestRevisionByEntryId.d.ts +0 -15
  44. package/operations/entry/SqlGetLatestRevisionByEntryId.js +0 -32
  45. package/operations/entry/SqlGetLatestRevisionByEntryId.js.map +0 -1
  46. package/operations/entry/SqlGetPreviousRevision.d.ts +0 -15
  47. package/operations/entry/SqlGetPreviousRevision.js +0 -30
  48. package/operations/entry/SqlGetPreviousRevision.js.map +0 -1
  49. package/operations/entry/SqlGetPublishedEntriesByIds.d.ts +0 -15
  50. package/operations/entry/SqlGetPublishedEntriesByIds.js +0 -37
  51. package/operations/entry/SqlGetPublishedEntriesByIds.js.map +0 -1
  52. package/operations/entry/SqlGetPublishedRevisionByEntryId.d.ts +0 -15
  53. package/operations/entry/SqlGetPublishedRevisionByEntryId.js +0 -32
  54. package/operations/entry/SqlGetPublishedRevisionByEntryId.js.map +0 -1
  55. package/operations/entry/SqlGetRevisionById.d.ts +0 -15
  56. package/operations/entry/SqlGetRevisionById.js +0 -30
  57. package/operations/entry/SqlGetRevisionById.js.map +0 -1
  58. package/operations/entry/SqlGetRevisions.d.ts +0 -15
  59. package/operations/entry/SqlGetRevisions.js +0 -31
  60. package/operations/entry/SqlGetRevisions.js.map +0 -1
  61. package/operations/entry/SqlGetUniqueFieldValues.d.ts +0 -25
  62. package/operations/entry/SqlGetUniqueFieldValues.js +0 -58
  63. package/operations/entry/SqlGetUniqueFieldValues.js.map +0 -1
  64. package/operations/entry/SqlListEntries.d.ts +0 -25
  65. package/operations/entry/SqlListEntries.js +0 -52
  66. package/operations/entry/SqlListEntries.js.map +0 -1
  67. package/operations/entry/SqlMoveEntry.d.ts +0 -14
  68. package/operations/entry/SqlMoveEntry.js +0 -30
  69. package/operations/entry/SqlMoveEntry.js.map +0 -1
  70. package/operations/entry/SqlMoveToBin.d.ts +0 -14
  71. package/operations/entry/SqlMoveToBin.js +0 -35
  72. package/operations/entry/SqlMoveToBin.js.map +0 -1
  73. package/operations/entry/SqlPublishEntry.d.ts +0 -15
  74. package/operations/entry/SqlPublishEntry.js +0 -51
  75. package/operations/entry/SqlPublishEntry.js.map +0 -1
  76. package/operations/entry/SqlRestoreFromBin.d.ts +0 -14
  77. package/operations/entry/SqlRestoreFromBin.js +0 -36
  78. package/operations/entry/SqlRestoreFromBin.js.map +0 -1
  79. package/operations/entry/SqlUnpublishEntry.d.ts +0 -15
  80. package/operations/entry/SqlUnpublishEntry.js +0 -38
  81. package/operations/entry/SqlUnpublishEntry.js.map +0 -1
  82. package/operations/entry/SqlUpdateEntry.d.ts +0 -15
  83. package/operations/entry/SqlUpdateEntry.js +0 -36
  84. package/operations/entry/SqlUpdateEntry.js.map +0 -1
  85. package/operations/entry/feature.d.ts +0 -4
  86. package/operations/entry/feature.js +0 -53
  87. package/operations/entry/feature.js.map +0 -1
  88. package/operations/entry/queryHelpers.d.ts +0 -23
  89. package/operations/entry/queryHelpers.js +0 -105
  90. package/operations/entry/queryHelpers.js.map +0 -1
  91. package/operations/group/SqlCreateGroup.d.ts +0 -16
  92. package/operations/group/SqlCreateGroup.js +0 -28
  93. package/operations/group/SqlCreateGroup.js.map +0 -1
  94. package/operations/group/SqlDeleteGroup.d.ts +0 -16
  95. package/operations/group/SqlDeleteGroup.js +0 -26
  96. package/operations/group/SqlDeleteGroup.js.map +0 -1
  97. package/operations/group/SqlGetGroup.d.ts +0 -16
  98. package/operations/group/SqlGetGroup.js +0 -29
  99. package/operations/group/SqlGetGroup.js.map +0 -1
  100. package/operations/group/SqlListGroups.d.ts +0 -16
  101. package/operations/group/SqlListGroups.js +0 -43
  102. package/operations/group/SqlListGroups.js.map +0 -1
  103. package/operations/group/SqlUpdateGroup.d.ts +0 -16
  104. package/operations/group/SqlUpdateGroup.js +0 -28
  105. package/operations/group/SqlUpdateGroup.js.map +0 -1
  106. package/operations/group/feature.d.ts +0 -4
  107. package/operations/group/feature.js +0 -19
  108. package/operations/group/feature.js.map +0 -1
  109. package/operations/model/SqlCreateModel.d.ts +0 -16
  110. package/operations/model/SqlCreateModel.js +0 -30
  111. package/operations/model/SqlCreateModel.js.map +0 -1
  112. package/operations/model/SqlDeleteModel.d.ts +0 -16
  113. package/operations/model/SqlDeleteModel.js +0 -26
  114. package/operations/model/SqlDeleteModel.js.map +0 -1
  115. package/operations/model/SqlGetModel.d.ts +0 -16
  116. package/operations/model/SqlGetModel.js +0 -29
  117. package/operations/model/SqlGetModel.js.map +0 -1
  118. package/operations/model/SqlListModels.d.ts +0 -16
  119. package/operations/model/SqlListModels.js +0 -31
  120. package/operations/model/SqlListModels.js.map +0 -1
  121. package/operations/model/SqlUpdateModel.d.ts +0 -16
  122. package/operations/model/SqlUpdateModel.js +0 -30
  123. package/operations/model/SqlUpdateModel.js.map +0 -1
  124. package/operations/model/feature.d.ts +0 -4
  125. package/operations/model/feature.js +0 -19
  126. package/operations/model/feature.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"operations/group/SqlCreateGroup.js","sources":["../../../src/operations/group/SqlCreateGroup.ts"],"sourcesContent":["import type { CmsGroupStorageOperationsCreateParams } from \"@webiny/api-headless-cms/types/index.js\";\nimport type { IGroupRow } from \"./types.js\";\nimport { CreateGroupStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/group/CreateGroupStorageOperation.js\";\nimport { TableNameResolver } from \"~/features/tableNameResolver/abstractions.js\";\nimport { GroupSchemaManager } from \"~/features/groupSchemaManager/abstractions.js\";\nimport { groupToRow } from \"./mappers.js\";\nimport { KnexClient } from \"@webiny/api-core-sql\";\n\nclass SqlCreateGroupImpl implements CreateGroupStorageOperation.Interface {\n private tableName: string;\n\n constructor(\n private knex: KnexClient.Interface,\n tableNameResolver: TableNameResolver.Interface,\n private groupSchemaManager: GroupSchemaManager.Interface\n ) {\n this.tableName = tableNameResolver.resolve(\"groups\");\n }\n\n async execute(params: CmsGroupStorageOperationsCreateParams) {\n const row = groupToRow(params.group);\n\n await this.groupSchemaManager.ensure(this.tableName);\n await this.knex.client<IGroupRow>(this.tableName).insert(row);\n }\n}\n\nexport const SqlCreateGroup = CreateGroupStorageOperation.createImplementation({\n implementation: SqlCreateGroupImpl,\n dependencies: [KnexClient, TableNameResolver, GroupSchemaManager]\n});\n"],"names":["SqlCreateGroupImpl","knex","tableNameResolver","groupSchemaManager","params","row","groupToRow","SqlCreateGroup","CreateGroupStorageOperation","KnexClient","TableNameResolver","GroupSchemaManager"],"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,MAAMC,WAAWF,OAAO,KAAK;QAEnC,MAAM,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS;QACnD,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAY,IAAI,CAAC,SAAS,EAAE,MAAM,CAACC;IAC7D;AACJ;AAEO,MAAME,iBAAiBC,4BAA4B,oBAAoB,CAAC;IAC3E,gBAAgBR;IAChB,cAAc;QAACS;QAAYC;QAAmBC;KAAmB;AACrE"}
@@ -1,16 +0,0 @@
1
- import type { CmsGroupStorageOperationsDeleteParams } from "@webiny/api-headless-cms/types/index.js";
2
- import { DeleteGroupStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/group/DeleteGroupStorageOperation.js";
3
- import { TableNameResolver } from "../../features/tableNameResolver/abstractions.js";
4
- import { GroupSchemaManager } from "../../features/groupSchemaManager/abstractions.js";
5
- import { KnexClient } from "@webiny/api-core-sql";
6
- declare class SqlDeleteGroupImpl implements DeleteGroupStorageOperation.Interface {
7
- private knex;
8
- private groupSchemaManager;
9
- private tableName;
10
- constructor(knex: KnexClient.Interface, tableNameResolver: TableNameResolver.Interface, groupSchemaManager: GroupSchemaManager.Interface);
11
- execute(params: CmsGroupStorageOperationsDeleteParams): Promise<void>;
12
- }
13
- export declare const SqlDeleteGroup: typeof SqlDeleteGroupImpl & {
14
- __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/group/DeleteGroupStorageOperation.js").IDeleteGroupStorageOperation>;
15
- };
16
- export {};
@@ -1,26 +0,0 @@
1
- import { DeleteGroupStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/group/DeleteGroupStorageOperation.js";
2
- import { TableNameResolver } from "../../features/tableNameResolver/abstractions.js";
3
- import { GroupSchemaManager } from "../../features/groupSchemaManager/abstractions.js";
4
- import { KnexClient } from "@webiny/api-core-sql";
5
- class SqlDeleteGroupImpl {
6
- constructor(knex, tableNameResolver, groupSchemaManager){
7
- this.knex = knex;
8
- this.groupSchemaManager = groupSchemaManager;
9
- this.tableName = tableNameResolver.resolve("groups");
10
- }
11
- async execute(params) {
12
- await this.groupSchemaManager.ensure(this.tableName);
13
- await this.knex.client(this.tableName).where("id", params.group.id).delete();
14
- }
15
- }
16
- const SqlDeleteGroup = DeleteGroupStorageOperation.createImplementation({
17
- implementation: SqlDeleteGroupImpl,
18
- dependencies: [
19
- KnexClient,
20
- TableNameResolver,
21
- GroupSchemaManager
22
- ]
23
- });
24
- export { SqlDeleteGroup };
25
-
26
- //# sourceMappingURL=SqlDeleteGroup.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"operations/group/SqlDeleteGroup.js","sources":["../../../src/operations/group/SqlDeleteGroup.ts"],"sourcesContent":["import type { CmsGroupStorageOperationsDeleteParams } from \"@webiny/api-headless-cms/types/index.js\";\nimport type { IGroupRow } from \"./types.js\";\nimport { DeleteGroupStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/group/DeleteGroupStorageOperation.js\";\nimport { TableNameResolver } from \"~/features/tableNameResolver/abstractions.js\";\nimport { GroupSchemaManager } from \"~/features/groupSchemaManager/abstractions.js\";\nimport { KnexClient } from \"@webiny/api-core-sql\";\n\nclass SqlDeleteGroupImpl implements DeleteGroupStorageOperation.Interface {\n private tableName: string;\n\n constructor(\n private knex: KnexClient.Interface,\n tableNameResolver: TableNameResolver.Interface,\n private groupSchemaManager: GroupSchemaManager.Interface\n ) {\n this.tableName = tableNameResolver.resolve(\"groups\");\n }\n\n async execute(params: CmsGroupStorageOperationsDeleteParams) {\n await this.groupSchemaManager.ensure(this.tableName);\n await this.knex.client<IGroupRow>(this.tableName).where(\"id\", params.group.id).delete();\n }\n}\n\nexport const SqlDeleteGroup = DeleteGroupStorageOperation.createImplementation({\n implementation: SqlDeleteGroupImpl,\n dependencies: [KnexClient, TableNameResolver, GroupSchemaManager]\n});\n"],"names":["SqlDeleteGroupImpl","knex","tableNameResolver","groupSchemaManager","params","SqlDeleteGroup","DeleteGroupStorageOperation","KnexClient","TableNameResolver","GroupSchemaManager"],"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,CAAC,MAAM,CAAY,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,MAAMA,OAAO,KAAK,CAAC,EAAE,EAAE,MAAM;IACzF;AACJ;AAEO,MAAMC,iBAAiBC,4BAA4B,oBAAoB,CAAC;IAC3E,gBAAgBN;IAChB,cAAc;QAACO;QAAYC;QAAmBC;KAAmB;AACrE"}
@@ -1,16 +0,0 @@
1
- import type { CmsGroupStorageOperationsGetParams } from "@webiny/api-headless-cms/types/index.js";
2
- import { GetGroupStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/group/GetGroupStorageOperation.js";
3
- import { TableNameResolver } from "../../features/tableNameResolver/abstractions.js";
4
- import { GroupSchemaManager } from "../../features/groupSchemaManager/abstractions.js";
5
- import { KnexClient } from "@webiny/api-core-sql";
6
- declare class SqlGetGroupImpl implements GetGroupStorageOperation.Interface {
7
- private knex;
8
- private groupSchemaManager;
9
- private tableName;
10
- constructor(knex: KnexClient.Interface, tableNameResolver: TableNameResolver.Interface, groupSchemaManager: GroupSchemaManager.Interface);
11
- execute(params: CmsGroupStorageOperationsGetParams): Promise<import("@webiny/api-headless-cms/types/modelGroup.js").CmsGroup | null>;
12
- }
13
- export declare const SqlGetGroup: typeof SqlGetGroupImpl & {
14
- __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/group/GetGroupStorageOperation.js").IGetGroupStorageOperation>;
15
- };
16
- export {};
@@ -1,29 +0,0 @@
1
- import { GetGroupStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/group/GetGroupStorageOperation.js";
2
- import { TableNameResolver } from "../../features/tableNameResolver/abstractions.js";
3
- import { GroupSchemaManager } from "../../features/groupSchemaManager/abstractions.js";
4
- import { rowToGroup } from "./mappers.js";
5
- import { KnexClient } from "@webiny/api-core-sql";
6
- class SqlGetGroupImpl {
7
- constructor(knex, tableNameResolver, groupSchemaManager){
8
- this.knex = knex;
9
- this.groupSchemaManager = groupSchemaManager;
10
- this.tableName = tableNameResolver.resolve("groups");
11
- }
12
- async execute(params) {
13
- await this.groupSchemaManager.ensure(this.tableName);
14
- const row = await this.knex.client(this.tableName).where("id", params.id).where("tenant", params.tenant).first();
15
- if (!row) return null;
16
- return rowToGroup(row);
17
- }
18
- }
19
- const SqlGetGroup = GetGroupStorageOperation.createImplementation({
20
- implementation: SqlGetGroupImpl,
21
- dependencies: [
22
- KnexClient,
23
- TableNameResolver,
24
- GroupSchemaManager
25
- ]
26
- });
27
- export { SqlGetGroup };
28
-
29
- //# sourceMappingURL=SqlGetGroup.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"operations/group/SqlGetGroup.js","sources":["../../../src/operations/group/SqlGetGroup.ts"],"sourcesContent":["import type { CmsGroupStorageOperationsGetParams } from \"@webiny/api-headless-cms/types/index.js\";\nimport type { IGroupRow } from \"./types.js\";\nimport { GetGroupStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/group/GetGroupStorageOperation.js\";\nimport { TableNameResolver } from \"~/features/tableNameResolver/abstractions.js\";\nimport { GroupSchemaManager } from \"~/features/groupSchemaManager/abstractions.js\";\nimport { rowToGroup } from \"./mappers.js\";\nimport { KnexClient } from \"@webiny/api-core-sql\";\n\nclass SqlGetGroupImpl implements GetGroupStorageOperation.Interface {\n private tableName: string;\n\n constructor(\n private knex: KnexClient.Interface,\n tableNameResolver: TableNameResolver.Interface,\n private groupSchemaManager: GroupSchemaManager.Interface\n ) {\n this.tableName = tableNameResolver.resolve(\"groups\");\n }\n\n async execute(params: CmsGroupStorageOperationsGetParams) {\n await this.groupSchemaManager.ensure(this.tableName);\n\n const row = await this.knex\n .client<IGroupRow>(this.tableName)\n .where(\"id\", params.id)\n .where(\"tenant\", params.tenant)\n .first();\n\n if (!row) {\n return null;\n }\n\n return rowToGroup(row);\n }\n}\n\nexport const SqlGetGroup = GetGroupStorageOperation.createImplementation({\n implementation: SqlGetGroupImpl,\n dependencies: [KnexClient, TableNameResolver, GroupSchemaManager]\n});\n"],"names":["SqlGetGroupImpl","knex","tableNameResolver","groupSchemaManager","params","row","rowToGroup","SqlGetGroup","GetGroupStorageOperation","KnexClient","TableNameResolver","GroupSchemaManager"],"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,MAAMD,OAAO,EAAE,EACrB,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"}
@@ -1,16 +0,0 @@
1
- import type { CmsGroupStorageOperationsListParams } from "@webiny/api-headless-cms/types/index.js";
2
- import { ListGroupsStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/group/ListGroupsStorageOperation.js";
3
- import { TableNameResolver } from "../../features/tableNameResolver/abstractions.js";
4
- import { GroupSchemaManager } from "../../features/groupSchemaManager/abstractions.js";
5
- import { KnexClient } from "@webiny/api-core-sql";
6
- declare class SqlListGroupsImpl implements ListGroupsStorageOperation.Interface {
7
- private knex;
8
- private groupSchemaManager;
9
- private tableName;
10
- constructor(knex: KnexClient.Interface, tableNameResolver: TableNameResolver.Interface, groupSchemaManager: GroupSchemaManager.Interface);
11
- execute(params: CmsGroupStorageOperationsListParams): Promise<import("@webiny/api-headless-cms/types/modelGroup.js").CmsGroup[]>;
12
- }
13
- export declare const SqlListGroups: typeof SqlListGroupsImpl & {
14
- __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/group/ListGroupsStorageOperation.js").IListGroupsStorageOperation>;
15
- };
16
- export {};
@@ -1,43 +0,0 @@
1
- import { GROUP_COLUMNS } from "./types.js";
2
- import { ListGroupsStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/group/ListGroupsStorageOperation.js";
3
- import { TableNameResolver } from "../../features/tableNameResolver/abstractions.js";
4
- import { GroupSchemaManager } from "../../features/groupSchemaManager/abstractions.js";
5
- import { rowToGroup } from "./mappers.js";
6
- import { KnexClient } from "@webiny/api-core-sql";
7
- class SqlListGroupsImpl {
8
- constructor(knex, tableNameResolver, groupSchemaManager){
9
- this.knex = knex;
10
- this.groupSchemaManager = groupSchemaManager;
11
- this.tableName = tableNameResolver.resolve("groups");
12
- }
13
- async execute(params) {
14
- const { where, sort } = params;
15
- await this.groupSchemaManager.ensure(this.tableName);
16
- const qb = this.knex.client(this.tableName).where("tenant", where.tenant);
17
- if (where.id) qb.andWhere("id", where.id);
18
- if (where.slug) qb.andWhere("slug", where.slug);
19
- if (void 0 !== where.isPlugin) qb.andWhere("isPlugin", where.isPlugin);
20
- if (void 0 !== where.isPrivate) qb.andWhere("isPrivate", where.isPrivate);
21
- if (sort?.length) for (const sortField of sort){
22
- const parts = sortField.split("_");
23
- const direction = parts.pop()?.toLowerCase() === "asc" ? "asc" : "desc";
24
- const field = parts.join("_");
25
- qb.orderBy(field, direction);
26
- }
27
- const rows = await qb.select([
28
- ...GROUP_COLUMNS
29
- ]);
30
- return rows.map(rowToGroup);
31
- }
32
- }
33
- const SqlListGroups = ListGroupsStorageOperation.createImplementation({
34
- implementation: SqlListGroupsImpl,
35
- dependencies: [
36
- KnexClient,
37
- TableNameResolver,
38
- GroupSchemaManager
39
- ]
40
- });
41
- export { SqlListGroups };
42
-
43
- //# sourceMappingURL=SqlListGroups.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"operations/group/SqlListGroups.js","sources":["../../../src/operations/group/SqlListGroups.ts"],"sourcesContent":["import type { CmsGroupStorageOperationsListParams } from \"@webiny/api-headless-cms/types/index.js\";\nimport type { IGroupRow } from \"./types.js\";\nimport { GROUP_COLUMNS } from \"./types.js\";\nimport { ListGroupsStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/group/ListGroupsStorageOperation.js\";\nimport { TableNameResolver } from \"~/features/tableNameResolver/abstractions.js\";\nimport { GroupSchemaManager } from \"~/features/groupSchemaManager/abstractions.js\";\nimport { rowToGroup } from \"./mappers.js\";\nimport { KnexClient } from \"@webiny/api-core-sql\";\n\nclass SqlListGroupsImpl implements ListGroupsStorageOperation.Interface {\n private tableName: string;\n\n constructor(\n private knex: KnexClient.Interface,\n tableNameResolver: TableNameResolver.Interface,\n private groupSchemaManager: GroupSchemaManager.Interface\n ) {\n this.tableName = tableNameResolver.resolve(\"groups\");\n }\n\n async execute(params: CmsGroupStorageOperationsListParams) {\n const { where, sort } = params;\n\n await this.groupSchemaManager.ensure(this.tableName);\n\n const qb = this.knex.client<IGroupRow>(this.tableName).where(\"tenant\", where.tenant);\n\n if (where.id) {\n qb.andWhere(\"id\", where.id);\n }\n if (where.slug) {\n qb.andWhere(\"slug\", where.slug);\n }\n if (where.isPlugin !== undefined) {\n qb.andWhere(\"isPlugin\", where.isPlugin);\n }\n if (where.isPrivate !== undefined) {\n qb.andWhere(\"isPrivate\", where.isPrivate);\n }\n\n if (sort?.length) {\n for (const sortField of sort) {\n const parts = sortField.split(\"_\");\n const direction = parts.pop()?.toLowerCase() === \"asc\" ? \"asc\" : \"desc\";\n const field = parts.join(\"_\");\n qb.orderBy(field, direction);\n }\n }\n\n const rows = await qb.select<IGroupRow[]>([...GROUP_COLUMNS]);\n\n return rows.map(rowToGroup);\n }\n}\n\nexport const SqlListGroups = ListGroupsStorageOperation.createImplementation({\n implementation: SqlListGroupsImpl,\n dependencies: [KnexClient, TableNameResolver, GroupSchemaManager]\n});\n"],"names":["SqlListGroupsImpl","knex","tableNameResolver","groupSchemaManager","params","where","sort","qb","undefined","sortField","parts","direction","field","rows","GROUP_COLUMNS","rowToGroup","SqlListGroups","ListGroupsStorageOperation","KnexClient","TableNameResolver","GroupSchemaManager"],"mappings":";;;;;;AASA,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,EAAEC,KAAK,EAAEC,IAAI,EAAE,GAAGF;QAExB,MAAM,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS;QAEnD,MAAMG,KAAK,IAAI,CAAC,IAAI,CAAC,MAAM,CAAY,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,UAAUF,MAAM,MAAM;QAEnF,IAAIA,MAAM,EAAE,EACRE,GAAG,QAAQ,CAAC,MAAMF,MAAM,EAAE;QAE9B,IAAIA,MAAM,IAAI,EACVE,GAAG,QAAQ,CAAC,QAAQF,MAAM,IAAI;QAElC,IAAIA,AAAmBG,WAAnBH,MAAM,QAAQ,EACdE,GAAG,QAAQ,CAAC,YAAYF,MAAM,QAAQ;QAE1C,IAAIA,AAAoBG,WAApBH,MAAM,SAAS,EACfE,GAAG,QAAQ,CAAC,aAAaF,MAAM,SAAS;QAG5C,IAAIC,MAAM,QACN,KAAK,MAAMG,aAAaH,KAAM;YAC1B,MAAMI,QAAQD,UAAU,KAAK,CAAC;YAC9B,MAAME,YAAYD,MAAM,GAAG,IAAI,kBAAkB,QAAQ,QAAQ;YACjE,MAAME,QAAQF,MAAM,IAAI,CAAC;YACzBH,GAAG,OAAO,CAACK,OAAOD;QACtB;QAGJ,MAAME,OAAO,MAAMN,GAAG,MAAM,CAAc;eAAIO;SAAc;QAE5D,OAAOD,KAAK,GAAG,CAACE;IACpB;AACJ;AAEO,MAAMC,gBAAgBC,2BAA2B,oBAAoB,CAAC;IACzE,gBAAgBjB;IAChB,cAAc;QAACkB;QAAYC;QAAmBC;KAAmB;AACrE"}
@@ -1,16 +0,0 @@
1
- import type { CmsGroupStorageOperationsUpdateParams } from "@webiny/api-headless-cms/types/index.js";
2
- import { UpdateGroupStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/group/UpdateGroupStorageOperation.js";
3
- import { TableNameResolver } from "../../features/tableNameResolver/abstractions.js";
4
- import { GroupSchemaManager } from "../../features/groupSchemaManager/abstractions.js";
5
- import { KnexClient } from "@webiny/api-core-sql";
6
- declare class SqlUpdateGroupImpl implements UpdateGroupStorageOperation.Interface {
7
- private knex;
8
- private groupSchemaManager;
9
- private tableName;
10
- constructor(knex: KnexClient.Interface, tableNameResolver: TableNameResolver.Interface, groupSchemaManager: GroupSchemaManager.Interface);
11
- execute(params: CmsGroupStorageOperationsUpdateParams): Promise<void>;
12
- }
13
- export declare const SqlUpdateGroup: typeof SqlUpdateGroupImpl & {
14
- __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/group/UpdateGroupStorageOperation.js").IUpdateGroupStorageOperation>;
15
- };
16
- export {};
@@ -1,28 +0,0 @@
1
- import { UpdateGroupStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/group/UpdateGroupStorageOperation.js";
2
- import { TableNameResolver } from "../../features/tableNameResolver/abstractions.js";
3
- import { GroupSchemaManager } from "../../features/groupSchemaManager/abstractions.js";
4
- import { groupToRow } from "./mappers.js";
5
- import { KnexClient } from "@webiny/api-core-sql";
6
- class SqlUpdateGroupImpl {
7
- constructor(knex, tableNameResolver, groupSchemaManager){
8
- this.knex = knex;
9
- this.groupSchemaManager = groupSchemaManager;
10
- this.tableName = tableNameResolver.resolve("groups");
11
- }
12
- async execute(params) {
13
- const row = groupToRow(params.group);
14
- await this.groupSchemaManager.ensure(this.tableName);
15
- await this.knex.client(this.tableName).where("id", params.group.id).update(row);
16
- }
17
- }
18
- const SqlUpdateGroup = UpdateGroupStorageOperation.createImplementation({
19
- implementation: SqlUpdateGroupImpl,
20
- dependencies: [
21
- KnexClient,
22
- TableNameResolver,
23
- GroupSchemaManager
24
- ]
25
- });
26
- export { SqlUpdateGroup };
27
-
28
- //# sourceMappingURL=SqlUpdateGroup.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"operations/group/SqlUpdateGroup.js","sources":["../../../src/operations/group/SqlUpdateGroup.ts"],"sourcesContent":["import type { CmsGroupStorageOperationsUpdateParams } from \"@webiny/api-headless-cms/types/index.js\";\nimport type { IGroupRow } from \"./types.js\";\nimport { UpdateGroupStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/group/UpdateGroupStorageOperation.js\";\nimport { TableNameResolver } from \"~/features/tableNameResolver/abstractions.js\";\nimport { GroupSchemaManager } from \"~/features/groupSchemaManager/abstractions.js\";\nimport { groupToRow } from \"./mappers.js\";\nimport { KnexClient } from \"@webiny/api-core-sql\";\n\nclass SqlUpdateGroupImpl implements UpdateGroupStorageOperation.Interface {\n private tableName: string;\n\n constructor(\n private knex: KnexClient.Interface,\n tableNameResolver: TableNameResolver.Interface,\n private groupSchemaManager: GroupSchemaManager.Interface\n ) {\n this.tableName = tableNameResolver.resolve(\"groups\");\n }\n\n async execute(params: CmsGroupStorageOperationsUpdateParams) {\n const row = groupToRow(params.group);\n\n await this.groupSchemaManager.ensure(this.tableName);\n await this.knex.client<IGroupRow>(this.tableName).where(\"id\", params.group.id).update(row);\n }\n}\n\nexport const SqlUpdateGroup = UpdateGroupStorageOperation.createImplementation({\n implementation: SqlUpdateGroupImpl,\n dependencies: [KnexClient, TableNameResolver, GroupSchemaManager]\n});\n"],"names":["SqlUpdateGroupImpl","knex","tableNameResolver","groupSchemaManager","params","row","groupToRow","SqlUpdateGroup","UpdateGroupStorageOperation","KnexClient","TableNameResolver","GroupSchemaManager"],"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,MAAMC,WAAWF,OAAO,KAAK;QAEnC,MAAM,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS;QACnD,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAY,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,MAAMA,OAAO,KAAK,CAAC,EAAE,EAAE,MAAM,CAACC;IAC1F;AACJ;AAEO,MAAME,iBAAiBC,4BAA4B,oBAAoB,CAAC;IAC3E,gBAAgBR;IAChB,cAAc;QAACS;QAAYC;QAAmBC;KAAmB;AACrE"}
@@ -1,4 +0,0 @@
1
- export declare const SqlGroupStorageOpsFeature: {
2
- name: string;
3
- register(container: import("@webiny/di").Container): void;
4
- };
@@ -1,19 +0,0 @@
1
- import { createFeature } from "@webiny/feature/api/index.js";
2
- import { SqlGetGroup } from "./SqlGetGroup.js";
3
- import { SqlListGroups } from "./SqlListGroups.js";
4
- import { SqlCreateGroup } from "./SqlCreateGroup.js";
5
- import { SqlUpdateGroup } from "./SqlUpdateGroup.js";
6
- import { SqlDeleteGroup } from "./SqlDeleteGroup.js";
7
- const SqlGroupStorageOpsFeature = createFeature({
8
- name: "cms.sql.groupStorageOps",
9
- register: (container)=>{
10
- container.register(SqlGetGroup);
11
- container.register(SqlListGroups);
12
- container.register(SqlCreateGroup);
13
- container.register(SqlUpdateGroup);
14
- container.register(SqlDeleteGroup);
15
- }
16
- });
17
- export { SqlGroupStorageOpsFeature };
18
-
19
- //# sourceMappingURL=feature.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"operations/group/feature.js","sources":["../../../src/operations/group/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api/index.js\";\nimport { SqlGetGroup } from \"./SqlGetGroup.js\";\nimport { SqlListGroups } from \"./SqlListGroups.js\";\nimport { SqlCreateGroup } from \"./SqlCreateGroup.js\";\nimport { SqlUpdateGroup } from \"./SqlUpdateGroup.js\";\nimport { SqlDeleteGroup } from \"./SqlDeleteGroup.js\";\n\nexport const SqlGroupStorageOpsFeature = createFeature({\n name: \"cms.sql.groupStorageOps\",\n register: container => {\n container.register(SqlGetGroup);\n container.register(SqlListGroups);\n container.register(SqlCreateGroup);\n container.register(SqlUpdateGroup);\n container.register(SqlDeleteGroup);\n }\n});\n"],"names":["SqlGroupStorageOpsFeature","createFeature","container","SqlGetGroup","SqlListGroups","SqlCreateGroup","SqlUpdateGroup","SqlDeleteGroup"],"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"}
@@ -1,16 +0,0 @@
1
- import type { CmsModelStorageOperationsCreateParams } from "@webiny/api-headless-cms/types/index.js";
2
- import { CreateModelStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/model/CreateModelStorageOperation.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 SqlCreateModelImpl implements CreateModelStorageOperation.Interface {
7
- private knex;
8
- private modelSchemaManager;
9
- private tableName;
10
- constructor(knex: KnexClient.Interface, tableNameResolver: TableNameResolver.Interface, modelSchemaManager: ModelSchemaManager.Interface);
11
- execute(params: CmsModelStorageOperationsCreateParams): Promise<import("@webiny/api-headless-cms/types/model.js").StorageCmsModel>;
12
- }
13
- export declare const SqlCreateModel: typeof SqlCreateModelImpl & {
14
- __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/model/CreateModelStorageOperation.js").ICreateModelStorageOperation>;
15
- };
16
- export {};
@@ -1,30 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,16 +0,0 @@
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 {};
@@ -1,26 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,16 +0,0 @@
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 {};
@@ -1,29 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,16 +0,0 @@
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 {};
@@ -1,31 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,16 +0,0 @@
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 {};
@@ -1,30 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,4 +0,0 @@
1
- export declare const SqlModelStorageOpsFeature: {
2
- name: string;
3
- register(container: import("@webiny/di").Container): void;
4
- };
@@ -1,19 +0,0 @@
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
@@ -1 +0,0 @@
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"}