@webiny/api-headless-cms-ddb 6.3.0 → 6.4.0-beta.1

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 (100) hide show
  1. package/definitions/entry.js +7 -9
  2. package/definitions/entry.js.map +1 -1
  3. package/definitions/group.js +7 -9
  4. package/definitions/group.js.map +1 -1
  5. package/definitions/model.js +7 -9
  6. package/definitions/model.js.map +1 -1
  7. package/definitions/table.js +6 -7
  8. package/definitions/table.js.map +1 -1
  9. package/definitions/types.d.ts +1 -0
  10. package/definitions/types.js +0 -3
  11. package/dynamoDb/index.js +6 -1
  12. package/dynamoDb/index.js.map +1 -1
  13. package/dynamoDb/path/locationFolderId.js +16 -29
  14. package/dynamoDb/path/locationFolderId.js.map +1 -1
  15. package/dynamoDb/path/plainObject.js +11 -21
  16. package/dynamoDb/path/plainObject.js.map +1 -1
  17. package/dynamoDb/transformValue/datetime.js +21 -32
  18. package/dynamoDb/transformValue/datetime.js.map +1 -1
  19. package/index.js +67 -77
  20. package/index.js.map +1 -1
  21. package/operations/entry/dataLoader/DataLoaderCache.js +22 -26
  22. package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -1
  23. package/operations/entry/dataLoader/constants.js +2 -1
  24. package/operations/entry/dataLoader/constants.js.map +1 -1
  25. package/operations/entry/dataLoader/createBatchScheduleFn.js +6 -15
  26. package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -1
  27. package/operations/entry/dataLoader/getAllEntryRevisions.js +18 -29
  28. package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -1
  29. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +31 -41
  30. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -1
  31. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +31 -41
  32. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -1
  33. package/operations/entry/dataLoader/getRevisionById.js +33 -47
  34. package/operations/entry/dataLoader/getRevisionById.js.map +1 -1
  35. package/operations/entry/dataLoader/index.js +8 -9
  36. package/operations/entry/dataLoader/index.js.map +1 -1
  37. package/operations/entry/dataLoader/types.js +0 -3
  38. package/operations/entry/dataLoaders.js +81 -99
  39. package/operations/entry/dataLoaders.js.map +1 -1
  40. package/operations/entry/filtering/createExpressions.js +109 -157
  41. package/operations/entry/filtering/createExpressions.js.map +1 -1
  42. package/operations/entry/filtering/createFields.js +83 -96
  43. package/operations/entry/filtering/createFields.js.map +1 -1
  44. package/operations/entry/filtering/extractSort.js +50 -74
  45. package/operations/entry/filtering/extractSort.js.map +1 -1
  46. package/operations/entry/filtering/filter.js +72 -140
  47. package/operations/entry/filtering/filter.js.map +1 -1
  48. package/operations/entry/filtering/fullTextSearch.js +21 -38
  49. package/operations/entry/filtering/fullTextSearch.js.map +1 -1
  50. package/operations/entry/filtering/getValue.js +31 -53
  51. package/operations/entry/filtering/getValue.js.map +1 -1
  52. package/operations/entry/filtering/index.js +0 -2
  53. package/operations/entry/filtering/mapPlugins.js +15 -22
  54. package/operations/entry/filtering/mapPlugins.js.map +1 -1
  55. package/operations/entry/filtering/plugins/defaultFilterCreate.js +29 -33
  56. package/operations/entry/filtering/plugins/defaultFilterCreate.js.map +1 -1
  57. package/operations/entry/filtering/plugins/index.js +7 -3
  58. package/operations/entry/filtering/plugins/index.js.map +1 -1
  59. package/operations/entry/filtering/plugins/objectFilterCreate.js +60 -76
  60. package/operations/entry/filtering/plugins/objectFilterCreate.js.map +1 -1
  61. package/operations/entry/filtering/plugins/refFilterCreate.js +55 -66
  62. package/operations/entry/filtering/plugins/refFilterCreate.js.map +1 -1
  63. package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js +43 -56
  64. package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js.map +1 -1
  65. package/operations/entry/filtering/sort.js +34 -60
  66. package/operations/entry/filtering/sort.js.map +1 -1
  67. package/operations/entry/filtering/systemFields.js +144 -126
  68. package/operations/entry/filtering/systemFields.js.map +1 -1
  69. package/operations/entry/filtering/transform.js +4 -8
  70. package/operations/entry/filtering/transform.js.map +1 -1
  71. package/operations/entry/filtering/types.js +0 -3
  72. package/operations/entry/filtering/values.js +11 -12
  73. package/operations/entry/filtering/values.js.map +1 -1
  74. package/operations/entry/filtering/where.js +17 -23
  75. package/operations/entry/filtering/where.js.map +1 -1
  76. package/operations/entry/index.js +894 -1148
  77. package/operations/entry/index.js.map +1 -1
  78. package/operations/entry/keys.js +54 -77
  79. package/operations/entry/keys.js.map +1 -1
  80. package/operations/group/index.js +113 -134
  81. package/operations/group/index.js.map +1 -1
  82. package/operations/model/index.js +100 -121
  83. package/operations/model/index.js.map +1 -1
  84. package/package.json +16 -16
  85. package/plugins/CmsEntryFieldFilterPathPlugin.js +23 -33
  86. package/plugins/CmsEntryFieldFilterPathPlugin.js.map +1 -1
  87. package/plugins/CmsEntryFieldFilterPlugin.js +16 -17
  88. package/plugins/CmsEntryFieldFilterPlugin.js.map +1 -1
  89. package/plugins/CmsEntryFieldSortingPlugin.js +16 -15
  90. package/plugins/CmsEntryFieldSortingPlugin.js.map +1 -1
  91. package/plugins/CmsFieldFilterValueTransformPlugin.js +15 -12
  92. package/plugins/CmsFieldFilterValueTransformPlugin.js.map +1 -1
  93. package/plugins/index.js +0 -2
  94. package/types.js +6 -5
  95. package/types.js.map +1 -1
  96. package/definitions/types.js.map +0 -1
  97. package/operations/entry/dataLoader/types.js.map +0 -1
  98. package/operations/entry/filtering/index.js.map +0 -1
  99. package/operations/entry/filtering/types.js.map +0 -1
  100. package/plugins/index.js.map +0 -1
@@ -1,13 +1,11 @@
1
1
  import { createStandardEntity } from "@webiny/db-dynamodb";
2
- export const createEntryEntity = params => {
3
- const {
4
- table,
5
- entityName
6
- } = params;
7
- return createStandardEntity({
8
- name: entityName,
9
- table: table.table
10
- });
2
+ const createEntryEntity = (params)=>{
3
+ const { table, entityName } = params;
4
+ return createStandardEntity({
5
+ name: entityName,
6
+ table: table.table
7
+ });
11
8
  };
9
+ export { createEntryEntity };
12
10
 
13
11
  //# sourceMappingURL=entry.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createStandardEntity","createEntryEntity","params","table","entityName","name"],"sources":["entry.ts"],"sourcesContent":["import { createStandardEntity, type ITable } from \"@webiny/db-dynamodb\";\nimport type { IEntryEntity, IEntryEntityAttributesData } from \"./types.js\";\n\ninterface Params {\n table: ITable;\n entityName: string;\n}\n\nexport const createEntryEntity = (params: Params): IEntryEntity => {\n const { table, entityName } = params;\n return createStandardEntity<IEntryEntityAttributesData>({\n name: entityName,\n table: table.table\n });\n};\n"],"mappings":"AAAA,SAASA,oBAAoB,QAAqB,qBAAqB;AAQvE,OAAO,MAAMC,iBAAiB,GAAIC,MAAc,IAAmB;EAC/D,MAAM;IAAEC,KAAK;IAAEC;EAAW,CAAC,GAAGF,MAAM;EACpC,OAAOF,oBAAoB,CAA6B;IACpDK,IAAI,EAAED,UAAU;IAChBD,KAAK,EAAEA,KAAK,CAACA;EACjB,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"definitions/entry.js","sources":["../../src/definitions/entry.ts"],"sourcesContent":["import { createStandardEntity, type ITable } from \"@webiny/db-dynamodb\";\nimport type { IEntryEntity, IEntryEntityAttributesData } from \"./types.js\";\n\ninterface Params {\n table: ITable;\n entityName: string;\n}\n\nexport const createEntryEntity = (params: Params): IEntryEntity => {\n const { table, entityName } = params;\n return createStandardEntity<IEntryEntityAttributesData>({\n name: entityName,\n table: table.table\n });\n};\n"],"names":["createEntryEntity","params","table","entityName","createStandardEntity"],"mappings":";AAQO,MAAMA,oBAAoB,CAACC;IAC9B,MAAM,EAAEC,KAAK,EAAEC,UAAU,EAAE,GAAGF;IAC9B,OAAOG,qBAAiD;QACpD,MAAMD;QACN,OAAOD,MAAM,KAAK;IACtB;AACJ"}
@@ -1,13 +1,11 @@
1
1
  import { createStandardEntity } from "@webiny/db-dynamodb";
2
- export const createGroupEntity = params => {
3
- const {
4
- table,
5
- entityName
6
- } = params;
7
- return createStandardEntity({
8
- table: table.table,
9
- name: entityName
10
- });
2
+ const createGroupEntity = (params)=>{
3
+ const { table, entityName } = params;
4
+ return createStandardEntity({
5
+ table: table.table,
6
+ name: entityName
7
+ });
11
8
  };
9
+ export { createGroupEntity };
12
10
 
13
11
  //# sourceMappingURL=group.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createStandardEntity","createGroupEntity","params","table","entityName","name"],"sources":["group.ts"],"sourcesContent":["import { createStandardEntity, type ITable } from \"@webiny/db-dynamodb\";\nimport type { IGroupEntity } from \"./types.js\";\nimport type { CmsGroup } from \"@webiny/api-headless-cms/types/index.js\";\n\ninterface Params {\n table: ITable;\n entityName: string;\n}\n\nexport const createGroupEntity = (params: Params): IGroupEntity => {\n const { table, entityName } = params;\n return createStandardEntity<CmsGroup>({\n table: table.table,\n name: entityName\n });\n};\n"],"mappings":"AAAA,SAASA,oBAAoB,QAAqB,qBAAqB;AASvE,OAAO,MAAMC,iBAAiB,GAAIC,MAAc,IAAmB;EAC/D,MAAM;IAAEC,KAAK;IAAEC;EAAW,CAAC,GAAGF,MAAM;EACpC,OAAOF,oBAAoB,CAAW;IAClCG,KAAK,EAAEA,KAAK,CAACA,KAAK;IAClBE,IAAI,EAAED;EACV,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"definitions/group.js","sources":["../../src/definitions/group.ts"],"sourcesContent":["import { createStandardEntity, type ITable } from \"@webiny/db-dynamodb\";\nimport type { IGroupEntity } from \"./types.js\";\nimport type { CmsGroup } from \"@webiny/api-headless-cms/types/index.js\";\n\ninterface Params {\n table: ITable;\n entityName: string;\n}\n\nexport const createGroupEntity = (params: Params): IGroupEntity => {\n const { table, entityName } = params;\n return createStandardEntity<CmsGroup>({\n table: table.table,\n name: entityName\n });\n};\n"],"names":["createGroupEntity","params","table","entityName","createStandardEntity"],"mappings":";AASO,MAAMA,oBAAoB,CAACC;IAC9B,MAAM,EAAEC,KAAK,EAAEC,UAAU,EAAE,GAAGF;IAC9B,OAAOG,qBAA+B;QAClC,OAAOF,MAAM,KAAK;QAClB,MAAMC;IACV;AACJ"}
@@ -1,13 +1,11 @@
1
1
  import { createStandardEntity } from "@webiny/db-dynamodb";
2
- export const createModelEntity = params => {
3
- const {
4
- table,
5
- entityName
6
- } = params;
7
- return createStandardEntity({
8
- table: table.table,
9
- name: entityName
10
- });
2
+ const createModelEntity = (params)=>{
3
+ const { table, entityName } = params;
4
+ return createStandardEntity({
5
+ table: table.table,
6
+ name: entityName
7
+ });
11
8
  };
9
+ export { createModelEntity };
12
10
 
13
11
  //# sourceMappingURL=model.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createStandardEntity","createModelEntity","params","table","entityName","name"],"sources":["model.ts"],"sourcesContent":["import { createStandardEntity, type ITable } from \"@webiny/db-dynamodb\";\nimport type { IModelEntity } from \"./types.js\";\nimport type { StorageCmsModel } from \"@webiny/api-headless-cms/types/index.js\";\n\ninterface Params {\n table: ITable;\n entityName: string;\n}\n\nexport const createModelEntity = (params: Params): IModelEntity => {\n const { table, entityName } = params;\n return createStandardEntity<StorageCmsModel>({\n table: table.table,\n name: entityName\n });\n};\n"],"mappings":"AAAA,SAASA,oBAAoB,QAAqB,qBAAqB;AASvE,OAAO,MAAMC,iBAAiB,GAAIC,MAAc,IAAmB;EAC/D,MAAM;IAAEC,KAAK;IAAEC;EAAW,CAAC,GAAGF,MAAM;EACpC,OAAOF,oBAAoB,CAAkB;IACzCG,KAAK,EAAEA,KAAK,CAACA,KAAK;IAClBE,IAAI,EAAED;EACV,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"definitions/model.js","sources":["../../src/definitions/model.ts"],"sourcesContent":["import { createStandardEntity, type ITable } from \"@webiny/db-dynamodb\";\nimport type { IModelEntity } from \"./types.js\";\nimport type { StorageCmsModel } from \"@webiny/api-headless-cms/types/index.js\";\n\ninterface Params {\n table: ITable;\n entityName: string;\n}\n\nexport const createModelEntity = (params: Params): IModelEntity => {\n const { table, entityName } = params;\n return createStandardEntity<StorageCmsModel>({\n table: table.table,\n name: entityName\n });\n};\n"],"names":["createModelEntity","params","table","entityName","createStandardEntity"],"mappings":";AASO,MAAMA,oBAAoB,CAACC;IAC9B,MAAM,EAAEC,KAAK,EAAEC,UAAU,EAAE,GAAGF;IAC9B,OAAOG,qBAAsC;QACzC,OAAOF,MAAM,KAAK;QAClB,MAAMC;IACV;AACJ"}
@@ -1,9 +1,8 @@
1
- import { createTable as baseCreateTable } from "@webiny/db-dynamodb";
2
- export const createTable = params => {
3
- return baseCreateTable({
4
- name: params.name || process.env.DB_TABLE_HEADLESS_CMS || process.env.DB_TABLE,
5
- documentClient: params.documentClient
6
- });
7
- };
1
+ import { createTable } from "@webiny/db-dynamodb";
2
+ const table_createTable = (params)=>createTable({
3
+ name: params.name || process.env.DB_TABLE_HEADLESS_CMS || process.env.DB_TABLE,
4
+ documentClient: params.documentClient
5
+ });
6
+ export { table_createTable as createTable };
8
7
 
9
8
  //# sourceMappingURL=table.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createTable","baseCreateTable","params","name","process","env","DB_TABLE_HEADLESS_CMS","DB_TABLE","documentClient"],"sources":["table.ts"],"sourcesContent":["import { createTable as baseCreateTable } from \"@webiny/db-dynamodb\";\nimport type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\n\ninterface Params {\n name?: string;\n documentClient: DynamoDBDocument;\n}\n\nexport const createTable = (params: Params) => {\n return baseCreateTable({\n name: params.name || process.env.DB_TABLE_HEADLESS_CMS || (process.env.DB_TABLE as string),\n documentClient: params.documentClient\n });\n};\n"],"mappings":"AAAA,SAASA,WAAW,IAAIC,eAAe,QAAQ,qBAAqB;AAQpE,OAAO,MAAMD,WAAW,GAAIE,MAAc,IAAK;EAC3C,OAAOD,eAAe,CAAC;IACnBE,IAAI,EAAED,MAAM,CAACC,IAAI,IAAIC,OAAO,CAACC,GAAG,CAACC,qBAAqB,IAAKF,OAAO,CAACC,GAAG,CAACE,QAAmB;IAC1FC,cAAc,EAAEN,MAAM,CAACM;EAC3B,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"definitions/table.js","sources":["../../src/definitions/table.ts"],"sourcesContent":["import { createTable as baseCreateTable } from \"@webiny/db-dynamodb\";\nimport type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\n\ninterface Params {\n name?: string;\n documentClient: DynamoDBDocument;\n}\n\nexport const createTable = (params: Params) => {\n return baseCreateTable({\n name: params.name || process.env.DB_TABLE_HEADLESS_CMS || (process.env.DB_TABLE as string),\n documentClient: params.documentClient\n });\n};\n"],"names":["createTable","params","baseCreateTable","process"],"mappings":";AAQO,MAAMA,oBAAc,CAACC,SACjBC,YAAgB;QACnB,MAAMD,OAAO,IAAI,IAAIE,QAAQ,GAAG,CAAC,qBAAqB,IAAKA,QAAQ,GAAG,CAAC,QAAQ;QAC/E,gBAAgBF,OAAO,cAAc;IACzC"}
@@ -53,6 +53,7 @@ export interface IEntryEntityAttributesData {
53
53
  meta?: GenericRecord;
54
54
  system?: ICmsEntrySystem;
55
55
  live: ICmsEntryLive | null;
56
+ revisionDescription: string | undefined;
56
57
  }
57
58
  export type IEntryEntityAttributes = IStandardEntityAttributes<IEntryEntityAttributesData>;
58
59
  export type IModelEntity = IEntity<IStandardEntityAttributes<StorageCmsModel>>;
@@ -1,3 +0,0 @@
1
- export {};
2
-
3
- //# sourceMappingURL=types.js.map
package/dynamoDb/index.js CHANGED
@@ -1,6 +1,11 @@
1
1
  import { createPlainObjectPathPlugin } from "./path/plainObject.js";
2
2
  import { createDatetimeTransformValuePlugin } from "./transformValue/datetime.js";
3
3
  import { createLocationFolderIdPathPlugin } from "./path/locationFolderId.js";
4
- export default () => [createPlainObjectPathPlugin(), createLocationFolderIdPathPlugin(), createDatetimeTransformValuePlugin()];
4
+ const dynamoDb = ()=>[
5
+ createPlainObjectPathPlugin(),
6
+ createLocationFolderIdPathPlugin(),
7
+ createDatetimeTransformValuePlugin()
8
+ ];
9
+ export default dynamoDb;
5
10
 
6
11
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createPlainObjectPathPlugin","createDatetimeTransformValuePlugin","createLocationFolderIdPathPlugin"],"sources":["index.ts"],"sourcesContent":["import { createPlainObjectPathPlugin } from \"./path/plainObject.js\";\nimport { createDatetimeTransformValuePlugin } from \"./transformValue/datetime.js\";\nimport { createLocationFolderIdPathPlugin } from \"~/dynamoDb/path/locationFolderId.js\";\n\nexport default () => [\n createPlainObjectPathPlugin(),\n createLocationFolderIdPathPlugin(),\n createDatetimeTransformValuePlugin()\n];\n"],"mappings":"AAAA,SAASA,2BAA2B;AACpC,SAASC,kCAAkC;AAC3C,SAASC,gCAAgC;AAEzC,eAAe,MAAM,CACjBF,2BAA2B,CAAC,CAAC,EAC7BE,gCAAgC,CAAC,CAAC,EAClCD,kCAAkC,CAAC,CAAC,CACvC","ignoreList":[]}
1
+ {"version":3,"file":"dynamoDb/index.js","sources":["../../src/dynamoDb/index.ts"],"sourcesContent":["import { createPlainObjectPathPlugin } from \"./path/plainObject.js\";\nimport { createDatetimeTransformValuePlugin } from \"./transformValue/datetime.js\";\nimport { createLocationFolderIdPathPlugin } from \"~/dynamoDb/path/locationFolderId.js\";\n\nexport default () => [\n createPlainObjectPathPlugin(),\n createLocationFolderIdPathPlugin(),\n createDatetimeTransformValuePlugin()\n];\n"],"names":["createPlainObjectPathPlugin","createLocationFolderIdPathPlugin","createDatetimeTransformValuePlugin"],"mappings":";;;AAIA,iBAAgB,IAAK;QACjBA;QACAC;QACAC;KACJ"}
@@ -1,34 +1,21 @@
1
- /**
2
- * File is @internal
3
- */
4
- import WebinyError from "@webiny/error";
1
+ import error from "@webiny/error";
5
2
  import { CmsEntryFieldFilterPathPlugin } from "../../plugins/CmsEntryFieldFilterPathPlugin.js";
6
- const createPath = ({
7
- field
8
- }) => {
9
- const {
10
- path
11
- } = field.settings || {};
12
- if (!path) {
13
- throw new WebinyError("Missing path settings value.", "FIELD_SETTINGS_ERROR", {
14
- field
3
+ const createPath = ({ field })=>{
4
+ const { path } = field.settings || {};
5
+ if (!path) throw new error("Missing path settings value.", "FIELD_SETTINGS_ERROR", {
6
+ field
15
7
  });
16
- }
17
- return path;
18
- };
19
- export const createLocationFolderIdPathPlugin = () => {
20
- return new CmsEntryFieldFilterPathPlugin({
21
- fieldType: "text",
22
- path: createPath,
23
- canUse: (field, parents) => {
24
- if (field.fieldId !== "folderId") {
25
- return false;
26
- } else if (!parents?.length) {
27
- return false;
28
- }
29
- return parents[0] === "wbyAco_location";
30
- }
31
- });
8
+ return path;
32
9
  };
10
+ const createLocationFolderIdPathPlugin = ()=>new CmsEntryFieldFilterPathPlugin({
11
+ fieldType: "text",
12
+ path: createPath,
13
+ canUse: (field, parents)=>{
14
+ if ("folderId" !== field.fieldId) return false;
15
+ if (!parents?.length) return false;
16
+ return "wbyAco_location" === parents[0];
17
+ }
18
+ });
19
+ export { createLocationFolderIdPathPlugin };
33
20
 
34
21
  //# sourceMappingURL=locationFolderId.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["WebinyError","CmsEntryFieldFilterPathPlugin","createPath","field","path","settings","createLocationFolderIdPathPlugin","fieldType","canUse","parents","fieldId","length"],"sources":["locationFolderId.ts"],"sourcesContent":["/**\n * File is @internal\n */\nimport WebinyError from \"@webiny/error\";\nimport type { CreatePathCallable } from \"~/plugins/CmsEntryFieldFilterPathPlugin.js\";\nimport { CmsEntryFieldFilterPathPlugin } from \"~/plugins/CmsEntryFieldFilterPathPlugin.js\";\n\nconst createPath: CreatePathCallable = ({ field }) => {\n const { path } = field.settings || {};\n if (!path) {\n throw new WebinyError(\"Missing path settings value.\", \"FIELD_SETTINGS_ERROR\", {\n field\n });\n }\n return path;\n};\n\nexport const createLocationFolderIdPathPlugin = (): CmsEntryFieldFilterPathPlugin => {\n return new CmsEntryFieldFilterPathPlugin({\n fieldType: \"text\",\n path: createPath,\n canUse: (field, parents) => {\n if (field.fieldId !== \"folderId\") {\n return false;\n } else if (!parents?.length) {\n return false;\n }\n return parents[0] === \"wbyAco_location\";\n }\n });\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,WAAW,MAAM,eAAe;AAEvC,SAASC,6BAA6B;AAEtC,MAAMC,UAA8B,GAAGA,CAAC;EAAEC;AAAM,CAAC,KAAK;EAClD,MAAM;IAAEC;EAAK,CAAC,GAAGD,KAAK,CAACE,QAAQ,IAAI,CAAC,CAAC;EACrC,IAAI,CAACD,IAAI,EAAE;IACP,MAAM,IAAIJ,WAAW,CAAC,8BAA8B,EAAE,sBAAsB,EAAE;MAC1EG;IACJ,CAAC,CAAC;EACN;EACA,OAAOC,IAAI;AACf,CAAC;AAED,OAAO,MAAME,gCAAgC,GAAGA,CAAA,KAAqC;EACjF,OAAO,IAAIL,6BAA6B,CAAC;IACrCM,SAAS,EAAE,MAAM;IACjBH,IAAI,EAAEF,UAAU;IAChBM,MAAM,EAAEA,CAACL,KAAK,EAAEM,OAAO,KAAK;MACxB,IAAIN,KAAK,CAACO,OAAO,KAAK,UAAU,EAAE;QAC9B,OAAO,KAAK;MAChB,CAAC,MAAM,IAAI,CAACD,OAAO,EAAEE,MAAM,EAAE;QACzB,OAAO,KAAK;MAChB;MACA,OAAOF,OAAO,CAAC,CAAC,CAAC,KAAK,iBAAiB;IAC3C;EACJ,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"dynamoDb/path/locationFolderId.js","sources":["../../../src/dynamoDb/path/locationFolderId.ts"],"sourcesContent":["/**\n * File is @internal\n */\nimport WebinyError from \"@webiny/error\";\nimport type { CreatePathCallable } from \"~/plugins/CmsEntryFieldFilterPathPlugin.js\";\nimport { CmsEntryFieldFilterPathPlugin } from \"~/plugins/CmsEntryFieldFilterPathPlugin.js\";\n\nconst createPath: CreatePathCallable = ({ field }) => {\n const { path } = field.settings || {};\n if (!path) {\n throw new WebinyError(\"Missing path settings value.\", \"FIELD_SETTINGS_ERROR\", {\n field\n });\n }\n return path;\n};\n\nexport const createLocationFolderIdPathPlugin = (): CmsEntryFieldFilterPathPlugin => {\n return new CmsEntryFieldFilterPathPlugin({\n fieldType: \"text\",\n path: createPath,\n canUse: (field, parents) => {\n if (field.fieldId !== \"folderId\") {\n return false;\n } else if (!parents?.length) {\n return false;\n }\n return parents[0] === \"wbyAco_location\";\n }\n });\n};\n"],"names":["createPath","field","path","WebinyError","createLocationFolderIdPathPlugin","CmsEntryFieldFilterPathPlugin","parents"],"mappings":";;AAOA,MAAMA,aAAiC,CAAC,EAAEC,KAAK,EAAE;IAC7C,MAAM,EAAEC,IAAI,EAAE,GAAGD,MAAM,QAAQ,IAAI,CAAC;IACpC,IAAI,CAACC,MACD,MAAM,IAAIC,MAAY,gCAAgC,wBAAwB;QAC1EF;IACJ;IAEJ,OAAOC;AACX;AAEO,MAAME,mCAAmC,IACrC,IAAIC,8BAA8B;QACrC,WAAW;QACX,MAAML;QACN,QAAQ,CAACC,OAAOK;YACZ,IAAIL,AAAkB,eAAlBA,MAAM,OAAO,EACb,OAAO;YACJ,IAAI,CAACK,SAAS,QACjB,OAAO;YAEX,OAAOA,AAAe,sBAAfA,OAAO,CAAC,EAAE;QACrB;IACJ"}
@@ -1,26 +1,16 @@
1
- /**
2
- * File is @internal
3
- */
4
- import WebinyError from "@webiny/error";
1
+ import error from "@webiny/error";
5
2
  import { CmsEntryFieldFilterPathPlugin } from "../../plugins/CmsEntryFieldFilterPathPlugin.js";
6
- const createPath = ({
7
- field
8
- }) => {
9
- const {
10
- path
11
- } = field.settings || {};
12
- if (!path) {
13
- throw new WebinyError("Missing path settings value.", "FIELD_SETTINGS_ERROR", {
14
- field
3
+ const createPath = ({ field })=>{
4
+ const { path } = field.settings || {};
5
+ if (!path) throw new error("Missing path settings value.", "FIELD_SETTINGS_ERROR", {
6
+ field
15
7
  });
16
- }
17
- return path;
18
- };
19
- export const createPlainObjectPathPlugin = () => {
20
- return new CmsEntryFieldFilterPathPlugin({
21
- fieldType: "plainObject",
22
- path: createPath
23
- });
8
+ return path;
24
9
  };
10
+ const createPlainObjectPathPlugin = ()=>new CmsEntryFieldFilterPathPlugin({
11
+ fieldType: "plainObject",
12
+ path: createPath
13
+ });
14
+ export { createPlainObjectPathPlugin };
25
15
 
26
16
  //# sourceMappingURL=plainObject.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["WebinyError","CmsEntryFieldFilterPathPlugin","createPath","field","path","settings","createPlainObjectPathPlugin","fieldType"],"sources":["plainObject.ts"],"sourcesContent":["/**\n * File is @internal\n */\nimport WebinyError from \"@webiny/error\";\nimport type { CreatePathCallable } from \"~/plugins/CmsEntryFieldFilterPathPlugin.js\";\nimport { CmsEntryFieldFilterPathPlugin } from \"~/plugins/CmsEntryFieldFilterPathPlugin.js\";\n\nconst createPath: CreatePathCallable = ({ field }) => {\n const { path } = field.settings || {};\n if (!path) {\n throw new WebinyError(\"Missing path settings value.\", \"FIELD_SETTINGS_ERROR\", {\n field\n });\n }\n return path;\n};\n\nexport const createPlainObjectPathPlugin = (): CmsEntryFieldFilterPathPlugin => {\n return new CmsEntryFieldFilterPathPlugin({\n fieldType: \"plainObject\",\n path: createPath\n });\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,WAAW,MAAM,eAAe;AAEvC,SAASC,6BAA6B;AAEtC,MAAMC,UAA8B,GAAGA,CAAC;EAAEC;AAAM,CAAC,KAAK;EAClD,MAAM;IAAEC;EAAK,CAAC,GAAGD,KAAK,CAACE,QAAQ,IAAI,CAAC,CAAC;EACrC,IAAI,CAACD,IAAI,EAAE;IACP,MAAM,IAAIJ,WAAW,CAAC,8BAA8B,EAAE,sBAAsB,EAAE;MAC1EG;IACJ,CAAC,CAAC;EACN;EACA,OAAOC,IAAI;AACf,CAAC;AAED,OAAO,MAAME,2BAA2B,GAAGA,CAAA,KAAqC;EAC5E,OAAO,IAAIL,6BAA6B,CAAC;IACrCM,SAAS,EAAE,aAAa;IACxBH,IAAI,EAAEF;EACV,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"dynamoDb/path/plainObject.js","sources":["../../../src/dynamoDb/path/plainObject.ts"],"sourcesContent":["/**\n * File is @internal\n */\nimport WebinyError from \"@webiny/error\";\nimport type { CreatePathCallable } from \"~/plugins/CmsEntryFieldFilterPathPlugin.js\";\nimport { CmsEntryFieldFilterPathPlugin } from \"~/plugins/CmsEntryFieldFilterPathPlugin.js\";\n\nconst createPath: CreatePathCallable = ({ field }) => {\n const { path } = field.settings || {};\n if (!path) {\n throw new WebinyError(\"Missing path settings value.\", \"FIELD_SETTINGS_ERROR\", {\n field\n });\n }\n return path;\n};\n\nexport const createPlainObjectPathPlugin = (): CmsEntryFieldFilterPathPlugin => {\n return new CmsEntryFieldFilterPathPlugin({\n fieldType: \"plainObject\",\n path: createPath\n });\n};\n"],"names":["createPath","field","path","WebinyError","createPlainObjectPathPlugin","CmsEntryFieldFilterPathPlugin"],"mappings":";;AAOA,MAAMA,aAAiC,CAAC,EAAEC,KAAK,EAAE;IAC7C,MAAM,EAAEC,IAAI,EAAE,GAAGD,MAAM,QAAQ,IAAI,CAAC;IACpC,IAAI,CAACC,MACD,MAAM,IAAIC,MAAY,gCAAgC,wBAAwB;QAC1EF;IACJ;IAEJ,OAAOC;AACX;AAEO,MAAME,8BAA8B,IAChC,IAAIC,8BAA8B;QACrC,WAAW;QACX,MAAML;IACV"}
@@ -1,40 +1,29 @@
1
- /**
2
- * File is @internal
3
- */
4
-
5
1
  import { TimeTransformPlugin } from "@webiny/db-dynamodb/plugins/definitions/TimeTransformPlugin.js";
6
2
  import { DateTimeTransformPlugin } from "@webiny/db-dynamodb/plugins/definitions/DateTimeTransformPlugin.js";
7
3
  const timeTransformer = new TimeTransformPlugin({
8
- fields: ["*"]
4
+ fields: [
5
+ "*"
6
+ ]
9
7
  });
10
8
  const dateTimeTransformer = new DateTimeTransformPlugin({
11
- fields: ["*"]
9
+ fields: [
10
+ "*"
11
+ ]
12
12
  });
13
- export const createDatetimeTransformValuePlugin = () => {
14
- return {
15
- type: "cms-field-filter-value-transform",
16
- name: "cms-field-value-filter-transform-datetime",
17
- fieldType: "datetime",
18
- /**
19
- * Always transform into the milliseconds.
20
- */
21
- transform: ({
22
- field,
23
- value
24
- }) => {
25
- const {
26
- type
27
- } = field.settings || {};
28
- if (type === "time") {
29
- return timeTransformer.transform({
30
- value
31
- });
32
- }
33
- return dateTimeTransformer.transform({
34
- value
35
- });
36
- }
37
- };
38
- };
13
+ const createDatetimeTransformValuePlugin = ()=>({
14
+ type: "cms-field-filter-value-transform",
15
+ name: "cms-field-value-filter-transform-datetime",
16
+ fieldType: "datetime",
17
+ transform: ({ field, value })=>{
18
+ const { type } = field.settings || {};
19
+ if ("time" === type) return timeTransformer.transform({
20
+ value
21
+ });
22
+ return dateTimeTransformer.transform({
23
+ value
24
+ });
25
+ }
26
+ });
27
+ export { createDatetimeTransformValuePlugin };
39
28
 
40
29
  //# sourceMappingURL=datetime.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["TimeTransformPlugin","DateTimeTransformPlugin","timeTransformer","fields","dateTimeTransformer","createDatetimeTransformValuePlugin","type","name","fieldType","transform","field","value","settings"],"sources":["datetime.ts"],"sourcesContent":["/**\n * File is @internal\n */\nimport type { CmsFieldFilterValueTransformPlugin } from \"~/types.js\";\nimport { TimeTransformPlugin } from \"@webiny/db-dynamodb/plugins/definitions/TimeTransformPlugin.js\";\nimport { DateTimeTransformPlugin } from \"@webiny/db-dynamodb/plugins/definitions/DateTimeTransformPlugin.js\";\n\nconst timeTransformer = new TimeTransformPlugin({\n fields: [\"*\"]\n});\nconst dateTimeTransformer = new DateTimeTransformPlugin({\n fields: [\"*\"]\n});\n\nexport const createDatetimeTransformValuePlugin = (): CmsFieldFilterValueTransformPlugin => {\n return {\n type: \"cms-field-filter-value-transform\",\n name: \"cms-field-value-filter-transform-datetime\",\n fieldType: \"datetime\",\n /**\n * Always transform into the milliseconds.\n */\n transform: ({ field, value }) => {\n const { type } = field.settings || {};\n if (type === \"time\") {\n return timeTransformer.transform({\n value\n });\n }\n return dateTimeTransformer.transform({\n value\n });\n }\n };\n};\n"],"mappings":"AAAA;AACA;AACA;;AAEA,SAASA,mBAAmB,QAAQ,gEAAgE;AACpG,SAASC,uBAAuB,QAAQ,oEAAoE;AAE5G,MAAMC,eAAe,GAAG,IAAIF,mBAAmB,CAAC;EAC5CG,MAAM,EAAE,CAAC,GAAG;AAChB,CAAC,CAAC;AACF,MAAMC,mBAAmB,GAAG,IAAIH,uBAAuB,CAAC;EACpDE,MAAM,EAAE,CAAC,GAAG;AAChB,CAAC,CAAC;AAEF,OAAO,MAAME,kCAAkC,GAAGA,CAAA,KAA0C;EACxF,OAAO;IACHC,IAAI,EAAE,kCAAkC;IACxCC,IAAI,EAAE,2CAA2C;IACjDC,SAAS,EAAE,UAAU;IACrB;AACR;AACA;IACQC,SAAS,EAAEA,CAAC;MAAEC,KAAK;MAAEC;IAAM,CAAC,KAAK;MAC7B,MAAM;QAAEL;MAAK,CAAC,GAAGI,KAAK,CAACE,QAAQ,IAAI,CAAC,CAAC;MACrC,IAAIN,IAAI,KAAK,MAAM,EAAE;QACjB,OAAOJ,eAAe,CAACO,SAAS,CAAC;UAC7BE;QACJ,CAAC,CAAC;MACN;MACA,OAAOP,mBAAmB,CAACK,SAAS,CAAC;QACjCE;MACJ,CAAC,CAAC;IACN;EACJ,CAAC;AACL,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"dynamoDb/transformValue/datetime.js","sources":["../../../src/dynamoDb/transformValue/datetime.ts"],"sourcesContent":["/**\n * File is @internal\n */\nimport type { CmsFieldFilterValueTransformPlugin } from \"~/types.js\";\nimport { TimeTransformPlugin } from \"@webiny/db-dynamodb/plugins/definitions/TimeTransformPlugin.js\";\nimport { DateTimeTransformPlugin } from \"@webiny/db-dynamodb/plugins/definitions/DateTimeTransformPlugin.js\";\n\nconst timeTransformer = new TimeTransformPlugin({\n fields: [\"*\"]\n});\nconst dateTimeTransformer = new DateTimeTransformPlugin({\n fields: [\"*\"]\n});\n\nexport const createDatetimeTransformValuePlugin = (): CmsFieldFilterValueTransformPlugin => {\n return {\n type: \"cms-field-filter-value-transform\",\n name: \"cms-field-value-filter-transform-datetime\",\n fieldType: \"datetime\",\n /**\n * Always transform into the milliseconds.\n */\n transform: ({ field, value }) => {\n const { type } = field.settings || {};\n if (type === \"time\") {\n return timeTransformer.transform({\n value\n });\n }\n return dateTimeTransformer.transform({\n value\n });\n }\n };\n};\n"],"names":["timeTransformer","TimeTransformPlugin","dateTimeTransformer","DateTimeTransformPlugin","createDatetimeTransformValuePlugin","field","value","type"],"mappings":";;AAOA,MAAMA,kBAAkB,IAAIC,oBAAoB;IAC5C,QAAQ;QAAC;KAAI;AACjB;AACA,MAAMC,sBAAsB,IAAIC,wBAAwB;IACpD,QAAQ;QAAC;KAAI;AACjB;AAEO,MAAMC,qCAAqC,IACvC;QACH,MAAM;QACN,MAAM;QACN,WAAW;QAIX,WAAW,CAAC,EAAEC,KAAK,EAAEC,KAAK,EAAE;YACxB,MAAM,EAAEC,IAAI,EAAE,GAAGF,MAAM,QAAQ,IAAI,CAAC;YACpC,IAAIE,AAAS,WAATA,MACA,OAAOP,gBAAgB,SAAS,CAAC;gBAC7BM;YACJ;YAEJ,OAAOJ,oBAAoB,SAAS,CAAC;gBACjCI;YACJ;QACJ;IACJ"}
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { registerExtension as registerDynamoDbExtension } from "@webiny/db-dynamodb";
2
- import dynamoDbPlugins from "./dynamoDb/index.js";
1
+ import { registerExtension } from "@webiny/db-dynamodb";
2
+ import dynamoDb from "./dynamoDb/index.js";
3
3
  import { ENTITIES } from "./types.js";
4
4
  import { createGroupEntity } from "./definitions/group.js";
5
5
  import { createModelEntity } from "./definitions/model.js";
@@ -11,87 +11,77 @@ import { createFilterCreatePlugins } from "./operations/entry/filtering/plugins/
11
11
  import { createTable } from "./definitions/table.js";
12
12
  import { createRegisterExtensionPlugin } from "@webiny/handler";
13
13
  import { createFeature } from "@webiny/feature/api/index.js";
14
- import { StorageOperationsFactory as StorageOperationsFactoryAbstraction } from "@webiny/api-headless-cms/exports/api/cms/storage.js";
14
+ import { StorageOperationsFactory } from "@webiny/api-headless-cms/exports/api/cms/storage.js";
15
15
  export * from "./plugins/index.js";
16
- const createDynamoDbStorageOperations = params => {
17
- const {
18
- table,
19
- documentClient,
20
- plugins,
21
- container
22
- } = params;
23
- const tableInstance = createTable({
24
- name: table,
25
- documentClient
26
- });
27
- const entities = {
28
- groups: createGroupEntity({
29
- entityName: ENTITIES.GROUPS,
30
- table: tableInstance
31
- }),
32
- models: createModelEntity({
33
- entityName: ENTITIES.MODELS,
34
- table: tableInstance
35
- }),
36
- entries: createEntryEntity({
37
- entityName: ENTITIES.ENTRIES,
38
- table: tableInstance
39
- })
40
- };
41
- plugins.register([
42
- /**
43
- * Field plugins for DynamoDB.
44
- */
45
- dynamoDbPlugins(),
46
- /**
47
- * Filter create plugins.
48
- */
49
- createFilterCreatePlugins()]);
50
- const entries = createEntriesStorageOperations({
51
- entity: entities.entries,
52
- container,
53
- plugins
54
- });
55
- return {
56
- name: "dynamodb",
57
- beforeInit: async () => {
58
- entries.dataLoaders.clearAll();
59
- },
60
- getEntities: () => entities,
61
- getTable: () => tableInstance,
62
- groups: createGroupsStorageOperations({
63
- entity: entities.groups,
64
- container
65
- }),
66
- models: createModelsStorageOperations({
67
- entity: entities.models
68
- }),
69
- entries
70
- };
16
+ const createDynamoDbStorageOperations = (params)=>{
17
+ const { table, documentClient, plugins, container } = params;
18
+ const tableInstance = createTable({
19
+ name: table,
20
+ documentClient
21
+ });
22
+ const entities = {
23
+ groups: createGroupEntity({
24
+ entityName: ENTITIES.GROUPS,
25
+ table: tableInstance
26
+ }),
27
+ models: createModelEntity({
28
+ entityName: ENTITIES.MODELS,
29
+ table: tableInstance
30
+ }),
31
+ entries: createEntryEntity({
32
+ entityName: ENTITIES.ENTRIES,
33
+ table: tableInstance
34
+ })
35
+ };
36
+ plugins.register([
37
+ dynamoDb(),
38
+ createFilterCreatePlugins()
39
+ ]);
40
+ const entries = createEntriesStorageOperations({
41
+ entity: entities.entries,
42
+ container,
43
+ plugins
44
+ });
45
+ return {
46
+ name: "dynamodb",
47
+ beforeInit: async ()=>{
48
+ entries.dataLoaders.clearAll();
49
+ },
50
+ getEntities: ()=>entities,
51
+ getTable: ()=>tableInstance,
52
+ groups: createGroupsStorageOperations({
53
+ entity: entities.groups,
54
+ container
55
+ }),
56
+ models: createModelsStorageOperations({
57
+ entity: entities.models
58
+ }),
59
+ entries
60
+ };
71
61
  };
72
62
  class DynamoDbStorageOperationsFactoryImpl {
73
- async create(context) {
74
- return createDynamoDbStorageOperations({
75
- documentClient: context.db.driver.getClient(),
76
- plugins: context.plugins,
77
- container: context.container
78
- });
79
- }
63
+ async create(context) {
64
+ return createDynamoDbStorageOperations({
65
+ documentClient: context.db.driver.getClient(),
66
+ plugins: context.plugins,
67
+ container: context.container
68
+ });
69
+ }
80
70
  }
81
- const DynamoDbStorageOperationsFactory = StorageOperationsFactoryAbstraction.createImplementation({
82
- implementation: DynamoDbStorageOperationsFactoryImpl,
83
- dependencies: []
71
+ const DynamoDbStorageOperationsFactory = StorageOperationsFactory.createImplementation({
72
+ implementation: DynamoDbStorageOperationsFactoryImpl,
73
+ dependencies: []
84
74
  });
85
75
  const storageOperationsFeature = createFeature({
86
- name: "cms.storageOperations.openSearch",
87
- register: container => {
88
- container.register(DynamoDbStorageOperationsFactory).inSingletonScope();
89
- }
76
+ name: "cms.storageOperations.openSearch",
77
+ register: (container)=>{
78
+ container.register(DynamoDbStorageOperationsFactory).inSingletonScope();
79
+ }
90
80
  });
91
- export const registerDynamoDbStorageOperations = () => {
92
- return [registerDynamoDbExtension(), createRegisterExtensionPlugin(context => {
93
- return storageOperationsFeature.register(context.container);
94
- })];
95
- };
81
+ const registerDynamoDbStorageOperations = ()=>[
82
+ registerExtension(),
83
+ createRegisterExtensionPlugin((context)=>storageOperationsFeature.register(context.container))
84
+ ];
85
+ export { registerDynamoDbStorageOperations };
96
86
 
97
87
  //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["registerExtension","registerDynamoDbExtension","dynamoDbPlugins","ENTITIES","createGroupEntity","createModelEntity","createEntryEntity","createGroupsStorageOperations","createModelsStorageOperations","createEntriesStorageOperations","createFilterCreatePlugins","createTable","createRegisterExtensionPlugin","createFeature","StorageOperationsFactory","StorageOperationsFactoryAbstraction","createDynamoDbStorageOperations","params","table","documentClient","plugins","container","tableInstance","name","entities","groups","entityName","GROUPS","models","MODELS","entries","ENTRIES","register","entity","beforeInit","dataLoaders","clearAll","getEntities","getTable","DynamoDbStorageOperationsFactoryImpl","create","context","db","driver","getClient","DynamoDbStorageOperationsFactory","createImplementation","implementation","dependencies","storageOperationsFeature","inSingletonScope","registerDynamoDbStorageOperations"],"sources":["index.ts"],"sourcesContent":["import { registerExtension as registerDynamoDbExtension } from \"@webiny/db-dynamodb\";\nimport dynamoDbPlugins from \"./dynamoDb/index.js\";\nimport type { CmsContext, StorageOperationsFactory } from \"~/types.js\";\nimport { ENTITIES } from \"~/types.js\";\nimport { createGroupEntity } from \"~/definitions/group.js\";\nimport { createModelEntity } from \"~/definitions/model.js\";\nimport { createEntryEntity } from \"~/definitions/entry.js\";\nimport { createGroupsStorageOperations } from \"~/operations/group/index.js\";\nimport { createModelsStorageOperations } from \"~/operations/model/index.js\";\nimport { createEntriesStorageOperations } from \"./operations/entry/index.js\";\nimport { createFilterCreatePlugins } from \"~/operations/entry/filtering/plugins/index.js\";\nimport { createTable } from \"~/definitions/table.js\";\nimport { createRegisterExtensionPlugin } from \"@webiny/handler\";\nimport { createFeature } from \"@webiny/feature/api/index.js\";\nimport { StorageOperationsFactory as StorageOperationsFactoryAbstraction } from \"@webiny/api-headless-cms/exports/api/cms/storage.js\";\nimport type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\n\nexport * from \"./plugins/index.js\";\n\nconst createDynamoDbStorageOperations: StorageOperationsFactory = params => {\n const { table, documentClient, plugins, container } = params;\n\n const tableInstance = createTable({\n name: table,\n documentClient\n });\n\n const entities = {\n groups: createGroupEntity({\n entityName: ENTITIES.GROUPS,\n table: tableInstance\n }),\n models: createModelEntity({\n entityName: ENTITIES.MODELS,\n table: tableInstance\n }),\n entries: createEntryEntity({\n entityName: ENTITIES.ENTRIES,\n table: tableInstance\n })\n };\n\n plugins.register([\n /**\n * Field plugins for DynamoDB.\n */\n dynamoDbPlugins(),\n /**\n * Filter create plugins.\n */\n createFilterCreatePlugins()\n ]);\n\n const entries = createEntriesStorageOperations({\n entity: entities.entries,\n container,\n plugins\n });\n\n return {\n name: \"dynamodb\",\n beforeInit: async () => {\n entries.dataLoaders.clearAll();\n },\n getEntities: () => entities,\n getTable: () => tableInstance,\n groups: createGroupsStorageOperations({\n entity: entities.groups,\n container\n }),\n models: createModelsStorageOperations({\n entity: entities.models\n }),\n entries\n };\n};\n\nclass DynamoDbStorageOperationsFactoryImpl\n implements StorageOperationsFactoryAbstraction.Interface\n{\n public async create(context: CmsContext) {\n return createDynamoDbStorageOperations({\n documentClient: context.db.driver.getClient() as DynamoDBDocument,\n plugins: context.plugins,\n container: context.container\n });\n }\n}\n\nconst DynamoDbStorageOperationsFactory = StorageOperationsFactoryAbstraction.createImplementation({\n implementation: DynamoDbStorageOperationsFactoryImpl,\n dependencies: []\n});\n\nconst storageOperationsFeature = createFeature({\n name: \"cms.storageOperations.openSearch\",\n register: container => {\n container.register(DynamoDbStorageOperationsFactory).inSingletonScope();\n }\n});\n\nexport const registerDynamoDbStorageOperations = () => {\n return [\n registerDynamoDbExtension(),\n createRegisterExtensionPlugin(context => {\n return storageOperationsFeature.register(context.container);\n })\n ];\n};\n"],"mappings":"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","ignoreList":[]}
1
+ {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import { registerExtension as registerDynamoDbExtension } from \"@webiny/db-dynamodb\";\nimport dynamoDbPlugins from \"./dynamoDb/index.js\";\nimport type { CmsContext, StorageOperationsFactory } from \"~/types.js\";\nimport { ENTITIES } from \"~/types.js\";\nimport { createGroupEntity } from \"~/definitions/group.js\";\nimport { createModelEntity } from \"~/definitions/model.js\";\nimport { createEntryEntity } from \"~/definitions/entry.js\";\nimport { createGroupsStorageOperations } from \"~/operations/group/index.js\";\nimport { createModelsStorageOperations } from \"~/operations/model/index.js\";\nimport { createEntriesStorageOperations } from \"./operations/entry/index.js\";\nimport { createFilterCreatePlugins } from \"~/operations/entry/filtering/plugins/index.js\";\nimport { createTable } from \"~/definitions/table.js\";\nimport { createRegisterExtensionPlugin } from \"@webiny/handler\";\nimport { createFeature } from \"@webiny/feature/api/index.js\";\nimport { StorageOperationsFactory as StorageOperationsFactoryAbstraction } from \"@webiny/api-headless-cms/exports/api/cms/storage.js\";\nimport type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\n\nexport * from \"./plugins/index.js\";\n\nconst createDynamoDbStorageOperations: StorageOperationsFactory = params => {\n const { table, documentClient, plugins, container } = params;\n\n const tableInstance = createTable({\n name: table,\n documentClient\n });\n\n const entities = {\n groups: createGroupEntity({\n entityName: ENTITIES.GROUPS,\n table: tableInstance\n }),\n models: createModelEntity({\n entityName: ENTITIES.MODELS,\n table: tableInstance\n }),\n entries: createEntryEntity({\n entityName: ENTITIES.ENTRIES,\n table: tableInstance\n })\n };\n\n plugins.register([\n /**\n * Field plugins for DynamoDB.\n */\n dynamoDbPlugins(),\n /**\n * Filter create plugins.\n */\n createFilterCreatePlugins()\n ]);\n\n const entries = createEntriesStorageOperations({\n entity: entities.entries,\n container,\n plugins\n });\n\n return {\n name: \"dynamodb\",\n beforeInit: async () => {\n entries.dataLoaders.clearAll();\n },\n getEntities: () => entities,\n getTable: () => tableInstance,\n groups: createGroupsStorageOperations({\n entity: entities.groups,\n container\n }),\n models: createModelsStorageOperations({\n entity: entities.models\n }),\n entries\n };\n};\n\nclass DynamoDbStorageOperationsFactoryImpl\n implements StorageOperationsFactoryAbstraction.Interface\n{\n public async create(context: CmsContext) {\n return createDynamoDbStorageOperations({\n documentClient: context.db.driver.getClient() as DynamoDBDocument,\n plugins: context.plugins,\n container: context.container\n });\n }\n}\n\nconst DynamoDbStorageOperationsFactory = StorageOperationsFactoryAbstraction.createImplementation({\n implementation: DynamoDbStorageOperationsFactoryImpl,\n dependencies: []\n});\n\nconst storageOperationsFeature = createFeature({\n name: \"cms.storageOperations.openSearch\",\n register: container => {\n container.register(DynamoDbStorageOperationsFactory).inSingletonScope();\n }\n});\n\nexport const registerDynamoDbStorageOperations = () => {\n return [\n registerDynamoDbExtension(),\n createRegisterExtensionPlugin(context => {\n return storageOperationsFeature.register(context.container);\n })\n ];\n};\n"],"names":["createDynamoDbStorageOperations","params","table","documentClient","plugins","container","tableInstance","createTable","entities","createGroupEntity","ENTITIES","createModelEntity","createEntryEntity","dynamoDbPlugins","createFilterCreatePlugins","entries","createEntriesStorageOperations","createGroupsStorageOperations","createModelsStorageOperations","DynamoDbStorageOperationsFactoryImpl","context","DynamoDbStorageOperationsFactory","StorageOperationsFactoryAbstraction","storageOperationsFeature","createFeature","registerDynamoDbStorageOperations","registerDynamoDbExtension","createRegisterExtensionPlugin"],"mappings":";;;;;;;;;;;;;;;AAmBA,MAAMA,kCAA4DC,CAAAA;IAC9D,MAAM,EAAEC,KAAK,EAAEC,cAAc,EAAEC,OAAO,EAAEC,SAAS,EAAE,GAAGJ;IAEtD,MAAMK,gBAAgBC,YAAY;QAC9B,MAAML;QACNC;IACJ;IAEA,MAAMK,WAAW;QACb,QAAQC,kBAAkB;YACtB,YAAYC,SAAS,MAAM;YAC3B,OAAOJ;QACX;QACA,QAAQK,kBAAkB;YACtB,YAAYD,SAAS,MAAM;YAC3B,OAAOJ;QACX;QACA,SAASM,kBAAkB;YACvB,YAAYF,SAAS,OAAO;YAC5B,OAAOJ;QACX;IACJ;IAEAF,QAAQ,QAAQ,CAAC;QAIbS;QAIAC;KACH;IAED,MAAMC,UAAUC,+BAA+B;QAC3C,QAAQR,SAAS,OAAO;QACxBH;QACAD;IACJ;IAEA,OAAO;QACH,MAAM;QACN,YAAY;YACRW,QAAQ,WAAW,CAAC,QAAQ;QAChC;QACA,aAAa,IAAMP;QACnB,UAAU,IAAMF;QAChB,QAAQW,8BAA8B;YAClC,QAAQT,SAAS,MAAM;YACvBH;QACJ;QACA,QAAQa,8BAA8B;YAClC,QAAQV,SAAS,MAAM;QAC3B;QACAO;IACJ;AACJ;AAEA,MAAMI;IAGF,MAAa,OAAOC,OAAmB,EAAE;QACrC,OAAOpB,gCAAgC;YACnC,gBAAgBoB,QAAQ,EAAE,CAAC,MAAM,CAAC,SAAS;YAC3C,SAASA,QAAQ,OAAO;YACxB,WAAWA,QAAQ,SAAS;QAChC;IACJ;AACJ;AAEA,MAAMC,mCAAmCC,yBAAAA,oBAAwD,CAAC;IAC9F,gBAAgBH;IAChB,cAAc,EAAE;AACpB;AAEA,MAAMI,2BAA2BC,cAAc;IAC3C,MAAM;IACN,UAAUnB,CAAAA;QACNA,UAAU,QAAQ,CAACgB,kCAAkC,gBAAgB;IACzE;AACJ;AAEO,MAAMI,oCAAoC,IACtC;QACHC;QACAC,8BAA8BP,CAAAA,UACnBG,yBAAyB,QAAQ,CAACH,QAAQ,SAAS;KAEjE"}
@@ -1,31 +1,27 @@
1
- export class DataLoaderCache {
2
- cache = {};
3
- getDataLoader(params) {
4
- const key = this.createKey(params);
5
- return this.cache[key] || null;
6
- }
7
- setDataLoader(params, dataLoader) {
8
- const key = this.createKey(params);
9
- this.cache[key] = dataLoader;
10
- }
11
- clearAll(params) {
12
- if (!params) {
13
- for (const current in this.cache) {
14
- this.cache[current].clearAll();
15
- }
16
- return;
1
+ class DataLoaderCache {
2
+ getDataLoader(params) {
3
+ const key = this.createKey(params);
4
+ return this.cache[key] || null;
17
5
  }
18
- const key = `${params.tenant}_`;
19
- for (const current in this.cache) {
20
- if (current.startsWith(key) === false) {
21
- continue;
22
- }
23
- this.cache[current].clearAll();
6
+ setDataLoader(params, dataLoader) {
7
+ const key = this.createKey(params);
8
+ this.cache[key] = dataLoader;
9
+ }
10
+ clearAll(params) {
11
+ if (!params) {
12
+ for(const current in this.cache)this.cache[current].clearAll();
13
+ return;
14
+ }
15
+ const key = `${params.tenant}_`;
16
+ for(const current in this.cache)if (false !== current.startsWith(key)) this.cache[current].clearAll();
17
+ }
18
+ createKey(params) {
19
+ return `${params.tenant}_${params.modelId}_${params.name}`;
20
+ }
21
+ constructor(){
22
+ this.cache = {};
24
23
  }
25
- }
26
- createKey(params) {
27
- return `${params.tenant}_${params.modelId}_${params.name}`;
28
- }
29
24
  }
25
+ export { DataLoaderCache };
30
26
 
31
27
  //# sourceMappingURL=DataLoaderCache.js.map