@webiny/api-headless-cms-ddb 0.0.0-unstable.40876133bb → 0.0.0-unstable.461c047ab7

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 (170) hide show
  1. package/definitions/entry.d.ts +4 -3
  2. package/definitions/entry.js +108 -16
  3. package/definitions/entry.js.map +1 -1
  4. package/definitions/group.d.ts +4 -3
  5. package/definitions/group.js +8 -12
  6. package/definitions/group.js.map +1 -1
  7. package/definitions/model.d.ts +4 -3
  8. package/definitions/model.js +30 -12
  9. package/definitions/model.js.map +1 -1
  10. package/definitions/system.d.ts +4 -3
  11. package/definitions/system.js +8 -12
  12. package/definitions/system.js.map +1 -1
  13. package/definitions/table.d.ts +5 -5
  14. package/definitions/table.js +7 -6
  15. package/definitions/table.js.map +1 -1
  16. package/dynamoDb/index.d.ts +1 -1
  17. package/dynamoDb/index.js +4 -9
  18. package/dynamoDb/index.js.map +1 -1
  19. package/dynamoDb/path/locationFolderId.d.ts +2 -0
  20. package/dynamoDb/path/locationFolderId.js +43 -0
  21. package/dynamoDb/path/locationFolderId.js.map +1 -0
  22. package/dynamoDb/path/plainObject.js +3 -8
  23. package/dynamoDb/path/plainObject.js.map +1 -1
  24. package/dynamoDb/storage/longText.d.ts +1 -1
  25. package/dynamoDb/storage/longText.js +10 -17
  26. package/dynamoDb/storage/longText.js.map +1 -1
  27. package/dynamoDb/storage/richText.d.ts +1 -1
  28. package/dynamoDb/storage/richText.js +23 -75
  29. package/dynamoDb/storage/richText.js.map +1 -1
  30. package/dynamoDb/transformValue/datetime.d.ts +1 -1
  31. package/dynamoDb/transformValue/datetime.js +3 -8
  32. package/dynamoDb/transformValue/datetime.js.map +1 -1
  33. package/index.d.ts +1 -1
  34. package/index.js +25 -41
  35. package/index.js.map +1 -1
  36. package/operations/entry/dataLoader/DataLoaderCache.d.ts +17 -0
  37. package/operations/entry/dataLoader/DataLoaderCache.js +41 -0
  38. package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -0
  39. package/operations/entry/dataLoader/constants.d.ts +1 -0
  40. package/operations/entry/dataLoader/constants.js +10 -0
  41. package/operations/entry/dataLoader/constants.js.map +1 -0
  42. package/operations/entry/dataLoader/createBatchScheduleFn.d.ts +8 -0
  43. package/operations/entry/dataLoader/createBatchScheduleFn.js +25 -0
  44. package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -0
  45. package/operations/entry/dataLoader/getAllEntryRevisions.d.ts +4 -0
  46. package/operations/entry/dataLoader/getAllEntryRevisions.js +45 -0
  47. package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -0
  48. package/operations/entry/dataLoader/getLatestRevisionByEntryId.d.ts +4 -0
  49. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +56 -0
  50. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -0
  51. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.d.ts +4 -0
  52. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +56 -0
  53. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -0
  54. package/operations/entry/dataLoader/getRevisionById.d.ts +4 -0
  55. package/operations/entry/dataLoader/getRevisionById.js +62 -0
  56. package/operations/entry/dataLoader/getRevisionById.js.map +1 -0
  57. package/operations/entry/dataLoader/index.d.ts +8 -0
  58. package/operations/entry/dataLoader/index.js +40 -0
  59. package/operations/entry/dataLoader/index.js.map +1 -0
  60. package/operations/entry/dataLoader/types.d.ts +6 -0
  61. package/operations/entry/dataLoader/types.js +7 -0
  62. package/operations/entry/dataLoader/types.js.map +1 -0
  63. package/operations/entry/dataLoaders.d.ts +12 -27
  64. package/operations/entry/dataLoaders.js +55 -260
  65. package/operations/entry/dataLoaders.js.map +1 -1
  66. package/operations/entry/filtering/createExpressions.d.ts +26 -0
  67. package/operations/entry/filtering/createExpressions.js +178 -0
  68. package/operations/entry/filtering/createExpressions.js.map +1 -0
  69. package/operations/entry/filtering/createFields.d.ts +16 -0
  70. package/operations/entry/filtering/createFields.js +108 -0
  71. package/operations/entry/filtering/createFields.js.map +1 -0
  72. package/operations/entry/filtering/extractSort.d.ts +17 -0
  73. package/operations/entry/filtering/extractSort.js +69 -0
  74. package/operations/entry/filtering/extractSort.js.map +1 -0
  75. package/operations/entry/filtering/filter.d.ts +15 -0
  76. package/operations/entry/filtering/filter.js +158 -0
  77. package/operations/entry/filtering/filter.js.map +1 -0
  78. package/operations/entry/filtering/fullTextSearch.d.ts +14 -0
  79. package/operations/entry/filtering/fullTextSearch.js +50 -0
  80. package/operations/entry/filtering/fullTextSearch.js.map +1 -0
  81. package/operations/entry/filtering/getValue.d.ts +5 -0
  82. package/operations/entry/filtering/getValue.js +66 -0
  83. package/operations/entry/filtering/getValue.js.map +1 -0
  84. package/operations/entry/filtering/index.d.ts +2 -0
  85. package/operations/entry/filtering/index.js +21 -0
  86. package/operations/entry/filtering/index.js.map +1 -0
  87. package/operations/entry/filtering/mapPlugins.d.ts +8 -0
  88. package/operations/entry/filtering/mapPlugins.js +33 -0
  89. package/operations/entry/filtering/mapPlugins.js.map +1 -0
  90. package/operations/entry/filtering/plugins/defaultFilterCreate.d.ts +2 -0
  91. package/operations/entry/filtering/plugins/defaultFilterCreate.js +45 -0
  92. package/operations/entry/filtering/plugins/defaultFilterCreate.js.map +1 -0
  93. package/operations/entry/filtering/plugins/index.d.ts +1 -0
  94. package/operations/entry/filtering/plugins/index.js +16 -0
  95. package/operations/entry/filtering/plugins/index.js.map +1 -0
  96. package/operations/entry/filtering/plugins/objectFilterCreate.d.ts +2 -0
  97. package/operations/entry/filtering/plugins/objectFilterCreate.js +90 -0
  98. package/operations/entry/filtering/plugins/objectFilterCreate.js.map +1 -0
  99. package/operations/entry/filtering/plugins/refFilterCreate.d.ts +3 -0
  100. package/operations/entry/filtering/plugins/refFilterCreate.js +80 -0
  101. package/operations/entry/filtering/plugins/refFilterCreate.js.map +1 -0
  102. package/operations/entry/filtering/plugins/searchableJsonFilterCreate.d.ts +2 -0
  103. package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js +65 -0
  104. package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js.map +1 -0
  105. package/operations/entry/filtering/sort.d.ts +12 -0
  106. package/operations/entry/filtering/sort.js +71 -0
  107. package/operations/entry/filtering/sort.js.map +1 -0
  108. package/operations/entry/filtering/systemFields.d.ts +4 -0
  109. package/operations/entry/filtering/systemFields.js +90 -0
  110. package/operations/entry/filtering/systemFields.js.map +1 -0
  111. package/operations/entry/filtering/transform.d.ts +6 -0
  112. package/operations/entry/filtering/transform.js +18 -0
  113. package/operations/entry/filtering/transform.js.map +1 -0
  114. package/operations/entry/filtering/types.d.ts +40 -0
  115. package/operations/entry/filtering/types.js +7 -0
  116. package/operations/entry/filtering/types.js.map +1 -0
  117. package/operations/entry/filtering/values.d.ts +2 -0
  118. package/operations/entry/filtering/values.js +24 -0
  119. package/operations/entry/filtering/values.js.map +1 -0
  120. package/operations/entry/filtering/where.d.ts +5 -0
  121. package/operations/entry/filtering/where.js +35 -0
  122. package/operations/entry/filtering/where.js.map +1 -0
  123. package/operations/entry/index.d.ts +3 -3
  124. package/operations/entry/index.js +733 -284
  125. package/operations/entry/index.js.map +1 -1
  126. package/operations/entry/keys.js +2 -18
  127. package/operations/entry/keys.js.map +1 -1
  128. package/operations/group/index.d.ts +3 -3
  129. package/operations/group/index.js +33 -51
  130. package/operations/group/index.js.map +1 -1
  131. package/operations/model/index.d.ts +2 -2
  132. package/operations/model/index.js +25 -37
  133. package/operations/model/index.js.map +1 -1
  134. package/operations/system/index.d.ts +2 -2
  135. package/operations/system/index.js +18 -23
  136. package/operations/system/index.js.map +1 -1
  137. package/package.json +21 -26
  138. package/plugins/CmsEntryFieldFilterPathPlugin.d.ts +4 -3
  139. package/plugins/CmsEntryFieldFilterPathPlugin.js +11 -18
  140. package/plugins/CmsEntryFieldFilterPathPlugin.js.map +1 -1
  141. package/plugins/CmsEntryFieldFilterPlugin.d.ts +43 -0
  142. package/plugins/CmsEntryFieldFilterPlugin.js +27 -0
  143. package/plugins/CmsEntryFieldFilterPlugin.js.map +1 -0
  144. package/plugins/CmsEntryFieldSortingPlugin.d.ts +42 -0
  145. package/plugins/CmsEntryFieldSortingPlugin.js +27 -0
  146. package/plugins/CmsEntryFieldSortingPlugin.js.map +1 -0
  147. package/plugins/CmsFieldFilterValueTransformPlugin.d.ts +11 -0
  148. package/plugins/CmsFieldFilterValueTransformPlugin.js +23 -0
  149. package/plugins/CmsFieldFilterValueTransformPlugin.js.map +1 -0
  150. package/plugins/index.d.ts +3 -0
  151. package/plugins/index.js +36 -3
  152. package/plugins/index.js.map +1 -1
  153. package/types.d.ts +21 -14
  154. package/types.js +5 -6
  155. package/types.js.map +1 -1
  156. package/definitions/settings.d.ts +0 -9
  157. package/definitions/settings.js +0 -58
  158. package/definitions/settings.js.map +0 -1
  159. package/dynamoDb/storage/date.d.ts +0 -2
  160. package/dynamoDb/storage/date.js +0 -99
  161. package/dynamoDb/storage/date.js.map +0 -1
  162. package/operations/entry/systemFields.d.ts +0 -2
  163. package/operations/entry/systemFields.js +0 -74
  164. package/operations/entry/systemFields.js.map +0 -1
  165. package/operations/entry/utils.d.ts +0 -36
  166. package/operations/entry/utils.js +0 -680
  167. package/operations/entry/utils.js.map +0 -1
  168. package/operations/settings/index.d.ts +0 -7
  169. package/operations/settings/index.js +0 -135
  170. package/operations/settings/index.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"names":["createPartitionKey","tenant","toLowerCase","createSortKey","createKeys","params","PK","SK","createSystemStorageOperations","entity","create","system","keys","put","ex","WebinyError","message","code","error","update","get","getRecord","cleanupItem"],"sources":["index.ts"],"sourcesContent":["import {\n CmsSystem,\n CmsSystemStorageOperations,\n CmsSystemStorageOperationsCreateParams,\n CmsSystemStorageOperationsGetParams,\n CmsSystemStorageOperationsUpdateParams\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 } from \"@webiny/db-dynamodb/utils/cleanup\";\n\ninterface CreateSystemStorageOperationsParams {\n entity: Entity<any>;\n}\n\ninterface PartitionKeyParams {\n tenant: string;\n}\nconst createPartitionKey = ({ tenant }: PartitionKeyParams): string => {\n return `T#${tenant.toLowerCase()}#SYSTEM`;\n};\nconst createSortKey = (): string => {\n return \"CMS\";\n};\n\ninterface Keys {\n PK: string;\n SK: string;\n}\nconst createKeys = (params: PartitionKeyParams): Keys => {\n return {\n PK: createPartitionKey(params),\n SK: createSortKey()\n };\n};\n\nexport const createSystemStorageOperations = (\n params: CreateSystemStorageOperationsParams\n): CmsSystemStorageOperations => {\n const { entity } = params;\n\n const create = async ({ system }: CmsSystemStorageOperationsCreateParams) => {\n const keys = createKeys(system);\n try {\n await entity.put({\n ...system,\n ...keys\n });\n return system;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not create system.\",\n ex.code || \"CREATE_SYSTEM_ERROR\",\n {\n error: ex,\n system,\n keys\n }\n );\n }\n };\n\n const update = async (params: CmsSystemStorageOperationsUpdateParams) => {\n const { system } = params;\n\n const keys = createKeys(system);\n\n try {\n await entity.put({\n ...system,\n ...keys\n });\n return system;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not update system.\",\n ex.code || \"UPDATE_SYSTEM_ERROR\",\n {\n error: ex,\n system,\n keys\n }\n );\n }\n };\n\n const get = async (params: CmsSystemStorageOperationsGetParams) => {\n const keys = createKeys(params);\n\n try {\n const system = await getRecord<CmsSystem>({\n entity,\n keys\n });\n return cleanupItem(entity, system);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not get system.\",\n ex.code || \"GET_SYSTEM_ERROR\",\n {\n error: ex,\n keys\n }\n );\n }\n };\n\n return {\n create,\n update,\n get\n };\n};\n"],"mappings":";;;;;;;;;;;AAQA;;AACA;;AACA;;AASA,MAAMA,kBAAkB,GAAG,CAAC;EAAEC;AAAF,CAAD,KAA4C;EACnE,OAAQ,KAAIA,MAAM,CAACC,WAAP,EAAqB,SAAjC;AACH,CAFD;;AAGA,MAAMC,aAAa,GAAG,MAAc;EAChC,OAAO,KAAP;AACH,CAFD;;AAQA,MAAMC,UAAU,GAAIC,MAAD,IAAsC;EACrD,OAAO;IACHC,EAAE,EAAEN,kBAAkB,CAACK,MAAD,CADnB;IAEHE,EAAE,EAAEJ,aAAa;EAFd,CAAP;AAIH,CALD;;AAOO,MAAMK,6BAA6B,GACtCH,MADyC,IAEZ;EAC7B,MAAM;IAAEI;EAAF,IAAaJ,MAAnB;;EAEA,MAAMK,MAAM,GAAG,OAAO;IAAEC;EAAF,CAAP,KAA8D;IACzE,MAAMC,IAAI,GAAGR,UAAU,CAACO,MAAD,CAAvB;;IACA,IAAI;MACA,MAAMF,MAAM,CAACI,GAAP,6DACCF,MADD,GAECC,IAFD,EAAN;MAIA,OAAOD,MAAP;IACH,CAND,CAME,OAAOG,EAAP,EAAW;MACT,MAAM,IAAIC,cAAJ,CACFD,EAAE,CAACE,OAAH,IAAc,0BADZ,EAEFF,EAAE,CAACG,IAAH,IAAW,qBAFT,EAGF;QACIC,KAAK,EAAEJ,EADX;QAEIH,MAFJ;QAGIC;MAHJ,CAHE,CAAN;IASH;EACJ,CAnBD;;EAqBA,MAAMO,MAAM,GAAG,MAAOd,MAAP,IAA0D;IACrE,MAAM;MAAEM;IAAF,IAAaN,MAAnB;IAEA,MAAMO,IAAI,GAAGR,UAAU,CAACO,MAAD,CAAvB;;IAEA,IAAI;MACA,MAAMF,MAAM,CAACI,GAAP,6DACCF,MADD,GAECC,IAFD,EAAN;MAIA,OAAOD,MAAP;IACH,CAND,CAME,OAAOG,EAAP,EAAW;MACT,MAAM,IAAIC,cAAJ,CACFD,EAAE,CAACE,OAAH,IAAc,0BADZ,EAEFF,EAAE,CAACG,IAAH,IAAW,qBAFT,EAGF;QACIC,KAAK,EAAEJ,EADX;QAEIH,MAFJ;QAGIC;MAHJ,CAHE,CAAN;IASH;EACJ,CAtBD;;EAwBA,MAAMQ,GAAG,GAAG,MAAOf,MAAP,IAAuD;IAC/D,MAAMO,IAAI,GAAGR,UAAU,CAACC,MAAD,CAAvB;;IAEA,IAAI;MACA,MAAMM,MAAM,GAAG,MAAM,IAAAU,QAAA,EAAqB;QACtCZ,MADsC;QAEtCG;MAFsC,CAArB,CAArB;MAIA,OAAO,IAAAU,oBAAA,EAAYb,MAAZ,EAAoBE,MAApB,CAAP;IACH,CAND,CAME,OAAOG,EAAP,EAAW;MACT,MAAM,IAAIC,cAAJ,CACFD,EAAE,CAACE,OAAH,IAAc,uBADZ,EAEFF,EAAE,CAACG,IAAH,IAAW,kBAFT,EAGF;QACIC,KAAK,EAAEJ,EADX;QAEIF;MAFJ,CAHE,CAAN;IAQH;EACJ,CAnBD;;EAqBA,OAAO;IACHF,MADG;IAEHS,MAFG;IAGHC;EAHG,CAAP;AAKH,CA5EM"}
1
+ {"version":3,"names":["_error","_interopRequireDefault","require","_get","_dbDynamodb","createPartitionKey","tenant","toLowerCase","createSortKey","createKeys","params","PK","SK","createSystemStorageOperations","entity","create","system","keys","put","item","ex","WebinyError","message","code","error","update","get","getClean","exports"],"sources":["index.ts"],"sourcesContent":["import type {\n CmsSystem,\n CmsSystemStorageOperations,\n CmsSystemStorageOperationsCreateParams,\n CmsSystemStorageOperationsGetParams,\n CmsSystemStorageOperationsUpdateParams\n} from \"@webiny/api-headless-cms/types\";\nimport type { Entity } from \"@webiny/db-dynamodb/toolbox\";\nimport WebinyError from \"@webiny/error\";\nimport { getClean } from \"@webiny/db-dynamodb/utils/get\";\nimport { put } from \"@webiny/db-dynamodb\";\n\ninterface CreateSystemStorageOperationsParams {\n entity: Entity<any>;\n}\n\ninterface PartitionKeyParams {\n tenant: string;\n}\nconst createPartitionKey = ({ tenant }: PartitionKeyParams): string => {\n return `T#${tenant.toLowerCase()}#SYSTEM`;\n};\nconst createSortKey = (): string => {\n return \"CMS\";\n};\n\ninterface Keys {\n PK: string;\n SK: string;\n}\nconst createKeys = (params: PartitionKeyParams): Keys => {\n return {\n PK: createPartitionKey(params),\n SK: createSortKey()\n };\n};\n\nexport const createSystemStorageOperations = (\n params: CreateSystemStorageOperationsParams\n): CmsSystemStorageOperations => {\n const { entity } = params;\n\n const create = async ({ system }: CmsSystemStorageOperationsCreateParams) => {\n const keys = createKeys(system);\n try {\n await put({\n entity,\n item: {\n ...system,\n ...keys\n }\n });\n return system;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not create system.\",\n ex.code || \"CREATE_SYSTEM_ERROR\",\n {\n error: ex,\n system,\n keys\n }\n );\n }\n };\n\n const update = async (params: CmsSystemStorageOperationsUpdateParams) => {\n const { system } = params;\n\n const keys = createKeys(system);\n\n try {\n await put({\n entity,\n item: {\n ...system,\n ...keys\n }\n });\n return system;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not update system.\",\n ex.code || \"UPDATE_SYSTEM_ERROR\",\n {\n error: ex,\n system,\n keys\n }\n );\n }\n };\n\n const get = async (params: CmsSystemStorageOperationsGetParams) => {\n const keys = createKeys(params);\n\n try {\n return await getClean<CmsSystem>({\n entity,\n keys\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not get system.\",\n ex.code || \"GET_SYSTEM_ERROR\",\n {\n error: ex,\n keys\n }\n );\n }\n };\n\n return {\n create,\n update,\n get\n };\n};\n"],"mappings":";;;;;;;AAQA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AASA,MAAMG,kBAAkB,GAAGA,CAAC;EAAEC;AAA2B,CAAC,KAAa;EACnE,OAAO,KAAKA,MAAM,CAACC,WAAW,CAAC,CAAC,SAAS;AAC7C,CAAC;AACD,MAAMC,aAAa,GAAGA,CAAA,KAAc;EAChC,OAAO,KAAK;AAChB,CAAC;AAMD,MAAMC,UAAU,GAAIC,MAA0B,IAAW;EACrD,OAAO;IACHC,EAAE,EAAEN,kBAAkB,CAACK,MAAM,CAAC;IAC9BE,EAAE,EAAEJ,aAAa,CAAC;EACtB,CAAC;AACL,CAAC;AAEM,MAAMK,6BAA6B,GACtCH,MAA2C,IACd;EAC7B,MAAM;IAAEI;EAAO,CAAC,GAAGJ,MAAM;EAEzB,MAAMK,MAAM,GAAG,MAAAA,CAAO;IAAEC;EAA+C,CAAC,KAAK;IACzE,MAAMC,IAAI,GAAGR,UAAU,CAACO,MAAM,CAAC;IAC/B,IAAI;MACA,MAAM,IAAAE,eAAG,EAAC;QACNJ,MAAM;QACNK,IAAI,EAAE;UACF,GAAGH,MAAM;UACT,GAAGC;QACP;MACJ,CAAC,CAAC;MACF,OAAOD,MAAM;IACjB,CAAC,CAAC,OAAOI,EAAE,EAAE;MACT,MAAM,IAAIC,cAAW,CACjBD,EAAE,CAACE,OAAO,IAAI,0BAA0B,EACxCF,EAAE,CAACG,IAAI,IAAI,qBAAqB,EAChC;QACIC,KAAK,EAAEJ,EAAE;QACTJ,MAAM;QACNC;MACJ,CACJ,CAAC;IACL;EACJ,CAAC;EAED,MAAMQ,MAAM,GAAG,MAAOf,MAA8C,IAAK;IACrE,MAAM;MAAEM;IAAO,CAAC,GAAGN,MAAM;IAEzB,MAAMO,IAAI,GAAGR,UAAU,CAACO,MAAM,CAAC;IAE/B,IAAI;MACA,MAAM,IAAAE,eAAG,EAAC;QACNJ,MAAM;QACNK,IAAI,EAAE;UACF,GAAGH,MAAM;UACT,GAAGC;QACP;MACJ,CAAC,CAAC;MACF,OAAOD,MAAM;IACjB,CAAC,CAAC,OAAOI,EAAE,EAAE;MACT,MAAM,IAAIC,cAAW,CACjBD,EAAE,CAACE,OAAO,IAAI,0BAA0B,EACxCF,EAAE,CAACG,IAAI,IAAI,qBAAqB,EAChC;QACIC,KAAK,EAAEJ,EAAE;QACTJ,MAAM;QACNC;MACJ,CACJ,CAAC;IACL;EACJ,CAAC;EAED,MAAMS,GAAG,GAAG,MAAOhB,MAA2C,IAAK;IAC/D,MAAMO,IAAI,GAAGR,UAAU,CAACC,MAAM,CAAC;IAE/B,IAAI;MACA,OAAO,MAAM,IAAAiB,aAAQ,EAAY;QAC7Bb,MAAM;QACNG;MACJ,CAAC,CAAC;IACN,CAAC,CAAC,OAAOG,EAAE,EAAE;MACT,MAAM,IAAIC,cAAW,CACjBD,EAAE,CAACE,OAAO,IAAI,uBAAuB,EACrCF,EAAE,CAACG,IAAI,IAAI,kBAAkB,EAC7B;QACIC,KAAK,EAAEJ,EAAE;QACTH;MACJ,CACJ,CAAC;IACL;EACJ,CAAC;EAED,OAAO;IACHF,MAAM;IACNU,MAAM;IACNC;EACJ,CAAC;AACL,CAAC;AAACE,OAAA,CAAAf,6BAAA,GAAAA,6BAAA","ignoreList":[]}
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@webiny/api-headless-cms-ddb",
3
- "version": "0.0.0-unstable.40876133bb",
3
+ "version": "0.0.0-unstable.461c047ab7",
4
4
  "main": "index.js",
5
5
  "keywords": [
6
6
  "@webiny/api-headless-cms",
7
7
  "storage-operations",
8
8
  "dynamodb",
9
+ "ddb",
9
10
  "cms:ddb"
10
11
  ],
11
12
  "repository": {
@@ -21,40 +22,34 @@
21
22
  ],
22
23
  "license": "MIT",
23
24
  "dependencies": {
24
- "@babel/runtime": "7.19.0",
25
- "@webiny/api-headless-cms": "0.0.0-unstable.40876133bb",
26
- "@webiny/db-dynamodb": "0.0.0-unstable.40876133bb",
27
- "@webiny/error": "0.0.0-unstable.40876133bb",
28
- "@webiny/handler-db": "0.0.0-unstable.40876133bb",
29
- "@webiny/utils": "0.0.0-unstable.40876133bb",
30
- "aws-sdk": "2.1230.0",
31
- "dataloader": "2.1.0",
25
+ "@webiny/api": "0.0.0-unstable.461c047ab7",
26
+ "@webiny/api-headless-cms": "0.0.0-unstable.461c047ab7",
27
+ "@webiny/aws-sdk": "0.0.0-unstable.461c047ab7",
28
+ "@webiny/db-dynamodb": "0.0.0-unstable.461c047ab7",
29
+ "@webiny/error": "0.0.0-unstable.461c047ab7",
30
+ "@webiny/handler-db": "0.0.0-unstable.461c047ab7",
31
+ "@webiny/utils": "0.0.0-unstable.461c047ab7",
32
+ "dataloader": "2.2.3",
33
+ "dot-object": "2.1.5",
32
34
  "dot-prop": "6.0.1",
33
- "dynamodb-toolbox": "0.3.5",
34
- "jsonpack": "1.1.5",
35
35
  "lodash": "4.17.21"
36
36
  },
37
37
  "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.40876133bb",
43
- "@webiny/plugins": "^0.0.0-unstable.40876133bb",
44
- "@webiny/project-utils": "^0.0.0-unstable.40876133bb",
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"
38
+ "@types/dot-object": "2.1.6",
39
+ "@types/jsonpack": "1.1.6",
40
+ "@webiny/plugins": "0.0.0-unstable.461c047ab7",
41
+ "@webiny/project-utils": "0.0.0-unstable.461c047ab7",
42
+ "jest": "29.7.0",
43
+ "jest-dynalite": "3.6.1",
44
+ "typescript": "5.3.3"
50
45
  },
51
46
  "publishConfig": {
52
47
  "access": "public",
53
48
  "directory": "dist"
54
49
  },
55
50
  "scripts": {
56
- "build": "yarn webiny run build",
57
- "watch": "yarn webiny run watch"
51
+ "build": "node ../cli/bin.js run build",
52
+ "watch": "node ../cli/bin.js run watch"
58
53
  },
59
- "gitHead": "f33811072795d25c5787ae39808e75e3312fb247"
54
+ "gitHead": "461c047ab7dd75a537e760dc6e917d21fedfaaae"
60
55
  }
@@ -1,7 +1,7 @@
1
1
  import { Plugin } from "@webiny/plugins/Plugin";
2
- import { CmsModelField } from "@webiny/api-headless-cms/types";
2
+ import type { CmsModelField } from "@webiny/api-headless-cms/types";
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,48 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.CmsEntryFieldFilterPathPlugin = void 0;
9
-
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
12
8
  var _error = _interopRequireDefault(require("@webiny/error"));
13
-
14
9
  var _Plugin = require("@webiny/plugins/Plugin");
15
-
16
10
  class CmsEntryFieldFilterPathPlugin extends _Plugin.Plugin {
11
+ static type = "cms-field-filter-path";
17
12
  get fieldType() {
18
13
  return this.config.fieldType;
19
14
  }
20
-
21
15
  constructor(config) {
22
16
  super();
23
- (0, _defineProperty2.default)(this, "config", void 0);
24
17
  this.config = config;
18
+
19
+ /**
20
+ * We expect error here because we know that `this.constructor.type` is defined, but TS does not.
21
+ */
22
+ // @ts-expect-error
25
23
  this.name = `${this.constructor.type}-${this.config.fieldType}`;
26
24
  }
27
-
28
- canUse(field) {
25
+ canUse(field, parents) {
29
26
  if (field.type !== this.config.fieldType) {
30
27
  return false;
28
+ } else if (this.config.canUse) {
29
+ return this.config.canUse(field, parents);
31
30
  }
32
-
33
31
  const fieldId = this.config.fieldId;
34
-
35
32
  if (!fieldId || Array.isArray(fieldId) === false || fieldId.length === 0) {
36
33
  return true;
37
34
  }
38
-
39
35
  return fieldId.includes(field.fieldId);
40
36
  }
41
-
42
37
  createPath(params) {
43
38
  if (typeof this.config.path === "function") {
44
39
  return this.config.path(params);
45
40
  } else if (typeof this.config.path === "string") {
46
41
  return this.config.path;
47
42
  }
48
-
49
43
  throw new _error.default(`Missing path in "${this.name}" plugin.`);
50
44
  }
51
-
52
45
  }
53
-
54
46
  exports.CmsEntryFieldFilterPathPlugin = CmsEntryFieldFilterPathPlugin;
55
- (0, _defineProperty2.default)(CmsEntryFieldFilterPathPlugin, "type", "cms-field-filter-path");
47
+
48
+ //# 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,"names":["_error","_interopRequireDefault","require","_Plugin","CmsEntryFieldFilterPathPlugin","Plugin","type","fieldType","config","constructor","name","canUse","field","parents","fieldId","Array","isArray","length","includes","createPath","params","path","WebinyError","exports"],"sources":["CmsEntryFieldFilterPathPlugin.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { Plugin } from \"@webiny/plugins/Plugin\";\nimport type { CmsModelField } from \"@webiny/api-headless-cms/types\";\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"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAgBO,MAAME,6BAA6B,SAASC,cAAM,CAAC;EACtD,OAAgCC,IAAI,GAAW,uBAAuB;EAItE,IAAWC,SAASA,CAAA,EAAW;IAC3B,OAAO,IAAI,CAACC,MAAM,CAACD,SAAS;EAChC;EAEOE,WAAWA,CAACD,MAA2C,EAAE;IAC5D,KAAK,CAAC,CAAC;IAEP,IAAI,CAACA,MAAM,GAAGA,MAAM;;IAEpB;AACR;AACA;IACQ;IACA,IAAI,CAACE,IAAI,GAAG,GAAG,IAAI,CAACD,WAAW,CAACH,IAAI,IAAI,IAAI,CAACE,MAAM,CAACD,SAAS,EAAE;EACnE;EAEOI,MAAMA,CAACC,KAA8C,EAAEC,OAAiB,EAAW;IACtF,IAAID,KAAK,CAACN,IAAI,KAAK,IAAI,CAACE,MAAM,CAACD,SAAS,EAAE;MACtC,OAAO,KAAK;IAChB,CAAC,MAAM,IAAI,IAAI,CAACC,MAAM,CAACG,MAAM,EAAE;MAC3B,OAAO,IAAI,CAACH,MAAM,CAACG,MAAM,CAACC,KAAK,EAAEC,OAAO,CAAC;IAC7C;IACA,MAAMC,OAAO,GAAG,IAAI,CAACN,MAAM,CAACM,OAAO;IACnC,IAAI,CAACA,OAAO,IAAIC,KAAK,CAACC,OAAO,CAACF,OAAO,CAAC,KAAK,KAAK,IAAIA,OAAO,CAACG,MAAM,KAAK,CAAC,EAAE;MACtE,OAAO,IAAI;IACf;IACA,OAAOH,OAAO,CAACI,QAAQ,CAACN,KAAK,CAACE,OAAO,CAAC;EAC1C;EAEOK,UAAUA,CAACC,MAAgC,EAAU;IACxD,IAAI,OAAO,IAAI,CAACZ,MAAM,CAACa,IAAI,KAAK,UAAU,EAAE;MACxC,OAAO,IAAI,CAACb,MAAM,CAACa,IAAI,CAACD,MAAM,CAAC;IACnC,CAAC,MAAM,IAAI,OAAO,IAAI,CAACZ,MAAM,CAACa,IAAI,KAAK,QAAQ,EAAE;MAC7C,OAAO,IAAI,CAACb,MAAM,CAACa,IAAI;IAC3B;IACA,MAAM,IAAIC,cAAW,CAAC,oBAAoB,IAAI,CAACZ,IAAI,WAAW,CAAC;EACnE;AACJ;AAACa,OAAA,CAAAnB,6BAAA,GAAAA,6BAAA","ignoreList":[]}
@@ -0,0 +1,43 @@
1
+ import { Plugin } from "@webiny/plugins";
2
+ import type { ValueFilterPlugin } from "@webiny/db-dynamodb/plugins/definitions/ValueFilterPlugin";
3
+ import type { Field } from "../operations/entry/filtering/types";
4
+ import type { CmsFieldFilterValueTransformPlugin } from "../types";
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
+ valueFilterPlugins: Record<string, ValueFilterPlugin>;
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
+ plugin: ValueFilterPlugin;
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,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.CmsEntryFieldFilterPlugin = void 0;
7
+ var _plugins = require("@webiny/plugins");
8
+ /**
9
+ * This plugin is used to create the filter.
10
+ * Internally we have default one + the one for the reference field - because it is actually an object when filtering.
11
+ */
12
+
13
+ class CmsEntryFieldFilterPlugin extends _plugins.Plugin {
14
+ static type = "cms.dynamodb.entry.field.filter";
15
+ static ALL = "*";
16
+ constructor(config) {
17
+ super();
18
+ this.config = config;
19
+ this.fieldType = this.config.fieldType;
20
+ }
21
+ create(params) {
22
+ return this.config.create(params);
23
+ }
24
+ }
25
+ exports.CmsEntryFieldFilterPlugin = CmsEntryFieldFilterPlugin;
26
+
27
+ //# sourceMappingURL=CmsEntryFieldFilterPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_plugins","require","CmsEntryFieldFilterPlugin","Plugin","type","ALL","constructor","config","fieldType","create","params","exports"],"sources":["CmsEntryFieldFilterPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport type { ValueFilterPlugin } from \"@webiny/db-dynamodb/plugins/definitions/ValueFilterPlugin\";\nimport type { Field } from \"~/operations/entry/filtering/types\";\nimport type { CmsFieldFilterValueTransformPlugin } from \"~/types\";\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 valueFilterPlugins: Record<string, ValueFilterPlugin>;\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 plugin: ValueFilterPlugin;\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"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAKA;AACA;AACA;AACA;;AAiCO,MAAMC,yBAAyB,SAAkBC,eAAM,CAAC;EAC3D,OAAgCC,IAAI,GAAW,iCAAiC;EAChF,OAAuBC,GAAG,GAAW,GAAG;EAMjCC,WAAWA,CAACC,MAA0C,EAAE;IAC3D,KAAK,CAAC,CAAC;IACP,IAAI,CAACA,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACC,SAAS,GAAG,IAAI,CAACD,MAAM,CAACC,SAAS;EAC1C;EAEOC,MAAMA,CAACC,MAAgD,EAAE;IAC5D,OAAO,IAAI,CAACH,MAAM,CAACE,MAAM,CAACC,MAAM,CAAC;EACrC;AACJ;AAACC,OAAA,CAAAT,yBAAA,GAAAA,yBAAA","ignoreList":[]}
@@ -0,0 +1,42 @@
1
+ import { Plugin } from "@webiny/plugins";
2
+ import type { Field } from "../operations/entry/filtering/types";
3
+ import type { CmsModel } from "@webiny/api-headless-cms/types";
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,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createCmsEntryFieldSortingPlugin = exports.CmsEntryFieldSortingPlugin = void 0;
7
+ var _plugins = require("@webiny/plugins");
8
+ class CmsEntryFieldSortingPlugin extends _plugins.Plugin {
9
+ static type = "cms.entry.field.sorting";
10
+ constructor(config) {
11
+ super();
12
+ this.config = config;
13
+ }
14
+ canUse(params) {
15
+ return this.config.canUse(params);
16
+ }
17
+ createSort(params) {
18
+ return this.config.createSort(params);
19
+ }
20
+ }
21
+ exports.CmsEntryFieldSortingPlugin = CmsEntryFieldSortingPlugin;
22
+ const createCmsEntryFieldSortingPlugin = config => {
23
+ return new CmsEntryFieldSortingPlugin(config);
24
+ };
25
+ exports.createCmsEntryFieldSortingPlugin = createCmsEntryFieldSortingPlugin;
26
+
27
+ //# sourceMappingURL=CmsEntryFieldSortingPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_plugins","require","CmsEntryFieldSortingPlugin","Plugin","type","constructor","config","canUse","params","createSort","exports","createCmsEntryFieldSortingPlugin"],"sources":["CmsEntryFieldSortingPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport type { Field } from \"~/operations/entry/filtering/types\";\nimport type { CmsModel } from \"@webiny/api-headless-cms/types\";\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"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAwCO,MAAMC,0BAA0B,SAASC,eAAM,CAAC;EACnD,OAAgCC,IAAI,GAAW,yBAAyB;EAGjEC,WAAWA,CAACC,MAAwC,EAAE;IACzD,KAAK,CAAC,CAAC;IACP,IAAI,CAACA,MAAM,GAAGA,MAAM;EACxB;EAEOC,MAAMA,CAACC,MAA8C,EAAW;IACnE,OAAO,IAAI,CAACF,MAAM,CAACC,MAAM,CAACC,MAAM,CAAC;EACrC;EAEOC,UAAUA,CACbD,MAAkD,EACR;IAC1C,OAAO,IAAI,CAACF,MAAM,CAACG,UAAU,CAACD,MAAM,CAAC;EACzC;AACJ;AAACE,OAAA,CAAAR,0BAAA,GAAAA,0BAAA;AAEM,MAAMS,gCAAgC,GAAIL,MAAwC,IAAK;EAC1F,OAAO,IAAIJ,0BAA0B,CAACI,MAAM,CAAC;AACjD,CAAC;AAACI,OAAA,CAAAC,gCAAA,GAAAA,gCAAA","ignoreList":[]}
@@ -0,0 +1,11 @@
1
+ import { Plugin } from "@webiny/plugins";
2
+ import type { CmsFieldFilterValueTransformPlugin as CmsFieldFilterValueTransformPluginInterface } from "../types";
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,23 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.CmsFieldFilterValueTransformPlugin = void 0;
7
+ var _plugins = require("@webiny/plugins");
8
+ class CmsFieldFilterValueTransformPlugin extends _plugins.Plugin {
9
+ static type = "cms-field-filter-value-transform";
10
+ get fieldType() {
11
+ return this.config.fieldType;
12
+ }
13
+ get transform() {
14
+ return this.config.transform;
15
+ }
16
+ constructor(config) {
17
+ super();
18
+ this.config = config;
19
+ }
20
+ }
21
+ exports.CmsFieldFilterValueTransformPlugin = CmsFieldFilterValueTransformPlugin;
22
+
23
+ //# sourceMappingURL=CmsFieldFilterValueTransformPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_plugins","require","CmsFieldFilterValueTransformPlugin","Plugin","type","fieldType","config","transform","constructor","exports"],"sources":["CmsFieldFilterValueTransformPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport type { CmsFieldFilterValueTransformPlugin as CmsFieldFilterValueTransformPluginInterface } from \"~/types\";\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"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAOO,MAAMC,kCAAkC,SACnCC,eAAM,CAElB;EACI,OAAuBC,IAAI,GAAG,kCAAkC;EAIhE,IAAWC,SAASA,CAAA,EAAW;IAC3B,OAAO,IAAI,CAACC,MAAM,CAACD,SAAS;EAChC;EAEA,IAAWE,SAASA,CAAA,EAA0D;IAC1E,OAAO,IAAI,CAACD,MAAM,CAACC,SAAS;EAChC;EAEOC,WAAWA,CAACF,MAAgD,EAAE;IACjE,KAAK,CAAC,CAAC;IACP,IAAI,CAACA,MAAM,GAAGA,MAAM;EACxB;AACJ;AAACG,OAAA,CAAAP,kCAAA,GAAAA,kCAAA","ignoreList":[]}
@@ -1 +1,4 @@
1
1
  export * from "./CmsEntryFieldFilterPathPlugin";
2
+ export * from "./CmsEntryFieldSortingPlugin";
3
+ export * from "./CmsEntryFieldFilterPlugin";
4
+ export * from "./CmsFieldFilterValueTransformPlugin";
package/plugins/index.js CHANGED
@@ -3,9 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
-
7
6
  var _CmsEntryFieldFilterPathPlugin = require("./CmsEntryFieldFilterPathPlugin");
8
-
9
7
  Object.keys(_CmsEntryFieldFilterPathPlugin).forEach(function (key) {
10
8
  if (key === "default" || key === "__esModule") return;
11
9
  if (key in exports && exports[key] === _CmsEntryFieldFilterPathPlugin[key]) return;
@@ -15,4 +13,39 @@ Object.keys(_CmsEntryFieldFilterPathPlugin).forEach(function (key) {
15
13
  return _CmsEntryFieldFilterPathPlugin[key];
16
14
  }
17
15
  });
18
- });
16
+ });
17
+ var _CmsEntryFieldSortingPlugin = require("./CmsEntryFieldSortingPlugin");
18
+ Object.keys(_CmsEntryFieldSortingPlugin).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _CmsEntryFieldSortingPlugin[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function () {
24
+ return _CmsEntryFieldSortingPlugin[key];
25
+ }
26
+ });
27
+ });
28
+ var _CmsEntryFieldFilterPlugin = require("./CmsEntryFieldFilterPlugin");
29
+ Object.keys(_CmsEntryFieldFilterPlugin).forEach(function (key) {
30
+ if (key === "default" || key === "__esModule") return;
31
+ if (key in exports && exports[key] === _CmsEntryFieldFilterPlugin[key]) return;
32
+ Object.defineProperty(exports, key, {
33
+ enumerable: true,
34
+ get: function () {
35
+ return _CmsEntryFieldFilterPlugin[key];
36
+ }
37
+ });
38
+ });
39
+ var _CmsFieldFilterValueTransformPlugin = require("./CmsFieldFilterValueTransformPlugin");
40
+ Object.keys(_CmsFieldFilterValueTransformPlugin).forEach(function (key) {
41
+ if (key === "default" || key === "__esModule") return;
42
+ if (key in exports && exports[key] === _CmsFieldFilterValueTransformPlugin[key]) return;
43
+ Object.defineProperty(exports, key, {
44
+ enumerable: true,
45
+ get: function () {
46
+ return _CmsFieldFilterValueTransformPlugin[key];
47
+ }
48
+ });
49
+ });
50
+
51
+ //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./CmsEntryFieldFilterPathPlugin\";\n"],"mappings":";;;;;;AAAA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
1
+ {"version":3,"names":["_CmsEntryFieldFilterPathPlugin","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_CmsEntryFieldSortingPlugin","_CmsEntryFieldFilterPlugin","_CmsFieldFilterValueTransformPlugin"],"sources":["index.ts"],"sourcesContent":["export * from \"./CmsEntryFieldFilterPathPlugin\";\nexport * from \"./CmsEntryFieldSortingPlugin\";\nexport * from \"./CmsEntryFieldFilterPlugin\";\nexport * from \"./CmsFieldFilterValueTransformPlugin\";\n"],"mappings":";;;;;AAAA,IAAAA,8BAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,8BAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,8BAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,8BAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,2BAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,2BAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,2BAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,2BAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,0BAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,0BAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,0BAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,0BAAA,CAAAN,GAAA;IAAA;EAAA;AAAA;AACA,IAAAO,mCAAA,GAAAX,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAS,mCAAA,EAAAR,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAO,mCAAA,CAAAP,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAG,mCAAA,CAAAP,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
package/types.d.ts CHANGED
@@ -1,14 +1,14 @@
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 } from "@webiny/plugins/types";
2
+ import type { CmsEntryStorageOperations as BaseCmsEntryStorageOperations, CmsModel, CmsModelField, HeadlessCmsStorageOperations as BaseHeadlessCmsStorageOperations } from "@webiny/api-headless-cms/types";
3
+ import type { TableConstructor } from "@webiny/db-dynamodb/toolbox";
4
+ import type { AttributeDefinition } from "@webiny/db-dynamodb/toolbox";
5
+ import type { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";
6
+ import type { Entity, Table } from "@webiny/db-dynamodb/toolbox";
7
7
  interface CmsFieldFilterValueTransformParams {
8
8
  /**
9
9
  * A field which value we are transforming.
10
10
  */
11
- field: CmsModelField;
11
+ field: Partial<CmsModelField> & Pick<CmsModelField, "id" | "storageId" | "fieldId" | "settings">;
12
12
  value: any;
13
13
  }
14
14
  export interface CmsFieldFilterValueTransformPlugin extends Plugin {
@@ -25,29 +25,36 @@ export interface CmsFieldFilterValueTransformPlugin extends Plugin {
25
25
  */
26
26
  transform: (params: CmsFieldFilterValueTransformParams) => any;
27
27
  }
28
- export declare type AttributeDefinition = DynamoDBTypes | EntityAttributeConfig | EntityCompositeAttributes;
29
- export declare type Attributes = Record<string, AttributeDefinition>;
28
+ export type Attributes = Record<string, AttributeDefinition>;
30
29
  export declare enum ENTITIES {
31
30
  SYSTEM = "CmsSystem",
32
- SETTINGS = "CmsSettings",
33
31
  GROUPS = "CmsGroups",
34
32
  MODELS = "CmsModels",
35
33
  ENTRIES = "CmsEntries"
36
34
  }
37
35
  export interface TableModifier {
38
- (table: TableConstructor): TableConstructor;
36
+ (table: TableConstructor<string, string, string>): TableConstructor<string, string, string>;
39
37
  }
40
38
  export interface StorageOperationsFactoryParams {
41
- documentClient: DocumentClient;
39
+ documentClient: DynamoDBDocument;
42
40
  table?: TableModifier;
43
41
  attributes?: Record<ENTITIES, Attributes>;
44
42
  plugins?: Plugin[] | Plugin[][];
45
43
  }
46
44
  export interface HeadlessCmsStorageOperations extends BaseHeadlessCmsStorageOperations {
47
- getTable: () => Table;
48
- getEntities: () => Record<"system" | "settings" | "groups" | "models" | "entries", Entity<any>>;
45
+ getTable: () => Table<string, string, string>;
46
+ getEntities: () => Record<"system" | "groups" | "models" | "entries", Entity<any>>;
49
47
  }
50
48
  export interface StorageOperationsFactory {
51
49
  (params: StorageOperationsFactoryParams): HeadlessCmsStorageOperations;
52
50
  }
51
+ export interface CmsEntryStorageOperations extends BaseCmsEntryStorageOperations {
52
+ dataLoaders: DataLoadersHandlerInterface;
53
+ }
54
+ export interface DataLoadersHandlerInterfaceClearAllParams {
55
+ model: Pick<CmsModel, "tenant" | "locale">;
56
+ }
57
+ export interface DataLoadersHandlerInterface {
58
+ clearAll: (params?: DataLoadersHandlerInterfaceClearAllParams) => void;
59
+ }
53
60
  export {};
package/types.js CHANGED
@@ -4,13 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.ENTITIES = void 0;
7
- let ENTITIES;
8
- exports.ENTITIES = ENTITIES;
9
-
10
- (function (ENTITIES) {
7
+ let ENTITIES = exports.ENTITIES = /*#__PURE__*/function (ENTITIES) {
11
8
  ENTITIES["SYSTEM"] = "CmsSystem";
12
- ENTITIES["SETTINGS"] = "CmsSettings";
13
9
  ENTITIES["GROUPS"] = "CmsGroups";
14
10
  ENTITIES["MODELS"] = "CmsModels";
15
11
  ENTITIES["ENTRIES"] = "CmsEntries";
16
- })(ENTITIES || (exports.ENTITIES = ENTITIES = {}));
12
+ return ENTITIES;
13
+ }({});
14
+
15
+ //# 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,"names":["ENTITIES","exports"],"sources":["types.ts"],"sourcesContent":["import type { Plugin } from \"@webiny/plugins/types\";\nimport type {\n CmsEntryStorageOperations as BaseCmsEntryStorageOperations,\n CmsModel,\n CmsModelField,\n HeadlessCmsStorageOperations as BaseHeadlessCmsStorageOperations\n} from \"@webiny/api-headless-cms/types\";\nimport type { TableConstructor } from \"@webiny/db-dynamodb/toolbox\";\nimport type { AttributeDefinition } from \"@webiny/db-dynamodb/toolbox\";\nimport type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb\";\nimport type { Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\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 type Attributes = Record<string, AttributeDefinition>;\n\nexport enum ENTITIES {\n SYSTEM = \"CmsSystem\",\n GROUPS = \"CmsGroups\",\n MODELS = \"CmsModels\",\n ENTRIES = \"CmsEntries\"\n}\n\nexport interface TableModifier {\n (table: TableConstructor<string, string, string>): TableConstructor<string, string, string>;\n}\n\nexport interface StorageOperationsFactoryParams {\n documentClient: DynamoDBDocument;\n table?: TableModifier;\n attributes?: Record<ENTITIES, Attributes>;\n plugins?: Plugin[] | Plugin[][];\n}\n\nexport interface HeadlessCmsStorageOperations extends BaseHeadlessCmsStorageOperations {\n getTable: () => Table<string, string, string>;\n getEntities: () => Record<\"system\" | \"groups\" | \"models\" | \"entries\", Entity<any>>;\n}\n\nexport interface StorageOperationsFactory {\n (params: StorageOperationsFactoryParams): HeadlessCmsStorageOperations;\n}\n\nexport interface CmsEntryStorageOperations extends BaseCmsEntryStorageOperations {\n dataLoaders: DataLoadersHandlerInterface;\n}\n\nexport interface DataLoadersHandlerInterfaceClearAllParams {\n model: Pick<CmsModel, \"tenant\" | \"locale\">;\n}\nexport interface DataLoadersHandlerInterface {\n clearAll: (params?: DataLoadersHandlerInterfaceClearAllParams) => void;\n}\n"],"mappings":";;;;;;IAsCYA,QAAQ,GAAAC,OAAA,CAAAD,QAAA,0BAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAAA,OAARA,QAAQ;AAAA","ignoreList":[]}
@@ -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 {};