@webiny/api-headless-cms-bulk-actions 0.0.0-unstable.461c047ab7 → 0.0.0-unstable.48a4e5b6c1

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 (199) hide show
  1. package/HcmsBulkActionsFeature.d.ts +7 -0
  2. package/HcmsBulkActionsFeature.js +32 -0
  3. package/HcmsBulkActionsFeature.js.map +1 -0
  4. package/README.md +10 -14
  5. package/abstractions/IUseCase.js +0 -7
  6. package/abstractions/index.d.ts +1 -3
  7. package/abstractions/index.js +0 -40
  8. package/domain/BulkActionName.d.ts +3 -0
  9. package/domain/BulkActionName.js +14 -0
  10. package/domain/BulkActionName.js.map +1 -0
  11. package/exports/api/cms/entry.d.ts +1 -0
  12. package/exports/api/cms/entry.js +1 -0
  13. package/features/DeleteEntriesBulkAction/DeleteEntriesBulkAction.d.ts +15 -0
  14. package/features/DeleteEntriesBulkAction/DeleteEntriesBulkAction.js +32 -0
  15. package/features/DeleteEntriesBulkAction/DeleteEntriesBulkAction.js.map +1 -0
  16. package/features/DeleteEntriesBulkAction/feature.d.ts +4 -0
  17. package/features/DeleteEntriesBulkAction/feature.js +11 -0
  18. package/features/DeleteEntriesBulkAction/feature.js.map +1 -0
  19. package/features/EntriesBulkAction/abstractions.d.ts +38 -0
  20. package/features/EntriesBulkAction/abstractions.js +6 -0
  21. package/features/EntriesBulkAction/abstractions.js.map +1 -0
  22. package/features/EntriesBulkAction/createBulkActionTasks.d.ts +67 -0
  23. package/features/EntriesBulkAction/createBulkActionTasks.js +179 -0
  24. package/features/EntriesBulkAction/createBulkActionTasks.js.map +1 -0
  25. package/features/EntriesBulkAction/internals/ChildTasksCleanup.d.ts +20 -0
  26. package/features/EntriesBulkAction/internals/ChildTasksCleanup.js +42 -0
  27. package/features/EntriesBulkAction/internals/ChildTasksCleanup.js.map +1 -0
  28. package/features/EntriesBulkAction/internals/CreateTasksByModel.d.ts +17 -0
  29. package/features/EntriesBulkAction/internals/CreateTasksByModel.js +77 -0
  30. package/features/EntriesBulkAction/internals/CreateTasksByModel.js.map +1 -0
  31. package/features/EntriesBulkAction/internals/ProcessTask.d.ts +18 -0
  32. package/features/EntriesBulkAction/internals/ProcessTask.js +47 -0
  33. package/features/EntriesBulkAction/internals/ProcessTask.js.map +1 -0
  34. package/{useCases/internals/ProcessTask/Result.d.ts → features/EntriesBulkAction/internals/ProcessTaskResult.d.ts} +1 -1
  35. package/features/EntriesBulkAction/internals/ProcessTaskResult.js +23 -0
  36. package/features/EntriesBulkAction/internals/ProcessTaskResult.js.map +1 -0
  37. package/features/EntriesBulkAction/internals/ProcessTasksByModel.d.ts +13 -0
  38. package/features/EntriesBulkAction/internals/ProcessTasksByModel.js +45 -0
  39. package/features/EntriesBulkAction/internals/ProcessTasksByModel.js.map +1 -0
  40. package/{useCases/internals/CreateTasksByModel → features/EntriesBulkAction/internals}/TaskCache.d.ts +9 -7
  41. package/features/EntriesBulkAction/internals/TaskCache.js +41 -0
  42. package/features/EntriesBulkAction/internals/TaskCache.js.map +1 -0
  43. package/features/MoveToFolderBulkAction/MoveToFolderBulkAction.d.ts +15 -0
  44. package/features/MoveToFolderBulkAction/MoveToFolderBulkAction.js +29 -0
  45. package/features/MoveToFolderBulkAction/MoveToFolderBulkAction.js.map +1 -0
  46. package/features/MoveToFolderBulkAction/feature.d.ts +4 -0
  47. package/features/MoveToFolderBulkAction/feature.js +11 -0
  48. package/features/MoveToFolderBulkAction/feature.js.map +1 -0
  49. package/features/MoveToTrashBulkAction/MoveToTrashBulkAction.d.ts +15 -0
  50. package/features/MoveToTrashBulkAction/MoveToTrashBulkAction.js +32 -0
  51. package/features/MoveToTrashBulkAction/MoveToTrashBulkAction.js.map +1 -0
  52. package/features/MoveToTrashBulkAction/feature.d.ts +4 -0
  53. package/features/MoveToTrashBulkAction/feature.js +11 -0
  54. package/features/MoveToTrashBulkAction/feature.js.map +1 -0
  55. package/features/PublishEntriesBulkAction/PublishEntriesBulkAction.d.ts +15 -0
  56. package/features/PublishEntriesBulkAction/PublishEntriesBulkAction.js +35 -0
  57. package/features/PublishEntriesBulkAction/PublishEntriesBulkAction.js.map +1 -0
  58. package/features/PublishEntriesBulkAction/feature.d.ts +4 -0
  59. package/features/PublishEntriesBulkAction/feature.js +11 -0
  60. package/features/PublishEntriesBulkAction/feature.js.map +1 -0
  61. package/features/RestoreEntriesBulkAction/RestoreEntriesBulkAction.d.ts +15 -0
  62. package/features/RestoreEntriesBulkAction/RestoreEntriesBulkAction.js +30 -0
  63. package/features/RestoreEntriesBulkAction/RestoreEntriesBulkAction.js.map +1 -0
  64. package/features/RestoreEntriesBulkAction/feature.d.ts +4 -0
  65. package/features/RestoreEntriesBulkAction/feature.js +11 -0
  66. package/features/RestoreEntriesBulkAction/feature.js.map +1 -0
  67. package/features/UnpublishEntriesBulkAction/UnpublishEntriesBulkAction.d.ts +15 -0
  68. package/features/UnpublishEntriesBulkAction/UnpublishEntriesBulkAction.js +28 -0
  69. package/features/UnpublishEntriesBulkAction/UnpublishEntriesBulkAction.js.map +1 -0
  70. package/features/UnpublishEntriesBulkAction/feature.d.ts +4 -0
  71. package/features/UnpublishEntriesBulkAction/feature.js +11 -0
  72. package/features/UnpublishEntriesBulkAction/feature.js.map +1 -0
  73. package/graphql/BulkActionsGraphQLSchema.d.ts +12 -0
  74. package/graphql/BulkActionsGraphQLSchema.js +124 -0
  75. package/graphql/BulkActionsGraphQLSchema.js.map +1 -0
  76. package/graphql/bulkActionAccess.d.ts +22 -0
  77. package/graphql/bulkActionAccess.js +94 -0
  78. package/graphql/bulkActionAccess.js.map +1 -0
  79. package/graphql/createBulkActionGraphQL.d.ts +3 -0
  80. package/graphql/createBulkActionGraphQL.js +61 -0
  81. package/graphql/createBulkActionGraphQL.js.map +1 -0
  82. package/graphql/createDefaultGraphQL.d.ts +8 -0
  83. package/graphql/createDefaultGraphQL.js +61 -0
  84. package/graphql/createDefaultGraphQL.js.map +1 -0
  85. package/index.d.ts +3 -6
  86. package/index.js +1 -73
  87. package/package.json +29 -26
  88. package/tasks/EmptyTrashBinTask.d.ts +26 -0
  89. package/tasks/EmptyTrashBinTask.js +116 -0
  90. package/tasks/EmptyTrashBinTask.js.map +1 -0
  91. package/types.d.ts +15 -13
  92. package/types.js +7 -21
  93. package/types.js.map +1 -1
  94. package/abstractions/IListEntries.d.ts +0 -7
  95. package/abstractions/IListEntries.js +0 -7
  96. package/abstractions/IListEntries.js.map +0 -1
  97. package/abstractions/IProcessEntry.d.ts +0 -4
  98. package/abstractions/IProcessEntry.js +0 -7
  99. package/abstractions/IProcessEntry.js.map +0 -1
  100. package/abstractions/IUseCase.js.map +0 -1
  101. package/abstractions/index.js.map +0 -1
  102. package/handlers/eventBridgeEventHandler.d.ts +0 -1
  103. package/handlers/eventBridgeEventHandler.js +0 -53
  104. package/handlers/eventBridgeEventHandler.js.map +0 -1
  105. package/handlers/index.d.ts +0 -1
  106. package/handlers/index.js +0 -14
  107. package/handlers/index.js.map +0 -1
  108. package/handlers/setupEventsTenant.d.ts +0 -1
  109. package/handlers/setupEventsTenant.js +0 -19
  110. package/handlers/setupEventsTenant.js.map +0 -1
  111. package/index.js.map +0 -1
  112. package/plugins/createBulkAction.d.ts +0 -10
  113. package/plugins/createBulkAction.js +0 -36
  114. package/plugins/createBulkAction.js.map +0 -1
  115. package/plugins/createBulkActionGraphQL.d.ts +0 -7
  116. package/plugins/createBulkActionGraphQL.js +0 -72
  117. package/plugins/createBulkActionGraphQL.js.map +0 -1
  118. package/plugins/createBulkActionTasks.d.ts +0 -9
  119. package/plugins/createBulkActionTasks.js +0 -135
  120. package/plugins/createBulkActionTasks.js.map +0 -1
  121. package/plugins/createDefaultGraphQL.d.ts +0 -3
  122. package/plugins/createDefaultGraphQL.js +0 -70
  123. package/plugins/createDefaultGraphQL.js.map +0 -1
  124. package/plugins/index.d.ts +0 -2
  125. package/plugins/index.js +0 -29
  126. package/plugins/index.js.map +0 -1
  127. package/tasks/createBulkActionEntriesTasks.d.ts +0 -1
  128. package/tasks/createBulkActionEntriesTasks.js +0 -38
  129. package/tasks/createBulkActionEntriesTasks.js.map +0 -1
  130. package/tasks/createEmptyTrashBinsTask.d.ts +0 -2
  131. package/tasks/createEmptyTrashBinsTask.js +0 -118
  132. package/tasks/createEmptyTrashBinsTask.js.map +0 -1
  133. package/tasks/index.d.ts +0 -2
  134. package/tasks/index.js +0 -29
  135. package/tasks/index.js.map +0 -1
  136. package/useCases/DeleteEntry.d.ts +0 -10
  137. package/useCases/DeleteEntry.js +0 -26
  138. package/useCases/DeleteEntry.js.map +0 -1
  139. package/useCases/ListDeletedEntries.d.ts +0 -13
  140. package/useCases/ListDeletedEntries.js +0 -28
  141. package/useCases/ListDeletedEntries.js.map +0 -1
  142. package/useCases/ListLatestEntries.d.ts +0 -13
  143. package/useCases/ListLatestEntries.js +0 -28
  144. package/useCases/ListLatestEntries.js.map +0 -1
  145. package/useCases/ListNotPublishedEntries.d.ts +0 -13
  146. package/useCases/ListNotPublishedEntries.js +0 -34
  147. package/useCases/ListNotPublishedEntries.js.map +0 -1
  148. package/useCases/ListPublishedEntries.d.ts +0 -13
  149. package/useCases/ListPublishedEntries.js +0 -28
  150. package/useCases/ListPublishedEntries.js.map +0 -1
  151. package/useCases/MoveEntryToFolder.d.ts +0 -13
  152. package/useCases/MoveEntryToFolder.js +0 -23
  153. package/useCases/MoveEntryToFolder.js.map +0 -1
  154. package/useCases/MoveEntryToTrash.d.ts +0 -10
  155. package/useCases/MoveEntryToTrash.js +0 -26
  156. package/useCases/MoveEntryToTrash.js.map +0 -1
  157. package/useCases/PublishEntry.d.ts +0 -10
  158. package/useCases/PublishEntry.js +0 -20
  159. package/useCases/PublishEntry.js.map +0 -1
  160. package/useCases/RestoreEntryFromTrash.d.ts +0 -10
  161. package/useCases/RestoreEntryFromTrash.js +0 -24
  162. package/useCases/RestoreEntryFromTrash.js.map +0 -1
  163. package/useCases/UnpublishEntry.d.ts +0 -10
  164. package/useCases/UnpublishEntry.js +0 -20
  165. package/useCases/UnpublishEntry.js.map +0 -1
  166. package/useCases/index.d.ts +0 -10
  167. package/useCases/index.js +0 -117
  168. package/useCases/index.js.map +0 -1
  169. package/useCases/internals/ChildTaskCleanup/ChildTasksCleanup.d.ts +0 -17
  170. package/useCases/internals/ChildTaskCleanup/ChildTasksCleanup.js +0 -77
  171. package/useCases/internals/ChildTaskCleanup/ChildTasksCleanup.js.map +0 -1
  172. package/useCases/internals/ChildTaskCleanup/index.d.ts +0 -1
  173. package/useCases/internals/ChildTaskCleanup/index.js +0 -18
  174. package/useCases/internals/ChildTaskCleanup/index.js.map +0 -1
  175. package/useCases/internals/CreateTasksByModel/CreateTasksByModel.d.ts +0 -13
  176. package/useCases/internals/CreateTasksByModel/CreateTasksByModel.js +0 -111
  177. package/useCases/internals/CreateTasksByModel/CreateTasksByModel.js.map +0 -1
  178. package/useCases/internals/CreateTasksByModel/TaskCache.js +0 -76
  179. package/useCases/internals/CreateTasksByModel/TaskCache.js.map +0 -1
  180. package/useCases/internals/CreateTasksByModel/index.d.ts +0 -1
  181. package/useCases/internals/CreateTasksByModel/index.js +0 -18
  182. package/useCases/internals/CreateTasksByModel/index.js.map +0 -1
  183. package/useCases/internals/ProcessTask/ProcessTask.d.ts +0 -14
  184. package/useCases/internals/ProcessTask/ProcessTask.js +0 -81
  185. package/useCases/internals/ProcessTask/ProcessTask.js.map +0 -1
  186. package/useCases/internals/ProcessTask/Result.js +0 -29
  187. package/useCases/internals/ProcessTask/Result.js.map +0 -1
  188. package/useCases/internals/ProcessTask/index.d.ts +0 -1
  189. package/useCases/internals/ProcessTask/index.js +0 -18
  190. package/useCases/internals/ProcessTask/index.js.map +0 -1
  191. package/useCases/internals/ProcessTasksByModel/ProcessTasksByModel.d.ts +0 -11
  192. package/useCases/internals/ProcessTasksByModel/ProcessTasksByModel.js +0 -67
  193. package/useCases/internals/ProcessTasksByModel/ProcessTasksByModel.js.map +0 -1
  194. package/useCases/internals/ProcessTasksByModel/index.d.ts +0 -1
  195. package/useCases/internals/ProcessTasksByModel/index.js +0 -18
  196. package/useCases/internals/ProcessTasksByModel/index.js.map +0 -1
  197. package/useCases/internals/index.d.ts +0 -4
  198. package/useCases/internals/index.js +0 -51
  199. package/useCases/internals/index.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphql/createBulkActionGraphQL.js","sources":["../../src/graphql/createBulkActionGraphQL.ts"],"sourcesContent":["import type { HcmsBulkActionsContext } from \"~/types.js\";\nimport {\n CmsGraphQLSchemaPlugin,\n CmsGraphQLSchemaFactory,\n isHeadlessCmsReady\n} from \"@webiny/api-headless-cms\";\nimport { ListModelsUseCase } from \"@webiny/api-headless-cms/features/contentModel/ListModels/index.js\";\nimport { Response } from \"@webiny/api-graphql\";\nimport { CMS_MODEL_SINGLETON_TAG } from \"@webiny/api-headless-cms/constants.js\";\nimport { EntriesBulkAction } from \"~/features/EntriesBulkAction/abstractions.js\";\nimport { BulkActionName } from \"~/domain/BulkActionName.js\";\nimport { TenantContext } from \"@webiny/api-core/features/tenancy/TenantContext/index.js\";\nimport { HeadlessCmsEndpointConfig } from \"@webiny/api-headless-cms/HeadlessCmsEndpointConfig.js\";\nimport { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/abstractions.js\";\nimport { TriggerTaskUseCase } from \"@webiny/background-tasks/api\";\n\nexport const createBulkActionGraphQL = async (\n context: HcmsBulkActionsContext,\n bulkAction: EntriesBulkAction.Interface\n) => {\n const tenant = context.container.resolve(TenantContext).getTenant();\n\n if (!(await isHeadlessCmsReady(context))) {\n return;\n }\n\n const modelsResult = await context.container\n .resolve(IdentityContext)\n .withoutAuthorization(async () => {\n return context.container.resolve(ListModelsUseCase).execute();\n });\n if (modelsResult.isFail()) {\n return;\n }\n const models = modelsResult.value.filter(model => {\n if (model.isPrivate) {\n return false;\n }\n const tags = Array.isArray(model.tags) ? model.tags : [];\n if (tags.includes(CMS_MODEL_SINGLETON_TAG)) {\n return false;\n }\n if (bulkAction.modelIds?.length) {\n return bulkAction.modelIds.includes(model.modelId);\n }\n return true;\n });\n\n const plugins: CmsGraphQLSchemaPlugin<HcmsBulkActionsContext>[] = [];\n\n models.forEach(model => {\n const plugin = new CmsGraphQLSchemaPlugin<HcmsBulkActionsContext>({\n typeDefs: /* GraphQL */ `\n extend enum BulkAction${model.singularApiName}Name {\n ${BulkActionName.from(bulkAction.name)}\n }\n `,\n resolvers: {\n Mutation: {\n [`bulkAction${model.singularApiName}`]: async (_, args, context) => {\n const identity = context.container.resolve(IdentityContext).getIdentity();\n\n const response = await context.container\n .resolve(TriggerTaskUseCase)\n .execute({\n definition: `hcmsBulkList${args.action}Entries`,\n input: {\n modelId: model.modelId,\n where: args.where,\n search: args.search,\n data: args.data,\n identity\n }\n });\n\n return new Response({\n id: response.value.id\n });\n }\n }\n },\n isApplicable: context =>\n context.container.resolve(TenantContext).getTenant().id === tenant.id &&\n // Bulk actions change entries: manage endpoint only.\n context.container.resolve(HeadlessCmsEndpointConfig).type === \"manage\"\n });\n\n plugin.name = `headless-cms.graphql.schema.bulkAction.${model.modelId}.${bulkAction.name}`;\n plugins.push(plugin);\n });\n\n context.container.registerInstance(CmsGraphQLSchemaFactory, {\n execute: () => plugins\n });\n};\n"],"names":["createBulkActionGraphQL","context","bulkAction","tenant","TenantContext","isHeadlessCmsReady","modelsResult","IdentityContext","ListModelsUseCase","models","model","tags","Array","CMS_MODEL_SINGLETON_TAG","plugins","plugin","CmsGraphQLSchemaPlugin","BulkActionName","_","args","identity","response","TriggerTaskUseCase","Response","HeadlessCmsEndpointConfig","CmsGraphQLSchemaFactory"],"mappings":";;;;;;;;;AAgBO,MAAMA,0BAA0B,OACnCC,SACAC;IAEA,MAAMC,SAASF,QAAQ,SAAS,CAAC,OAAO,CAACG,eAAe,SAAS;IAEjE,IAAI,CAAE,MAAMC,mBAAmBJ,UAC3B;IAGJ,MAAMK,eAAe,MAAML,QAAQ,SAAS,CACvC,OAAO,CAACM,iBACR,oBAAoB,CAAC,UACXN,QAAQ,SAAS,CAAC,OAAO,CAACO,mBAAmB,OAAO;IAEnE,IAAIF,aAAa,MAAM,IACnB;IAEJ,MAAMG,SAASH,aAAa,KAAK,CAAC,MAAM,CAACI,CAAAA;QACrC,IAAIA,MAAM,SAAS,EACf,OAAO;QAEX,MAAMC,OAAOC,MAAM,OAAO,CAACF,MAAM,IAAI,IAAIA,MAAM,IAAI,GAAG,EAAE;QACxD,IAAIC,KAAK,QAAQ,CAACE,0BACd,OAAO;QAEX,IAAIX,WAAW,QAAQ,EAAE,QACrB,OAAOA,WAAW,QAAQ,CAAC,QAAQ,CAACQ,MAAM,OAAO;QAErD,OAAO;IACX;IAEA,MAAMI,UAA4D,EAAE;IAEpEL,OAAO,OAAO,CAACC,CAAAA;QACX,MAAMK,SAAS,IAAIC,uBAA+C;YAC9D,UAAwB,CAAC;2CACM,EAAEN,MAAM,eAAe,CAAC;wBAC3C,EAAEO,eAAe,IAAI,CAACf,WAAW,IAAI,EAAE;;gBAE/C,CAAC;YACL,WAAW;gBACP,UAAU;oBACN,CAAC,CAAC,UAAU,EAAEQ,MAAM,eAAe,EAAE,CAAC,EAAE,OAAOQ,GAAGC,MAAMlB;wBACpD,MAAMmB,WAAWnB,QAAQ,SAAS,CAAC,OAAO,CAACM,iBAAiB,WAAW;wBAEvE,MAAMc,WAAW,MAAMpB,QAAQ,SAAS,CACnC,OAAO,CAACqB,oBACR,OAAO,CAAC;4BACL,YAAY,CAAC,YAAY,EAAEH,KAAK,MAAM,CAAC,OAAO,CAAC;4BAC/C,OAAO;gCACH,SAAST,MAAM,OAAO;gCACtB,OAAOS,KAAK,KAAK;gCACjB,QAAQA,KAAK,MAAM;gCACnB,MAAMA,KAAK,IAAI;gCACfC;4BACJ;wBACJ;wBAEJ,OAAO,IAAIG,SAAS;4BAChB,IAAIF,SAAS,KAAK,CAAC,EAAE;wBACzB;oBACJ;gBACJ;YACJ;YACA,cAAcpB,CAAAA,UACVA,QAAQ,SAAS,CAAC,OAAO,CAACG,eAAe,SAAS,GAAG,EAAE,KAAKD,OAAO,EAAE,IAErEF,AAA8D,aAA9DA,QAAQ,SAAS,CAAC,OAAO,CAACuB,2BAA2B,IAAI;QACjE;QAEAT,OAAO,IAAI,GAAG,CAAC,uCAAuC,EAAEL,MAAM,OAAO,CAAC,CAAC,EAAER,WAAW,IAAI,EAAE;QAC1FY,QAAQ,IAAI,CAACC;IACjB;IAEAd,QAAQ,SAAS,CAAC,gBAAgB,CAACwB,yBAAyB;QACxD,SAAS,IAAMX;IACnB;AACJ"}
@@ -0,0 +1,8 @@
1
+ import type { HcmsBulkActionsContext } from "../types.js";
2
+ /**
3
+ * Registers the "default" bulk-action GraphQL for every public model: the shared response types plus,
4
+ * per model, an empty `BulkAction<Model>Name` enum + `bulkAction<Model>` mutation skeleton (each
5
+ * action extends the enum via createBulkActionGraphQL). Run per request, since models are only
6
+ * known at request time.
7
+ */
8
+ export declare const registerDefaultBulkActionGraphQL: (context: HcmsBulkActionsContext) => Promise<void>;
@@ -0,0 +1,61 @@
1
+ import { CmsGraphQLSchemaFactory, CmsGraphQLSchemaPlugin, isHeadlessCmsReady } from "@webiny/api-headless-cms";
2
+ import { ListModelsUseCase } from "@webiny/api-headless-cms/features/contentModel/ListModels/index.js";
3
+ import { CMS_MODEL_SINGLETON_TAG } from "@webiny/api-headless-cms/constants.js";
4
+ import { TenantContext } from "@webiny/api-core/features/tenancy/TenantContext/index.js";
5
+ import { HeadlessCmsEndpointConfig } from "@webiny/api-headless-cms/HeadlessCmsEndpointConfig.js";
6
+ import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/abstractions.js";
7
+ const registerDefaultBulkActionGraphQL = async (context)=>{
8
+ const tenant = context.container.resolve(TenantContext).getTenant();
9
+ if (!await isHeadlessCmsReady(context)) return;
10
+ const defaultPlugin = new CmsGraphQLSchemaPlugin({
11
+ typeDefs: `
12
+ type BulkActionResponseData {
13
+ id: String
14
+ }
15
+
16
+ type BulkActionResponse {
17
+ data: BulkActionResponseData
18
+ error: CmsError
19
+ }
20
+ `
21
+ });
22
+ defaultPlugin.name = "headless-cms.graphql.schema.bulkAction.default";
23
+ const modelsResult = await context.container.resolve(IdentityContext).withoutAuthorization(async ()=>context.container.resolve(ListModelsUseCase).execute());
24
+ if (modelsResult.isFail()) return;
25
+ const models = modelsResult.value.filter((model)=>{
26
+ if (model.isPrivate) return false;
27
+ const tags = Array.isArray(model.tags) ? model.tags : [];
28
+ return !tags.includes(CMS_MODEL_SINGLETON_TAG);
29
+ });
30
+ const modelPlugins = [];
31
+ models.forEach((model)=>{
32
+ const plugin = new CmsGraphQLSchemaPlugin({
33
+ typeDefs: `
34
+ enum BulkAction${model.singularApiName}Name {
35
+ _empty
36
+ }
37
+
38
+ extend type Mutation {
39
+ bulkAction${model.singularApiName}(
40
+ action: BulkAction${model.singularApiName}Name!
41
+ where: ${model.singularApiName}ListWhereInput
42
+ search: String
43
+ data: JSON
44
+ ): BulkActionResponse
45
+ }
46
+ `,
47
+ isApplicable: (context)=>context.container.resolve(TenantContext).getTenant().id === tenant.id && "manage" === context.container.resolve(HeadlessCmsEndpointConfig).type
48
+ });
49
+ plugin.name = `headless-cms.graphql.schema.bulkAction.default.${model.modelId}`;
50
+ modelPlugins.push(plugin);
51
+ });
52
+ context.container.registerInstance(CmsGraphQLSchemaFactory, {
53
+ execute: ()=>[
54
+ defaultPlugin,
55
+ ...modelPlugins
56
+ ]
57
+ });
58
+ };
59
+ export { registerDefaultBulkActionGraphQL };
60
+
61
+ //# sourceMappingURL=createDefaultGraphQL.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphql/createDefaultGraphQL.js","sources":["../../src/graphql/createDefaultGraphQL.ts"],"sourcesContent":["import type { HcmsBulkActionsContext } from \"~/types.js\";\nimport {\n CmsGraphQLSchemaPlugin,\n CmsGraphQLSchemaFactory,\n isHeadlessCmsReady\n} from \"@webiny/api-headless-cms\";\nimport { ListModelsUseCase } from \"@webiny/api-headless-cms/features/contentModel/ListModels/index.js\";\nimport { CMS_MODEL_SINGLETON_TAG } from \"@webiny/api-headless-cms/constants.js\";\nimport { TenantContext } from \"@webiny/api-core/features/tenancy/TenantContext/index.js\";\nimport { HeadlessCmsEndpointConfig } from \"@webiny/api-headless-cms/HeadlessCmsEndpointConfig.js\";\nimport { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/abstractions.js\";\n\n/**\n * Registers the \"default\" bulk-action GraphQL for every public model: the shared response types plus,\n * per model, an empty `BulkAction<Model>Name` enum + `bulkAction<Model>` mutation skeleton (each\n * action extends the enum via createBulkActionGraphQL). Run per request, since models are only\n * known at request time.\n */\nexport const registerDefaultBulkActionGraphQL = async (context: HcmsBulkActionsContext) => {\n const tenant = context.container.resolve(TenantContext).getTenant();\n\n if (!(await isHeadlessCmsReady(context))) {\n return;\n }\n\n const defaultPlugin = new CmsGraphQLSchemaPlugin({\n typeDefs: /* GraphQL */ `\n type BulkActionResponseData {\n id: String\n }\n\n type BulkActionResponse {\n data: BulkActionResponseData\n error: CmsError\n }\n `\n });\n defaultPlugin.name = `headless-cms.graphql.schema.bulkAction.default`;\n\n const modelsResult = await context.container\n .resolve(IdentityContext)\n .withoutAuthorization(async () => {\n return context.container.resolve(ListModelsUseCase).execute();\n });\n if (modelsResult.isFail()) {\n return;\n }\n const models = modelsResult.value.filter(model => {\n if (model.isPrivate) {\n return false;\n }\n const tags = Array.isArray(model.tags) ? model.tags : [];\n return !tags.includes(CMS_MODEL_SINGLETON_TAG);\n });\n\n const modelPlugins: CmsGraphQLSchemaPlugin<HcmsBulkActionsContext>[] = [];\n\n models.forEach(model => {\n const plugin = new CmsGraphQLSchemaPlugin({\n typeDefs: /* GraphQL */ `\n enum BulkAction${model.singularApiName}Name {\n _empty\n }\n \n extend type Mutation {\n bulkAction${model.singularApiName}(\n action: BulkAction${model.singularApiName}Name!\n where: ${model.singularApiName}ListWhereInput\n search: String\n data: JSON\n ): BulkActionResponse\n }\n `,\n isApplicable: context =>\n context.container.resolve(TenantContext).getTenant().id === tenant.id &&\n // Bulk actions change entries: manage endpoint only.\n context.container.resolve(HeadlessCmsEndpointConfig).type === \"manage\"\n });\n\n plugin.name = `headless-cms.graphql.schema.bulkAction.default.${model.modelId}`;\n modelPlugins.push(plugin);\n });\n\n context.container.registerInstance(CmsGraphQLSchemaFactory, {\n execute: () => [defaultPlugin, ...modelPlugins]\n });\n};\n"],"names":["registerDefaultBulkActionGraphQL","context","tenant","TenantContext","isHeadlessCmsReady","defaultPlugin","CmsGraphQLSchemaPlugin","modelsResult","IdentityContext","ListModelsUseCase","models","model","tags","Array","CMS_MODEL_SINGLETON_TAG","modelPlugins","plugin","HeadlessCmsEndpointConfig","CmsGraphQLSchemaFactory"],"mappings":";;;;;;AAkBO,MAAMA,mCAAmC,OAAOC;IACnD,MAAMC,SAASD,QAAQ,SAAS,CAAC,OAAO,CAACE,eAAe,SAAS;IAEjE,IAAI,CAAE,MAAMC,mBAAmBH,UAC3B;IAGJ,MAAMI,gBAAgB,IAAIC,uBAAuB;QAC7C,UAAwB,CAAC;;;;;;;;;QASzB,CAAC;IACL;IACAD,cAAc,IAAI,GAAG;IAErB,MAAME,eAAe,MAAMN,QAAQ,SAAS,CACvC,OAAO,CAACO,iBACR,oBAAoB,CAAC,UACXP,QAAQ,SAAS,CAAC,OAAO,CAACQ,mBAAmB,OAAO;IAEnE,IAAIF,aAAa,MAAM,IACnB;IAEJ,MAAMG,SAASH,aAAa,KAAK,CAAC,MAAM,CAACI,CAAAA;QACrC,IAAIA,MAAM,SAAS,EACf,OAAO;QAEX,MAAMC,OAAOC,MAAM,OAAO,CAACF,MAAM,IAAI,IAAIA,MAAM,IAAI,GAAG,EAAE;QACxD,OAAO,CAACC,KAAK,QAAQ,CAACE;IAC1B;IAEA,MAAMC,eAAiE,EAAE;IAEzEL,OAAO,OAAO,CAACC,CAAAA;QACX,MAAMK,SAAS,IAAIV,uBAAuB;YACtC,UAAwB,CAAC;mCACF,EAAEK,MAAM,eAAe,CAAC;;;;;kCAKzB,EAAEA,MAAM,eAAe,CAAC;8CACZ,EAAEA,MAAM,eAAe,CAAC;mCACnC,EAAEA,MAAM,eAAe,CAAC;;;;;gBAK3C,CAAC;YACL,cAAcV,CAAAA,UACVA,QAAQ,SAAS,CAAC,OAAO,CAACE,eAAe,SAAS,GAAG,EAAE,KAAKD,OAAO,EAAE,IAErED,AAA8D,aAA9DA,QAAQ,SAAS,CAAC,OAAO,CAACgB,2BAA2B,IAAI;QACjE;QAEAD,OAAO,IAAI,GAAG,CAAC,+CAA+C,EAAEL,MAAM,OAAO,EAAE;QAC/EI,aAAa,IAAI,CAACC;IACtB;IAEAf,QAAQ,SAAS,CAAC,gBAAgB,CAACiB,yBAAyB;QACxD,SAAS,IAAM;gBAACb;mBAAkBU;aAAa;IACnD;AACJ"}
package/index.d.ts CHANGED
@@ -1,6 +1,3 @@
1
- export * from "./abstractions";
2
- export * from "./handlers";
3
- export * from "./useCases";
4
- export * from "./plugins";
5
- export * from "./tasks";
6
- export declare const createHcmsBulkActions: () => ((import("@webiny/handler-aws").EventBridgeEventHandler<"WebinyEmptyTrashBin", Record<string, any>, any> | import("@webiny/handler").HandlerOnRequestPlugin<import("@webiny/handler/types").Context>)[] | import("@webiny/api").ContextPlugin<import("./types").HcmsBulkActionsContext>)[];
1
+ export type * from "./abstractions/index.js";
2
+ export { HcmsBulkActionsFeature } from "./HcmsBulkActionsFeature.js";
3
+ export type { HcmsBulkActionsFeatureConfig } from "./HcmsBulkActionsFeature.js";
package/index.js CHANGED
@@ -1,73 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _exportNames = {
7
- createHcmsBulkActions: true
8
- };
9
- exports.createHcmsBulkActions = void 0;
10
- var _handlers = require("./handlers");
11
- Object.keys(_handlers).forEach(function (key) {
12
- if (key === "default" || key === "__esModule") return;
13
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
14
- if (key in exports && exports[key] === _handlers[key]) return;
15
- Object.defineProperty(exports, key, {
16
- enumerable: true,
17
- get: function () {
18
- return _handlers[key];
19
- }
20
- });
21
- });
22
- var _plugins = require("./plugins");
23
- Object.keys(_plugins).forEach(function (key) {
24
- if (key === "default" || key === "__esModule") return;
25
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
26
- if (key in exports && exports[key] === _plugins[key]) return;
27
- Object.defineProperty(exports, key, {
28
- enumerable: true,
29
- get: function () {
30
- return _plugins[key];
31
- }
32
- });
33
- });
34
- var _abstractions = require("./abstractions");
35
- Object.keys(_abstractions).forEach(function (key) {
36
- if (key === "default" || key === "__esModule") return;
37
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
38
- if (key in exports && exports[key] === _abstractions[key]) return;
39
- Object.defineProperty(exports, key, {
40
- enumerable: true,
41
- get: function () {
42
- return _abstractions[key];
43
- }
44
- });
45
- });
46
- var _useCases = require("./useCases");
47
- Object.keys(_useCases).forEach(function (key) {
48
- if (key === "default" || key === "__esModule") return;
49
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
50
- if (key in exports && exports[key] === _useCases[key]) return;
51
- Object.defineProperty(exports, key, {
52
- enumerable: true,
53
- get: function () {
54
- return _useCases[key];
55
- }
56
- });
57
- });
58
- var _tasks = require("./tasks");
59
- Object.keys(_tasks).forEach(function (key) {
60
- if (key === "default" || key === "__esModule") return;
61
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
62
- if (key in exports && exports[key] === _tasks[key]) return;
63
- Object.defineProperty(exports, key, {
64
- enumerable: true,
65
- get: function () {
66
- return _tasks[key];
67
- }
68
- });
69
- });
70
- const createHcmsBulkActions = () => [(0, _handlers.createHandlers)(), (0, _plugins.createDefaultGraphQL)()];
71
- exports.createHcmsBulkActions = createHcmsBulkActions;
72
-
73
- //# sourceMappingURL=index.js.map
1
+ export { HcmsBulkActionsFeature } from "./HcmsBulkActionsFeature.js";
package/package.json CHANGED
@@ -1,7 +1,11 @@
1
1
  {
2
2
  "name": "@webiny/api-headless-cms-bulk-actions",
3
- "version": "0.0.0-unstable.461c047ab7",
4
- "main": "index.js",
3
+ "version": "0.0.0-unstable.48a4e5b6c1",
4
+ "type": "module",
5
+ "exports": {
6
+ ".": "./index.js",
7
+ "./*": "./*"
8
+ },
5
9
  "description": "Webiny Headless CMS bulk actions",
6
10
  "keywords": [
7
11
  "api-headless-cms-bulk-actions:base"
@@ -13,33 +17,32 @@
13
17
  },
14
18
  "license": "MIT",
15
19
  "dependencies": {
16
- "@webiny/api-headless-cms": "0.0.0-unstable.461c047ab7",
17
- "@webiny/handler": "0.0.0-unstable.461c047ab7",
18
- "@webiny/handler-aws": "0.0.0-unstable.461c047ab7",
19
- "@webiny/tasks": "0.0.0-unstable.461c047ab7",
20
- "@webiny/utils": "0.0.0-unstable.461c047ab7"
20
+ "@webiny/api-aco": "0.0.0-unstable.48a4e5b6c1",
21
+ "@webiny/api-graphql": "0.0.0-unstable.48a4e5b6c1",
22
+ "@webiny/api-headless-cms": "0.0.0-unstable.48a4e5b6c1",
23
+ "@webiny/api-kernel-core": "0.0.0-unstable.48a4e5b6c1",
24
+ "@webiny/background-tasks": "0.0.0-unstable.48a4e5b6c1",
25
+ "@webiny/feature": "0.0.0-unstable.48a4e5b6c1",
26
+ "@webiny/handler": "0.0.0-unstable.48a4e5b6c1",
27
+ "@webiny/utils": "0.0.0-unstable.48a4e5b6c1"
21
28
  },
22
29
  "devDependencies": {
23
- "@webiny/api": "0.0.0-unstable.461c047ab7",
24
- "@webiny/api-admin-users": "0.0.0-unstable.461c047ab7",
25
- "@webiny/api-i18n": "0.0.0-unstable.461c047ab7",
26
- "@webiny/api-security": "0.0.0-unstable.461c047ab7",
27
- "@webiny/api-tenancy": "0.0.0-unstable.461c047ab7",
28
- "@webiny/api-wcp": "0.0.0-unstable.461c047ab7",
29
- "@webiny/handler-graphql": "0.0.0-unstable.461c047ab7",
30
- "@webiny/plugins": "0.0.0-unstable.461c047ab7",
31
- "@webiny/project-utils": "0.0.0-unstable.461c047ab7",
32
- "@webiny/wcp": "0.0.0-unstable.461c047ab7",
33
- "graphql": "15.9.0",
34
- "typescript": "5.3.3"
35
- },
36
- "scripts": {
37
- "build": "node ../cli/bin.js run build",
38
- "watch": "node ../cli/bin.js run watch"
30
+ "@webiny/api": "0.0.0-unstable.48a4e5b6c1",
31
+ "@webiny/api-core": "0.0.0-unstable.48a4e5b6c1",
32
+ "@webiny/api-graphql": "0.0.0-unstable.48a4e5b6c1",
33
+ "@webiny/api-headless-cms-testing": "0.0.0-unstable.48a4e5b6c1",
34
+ "@webiny/build-tools": "0.0.0-unstable.48a4e5b6c1",
35
+ "@webiny/di": "2.0.0",
36
+ "@webiny/plugins": "0.0.0-unstable.48a4e5b6c1",
37
+ "@webiny/wcp": "0.0.0-unstable.48a4e5b6c1",
38
+ "graphql": "16.15.0",
39
+ "typescript": "7.0.2",
40
+ "vitest": "5.1.1"
39
41
  },
40
42
  "publishConfig": {
41
- "access": "public",
42
- "directory": "dist"
43
+ "access": "public"
43
44
  },
44
- "gitHead": "461c047ab7dd75a537e760dc6e917d21fedfaaae"
45
+ "webiny": {
46
+ "publishFrom": "dist"
47
+ }
45
48
  }
@@ -0,0 +1,26 @@
1
+ import type { IEmptyTrashBinsInput, IEmptyTrashBinsOutput } from "../types.js";
2
+ import { TaskDefinition, TaskHandler } from "@webiny/api-core/features/task/TaskDefinition/index.js";
3
+ import { ListTenantsUseCase } from "@webiny/api-core/features/tenancy/ListTenants/index.js";
4
+ import { TenantScopes } from "@webiny/api-core/features/tenancy/TenantScopes/index.js";
5
+ declare class EmptyTrashBinTaskHandlerImpl implements TaskHandler.Interface<IEmptyTrashBinsInput, IEmptyTrashBinsOutput> {
6
+ private tenantScopes;
7
+ private listTenants;
8
+ constructor(tenantScopes: TenantScopes.Interface, listTenants: ListTenantsUseCase.Interface);
9
+ run(params: TaskHandler.RunParams<IEmptyTrashBinsInput, IEmptyTrashBinsOutput>): Promise<TaskDefinition.Result<IEmptyTrashBinsInput, IEmptyTrashBinsOutput>>;
10
+ }
11
+ declare class EmptyTrashBinTask implements TaskDefinition.Interface {
12
+ readonly isPrivate = true;
13
+ readonly id = "hcmsEntriesEmptyTrashBins";
14
+ readonly title = "Headless CMS - Empty all trash bins";
15
+ readonly description = "Delete all entries in the trash bin for each model in the system.";
16
+ readonly maxIterations = 120;
17
+ readonly databaseLogs = false;
18
+ readonly selfCleanup: ("onAbort" | "onSuccess")[];
19
+ handler: typeof EmptyTrashBinTaskHandlerImpl & {
20
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskHandler<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskInput, import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskOutput>>;
21
+ };
22
+ }
23
+ export declare const EmptyTrashBinTaskDefinition: typeof EmptyTrashBinTask & {
24
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskDefinition<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskInput, import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskOutput>>;
25
+ };
26
+ export {};
@@ -0,0 +1,116 @@
1
+ import { TaskDefinition, TaskHandler } from "@webiny/api-core/features/task/TaskDefinition/index.js";
2
+ import { ListTenantsUseCase } from "@webiny/api-core/features/tenancy/ListTenants/index.js";
3
+ import { TenantScopes } from "@webiny/api-core/features/tenancy/TenantScopes/index.js";
4
+ import { ListModelsUseCase } from "@webiny/api-headless-cms/features/contentModel/ListModels/index.js";
5
+ import { DeleteEntryUseCase } from "@webiny/api-headless-cms/features/contentEntry/DeleteEntry/index.js";
6
+ import { ListDeletedEntriesUseCase } from "@webiny/api-headless-cms/features/contentEntry/ListEntries/index.js";
7
+ const calculateDateTimeString = ()=>{
8
+ const retentionPeriodFromEnv = process.env["WEBINY_TRASH_BIN_RETENTION_PERIOD_DAYS"];
9
+ const retentionPeriod = retentionPeriodFromEnv && 0 !== Number(retentionPeriodFromEnv) ? Number(retentionPeriodFromEnv) : 90;
10
+ const currentDate = new Date();
11
+ currentDate.setDate(currentDate.getDate() - retentionPeriod);
12
+ return currentDate.toISOString();
13
+ };
14
+ class EmptyTrashBinTaskHandlerImpl {
15
+ constructor(tenantScopes, listTenants){
16
+ this.tenantScopes = tenantScopes;
17
+ this.listTenants = listTenants;
18
+ }
19
+ async run(params) {
20
+ const { input, controller } = params;
21
+ if (controller.runtime.isAborted()) return controller.response.aborted();
22
+ const tenantsResult = await this.listTenants.execute();
23
+ if (tenantsResult.isFail()) return controller.response.error(tenantsResult.error);
24
+ const baseTenants = tenantsResult.value;
25
+ const executedTenantIds = input.executedTenantIds || [];
26
+ const tenants = baseTenants.filter((tenant)=>!executedTenantIds.includes(tenant.id));
27
+ let shouldTaskContinue = false;
28
+ for (const tenant of tenants){
29
+ if (controller.runtime.isCloseToTimeout()) {
30
+ shouldTaskContinue = true;
31
+ break;
32
+ }
33
+ await this.tenantScopes.withTenant(tenant, async (scope)=>{
34
+ const listModels = scope.resolve(ListModelsUseCase);
35
+ const listDeletedEntries = scope.resolve(ListDeletedEntriesUseCase);
36
+ const deleteEntry = scope.resolve(DeleteEntryUseCase);
37
+ const modelsResult = await listModels.execute({
38
+ includePrivate: false
39
+ });
40
+ if (modelsResult.isFail()) return void await controller.logger.error({
41
+ message: `Failed to list models for tenant "${tenant.id}".`,
42
+ error: modelsResult.error
43
+ });
44
+ const models = modelsResult.value;
45
+ for (const model of models){
46
+ const listEntriesParams = {
47
+ where: {
48
+ deletedOn_lt: calculateDateTimeString()
49
+ },
50
+ limit: 50
51
+ };
52
+ while(true){
53
+ const listResult = await listDeletedEntries.execute(model, listEntriesParams);
54
+ if (listResult.isFail()) {
55
+ await controller.logger.error({
56
+ message: `Failed to list deleted entries of model "${model.modelId}".`,
57
+ error: listResult.error
58
+ });
59
+ break;
60
+ }
61
+ const { entries, meta } = listResult.value;
62
+ if (0 === meta.totalCount) break;
63
+ if (controller.runtime.isCloseToTimeout()) {
64
+ shouldTaskContinue = true;
65
+ break;
66
+ }
67
+ for (const entry of entries){
68
+ if (controller.runtime.isCloseToTimeout()) {
69
+ shouldTaskContinue = true;
70
+ break;
71
+ }
72
+ await deleteEntry.execute(model, entry.id, {
73
+ permanently: true
74
+ });
75
+ }
76
+ }
77
+ }
78
+ if (!shouldTaskContinue) executedTenantIds.push(tenant.id);
79
+ });
80
+ if (shouldTaskContinue) break;
81
+ }
82
+ return shouldTaskContinue ? controller.response.continue({
83
+ ...input,
84
+ executedTenantIds
85
+ }) : controller.response.done("Task done: emptied the trash bin for all registered models.");
86
+ }
87
+ }
88
+ const EmptyTrashBinTaskHandler = TaskHandler.createImplementation({
89
+ implementation: EmptyTrashBinTaskHandlerImpl,
90
+ dependencies: [
91
+ TenantScopes,
92
+ ListTenantsUseCase
93
+ ]
94
+ });
95
+ class EmptyTrashBinTask {
96
+ constructor(){
97
+ this.isPrivate = true;
98
+ this.id = "hcmsEntriesEmptyTrashBins";
99
+ this.title = "Headless CMS - Empty all trash bins";
100
+ this.description = "Delete all entries in the trash bin for each model in the system.";
101
+ this.maxIterations = 120;
102
+ this.databaseLogs = false;
103
+ this.selfCleanup = [
104
+ "onSuccess",
105
+ "onAbort"
106
+ ];
107
+ this.handler = EmptyTrashBinTaskHandler;
108
+ }
109
+ }
110
+ const EmptyTrashBinTaskDefinition = TaskDefinition.createImplementation({
111
+ implementation: EmptyTrashBinTask,
112
+ dependencies: []
113
+ });
114
+ export { EmptyTrashBinTaskDefinition };
115
+
116
+ //# sourceMappingURL=EmptyTrashBinTask.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tasks/EmptyTrashBinTask.js","sources":["../../src/tasks/EmptyTrashBinTask.ts"],"sourcesContent":["import type { IEmptyTrashBinsInput, IEmptyTrashBinsOutput } from \"~/types.js\";\nimport {\n TaskDefinition,\n TaskHandler\n} from \"@webiny/api-core/features/task/TaskDefinition/index.js\";\nimport { ListTenantsUseCase } from \"@webiny/api-core/features/tenancy/ListTenants/index.js\";\nimport { TenantScopes } from \"@webiny/api-core/features/tenancy/TenantScopes/index.js\";\nimport { ListModelsUseCase } from \"@webiny/api-headless-cms/features/contentModel/ListModels/index.js\";\nimport { DeleteEntryUseCase } from \"@webiny/api-headless-cms/features/contentEntry/DeleteEntry/index.js\";\nimport { ListDeletedEntriesUseCase } from \"@webiny/api-headless-cms/features/contentEntry/ListEntries/index.js\";\n\nconst calculateDateTimeString = () => {\n // Retrieve the retention period from the environment variable WEBINY_TRASH_BIN_RETENTION_PERIOD_DAYS,\n // or default to 90 days if not set or set to 0.\n const retentionPeriodFromEnv = process.env[\"WEBINY_TRASH_BIN_RETENTION_PERIOD_DAYS\"];\n const retentionPeriod =\n retentionPeriodFromEnv && Number(retentionPeriodFromEnv) !== 0\n ? Number(retentionPeriodFromEnv)\n : 90;\n\n // Calculate the date-time by subtracting the retention period (in days) from the current date.\n const currentDate = new Date();\n currentDate.setDate(currentDate.getDate() - retentionPeriod);\n\n // Return the calculated date-time string in ISO 8601 format.\n return currentDate.toISOString();\n};\n\nclass EmptyTrashBinTaskHandlerImpl implements TaskHandler.Interface<\n IEmptyTrashBinsInput,\n IEmptyTrashBinsOutput\n> {\n constructor(\n private tenantScopes: TenantScopes.Interface,\n private listTenants: ListTenantsUseCase.Interface\n ) {}\n\n async run(\n params: TaskHandler.RunParams<IEmptyTrashBinsInput, IEmptyTrashBinsOutput>\n ): Promise<TaskDefinition.Result<IEmptyTrashBinsInput, IEmptyTrashBinsOutput>> {\n const { input, controller } = params;\n\n // Abort the task if needed.\n if (controller.runtime.isAborted()) {\n return controller.response.aborted();\n }\n\n // Fetch all tenants, excluding those already processed.\n const tenantsResult = await this.listTenants.execute();\n if (tenantsResult.isFail()) {\n return controller.response.error(tenantsResult.error);\n }\n const baseTenants = tenantsResult.value;\n const executedTenantIds = input.executedTenantIds || [];\n const tenants = baseTenants.filter(tenant => !executedTenantIds.includes(tenant.id));\n\n let shouldTaskContinue = false;\n\n // Iterate over each tenant, in its scope: its models and entries are in its storage. The\n // timeout is checked before entering a scope, so no scope is built once time is up.\n for (const tenant of tenants) {\n if (controller.runtime.isCloseToTimeout()) {\n shouldTaskContinue = true;\n break;\n }\n\n await this.tenantScopes.withTenant(tenant, async scope => {\n const listModels = scope.resolve(ListModelsUseCase);\n const listDeletedEntries = scope.resolve(ListDeletedEntriesUseCase);\n const deleteEntry = scope.resolve(DeleteEntryUseCase);\n\n // List all non-private models.\n const modelsResult = await listModels.execute({ includePrivate: false });\n if (modelsResult.isFail()) {\n await controller.logger.error({\n message: `Failed to list models for tenant \"${tenant.id}\".`,\n error: modelsResult.error\n });\n return;\n }\n const models = modelsResult.value;\n\n // Process each model to delete trashed entries.\n for (const model of models) {\n // Query parameters for fetching deleted entries older than a minute ago.\n const listEntriesParams = {\n where: {\n deletedOn_lt: calculateDateTimeString()\n },\n limit: 50\n };\n\n // Continue deleting entries while there are entries left to delete.\n while (true) {\n const listResult = await listDeletedEntries.execute(\n model,\n listEntriesParams\n );\n if (listResult.isFail()) {\n await controller.logger.error({\n message: `Failed to list deleted entries of model \"${model.modelId}\".`,\n error: listResult.error\n });\n break;\n }\n const { entries, meta } = listResult.value;\n\n if (meta.totalCount === 0) {\n break;\n }\n\n if (controller.runtime.isCloseToTimeout()) {\n shouldTaskContinue = true;\n break;\n }\n for (const entry of entries) {\n if (controller.runtime.isCloseToTimeout()) {\n shouldTaskContinue = true;\n break;\n }\n // Delete each entry individually.\n await deleteEntry.execute(model, entry.id, { permanently: true });\n }\n }\n }\n\n // If the task isn't continuing, add the tenant to the executed list.\n if (!shouldTaskContinue) {\n executedTenantIds.push(tenant.id);\n }\n });\n\n if (shouldTaskContinue) {\n break;\n }\n }\n\n // Continue the task or mark it as done based on the `shouldContinue` flag.\n return shouldTaskContinue\n ? controller.response.continue({ ...input, executedTenantIds })\n : controller.response.done(\n \"Task done: emptied the trash bin for all registered models.\"\n );\n }\n}\n\nconst EmptyTrashBinTaskHandler = TaskHandler.createImplementation({\n implementation: EmptyTrashBinTaskHandlerImpl,\n dependencies: [TenantScopes, ListTenantsUseCase]\n});\n\nclass EmptyTrashBinTask implements TaskDefinition.Interface {\n public readonly isPrivate = true;\n public readonly id = \"hcmsEntriesEmptyTrashBins\";\n public readonly title = \"Headless CMS - Empty all trash bins\";\n public readonly description =\n \"Delete all entries in the trash bin for each model in the system.\";\n public readonly maxIterations = 120;\n public readonly databaseLogs = false;\n\n public readonly selfCleanup = [\"onSuccess\" as const, \"onAbort\" as const];\n\n handler = EmptyTrashBinTaskHandler;\n}\n\nexport const EmptyTrashBinTaskDefinition = TaskDefinition.createImplementation({\n implementation: EmptyTrashBinTask,\n dependencies: []\n});\n"],"names":["calculateDateTimeString","retentionPeriodFromEnv","process","retentionPeriod","Number","currentDate","Date","EmptyTrashBinTaskHandlerImpl","tenantScopes","listTenants","params","input","controller","tenantsResult","baseTenants","executedTenantIds","tenants","tenant","shouldTaskContinue","scope","listModels","ListModelsUseCase","listDeletedEntries","ListDeletedEntriesUseCase","deleteEntry","DeleteEntryUseCase","modelsResult","models","model","listEntriesParams","listResult","entries","meta","entry","EmptyTrashBinTaskHandler","TaskHandler","TenantScopes","ListTenantsUseCase","EmptyTrashBinTask","EmptyTrashBinTaskDefinition","TaskDefinition"],"mappings":"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"}
package/types.d.ts CHANGED
@@ -1,25 +1,26 @@
1
- import type { CmsContext } from "@webiny/api-headless-cms/types";
2
- import type { Context as BaseContext } from "@webiny/handler/types";
3
- import type { Context as TasksContext, ITaskResponseDoneResultOutput, ITaskRunParams } from "@webiny/tasks/types";
4
- import type { SecurityIdentity } from "@webiny/api-security/types";
5
- export interface HcmsBulkActionsContext extends BaseContext, CmsContext, TasksContext {
1
+ import type { CmsContext } from "@webiny/api-headless-cms/types/index.js";
2
+ import type { Context as BaseContext } from "@webiny/handler/types.js";
3
+ import type { ITaskIdentity } from "@webiny/background-tasks/api/types.js";
4
+ import { TaskDefinition } from "@webiny/api-core/features/task/TaskDefinition/index.js";
5
+ export interface HcmsBulkActionsContext extends BaseContext, CmsContext {
6
6
  }
7
7
  /**
8
8
  * Bulk Action Operation
9
9
  */
10
10
  export interface IBulkActionOperationInput {
11
+ actionName: string;
11
12
  modelId: string;
12
13
  ids: string[];
13
14
  data?: Record<string, any>;
14
- identity: SecurityIdentity;
15
+ identity: ITaskIdentity;
15
16
  done?: string[];
16
17
  failed?: string[];
17
18
  }
18
- export interface IBulkActionOperationOutput extends ITaskResponseDoneResultOutput {
19
+ export interface IBulkActionOperationOutput {
19
20
  done: string[];
20
21
  failed: string[];
21
22
  }
22
- export type IBulkActionOperationTaskParams = ITaskRunParams<HcmsBulkActionsContext, IBulkActionOperationInput, IBulkActionOperationOutput>;
23
+ export type IBulkActionOperationTaskParams = TaskDefinition.RunParams<IBulkActionOperationInput, IBulkActionOperationOutput>;
23
24
  /**
24
25
  * Bulk Action Operation By Model
25
26
  */
@@ -30,24 +31,25 @@ export declare enum BulkActionOperationByModelAction {
30
31
  END_TASK = "END_TASK"
31
32
  }
32
33
  export interface IBulkActionOperationByModelInput {
34
+ actionName: string;
33
35
  modelId: string;
34
- identity?: SecurityIdentity;
36
+ identity?: ITaskIdentity;
35
37
  where?: Record<string, any>;
36
38
  search?: string;
37
39
  after?: string | null;
38
40
  data?: Record<string, any>;
39
41
  action?: BulkActionOperationByModelAction;
40
42
  }
41
- export interface IBulkActionOperationByModelOutput extends ITaskResponseDoneResultOutput {
43
+ export interface IBulkActionOperationByModelOutput {
42
44
  done: string[];
43
45
  failed: string[];
44
46
  }
45
- export type IBulkActionOperationByModelTaskParams = ITaskRunParams<HcmsBulkActionsContext, IBulkActionOperationByModelInput, IBulkActionOperationByModelOutput>;
47
+ export type IBulkActionOperationByModelTaskParams = TaskDefinition.RunParams<IBulkActionOperationByModelInput, IBulkActionOperationByModelOutput>;
46
48
  /**
47
49
  * Empty Trash Bin
48
50
  */
49
51
  export interface IEmptyTrashBinsInput {
50
52
  executedTenantIds?: string[] | null;
51
53
  }
52
- export type IEmptyTrashBinsOutput = ITaskResponseDoneResultOutput;
53
- export type IEmptyTrashBinsTaskParams = ITaskRunParams<HcmsBulkActionsContext, IEmptyTrashBinsInput, IEmptyTrashBinsOutput>;
54
+ export type IEmptyTrashBinsOutput = TaskDefinition.ResultDone;
55
+ export type IEmptyTrashBinsTaskParams = TaskDefinition.RunParams<IEmptyTrashBinsInput, IEmptyTrashBinsOutput>;
package/types.js CHANGED
@@ -1,24 +1,10 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.BulkActionOperationByModelAction = void 0;
7
- /**
8
- * Bulk Action Operation
9
- */
10
- /**
11
- * Bulk Action Operation By Model
12
- */
13
- let BulkActionOperationByModelAction = exports.BulkActionOperationByModelAction = /*#__PURE__*/function (BulkActionOperationByModelAction) {
14
- BulkActionOperationByModelAction["CREATE_SUBTASKS"] = "CREATE_SUBTASKS";
15
- BulkActionOperationByModelAction["CHECK_MORE_SUBTASKS"] = "CHECK_MORE_SUBTASKS";
16
- BulkActionOperationByModelAction["PROCESS_SUBTASKS"] = "PROCESS_SUBTASKS";
17
- BulkActionOperationByModelAction["END_TASK"] = "END_TASK";
18
- return BulkActionOperationByModelAction;
1
+ var types_BulkActionOperationByModelAction = /*#__PURE__*/ function(BulkActionOperationByModelAction) {
2
+ BulkActionOperationByModelAction["CREATE_SUBTASKS"] = "CREATE_SUBTASKS";
3
+ BulkActionOperationByModelAction["CHECK_MORE_SUBTASKS"] = "CHECK_MORE_SUBTASKS";
4
+ BulkActionOperationByModelAction["PROCESS_SUBTASKS"] = "PROCESS_SUBTASKS";
5
+ BulkActionOperationByModelAction["END_TASK"] = "END_TASK";
6
+ return BulkActionOperationByModelAction;
19
7
  }({});
20
- /**
21
- * Empty Trash Bin
22
- */
8
+ export { types_BulkActionOperationByModelAction as BulkActionOperationByModelAction };
23
9
 
24
10
  //# sourceMappingURL=types.js.map
package/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["BulkActionOperationByModelAction","exports"],"sources":["types.ts"],"sourcesContent":["import type { CmsContext } from \"@webiny/api-headless-cms/types\";\nimport type { Context as BaseContext } from \"@webiny/handler/types\";\nimport type {\n Context as TasksContext,\n ITaskResponseDoneResultOutput,\n ITaskRunParams\n} from \"@webiny/tasks/types\";\nimport type { SecurityIdentity } from \"@webiny/api-security/types\";\n\nexport interface HcmsBulkActionsContext extends BaseContext, CmsContext, TasksContext {}\n\n/**\n * Bulk Action Operation\n */\n\nexport interface IBulkActionOperationInput {\n modelId: string;\n ids: string[];\n data?: Record<string, any>;\n identity: SecurityIdentity;\n done?: string[];\n failed?: string[];\n}\n\nexport interface IBulkActionOperationOutput extends ITaskResponseDoneResultOutput {\n done: string[];\n failed: string[];\n}\n\nexport type IBulkActionOperationTaskParams = ITaskRunParams<\n HcmsBulkActionsContext,\n IBulkActionOperationInput,\n IBulkActionOperationOutput\n>;\n\n/**\n * Bulk Action Operation By Model\n */\n\nexport enum BulkActionOperationByModelAction {\n CREATE_SUBTASKS = \"CREATE_SUBTASKS\",\n CHECK_MORE_SUBTASKS = \"CHECK_MORE_SUBTASKS\",\n PROCESS_SUBTASKS = \"PROCESS_SUBTASKS\",\n END_TASK = \"END_TASK\"\n}\n\nexport interface IBulkActionOperationByModelInput {\n modelId: string;\n identity?: SecurityIdentity;\n where?: Record<string, any>;\n search?: string;\n after?: string | null;\n data?: Record<string, any>;\n action?: BulkActionOperationByModelAction;\n}\n\nexport interface IBulkActionOperationByModelOutput extends ITaskResponseDoneResultOutput {\n done: string[];\n failed: string[];\n}\n\nexport type IBulkActionOperationByModelTaskParams = ITaskRunParams<\n HcmsBulkActionsContext,\n IBulkActionOperationByModelInput,\n IBulkActionOperationByModelOutput\n>;\n\n/**\n * Empty Trash Bin\n */\n\nexport interface IEmptyTrashBinsInput {\n executedTenantIds?: string[] | null;\n}\n\nexport type IEmptyTrashBinsOutput = ITaskResponseDoneResultOutput;\n\nexport type IEmptyTrashBinsTaskParams = ITaskRunParams<\n HcmsBulkActionsContext,\n IEmptyTrashBinsInput,\n IEmptyTrashBinsOutput\n>;\n"],"mappings":";;;;;;AAWA;AACA;AACA;AAsBA;AACA;AACA;AAFA,IAIYA,gCAAgC,GAAAC,OAAA,CAAAD,gCAAA,0BAAhCA,gCAAgC;EAAhCA,gCAAgC;EAAhCA,gCAAgC;EAAhCA,gCAAgC;EAAhCA,gCAAgC;EAAA,OAAhCA,gCAAgC;AAAA;AA4B5C;AACA;AACA","ignoreList":[]}
1
+ {"version":3,"file":"types.js","sources":["../src/types.ts"],"sourcesContent":["import type { CmsContext } from \"@webiny/api-headless-cms/types/index.js\";\nimport type { Context as BaseContext } from \"@webiny/handler/types.js\";\nimport type { ITaskIdentity } from \"@webiny/background-tasks/api/types.js\";\nimport { TaskDefinition } from \"@webiny/api-core/features/task/TaskDefinition/index.js\";\n\nexport interface HcmsBulkActionsContext extends BaseContext, CmsContext {}\n\n/**\n * Bulk Action Operation\n */\n\nexport interface IBulkActionOperationInput {\n actionName: string;\n modelId: string;\n ids: string[];\n data?: Record<string, any>;\n identity: ITaskIdentity;\n done?: string[];\n failed?: string[];\n}\n\nexport interface IBulkActionOperationOutput {\n done: string[];\n failed: string[];\n}\n\nexport type IBulkActionOperationTaskParams = TaskDefinition.RunParams<\n IBulkActionOperationInput,\n IBulkActionOperationOutput\n>;\n\n/**\n * Bulk Action Operation By Model\n */\n\nexport enum BulkActionOperationByModelAction {\n CREATE_SUBTASKS = \"CREATE_SUBTASKS\",\n CHECK_MORE_SUBTASKS = \"CHECK_MORE_SUBTASKS\",\n PROCESS_SUBTASKS = \"PROCESS_SUBTASKS\",\n END_TASK = \"END_TASK\"\n}\n\nexport interface IBulkActionOperationByModelInput {\n actionName: string;\n modelId: string;\n identity?: ITaskIdentity;\n where?: Record<string, any>;\n search?: string;\n after?: string | null;\n data?: Record<string, any>;\n action?: BulkActionOperationByModelAction;\n}\n\nexport interface IBulkActionOperationByModelOutput {\n done: string[];\n failed: string[];\n}\n\nexport type IBulkActionOperationByModelTaskParams = TaskDefinition.RunParams<\n IBulkActionOperationByModelInput,\n IBulkActionOperationByModelOutput\n>;\n\n/**\n * Empty Trash Bin\n */\n\nexport interface IEmptyTrashBinsInput {\n executedTenantIds?: string[] | null;\n}\n\nexport type IEmptyTrashBinsOutput = TaskDefinition.ResultDone;\n\nexport type IEmptyTrashBinsTaskParams = TaskDefinition.RunParams<\n IEmptyTrashBinsInput,\n IEmptyTrashBinsOutput\n>;\n"],"names":["BulkActionOperationByModelAction"],"mappings":"AAmCO,IAAKA,yCAAgCA,WAAAA,GAAAA,SAAAA,gCAAAA"}
@@ -1,7 +0,0 @@
1
- import type { CmsEntry, CmsEntryListParams, CmsEntryMeta } from "@webiny/api-headless-cms/types";
2
- export interface IListEntries {
3
- execute: (modelId: string, params: CmsEntryListParams) => Promise<{
4
- entries: CmsEntry[];
5
- meta: CmsEntryMeta;
6
- }>;
7
- }
@@ -1,7 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
-
7
- //# sourceMappingURL=IListEntries.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["IListEntries.ts"],"sourcesContent":["import type { CmsEntry, CmsEntryListParams, CmsEntryMeta } from \"@webiny/api-headless-cms/types\";\n\nexport interface IListEntries {\n execute: (\n modelId: string,\n params: CmsEntryListParams\n ) => Promise<{ entries: CmsEntry[]; meta: CmsEntryMeta }>;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1,4 +0,0 @@
1
- import type { CmsModel } from "@webiny/api-headless-cms/types";
2
- export interface IProcessEntry {
3
- execute: (model: CmsModel, id: string, data?: any) => Promise<void>;
4
- }
@@ -1,7 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
-
7
- //# sourceMappingURL=IProcessEntry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["IProcessEntry.ts"],"sourcesContent":["import type { CmsModel } from \"@webiny/api-headless-cms/types\";\n\nexport interface IProcessEntry {\n execute: (model: CmsModel, id: string, data?: any) => Promise<void>;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["IUseCase.ts"],"sourcesContent":["export interface IUseCase<TInput, TOutput> {\n execute(params: TInput): Promise<TOutput>;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":["_IListEntries","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_IProcessEntry","_IUseCase"],"sources":["index.ts"],"sourcesContent":["export * from \"./IListEntries\";\nexport * from \"./IProcessEntry\";\nexport * from \"./IUseCase\";\n"],"mappings":";;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,aAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,aAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,aAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,cAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,cAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,cAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,cAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,SAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,SAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,SAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,SAAA,CAAAN,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
@@ -1 +0,0 @@
1
- export declare const createEventBridgeHandler: () => import("@webiny/handler-aws").EventBridgeEventHandler<"WebinyEmptyTrashBin", Record<string, any>, any>;