@webiny/api-apw 5.37.8 → 5.38.0-beta.0

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 (117) hide show
  1. package/ApwChangeRequestNotification.js +3 -1
  2. package/ApwCommentNotification.js +3 -1
  3. package/ApwContentReviewNotification.js +3 -1
  4. package/ApwContentUrlPlugin.js +3 -1
  5. package/ContentApwSettingsPlugin.js +3 -1
  6. package/README.md +3 -3
  7. package/crud/createChangeRequestMethods.js +3 -1
  8. package/crud/createCommentMethods.js +3 -1
  9. package/crud/createContentReviewMethods.js +3 -1
  10. package/crud/createReviewerMethods.js +3 -1
  11. package/crud/createWorkflowMethods.js +3 -1
  12. package/crud/index.js +3 -1
  13. package/crud/utils.js +3 -1
  14. package/index.js +3 -1
  15. package/package.json +26 -26
  16. package/plugins/cms/CmsEntryApwSettingsGetterPlugin.js +3 -1
  17. package/plugins/cms/apwEntryPlugins.js +3 -1
  18. package/plugins/cms/index.js +3 -1
  19. package/plugins/cms/linkContentReviewToEntry.js +4 -2
  20. package/plugins/cms/linkContentReviewToEntry.js.map +1 -1
  21. package/plugins/cms/linkWorkflowToEntry.js +10 -6
  22. package/plugins/cms/linkWorkflowToEntry.js.map +1 -1
  23. package/plugins/cms/notifications/changeRequestNotification.js +3 -1
  24. package/plugins/cms/notifications/commentNotification.js +3 -1
  25. package/plugins/cms/notifications/contentReviewNotification.js +3 -1
  26. package/plugins/cms/notifications/contentUrl.js +3 -1
  27. package/plugins/cms/triggerContentReview.js +4 -2
  28. package/plugins/cms/triggerContentReview.js.map +1 -1
  29. package/plugins/cms/updateContentReviewStatus.js +5 -3
  30. package/plugins/cms/updateContentReviewStatus.js.map +1 -1
  31. package/plugins/cms/utils.d.ts +2 -1
  32. package/plugins/cms/utils.js +17 -8
  33. package/plugins/cms/utils.js.map +1 -1
  34. package/plugins/context.js +3 -1
  35. package/plugins/graphql/changeRequest.gql.js +3 -1
  36. package/plugins/graphql/comment.gql.js +3 -1
  37. package/plugins/graphql/contentReview.gql.js +3 -1
  38. package/plugins/graphql/reviewer.gql.js +3 -1
  39. package/plugins/graphql/workflow.gql.js +3 -1
  40. package/plugins/graphql.js +3 -1
  41. package/plugins/hooks/createReviewerFromIdentity.js +3 -1
  42. package/plugins/hooks/deleteChangeRequestsAfterContentReview.js +3 -1
  43. package/plugins/hooks/deleteCommentsAfterChangeRequest.js +3 -1
  44. package/plugins/hooks/index.js +3 -1
  45. package/plugins/hooks/initializeContentReviewSteps.js +3 -1
  46. package/plugins/hooks/initializeNotifications.js +3 -1
  47. package/plugins/hooks/listContentReviews.js +3 -1
  48. package/plugins/hooks/notifications/appUrl.js +3 -1
  49. package/plugins/hooks/notifications/changeRequestAfterCreate.js +3 -1
  50. package/plugins/hooks/notifications/changeRequestUrl.js +3 -1
  51. package/plugins/hooks/notifications/commentAfterCreate.js +3 -1
  52. package/plugins/hooks/notifications/commentUrl.js +3 -1
  53. package/plugins/hooks/notifications/contentReviewAfterCreate.js +3 -1
  54. package/plugins/hooks/notifications/contentReviewUrl.js +3 -1
  55. package/plugins/hooks/notifications/contentUrl.js +3 -1
  56. package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.js +3 -1
  57. package/plugins/hooks/notifications/lastCommentNotificationPlugin.js +3 -1
  58. package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.js +3 -1
  59. package/plugins/hooks/notifications/reviewers.js +3 -1
  60. package/plugins/hooks/notifications/sendChangeRequestNotification.js +3 -1
  61. package/plugins/hooks/notifications/sendCommentNotification.js +3 -1
  62. package/plugins/hooks/notifications/sendContentReviewNotification.js +3 -1
  63. package/plugins/hooks/updatePendingChangeRequests.js +3 -1
  64. package/plugins/hooks/updateTotalComments.js +3 -1
  65. package/plugins/hooks/validateChangeRequest.js +3 -1
  66. package/plugins/hooks/validateComment.js +3 -1
  67. package/plugins/hooks/validateContentReview.js +3 -1
  68. package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js +3 -1
  69. package/plugins/pageBuilder/apwContentPagePlugins.js +3 -1
  70. package/plugins/pageBuilder/extendPbPageSettingsSchema.js +3 -1
  71. package/plugins/pageBuilder/index.js +3 -1
  72. package/plugins/pageBuilder/linkContentReviewToPage.js +3 -1
  73. package/plugins/pageBuilder/linkWorkflowToPage.js +3 -1
  74. package/plugins/pageBuilder/notifications/changeRequestNotification.js +3 -1
  75. package/plugins/pageBuilder/notifications/commentNotification.js +3 -1
  76. package/plugins/pageBuilder/notifications/contentReviewNotification.js +3 -1
  77. package/plugins/pageBuilder/notifications/contentUrl.js +3 -1
  78. package/plugins/pageBuilder/triggerContentReview.js +3 -1
  79. package/plugins/pageBuilder/updateContentReviewStatus.js +3 -1
  80. package/plugins/pageBuilder/utils.js +3 -1
  81. package/plugins/utils.js +3 -1
  82. package/scheduler/createScheduleActionMethods.js +3 -1
  83. package/scheduler/handlers/executeAction/index.js +3 -1
  84. package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js +3 -1
  85. package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js +3 -1
  86. package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js +3 -1
  87. package/scheduler/handlers/executeAction/security.js +3 -1
  88. package/scheduler/handlers/scheduleAction/index.js +3 -1
  89. package/scheduler/handlers/scheduleAction/scheduleAction.utils.js +3 -1
  90. package/scheduler/handlers/utils.js +3 -1
  91. package/scheduler/index.js +3 -1
  92. package/scheduler/types.d.ts +2 -3
  93. package/scheduler/types.js +3 -1
  94. package/scheduler/types.js.map +1 -1
  95. package/storageOperations/changeRequestStorageOperations.js +28 -1
  96. package/storageOperations/changeRequestStorageOperations.js.map +1 -1
  97. package/storageOperations/commentStorageOperations.js +3 -1
  98. package/storageOperations/contentReviewStorageOperations.js +3 -1
  99. package/storageOperations/index.js +3 -1
  100. package/storageOperations/models/changeRequest.model.js +3 -1
  101. package/storageOperations/models/comment.model.js +3 -1
  102. package/storageOperations/models/contentModelPluginFactory.js +3 -1
  103. package/storageOperations/models/contentReview.model.js +4 -2
  104. package/storageOperations/models/contentReview.model.js.map +1 -1
  105. package/storageOperations/models/index.js +3 -1
  106. package/storageOperations/models/reviewer.model.js +3 -1
  107. package/storageOperations/models/utils.js +3 -1
  108. package/storageOperations/models/workflow.model.js +7 -7
  109. package/storageOperations/models/workflow.model.js.map +1 -1
  110. package/storageOperations/reviewerStorageOperations.js +3 -1
  111. package/storageOperations/types.js +3 -1
  112. package/storageOperations/workflowStorageOperations.js +3 -1
  113. package/types.js +3 -1
  114. package/utils/contentApwSettingsPlugin.js +3 -1
  115. package/utils/errors.js +3 -1
  116. package/utils/fieldResolver.js +3 -1
  117. package/utils/resolve.js +3 -1
@@ -1 +1 @@
1
- {"version":3,"names":["_error","_interopRequireDefault","require","_types","_utils","_changeRequest","_comment","_contentReview","_reviewer","_workflow","fetchModel","cms","id","settings","WebinyError","modelId","model","getModel","exports","getEntryTitle","entry","titleFieldId","values","getLatestEntryRevision","params","entryId","items","getLatestEntriesByIds","item","shift","updateEntryMeta","meta","updateEntry","isWorkflowApplicable","workflow","application","app","ApwWorkflowApplications","CMS","scopeType","scope","type","WorkflowScopeTypes","DEFAULT","CUSTOM","_workflow$scope$data","_workflow$scope$data2","models","data","Array","isArray","includes","entries","some","value","assignWorkflowToEntry","apw","list","where","console","log","length","sortedWorkflows","sort","workflowByPrecedenceDesc","workflowByCreatedOnDesc","_objectSpread2","default","workflowId","contentReviewId","ex","code","hasEntries","isAwpModel","CHANGE_REQUEST_MODEL_ID","COMMENT_MODEL_ID","CONTENT_REVIEW_MODEL_ID","REVIEWER_MODEL_ID","WORKFLOW_MODEL_ID"],"sources":["utils.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { CmsEntry, CmsModel, HeadlessCms } from \"@webiny/api-headless-cms/types\";\nimport {\n AdvancedPublishingWorkflow,\n ApwWorkflow,\n ApwWorkflowApplications,\n WorkflowScopeTypes\n} from \"~/types\";\nimport { workflowByCreatedOnDesc, workflowByPrecedenceDesc } from \"~/plugins/utils\";\nimport { CHANGE_REQUEST_MODEL_ID } from \"~/storageOperations/models/changeRequest.model\";\nimport { COMMENT_MODEL_ID } from \"~/storageOperations/models/comment.model\";\nimport { CONTENT_REVIEW_MODEL_ID } from \"~/storageOperations/models/contentReview.model\";\nimport { REVIEWER_MODEL_ID } from \"~/storageOperations/models/reviewer.model\";\nimport { WORKFLOW_MODEL_ID } from \"~/storageOperations/models/workflow.model\";\n\nexport const fetchModel = async (\n cms: HeadlessCms,\n id: string,\n settings?: { modelId?: string } | null\n): Promise<CmsModel> => {\n if (!settings) {\n throw new WebinyError(\"Missing settings.\", \"SETTINGS_ERROR\", {\n id\n });\n }\n const modelId = settings.modelId;\n if (!modelId) {\n throw new WebinyError(\"Missing modelId in settings.\", \"MODEL_ID_ERROR\", {\n id,\n settings\n });\n }\n const model = await cms.getModel(modelId);\n if (model) {\n return model;\n }\n throw new WebinyError(\"There is no requested model in the system.\", \"MODEL_NOT_EXISTS\", {\n id,\n settings\n });\n};\n\nexport const getEntryTitle = (model: CmsModel, entry: CmsEntry): string => {\n const titleFieldId = model.titleFieldId;\n if (!titleFieldId || !entry.values[titleFieldId]) {\n return entry.id;\n }\n return entry.values[titleFieldId];\n};\n\ninterface GetLatestEntryRevisionParams {\n cms: HeadlessCms;\n model: CmsModel;\n entryId: string;\n}\nexport const getLatestEntryRevision = async (\n params: GetLatestEntryRevisionParams\n): Promise<CmsEntry> => {\n const { cms, model, entryId } = params;\n const items = await cms.getLatestEntriesByIds(model, [entryId]);\n\n const item = items.shift();\n if (!item) {\n throw new WebinyError(\"There is no entry with given ID.\", \"ENTRY_NOT_FOUND\", {\n entryId\n });\n }\n return item;\n};\n\ninterface UpdateEntryMetaParams {\n meta: Record<string, any>;\n entryId: string;\n cms: HeadlessCms;\n model: CmsModel;\n}\nexport const updateEntryMeta = async (params: UpdateEntryMetaParams): Promise<void> => {\n const { entryId, cms, model, meta } = params;\n\n const entry = await getLatestEntryRevision({\n cms,\n model,\n entryId\n });\n\n await cms.updateEntry(model, entry.id, {}, meta);\n};\n\nconst isWorkflowApplicable = (entry: CmsEntry, workflow: ApwWorkflow): boolean => {\n const application = workflow.app;\n if (application !== ApwWorkflowApplications.CMS) {\n return false;\n }\n\n const scopeType = workflow.scope.type;\n\n if (scopeType === WorkflowScopeTypes.DEFAULT) {\n return true;\n } else if (scopeType === WorkflowScopeTypes.CUSTOM) {\n const models = workflow.scope.data?.models;\n\n if (Array.isArray(models) && models.includes(entry.modelId)) {\n return true;\n }\n\n const entries = workflow.scope.data?.entries || [];\n if (Array.isArray(entries) && entries.some(value => value.id === entry.entryId)) {\n return true;\n }\n return false;\n }\n throw new WebinyError(`Unknown scope type \"${scopeType}\".`, \"UNKNOWN_SCOPE_TYPE\", {\n workflow\n });\n};\n\ninterface AssignWorkflowToEntryParams {\n apw: AdvancedPublishingWorkflow;\n entry: CmsEntry;\n}\nexport const assignWorkflowToEntry = async (params: AssignWorkflowToEntryParams): Promise<void> => {\n const { apw, entry } = params;\n /**\n * Lookup and assign \"workflowId\".\n */\n try {\n /*\n * List all workflows for app cms\n */\n const [entries] = await apw.workflow.list({\n where: {\n app: ApwWorkflowApplications.CMS\n }\n });\n\n console.log(`Found ${entries.length} workflows.`);\n\n /*\n * Re-order them based on workflow scope and pre-defined rule i.e.\n * \"specific\" entry -> entry for a \"category\" -> \"default\".\n * There can be more than one workflow with same \"scope\" and \"app\".\n * Therefore, we are also sorting the workflows by `createdOn` to get the latest workflow.\n */\n const sortedWorkflows = entries\n .sort(workflowByPrecedenceDesc)\n .sort(workflowByCreatedOnDesc);\n\n /**\n * Assign the first applicable workflow to the page and exit.\n */\n for (const workflow of sortedWorkflows) {\n if (isWorkflowApplicable(entry, workflow) === false) {\n console.log(`Not applying workflow ${workflow.id} to entry ${entry.id}.`);\n continue;\n }\n entry.meta = {\n ...(entry.meta || {}),\n apw: {\n workflowId: workflow.id,\n contentReviewId: null\n }\n };\n return;\n }\n } catch (ex) {\n throw new WebinyError(\n `Failed to assign workflow to CMS entry \"${entry.id}\".`,\n ex.code,\n ex.data\n );\n }\n};\n\nexport const hasEntries = (workflow: ApwWorkflow): Boolean => {\n const { app, scope } = workflow;\n return (\n app === ApwWorkflowApplications.CMS &&\n scope.type === WorkflowScopeTypes.CUSTOM &&\n scope.data &&\n Array.isArray(scope.data.entries)\n );\n};\n\nexport const isAwpModel = (model: CmsModel): boolean => {\n return [\n CHANGE_REQUEST_MODEL_ID,\n COMMENT_MODEL_ID,\n CONTENT_REVIEW_MODEL_ID,\n REVIEWER_MODEL_ID,\n WORKFLOW_MODEL_ID\n ].includes(model.modelId);\n};\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAMA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,cAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AAEO,MAAMQ,UAAU,GAAG,MAAAA,CACtBC,GAAgB,EAChBC,EAAU,EACVC,QAAsC,KAClB;EACpB,IAAI,CAACA,QAAQ,EAAE;IACX,MAAM,IAAIC,cAAW,CAAC,mBAAmB,EAAE,gBAAgB,EAAE;MACzDF;IACJ,CAAC,CAAC;EACN;EACA,MAAMG,OAAO,GAAGF,QAAQ,CAACE,OAAO;EAChC,IAAI,CAACA,OAAO,EAAE;IACV,MAAM,IAAID,cAAW,CAAC,8BAA8B,EAAE,gBAAgB,EAAE;MACpEF,EAAE;MACFC;IACJ,CAAC,CAAC;EACN;EACA,MAAMG,KAAK,GAAG,MAAML,GAAG,CAACM,QAAQ,CAACF,OAAO,CAAC;EACzC,IAAIC,KAAK,EAAE;IACP,OAAOA,KAAK;EAChB;EACA,MAAM,IAAIF,cAAW,CAAC,4CAA4C,EAAE,kBAAkB,EAAE;IACpFF,EA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EAC/B,OACIE,GAAG,KAAKC,8BAAuB,CAACC,GAAG,IACnCE,KAAK,CAACC,IAAI,KAAKC,yBAAkB,CAACE,MAAM,IACxCJ,KAAK,CAACQ,IAAI,IACVC,KAAK,CAACC,OAAO,CAACV,KAAK,CAACQ,IAAI,CAACI,OAAO,CAAC;AAEzC,CAAC;AAAClC,OAAA,CAAAsD,UAAA,GAAAA,UAAA;AAEK,MAAMC,UAAU,GAAIzD,KAAe,IAAc;EACpD,OAAO,CACH0D,sCAAuB,EACvBC,yBAAgB,EAChBC,sCAAuB,EACvBC,2BAAiB,EACjBC,2BAAiB,CACpB,CAAC3B,QAAQ,CAACnC,KAAK,CAACD,OAAO,CAAC;AAC7B,CAAC;AAACG,OAAA,CAAAuD,UAAA,GAAAA,UAAA"}
1
+ {"version":3,"names":["_error","_interopRequireDefault","require","_types","_utils","_changeRequest","_comment","_contentReview","_reviewer","_workflow","fetchModel","cms","id","settings","WebinyError","modelId","model","getModel","exports","getEntryTitle","entry","titleFieldId","values","getLatestEntryRevision","params","entryId","item","getLatestEntriesByIds","updateEntryMeta","meta","updateEntry","isWorkflowApplicable","workflow","application","app","ApwWorkflowApplications","CMS","scopeType","scope","type","WorkflowScopeTypes","DEFAULT","CUSTOM","_workflow$scope$data","_workflow$scope$data2","models","data","Array","isArray","includes","entries","some","value","assignWorkflowToEntry","apw","list","where","console","log","length","sortedWorkflows","sort","workflowByPrecedenceDesc","workflowByCreatedOnDesc","_objectSpread2","default","workflowId","contentReviewId","ex","code","hasEntries","isApwDisabledOnModel","isPrivate","CHANGE_REQUEST_MODEL_ID","COMMENT_MODEL_ID","CONTENT_REVIEW_MODEL_ID","REVIEWER_MODEL_ID","WORKFLOW_MODEL_ID"],"sources":["utils.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { CmsEntry, CmsModel, HeadlessCms } from \"@webiny/api-headless-cms/types\";\nimport {\n AdvancedPublishingWorkflow,\n ApwWorkflow,\n ApwWorkflowApplications,\n WorkflowScopeTypes\n} from \"~/types\";\nimport { workflowByCreatedOnDesc, workflowByPrecedenceDesc } from \"~/plugins/utils\";\nimport { CHANGE_REQUEST_MODEL_ID } from \"~/storageOperations/models/changeRequest.model\";\nimport { COMMENT_MODEL_ID } from \"~/storageOperations/models/comment.model\";\nimport { CONTENT_REVIEW_MODEL_ID } from \"~/storageOperations/models/contentReview.model\";\nimport { REVIEWER_MODEL_ID } from \"~/storageOperations/models/reviewer.model\";\nimport { WORKFLOW_MODEL_ID } from \"~/storageOperations/models/workflow.model\";\n\nexport const fetchModel = async (\n cms: HeadlessCms,\n id: string,\n settings?: { modelId?: string } | null\n): Promise<CmsModel> => {\n if (!settings) {\n throw new WebinyError(\"Missing settings.\", \"SETTINGS_ERROR\", {\n id\n });\n }\n const modelId = settings.modelId;\n if (!modelId) {\n throw new WebinyError(\"Missing modelId in settings.\", \"MODEL_ID_ERROR\", {\n id,\n settings\n });\n }\n const model = await cms.getModel(modelId);\n if (model) {\n return model;\n }\n throw new WebinyError(\"There is no requested model in the system.\", \"MODEL_NOT_EXISTS\", {\n id,\n settings\n });\n};\n\nexport const getEntryTitle = (model: CmsModel, entry: CmsEntry): string => {\n const titleFieldId = model.titleFieldId;\n if (!titleFieldId || !entry.values[titleFieldId]) {\n return entry.id;\n }\n return entry.values[titleFieldId];\n};\n\ninterface GetLatestEntryRevisionParams {\n cms: HeadlessCms;\n model: CmsModel;\n entryId: string;\n}\nexport const getLatestEntryRevision = async (\n params: GetLatestEntryRevisionParams\n): Promise<CmsEntry> => {\n const { cms, model, entryId } = params;\n const [item] = await cms.getLatestEntriesByIds(model, [entryId]);\n\n if (!item) {\n throw new WebinyError(\"There is no entry with given ID.\", \"ENTRY_NOT_FOUND\", {\n entryId,\n model: model.modelId\n });\n }\n return item;\n};\n\ninterface UpdateEntryMetaParams {\n meta: Record<string, any>;\n entryId: string;\n cms: HeadlessCms;\n model: CmsModel;\n}\nexport const updateEntryMeta = async (params: UpdateEntryMetaParams): Promise<void> => {\n const { entryId, cms, model, meta } = params;\n\n const entry = await getLatestEntryRevision({\n cms,\n model,\n entryId\n });\n\n await cms.updateEntry(model, entry.id, {}, meta);\n};\n\nconst isWorkflowApplicable = (entry: CmsEntry, workflow: ApwWorkflow): boolean => {\n const application = workflow.app;\n if (application !== ApwWorkflowApplications.CMS) {\n return false;\n }\n\n const scopeType = workflow.scope.type;\n\n if (scopeType === WorkflowScopeTypes.DEFAULT) {\n return true;\n } else if (scopeType === WorkflowScopeTypes.CUSTOM) {\n const models = workflow.scope.data?.models;\n\n if (Array.isArray(models) && models.includes(entry.modelId)) {\n return true;\n }\n\n const entries = workflow.scope.data?.entries || [];\n if (Array.isArray(entries) && entries.some(value => value.id === entry.entryId)) {\n return true;\n }\n return false;\n }\n throw new WebinyError(`Unknown scope type \"${scopeType}\".`, \"UNKNOWN_SCOPE_TYPE\", {\n workflow\n });\n};\n\ninterface AssignWorkflowToEntryParams {\n apw: AdvancedPublishingWorkflow;\n entry: CmsEntry;\n model: CmsModel;\n}\nexport const assignWorkflowToEntry = async (params: AssignWorkflowToEntryParams): Promise<void> => {\n const { apw, entry, model } = params;\n /**\n * Lookup and assign \"workflowId\".\n */\n try {\n /*\n * List all workflows for app cms\n */\n const [entries] = await apw.workflow.list({\n where: {\n app: ApwWorkflowApplications.CMS\n }\n });\n\n console.log(`Found ${entries.length} workflow(s) for model ${model.modelId}.`);\n\n /*\n * Re-order them based on workflow scope and pre-defined rule i.e.\n * \"specific\" entry -> entry for a \"category\" -> \"default\".\n * There can be more than one workflow with same \"scope\" and \"app\".\n * Therefore, we are also sorting the workflows by `createdOn` to get the latest workflow.\n */\n const sortedWorkflows = entries\n .sort(workflowByPrecedenceDesc)\n .sort(workflowByCreatedOnDesc);\n\n /**\n * Assign the first applicable workflow to the page and exit.\n */\n for (const workflow of sortedWorkflows) {\n if (isWorkflowApplicable(entry, workflow) === false) {\n console.log(`Not applying workflow ${workflow.id} to entry ${entry.id}.`);\n continue;\n }\n entry.meta = {\n ...(entry.meta || {}),\n apw: {\n workflowId: workflow.id,\n contentReviewId: null\n }\n };\n return;\n }\n } catch (ex) {\n throw new WebinyError(\n `Failed to assign workflow to CMS entry \"${entry.id}\".`,\n ex.code,\n ex.data\n );\n }\n};\n\nexport const hasEntries = (workflow: ApwWorkflow): Boolean => {\n const { app, scope } = workflow;\n return (\n app === ApwWorkflowApplications.CMS &&\n scope.type === WorkflowScopeTypes.CUSTOM &&\n scope.data &&\n Array.isArray(scope.data.entries)\n );\n};\n\nexport const isApwDisabledOnModel = (model: Pick<CmsModel, \"modelId\" | \"isPrivate\">): boolean => {\n /**\n * We should not run APW on private models as well.\n */\n if (model.isPrivate) {\n return true;\n }\n return [\n CHANGE_REQUEST_MODEL_ID,\n COMMENT_MODEL_ID,\n CONTENT_REVIEW_MODEL_ID,\n REVIEWER_MODEL_ID,\n WORKFLOW_MODEL_ID\n ].includes(model.modelId);\n};\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAMA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,cAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AAEO,MAAMQ,UAAU,GAAG,MAAAA,CACtBC,GAAgB,EAChBC,EAAU,EACVC,QAAsC,KAClB;EACpB,IAAI,CAACA,QAAQ,EAAE;IACX,MAAM,IAAIC,cAAW,CAAC,mBAAmB,EAAE,gBAAgB,EAAE;MACzDF;IACJ,CAAC,CAAC;EACN;EACA,MAAMG,OAAO,GAAGF,QAAQ,CAACE,OAAO;EAChC,IAAI,CAACA,OAAO,EAAE;IACV,MAAM,IAAID,cAAW,CAAC,8BAA8B,EAAE,gBAAgB,EAAE;MACpEF,EAAE;MACFC;IACJ,CAAC,CAAC;EACN;EACA,MAA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vDwD,EAAE,CAACC,IAAI,EACPD,EAAE,CAACtB,IACP,CAAC;EACL;AACJ,CAAC;AAAC5B,OAAA,CAAAmC,qBAAA,GAAAA,qBAAA;AAEK,MAAMiB,UAAU,GAAItC,QAAqB,IAAc;EAC1D,MAAM;IAAEE,GAAG;IAAEI;EAAM,CAAC,GAAGN,QAAQ;EAC/B,OACIE,GAAG,KAAKC,8BAAuB,CAACC,GAAG,IACnCE,KAAK,CAACC,IAAI,KAAKC,yBAAkB,CAACE,MAAM,IACxCJ,KAAK,CAACQ,IAAI,IACVC,KAAK,CAACC,OAAO,CAACV,KAAK,CAACQ,IAAI,CAACI,OAAO,CAAC;AAEzC,CAAC;AAAChC,OAAA,CAAAoD,UAAA,GAAAA,UAAA;AAEK,MAAMC,oBAAoB,GAAIvD,KAA8C,IAAc;EAC7F;AACJ;AACA;EACI,IAAIA,KAAK,CAACwD,SAAS,EAAE;IACjB,OAAO,IAAI;EACf;EACA,OAAO,CACHC,sCAAuB,EACvBC,yBAAgB,EAChBC,sCAAuB,EACvBC,2BAAiB,EACjBC,2BAAiB,CACpB,CAAC5B,QAAQ,CAACjC,KAAK,CAACD,OAAO,CAAC;AAC7B,CAAC;AAACG,OAAA,CAAAqD,oBAAA,GAAAA,oBAAA"}
@@ -98,4 +98,6 @@ const createApwPageBuilderContext = params => {
98
98
  context.plugins.register((0, _extendPbPageSettingsSchema.extendPbPageSettingsSchema)());
99
99
  });
100
100
  };
101
- exports.createApwPageBuilderContext = createApwPageBuilderContext;
101
+ exports.createApwPageBuilderContext = createApwPageBuilderContext;
102
+
103
+ //# sourceMappingURL=context.js.map
@@ -145,4 +145,6 @@ const workflowSchema = new _plugins.GraphQLSchemaPlugin({
145
145
  }
146
146
  });
147
147
  var _default = workflowSchema;
148
- exports.default = _default;
148
+ exports.default = _default;
149
+
150
+ //# sourceMappingURL=changeRequest.gql.js.map
@@ -150,4 +150,6 @@ const workflowSchema = new _plugins.GraphQLSchemaPlugin({
150
150
  }
151
151
  });
152
152
  var _default = workflowSchema;
153
- exports.default = _default;
153
+ exports.default = _default;
154
+
155
+ //# sourceMappingURL=comment.gql.js.map
@@ -360,4 +360,6 @@ const contentReviewSchema = new _plugins.GraphQLSchemaPlugin({
360
360
  }
361
361
  });
362
362
  var _default = contentReviewSchema;
363
- exports.default = _default;
363
+ exports.default = _default;
364
+
365
+ //# sourceMappingURL=contentReview.gql.js.map
@@ -106,4 +106,6 @@ const workflowSchema = new _plugins.GraphQLSchemaPlugin({
106
106
  }
107
107
  });
108
108
  var _default = workflowSchema;
109
- exports.default = _default;
109
+ exports.default = _default;
110
+
111
+ //# sourceMappingURL=reviewer.gql.js.map
@@ -195,4 +195,6 @@ const workflowSchema = new _plugins.GraphQLSchemaPlugin({
195
195
  }
196
196
  });
197
197
  var _default = workflowSchema;
198
- exports.default = _default;
198
+ exports.default = _default;
199
+
200
+ //# sourceMappingURL=workflow.gql.js.map
@@ -77,4 +77,6 @@ var _default = () => {
77
77
  context.plugins.register([baseSchema, _workflow.default, _contentReview.default, _reviewer.default, _comment.default, _changeRequest.default]);
78
78
  });
79
79
  };
80
- exports.default = _default;
80
+ exports.default = _default;
81
+
82
+ //# sourceMappingURL=graphql.js.map
@@ -70,4 +70,6 @@ const createReviewerFromIdentity = ({
70
70
  }
71
71
  });
72
72
  };
73
- exports.createReviewerFromIdentity = createReviewerFromIdentity;
73
+ exports.createReviewerFromIdentity = createReviewerFromIdentity;
74
+
75
+ //# sourceMappingURL=createReviewerFromIdentity.js.map
@@ -56,4 +56,6 @@ const deleteChangeRequestsWithContentReview = ({
56
56
  }
57
57
  });
58
58
  };
59
- exports.deleteChangeRequestsWithContentReview = deleteChangeRequestsWithContentReview;
59
+ exports.deleteChangeRequestsWithContentReview = deleteChangeRequestsWithContentReview;
60
+
61
+ //# sourceMappingURL=deleteChangeRequestsAfterContentReview.js.map
@@ -49,4 +49,6 @@ const deleteCommentsAfterChangeRequest = ({
49
49
  }
50
50
  });
51
51
  };
52
- exports.deleteCommentsAfterChangeRequest = deleteCommentsAfterChangeRequest;
52
+ exports.deleteCommentsAfterChangeRequest = deleteCommentsAfterChangeRequest;
53
+
54
+ //# sourceMappingURL=deleteCommentsAfterChangeRequest.js.map
@@ -57,4 +57,6 @@ new _api.ContextPlugin(async context => {
57
57
  (0, _listContentReviews.listContentReviews)(context);
58
58
  (0, _initializeNotifications.initializeNotifications)(context);
59
59
  });
60
- exports.attachApwHooks = attachApwHooks;
60
+ exports.attachApwHooks = attachApwHooks;
61
+
62
+ //# sourceMappingURL=index.js.map
@@ -76,4 +76,6 @@ const initializeContentReviewSteps = ({
76
76
  input = (0, _set.default)(input, "steps", updatedSteps);
77
77
  });
78
78
  };
79
- exports.initializeContentReviewSteps = initializeContentReviewSteps;
79
+ exports.initializeContentReviewSteps = initializeContentReviewSteps;
80
+
81
+ //# sourceMappingURL=initializeContentReviewSteps.js.map
@@ -12,4 +12,6 @@ const initializeNotifications = context => {
12
12
  (0, _commentAfterCreate.attachCommentAfterCreate)(context);
13
13
  (0, _changeRequestAfterCreate.attachChangeRequestAfterCreate)(context);
14
14
  };
15
- exports.initializeNotifications = initializeNotifications;
15
+ exports.initializeNotifications = initializeNotifications;
16
+
17
+ //# sourceMappingURL=initializeNotifications.js.map
@@ -53,4 +53,6 @@ const listContentReviews = ({
53
53
  where.workflowId_in = userWorkflows.map(workflow => workflow.id);
54
54
  });
55
55
  };
56
- exports.listContentReviews = listContentReviews;
56
+ exports.listContentReviews = listContentReviews;
57
+
58
+ //# sourceMappingURL=listContentReviews.js.map
@@ -15,4 +15,6 @@ const getAppUrl = async context => {
15
15
  }
16
16
  return null;
17
17
  };
18
- exports.getAppUrl = getAppUrl;
18
+ exports.getAppUrl = getAppUrl;
19
+
20
+ //# sourceMappingURL=appUrl.js.map
@@ -108,4 +108,6 @@ const attachChangeRequestAfterCreate = context => {
108
108
  });
109
109
  });
110
110
  };
111
- exports.attachChangeRequestAfterCreate = attachChangeRequestAfterCreate;
111
+ exports.attachChangeRequestAfterCreate = attachChangeRequestAfterCreate;
112
+
113
+ //# sourceMappingURL=changeRequestAfterCreate.js.map
@@ -24,4 +24,6 @@ const createChangeRequestUrl = params => {
24
24
  } = params;
25
25
  return `${baseUrl}/apw/content-reviews/${contentReviewId}/${stepId}/${changeRequestId}`;
26
26
  };
27
- exports.createChangeRequestUrl = createChangeRequestUrl;
27
+ exports.createChangeRequestUrl = createChangeRequestUrl;
28
+
29
+ //# sourceMappingURL=changeRequestUrl.js.map
@@ -119,4 +119,6 @@ const attachCommentAfterCreate = context => {
119
119
  });
120
120
  });
121
121
  };
122
- exports.attachCommentAfterCreate = attachCommentAfterCreate;
122
+ exports.attachCommentAfterCreate = attachCommentAfterCreate;
123
+
124
+ //# sourceMappingURL=commentAfterCreate.js.map
@@ -24,4 +24,6 @@ const createCommentUrl = params => {
24
24
  } = params;
25
25
  return `${baseUrl}/apw/content-reviews/${contentReviewId}/${stepId}/${changeRequestId}`;
26
26
  };
27
- exports.createCommentUrl = createCommentUrl;
27
+ exports.createCommentUrl = createCommentUrl;
28
+
29
+ //# sourceMappingURL=commentUrl.js.map
@@ -91,4 +91,6 @@ const attachContentReviewAfterCreate = context => {
91
91
  });
92
92
  });
93
93
  };
94
- exports.attachContentReviewAfterCreate = attachContentReviewAfterCreate;
94
+ exports.attachContentReviewAfterCreate = attachContentReviewAfterCreate;
95
+
96
+ //# sourceMappingURL=contentReviewAfterCreate.js.map
@@ -23,4 +23,6 @@ const createContentReviewUrl = params => {
23
23
  } = params;
24
24
  return `${baseUrl}/apw/content-reviews/${contentReviewId}/${stepId}`;
25
25
  };
26
- exports.createContentReviewUrl = createContentReviewUrl;
26
+ exports.createContentReviewUrl = createContentReviewUrl;
27
+
28
+ //# sourceMappingURL=contentReviewUrl.js.map
@@ -21,4 +21,6 @@ const createContentUrl = params => {
21
21
  }
22
22
  return contentUrlPlugin.create(params);
23
23
  };
24
- exports.createContentUrl = createContentUrl;
24
+ exports.createContentUrl = createContentUrl;
25
+
26
+ //# sourceMappingURL=contentUrl.js.map
@@ -18,4 +18,6 @@ const getLastChangeRequestNotificationPlugin = params => {
18
18
  });
19
19
  return plugins.shift();
20
20
  };
21
- exports.getLastChangeRequestNotificationPlugin = getLastChangeRequestNotificationPlugin;
21
+ exports.getLastChangeRequestNotificationPlugin = getLastChangeRequestNotificationPlugin;
22
+
23
+ //# sourceMappingURL=lastChangeRequestNotificationPlugin.js.map
@@ -18,4 +18,6 @@ const getLastCommentNotificationPlugin = params => {
18
18
  });
19
19
  return plugins.shift();
20
20
  };
21
- exports.getLastCommentNotificationPlugin = getLastCommentNotificationPlugin;
21
+ exports.getLastCommentNotificationPlugin = getLastCommentNotificationPlugin;
22
+
23
+ //# sourceMappingURL=lastCommentNotificationPlugin.js.map
@@ -18,4 +18,6 @@ const getLastContentReviewNotificationPlugin = params => {
18
18
  });
19
19
  return plugins.shift();
20
20
  };
21
- exports.getLastContentReviewNotificationPlugin = getLastContentReviewNotificationPlugin;
21
+ exports.getLastContentReviewNotificationPlugin = getLastContentReviewNotificationPlugin;
22
+
23
+ //# sourceMappingURL=lastContentReviewNotificationPlugin.js.map
@@ -42,4 +42,6 @@ const fetchReviewers = async params => {
42
42
  });
43
43
  });
44
44
  };
45
- exports.fetchReviewers = fetchReviewers;
45
+ exports.fetchReviewers = fetchReviewers;
46
+
47
+ //# sourceMappingURL=reviewers.js.map
@@ -38,4 +38,6 @@ const sendChangeRequestNotification = async params => {
38
38
  }
39
39
  console.log("Error while sending e-mail", JSON.stringify(result.error));
40
40
  };
41
- exports.sendChangeRequestNotification = sendChangeRequestNotification;
41
+ exports.sendChangeRequestNotification = sendChangeRequestNotification;
42
+
43
+ //# sourceMappingURL=sendChangeRequestNotification.js.map
@@ -38,4 +38,6 @@ const sendCommentNotification = async params => {
38
38
  }
39
39
  console.log("Error while sending e-mail", JSON.stringify(result.error));
40
40
  };
41
- exports.sendCommentNotification = sendCommentNotification;
41
+ exports.sendCommentNotification = sendCommentNotification;
42
+
43
+ //# sourceMappingURL=sendCommentNotification.js.map
@@ -38,4 +38,6 @@ const sendContentReviewNotification = async params => {
38
38
  }
39
39
  console.log("Error while sending e-mail", JSON.stringify(result.error));
40
40
  };
41
- exports.sendContentReviewNotification = sendContentReviewNotification;
41
+ exports.sendContentReviewNotification = sendContentReviewNotification;
42
+
43
+ //# sourceMappingURL=sendContentReviewNotification.js.map
@@ -83,4 +83,6 @@ const updatePendingChangeRequestsCount = ({
83
83
  }
84
84
  });
85
85
  };
86
- exports.updatePendingChangeRequestsCount = updatePendingChangeRequestsCount;
86
+ exports.updatePendingChangeRequestsCount = updatePendingChangeRequestsCount;
87
+
88
+ //# sourceMappingURL=updatePendingChangeRequests.js.map
@@ -141,4 +141,6 @@ const updateLatestCommentId = ({
141
141
  }
142
142
  });
143
143
  };
144
- exports.updateLatestCommentId = updateLatestCommentId;
144
+ exports.updateLatestCommentId = updateLatestCommentId;
145
+
146
+ //# sourceMappingURL=updateTotalComments.js.map
@@ -70,4 +70,6 @@ const validateChangeRequest = ({
70
70
  }
71
71
  });
72
72
  };
73
- exports.validateChangeRequest = validateChangeRequest;
73
+ exports.validateChangeRequest = validateChangeRequest;
74
+
75
+ //# sourceMappingURL=validateChangeRequest.js.map
@@ -43,4 +43,6 @@ const validateComment = ({
43
43
  input.step = changeRequest.step;
44
44
  });
45
45
  };
46
- exports.validateComment = validateComment;
46
+ exports.validateComment = validateComment;
47
+
48
+ //# sourceMappingURL=validateComment.js.map
@@ -29,4 +29,6 @@ const validateContentReview = ({
29
29
  }
30
30
  });
31
31
  };
32
- exports.validateContentReview = validateContentReview;
32
+ exports.validateContentReview = validateContentReview;
33
+
34
+ //# sourceMappingURL=validateContentReview.js.map
@@ -33,4 +33,6 @@ class PageApwSettingsGetterPlugin extends _ContentApwSettingsPlugin.ContentApwSe
33
33
  return (_page$settings$apw2 = page.settings.apw) === null || _page$settings$apw2 === void 0 ? void 0 : _page$settings$apw2.contentReviewId;
34
34
  }
35
35
  }
36
- exports.PageApwSettingsGetterPlugin = PageApwSettingsGetterPlugin;
36
+ exports.PageApwSettingsGetterPlugin = PageApwSettingsGetterPlugin;
37
+
38
+ //# sourceMappingURL=PageApwSettingsGetterPlugin.js.map
@@ -23,4 +23,6 @@ const apwContentPagePlugins = () => new _api.ContextPlugin(async context => {
23
23
  return true;
24
24
  });
25
25
  });
26
- exports.apwContentPagePlugins = apwContentPagePlugins;
26
+ exports.apwContentPagePlugins = apwContentPagePlugins;
27
+
28
+ //# sourceMappingURL=apwContentPagePlugins.js.map
@@ -17,4 +17,6 @@ const extendPbPageSettingsSchema = () => new _plugins.GraphQLSchemaPlugin({
17
17
  }
18
18
  `
19
19
  });
20
- exports.extendPbPageSettingsSchema = extendPbPageSettingsSchema;
20
+ exports.extendPbPageSettingsSchema = extendPbPageSettingsSchema;
21
+
22
+ //# sourceMappingURL=extendPbPageSettingsSchema.js.map
@@ -39,4 +39,6 @@ const apwPageBuilderHooks = params => {
39
39
  pageBuilder
40
40
  });
41
41
  };
42
- exports.apwPageBuilderHooks = apwPageBuilderHooks;
42
+ exports.apwPageBuilderHooks = apwPageBuilderHooks;
43
+
44
+ //# sourceMappingURL=index.js.map
@@ -86,4 +86,6 @@ const linkContentReviewToPage = params => {
86
86
  }
87
87
  });
88
88
  };
89
- exports.linkContentReviewToPage = linkContentReviewToPage;
89
+ exports.linkContentReviewToPage = linkContentReviewToPage;
90
+
91
+ //# sourceMappingURL=linkContentReviewToPage.js.map
@@ -161,4 +161,6 @@ const linkWorkflowToPage = params => {
161
161
  }
162
162
  });
163
163
  };
164
- exports.linkWorkflowToPage = linkWorkflowToPage;
164
+ exports.linkWorkflowToPage = linkWorkflowToPage;
165
+
166
+ //# sourceMappingURL=linkWorkflowToPage.js.map
@@ -28,4 +28,6 @@ const createChangeRequestNotification = () => {
28
28
  plugin.name = `${plugin.type}.${_types.ApwContentTypes.PAGE}.default`;
29
29
  return plugin;
30
30
  };
31
- exports.createChangeRequestNotification = createChangeRequestNotification;
31
+ exports.createChangeRequestNotification = createChangeRequestNotification;
32
+
33
+ //# sourceMappingURL=changeRequestNotification.js.map
@@ -28,4 +28,6 @@ const createCommentNotification = () => {
28
28
  plugin.name = `${plugin.type}.${_types.ApwContentTypes.PAGE}.default`;
29
29
  return plugin;
30
30
  };
31
- exports.createCommentNotification = createCommentNotification;
31
+ exports.createCommentNotification = createCommentNotification;
32
+
33
+ //# sourceMappingURL=commentNotification.js.map
@@ -28,4 +28,6 @@ const createContentReviewNotification = () => {
28
28
  plugin.name = `${plugin.type}.${_types.ApwContentTypes.PAGE}.default`;
29
29
  return plugin;
30
30
  };
31
- exports.createContentReviewNotification = createContentReviewNotification;
31
+ exports.createContentReviewNotification = createContentReviewNotification;
32
+
33
+ //# sourceMappingURL=contentReviewNotification.js.map
@@ -44,4 +44,6 @@ const createContentUrlPlugin = () => {
44
44
  });
45
45
  });
46
46
  };
47
- exports.createContentUrlPlugin = createContentUrlPlugin;
47
+ exports.createContentUrlPlugin = createContentUrlPlugin;
48
+
49
+ //# sourceMappingURL=contentUrl.js.map
@@ -36,4 +36,6 @@ const triggerContentReview = params => {
36
36
  }
37
37
  });
38
38
  };
39
- exports.triggerContentReview = triggerContentReview;
39
+ exports.triggerContentReview = triggerContentReview;
40
+
41
+ //# sourceMappingURL=triggerContentReview.js.map
@@ -64,4 +64,6 @@ const updateContentReviewStatus = params => {
64
64
  }
65
65
  });
66
66
  };
67
- exports.updateContentReviewStatus = updateContentReviewStatus;
67
+ exports.updateContentReviewStatus = updateContentReviewStatus;
68
+
69
+ //# sourceMappingURL=updateContentReviewStatus.js.map
@@ -147,4 +147,6 @@ const updatePageSettings = async ({
147
147
  }
148
148
  }
149
149
  };
150
- exports.updatePageSettings = updatePageSettings;
150
+ exports.updatePageSettings = updatePageSettings;
151
+
152
+ //# sourceMappingURL=utils.js.map
package/plugins/utils.js CHANGED
@@ -141,4 +141,6 @@ const workflowByCreatedOnDesc = (a, b) => {
141
141
  */
142
142
  return new Date(createdOnB).getTime() - new Date(createdOnA).getTime();
143
143
  };
144
- exports.workflowByCreatedOnDesc = workflowByCreatedOnDesc;
144
+ exports.workflowByCreatedOnDesc = workflowByCreatedOnDesc;
145
+
146
+ //# sourceMappingURL=utils.js.map
@@ -122,4 +122,6 @@ function createScheduleActionMethods({
122
122
  return await storageOperations.deleteCurrentTask((0, _objectSpread2.default)({}, getTenantAndLocale()));
123
123
  }
124
124
  };
125
- }
125
+ }
126
+
127
+ //# sourceMappingURL=createScheduleActionMethods.js.map
@@ -175,4 +175,6 @@ const createExecuteActionLambda = params => {
175
175
  const executeActionHandlerPlugins = config => [new _api.ContextPlugin(async context => {
176
176
  context.plugins.register([new _PageBuilderGraphQL.PageBuilderGraphQL(), new _HeadlessCMSGraphQL.HeadlessCMSGraphQL()]);
177
177
  }), (0, _utils.basePlugins)(), createExecuteActionLambda(config)];
178
- exports.executeActionHandlerPlugins = executeActionHandlerPlugins;
178
+ exports.executeActionHandlerPlugins = executeActionHandlerPlugins;
179
+
180
+ //# sourceMappingURL=index.js.map
@@ -23,4 +23,6 @@ var _types = require("../../../types");
23
23
  var _utils = require("../../utils");
24
24
  class ApplicationGraphQL extends _Plugin.Plugin {}
25
25
  exports.ApplicationGraphQL = ApplicationGraphQL;
26
- (0, _defineProperty2.default)(ApplicationGraphQL, "type", "apw.scheduler.applicationGraphQL");
26
+ (0, _defineProperty2.default)(ApplicationGraphQL, "type", "apw.scheduler.applicationGraphQL");
27
+
28
+ //# sourceMappingURL=ApplicationGraphQL.js.map
@@ -107,4 +107,6 @@ class HeadlessCMSGraphQL extends _ApplicationGraphQL.ApplicationGraphQL {
107
107
  };
108
108
  }
109
109
  }
110
- exports.HeadlessCMSGraphQL = HeadlessCMSGraphQL;
110
+ exports.HeadlessCMSGraphQL = HeadlessCMSGraphQL;
111
+
112
+ //# sourceMappingURL=HeadlessCMSGraphQL.js.map
@@ -81,4 +81,6 @@ class PageBuilderGraphQL extends _ApplicationGraphQL.ApplicationGraphQL {
81
81
  };
82
82
  }
83
83
  }
84
- exports.PageBuilderGraphQL = PageBuilderGraphQL;
84
+ exports.PageBuilderGraphQL = PageBuilderGraphQL;
85
+
86
+ //# sourceMappingURL=PageBuilderGraphQL.js.map
@@ -54,4 +54,6 @@ const createCustomAuth = ({
54
54
  });
55
55
  });
56
56
  };
57
- exports.createCustomAuth = createCustomAuth;
57
+ exports.createCustomAuth = createCustomAuth;
58
+
59
+ //# sourceMappingURL=security.js.map
@@ -145,4 +145,6 @@ const createScheduleActionLambda = params => {
145
145
  };
146
146
 
147
147
  const scheduleActionHandlerPlugins = config => [(0, _utils.basePlugins)(), createScheduleActionLambda(config)];
148
- exports.scheduleActionHandlerPlugins = scheduleActionHandlerPlugins;
148
+ exports.scheduleActionHandlerPlugins = scheduleActionHandlerPlugins;
149
+
150
+ //# sourceMappingURL=index.js.map
@@ -150,4 +150,6 @@ const executeTask = async ({
150
150
  console.error(e);
151
151
  }
152
152
  };
153
- exports.executeTask = executeTask;
153
+ exports.executeTask = executeTask;
154
+
155
+ //# sourceMappingURL=scheduleAction.utils.js.map
@@ -127,4 +127,6 @@ const getApwSettings = async () => {
127
127
  eventTargetId: Item ? Item["eventTargetId"] : "eventTargetId"
128
128
  };
129
129
  };
130
- exports.getApwSettings = getApwSettings;
130
+ exports.getApwSettings = getApwSettings;
131
+
132
+ //# sourceMappingURL=utils.js.map
@@ -21,4 +21,6 @@ const createScheduler = params => {
21
21
  storageOperations
22
22
  });
23
23
  };
24
- exports.createScheduler = createScheduler;
24
+ exports.createScheduler = createScheduler;
25
+
26
+ //# sourceMappingURL=index.js.map
@@ -1,8 +1,7 @@
1
1
  import { Context } from "@webiny/api/types";
2
2
  import { SecurityIdentity, SecurityPermission } from "@webiny/api-security/types";
3
- import { I18NLocale, I18NContext } from "@webiny/api-i18n/types";
4
- import { Tenant } from "@webiny/api-tenancy/types";
5
- import { TenancyContext } from "@webiny/api-tenancy/types";
3
+ import { I18NContext, I18NLocale } from "@webiny/api-i18n/types";
4
+ import { TenancyContext, Tenant } from "@webiny/api-tenancy/types";
6
5
  import { ApwIdentity } from "../types";
7
6
  export interface ListWhere {
8
7
  /**
@@ -20,4 +20,6 @@ let InvocationTypes = /*#__PURE__*/function (InvocationTypes) {
20
20
  InvocationTypes["SCHEDULED"] = "scheduled";
21
21
  return InvocationTypes;
22
22
  }({});
23
- exports.InvocationTypes = InvocationTypes;
23
+ exports.InvocationTypes = InvocationTypes;
24
+
25
+ //# sourceMappingURL=types.js.map