@webiny/api-headless-cms-ddb 0.0.0-unstable.6f45466a1d → 0.0.0-unstable.7be00a75a9

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 (119) 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 +11 -5
  10. package/definitions/types.js +0 -3
  11. package/dynamoDb/index.d.ts +1 -1
  12. package/dynamoDb/index.js +6 -3
  13. package/dynamoDb/index.js.map +1 -1
  14. package/dynamoDb/path/locationFolderId.js +16 -29
  15. package/dynamoDb/path/locationFolderId.js.map +1 -1
  16. package/dynamoDb/path/plainObject.js +11 -21
  17. package/dynamoDb/path/plainObject.js.map +1 -1
  18. package/dynamoDb/transformValue/datetime.js +21 -32
  19. package/dynamoDb/transformValue/datetime.js.map +1 -1
  20. package/index.d.ts +1 -2
  21. package/index.js +74 -79
  22. package/index.js.map +1 -1
  23. package/operations/entry/dataLoader/DataLoaderCache.d.ts +1 -0
  24. package/operations/entry/dataLoader/DataLoaderCache.js +22 -29
  25. package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -1
  26. package/operations/entry/dataLoader/constants.js +2 -1
  27. package/operations/entry/dataLoader/constants.js.map +1 -1
  28. package/operations/entry/dataLoader/createBatchScheduleFn.js +6 -15
  29. package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -1
  30. package/operations/entry/dataLoader/getAllEntryRevisions.js +18 -26
  31. package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -1
  32. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +32 -38
  33. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -1
  34. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +32 -38
  35. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -1
  36. package/operations/entry/dataLoader/getRevisionById.js +34 -44
  37. package/operations/entry/dataLoader/getRevisionById.js.map +1 -1
  38. package/operations/entry/dataLoader/index.js +8 -9
  39. package/operations/entry/dataLoader/index.js.map +1 -1
  40. package/operations/entry/dataLoader/types.d.ts +1 -0
  41. package/operations/entry/dataLoader/types.js +0 -3
  42. package/operations/entry/dataLoaders.js +81 -97
  43. package/operations/entry/dataLoaders.js.map +1 -1
  44. package/operations/entry/filtering/createExpressions.d.ts +6 -5
  45. package/operations/entry/filtering/createExpressions.js +110 -161
  46. package/operations/entry/filtering/createExpressions.js.map +1 -1
  47. package/operations/entry/filtering/createFields.js +83 -96
  48. package/operations/entry/filtering/createFields.js.map +1 -1
  49. package/operations/entry/filtering/extractSort.js +50 -74
  50. package/operations/entry/filtering/extractSort.js.map +1 -1
  51. package/operations/entry/filtering/filter.d.ts +5 -4
  52. package/operations/entry/filtering/filter.js +73 -138
  53. package/operations/entry/filtering/filter.js.map +1 -1
  54. package/operations/entry/filtering/fullTextSearch.d.ts +2 -2
  55. package/operations/entry/filtering/fullTextSearch.js +21 -38
  56. package/operations/entry/filtering/fullTextSearch.js.map +1 -1
  57. package/operations/entry/filtering/getValue.js +31 -53
  58. package/operations/entry/filtering/getValue.js.map +1 -1
  59. package/operations/entry/filtering/index.js +0 -2
  60. package/operations/entry/filtering/mapPlugins.js +15 -22
  61. package/operations/entry/filtering/mapPlugins.js.map +1 -1
  62. package/operations/entry/filtering/plugins/defaultFilterCreate.js +29 -33
  63. package/operations/entry/filtering/plugins/defaultFilterCreate.js.map +1 -1
  64. package/operations/entry/filtering/plugins/index.js +7 -3
  65. package/operations/entry/filtering/plugins/index.js.map +1 -1
  66. package/operations/entry/filtering/plugins/objectFilterCreate.js +60 -76
  67. package/operations/entry/filtering/plugins/objectFilterCreate.js.map +1 -1
  68. package/operations/entry/filtering/plugins/refFilterCreate.js +55 -66
  69. package/operations/entry/filtering/plugins/refFilterCreate.js.map +1 -1
  70. package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js +43 -51
  71. package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js.map +1 -1
  72. package/operations/entry/filtering/sort.js +34 -60
  73. package/operations/entry/filtering/sort.js.map +1 -1
  74. package/operations/entry/filtering/systemFields.js +144 -111
  75. package/operations/entry/filtering/systemFields.js.map +1 -1
  76. package/operations/entry/filtering/transform.js +4 -8
  77. package/operations/entry/filtering/transform.js.map +1 -1
  78. package/operations/entry/filtering/types.d.ts +2 -2
  79. package/operations/entry/filtering/types.js +0 -3
  80. package/operations/entry/filtering/values.js +11 -12
  81. package/operations/entry/filtering/values.js.map +1 -1
  82. package/operations/entry/filtering/where.js +17 -23
  83. package/operations/entry/filtering/where.js.map +1 -1
  84. package/operations/entry/index.d.ts +2 -0
  85. package/operations/entry/index.js +896 -1149
  86. package/operations/entry/index.js.map +1 -1
  87. package/operations/entry/keys.d.ts +6 -0
  88. package/operations/entry/keys.js +57 -77
  89. package/operations/entry/keys.js.map +1 -1
  90. package/operations/group/index.d.ts +2 -3
  91. package/operations/group/index.js +115 -139
  92. package/operations/group/index.js.map +1 -1
  93. package/operations/model/index.js +100 -122
  94. package/operations/model/index.js.map +1 -1
  95. package/package.json +27 -19
  96. package/plugins/CmsEntryFieldFilterPathPlugin.js +23 -33
  97. package/plugins/CmsEntryFieldFilterPathPlugin.js.map +1 -1
  98. package/plugins/CmsEntryFieldFilterPlugin.d.ts +3 -3
  99. package/plugins/CmsEntryFieldFilterPlugin.js +16 -17
  100. package/plugins/CmsEntryFieldFilterPlugin.js.map +1 -1
  101. package/plugins/CmsEntryFieldSortingPlugin.js +16 -15
  102. package/plugins/CmsEntryFieldSortingPlugin.js.map +1 -1
  103. package/plugins/CmsFieldFilterValueTransformPlugin.js +15 -12
  104. package/plugins/CmsFieldFilterValueTransformPlugin.js.map +1 -1
  105. package/plugins/index.js +0 -2
  106. package/types.d.ts +5 -3
  107. package/types.js +6 -5
  108. package/types.js.map +1 -1
  109. package/definitions/types.js.map +0 -1
  110. package/dynamoDb/storage/longText.d.ts +0 -10
  111. package/dynamoDb/storage/longText.js +0 -86
  112. package/dynamoDb/storage/longText.js.map +0 -1
  113. package/dynamoDb/storage/richText.d.ts +0 -2
  114. package/dynamoDb/storage/richText.js +0 -52
  115. package/dynamoDb/storage/richText.js.map +0 -1
  116. package/operations/entry/dataLoader/types.js.map +0 -1
  117. package/operations/entry/filtering/index.js.map +0 -1
  118. package/operations/entry/filtering/types.js.map +0 -1
  119. 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, IEntryEntityAttirbutesData } 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<IEntryEntityAttirbutesData>({\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 { CmsModel } 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<CmsModel>({\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/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"}
@@ -1,7 +1,7 @@
1
1
  import type { IEntity, IStandardEntityAttributes } from "@webiny/db-dynamodb";
2
2
  import type { GenericRecord } from "@webiny/api/types.js";
3
- import type { CmsEntryStatus, CmsGroup, CmsIdentity, CmsModel, ICmsEntryLocation, IEntryState } from "@webiny/api-headless-cms/types/index.js";
4
- export interface IEntryEntityAttirbutesData {
3
+ import type { CmsEntryStatus, CmsGroup, CmsIdentity, ICmsEntryLive, ICmsEntryLocation, ICmsEntrySystem, StorageCmsModel } from "@webiny/api-headless-cms/types/index.js";
4
+ export interface IEntryEntityAttributesData {
5
5
  id: string;
6
6
  entryId: string;
7
7
  modelId: string;
@@ -51,9 +51,15 @@ export interface IEntryEntityAttirbutesData {
51
51
  binOriginalFolderId?: string;
52
52
  values: GenericRecord;
53
53
  meta?: GenericRecord;
54
- state?: IEntryState;
54
+ system?: ICmsEntrySystem;
55
+ live: ICmsEntryLive | null;
56
+ revisionDescription: string | undefined;
57
+ /**
58
+ * A timestamp of when the entry should be automatically deleted from the database.
59
+ */
60
+ expiresAt: number | null;
55
61
  }
56
- export type IEntryEntityAttributes = IStandardEntityAttributes<IEntryEntityAttirbutesData>;
57
- export type IModelEntity = IEntity<IStandardEntityAttributes<CmsModel>>;
62
+ export type IEntryEntityAttributes = IStandardEntityAttributes<IEntryEntityAttributesData>;
63
+ export type IModelEntity = IEntity<IStandardEntityAttributes<StorageCmsModel>>;
58
64
  export type IGroupEntity = IEntity<IStandardEntityAttributes<CmsGroup>>;
59
65
  export type IEntryEntity = IEntity<IEntryEntityAttributes>;
@@ -1,3 +0,0 @@
1
- export {};
2
-
3
- //# sourceMappingURL=types.js.map
@@ -1,2 +1,2 @@
1
- declare const _default: () => (import("@webiny/api-headless-cms/index.js").StorageTransformPlugin<any, any, import("@webiny/api-headless-cms/types/modelField.js").CmsModelField> | import("../index.js").CmsEntryFieldFilterPathPlugin | import("../types.js").CmsFieldFilterValueTransformPlugin)[];
1
+ declare const _default: () => (import("../index.js").CmsEntryFieldFilterPathPlugin | import("../types.js").CmsFieldFilterValueTransformPlugin)[];
2
2
  export default _default;
package/dynamoDb/index.js CHANGED
@@ -1,8 +1,11 @@
1
- import { createRichTextStorageTransformPlugin } from "./storage/richText.js";
2
- import { createLongTextStorageTransformPlugin } from "./storage/longText.js";
3
1
  import { createPlainObjectPathPlugin } from "./path/plainObject.js";
4
2
  import { createDatetimeTransformValuePlugin } from "./transformValue/datetime.js";
5
3
  import { createLocationFolderIdPathPlugin } from "./path/locationFolderId.js";
6
- export default () => [createRichTextStorageTransformPlugin(), createLongTextStorageTransformPlugin(), createPlainObjectPathPlugin(), createLocationFolderIdPathPlugin(), createDatetimeTransformValuePlugin()];
4
+ const dynamoDb = ()=>[
5
+ createPlainObjectPathPlugin(),
6
+ createLocationFolderIdPathPlugin(),
7
+ createDatetimeTransformValuePlugin()
8
+ ];
9
+ export default dynamoDb;
7
10
 
8
11
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createRichTextStorageTransformPlugin","createLongTextStorageTransformPlugin","createPlainObjectPathPlugin","createDatetimeTransformValuePlugin","createLocationFolderIdPathPlugin"],"sources":["index.ts"],"sourcesContent":["import { createRichTextStorageTransformPlugin } from \"./storage/richText.js\";\nimport { createLongTextStorageTransformPlugin } from \"./storage/longText.js\";\nimport { createPlainObjectPathPlugin } from \"./path/plainObject.js\";\nimport { createDatetimeTransformValuePlugin } from \"./transformValue/datetime.js\";\nimport { createLocationFolderIdPathPlugin } from \"~/dynamoDb/path/locationFolderId.js\";\n\nexport default () => [\n createRichTextStorageTransformPlugin(),\n createLongTextStorageTransformPlugin(),\n createPlainObjectPathPlugin(),\n createLocationFolderIdPathPlugin(),\n createDatetimeTransformValuePlugin()\n];\n"],"mappings":"AAAA,SAASA,oCAAoC;AAC7C,SAASC,oCAAoC;AAC7C,SAASC,2BAA2B;AACpC,SAASC,kCAAkC;AAC3C,SAASC,gCAAgC;AAEzC,eAAe,MAAM,CACjBJ,oCAAoC,CAAC,CAAC,EACtCC,oCAAoC,CAAC,CAAC,EACtCC,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.d.ts CHANGED
@@ -1,3 +1,2 @@
1
- import type { StorageOperationsFactory } from "./types.js";
2
1
  export * from "./plugins/index.js";
3
- export declare const createStorageOperations: StorageOperationsFactory;
2
+ export declare const registerDynamoDbStorageOperations: () => import("@webiny/handler").RegisterExtensionPlugin<import("@webiny/handler/types.js").Context>[];
package/index.js CHANGED
@@ -1,92 +1,87 @@
1
- import dynamoDbValueFilters from "@webiny/db-dynamodb/plugins/filters/index.js";
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";
6
6
  import { createEntryEntity } from "./definitions/entry.js";
7
- import { PluginsContainer } from "@webiny/plugins";
8
7
  import { createGroupsStorageOperations } from "./operations/group/index.js";
9
8
  import { createModelsStorageOperations } from "./operations/model/index.js";
10
9
  import { createEntriesStorageOperations } from "./operations/entry/index.js";
11
10
  import { createFilterCreatePlugins } from "./operations/entry/filtering/plugins/index.js";
12
- import { CmsEntryFieldFilterPathPlugin, CmsEntryFieldFilterPlugin, CmsEntryFieldSortingPlugin, CmsFieldFilterValueTransformPlugin } from "./plugins/index.js";
13
- import { ValueFilterPlugin } from "@webiny/db-dynamodb/plugins/definitions/ValueFilterPlugin.js";
14
- import { StorageOperationsCmsModelPlugin, StorageTransformPlugin } from "@webiny/api-headless-cms";
15
- import { CompressorPlugin } from "@webiny/api";
16
11
  import { createTable } from "./definitions/table.js";
12
+ import { createRegisterExtensionPlugin } from "@webiny/handler";
13
+ import { createFeature } from "@webiny/feature/api/index.js";
14
+ import { StorageOperationsFactory } from "@webiny/api-headless-cms/exports/api/cms/storage.js";
17
15
  export * from "./plugins/index.js";
18
- export const createStorageOperations = params => {
19
- const {
20
- table,
21
- documentClient,
22
- plugins: userPlugins
23
- } = params;
24
- const tableInstance = createTable({
25
- name: table,
26
- documentClient
27
- });
28
- const entities = {
29
- groups: createGroupEntity({
30
- entityName: ENTITIES.GROUPS,
31
- table: tableInstance
32
- }),
33
- models: createModelEntity({
34
- entityName: ENTITIES.MODELS,
35
- table: tableInstance
36
- }),
37
- entries: createEntryEntity({
38
- entityName: ENTITIES.ENTRIES,
39
- table: tableInstance
40
- })
41
- };
42
- const plugins = new PluginsContainer([
43
- /**
44
- * DynamoDB filter plugins for the where conditions.
45
- */
46
- dynamoDbValueFilters(),
47
- /**
48
- * Field plugins for DynamoDB.
49
- */
50
- dynamoDbPlugins(),
51
- /**
52
- * Filter create plugins.
53
- */
54
- createFilterCreatePlugins(),
55
- /**
56
- * User defined custom plugins.
57
- */
58
- ...(userPlugins || [])]);
59
- const entries = createEntriesStorageOperations({
60
- entity: entities.entries,
61
- plugins
62
- });
63
- return {
64
- name: "dynamodb",
65
- beforeInit: async context => {
66
- const types = ["cms-model-field-to-graphql", CmsEntryFieldFilterPathPlugin.type, CmsFieldFilterValueTransformPlugin.type, CmsEntryFieldFilterPlugin.type, CmsEntryFieldSortingPlugin.type, ValueFilterPlugin.type, StorageOperationsCmsModelPlugin.type, StorageTransformPlugin.type, CompressorPlugin.type];
67
- /**
68
- * Collect all required plugins from parent context.
69
- */
70
- for (const type of types) {
71
- plugins.mergeByType(context.plugins, type);
72
- }
73
- /**
74
- * Pass the plugins to the parent context.
75
- */
76
- context.plugins.register([dynamoDbPlugins()]);
77
- entries.dataLoaders.clearAll();
78
- },
79
- getEntities: () => entities,
80
- getTable: () => tableInstance,
81
- groups: createGroupsStorageOperations({
82
- entity: entities.groups,
83
- plugins
84
- }),
85
- models: createModelsStorageOperations({
86
- entity: entities.models
87
- }),
88
- entries
89
- };
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
+ };
90
61
  };
62
+ class DynamoDbStorageOperationsFactoryImpl {
63
+ async create(context) {
64
+ return createDynamoDbStorageOperations({
65
+ documentClient: context.db.driver.getClient(),
66
+ plugins: context.plugins,
67
+ container: context.container
68
+ });
69
+ }
70
+ }
71
+ const DynamoDbStorageOperationsFactory = StorageOperationsFactory.createImplementation({
72
+ implementation: DynamoDbStorageOperationsFactoryImpl,
73
+ dependencies: []
74
+ });
75
+ const storageOperationsFeature = createFeature({
76
+ name: "cms.storageOperations.openSearch",
77
+ register: (container)=>{
78
+ container.register(DynamoDbStorageOperationsFactory).inSingletonScope();
79
+ }
80
+ });
81
+ const registerDynamoDbStorageOperations = ()=>[
82
+ registerExtension(),
83
+ createRegisterExtensionPlugin((context)=>storageOperationsFeature.register(context.container))
84
+ ];
85
+ export { registerDynamoDbStorageOperations };
91
86
 
92
87
  //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["dynamoDbValueFilters","dynamoDbPlugins","ENTITIES","createGroupEntity","createModelEntity","createEntryEntity","PluginsContainer","createGroupsStorageOperations","createModelsStorageOperations","createEntriesStorageOperations","createFilterCreatePlugins","CmsEntryFieldFilterPathPlugin","CmsEntryFieldFilterPlugin","CmsEntryFieldSortingPlugin","CmsFieldFilterValueTransformPlugin","ValueFilterPlugin","StorageOperationsCmsModelPlugin","StorageTransformPlugin","CompressorPlugin","createTable","createStorageOperations","params","table","documentClient","plugins","userPlugins","tableInstance","name","entities","groups","entityName","GROUPS","models","MODELS","entries","ENTRIES","entity","beforeInit","context","types","type","mergeByType","register","dataLoaders","clearAll","getEntities","getTable"],"sources":["index.ts"],"sourcesContent":["import dynamoDbValueFilters from \"@webiny/db-dynamodb/plugins/filters/index.js\";\nimport dynamoDbPlugins from \"./dynamoDb/index.js\";\nimport type { 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 { PluginsContainer } from \"@webiny/plugins\";\nimport { createGroupsStorageOperations } from \"~/operations/group/index.js\";\nimport { createModelsStorageOperations } from \"~/operations/model/index.js\";\nimport { createEntriesStorageOperations } from \"./operations/entry/index.js\";\n\nimport { createFilterCreatePlugins } from \"~/operations/entry/filtering/plugins/index.js\";\nimport {\n CmsEntryFieldFilterPathPlugin,\n CmsEntryFieldFilterPlugin,\n CmsEntryFieldSortingPlugin,\n CmsFieldFilterValueTransformPlugin\n} from \"~/plugins/index.js\";\nimport { ValueFilterPlugin } from \"@webiny/db-dynamodb/plugins/definitions/ValueFilterPlugin.js\";\nimport { StorageOperationsCmsModelPlugin, StorageTransformPlugin } from \"@webiny/api-headless-cms\";\nimport { CompressorPlugin } from \"@webiny/api\";\nimport { createTable } from \"~/definitions/table.js\";\n\nexport * from \"./plugins/index.js\";\n\nexport const createStorageOperations: StorageOperationsFactory = params => {\n const { table, documentClient, plugins: userPlugins } = 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 const plugins = new PluginsContainer([\n /**\n * DynamoDB filter plugins for the where conditions.\n */\n dynamoDbValueFilters(),\n /**\n * Field plugins for DynamoDB.\n */\n dynamoDbPlugins(),\n /**\n * Filter create plugins.\n */\n createFilterCreatePlugins(),\n /**\n * User defined custom plugins.\n */\n ...(userPlugins || [])\n ]);\n\n const entries = createEntriesStorageOperations({\n entity: entities.entries,\n plugins\n });\n\n return {\n name: \"dynamodb\",\n beforeInit: async context => {\n const types: string[] = [\n \"cms-model-field-to-graphql\",\n CmsEntryFieldFilterPathPlugin.type,\n CmsFieldFilterValueTransformPlugin.type,\n CmsEntryFieldFilterPlugin.type,\n CmsEntryFieldSortingPlugin.type,\n ValueFilterPlugin.type,\n StorageOperationsCmsModelPlugin.type,\n StorageTransformPlugin.type,\n CompressorPlugin.type\n ];\n /**\n * Collect all required plugins from parent context.\n */\n for (const type of types) {\n plugins.mergeByType(context.plugins, type);\n }\n /**\n * Pass the plugins to the parent context.\n */\n context.plugins.register([dynamoDbPlugins()]);\n\n entries.dataLoaders.clearAll();\n },\n getEntities: () => entities,\n getTable: () => tableInstance,\n groups: createGroupsStorageOperations({\n entity: entities.groups,\n plugins\n }),\n models: createModelsStorageOperations({\n entity: entities.models\n }),\n entries\n };\n};\n"],"mappings":"AAAA,OAAOA,oBAAoB,MAAM,8CAA8C;AAC/E,OAAOC,eAAe;AAEtB,SAASC,QAAQ;AACjB,SAASC,iBAAiB;AAC1B,SAASC,iBAAiB;AAC1B,SAASC,iBAAiB;AAC1B,SAASC,gBAAgB,QAAQ,iBAAiB;AAClD,SAASC,6BAA6B;AACtC,SAASC,6BAA6B;AACtC,SAASC,8BAA8B;AAEvC,SAASC,yBAAyB;AAClC,SACIC,6BAA6B,EAC7BC,yBAAyB,EACzBC,0BAA0B,EAC1BC,kCAAkC;AAEtC,SAASC,iBAAiB,QAAQ,8DAA8D;AAChG,SAASC,+BAA+B,EAAEC,sBAAsB,QAAQ,0BAA0B;AAClG,SAASC,gBAAgB,QAAQ,aAAa;AAC9C,SAASC,WAAW;AAEpB;AAEA,OAAO,MAAMC,uBAAiD,GAAGC,MAAM,IAAI;EACvE,MAAM;IAAEC,KAAK;IAAEC,cAAc;IAAEC,OAAO,EAAEC;EAAY,CAAC,GAAGJ,MAAM;EAE9D,MAAMK,aAAa,GAAGP,WAAW,CAAC;IAC9BQ,IAAI,EAAEL,KAAK;IACXC;EACJ,CAAC,CAAC;EAEF,MAAMK,QAAQ,GAAG;IACbC,MAAM,EAAE1B,iBAAiB,CAAC;MACtB2B,UAAU,EAAE5B,QAAQ,CAAC6B,MAAM;MAC3BT,KAAK,EAAEI;IACX,CAAC,CAAC;IACFM,MAAM,EAAE5B,iBAAiB,CAAC;MACtB0B,UAAU,EAAE5B,QAAQ,CAAC+B,MAAM;MAC3BX,KAAK,EAAEI;IACX,CAAC,CAAC;IACFQ,OAAO,EAAE7B,iBAAiB,CAAC;MACvByB,UAAU,EAAE5B,QAAQ,CAACiC,OAAO;MAC5Bb,KAAK,EAAEI;IACX,CAAC;EACL,CAAC;EAED,MAAMF,OAAO,GAAG,IAAIlB,gBAAgB,CAAC;EACjC;AACR;AACA;EACQN,oBAAoB,CAAC,CAAC;EACtB;AACR;AACA;EACQC,eAAe,CAAC,CAAC;EACjB;AACR;AACA;EACQS,yBAAyB,CAAC,CAAC;EAC3B;AACR;AACA;EACQ,IAAIe,WAAW,IAAI,EAAE,CAAC,CACzB,CAAC;EAEF,MAAMS,OAAO,GAAGzB,8BAA8B,CAAC;IAC3C2B,MAAM,EAAER,QAAQ,CAACM,OAAO;IACxBV;EACJ,CAAC,CAAC;EAEF,OAAO;IACHG,IAAI,EAAE,UAAU;IAChBU,UAAU,EAAE,MAAMC,OAAO,IAAI;MACzB,MAAMC,KAAe,GAAG,CACpB,4BAA4B,EAC5B5B,6BAA6B,CAAC6B,IAAI,EAClC1B,kCAAkC,CAAC0B,IAAI,EACvC5B,yBAAyB,CAAC4B,IAAI,EAC9B3B,0BAA0B,CAAC2B,IAAI,EAC/BzB,iBAAiB,CAACyB,IAAI,EACtBxB,+BAA+B,CAACwB,IAAI,EACpCvB,sBAAsB,CAACuB,IAAI,EAC3BtB,gBAAgB,CAACsB,IAAI,CACxB;MACD;AACZ;AACA;MACY,KAAK,MAAMA,IAAI,IAAID,KAAK,EAAE;QACtBf,OAAO,CAACiB,WAAW,CAACH,OAAO,CAACd,OAAO,EAAEgB,IAAI,CAAC;MAC9C;MACA;AACZ;AACA;MACYF,OAAO,CAACd,OAAO,CAACkB,QAAQ,CAAC,CAACzC,eAAe,CAAC,CAAC,CAAC,CAAC;MAE7CiC,OAAO,CAACS,WAAW,CAACC,QAAQ,CAAC,CAAC;IAClC,CAAC;IACDC,WAAW,EAAEA,CAAA,KAAMjB,QAAQ;IAC3BkB,QAAQ,EAAEA,CAAA,KAAMpB,aAAa;IAC7BG,MAAM,EAAEtB,6BAA6B,CAAC;MAClC6B,MAAM,EAAER,QAAQ,CAACC,MAAM;MACvBL;IACJ,CAAC,CAAC;IACFQ,MAAM,EAAExB,6BAA6B,CAAC;MAClC4B,MAAM,EAAER,QAAQ,CAACI;IACrB,CAAC,CAAC;IACFE;EACJ,CAAC;AACL,CAAC","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"}
@@ -2,6 +2,7 @@ import type DataLoader from "dataloader";
2
2
  export interface CacheKeyParams {
3
3
  name: string;
4
4
  tenant: string;
5
+ modelId: string;
5
6
  }
6
7
  export interface ClearAllParams {
7
8
  tenant: string;