@webiny/api-headless-cms-ddb 0.0.0-unstable.78f581c1d2 → 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 (172) hide show
  1. package/README.md +6 -20
  2. package/definitions/entry.d.ts +4 -5
  3. package/definitions/entry.js +9 -94
  4. package/definitions/entry.js.map +1 -1
  5. package/definitions/group.d.ts +4 -5
  6. package/definitions/group.js +9 -68
  7. package/definitions/group.js.map +1 -1
  8. package/definitions/model.d.ts +4 -5
  9. package/definitions/model.js +9 -90
  10. package/definitions/model.js.map +1 -1
  11. package/definitions/table.d.ts +4 -6
  12. package/definitions/table.js +8 -30
  13. package/definitions/table.js.map +1 -1
  14. package/definitions/types.d.ts +65 -0
  15. package/definitions/types.js +0 -0
  16. package/dynamoDb/index.d.ts +1 -1
  17. package/dynamoDb/index.js +11 -20
  18. package/dynamoDb/index.js.map +1 -1
  19. package/dynamoDb/path/locationFolderId.d.ts +2 -0
  20. package/dynamoDb/path/locationFolderId.js +21 -0
  21. package/dynamoDb/path/locationFolderId.js.map +1 -0
  22. package/dynamoDb/path/plainObject.d.ts +1 -1
  23. package/dynamoDb/path/plainObject.js +13 -37
  24. package/dynamoDb/path/plainObject.js.map +1 -1
  25. package/dynamoDb/transformValue/datetime.d.ts +1 -1
  26. package/dynamoDb/transformValue/datetime.js +27 -50
  27. package/dynamoDb/transformValue/datetime.js.map +1 -1
  28. package/index.d.ts +2 -3
  29. package/index.js +83 -139
  30. package/index.js.map +1 -1
  31. package/operations/entry/dataLoader/DataLoaderCache.d.ts +16 -0
  32. package/operations/entry/dataLoader/DataLoaderCache.js +27 -0
  33. package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -0
  34. package/operations/entry/dataLoader/constants.d.ts +1 -0
  35. package/operations/entry/dataLoader/constants.js +5 -0
  36. package/operations/entry/dataLoader/constants.js.map +1 -0
  37. package/operations/entry/dataLoader/createBatchScheduleFn.d.ts +8 -0
  38. package/operations/entry/dataLoader/createBatchScheduleFn.js +10 -0
  39. package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -0
  40. package/operations/entry/dataLoader/getAllEntryRevisions.d.ts +4 -0
  41. package/operations/entry/dataLoader/getAllEntryRevisions.js +24 -0
  42. package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -0
  43. package/operations/entry/dataLoader/getLatestRevisionByEntryId.d.ts +4 -0
  44. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +40 -0
  45. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -0
  46. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.d.ts +4 -0
  47. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +40 -0
  48. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -0
  49. package/operations/entry/dataLoader/getRevisionById.d.ts +4 -0
  50. package/operations/entry/dataLoader/getRevisionById.js +42 -0
  51. package/operations/entry/dataLoader/getRevisionById.js.map +1 -0
  52. package/operations/entry/dataLoader/index.d.ts +8 -0
  53. package/operations/entry/dataLoader/index.js +18 -0
  54. package/operations/entry/dataLoader/index.js.map +1 -0
  55. package/operations/entry/dataLoader/types.d.ts +6 -0
  56. package/operations/entry/dataLoader/types.js +0 -0
  57. package/operations/entry/dataLoaders.d.ts +14 -30
  58. package/operations/entry/dataLoaders.js +83 -314
  59. package/operations/entry/dataLoaders.js.map +1 -1
  60. package/operations/entry/filtering/createExpressions.d.ts +27 -0
  61. package/operations/entry/filtering/createExpressions.js +124 -0
  62. package/operations/entry/filtering/createExpressions.js.map +1 -0
  63. package/operations/entry/filtering/createFields.d.ts +16 -0
  64. package/operations/entry/filtering/createFields.js +93 -0
  65. package/operations/entry/filtering/createFields.js.map +1 -0
  66. package/operations/entry/filtering/extractSort.d.ts +17 -0
  67. package/operations/entry/filtering/extractSort.js +60 -0
  68. package/operations/entry/filtering/extractSort.js.map +1 -0
  69. package/operations/entry/filtering/filter.d.ts +16 -0
  70. package/operations/entry/filtering/filter.js +85 -0
  71. package/operations/entry/filtering/filter.js.map +1 -0
  72. package/operations/entry/filtering/fullTextSearch.d.ts +14 -0
  73. package/operations/entry/filtering/fullTextSearch.js +25 -0
  74. package/operations/entry/filtering/fullTextSearch.js.map +1 -0
  75. package/operations/entry/filtering/getValue.d.ts +5 -0
  76. package/operations/entry/filtering/getValue.js +37 -0
  77. package/operations/entry/filtering/getValue.js.map +1 -0
  78. package/operations/entry/filtering/index.d.ts +2 -0
  79. package/operations/entry/filtering/index.js +2 -0
  80. package/operations/entry/filtering/mapPlugins.d.ts +8 -0
  81. package/operations/entry/filtering/mapPlugins.js +18 -0
  82. package/operations/entry/filtering/mapPlugins.js.map +1 -0
  83. package/operations/entry/filtering/plugins/defaultFilterCreate.d.ts +2 -0
  84. package/operations/entry/filtering/plugins/defaultFilterCreate.js +33 -0
  85. package/operations/entry/filtering/plugins/defaultFilterCreate.js.map +1 -0
  86. package/operations/entry/filtering/plugins/index.d.ts +1 -0
  87. package/operations/entry/filtering/plugins/index.js +13 -0
  88. package/operations/entry/filtering/plugins/index.js.map +1 -0
  89. package/operations/entry/filtering/plugins/objectFilterCreate.d.ts +2 -0
  90. package/operations/entry/filtering/plugins/objectFilterCreate.js +68 -0
  91. package/operations/entry/filtering/plugins/objectFilterCreate.js.map +1 -0
  92. package/operations/entry/filtering/plugins/refFilterCreate.d.ts +3 -0
  93. package/operations/entry/filtering/plugins/refFilterCreate.js +63 -0
  94. package/operations/entry/filtering/plugins/refFilterCreate.js.map +1 -0
  95. package/operations/entry/filtering/plugins/searchableJsonFilterCreate.d.ts +2 -0
  96. package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js +49 -0
  97. package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js.map +1 -0
  98. package/operations/entry/filtering/sort.d.ts +12 -0
  99. package/operations/entry/filtering/sort.js +41 -0
  100. package/operations/entry/filtering/sort.js.map +1 -0
  101. package/operations/entry/filtering/systemFields.d.ts +2 -0
  102. package/operations/entry/filtering/systemFields.js +149 -0
  103. package/operations/entry/filtering/systemFields.js.map +1 -0
  104. package/operations/entry/filtering/transform.d.ts +6 -0
  105. package/operations/entry/filtering/transform.js +7 -0
  106. package/operations/entry/filtering/transform.js.map +1 -0
  107. package/operations/entry/filtering/types.d.ts +40 -0
  108. package/operations/entry/filtering/types.js +0 -0
  109. package/operations/entry/filtering/values.d.ts +2 -0
  110. package/operations/entry/filtering/values.js +15 -0
  111. package/operations/entry/filtering/values.js.map +1 -0
  112. package/operations/entry/filtering/where.d.ts +5 -0
  113. package/operations/entry/filtering/where.js +22 -0
  114. package/operations/entry/filtering/where.js.map +1 -0
  115. package/operations/entry/index.d.ts +5 -4
  116. package/operations/entry/index.js +931 -845
  117. package/operations/entry/index.js.map +1 -1
  118. package/operations/entry/keys.d.ts +46 -2
  119. package/operations/entry/keys.js +53 -66
  120. package/operations/entry/keys.js.map +1 -1
  121. package/operations/group/index.d.ts +4 -5
  122. package/operations/group/index.js +116 -187
  123. package/operations/group/index.js.map +1 -1
  124. package/operations/model/index.d.ts +3 -3
  125. package/operations/model/index.js +102 -158
  126. package/operations/model/index.js.map +1 -1
  127. package/package.json +34 -33
  128. package/plugins/CmsEntryFieldFilterPathPlugin.d.ts +5 -4
  129. package/plugins/CmsEntryFieldFilterPathPlugin.js +25 -50
  130. package/plugins/CmsEntryFieldFilterPathPlugin.js.map +1 -1
  131. package/plugins/CmsEntryFieldFilterPlugin.d.ts +43 -0
  132. package/plugins/CmsEntryFieldFilterPlugin.js +20 -0
  133. package/plugins/CmsEntryFieldFilterPlugin.js.map +1 -0
  134. package/plugins/CmsEntryFieldSortingPlugin.d.ts +42 -0
  135. package/plugins/CmsEntryFieldSortingPlugin.js +20 -0
  136. package/plugins/CmsEntryFieldSortingPlugin.js.map +1 -0
  137. package/plugins/CmsFieldFilterValueTransformPlugin.d.ts +11 -0
  138. package/plugins/CmsFieldFilterValueTransformPlugin.js +19 -0
  139. package/plugins/CmsFieldFilterValueTransformPlugin.js.map +1 -0
  140. package/plugins/index.d.ts +4 -1
  141. package/plugins/index.js +4 -18
  142. package/types.d.ts +28 -21
  143. package/types.js +8 -15
  144. package/types.js.map +1 -1
  145. package/definitions/settings.d.ts +0 -9
  146. package/definitions/settings.js +0 -58
  147. package/definitions/settings.js.map +0 -1
  148. package/definitions/system.d.ts +0 -9
  149. package/definitions/system.js +0 -46
  150. package/definitions/system.js.map +0 -1
  151. package/dynamoDb/storage/date.d.ts +0 -2
  152. package/dynamoDb/storage/date.js +0 -99
  153. package/dynamoDb/storage/date.js.map +0 -1
  154. package/dynamoDb/storage/longText.d.ts +0 -10
  155. package/dynamoDb/storage/longText.js +0 -101
  156. package/dynamoDb/storage/longText.js.map +0 -1
  157. package/dynamoDb/storage/richText.d.ts +0 -2
  158. package/dynamoDb/storage/richText.js +0 -113
  159. package/dynamoDb/storage/richText.js.map +0 -1
  160. package/operations/entry/systemFields.d.ts +0 -2
  161. package/operations/entry/systemFields.js +0 -74
  162. package/operations/entry/systemFields.js.map +0 -1
  163. package/operations/entry/utils.d.ts +0 -36
  164. package/operations/entry/utils.js +0 -680
  165. package/operations/entry/utils.js.map +0 -1
  166. package/operations/settings/index.d.ts +0 -7
  167. package/operations/settings/index.js +0 -135
  168. package/operations/settings/index.js.map +0 -1
  169. package/operations/system/index.d.ts +0 -7
  170. package/operations/system/index.js +0 -99
  171. package/operations/system/index.js.map +0 -1
  172. package/plugins/index.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"names":["createPartitionKey","params","tenant","locale","WebinyError","createSortKey","modelId","createKeys","PK","SK","createType","createModelsStorageOperations","entity","create","model","keys","put","cleanupItem","TYPE","ex","error","update","message","code","deleteModel","delete","get","item","getRecord","list","where","queryAllParams","partitionKey","options","gte","items","queryAll","cleanupItems"],"sources":["index.ts"],"sourcesContent":["import {\n CmsModel,\n CmsModelStorageOperations,\n CmsModelStorageOperationsCreateParams,\n CmsModelStorageOperationsDeleteParams,\n CmsModelStorageOperationsGetParams,\n CmsModelStorageOperationsListParams,\n CmsModelStorageOperationsUpdateParams\n} from \"@webiny/api-headless-cms/types\";\nimport { Entity } from \"dynamodb-toolbox\";\nimport WebinyError from \"@webiny/error\";\nimport { get as getRecord } from \"@webiny/db-dynamodb/utils/get\";\nimport { cleanupItem, cleanupItems } from \"@webiny/db-dynamodb/utils/cleanup\";\nimport { queryAll, QueryAllParams } from \"@webiny/db-dynamodb/utils/query\";\n\ninterface PartitionKeysParams {\n tenant: string;\n locale: string;\n}\nconst createPartitionKey = (params: PartitionKeysParams): string => {\n const { tenant, locale } = params;\n if (!tenant) {\n throw new WebinyError(`Missing tenant variable when creating model partitionKey.`);\n } else if (!locale) {\n throw new WebinyError(`Missing locale variable when creating model partitionKey.`);\n }\n return `T#${tenant}#L#${locale}#CMS#CM`;\n};\n\ninterface SortKeyParams {\n modelId: string;\n}\nconst createSortKey = (params: SortKeyParams): string => {\n return params.modelId;\n};\n\ninterface Keys {\n PK: string;\n SK: string;\n}\nconst createKeys = (params: PartitionKeysParams & SortKeyParams): Keys => {\n return {\n PK: createPartitionKey(params),\n SK: createSortKey(params)\n };\n};\n\nconst createType = (): string => {\n return \"cms.model\";\n};\n\ninterface CreateModelsStorageOperationsParams {\n entity: Entity<any>;\n}\nexport const createModelsStorageOperations = (\n params: CreateModelsStorageOperationsParams\n): CmsModelStorageOperations => {\n const { entity } = params;\n\n const create = async (params: CmsModelStorageOperationsCreateParams) => {\n const { model } = params;\n\n const keys = createKeys(model);\n\n try {\n await entity.put({\n ...cleanupItem(entity, model),\n ...keys,\n TYPE: createType()\n });\n return model;\n } catch (ex) {\n throw new WebinyError(`Could not create CMS Content Model.`, \"CREATE_MODEL_ERROR\", {\n error: ex,\n model,\n keys\n });\n }\n };\n\n const update = async (params: CmsModelStorageOperationsUpdateParams) => {\n const { model } = params;\n\n const keys = createKeys(model);\n\n try {\n await entity.put({\n ...cleanupItem(entity, model),\n ...keys,\n TYPE: createType()\n });\n return model;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not update model.\",\n ex.code || \"MODEL_UPDATE_ERROR\",\n {\n error: ex,\n model,\n keys\n }\n );\n }\n };\n\n const deleteModel = async (params: CmsModelStorageOperationsDeleteParams) => {\n const { model } = params;\n const keys = createKeys(model);\n\n try {\n await entity.delete(keys);\n return model;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not delete model.\",\n ex.code || \"MODEL_DELETE_ERROR\",\n {\n error: ex,\n model,\n keys\n }\n );\n }\n };\n\n const get = async (params: CmsModelStorageOperationsGetParams) => {\n const keys = createKeys(params);\n\n try {\n const item = await getRecord<CmsModel>({\n entity,\n keys\n });\n return cleanupItem(entity, item);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not get model.\",\n ex.code || \"MODEL_GET_ERROR\",\n {\n error: ex,\n keys\n }\n );\n }\n };\n\n const list = async (params: CmsModelStorageOperationsListParams) => {\n const { where } = params;\n const queryAllParams: QueryAllParams = {\n entity,\n partitionKey: createPartitionKey(where),\n options: {\n gte: \" \"\n }\n };\n try {\n const items = await queryAll<CmsModel>(queryAllParams);\n\n return cleanupItems(entity, items);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not list models.\",\n ex.code || \"MODEL_LIST_ERROR\",\n {\n error: ex,\n partitionKey: queryAllParams.partitionKey\n }\n );\n }\n };\n\n return {\n create,\n update,\n delete: deleteModel,\n get,\n list\n };\n};\n"],"mappings":"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"}
1
+ {"version":3,"file":"operations/model/index.js","sources":["../../../src/operations/model/index.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type {\n CmsModelStorageOperations,\n CmsModelStorageOperationsCreateParams,\n CmsModelStorageOperationsDeleteParams,\n CmsModelStorageOperationsGetParams,\n CmsModelStorageOperationsListParams,\n CmsModelStorageOperationsUpdateParams\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { convertException } from \"@webiny/utils\";\nimport type { IModelEntity } from \"~/definitions/types.js\";\n\ninterface PartitionKeysParams {\n tenant: string;\n}\nconst createPartitionKey = (params: PartitionKeysParams): string => {\n const { tenant } = params;\n if (!tenant) {\n throw new WebinyError(`Missing tenant variable when creating model partitionKey.`);\n }\n return `T#${tenant}#CMS#CM`;\n};\n\ninterface SortKeyParams {\n modelId: string;\n}\nconst createSortKey = (params: SortKeyParams): string => {\n return params.modelId;\n};\n\ninterface Keys {\n PK: string;\n SK: string;\n GSI_TENANT: string;\n}\nconst createKeys = (params: PartitionKeysParams & SortKeyParams): Keys => {\n return {\n PK: createPartitionKey(params),\n SK: createSortKey(params),\n GSI_TENANT: params.tenant\n };\n};\n\nconst createType = (): string => {\n return \"cms.model\";\n};\n\ninterface CreateModelsStorageOperationsParams {\n entity: IModelEntity;\n}\nexport const createModelsStorageOperations = (\n params: CreateModelsStorageOperationsParams\n): CmsModelStorageOperations => {\n const { entity } = params;\n\n const create = async (params: CmsModelStorageOperationsCreateParams) => {\n const { model } = params;\n\n const keys = createKeys(model);\n\n try {\n await entity.put({\n data: model,\n ...keys,\n TYPE: createType()\n });\n return model;\n } catch (ex) {\n throw new WebinyError(`Could not create CMS Content Model.`, \"CREATE_MODEL_ERROR\", {\n error: convertException(ex),\n model,\n keys\n });\n }\n };\n\n const update = async (params: CmsModelStorageOperationsUpdateParams) => {\n const { model } = params;\n\n const keys = createKeys(model);\n\n try {\n await entity.put({\n data: model,\n ...keys,\n TYPE: createType()\n });\n return model;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not update model.\",\n ex.code || \"MODEL_UPDATE_ERROR\",\n {\n error: ex,\n model,\n keys\n }\n );\n }\n };\n\n const deleteModel = async (params: CmsModelStorageOperationsDeleteParams) => {\n const { model } = params;\n const keys = createKeys(model);\n\n try {\n await entity.delete(keys);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not delete model.\",\n ex.code || \"MODEL_DELETE_ERROR\",\n {\n error: ex,\n model,\n keys\n }\n );\n }\n };\n\n const get = async (params: CmsModelStorageOperationsGetParams) => {\n const keys = createKeys(params);\n\n try {\n const result = await entity.get(keys);\n return result?.data || null;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not get model.\",\n ex.code || \"MODEL_GET_ERROR\",\n {\n error: ex,\n keys\n }\n );\n }\n };\n\n const list = async (params: CmsModelStorageOperationsListParams) => {\n const { where } = params;\n\n const partitionKey = createPartitionKey(where);\n\n try {\n const result = await entity.queryAll({\n partitionKey,\n options: {\n gte: \" \"\n }\n });\n return result.map(item => {\n return item.data;\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not list models.\",\n ex.code || \"MODEL_LIST_ERROR\",\n {\n error: ex,\n partitionKey\n }\n );\n }\n };\n\n return {\n create,\n update,\n delete: deleteModel,\n get,\n list\n };\n};\n"],"names":["createPartitionKey","params","tenant","WebinyError","createSortKey","createKeys","createType","createModelsStorageOperations","entity","create","model","keys","ex","convertException","update","deleteModel","get","result","list","where","partitionKey","item"],"mappings":";;AAeA,MAAMA,qBAAqB,CAACC;IACxB,MAAM,EAAEC,MAAM,EAAE,GAAGD;IACnB,IAAI,CAACC,QACD,MAAM,IAAIC,MAAY;IAE1B,OAAO,CAAC,EAAE,EAAED,OAAO,OAAO,CAAC;AAC/B;AAKA,MAAME,gBAAgB,CAACH,SACZA,OAAO,OAAO;AAQzB,MAAMI,aAAa,CAACJ,SACT;QACH,IAAID,mBAAmBC;QACvB,IAAIG,cAAcH;QAClB,YAAYA,OAAO,MAAM;IAC7B;AAGJ,MAAMK,aAAa,IACR;AAMJ,MAAMC,gCAAgC,CACzCN;IAEA,MAAM,EAAEO,MAAM,EAAE,GAAGP;IAEnB,MAAMQ,SAAS,OAAOR;QAClB,MAAM,EAAES,KAAK,EAAE,GAAGT;QAElB,MAAMU,OAAON,WAAWK;QAExB,IAAI;YACA,MAAMF,OAAO,GAAG,CAAC;gBACb,MAAME;gBACN,GAAGC,IAAI;gBACP,MAAML;YACV;YACA,OAAOI;QACX,EAAE,OAAOE,IAAI;YACT,MAAM,IAAIT,MAAY,uCAAuC,sBAAsB;gBAC/E,OAAOU,iBAAiBD;gBACxBF;gBACAC;YACJ;QACJ;IACJ;IAEA,MAAMG,SAAS,OAAOb;QAClB,MAAM,EAAES,KAAK,EAAE,GAAGT;QAElB,MAAMU,OAAON,WAAWK;QAExB,IAAI;YACA,MAAMF,OAAO,GAAG,CAAC;gBACb,MAAME;gBACN,GAAGC,IAAI;gBACP,MAAML;YACV;YACA,OAAOI;QACX,EAAE,OAAOE,IAAI;YACT,MAAM,IAAIT,MACNS,GAAG,OAAO,IAAI,2BACdA,GAAG,IAAI,IAAI,sBACX;gBACI,OAAOA;gBACPF;gBACAC;YACJ;QAER;IACJ;IAEA,MAAMI,cAAc,OAAOd;QACvB,MAAM,EAAES,KAAK,EAAE,GAAGT;QAClB,MAAMU,OAAON,WAAWK;QAExB,IAAI;YACA,MAAMF,OAAO,MAAM,CAACG;QACxB,EAAE,OAAOC,IAAI;YACT,MAAM,IAAIT,MACNS,GAAG,OAAO,IAAI,2BACdA,GAAG,IAAI,IAAI,sBACX;gBACI,OAAOA;gBACPF;gBACAC;YACJ;QAER;IACJ;IAEA,MAAMK,MAAM,OAAOf;QACf,MAAMU,OAAON,WAAWJ;QAExB,IAAI;YACA,MAAMgB,SAAS,MAAMT,OAAO,GAAG,CAACG;YAChC,OAAOM,QAAQ,QAAQ;QAC3B,EAAE,OAAOL,IAAI;YACT,MAAM,IAAIT,MACNS,GAAG,OAAO,IAAI,wBACdA,GAAG,IAAI,IAAI,mBACX;gBACI,OAAOA;gBACPD;YACJ;QAER;IACJ;IAEA,MAAMO,OAAO,OAAOjB;QAChB,MAAM,EAAEkB,KAAK,EAAE,GAAGlB;QAElB,MAAMmB,eAAepB,mBAAmBmB;QAExC,IAAI;YACA,MAAMF,SAAS,MAAMT,OAAO,QAAQ,CAAC;gBACjCY;gBACA,SAAS;oBACL,KAAK;gBACT;YACJ;YACA,OAAOH,OAAO,GAAG,CAACI,CAAAA,OACPA,KAAK,IAAI;QAExB,EAAE,OAAOT,IAAI;YACT,MAAM,IAAIT,MACNS,GAAG,OAAO,IAAI,0BACdA,GAAG,IAAI,IAAI,oBACX;gBACI,OAAOA;gBACPQ;YACJ;QAER;IACJ;IAEA,OAAO;QACHX;QACAK;QACA,QAAQC;QACRC;QACAE;IACJ;AACJ"}
package/package.json CHANGED
@@ -1,11 +1,16 @@
1
1
  {
2
2
  "name": "@webiny/api-headless-cms-ddb",
3
- "version": "0.0.0-unstable.78f581c1d2",
4
- "main": "index.js",
3
+ "version": "0.0.0-unstable.7be00a75a9",
4
+ "type": "module",
5
+ "exports": {
6
+ ".": "./index.js",
7
+ "./*": "./*"
8
+ },
5
9
  "keywords": [
6
10
  "@webiny/api-headless-cms",
7
11
  "storage-operations",
8
12
  "dynamodb",
13
+ "ddb",
9
14
  "cms:ddb"
10
15
  ],
11
16
  "repository": {
@@ -21,40 +26,36 @@
21
26
  ],
22
27
  "license": "MIT",
23
28
  "dependencies": {
24
- "@babel/runtime": "7.19.0",
25
- "@webiny/api-headless-cms": "0.0.0-unstable.78f581c1d2",
26
- "@webiny/db-dynamodb": "0.0.0-unstable.78f581c1d2",
27
- "@webiny/error": "0.0.0-unstable.78f581c1d2",
28
- "@webiny/handler-db": "0.0.0-unstable.78f581c1d2",
29
- "@webiny/utils": "0.0.0-unstable.78f581c1d2",
30
- "aws-sdk": "2.1230.0",
31
- "dataloader": "2.1.0",
32
- "dot-prop": "6.0.1",
33
- "dynamodb-toolbox": "0.3.5",
34
- "jsonpack": "1.1.5",
35
- "lodash": "4.17.21"
29
+ "@webiny/api": "0.0.0-unstable.7be00a75a9",
30
+ "@webiny/api-headless-cms": "0.0.0-unstable.7be00a75a9",
31
+ "@webiny/aws-sdk": "0.0.0-unstable.7be00a75a9",
32
+ "@webiny/db-dynamodb": "0.0.0-unstable.7be00a75a9",
33
+ "@webiny/error": "0.0.0-unstable.7be00a75a9",
34
+ "@webiny/feature": "0.0.0-unstable.7be00a75a9",
35
+ "@webiny/handler": "0.0.0-unstable.7be00a75a9",
36
+ "@webiny/handler-db": "0.0.0-unstable.7be00a75a9",
37
+ "@webiny/utils": "0.0.0-unstable.7be00a75a9",
38
+ "dataloader": "2.2.3",
39
+ "dot-object": "2.1.5",
40
+ "dot-prop": "10.1.0",
41
+ "lodash": "4.18.1"
36
42
  },
37
43
  "devDependencies": {
38
- "@babel/cli": "^7.19.3",
39
- "@babel/core": "^7.19.3",
40
- "@babel/preset-env": "^7.19.4",
41
- "@types/jsonpack": "^1.1.0",
42
- "@webiny/cli": "^0.0.0-unstable.78f581c1d2",
43
- "@webiny/plugins": "^0.0.0-unstable.78f581c1d2",
44
- "@webiny/project-utils": "^0.0.0-unstable.78f581c1d2",
45
- "jest": "^28.1.0",
46
- "jest-dynalite": "^3.2.0",
47
- "jest-environment-node": "^27.2.4",
48
- "ttypescript": "^1.5.12",
49
- "typescript": "4.7.4"
44
+ "@types/dot-object": "2.1.6",
45
+ "@types/jsonpack": "1.1.6",
46
+ "@webiny/build-tools": "0.0.0-unstable.7be00a75a9",
47
+ "@webiny/di": "0.0.0-unstable.7be00a75a9",
48
+ "@webiny/plugins": "0.0.0-unstable.7be00a75a9",
49
+ "@webiny/project-utils": "0.0.0-unstable.7be00a75a9",
50
+ "jest-dynalite": "3.6.1",
51
+ "typescript": "6.0.3",
52
+ "vitest": "4.1.7"
50
53
  },
51
54
  "publishConfig": {
52
- "access": "public",
53
- "directory": "dist"
54
- },
55
- "scripts": {
56
- "build": "yarn webiny run build",
57
- "watch": "yarn webiny run watch"
55
+ "access": "public"
58
56
  },
59
- "gitHead": "78f581c1d2e5e6936aa11b9452a66d2a3652a1b2"
57
+ "gitHead": "b8aec8a1be3f25c3b428b357fe1e352c7cbff9ae",
58
+ "webiny": {
59
+ "publishFrom": "dist"
60
+ }
60
61
  }
@@ -1,7 +1,7 @@
1
- import { Plugin } from "@webiny/plugins/Plugin";
2
- import { CmsModelField } from "@webiny/api-headless-cms/types";
1
+ import { Plugin } from "@webiny/plugins/Plugin.js";
2
+ import type { CmsModelField } from "@webiny/api-headless-cms/types/index.js";
3
3
  export interface CreatePathCallableParams {
4
- field: CmsModelField;
4
+ field: Partial<CmsModelField> & Pick<CmsModelField, "fieldId" | "storageId" | "id">;
5
5
  index?: number;
6
6
  }
7
7
  export interface CreatePathCallable {
@@ -11,12 +11,13 @@ export interface CmsEntryFieldFilterPathPluginParams {
11
11
  fieldType: string;
12
12
  fieldId?: string[];
13
13
  path: string | CreatePathCallable;
14
+ canUse?: (field: Pick<CmsModelField, "fieldId" | "type">, parents?: string[]) => boolean;
14
15
  }
15
16
  export declare class CmsEntryFieldFilterPathPlugin extends Plugin {
16
17
  static readonly type: string;
17
18
  private readonly config;
18
19
  get fieldType(): string;
19
20
  constructor(config: CmsEntryFieldFilterPathPluginParams);
20
- canUse(field: CmsModelField): boolean;
21
+ canUse(field: Pick<CmsModelField, "fieldId" | "type">, parents: string[]): boolean;
21
22
  createPath(params: CreatePathCallableParams): string;
22
23
  }
@@ -1,55 +1,30 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.CmsEntryFieldFilterPathPlugin = void 0;
9
-
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
12
- var _error = _interopRequireDefault(require("@webiny/error"));
13
-
14
- var _Plugin = require("@webiny/plugins/Plugin");
15
-
16
- class CmsEntryFieldFilterPathPlugin extends _Plugin.Plugin {
17
- get fieldType() {
18
- return this.config.fieldType;
19
- }
20
-
21
- constructor(config) {
22
- super();
23
- (0, _defineProperty2.default)(this, "config", void 0);
24
- this.config = config;
25
- this.name = `${this.constructor.type}-${this.config.fieldType}`;
26
- }
27
-
28
- canUse(field) {
29
- if (field.type !== this.config.fieldType) {
30
- return false;
1
+ import error from "@webiny/error";
2
+ import { Plugin } from "@webiny/plugins/Plugin.js";
3
+ class CmsEntryFieldFilterPathPlugin extends Plugin {
4
+ static{
5
+ this.type = "cms-field-filter-path";
31
6
  }
32
-
33
- const fieldId = this.config.fieldId;
34
-
35
- if (!fieldId || Array.isArray(fieldId) === false || fieldId.length === 0) {
36
- return true;
7
+ get fieldType() {
8
+ return this.config.fieldType;
37
9
  }
38
-
39
- return fieldId.includes(field.fieldId);
40
- }
41
-
42
- createPath(params) {
43
- if (typeof this.config.path === "function") {
44
- return this.config.path(params);
45
- } else if (typeof this.config.path === "string") {
46
- return this.config.path;
10
+ constructor(config){
11
+ super();
12
+ this.config = config;
13
+ this.name = `${this.constructor.type}-${this.config.fieldType}`;
14
+ }
15
+ canUse(field, parents) {
16
+ if (field.type !== this.config.fieldType) return false;
17
+ if (this.config.canUse) return this.config.canUse(field, parents);
18
+ const fieldId = this.config.fieldId;
19
+ if (!fieldId || false === Array.isArray(fieldId) || 0 === fieldId.length) return true;
20
+ return fieldId.includes(field.fieldId);
21
+ }
22
+ createPath(params) {
23
+ if ("function" == typeof this.config.path) return this.config.path(params);
24
+ if ("string" == typeof this.config.path) return this.config.path;
25
+ throw new error(`Missing path in "${this.name}" plugin.`);
47
26
  }
48
-
49
- throw new _error.default(`Missing path in "${this.name}" plugin.`);
50
- }
51
-
52
27
  }
28
+ export { CmsEntryFieldFilterPathPlugin };
53
29
 
54
- exports.CmsEntryFieldFilterPathPlugin = CmsEntryFieldFilterPathPlugin;
55
- (0, _defineProperty2.default)(CmsEntryFieldFilterPathPlugin, "type", "cms-field-filter-path");
30
+ //# sourceMappingURL=CmsEntryFieldFilterPathPlugin.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["CmsEntryFieldFilterPathPlugin","Plugin","fieldType","config","constructor","name","type","canUse","field","fieldId","Array","isArray","length","includes","createPath","params","path","WebinyError"],"sources":["CmsEntryFieldFilterPathPlugin.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { Plugin } from \"@webiny/plugins/Plugin\";\nimport { CmsModelField } from \"@webiny/api-headless-cms/types\";\n\nexport interface CreatePathCallableParams {\n field: CmsModelField;\n index?: number;\n}\nexport interface CreatePathCallable {\n (params: CreatePathCallableParams): string;\n}\nexport interface CmsEntryFieldFilterPathPluginParams {\n fieldType: string;\n fieldId?: string[];\n path: string | CreatePathCallable;\n}\nexport class CmsEntryFieldFilterPathPlugin extends Plugin {\n public static override readonly type: string = \"cms-field-filter-path\";\n\n private readonly config: CmsEntryFieldFilterPathPluginParams;\n\n public get fieldType(): string {\n return this.config.fieldType;\n }\n\n public constructor(config: CmsEntryFieldFilterPathPluginParams) {\n super();\n\n this.config = config;\n\n this.name = `${(this.constructor as any).type}-${this.config.fieldType}`;\n }\n\n public canUse(field: CmsModelField): boolean {\n if (field.type !== this.config.fieldType) {\n return false;\n }\n const fieldId = this.config.fieldId;\n if (!fieldId || Array.isArray(fieldId) === false || fieldId.length === 0) {\n return true;\n }\n return fieldId.includes(field.fieldId);\n }\n\n public createPath(params: CreatePathCallableParams): string {\n if (typeof this.config.path === \"function\") {\n return this.config.path(params);\n } else if (typeof this.config.path === \"string\") {\n return this.config.path;\n }\n throw new WebinyError(`Missing path in \"${this.name}\" plugin.`);\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAeO,MAAMA,6BAAN,SAA4CC,cAA5C,CAAmD;EAKlC,IAATC,SAAS,GAAW;IAC3B,OAAO,KAAKC,MAAL,CAAYD,SAAnB;EACH;;EAEME,WAAW,CAACD,MAAD,EAA8C;IAC5D;IAD4D;IAG5D,KAAKA,MAAL,GAAcA,MAAd;IAEA,KAAKE,IAAL,GAAa,GAAG,KAAKD,WAAN,CAA0BE,IAAK,IAAG,KAAKH,MAAL,CAAYD,SAAU,EAAvE;EACH;;EAEMK,MAAM,CAACC,KAAD,EAAgC;IACzC,IAAIA,KAAK,CAACF,IAAN,KAAe,KAAKH,MAAL,CAAYD,SAA/B,EAA0C;MACtC,OAAO,KAAP;IACH;;IACD,MAAMO,OAAO,GAAG,KAAKN,MAAL,CAAYM,OAA5B;;IACA,IAAI,CAACA,OAAD,IAAYC,KAAK,CAACC,OAAN,CAAcF,OAAd,MAA2B,KAAvC,IAAgDA,OAAO,CAACG,MAAR,KAAmB,CAAvE,EAA0E;MACtE,OAAO,IAAP;IACH;;IACD,OAAOH,OAAO,CAACI,QAAR,CAAiBL,KAAK,CAACC,OAAvB,CAAP;EACH;;EAEMK,UAAU,CAACC,MAAD,EAA2C;IACxD,IAAI,OAAO,KAAKZ,MAAL,CAAYa,IAAnB,KAA4B,UAAhC,EAA4C;MACxC,OAAO,KAAKb,MAAL,CAAYa,IAAZ,CAAiBD,MAAjB,CAAP;IACH,CAFD,MAEO,IAAI,OAAO,KAAKZ,MAAL,CAAYa,IAAnB,KAA4B,QAAhC,EAA0C;MAC7C,OAAO,KAAKb,MAAL,CAAYa,IAAnB;IACH;;IACD,MAAM,IAAIC,cAAJ,CAAiB,oBAAmB,KAAKZ,IAAK,WAA9C,CAAN;EACH;;AAnCqD;;;8BAA7CL,6B,UACsC,uB"}
1
+ {"version":3,"file":"plugins/CmsEntryFieldFilterPathPlugin.js","sources":["../../src/plugins/CmsEntryFieldFilterPathPlugin.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { Plugin } from \"@webiny/plugins/Plugin.js\";\nimport type { CmsModelField } from \"@webiny/api-headless-cms/types/index.js\";\n\nexport interface CreatePathCallableParams {\n field: Partial<CmsModelField> & Pick<CmsModelField, \"fieldId\" | \"storageId\" | \"id\">;\n index?: number;\n}\nexport interface CreatePathCallable {\n (params: CreatePathCallableParams): string;\n}\nexport interface CmsEntryFieldFilterPathPluginParams {\n fieldType: string;\n fieldId?: string[];\n path: string | CreatePathCallable;\n canUse?: (field: Pick<CmsModelField, \"fieldId\" | \"type\">, parents?: string[]) => boolean;\n}\nexport class CmsEntryFieldFilterPathPlugin extends Plugin {\n public static override readonly type: string = \"cms-field-filter-path\";\n\n private readonly config: CmsEntryFieldFilterPathPluginParams;\n\n public get fieldType(): string {\n return this.config.fieldType;\n }\n\n public constructor(config: CmsEntryFieldFilterPathPluginParams) {\n super();\n\n this.config = config;\n\n /**\n * We expect error here because we know that `this.constructor.type` is defined, but TS does not.\n */\n // @ts-expect-error\n this.name = `${this.constructor.type}-${this.config.fieldType}`;\n }\n\n public canUse(field: Pick<CmsModelField, \"fieldId\" | \"type\">, parents: string[]): boolean {\n if (field.type !== this.config.fieldType) {\n return false;\n } else if (this.config.canUse) {\n return this.config.canUse(field, parents);\n }\n const fieldId = this.config.fieldId;\n if (!fieldId || Array.isArray(fieldId) === false || fieldId.length === 0) {\n return true;\n }\n return fieldId.includes(field.fieldId);\n }\n\n public createPath(params: CreatePathCallableParams): string {\n if (typeof this.config.path === \"function\") {\n return this.config.path(params);\n } else if (typeof this.config.path === \"string\") {\n return this.config.path;\n }\n throw new WebinyError(`Missing path in \"${this.name}\" plugin.`);\n }\n}\n"],"names":["CmsEntryFieldFilterPathPlugin","Plugin","config","field","parents","fieldId","Array","params","WebinyError"],"mappings":";;AAiBO,MAAMA,sCAAsCC;;aACf,IAAI,GAAW;;IAI/C,IAAW,YAAoB;QAC3B,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS;IAChC;IAEA,YAAmBC,MAA2C,CAAE;QAC5D,KAAK;QAEL,IAAI,CAAC,MAAM,GAAGA;QAMd,IAAI,CAAC,IAAI,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE;IACnE;IAEO,OAAOC,KAA8C,EAAEC,OAAiB,EAAW;QACtF,IAAID,MAAM,IAAI,KAAK,IAAI,CAAC,MAAM,CAAC,SAAS,EACpC,OAAO;QACJ,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,EACzB,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAACA,OAAOC;QAErC,MAAMC,UAAU,IAAI,CAAC,MAAM,CAAC,OAAO;QACnC,IAAI,CAACA,WAAWC,AAA2B,UAA3BA,MAAM,OAAO,CAACD,YAAsBA,AAAmB,MAAnBA,QAAQ,MAAM,EAC9D,OAAO;QAEX,OAAOA,QAAQ,QAAQ,CAACF,MAAM,OAAO;IACzC;IAEO,WAAWI,MAAgC,EAAU;QACxD,IAAI,AAA4B,cAA5B,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,EACvB,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAACA;QACrB,IAAI,AAA4B,YAA5B,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,EAC9B,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI;QAE3B,MAAM,IAAIC,MAAY,CAAC,iBAAiB,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC;IAClE;AACJ"}
@@ -0,0 +1,43 @@
1
+ import { Plugin } from "@webiny/plugins";
2
+ import type { Field } from "../operations/entry/filtering/types.js";
3
+ import type { CmsFieldFilterValueTransformPlugin } from "../types.js";
4
+ import { ValueFilterRegistry } from "@webiny/db-dynamodb/feature/ValueFilter/index.js";
5
+ /**
6
+ * This plugin is used to create the filter.
7
+ * Internally we have default one + the one for the reference field - because it is actually an object when filtering.
8
+ */
9
+ interface CmsEntryFieldFilterPluginParams<T = any> {
10
+ fieldType: string;
11
+ create: (params: CmsEntryFieldFilterPluginCreateParams<T>) => null | CmsEntryFieldFilterPluginCreateResponse | CmsEntryFieldFilterPluginCreateResponse[];
12
+ }
13
+ interface CmsEntryFieldFilterPluginCreateParams<T = any> {
14
+ key: string;
15
+ value: T;
16
+ field: Field;
17
+ fields: Record<string, Field>;
18
+ operation: string;
19
+ valueFilterRegistry: ValueFilterRegistry.Interface;
20
+ transformValuePlugins: Record<string, CmsFieldFilterValueTransformPlugin>;
21
+ getFilterCreatePlugin: (type: string) => CmsEntryFieldFilterPlugin;
22
+ negate: boolean;
23
+ compareValue: any;
24
+ transformValue: <I = any, O = any>(value: I) => O;
25
+ }
26
+ export interface CmsEntryFieldFilterPluginCreateResponse {
27
+ field: Field;
28
+ path: string;
29
+ fieldPathId: string;
30
+ filter: ValueFilterRegistry.Filter;
31
+ negate: boolean;
32
+ compareValue: any;
33
+ transformValue: <I = any, O = any>(value: I) => O;
34
+ }
35
+ export declare class CmsEntryFieldFilterPlugin<T = any> extends Plugin {
36
+ static readonly type: string;
37
+ static readonly ALL: string;
38
+ private readonly config;
39
+ readonly fieldType: string;
40
+ constructor(config: CmsEntryFieldFilterPluginParams<T>);
41
+ create(params: CmsEntryFieldFilterPluginCreateParams<T>): CmsEntryFieldFilterPluginCreateResponse | CmsEntryFieldFilterPluginCreateResponse[] | null;
42
+ }
43
+ export {};
@@ -0,0 +1,20 @@
1
+ import { Plugin } from "@webiny/plugins";
2
+ class CmsEntryFieldFilterPlugin extends Plugin {
3
+ static{
4
+ this.type = "cms.dynamodb.entry.field.filter";
5
+ }
6
+ static{
7
+ this.ALL = "*";
8
+ }
9
+ constructor(config){
10
+ super();
11
+ this.config = config;
12
+ this.fieldType = this.config.fieldType;
13
+ }
14
+ create(params) {
15
+ return this.config.create(params);
16
+ }
17
+ }
18
+ export { CmsEntryFieldFilterPlugin };
19
+
20
+ //# sourceMappingURL=CmsEntryFieldFilterPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugins/CmsEntryFieldFilterPlugin.js","sources":["../../src/plugins/CmsEntryFieldFilterPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport type { Field } from \"~/operations/entry/filtering/types.js\";\nimport type { CmsFieldFilterValueTransformPlugin } from \"~/types.js\";\nimport { ValueFilterRegistry } from \"@webiny/db-dynamodb/feature/ValueFilter/index.js\";\n\n/**\n * This plugin is used to create the filter.\n * Internally we have default one + the one for the reference field - because it is actually an object when filtering.\n */\n\ninterface CmsEntryFieldFilterPluginParams<T = any> {\n fieldType: string;\n create: (\n params: CmsEntryFieldFilterPluginCreateParams<T>\n ) => null | CmsEntryFieldFilterPluginCreateResponse | CmsEntryFieldFilterPluginCreateResponse[];\n}\n\ninterface CmsEntryFieldFilterPluginCreateParams<T = any> {\n key: string;\n value: T;\n field: Field;\n fields: Record<string, Field>;\n operation: string;\n valueFilterRegistry: ValueFilterRegistry.Interface;\n transformValuePlugins: Record<string, CmsFieldFilterValueTransformPlugin>;\n getFilterCreatePlugin: (type: string) => CmsEntryFieldFilterPlugin;\n negate: boolean;\n compareValue: any;\n transformValue: <I = any, O = any>(value: I) => O;\n}\n\nexport interface CmsEntryFieldFilterPluginCreateResponse {\n field: Field;\n path: string;\n fieldPathId: string;\n filter: ValueFilterRegistry.Filter;\n negate: boolean;\n compareValue: any;\n transformValue: <I = any, O = any>(value: I) => O;\n}\n\nexport class CmsEntryFieldFilterPlugin<T = any> extends Plugin {\n public static override readonly type: string = \"cms.dynamodb.entry.field.filter\";\n public static readonly ALL: string = \"*\";\n\n private readonly config: CmsEntryFieldFilterPluginParams<T>;\n\n public readonly fieldType: string;\n\n public constructor(config: CmsEntryFieldFilterPluginParams<T>) {\n super();\n this.config = config;\n this.fieldType = this.config.fieldType;\n }\n\n public create(params: CmsEntryFieldFilterPluginCreateParams<T>) {\n return this.config.create(params);\n }\n}\n"],"names":["CmsEntryFieldFilterPlugin","Plugin","config","params"],"mappings":";AAyCO,MAAMA,kCAA2CC;;aACpB,IAAI,GAAW;;;aACxB,GAAG,GAAW;;IAMrC,YAAmBC,MAA0C,CAAE;QAC3D,KAAK;QACL,IAAI,CAAC,MAAM,GAAGA;QACd,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS;IAC1C;IAEO,OAAOC,MAAgD,EAAE;QAC5D,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAACA;IAC9B;AACJ"}
@@ -0,0 +1,42 @@
1
+ import { Plugin } from "@webiny/plugins";
2
+ import type { Field } from "../operations/entry/filtering/types.js";
3
+ import type { CmsModel } from "@webiny/api-headless-cms/types/index.js";
4
+ interface CmsEntryFieldSortingPluginCanUseParams {
5
+ model: CmsModel;
6
+ field?: Field;
7
+ fieldId: string;
8
+ order: "ASC" | "DESC";
9
+ /**
10
+ * Combination of fieldId and sortBy
11
+ *
12
+ * example: id_ASC or createdBy_DESC
13
+ */
14
+ sortBy: string;
15
+ }
16
+ interface CmsEntryFieldSortingPluginCreateSortParams {
17
+ model: CmsModel;
18
+ fieldId: string;
19
+ order: "ASC" | "DESC";
20
+ sortBy: string;
21
+ fields: Record<string, Field>;
22
+ field?: Field;
23
+ }
24
+ interface CmsEntryFieldSortingPluginCreateSortResult {
25
+ valuePath: string;
26
+ reverse: boolean;
27
+ fieldId: string;
28
+ field: Field;
29
+ }
30
+ interface CmsEntryFieldSortingPluginConfig {
31
+ createSort: (params: CmsEntryFieldSortingPluginCreateSortParams) => CmsEntryFieldSortingPluginCreateSortResult;
32
+ canUse: (params: CmsEntryFieldSortingPluginCanUseParams) => boolean;
33
+ }
34
+ export declare class CmsEntryFieldSortingPlugin extends Plugin {
35
+ static readonly type: string;
36
+ private readonly config;
37
+ constructor(config: CmsEntryFieldSortingPluginConfig);
38
+ canUse(params: CmsEntryFieldSortingPluginCanUseParams): boolean;
39
+ createSort(params: CmsEntryFieldSortingPluginCreateSortParams): CmsEntryFieldSortingPluginCreateSortResult;
40
+ }
41
+ export declare const createCmsEntryFieldSortingPlugin: (config: CmsEntryFieldSortingPluginConfig) => CmsEntryFieldSortingPlugin;
42
+ export {};
@@ -0,0 +1,20 @@
1
+ import { Plugin } from "@webiny/plugins";
2
+ class CmsEntryFieldSortingPlugin extends Plugin {
3
+ static{
4
+ this.type = "cms.entry.field.sorting";
5
+ }
6
+ constructor(config){
7
+ super();
8
+ this.config = config;
9
+ }
10
+ canUse(params) {
11
+ return this.config.canUse(params);
12
+ }
13
+ createSort(params) {
14
+ return this.config.createSort(params);
15
+ }
16
+ }
17
+ const createCmsEntryFieldSortingPlugin = (config)=>new CmsEntryFieldSortingPlugin(config);
18
+ export { CmsEntryFieldSortingPlugin, createCmsEntryFieldSortingPlugin };
19
+
20
+ //# sourceMappingURL=CmsEntryFieldSortingPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugins/CmsEntryFieldSortingPlugin.js","sources":["../../src/plugins/CmsEntryFieldSortingPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport type { Field } from \"~/operations/entry/filtering/types.js\";\nimport type { CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\n\ninterface CmsEntryFieldSortingPluginCanUseParams {\n model: CmsModel;\n field?: Field;\n fieldId: string;\n order: \"ASC\" | \"DESC\";\n /**\n * Combination of fieldId and sortBy\n *\n * example: id_ASC or createdBy_DESC\n */\n sortBy: string;\n}\n\ninterface CmsEntryFieldSortingPluginCreateSortParams {\n model: CmsModel;\n fieldId: string;\n order: \"ASC\" | \"DESC\";\n sortBy: string;\n fields: Record<string, Field>;\n field?: Field;\n}\n\ninterface CmsEntryFieldSortingPluginCreateSortResult {\n valuePath: string;\n reverse: boolean;\n fieldId: string;\n field: Field;\n}\n\ninterface CmsEntryFieldSortingPluginConfig {\n createSort: (\n params: CmsEntryFieldSortingPluginCreateSortParams\n ) => CmsEntryFieldSortingPluginCreateSortResult;\n canUse: (params: CmsEntryFieldSortingPluginCanUseParams) => boolean;\n}\n\nexport class CmsEntryFieldSortingPlugin extends Plugin {\n public static override readonly type: string = \"cms.entry.field.sorting\";\n private readonly config: CmsEntryFieldSortingPluginConfig;\n\n public constructor(config: CmsEntryFieldSortingPluginConfig) {\n super();\n this.config = config;\n }\n\n public canUse(params: CmsEntryFieldSortingPluginCanUseParams): boolean {\n return this.config.canUse(params);\n }\n\n public createSort(\n params: CmsEntryFieldSortingPluginCreateSortParams\n ): CmsEntryFieldSortingPluginCreateSortResult {\n return this.config.createSort(params);\n }\n}\n\nexport const createCmsEntryFieldSortingPlugin = (config: CmsEntryFieldSortingPluginConfig) => {\n return new CmsEntryFieldSortingPlugin(config);\n};\n"],"names":["CmsEntryFieldSortingPlugin","Plugin","config","params","createCmsEntryFieldSortingPlugin"],"mappings":";AAwCO,MAAMA,mCAAmCC;;aACZ,IAAI,GAAW;;IAG/C,YAAmBC,MAAwC,CAAE;QACzD,KAAK;QACL,IAAI,CAAC,MAAM,GAAGA;IAClB;IAEO,OAAOC,MAA8C,EAAW;QACnE,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAACA;IAC9B;IAEO,WACHA,MAAkD,EACR;QAC1C,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,CAACA;IAClC;AACJ;AAEO,MAAMC,mCAAmC,CAACF,SACtC,IAAIF,2BAA2BE"}
@@ -0,0 +1,11 @@
1
+ import { Plugin } from "@webiny/plugins";
2
+ import type { CmsFieldFilterValueTransformPlugin as CmsFieldFilterValueTransformPluginInterface } from "../types.js";
3
+ type CmsFieldFilterValueTransformPluginParams = Omit<CmsFieldFilterValueTransformPluginInterface, "type">;
4
+ export declare class CmsFieldFilterValueTransformPlugin extends Plugin implements Omit<CmsFieldFilterValueTransformPluginInterface, "type"> {
5
+ static type: string;
6
+ private config;
7
+ get fieldType(): string;
8
+ get transform(): CmsFieldFilterValueTransformPluginParams["transform"];
9
+ constructor(config: CmsFieldFilterValueTransformPluginParams);
10
+ }
11
+ export {};
@@ -0,0 +1,19 @@
1
+ import { Plugin } from "@webiny/plugins";
2
+ class CmsFieldFilterValueTransformPlugin extends Plugin {
3
+ static{
4
+ this.type = "cms-field-filter-value-transform";
5
+ }
6
+ get fieldType() {
7
+ return this.config.fieldType;
8
+ }
9
+ get transform() {
10
+ return this.config.transform;
11
+ }
12
+ constructor(config){
13
+ super();
14
+ this.config = config;
15
+ }
16
+ }
17
+ export { CmsFieldFilterValueTransformPlugin };
18
+
19
+ //# sourceMappingURL=CmsFieldFilterValueTransformPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugins/CmsFieldFilterValueTransformPlugin.js","sources":["../../src/plugins/CmsFieldFilterValueTransformPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport type { CmsFieldFilterValueTransformPlugin as CmsFieldFilterValueTransformPluginInterface } from \"~/types.js\";\n\ntype CmsFieldFilterValueTransformPluginParams = Omit<\n CmsFieldFilterValueTransformPluginInterface,\n \"type\"\n>;\nexport class CmsFieldFilterValueTransformPlugin\n extends Plugin\n implements Omit<CmsFieldFilterValueTransformPluginInterface, \"type\">\n{\n public static override type = \"cms-field-filter-value-transform\";\n\n private config: CmsFieldFilterValueTransformPluginParams;\n\n public get fieldType(): string {\n return this.config.fieldType;\n }\n\n public get transform(): CmsFieldFilterValueTransformPluginParams[\"transform\"] {\n return this.config.transform;\n }\n\n public constructor(config: CmsFieldFilterValueTransformPluginParams) {\n super();\n this.config = config;\n }\n}\n"],"names":["CmsFieldFilterValueTransformPlugin","Plugin","config"],"mappings":";AAOO,MAAMA,2CACDC;;aAGe,IAAI,GAAG;;IAI9B,IAAW,YAAoB;QAC3B,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS;IAChC;IAEA,IAAW,YAAmE;QAC1E,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS;IAChC;IAEA,YAAmBC,MAAgD,CAAE;QACjE,KAAK;QACL,IAAI,CAAC,MAAM,GAAGA;IAClB;AACJ"}
@@ -1 +1,4 @@
1
- export * from "./CmsEntryFieldFilterPathPlugin";
1
+ export * from "./CmsEntryFieldFilterPathPlugin.js";
2
+ export * from "./CmsEntryFieldSortingPlugin.js";
3
+ export * from "./CmsEntryFieldFilterPlugin.js";
4
+ export * from "./CmsFieldFilterValueTransformPlugin.js";
package/plugins/index.js CHANGED
@@ -1,18 +1,4 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
-
7
- var _CmsEntryFieldFilterPathPlugin = require("./CmsEntryFieldFilterPathPlugin");
8
-
9
- Object.keys(_CmsEntryFieldFilterPathPlugin).forEach(function (key) {
10
- if (key === "default" || key === "__esModule") return;
11
- if (key in exports && exports[key] === _CmsEntryFieldFilterPathPlugin[key]) return;
12
- Object.defineProperty(exports, key, {
13
- enumerable: true,
14
- get: function () {
15
- return _CmsEntryFieldFilterPathPlugin[key];
16
- }
17
- });
18
- });
1
+ export * from "./CmsEntryFieldFilterPathPlugin.js";
2
+ export * from "./CmsEntryFieldSortingPlugin.js";
3
+ export * from "./CmsEntryFieldFilterPlugin.js";
4
+ export * from "./CmsFieldFilterValueTransformPlugin.js";
package/types.d.ts CHANGED
@@ -1,14 +1,15 @@
1
- import { Plugin } from "@webiny/plugins/types";
2
- import { CmsModelField, HeadlessCmsStorageOperations as BaseHeadlessCmsStorageOperations } from "@webiny/api-headless-cms/types";
3
- import { DynamoDBTypes, TableConstructor } from "dynamodb-toolbox/dist/classes/Table";
4
- import { EntityAttributeConfig, EntityCompositeAttributes } from "dynamodb-toolbox/dist/classes/Entity";
5
- import { DocumentClient } from "aws-sdk/clients/dynamodb";
6
- import { Entity, Table } from "dynamodb-toolbox";
1
+ import { type Plugin, PluginsContainer } from "@webiny/plugins/types.js";
2
+ import type { CmsContext, CmsEntryStorageOperations as BaseCmsEntryStorageOperations, CmsModel, CmsModelField, HeadlessCmsStorageOperations as BaseHeadlessCmsStorageOperations } from "@webiny/api-headless-cms/types/index.js";
3
+ import type { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb/index.js";
4
+ import type { IEntryEntity, IGroupEntity, IModelEntity } from "./definitions/types.js";
5
+ import type { ITable } from "@webiny/db-dynamodb";
6
+ export type { CmsContext };
7
+ export type { IGroupEntity, IModelEntity, IEntryEntity };
7
8
  interface CmsFieldFilterValueTransformParams {
8
9
  /**
9
10
  * A field which value we are transforming.
10
11
  */
11
- field: CmsModelField;
12
+ field: Partial<CmsModelField> & Pick<CmsModelField, "id" | "storageId" | "fieldId" | "settings">;
12
13
  value: any;
13
14
  }
14
15
  export interface CmsFieldFilterValueTransformPlugin extends Plugin {
@@ -25,29 +26,35 @@ export interface CmsFieldFilterValueTransformPlugin extends Plugin {
25
26
  */
26
27
  transform: (params: CmsFieldFilterValueTransformParams) => any;
27
28
  }
28
- export declare type AttributeDefinition = DynamoDBTypes | EntityAttributeConfig | EntityCompositeAttributes;
29
- export declare type Attributes = Record<string, AttributeDefinition>;
30
29
  export declare enum ENTITIES {
31
- SYSTEM = "CmsSystem",
32
- SETTINGS = "CmsSettings",
33
30
  GROUPS = "CmsGroups",
34
31
  MODELS = "CmsModels",
35
32
  ENTRIES = "CmsEntries"
36
33
  }
37
- export interface TableModifier {
38
- (table: TableConstructor): TableConstructor;
39
- }
40
34
  export interface StorageOperationsFactoryParams {
41
- documentClient: DocumentClient;
42
- table?: TableModifier;
43
- attributes?: Record<ENTITIES, Attributes>;
44
- plugins?: Plugin[] | Plugin[][];
35
+ documentClient: DynamoDBDocument;
36
+ table?: string;
37
+ plugins: PluginsContainer;
38
+ container: CmsContext["container"];
39
+ }
40
+ export interface IHeadlessCmsStorageOperationsGetEntitiesResult {
41
+ groups: IGroupEntity;
42
+ models: IModelEntity;
43
+ entries: IEntryEntity;
45
44
  }
46
45
  export interface HeadlessCmsStorageOperations extends BaseHeadlessCmsStorageOperations {
47
- getTable: () => Table;
48
- getEntities: () => Record<"system" | "settings" | "groups" | "models" | "entries", Entity<any>>;
46
+ getTable: () => ITable;
47
+ getEntities: () => IHeadlessCmsStorageOperationsGetEntitiesResult;
49
48
  }
50
49
  export interface StorageOperationsFactory {
51
50
  (params: StorageOperationsFactoryParams): HeadlessCmsStorageOperations;
52
51
  }
53
- export {};
52
+ export interface CmsEntryStorageOperations extends BaseCmsEntryStorageOperations {
53
+ dataLoaders: IDataLoadersHandler;
54
+ }
55
+ export interface DataLoadersHandlerInterfaceClearAllParams {
56
+ model: Pick<CmsModel, "tenant">;
57
+ }
58
+ export interface IDataLoadersHandler {
59
+ clearAll: (params?: DataLoadersHandlerInterfaceClearAllParams) => void;
60
+ }
package/types.js CHANGED
@@ -1,16 +1,9 @@
1
- "use strict";
1
+ var types_ENTITIES = /*#__PURE__*/ function(ENTITIES) {
2
+ ENTITIES["GROUPS"] = "CmsGroups";
3
+ ENTITIES["MODELS"] = "CmsModels";
4
+ ENTITIES["ENTRIES"] = "CmsEntries";
5
+ return ENTITIES;
6
+ }({});
7
+ export { types_ENTITIES as ENTITIES };
2
8
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.ENTITIES = void 0;
7
- let ENTITIES;
8
- exports.ENTITIES = ENTITIES;
9
-
10
- (function (ENTITIES) {
11
- ENTITIES["SYSTEM"] = "CmsSystem";
12
- ENTITIES["SETTINGS"] = "CmsSettings";
13
- ENTITIES["GROUPS"] = "CmsGroups";
14
- ENTITIES["MODELS"] = "CmsModels";
15
- ENTITIES["ENTRIES"] = "CmsEntries";
16
- })(ENTITIES || (exports.ENTITIES = ENTITIES = {}));
9
+ //# sourceMappingURL=types.js.map
package/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["ENTITIES"],"sources":["types.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins/types\";\nimport {\n CmsModelField,\n HeadlessCmsStorageOperations as BaseHeadlessCmsStorageOperations\n} from \"@webiny/api-headless-cms/types\";\nimport { DynamoDBTypes, TableConstructor } from \"dynamodb-toolbox/dist/classes/Table\";\nimport {\n EntityAttributeConfig,\n EntityCompositeAttributes\n} from \"dynamodb-toolbox/dist/classes/Entity\";\nimport { DocumentClient } from \"aws-sdk/clients/dynamodb\";\nimport { Entity, Table } from \"dynamodb-toolbox\";\n\ninterface CmsFieldFilterValueTransformParams {\n /**\n * A field which value we are transforming.\n */\n field: CmsModelField;\n value: any;\n}\n\nexport interface CmsFieldFilterValueTransformPlugin extends Plugin {\n /**\n * A plugin type.\n */\n type: \"cms-field-filter-value-transform\";\n /**\n * A field type this plugin is for.\n */\n fieldType: string;\n /**\n * Transform method which expect field definition and value to transform.\n */\n transform: (params: CmsFieldFilterValueTransformParams) => any;\n}\n\nexport type AttributeDefinition = DynamoDBTypes | EntityAttributeConfig | EntityCompositeAttributes;\n\nexport type Attributes = Record<string, AttributeDefinition>;\n\nexport enum ENTITIES {\n SYSTEM = \"CmsSystem\",\n SETTINGS = \"CmsSettings\",\n GROUPS = \"CmsGroups\",\n MODELS = \"CmsModels\",\n ENTRIES = \"CmsEntries\"\n}\n\nexport interface TableModifier {\n (table: TableConstructor): TableConstructor;\n}\n\nexport interface StorageOperationsFactoryParams {\n documentClient: DocumentClient;\n table?: TableModifier;\n attributes?: Record<ENTITIES, Attributes>;\n plugins?: Plugin[] | Plugin[][];\n}\n\nexport interface HeadlessCmsStorageOperations extends BaseHeadlessCmsStorageOperations {\n getTable: () => Table;\n getEntities: () => Record<\"system\" | \"settings\" | \"groups\" | \"models\" | \"entries\", Entity<any>>;\n}\n\nexport interface StorageOperationsFactory {\n (params: StorageOperationsFactoryParams): HeadlessCmsStorageOperations;\n}\n"],"mappings":";;;;;;IAwCYA,Q;;;WAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;EAAAA,Q;GAAAA,Q,wBAAAA,Q"}
1
+ {"version":3,"file":"types.js","sources":["../src/types.ts"],"sourcesContent":["import { type Plugin, PluginsContainer } from \"@webiny/plugins/types.js\";\nimport type {\n CmsContext,\n CmsEntryStorageOperations as BaseCmsEntryStorageOperations,\n CmsModel,\n CmsModelField,\n HeadlessCmsStorageOperations as BaseHeadlessCmsStorageOperations\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\nimport type { IEntryEntity, IGroupEntity, IModelEntity } from \"~/definitions/types.js\";\nimport type { ITable } from \"@webiny/db-dynamodb\";\n\nexport type { CmsContext };\n\nexport type { IGroupEntity, IModelEntity, IEntryEntity };\n\ninterface CmsFieldFilterValueTransformParams {\n /**\n * A field which value we are transforming.\n */\n field: Partial<CmsModelField> &\n Pick<CmsModelField, \"id\" | \"storageId\" | \"fieldId\" | \"settings\">;\n value: any;\n}\n\nexport interface CmsFieldFilterValueTransformPlugin extends Plugin {\n /**\n * A plugin type.\n */\n type: \"cms-field-filter-value-transform\";\n /**\n * A field type this plugin is for.\n */\n fieldType: string;\n /**\n * Transform method which expect field definition and value to transform.\n */\n transform: (params: CmsFieldFilterValueTransformParams) => any;\n}\n\nexport enum ENTITIES {\n GROUPS = \"CmsGroups\",\n MODELS = \"CmsModels\",\n ENTRIES = \"CmsEntries\"\n}\n\nexport interface StorageOperationsFactoryParams {\n documentClient: DynamoDBDocument;\n table?: string;\n plugins: PluginsContainer;\n container: CmsContext[\"container\"];\n}\n\nexport interface IHeadlessCmsStorageOperationsGetEntitiesResult {\n groups: IGroupEntity;\n models: IModelEntity;\n entries: IEntryEntity;\n}\n\nexport interface HeadlessCmsStorageOperations extends BaseHeadlessCmsStorageOperations {\n getTable: () => ITable;\n getEntities: () => IHeadlessCmsStorageOperationsGetEntitiesResult;\n}\n\nexport interface StorageOperationsFactory {\n (params: StorageOperationsFactoryParams): HeadlessCmsStorageOperations;\n}\n\nexport interface CmsEntryStorageOperations extends BaseCmsEntryStorageOperations {\n dataLoaders: IDataLoadersHandler;\n}\n\nexport interface DataLoadersHandlerInterfaceClearAllParams {\n model: Pick<CmsModel, \"tenant\">;\n}\nexport interface IDataLoadersHandler {\n clearAll: (params?: DataLoadersHandlerInterfaceClearAllParams) => void;\n}\n"],"names":["ENTITIES"],"mappings":"AAwCO,IAAKA,iBAAQA,WAAAA,GAAAA,SAARA,QAAQ;;;;WAARA"}
@@ -1,9 +0,0 @@
1
- import { Entity, Table } from "dynamodb-toolbox";
2
- import { Attributes } from "../types";
3
- interface Params {
4
- table: Table;
5
- entityName: string;
6
- attributes: Attributes;
7
- }
8
- export declare const createSettingsEntity: (params: Params) => Entity<any>;
9
- export {};