@webiny/api-headless-cms-sql 0.0.0-unstable.0156a4c312

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 (167) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +11 -0
  3. package/features/entryTableManager/EntryTableManager.d.ts +19 -0
  4. package/features/entryTableManager/EntryTableManager.js +80 -0
  5. package/features/entryTableManager/EntryTableManager.js.map +1 -0
  6. package/features/entryTableManager/abstractions.d.ts +9 -0
  7. package/features/entryTableManager/abstractions.js +5 -0
  8. package/features/entryTableManager/abstractions.js.map +1 -0
  9. package/features/entryTableManager/feature.d.ts +4 -0
  10. package/features/entryTableManager/feature.js +11 -0
  11. package/features/entryTableManager/feature.js.map +1 -0
  12. package/features/groupSchemaManager/GroupSchemaManager.d.ts +13 -0
  13. package/features/groupSchemaManager/GroupSchemaManager.js +48 -0
  14. package/features/groupSchemaManager/GroupSchemaManager.js.map +1 -0
  15. package/features/groupSchemaManager/abstractions.d.ts +8 -0
  16. package/features/groupSchemaManager/abstractions.js +5 -0
  17. package/features/groupSchemaManager/abstractions.js.map +1 -0
  18. package/features/groupSchemaManager/feature.d.ts +4 -0
  19. package/features/groupSchemaManager/feature.js +11 -0
  20. package/features/groupSchemaManager/feature.js.map +1 -0
  21. package/features/modelSchemaManager/ModelSchemaManager.d.ts +13 -0
  22. package/features/modelSchemaManager/ModelSchemaManager.js +58 -0
  23. package/features/modelSchemaManager/ModelSchemaManager.js.map +1 -0
  24. package/features/modelSchemaManager/abstractions.d.ts +8 -0
  25. package/features/modelSchemaManager/abstractions.js +5 -0
  26. package/features/modelSchemaManager/abstractions.js.map +1 -0
  27. package/features/modelSchemaManager/feature.d.ts +4 -0
  28. package/features/modelSchemaManager/feature.js +11 -0
  29. package/features/modelSchemaManager/feature.js.map +1 -0
  30. package/features/tableNameResolver/TableNameResolver.d.ts +13 -0
  31. package/features/tableNameResolver/TableNameResolver.js +24 -0
  32. package/features/tableNameResolver/TableNameResolver.js.map +1 -0
  33. package/features/tableNameResolver/abstractions.d.ts +16 -0
  34. package/features/tableNameResolver/abstractions.js +6 -0
  35. package/features/tableNameResolver/abstractions.js.map +1 -0
  36. package/features/tableNameResolver/feature.d.ts +4 -0
  37. package/features/tableNameResolver/feature.js +11 -0
  38. package/features/tableNameResolver/feature.js.map +1 -0
  39. package/index.d.ts +16 -0
  40. package/index.js +34 -0
  41. package/index.js.map +1 -0
  42. package/operations/entry/SqlCreateEntry.d.ts +15 -0
  43. package/operations/entry/SqlCreateEntry.js +35 -0
  44. package/operations/entry/SqlCreateEntry.js.map +1 -0
  45. package/operations/entry/SqlCreateEntryRevisionFrom.d.ts +16 -0
  46. package/operations/entry/SqlCreateEntryRevisionFrom.js +58 -0
  47. package/operations/entry/SqlCreateEntryRevisionFrom.js.map +1 -0
  48. package/operations/entry/SqlDeleteEntry.d.ts +15 -0
  49. package/operations/entry/SqlDeleteEntry.js +29 -0
  50. package/operations/entry/SqlDeleteEntry.js.map +1 -0
  51. package/operations/entry/SqlDeleteEntryRevision.d.ts +15 -0
  52. package/operations/entry/SqlDeleteEntryRevision.js +39 -0
  53. package/operations/entry/SqlDeleteEntryRevision.js.map +1 -0
  54. package/operations/entry/SqlDeleteMultipleEntries.d.ts +15 -0
  55. package/operations/entry/SqlDeleteMultipleEntries.js +29 -0
  56. package/operations/entry/SqlDeleteMultipleEntries.js.map +1 -0
  57. package/operations/entry/SqlGetEntriesByIds.d.ts +15 -0
  58. package/operations/entry/SqlGetEntriesByIds.js +35 -0
  59. package/operations/entry/SqlGetEntriesByIds.js.map +1 -0
  60. package/operations/entry/SqlGetEntry.d.ts +27 -0
  61. package/operations/entry/SqlGetEntry.js +65 -0
  62. package/operations/entry/SqlGetEntry.js.map +1 -0
  63. package/operations/entry/SqlGetLatestEntriesByIds.d.ts +15 -0
  64. package/operations/entry/SqlGetLatestEntriesByIds.js +37 -0
  65. package/operations/entry/SqlGetLatestEntriesByIds.js.map +1 -0
  66. package/operations/entry/SqlGetLatestRevisionByEntryId.d.ts +15 -0
  67. package/operations/entry/SqlGetLatestRevisionByEntryId.js +32 -0
  68. package/operations/entry/SqlGetLatestRevisionByEntryId.js.map +1 -0
  69. package/operations/entry/SqlGetPreviousRevision.d.ts +15 -0
  70. package/operations/entry/SqlGetPreviousRevision.js +30 -0
  71. package/operations/entry/SqlGetPreviousRevision.js.map +1 -0
  72. package/operations/entry/SqlGetPublishedEntriesByIds.d.ts +15 -0
  73. package/operations/entry/SqlGetPublishedEntriesByIds.js +37 -0
  74. package/operations/entry/SqlGetPublishedEntriesByIds.js.map +1 -0
  75. package/operations/entry/SqlGetPublishedRevisionByEntryId.d.ts +15 -0
  76. package/operations/entry/SqlGetPublishedRevisionByEntryId.js +32 -0
  77. package/operations/entry/SqlGetPublishedRevisionByEntryId.js.map +1 -0
  78. package/operations/entry/SqlGetRevisionById.d.ts +15 -0
  79. package/operations/entry/SqlGetRevisionById.js +30 -0
  80. package/operations/entry/SqlGetRevisionById.js.map +1 -0
  81. package/operations/entry/SqlGetRevisions.d.ts +15 -0
  82. package/operations/entry/SqlGetRevisions.js +31 -0
  83. package/operations/entry/SqlGetRevisions.js.map +1 -0
  84. package/operations/entry/SqlGetUniqueFieldValues.d.ts +27 -0
  85. package/operations/entry/SqlGetUniqueFieldValues.js +67 -0
  86. package/operations/entry/SqlGetUniqueFieldValues.js.map +1 -0
  87. package/operations/entry/SqlListEntries.d.ts +27 -0
  88. package/operations/entry/SqlListEntries.js +61 -0
  89. package/operations/entry/SqlListEntries.js.map +1 -0
  90. package/operations/entry/SqlMoveEntry.d.ts +14 -0
  91. package/operations/entry/SqlMoveEntry.js +30 -0
  92. package/operations/entry/SqlMoveEntry.js.map +1 -0
  93. package/operations/entry/SqlMoveToBin.d.ts +14 -0
  94. package/operations/entry/SqlMoveToBin.js +35 -0
  95. package/operations/entry/SqlMoveToBin.js.map +1 -0
  96. package/operations/entry/SqlPublishEntry.d.ts +15 -0
  97. package/operations/entry/SqlPublishEntry.js +51 -0
  98. package/operations/entry/SqlPublishEntry.js.map +1 -0
  99. package/operations/entry/SqlRestoreFromBin.d.ts +14 -0
  100. package/operations/entry/SqlRestoreFromBin.js +36 -0
  101. package/operations/entry/SqlRestoreFromBin.js.map +1 -0
  102. package/operations/entry/SqlUnpublishEntry.d.ts +15 -0
  103. package/operations/entry/SqlUnpublishEntry.js +38 -0
  104. package/operations/entry/SqlUnpublishEntry.js.map +1 -0
  105. package/operations/entry/SqlUpdateEntry.d.ts +15 -0
  106. package/operations/entry/SqlUpdateEntry.js +36 -0
  107. package/operations/entry/SqlUpdateEntry.js.map +1 -0
  108. package/operations/entry/feature.d.ts +4 -0
  109. package/operations/entry/feature.js +53 -0
  110. package/operations/entry/feature.js.map +1 -0
  111. package/operations/entry/mappers.d.ts +5 -0
  112. package/operations/entry/mappers.js +26 -0
  113. package/operations/entry/mappers.js.map +1 -0
  114. package/operations/entry/queryHelpers.d.ts +30 -0
  115. package/operations/entry/queryHelpers.js +107 -0
  116. package/operations/entry/queryHelpers.js.map +1 -0
  117. package/operations/entry/types.d.ts +11 -0
  118. package/operations/entry/types.js +0 -0
  119. package/operations/group/SqlCreateGroup.d.ts +16 -0
  120. package/operations/group/SqlCreateGroup.js +28 -0
  121. package/operations/group/SqlCreateGroup.js.map +1 -0
  122. package/operations/group/SqlDeleteGroup.d.ts +16 -0
  123. package/operations/group/SqlDeleteGroup.js +26 -0
  124. package/operations/group/SqlDeleteGroup.js.map +1 -0
  125. package/operations/group/SqlGetGroup.d.ts +16 -0
  126. package/operations/group/SqlGetGroup.js +29 -0
  127. package/operations/group/SqlGetGroup.js.map +1 -0
  128. package/operations/group/SqlListGroups.d.ts +16 -0
  129. package/operations/group/SqlListGroups.js +43 -0
  130. package/operations/group/SqlListGroups.js.map +1 -0
  131. package/operations/group/SqlUpdateGroup.d.ts +16 -0
  132. package/operations/group/SqlUpdateGroup.js +28 -0
  133. package/operations/group/SqlUpdateGroup.js.map +1 -0
  134. package/operations/group/feature.d.ts +4 -0
  135. package/operations/group/feature.js +19 -0
  136. package/operations/group/feature.js.map +1 -0
  137. package/operations/group/mappers.d.ts +4 -0
  138. package/operations/group/mappers.js +32 -0
  139. package/operations/group/mappers.js.map +1 -0
  140. package/operations/group/types.d.ts +18 -0
  141. package/operations/group/types.js +17 -0
  142. package/operations/group/types.js.map +1 -0
  143. package/operations/model/SqlCreateModel.d.ts +16 -0
  144. package/operations/model/SqlCreateModel.js +30 -0
  145. package/operations/model/SqlCreateModel.js.map +1 -0
  146. package/operations/model/SqlDeleteModel.d.ts +16 -0
  147. package/operations/model/SqlDeleteModel.js +26 -0
  148. package/operations/model/SqlDeleteModel.js.map +1 -0
  149. package/operations/model/SqlGetModel.d.ts +16 -0
  150. package/operations/model/SqlGetModel.js +29 -0
  151. package/operations/model/SqlGetModel.js.map +1 -0
  152. package/operations/model/SqlListModels.d.ts +16 -0
  153. package/operations/model/SqlListModels.js +31 -0
  154. package/operations/model/SqlListModels.js.map +1 -0
  155. package/operations/model/SqlUpdateModel.d.ts +16 -0
  156. package/operations/model/SqlUpdateModel.js +30 -0
  157. package/operations/model/SqlUpdateModel.js.map +1 -0
  158. package/operations/model/feature.d.ts +4 -0
  159. package/operations/model/feature.js +19 -0
  160. package/operations/model/feature.js.map +1 -0
  161. package/operations/model/mappers.d.ts +4 -0
  162. package/operations/model/mappers.js +52 -0
  163. package/operations/model/mappers.js.map +1 -0
  164. package/operations/model/types.d.ts +28 -0
  165. package/operations/model/types.js +27 -0
  166. package/operations/model/types.js.map +1 -0
  167. package/package.json +51 -0
@@ -0,0 +1,32 @@
1
+ import { GetLatestRevisionByEntryIdStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetLatestRevisionByEntryIdStorageOperation.js";
2
+ import { KnexClient } from "@webiny/api-core-sql";
3
+ import { EntryTableManager } from "../../features/entryTableManager/abstractions.js";
4
+ import { parseIdentifier } from "@webiny/utils";
5
+ import { rowToEntry } from "./mappers.js";
6
+ import { createEntryQuery } from "./queryHelpers.js";
7
+ class SqlGetLatestRevisionByEntryIdImpl {
8
+ constructor(knexClient, entryTableManager){
9
+ this.entryTableManager = entryTableManager;
10
+ this.knex = knexClient.client;
11
+ }
12
+ query() {
13
+ return createEntryQuery(this.knex, this.entryTableManager.getTableName());
14
+ }
15
+ async execute(model, params) {
16
+ await this.entryTableManager.ensureTable();
17
+ const { id: entryId } = parseIdentifier(params.id);
18
+ const row = await this.query().where("tenant", model.tenant).andWhere("modelId", model.modelId).where("entryId", entryId).andWhere("isLatest", true).first();
19
+ if (!row) return null;
20
+ return rowToEntry(row);
21
+ }
22
+ }
23
+ const SqlGetLatestRevisionByEntryId = GetLatestRevisionByEntryIdStorageOperation.createImplementation({
24
+ implementation: SqlGetLatestRevisionByEntryIdImpl,
25
+ dependencies: [
26
+ KnexClient,
27
+ EntryTableManager
28
+ ]
29
+ });
30
+ export { SqlGetLatestRevisionByEntryId };
31
+
32
+ //# sourceMappingURL=SqlGetLatestRevisionByEntryId.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations/entry/SqlGetLatestRevisionByEntryId.js","sources":["../../../src/operations/entry/SqlGetLatestRevisionByEntryId.ts"],"sourcesContent":["import type { Knex } from \"knex\";\nimport type {\n CmsEntryStorageOperationsGetLatestRevisionParams,\n CmsEntryValues,\n CmsModel\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { GetLatestRevisionByEntryIdStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/GetLatestRevisionByEntryIdStorageOperation.js\";\nimport { KnexClient } from \"@webiny/api-core-sql\";\nimport { EntryTableManager } from \"~/features/entryTableManager/abstractions.js\";\nimport { parseIdentifier } from \"@webiny/utils\";\nimport type { IEntryRow } from \"./types.js\";\nimport { rowToEntry } from \"./mappers.js\";\nimport { createEntryQuery } from \"./queryHelpers.js\";\n\nclass SqlGetLatestRevisionByEntryIdImpl\n implements GetLatestRevisionByEntryIdStorageOperation.Interface\n{\n private readonly knex: Knex;\n\n public constructor(\n knexClient: KnexClient.Interface,\n private readonly entryTableManager: EntryTableManager.Interface\n ) {\n this.knex = knexClient.client;\n }\n\n private query(): Knex.QueryBuilder<IEntryRow> {\n return createEntryQuery(this.knex, this.entryTableManager.getTableName());\n }\n\n async execute<T extends CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsGetLatestRevisionParams\n ) {\n await this.entryTableManager.ensureTable();\n\n const { id: entryId } = parseIdentifier(params.id);\n\n const row = await this.query()\n .where(\"tenant\", model.tenant)\n .andWhere(\"modelId\", model.modelId)\n .where(\"entryId\", entryId)\n .andWhere(\"isLatest\", true)\n .first();\n\n if (!row) {\n return null;\n }\n\n return rowToEntry<T>(row);\n }\n}\n\nexport const SqlGetLatestRevisionByEntryId =\n GetLatestRevisionByEntryIdStorageOperation.createImplementation({\n implementation: SqlGetLatestRevisionByEntryIdImpl,\n dependencies: [KnexClient, EntryTableManager]\n });\n"],"names":["SqlGetLatestRevisionByEntryIdImpl","knexClient","entryTableManager","createEntryQuery","model","params","entryId","parseIdentifier","row","rowToEntry","SqlGetLatestRevisionByEntryId","GetLatestRevisionByEntryIdStorageOperation","KnexClient","EntryTableManager"],"mappings":";;;;;;AAcA,MAAMA;IAKF,YACIC,UAAgC,EACfC,iBAA8C,CACjE;aADmBA,iBAAiB,GAAjBA;QAEjB,IAAI,CAAC,IAAI,GAAGD,WAAW,MAAM;IACjC;IAEQ,QAAsC;QAC1C,OAAOE,iBAAiB,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,iBAAiB,CAAC,YAAY;IAC1E;IAEA,MAAM,QACFC,KAAe,EACfC,MAAwD,EAC1D;QACE,MAAM,IAAI,CAAC,iBAAiB,CAAC,WAAW;QAExC,MAAM,EAAE,IAAIC,OAAO,EAAE,GAAGC,gBAAgBF,OAAO,EAAE;QAEjD,MAAMG,MAAM,MAAM,IAAI,CAAC,KAAK,GACvB,KAAK,CAAC,UAAUJ,MAAM,MAAM,EAC5B,QAAQ,CAAC,WAAWA,MAAM,OAAO,EACjC,KAAK,CAAC,WAAWE,SACjB,QAAQ,CAAC,YAAY,MACrB,KAAK;QAEV,IAAI,CAACE,KACD,OAAO;QAGX,OAAOC,WAAcD;IACzB;AACJ;AAEO,MAAME,gCACTC,2CAA2C,oBAAoB,CAAC;IAC5D,gBAAgBX;IAChB,cAAc;QAACY;QAAYC;KAAkB;AACjD"}
@@ -0,0 +1,15 @@
1
+ import type { CmsEntryStorageOperationsGetPreviousRevisionParams, CmsEntryValues, CmsModel } from "@webiny/api-headless-cms/types/index.js";
2
+ import { GetPreviousRevisionStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetPreviousRevisionStorageOperation.js";
3
+ import { KnexClient } from "@webiny/api-core-sql";
4
+ import { EntryTableManager } from "../../features/entryTableManager/abstractions.js";
5
+ declare class SqlGetPreviousRevisionImpl implements GetPreviousRevisionStorageOperation.Interface {
6
+ private readonly entryTableManager;
7
+ private readonly knex;
8
+ constructor(knexClient: KnexClient.Interface, entryTableManager: EntryTableManager.Interface);
9
+ private query;
10
+ execute<T extends CmsEntryValues>(model: CmsModel, params: CmsEntryStorageOperationsGetPreviousRevisionParams): Promise<import("@webiny/api-headless-cms/types/types.js").CmsEntry<T> | null>;
11
+ }
12
+ export declare const SqlGetPreviousRevision: typeof SqlGetPreviousRevisionImpl & {
13
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/entry/GetPreviousRevisionStorageOperation.js").IGetPreviousRevisionStorageOperation>;
14
+ };
15
+ export {};
@@ -0,0 +1,30 @@
1
+ import { GetPreviousRevisionStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetPreviousRevisionStorageOperation.js";
2
+ import { KnexClient } from "@webiny/api-core-sql";
3
+ import { EntryTableManager } from "../../features/entryTableManager/abstractions.js";
4
+ import { rowToEntry } from "./mappers.js";
5
+ import { createEntryQuery } from "./queryHelpers.js";
6
+ class SqlGetPreviousRevisionImpl {
7
+ constructor(knexClient, entryTableManager){
8
+ this.entryTableManager = entryTableManager;
9
+ this.knex = knexClient.client;
10
+ }
11
+ query() {
12
+ return createEntryQuery(this.knex, this.entryTableManager.getTableName());
13
+ }
14
+ async execute(model, params) {
15
+ await this.entryTableManager.ensureTable();
16
+ const row = await this.query().where("tenant", model.tenant).andWhere("modelId", model.modelId).where("entryId", params.entryId).andWhere("version", "<", params.version).orderBy("version", "desc").first();
17
+ if (!row) return null;
18
+ return rowToEntry(row);
19
+ }
20
+ }
21
+ const SqlGetPreviousRevision = GetPreviousRevisionStorageOperation.createImplementation({
22
+ implementation: SqlGetPreviousRevisionImpl,
23
+ dependencies: [
24
+ KnexClient,
25
+ EntryTableManager
26
+ ]
27
+ });
28
+ export { SqlGetPreviousRevision };
29
+
30
+ //# sourceMappingURL=SqlGetPreviousRevision.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations/entry/SqlGetPreviousRevision.js","sources":["../../../src/operations/entry/SqlGetPreviousRevision.ts"],"sourcesContent":["import type { Knex } from \"knex\";\nimport type {\n CmsEntryStorageOperationsGetPreviousRevisionParams,\n CmsEntryValues,\n CmsModel\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { GetPreviousRevisionStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/GetPreviousRevisionStorageOperation.js\";\nimport { KnexClient } from \"@webiny/api-core-sql\";\nimport { EntryTableManager } from \"~/features/entryTableManager/abstractions.js\";\nimport type { IEntryRow } from \"./types.js\";\nimport { rowToEntry } from \"./mappers.js\";\nimport { createEntryQuery } from \"./queryHelpers.js\";\n\nclass SqlGetPreviousRevisionImpl implements GetPreviousRevisionStorageOperation.Interface {\n private readonly knex: Knex;\n\n public constructor(\n knexClient: KnexClient.Interface,\n private readonly entryTableManager: EntryTableManager.Interface\n ) {\n this.knex = knexClient.client;\n }\n\n private query(): Knex.QueryBuilder<IEntryRow> {\n return createEntryQuery(this.knex, this.entryTableManager.getTableName());\n }\n\n async execute<T extends CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsGetPreviousRevisionParams\n ) {\n await this.entryTableManager.ensureTable();\n\n const row = await this.query()\n .where(\"tenant\", model.tenant)\n .andWhere(\"modelId\", model.modelId)\n .where(\"entryId\", params.entryId)\n .andWhere(\"version\", \"<\", params.version)\n .orderBy(\"version\", \"desc\")\n .first();\n\n if (!row) {\n return null;\n }\n\n return rowToEntry<T>(row);\n }\n}\n\nexport const SqlGetPreviousRevision = GetPreviousRevisionStorageOperation.createImplementation({\n implementation: SqlGetPreviousRevisionImpl,\n dependencies: [KnexClient, EntryTableManager]\n});\n"],"names":["SqlGetPreviousRevisionImpl","knexClient","entryTableManager","createEntryQuery","model","params","row","rowToEntry","SqlGetPreviousRevision","GetPreviousRevisionStorageOperation","KnexClient","EntryTableManager"],"mappings":";;;;;AAaA,MAAMA;IAGF,YACIC,UAAgC,EACfC,iBAA8C,CACjE;aADmBA,iBAAiB,GAAjBA;QAEjB,IAAI,CAAC,IAAI,GAAGD,WAAW,MAAM;IACjC;IAEQ,QAAsC;QAC1C,OAAOE,iBAAiB,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,iBAAiB,CAAC,YAAY;IAC1E;IAEA,MAAM,QACFC,KAAe,EACfC,MAA0D,EAC5D;QACE,MAAM,IAAI,CAAC,iBAAiB,CAAC,WAAW;QAExC,MAAMC,MAAM,MAAM,IAAI,CAAC,KAAK,GACvB,KAAK,CAAC,UAAUF,MAAM,MAAM,EAC5B,QAAQ,CAAC,WAAWA,MAAM,OAAO,EACjC,KAAK,CAAC,WAAWC,OAAO,OAAO,EAC/B,QAAQ,CAAC,WAAW,KAAKA,OAAO,OAAO,EACvC,OAAO,CAAC,WAAW,QACnB,KAAK;QAEV,IAAI,CAACC,KACD,OAAO;QAGX,OAAOC,WAAcD;IACzB;AACJ;AAEO,MAAME,yBAAyBC,oCAAoC,oBAAoB,CAAC;IAC3F,gBAAgBT;IAChB,cAAc;QAACU;QAAYC;KAAkB;AACjD"}
@@ -0,0 +1,15 @@
1
+ import type { CmsEntry, CmsEntryStorageOperationsGetPublishedByIdsParams, CmsEntryValues, CmsModel } from "@webiny/api-headless-cms/types/index.js";
2
+ import { GetPublishedEntriesByIdsStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetPublishedEntriesByIdsStorageOperation.js";
3
+ import { KnexClient } from "@webiny/api-core-sql";
4
+ import { EntryTableManager } from "../../features/entryTableManager/abstractions.js";
5
+ declare class SqlGetPublishedEntriesByIdsImpl implements GetPublishedEntriesByIdsStorageOperation.Interface {
6
+ private readonly entryTableManager;
7
+ private readonly knex;
8
+ constructor(knexClient: KnexClient.Interface, entryTableManager: EntryTableManager.Interface);
9
+ private query;
10
+ execute<T extends CmsEntryValues = CmsEntryValues>(model: CmsModel, params: CmsEntryStorageOperationsGetPublishedByIdsParams): Promise<CmsEntry<T>[]>;
11
+ }
12
+ export declare const SqlGetPublishedEntriesByIds: typeof SqlGetPublishedEntriesByIdsImpl & {
13
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/entry/GetPublishedEntriesByIdsStorageOperation.js").IGetPublishedEntriesByIdsStorageOperation>;
14
+ };
15
+ export {};
@@ -0,0 +1,37 @@
1
+ import { GetPublishedEntriesByIdsStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetPublishedEntriesByIdsStorageOperation.js";
2
+ import { KnexClient } from "@webiny/api-core-sql";
3
+ import { EntryTableManager } from "../../features/entryTableManager/abstractions.js";
4
+ import { parseIdentifier } from "@webiny/utils";
5
+ import { rowToEntry } from "./mappers.js";
6
+ import { createEntryQuery } from "./queryHelpers.js";
7
+ class SqlGetPublishedEntriesByIdsImpl {
8
+ constructor(knexClient, entryTableManager){
9
+ this.entryTableManager = entryTableManager;
10
+ this.knex = knexClient.client;
11
+ }
12
+ query() {
13
+ return createEntryQuery(this.knex, this.entryTableManager.getTableName());
14
+ }
15
+ async execute(model, params) {
16
+ await this.entryTableManager.ensureTable();
17
+ const idList = params.ids;
18
+ const entryIds = idList.map((id)=>parseIdentifier(id).id);
19
+ const rows = await this.query().where("tenant", model.tenant).andWhere("modelId", model.modelId).whereIn("entryId", entryIds).andWhere("isPublished", true);
20
+ const entries = rows.map((row)=>rowToEntry(row));
21
+ const byEntryId = new Map(entries.map((e)=>[
22
+ e.entryId,
23
+ e
24
+ ]));
25
+ return entryIds.map((eid)=>byEntryId.get(eid)).filter(Boolean);
26
+ }
27
+ }
28
+ const SqlGetPublishedEntriesByIds = GetPublishedEntriesByIdsStorageOperation.createImplementation({
29
+ implementation: SqlGetPublishedEntriesByIdsImpl,
30
+ dependencies: [
31
+ KnexClient,
32
+ EntryTableManager
33
+ ]
34
+ });
35
+ export { SqlGetPublishedEntriesByIds };
36
+
37
+ //# sourceMappingURL=SqlGetPublishedEntriesByIds.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations/entry/SqlGetPublishedEntriesByIds.js","sources":["../../../src/operations/entry/SqlGetPublishedEntriesByIds.ts"],"sourcesContent":["import type { Knex } from \"knex\";\nimport type {\n CmsEntry,\n CmsEntryStorageOperationsGetPublishedByIdsParams,\n CmsEntryValues,\n CmsModel\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { GetPublishedEntriesByIdsStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/GetPublishedEntriesByIdsStorageOperation.js\";\nimport { KnexClient } from \"@webiny/api-core-sql\";\nimport { EntryTableManager } from \"~/features/entryTableManager/abstractions.js\";\nimport { parseIdentifier } from \"@webiny/utils\";\nimport type { IEntryRow } from \"./types.js\";\nimport { rowToEntry } from \"./mappers.js\";\nimport { createEntryQuery } from \"./queryHelpers.js\";\n\nclass SqlGetPublishedEntriesByIdsImpl\n implements GetPublishedEntriesByIdsStorageOperation.Interface\n{\n private readonly knex: Knex;\n\n public constructor(\n knexClient: KnexClient.Interface,\n private readonly entryTableManager: EntryTableManager.Interface\n ) {\n this.knex = knexClient.client;\n }\n\n private query(): Knex.QueryBuilder<IEntryRow> {\n return createEntryQuery(this.knex, this.entryTableManager.getTableName());\n }\n\n async execute<T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsGetPublishedByIdsParams\n ) {\n await this.entryTableManager.ensureTable();\n\n const idList = params.ids as string[];\n const entryIds = idList.map(id => parseIdentifier(id).id);\n\n const rows: IEntryRow[] = await this.query()\n .where(\"tenant\", model.tenant)\n .andWhere(\"modelId\", model.modelId)\n .whereIn(\"entryId\", entryIds)\n .andWhere(\"isPublished\", true);\n\n const entries = rows.map(row => rowToEntry(row));\n const byEntryId = new Map(entries.map(e => [e.entryId, e]));\n\n return entryIds.map(eid => byEntryId.get(eid)).filter(Boolean) as CmsEntry<T>[];\n }\n}\n\nexport const SqlGetPublishedEntriesByIds =\n GetPublishedEntriesByIdsStorageOperation.createImplementation({\n implementation: SqlGetPublishedEntriesByIdsImpl,\n dependencies: [KnexClient, EntryTableManager]\n });\n"],"names":["SqlGetPublishedEntriesByIdsImpl","knexClient","entryTableManager","createEntryQuery","model","params","idList","entryIds","id","parseIdentifier","rows","entries","row","rowToEntry","byEntryId","Map","e","eid","Boolean","SqlGetPublishedEntriesByIds","GetPublishedEntriesByIdsStorageOperation","KnexClient","EntryTableManager"],"mappings":";;;;;;AAeA,MAAMA;IAKF,YACIC,UAAgC,EACfC,iBAA8C,CACjE;aADmBA,iBAAiB,GAAjBA;QAEjB,IAAI,CAAC,IAAI,GAAGD,WAAW,MAAM;IACjC;IAEQ,QAAsC;QAC1C,OAAOE,iBAAiB,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,iBAAiB,CAAC,YAAY;IAC1E;IAEA,MAAM,QACFC,KAAe,EACfC,MAAwD,EAC1D;QACE,MAAM,IAAI,CAAC,iBAAiB,CAAC,WAAW;QAExC,MAAMC,SAASD,OAAO,GAAG;QACzB,MAAME,WAAWD,OAAO,GAAG,CAACE,CAAAA,KAAMC,gBAAgBD,IAAI,EAAE;QAExD,MAAME,OAAoB,MAAM,IAAI,CAAC,KAAK,GACrC,KAAK,CAAC,UAAUN,MAAM,MAAM,EAC5B,QAAQ,CAAC,WAAWA,MAAM,OAAO,EACjC,OAAO,CAAC,WAAWG,UACnB,QAAQ,CAAC,eAAe;QAE7B,MAAMI,UAAUD,KAAK,GAAG,CAACE,CAAAA,MAAOC,WAAWD;QAC3C,MAAME,YAAY,IAAIC,IAAIJ,QAAQ,GAAG,CAACK,CAAAA,IAAK;gBAACA,EAAE,OAAO;gBAAEA;aAAE;QAEzD,OAAOT,SAAS,GAAG,CAACU,CAAAA,MAAOH,UAAU,GAAG,CAACG,MAAM,MAAM,CAACC;IAC1D;AACJ;AAEO,MAAMC,8BACTC,yCAAyC,oBAAoB,CAAC;IAC1D,gBAAgBpB;IAChB,cAAc;QAACqB;QAAYC;KAAkB;AACjD"}
@@ -0,0 +1,15 @@
1
+ import type { CmsEntryStorageOperationsGetPublishedRevisionParams, CmsEntryValues, CmsModel } from "@webiny/api-headless-cms/types/index.js";
2
+ import { GetPublishedRevisionByEntryIdStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetPublishedRevisionByEntryIdStorageOperation.js";
3
+ import { KnexClient } from "@webiny/api-core-sql";
4
+ import { EntryTableManager } from "../../features/entryTableManager/abstractions.js";
5
+ declare class SqlGetPublishedRevisionByEntryIdImpl implements GetPublishedRevisionByEntryIdStorageOperation.Interface {
6
+ private readonly entryTableManager;
7
+ private readonly knex;
8
+ constructor(knexClient: KnexClient.Interface, entryTableManager: EntryTableManager.Interface);
9
+ private query;
10
+ execute<T extends CmsEntryValues>(model: CmsModel, params: CmsEntryStorageOperationsGetPublishedRevisionParams): Promise<import("@webiny/api-headless-cms/types/types.js").CmsEntry<T> | null>;
11
+ }
12
+ export declare const SqlGetPublishedRevisionByEntryId: typeof SqlGetPublishedRevisionByEntryIdImpl & {
13
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/entry/GetPublishedRevisionByEntryIdStorageOperation.js").IGetPublishedRevisionByEntryIdStorageOperation>;
14
+ };
15
+ export {};
@@ -0,0 +1,32 @@
1
+ import { GetPublishedRevisionByEntryIdStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetPublishedRevisionByEntryIdStorageOperation.js";
2
+ import { KnexClient } from "@webiny/api-core-sql";
3
+ import { EntryTableManager } from "../../features/entryTableManager/abstractions.js";
4
+ import { parseIdentifier } from "@webiny/utils";
5
+ import { rowToEntry } from "./mappers.js";
6
+ import { createEntryQuery } from "./queryHelpers.js";
7
+ class SqlGetPublishedRevisionByEntryIdImpl {
8
+ constructor(knexClient, entryTableManager){
9
+ this.entryTableManager = entryTableManager;
10
+ this.knex = knexClient.client;
11
+ }
12
+ query() {
13
+ return createEntryQuery(this.knex, this.entryTableManager.getTableName());
14
+ }
15
+ async execute(model, params) {
16
+ await this.entryTableManager.ensureTable();
17
+ const { id: entryId } = parseIdentifier(params.id);
18
+ const row = await this.query().where("tenant", model.tenant).andWhere("modelId", model.modelId).where("entryId", entryId).andWhere("isPublished", true).first();
19
+ if (!row) return null;
20
+ return rowToEntry(row);
21
+ }
22
+ }
23
+ const SqlGetPublishedRevisionByEntryId = GetPublishedRevisionByEntryIdStorageOperation.createImplementation({
24
+ implementation: SqlGetPublishedRevisionByEntryIdImpl,
25
+ dependencies: [
26
+ KnexClient,
27
+ EntryTableManager
28
+ ]
29
+ });
30
+ export { SqlGetPublishedRevisionByEntryId };
31
+
32
+ //# sourceMappingURL=SqlGetPublishedRevisionByEntryId.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations/entry/SqlGetPublishedRevisionByEntryId.js","sources":["../../../src/operations/entry/SqlGetPublishedRevisionByEntryId.ts"],"sourcesContent":["import type { Knex } from \"knex\";\nimport type {\n CmsEntryStorageOperationsGetPublishedRevisionParams,\n CmsEntryValues,\n CmsModel\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { GetPublishedRevisionByEntryIdStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/GetPublishedRevisionByEntryIdStorageOperation.js\";\nimport { KnexClient } from \"@webiny/api-core-sql\";\nimport { EntryTableManager } from \"~/features/entryTableManager/abstractions.js\";\nimport { parseIdentifier } from \"@webiny/utils\";\nimport type { IEntryRow } from \"./types.js\";\nimport { rowToEntry } from \"./mappers.js\";\nimport { createEntryQuery } from \"./queryHelpers.js\";\n\nclass SqlGetPublishedRevisionByEntryIdImpl\n implements GetPublishedRevisionByEntryIdStorageOperation.Interface\n{\n private readonly knex: Knex;\n\n public constructor(\n knexClient: KnexClient.Interface,\n private readonly entryTableManager: EntryTableManager.Interface\n ) {\n this.knex = knexClient.client;\n }\n\n private query(): Knex.QueryBuilder<IEntryRow> {\n return createEntryQuery(this.knex, this.entryTableManager.getTableName());\n }\n\n async execute<T extends CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsGetPublishedRevisionParams\n ) {\n await this.entryTableManager.ensureTable();\n\n const { id: entryId } = parseIdentifier(params.id);\n\n const row = await this.query()\n .where(\"tenant\", model.tenant)\n .andWhere(\"modelId\", model.modelId)\n .where(\"entryId\", entryId)\n .andWhere(\"isPublished\", true)\n .first();\n\n if (!row) {\n return null;\n }\n\n return rowToEntry<T>(row);\n }\n}\n\nexport const SqlGetPublishedRevisionByEntryId =\n GetPublishedRevisionByEntryIdStorageOperation.createImplementation({\n implementation: SqlGetPublishedRevisionByEntryIdImpl,\n dependencies: [KnexClient, EntryTableManager]\n });\n"],"names":["SqlGetPublishedRevisionByEntryIdImpl","knexClient","entryTableManager","createEntryQuery","model","params","entryId","parseIdentifier","row","rowToEntry","SqlGetPublishedRevisionByEntryId","GetPublishedRevisionByEntryIdStorageOperation","KnexClient","EntryTableManager"],"mappings":";;;;;;AAcA,MAAMA;IAKF,YACIC,UAAgC,EACfC,iBAA8C,CACjE;aADmBA,iBAAiB,GAAjBA;QAEjB,IAAI,CAAC,IAAI,GAAGD,WAAW,MAAM;IACjC;IAEQ,QAAsC;QAC1C,OAAOE,iBAAiB,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,iBAAiB,CAAC,YAAY;IAC1E;IAEA,MAAM,QACFC,KAAe,EACfC,MAA2D,EAC7D;QACE,MAAM,IAAI,CAAC,iBAAiB,CAAC,WAAW;QAExC,MAAM,EAAE,IAAIC,OAAO,EAAE,GAAGC,gBAAgBF,OAAO,EAAE;QAEjD,MAAMG,MAAM,MAAM,IAAI,CAAC,KAAK,GACvB,KAAK,CAAC,UAAUJ,MAAM,MAAM,EAC5B,QAAQ,CAAC,WAAWA,MAAM,OAAO,EACjC,KAAK,CAAC,WAAWE,SACjB,QAAQ,CAAC,eAAe,MACxB,KAAK;QAEV,IAAI,CAACE,KACD,OAAO;QAGX,OAAOC,WAAcD;IACzB;AACJ;AAEO,MAAME,mCACTC,8CAA8C,oBAAoB,CAAC;IAC/D,gBAAgBX;IAChB,cAAc;QAACY;QAAYC;KAAkB;AACjD"}
@@ -0,0 +1,15 @@
1
+ import type { CmsEntryStorageOperationsGetRevisionParams, CmsEntryValues, CmsModel } from "@webiny/api-headless-cms/types/index.js";
2
+ import { GetRevisionByIdStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetRevisionByIdStorageOperation.js";
3
+ import { KnexClient } from "@webiny/api-core-sql";
4
+ import { EntryTableManager } from "../../features/entryTableManager/abstractions.js";
5
+ declare class SqlGetRevisionByIdImpl implements GetRevisionByIdStorageOperation.Interface {
6
+ private readonly entryTableManager;
7
+ private readonly knex;
8
+ constructor(knexClient: KnexClient.Interface, entryTableManager: EntryTableManager.Interface);
9
+ private query;
10
+ execute<T extends CmsEntryValues>(model: CmsModel, params: CmsEntryStorageOperationsGetRevisionParams): Promise<import("@webiny/api-headless-cms/types/types.js").CmsEntry<T> | null>;
11
+ }
12
+ export declare const SqlGetRevisionById: typeof SqlGetRevisionByIdImpl & {
13
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/entry/GetRevisionByIdStorageOperation.js").IGetRevisionByIdStorageOperation>;
14
+ };
15
+ export {};
@@ -0,0 +1,30 @@
1
+ import { GetRevisionByIdStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetRevisionByIdStorageOperation.js";
2
+ import { KnexClient } from "@webiny/api-core-sql";
3
+ import { EntryTableManager } from "../../features/entryTableManager/abstractions.js";
4
+ import { rowToEntry } from "./mappers.js";
5
+ import { createEntryQuery } from "./queryHelpers.js";
6
+ class SqlGetRevisionByIdImpl {
7
+ constructor(knexClient, entryTableManager){
8
+ this.entryTableManager = entryTableManager;
9
+ this.knex = knexClient.client;
10
+ }
11
+ query() {
12
+ return createEntryQuery(this.knex, this.entryTableManager.getTableName());
13
+ }
14
+ async execute(model, params) {
15
+ await this.entryTableManager.ensureTable();
16
+ const row = await this.query().where("tenant", model.tenant).andWhere("modelId", model.modelId).where("id", params.id).first();
17
+ if (!row) return null;
18
+ return rowToEntry(row);
19
+ }
20
+ }
21
+ const SqlGetRevisionById = GetRevisionByIdStorageOperation.createImplementation({
22
+ implementation: SqlGetRevisionByIdImpl,
23
+ dependencies: [
24
+ KnexClient,
25
+ EntryTableManager
26
+ ]
27
+ });
28
+ export { SqlGetRevisionById };
29
+
30
+ //# sourceMappingURL=SqlGetRevisionById.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations/entry/SqlGetRevisionById.js","sources":["../../../src/operations/entry/SqlGetRevisionById.ts"],"sourcesContent":["import type { Knex } from \"knex\";\nimport type {\n CmsEntryStorageOperationsGetRevisionParams,\n CmsEntryValues,\n CmsModel\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { GetRevisionByIdStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/GetRevisionByIdStorageOperation.js\";\nimport { KnexClient } from \"@webiny/api-core-sql\";\nimport { EntryTableManager } from \"~/features/entryTableManager/abstractions.js\";\nimport type { IEntryRow } from \"./types.js\";\nimport { rowToEntry } from \"./mappers.js\";\nimport { createEntryQuery } from \"./queryHelpers.js\";\n\nclass SqlGetRevisionByIdImpl implements GetRevisionByIdStorageOperation.Interface {\n private readonly knex: Knex;\n\n public constructor(\n knexClient: KnexClient.Interface,\n private readonly entryTableManager: EntryTableManager.Interface\n ) {\n this.knex = knexClient.client;\n }\n\n private query(): Knex.QueryBuilder<IEntryRow> {\n return createEntryQuery(this.knex, this.entryTableManager.getTableName());\n }\n\n async execute<T extends CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsGetRevisionParams\n ) {\n await this.entryTableManager.ensureTable();\n\n const row = await this.query()\n .where(\"tenant\", model.tenant)\n .andWhere(\"modelId\", model.modelId)\n .where(\"id\", params.id)\n .first();\n\n if (!row) {\n return null;\n }\n\n return rowToEntry<T>(row);\n }\n}\n\nexport const SqlGetRevisionById = GetRevisionByIdStorageOperation.createImplementation({\n implementation: SqlGetRevisionByIdImpl,\n dependencies: [KnexClient, EntryTableManager]\n});\n"],"names":["SqlGetRevisionByIdImpl","knexClient","entryTableManager","createEntryQuery","model","params","row","rowToEntry","SqlGetRevisionById","GetRevisionByIdStorageOperation","KnexClient","EntryTableManager"],"mappings":";;;;;AAaA,MAAMA;IAGF,YACIC,UAAgC,EACfC,iBAA8C,CACjE;aADmBA,iBAAiB,GAAjBA;QAEjB,IAAI,CAAC,IAAI,GAAGD,WAAW,MAAM;IACjC;IAEQ,QAAsC;QAC1C,OAAOE,iBAAiB,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,iBAAiB,CAAC,YAAY;IAC1E;IAEA,MAAM,QACFC,KAAe,EACfC,MAAkD,EACpD;QACE,MAAM,IAAI,CAAC,iBAAiB,CAAC,WAAW;QAExC,MAAMC,MAAM,MAAM,IAAI,CAAC,KAAK,GACvB,KAAK,CAAC,UAAUF,MAAM,MAAM,EAC5B,QAAQ,CAAC,WAAWA,MAAM,OAAO,EACjC,KAAK,CAAC,MAAMC,OAAO,EAAE,EACrB,KAAK;QAEV,IAAI,CAACC,KACD,OAAO;QAGX,OAAOC,WAAcD;IACzB;AACJ;AAEO,MAAME,qBAAqBC,gCAAgC,oBAAoB,CAAC;IACnF,gBAAgBT;IAChB,cAAc;QAACU;QAAYC;KAAkB;AACjD"}
@@ -0,0 +1,15 @@
1
+ import type { CmsEntryStorageOperationsGetRevisionsParams, CmsEntryValues, CmsModel } from "@webiny/api-headless-cms/types/index.js";
2
+ import { GetRevisionsStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetRevisionsStorageOperation.js";
3
+ import { KnexClient } from "@webiny/api-core-sql";
4
+ import { EntryTableManager } from "../../features/entryTableManager/abstractions.js";
5
+ declare class SqlGetRevisionsImpl implements GetRevisionsStorageOperation.Interface {
6
+ private readonly entryTableManager;
7
+ private readonly knex;
8
+ constructor(knexClient: KnexClient.Interface, entryTableManager: EntryTableManager.Interface);
9
+ private query;
10
+ execute<T extends CmsEntryValues>(model: CmsModel, params: CmsEntryStorageOperationsGetRevisionsParams): Promise<import("@webiny/api-headless-cms/types/types.js").CmsEntry<T>[]>;
11
+ }
12
+ export declare const SqlGetRevisions: typeof SqlGetRevisionsImpl & {
13
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/entry/GetRevisionsStorageOperation.js").IGetRevisionsStorageOperation>;
14
+ };
15
+ export {};
@@ -0,0 +1,31 @@
1
+ import { GetRevisionsStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetRevisionsStorageOperation.js";
2
+ import { KnexClient } from "@webiny/api-core-sql";
3
+ import { EntryTableManager } from "../../features/entryTableManager/abstractions.js";
4
+ import { parseIdentifier } from "@webiny/utils";
5
+ import { rowToEntry } from "./mappers.js";
6
+ import { createEntryQuery } from "./queryHelpers.js";
7
+ class SqlGetRevisionsImpl {
8
+ constructor(knexClient, entryTableManager){
9
+ this.entryTableManager = entryTableManager;
10
+ this.knex = knexClient.client;
11
+ }
12
+ query() {
13
+ return createEntryQuery(this.knex, this.entryTableManager.getTableName());
14
+ }
15
+ async execute(model, params) {
16
+ await this.entryTableManager.ensureTable();
17
+ const { id: entryId } = parseIdentifier(params.id);
18
+ const rows = await this.query().where("tenant", model.tenant).andWhere("modelId", model.modelId).where("entryId", entryId).orderBy("version", "desc");
19
+ return rows.map((row)=>rowToEntry(row));
20
+ }
21
+ }
22
+ const SqlGetRevisions = GetRevisionsStorageOperation.createImplementation({
23
+ implementation: SqlGetRevisionsImpl,
24
+ dependencies: [
25
+ KnexClient,
26
+ EntryTableManager
27
+ ]
28
+ });
29
+ export { SqlGetRevisions };
30
+
31
+ //# sourceMappingURL=SqlGetRevisions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations/entry/SqlGetRevisions.js","sources":["../../../src/operations/entry/SqlGetRevisions.ts"],"sourcesContent":["import type { Knex } from \"knex\";\nimport type {\n CmsEntryStorageOperationsGetRevisionsParams,\n CmsEntryValues,\n CmsModel\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { GetRevisionsStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/GetRevisionsStorageOperation.js\";\nimport { KnexClient } from \"@webiny/api-core-sql\";\nimport { EntryTableManager } from \"~/features/entryTableManager/abstractions.js\";\nimport { parseIdentifier } from \"@webiny/utils\";\nimport type { IEntryRow } from \"./types.js\";\nimport { rowToEntry } from \"./mappers.js\";\nimport { createEntryQuery } from \"./queryHelpers.js\";\n\nclass SqlGetRevisionsImpl implements GetRevisionsStorageOperation.Interface {\n private readonly knex: Knex;\n\n public constructor(\n knexClient: KnexClient.Interface,\n private readonly entryTableManager: EntryTableManager.Interface\n ) {\n this.knex = knexClient.client;\n }\n\n private query(): Knex.QueryBuilder<IEntryRow> {\n return createEntryQuery(this.knex, this.entryTableManager.getTableName());\n }\n\n async execute<T extends CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsGetRevisionsParams\n ) {\n await this.entryTableManager.ensureTable();\n\n const { id: entryId } = parseIdentifier(params.id);\n\n const rows: IEntryRow[] = await this.query()\n .where(\"tenant\", model.tenant)\n .andWhere(\"modelId\", model.modelId)\n .where(\"entryId\", entryId)\n .orderBy(\"version\", \"desc\");\n\n return rows.map(row => rowToEntry<T>(row));\n }\n}\n\nexport const SqlGetRevisions = GetRevisionsStorageOperation.createImplementation({\n implementation: SqlGetRevisionsImpl,\n dependencies: [KnexClient, EntryTableManager]\n});\n"],"names":["SqlGetRevisionsImpl","knexClient","entryTableManager","createEntryQuery","model","params","entryId","parseIdentifier","rows","row","rowToEntry","SqlGetRevisions","GetRevisionsStorageOperation","KnexClient","EntryTableManager"],"mappings":";;;;;;AAcA,MAAMA;IAGF,YACIC,UAAgC,EACfC,iBAA8C,CACjE;aADmBA,iBAAiB,GAAjBA;QAEjB,IAAI,CAAC,IAAI,GAAGD,WAAW,MAAM;IACjC;IAEQ,QAAsC;QAC1C,OAAOE,iBAAiB,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,iBAAiB,CAAC,YAAY;IAC1E;IAEA,MAAM,QACFC,KAAe,EACfC,MAAmD,EACrD;QACE,MAAM,IAAI,CAAC,iBAAiB,CAAC,WAAW;QAExC,MAAM,EAAE,IAAIC,OAAO,EAAE,GAAGC,gBAAgBF,OAAO,EAAE;QAEjD,MAAMG,OAAoB,MAAM,IAAI,CAAC,KAAK,GACrC,KAAK,CAAC,UAAUJ,MAAM,MAAM,EAC5B,QAAQ,CAAC,WAAWA,MAAM,OAAO,EACjC,KAAK,CAAC,WAAWE,SACjB,OAAO,CAAC,WAAW;QAExB,OAAOE,KAAK,GAAG,CAACC,CAAAA,MAAOC,WAAcD;IACzC;AACJ;AAEO,MAAME,kBAAkBC,6BAA6B,oBAAoB,CAAC;IAC7E,gBAAgBZ;IAChB,cAAc;QAACa;QAAYC;KAAkB;AACjD"}
@@ -0,0 +1,27 @@
1
+ import type { CmsEntryStorageOperationsGetUniqueFieldValuesParams, CmsModel } from "@webiny/api-headless-cms/types/index.js";
2
+ import { GetUniqueFieldValuesStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetUniqueFieldValuesStorageOperation.js";
3
+ import { KnexClient } from "@webiny/api-core-sql";
4
+ import { EntryTableManager } from "../../features/entryTableManager/abstractions.js";
5
+ import { StorageTransformRegistry } from "@webiny/api-headless-cms/exports/api/cms/storage.js";
6
+ import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
7
+ import { CmsEntrySystemField } from "@webiny/api-headless-cms/features/contentEntry/EntrySystemField/index.js";
8
+ import { ValueFilterRegistry } from "@webiny/db-utils";
9
+ import { FieldFilterPathRegistry, FieldFilterValueTransformRegistry, FieldFilterCreateRegistry, FieldSortingRegistry } from "@webiny/api-headless-cms-storage";
10
+ declare class SqlGetUniqueFieldValuesImpl implements GetUniqueFieldValuesStorageOperation.Interface {
11
+ private readonly entryTableManager;
12
+ private readonly storageTransformRegistry;
13
+ private readonly storageModelProvider;
14
+ private readonly pathRegistry;
15
+ private readonly transformRegistry;
16
+ private readonly filterCreateRegistry;
17
+ private readonly sortingRegistry;
18
+ private readonly valueFilterRegistry;
19
+ private readonly entrySystemFields;
20
+ private readonly knex;
21
+ constructor(knexClient: KnexClient.Interface, entryTableManager: EntryTableManager.Interface, storageTransformRegistry: StorageTransformRegistry.Interface, storageModelProvider: CmsStorageModelProvider.Interface, pathRegistry: FieldFilterPathRegistry.Interface, transformRegistry: FieldFilterValueTransformRegistry.Interface, filterCreateRegistry: FieldFilterCreateRegistry.Interface, sortingRegistry: FieldSortingRegistry.Interface, valueFilterRegistry: ValueFilterRegistry.Interface, entrySystemFields: CmsEntrySystemField.Interface[]);
22
+ execute(model: CmsModel, params: CmsEntryStorageOperationsGetUniqueFieldValuesParams): Promise<import("@webiny/api-headless-cms/types/types.js").CmsEntryUniqueValue[]>;
23
+ }
24
+ export declare const SqlGetUniqueFieldValues: typeof SqlGetUniqueFieldValuesImpl & {
25
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/entry/GetUniqueFieldValuesStorageOperation.js").IGetUniqueFieldValuesStorageOperation>;
26
+ };
27
+ export {};
@@ -0,0 +1,67 @@
1
+ import { GetUniqueFieldValuesStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetUniqueFieldValuesStorageOperation.js";
2
+ import { KnexClient } from "@webiny/api-core-sql";
3
+ import { EntryTableManager } from "../../features/entryTableManager/abstractions.js";
4
+ import { StorageTransformRegistry } from "@webiny/api-headless-cms/exports/api/cms/storage.js";
5
+ import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
6
+ import { CmsEntrySystemField } from "@webiny/api-headless-cms/features/contentEntry/EntrySystemField/index.js";
7
+ import { ValueFilterRegistry } from "@webiny/db-utils";
8
+ import { FieldFilterCreateRegistry, FieldFilterPathRegistry, FieldFilterValueTransformRegistry, FieldSortingRegistry, aggregateUniqueFieldValues } from "@webiny/api-headless-cms-storage";
9
+ import { MAX_LIST_LIMIT, listEntries } from "./queryHelpers.js";
10
+ class SqlGetUniqueFieldValuesImpl {
11
+ constructor(knexClient, entryTableManager, storageTransformRegistry, storageModelProvider, pathRegistry, transformRegistry, filterCreateRegistry, sortingRegistry, valueFilterRegistry, entrySystemFields){
12
+ this.entryTableManager = entryTableManager;
13
+ this.storageTransformRegistry = storageTransformRegistry;
14
+ this.storageModelProvider = storageModelProvider;
15
+ this.pathRegistry = pathRegistry;
16
+ this.transformRegistry = transformRegistry;
17
+ this.filterCreateRegistry = filterCreateRegistry;
18
+ this.sortingRegistry = sortingRegistry;
19
+ this.valueFilterRegistry = valueFilterRegistry;
20
+ this.entrySystemFields = entrySystemFields;
21
+ this.knex = knexClient.client;
22
+ }
23
+ async execute(model, params) {
24
+ const field = model.fields.find((f)=>f.fieldId === params.fieldId);
25
+ if (!field) return [];
26
+ await this.entryTableManager.ensureTable();
27
+ const { items } = await listEntries({
28
+ knex: this.knex,
29
+ tableName: this.entryTableManager.getTableName(),
30
+ storageModelProvider: this.storageModelProvider,
31
+ storageTransformRegistry: this.storageTransformRegistry,
32
+ pathRegistry: this.pathRegistry,
33
+ transformRegistry: this.transformRegistry,
34
+ filterCreateRegistry: this.filterCreateRegistry,
35
+ sortingRegistry: this.sortingRegistry,
36
+ valueFilterRegistry: this.valueFilterRegistry,
37
+ systemFields: this.entrySystemFields.map((systemField)=>systemField.field)
38
+ }, model, {
39
+ where: params.where,
40
+ limit: MAX_LIST_LIMIT
41
+ });
42
+ return aggregateUniqueFieldValues(items, field.fieldId);
43
+ }
44
+ }
45
+ const SqlGetUniqueFieldValues = GetUniqueFieldValuesStorageOperation.createImplementation({
46
+ implementation: SqlGetUniqueFieldValuesImpl,
47
+ dependencies: [
48
+ KnexClient,
49
+ EntryTableManager,
50
+ StorageTransformRegistry,
51
+ CmsStorageModelProvider,
52
+ FieldFilterPathRegistry,
53
+ FieldFilterValueTransformRegistry,
54
+ FieldFilterCreateRegistry,
55
+ FieldSortingRegistry,
56
+ ValueFilterRegistry,
57
+ [
58
+ CmsEntrySystemField,
59
+ {
60
+ multiple: true
61
+ }
62
+ ]
63
+ ]
64
+ });
65
+ export { SqlGetUniqueFieldValues };
66
+
67
+ //# sourceMappingURL=SqlGetUniqueFieldValues.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations/entry/SqlGetUniqueFieldValues.js","sources":["../../../src/operations/entry/SqlGetUniqueFieldValues.ts"],"sourcesContent":["import type { Knex } from \"knex\";\nimport type {\n CmsEntryStorageOperationsGetUniqueFieldValuesParams,\n CmsModel\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { GetUniqueFieldValuesStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/GetUniqueFieldValuesStorageOperation.js\";\nimport { KnexClient } from \"@webiny/api-core-sql\";\nimport { EntryTableManager } from \"~/features/entryTableManager/abstractions.js\";\nimport { StorageTransformRegistry } from \"@webiny/api-headless-cms/exports/api/cms/storage.js\";\nimport { CmsStorageModelProvider } from \"@webiny/api-headless-cms/features/shared/abstractions.js\";\nimport { CmsEntrySystemField } from \"@webiny/api-headless-cms/features/contentEntry/EntrySystemField/index.js\";\nimport { ValueFilterRegistry } from \"@webiny/db-utils\";\nimport {\n aggregateUniqueFieldValues,\n FieldFilterPathRegistry,\n FieldFilterValueTransformRegistry,\n FieldFilterCreateRegistry,\n FieldSortingRegistry\n} from \"@webiny/api-headless-cms-storage\";\nimport { listEntries, MAX_LIST_LIMIT } from \"./queryHelpers.js\";\n\nclass SqlGetUniqueFieldValuesImpl implements GetUniqueFieldValuesStorageOperation.Interface {\n private readonly knex: Knex;\n\n public constructor(\n knexClient: KnexClient.Interface,\n private readonly entryTableManager: EntryTableManager.Interface,\n private readonly storageTransformRegistry: StorageTransformRegistry.Interface,\n private readonly storageModelProvider: CmsStorageModelProvider.Interface,\n private readonly pathRegistry: FieldFilterPathRegistry.Interface,\n private readonly transformRegistry: FieldFilterValueTransformRegistry.Interface,\n private readonly filterCreateRegistry: FieldFilterCreateRegistry.Interface,\n private readonly sortingRegistry: FieldSortingRegistry.Interface,\n private readonly valueFilterRegistry: ValueFilterRegistry.Interface,\n private readonly entrySystemFields: CmsEntrySystemField.Interface[]\n ) {\n this.knex = knexClient.client;\n }\n\n async execute(model: CmsModel, params: CmsEntryStorageOperationsGetUniqueFieldValuesParams) {\n const field = model.fields.find(f => f.fieldId === params.fieldId);\n\n if (!field) {\n return [];\n }\n\n await this.entryTableManager.ensureTable();\n\n const { items } = await listEntries(\n {\n knex: this.knex,\n tableName: this.entryTableManager.getTableName(),\n storageModelProvider: this.storageModelProvider,\n storageTransformRegistry: this.storageTransformRegistry,\n pathRegistry: this.pathRegistry,\n transformRegistry: this.transformRegistry,\n filterCreateRegistry: this.filterCreateRegistry,\n sortingRegistry: this.sortingRegistry,\n valueFilterRegistry: this.valueFilterRegistry,\n systemFields: this.entrySystemFields.map(systemField => systemField.field)\n },\n model,\n {\n where: params.where,\n limit: MAX_LIST_LIMIT\n }\n );\n\n return aggregateUniqueFieldValues(items, field.fieldId);\n }\n}\n\nexport const SqlGetUniqueFieldValues = GetUniqueFieldValuesStorageOperation.createImplementation({\n implementation: SqlGetUniqueFieldValuesImpl,\n dependencies: [\n KnexClient,\n EntryTableManager,\n StorageTransformRegistry,\n CmsStorageModelProvider,\n FieldFilterPathRegistry,\n FieldFilterValueTransformRegistry,\n FieldFilterCreateRegistry,\n FieldSortingRegistry,\n ValueFilterRegistry,\n [CmsEntrySystemField, { multiple: true }]\n ]\n});\n"],"names":["SqlGetUniqueFieldValuesImpl","knexClient","entryTableManager","storageTransformRegistry","storageModelProvider","pathRegistry","transformRegistry","filterCreateRegistry","sortingRegistry","valueFilterRegistry","entrySystemFields","model","params","field","f","items","listEntries","systemField","MAX_LIST_LIMIT","aggregateUniqueFieldValues","SqlGetUniqueFieldValues","GetUniqueFieldValuesStorageOperation","KnexClient","EntryTableManager","StorageTransformRegistry","CmsStorageModelProvider","FieldFilterPathRegistry","FieldFilterValueTransformRegistry","FieldFilterCreateRegistry","FieldSortingRegistry","ValueFilterRegistry","CmsEntrySystemField"],"mappings":";;;;;;;;;AAqBA,MAAMA;IAGF,YACIC,UAAgC,EACfC,iBAA8C,EAC9CC,wBAA4D,EAC5DC,oBAAuD,EACvDC,YAA+C,EAC/CC,iBAA8D,EAC9DC,oBAAyD,EACzDC,eAA+C,EAC/CC,mBAAkD,EAClDC,iBAAkD,CACrE;aATmBR,iBAAiB,GAAjBA;aACAC,wBAAwB,GAAxBA;aACAC,oBAAoB,GAApBA;aACAC,YAAY,GAAZA;aACAC,iBAAiB,GAAjBA;aACAC,oBAAoB,GAApBA;aACAC,eAAe,GAAfA;aACAC,mBAAmB,GAAnBA;aACAC,iBAAiB,GAAjBA;QAEjB,IAAI,CAAC,IAAI,GAAGT,WAAW,MAAM;IACjC;IAEA,MAAM,QAAQU,KAAe,EAAEC,MAA2D,EAAE;QACxF,MAAMC,QAAQF,MAAM,MAAM,CAAC,IAAI,CAACG,CAAAA,IAAKA,EAAE,OAAO,KAAKF,OAAO,OAAO;QAEjE,IAAI,CAACC,OACD,OAAO,EAAE;QAGb,MAAM,IAAI,CAAC,iBAAiB,CAAC,WAAW;QAExC,MAAM,EAAEE,KAAK,EAAE,GAAG,MAAMC,YACpB;YACI,MAAM,IAAI,CAAC,IAAI;YACf,WAAW,IAAI,CAAC,iBAAiB,CAAC,YAAY;YAC9C,sBAAsB,IAAI,CAAC,oBAAoB;YAC/C,0BAA0B,IAAI,CAAC,wBAAwB;YACvD,cAAc,IAAI,CAAC,YAAY;YAC/B,mBAAmB,IAAI,CAAC,iBAAiB;YACzC,sBAAsB,IAAI,CAAC,oBAAoB;YAC/C,iBAAiB,IAAI,CAAC,eAAe;YACrC,qBAAqB,IAAI,CAAC,mBAAmB;YAC7C,cAAc,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAACC,CAAAA,cAAeA,YAAY,KAAK;QAC7E,GACAN,OACA;YACI,OAAOC,OAAO,KAAK;YACnB,OAAOM;QACX;QAGJ,OAAOC,2BAA2BJ,OAAOF,MAAM,OAAO;IAC1D;AACJ;AAEO,MAAMO,0BAA0BC,qCAAqC,oBAAoB,CAAC;IAC7F,gBAAgBrB;IAChB,cAAc;QACVsB;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACA;YAACC;YAAqB;gBAAE,UAAU;YAAK;SAAE;KAC5C;AACL"}
@@ -0,0 +1,27 @@
1
+ import type { CmsEntryStorageOperationsListParams, CmsEntryValues, CmsModel } from "@webiny/api-headless-cms/types/index.js";
2
+ import { ListEntriesStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/ListEntriesStorageOperation.js";
3
+ import { KnexClient } from "@webiny/api-core-sql";
4
+ import { EntryTableManager } from "../../features/entryTableManager/abstractions.js";
5
+ import { StorageTransformRegistry } from "@webiny/api-headless-cms/exports/api/cms/storage.js";
6
+ import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
7
+ import { CmsEntrySystemField } from "@webiny/api-headless-cms/features/contentEntry/EntrySystemField/index.js";
8
+ import { ValueFilterRegistry } from "@webiny/db-utils";
9
+ import { FieldFilterPathRegistry, FieldFilterValueTransformRegistry, FieldFilterCreateRegistry, FieldSortingRegistry } from "@webiny/api-headless-cms-storage";
10
+ declare class SqlListEntriesImpl implements ListEntriesStorageOperation.Interface {
11
+ private readonly entryTableManager;
12
+ private readonly storageTransformRegistry;
13
+ private readonly storageModelProvider;
14
+ private readonly pathRegistry;
15
+ private readonly transformRegistry;
16
+ private readonly filterCreateRegistry;
17
+ private readonly sortingRegistry;
18
+ private readonly valueFilterRegistry;
19
+ private readonly entrySystemFields;
20
+ private readonly knex;
21
+ constructor(knexClient: KnexClient.Interface, entryTableManager: EntryTableManager.Interface, storageTransformRegistry: StorageTransformRegistry.Interface, storageModelProvider: CmsStorageModelProvider.Interface, pathRegistry: FieldFilterPathRegistry.Interface, transformRegistry: FieldFilterValueTransformRegistry.Interface, filterCreateRegistry: FieldFilterCreateRegistry.Interface, sortingRegistry: FieldSortingRegistry.Interface, valueFilterRegistry: ValueFilterRegistry.Interface, entrySystemFields: CmsEntrySystemField.Interface[]);
22
+ execute<T extends CmsEntryValues = CmsEntryValues>(model: CmsModel, params: CmsEntryStorageOperationsListParams): Promise<import("@webiny/api-headless-cms/types/types.js").CmsEntryStorageOperationsListResponse<import("@webiny/api-headless-cms/types/types.js").CmsEntry<T>>>;
23
+ }
24
+ export declare const SqlListEntries: typeof SqlListEntriesImpl & {
25
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/entry/ListEntriesStorageOperation.js").IListEntriesStorageOperation>;
26
+ };
27
+ export {};
@@ -0,0 +1,61 @@
1
+ import { ListEntriesStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/ListEntriesStorageOperation.js";
2
+ import { KnexClient } from "@webiny/api-core-sql";
3
+ import { EntryTableManager } from "../../features/entryTableManager/abstractions.js";
4
+ import { StorageTransformRegistry } from "@webiny/api-headless-cms/exports/api/cms/storage.js";
5
+ import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
6
+ import { CmsEntrySystemField } from "@webiny/api-headless-cms/features/contentEntry/EntrySystemField/index.js";
7
+ import { ValueFilterRegistry } from "@webiny/db-utils";
8
+ import { FieldFilterCreateRegistry, FieldFilterPathRegistry, FieldFilterValueTransformRegistry, FieldSortingRegistry } from "@webiny/api-headless-cms-storage";
9
+ import { listEntries } from "./queryHelpers.js";
10
+ class SqlListEntriesImpl {
11
+ constructor(knexClient, entryTableManager, storageTransformRegistry, storageModelProvider, pathRegistry, transformRegistry, filterCreateRegistry, sortingRegistry, valueFilterRegistry, entrySystemFields){
12
+ this.entryTableManager = entryTableManager;
13
+ this.storageTransformRegistry = storageTransformRegistry;
14
+ this.storageModelProvider = storageModelProvider;
15
+ this.pathRegistry = pathRegistry;
16
+ this.transformRegistry = transformRegistry;
17
+ this.filterCreateRegistry = filterCreateRegistry;
18
+ this.sortingRegistry = sortingRegistry;
19
+ this.valueFilterRegistry = valueFilterRegistry;
20
+ this.entrySystemFields = entrySystemFields;
21
+ this.knex = knexClient.client;
22
+ }
23
+ async execute(model, params) {
24
+ await this.entryTableManager.ensureTable();
25
+ return listEntries({
26
+ knex: this.knex,
27
+ tableName: this.entryTableManager.getTableName(),
28
+ storageModelProvider: this.storageModelProvider,
29
+ storageTransformRegistry: this.storageTransformRegistry,
30
+ pathRegistry: this.pathRegistry,
31
+ transformRegistry: this.transformRegistry,
32
+ filterCreateRegistry: this.filterCreateRegistry,
33
+ sortingRegistry: this.sortingRegistry,
34
+ valueFilterRegistry: this.valueFilterRegistry,
35
+ systemFields: this.entrySystemFields.map((systemField)=>systemField.field)
36
+ }, model, params);
37
+ }
38
+ }
39
+ const SqlListEntries = ListEntriesStorageOperation.createImplementation({
40
+ implementation: SqlListEntriesImpl,
41
+ dependencies: [
42
+ KnexClient,
43
+ EntryTableManager,
44
+ StorageTransformRegistry,
45
+ CmsStorageModelProvider,
46
+ FieldFilterPathRegistry,
47
+ FieldFilterValueTransformRegistry,
48
+ FieldFilterCreateRegistry,
49
+ FieldSortingRegistry,
50
+ ValueFilterRegistry,
51
+ [
52
+ CmsEntrySystemField,
53
+ {
54
+ multiple: true
55
+ }
56
+ ]
57
+ ]
58
+ });
59
+ export { SqlListEntries };
60
+
61
+ //# sourceMappingURL=SqlListEntries.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations/entry/SqlListEntries.js","sources":["../../../src/operations/entry/SqlListEntries.ts"],"sourcesContent":["import type { Knex } from \"knex\";\nimport type {\n CmsEntryStorageOperationsListParams,\n CmsEntryValues,\n CmsModel\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { ListEntriesStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/ListEntriesStorageOperation.js\";\nimport { KnexClient } from \"@webiny/api-core-sql\";\nimport { EntryTableManager } from \"~/features/entryTableManager/abstractions.js\";\nimport { StorageTransformRegistry } from \"@webiny/api-headless-cms/exports/api/cms/storage.js\";\nimport { CmsStorageModelProvider } from \"@webiny/api-headless-cms/features/shared/abstractions.js\";\nimport { CmsEntrySystemField } from \"@webiny/api-headless-cms/features/contentEntry/EntrySystemField/index.js\";\nimport { ValueFilterRegistry } from \"@webiny/db-utils\";\nimport {\n FieldFilterPathRegistry,\n FieldFilterValueTransformRegistry,\n FieldFilterCreateRegistry,\n FieldSortingRegistry\n} from \"@webiny/api-headless-cms-storage\";\nimport { listEntries } from \"./queryHelpers.js\";\n\nclass SqlListEntriesImpl implements ListEntriesStorageOperation.Interface {\n private readonly knex: Knex;\n\n public constructor(\n knexClient: KnexClient.Interface,\n private readonly entryTableManager: EntryTableManager.Interface,\n private readonly storageTransformRegistry: StorageTransformRegistry.Interface,\n private readonly storageModelProvider: CmsStorageModelProvider.Interface,\n private readonly pathRegistry: FieldFilterPathRegistry.Interface,\n private readonly transformRegistry: FieldFilterValueTransformRegistry.Interface,\n private readonly filterCreateRegistry: FieldFilterCreateRegistry.Interface,\n private readonly sortingRegistry: FieldSortingRegistry.Interface,\n private readonly valueFilterRegistry: ValueFilterRegistry.Interface,\n private readonly entrySystemFields: CmsEntrySystemField.Interface[]\n ) {\n this.knex = knexClient.client;\n }\n\n async execute<T extends CmsEntryValues = CmsEntryValues>(\n model: CmsModel,\n params: CmsEntryStorageOperationsListParams\n ) {\n await this.entryTableManager.ensureTable();\n\n return listEntries<T>(\n {\n knex: this.knex,\n tableName: this.entryTableManager.getTableName(),\n storageModelProvider: this.storageModelProvider,\n storageTransformRegistry: this.storageTransformRegistry,\n pathRegistry: this.pathRegistry,\n transformRegistry: this.transformRegistry,\n filterCreateRegistry: this.filterCreateRegistry,\n sortingRegistry: this.sortingRegistry,\n valueFilterRegistry: this.valueFilterRegistry,\n systemFields: this.entrySystemFields.map(systemField => systemField.field)\n },\n model,\n params\n );\n }\n}\n\nexport const SqlListEntries = ListEntriesStorageOperation.createImplementation({\n implementation: SqlListEntriesImpl,\n dependencies: [\n KnexClient,\n EntryTableManager,\n StorageTransformRegistry,\n CmsStorageModelProvider,\n FieldFilterPathRegistry,\n FieldFilterValueTransformRegistry,\n FieldFilterCreateRegistry,\n FieldSortingRegistry,\n ValueFilterRegistry,\n [CmsEntrySystemField, { multiple: true }]\n ]\n});\n"],"names":["SqlListEntriesImpl","knexClient","entryTableManager","storageTransformRegistry","storageModelProvider","pathRegistry","transformRegistry","filterCreateRegistry","sortingRegistry","valueFilterRegistry","entrySystemFields","model","params","listEntries","systemField","SqlListEntries","ListEntriesStorageOperation","KnexClient","EntryTableManager","StorageTransformRegistry","CmsStorageModelProvider","FieldFilterPathRegistry","FieldFilterValueTransformRegistry","FieldFilterCreateRegistry","FieldSortingRegistry","ValueFilterRegistry","CmsEntrySystemField"],"mappings":";;;;;;;;;AAqBA,MAAMA;IAGF,YACIC,UAAgC,EACfC,iBAA8C,EAC9CC,wBAA4D,EAC5DC,oBAAuD,EACvDC,YAA+C,EAC/CC,iBAA8D,EAC9DC,oBAAyD,EACzDC,eAA+C,EAC/CC,mBAAkD,EAClDC,iBAAkD,CACrE;aATmBR,iBAAiB,GAAjBA;aACAC,wBAAwB,GAAxBA;aACAC,oBAAoB,GAApBA;aACAC,YAAY,GAAZA;aACAC,iBAAiB,GAAjBA;aACAC,oBAAoB,GAApBA;aACAC,eAAe,GAAfA;aACAC,mBAAmB,GAAnBA;aACAC,iBAAiB,GAAjBA;QAEjB,IAAI,CAAC,IAAI,GAAGT,WAAW,MAAM;IACjC;IAEA,MAAM,QACFU,KAAe,EACfC,MAA2C,EAC7C;QACE,MAAM,IAAI,CAAC,iBAAiB,CAAC,WAAW;QAExC,OAAOC,YACH;YACI,MAAM,IAAI,CAAC,IAAI;YACf,WAAW,IAAI,CAAC,iBAAiB,CAAC,YAAY;YAC9C,sBAAsB,IAAI,CAAC,oBAAoB;YAC/C,0BAA0B,IAAI,CAAC,wBAAwB;YACvD,cAAc,IAAI,CAAC,YAAY;YAC/B,mBAAmB,IAAI,CAAC,iBAAiB;YACzC,sBAAsB,IAAI,CAAC,oBAAoB;YAC/C,iBAAiB,IAAI,CAAC,eAAe;YACrC,qBAAqB,IAAI,CAAC,mBAAmB;YAC7C,cAAc,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAACC,CAAAA,cAAeA,YAAY,KAAK;QAC7E,GACAH,OACAC;IAER;AACJ;AAEO,MAAMG,iBAAiBC,4BAA4B,oBAAoB,CAAC;IAC3E,gBAAgBhB;IAChB,cAAc;QACViB;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACA;YAACC;YAAqB;gBAAE,UAAU;YAAK;SAAE;KAC5C;AACL"}
@@ -0,0 +1,14 @@
1
+ import type { CmsModel } from "@webiny/api-headless-cms/types/index.js";
2
+ import { MoveEntryStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/MoveEntryStorageOperation.js";
3
+ import { KnexClient } from "@webiny/api-core-sql";
4
+ import { EntryTableManager } from "../../features/entryTableManager/abstractions.js";
5
+ declare class SqlMoveEntryImpl implements MoveEntryStorageOperation.Interface {
6
+ private readonly entryTableManager;
7
+ private readonly knex;
8
+ constructor(knexClient: KnexClient.Interface, entryTableManager: EntryTableManager.Interface);
9
+ execute(model: CmsModel, id: string, folderId: string): Promise<void>;
10
+ }
11
+ export declare const SqlMoveEntry: typeof SqlMoveEntryImpl & {
12
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/entry/MoveEntryStorageOperation.js").IMoveEntryStorageOperation>;
13
+ };
14
+ export {};
@@ -0,0 +1,30 @@
1
+ import { MoveEntryStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/MoveEntryStorageOperation.js";
2
+ import { KnexClient } from "@webiny/api-core-sql";
3
+ import { EntryTableManager } from "../../features/entryTableManager/abstractions.js";
4
+ import { parseIdentifier } from "@webiny/utils";
5
+ import { patchAllEntryRevisions } from "./queryHelpers.js";
6
+ class SqlMoveEntryImpl {
7
+ constructor(knexClient, entryTableManager){
8
+ this.entryTableManager = entryTableManager;
9
+ this.knex = knexClient.client;
10
+ }
11
+ async execute(model, id, folderId) {
12
+ await this.entryTableManager.ensureTable();
13
+ const { id: entryId } = parseIdentifier(id);
14
+ await patchAllEntryRevisions(this.knex, this.entryTableManager.getTableName(), model, entryId, (parsed)=>{
15
+ parsed.location = {
16
+ folderId
17
+ };
18
+ });
19
+ }
20
+ }
21
+ const SqlMoveEntry = MoveEntryStorageOperation.createImplementation({
22
+ implementation: SqlMoveEntryImpl,
23
+ dependencies: [
24
+ KnexClient,
25
+ EntryTableManager
26
+ ]
27
+ });
28
+ export { SqlMoveEntry };
29
+
30
+ //# sourceMappingURL=SqlMoveEntry.js.map