@webiny/api-apw 0.0.0-unstable.6e5425ee89 → 0.0.0-unstable.78f581c1d2
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.
- package/ApwChangeRequestNotification.js +10 -0
- package/ApwChangeRequestNotification.js.map +1 -1
- package/ApwCommentNotification.js +10 -0
- package/ApwCommentNotification.js.map +1 -1
- package/ApwContentReviewNotification.js +10 -0
- package/ApwContentReviewNotification.js.map +1 -1
- package/ApwContentUrlPlugin.js +10 -0
- package/ApwContentUrlPlugin.js.map +1 -1
- package/ContentApwSettingsPlugin.js +5 -0
- package/ContentApwSettingsPlugin.js.map +1 -1
- package/crud/createChangeRequestMethods.js +11 -4
- package/crud/createChangeRequestMethods.js.map +1 -1
- package/crud/createCommentMethods.js +12 -4
- package/crud/createCommentMethods.js.map +1 -1
- package/crud/createContentReviewMethods.js +84 -20
- package/crud/createContentReviewMethods.js.map +1 -1
- package/crud/createReviewerMethods.js +12 -4
- package/crud/createReviewerMethods.js.map +1 -1
- package/crud/createWorkflowMethods.js +17 -4
- package/crud/createWorkflowMethods.js.map +1 -1
- package/crud/index.js +25 -0
- package/crud/index.js.map +1 -1
- package/crud/utils.js +28 -0
- package/crud/utils.js.map +1 -1
- package/index.js +11 -1
- package/index.js.map +1 -1
- package/package.json +34 -34
- package/plugins/cms/CmsEntryApwSettingsGetterPlugin.js +15 -0
- package/plugins/cms/CmsEntryApwSettingsGetterPlugin.js.map +1 -1
- package/plugins/cms/apwEntryPlugins.js +8 -0
- package/plugins/cms/apwEntryPlugins.js.map +1 -1
- package/plugins/cms/index.js +13 -0
- package/plugins/cms/index.js.map +1 -1
- package/plugins/cms/linkContentReviewToEntry.js +17 -0
- package/plugins/cms/linkContentReviewToEntry.js.map +1 -1
- package/plugins/cms/linkWorkflowToEntry.js +31 -2
- package/plugins/cms/linkWorkflowToEntry.js.map +1 -1
- package/plugins/cms/notifications/changeRequestNotification.js +4 -0
- package/plugins/cms/notifications/changeRequestNotification.js.map +1 -1
- package/plugins/cms/notifications/commentNotification.js +4 -0
- package/plugins/cms/notifications/commentNotification.js.map +1 -1
- package/plugins/cms/notifications/contentReviewNotification.js +4 -0
- package/plugins/cms/notifications/contentReviewNotification.js.map +1 -1
- package/plugins/cms/notifications/contentUrl.js +8 -1
- package/plugins/cms/notifications/contentUrl.js.map +1 -1
- package/plugins/cms/triggerContentReview.js +14 -0
- package/plugins/cms/triggerContentReview.js.map +1 -1
- package/plugins/cms/updateContentReviewStatus.js +18 -0
- package/plugins/cms/updateContentReviewStatus.js.map +1 -1
- package/plugins/cms/utils.js +47 -2
- package/plugins/cms/utils.js.map +1 -1
- package/plugins/context.js +31 -0
- package/plugins/context.js.map +1 -1
- package/plugins/graphql/changeRequest.gql.js +8 -1
- package/plugins/graphql/changeRequest.gql.js.map +1 -1
- package/plugins/graphql/comment.gql.js +8 -1
- package/plugins/graphql/comment.gql.js.map +1 -1
- package/plugins/graphql/contentReview.gql.js +20 -1
- package/plugins/graphql/contentReview.gql.js.map +1 -1
- package/plugins/graphql/reviewer.gql.js +8 -1
- package/plugins/graphql/reviewer.gql.js.map +1 -1
- package/plugins/graphql/workflow.gql.js +8 -1
- package/plugins/graphql/workflow.gql.js.map +1 -1
- package/plugins/graphql.js +16 -1
- package/plugins/graphql.js.map +1 -1
- package/plugins/hooks/createReviewerFromIdentity.js +11 -2
- package/plugins/hooks/createReviewerFromIdentity.js.map +1 -1
- package/plugins/hooks/deleteChangeRequestsAfterContentReview.js +9 -1
- package/plugins/hooks/deleteChangeRequestsAfterContentReview.js.map +1 -1
- package/plugins/hooks/deleteCommentsAfterChangeRequest.js +8 -1
- package/plugins/hooks/deleteCommentsAfterChangeRequest.js.map +1 -1
- package/plugins/hooks/index.js +14 -0
- package/plugins/hooks/index.js.map +1 -1
- package/plugins/hooks/initializeContentReviewSteps.js +15 -2
- package/plugins/hooks/initializeContentReviewSteps.js.map +1 -1
- package/plugins/hooks/initializeNotifications.js +5 -0
- package/plugins/hooks/initializeNotifications.js.map +1 -1
- package/plugins/hooks/listContentReviews.js +12 -0
- package/plugins/hooks/listContentReviews.js.map +1 -1
- package/plugins/hooks/notifications/appUrl.js +4 -0
- package/plugins/hooks/notifications/appUrl.js.map +1 -1
- package/plugins/hooks/notifications/changeRequestAfterCreate.js +28 -0
- package/plugins/hooks/notifications/changeRequestAfterCreate.js.map +1 -1
- package/plugins/hooks/notifications/changeRequestUrl.js +4 -0
- package/plugins/hooks/notifications/changeRequestUrl.js.map +1 -1
- package/plugins/hooks/notifications/commentAfterCreate.js +30 -0
- package/plugins/hooks/notifications/commentAfterCreate.js.map +1 -1
- package/plugins/hooks/notifications/commentUrl.js +4 -0
- package/plugins/hooks/notifications/commentUrl.js.map +1 -1
- package/plugins/hooks/notifications/contentReviewAfterCreate.js +24 -1
- package/plugins/hooks/notifications/contentReviewAfterCreate.js.map +1 -1
- package/plugins/hooks/notifications/contentReviewUrl.js +4 -0
- package/plugins/hooks/notifications/contentReviewUrl.js.map +1 -1
- package/plugins/hooks/notifications/contentUrl.js +5 -0
- package/plugins/hooks/notifications/contentUrl.js.map +1 -1
- package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.js +4 -0
- package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.js.map +1 -1
- package/plugins/hooks/notifications/lastCommentNotificationPlugin.js +4 -0
- package/plugins/hooks/notifications/lastCommentNotificationPlugin.js.map +1 -1
- package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.js +4 -0
- package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.js.map +1 -1
- package/plugins/hooks/notifications/reviewers.js +7 -0
- package/plugins/hooks/notifications/reviewers.js.map +1 -1
- package/plugins/hooks/notifications/sendChangeRequestNotification.js +11 -0
- package/plugins/hooks/notifications/sendChangeRequestNotification.js.map +1 -1
- package/plugins/hooks/notifications/sendCommentNotification.js +11 -0
- package/plugins/hooks/notifications/sendCommentNotification.js.map +1 -1
- package/plugins/hooks/notifications/sendContentReviewNotification.js +11 -0
- package/plugins/hooks/notifications/sendContentReviewNotification.js.map +1 -1
- package/plugins/hooks/updatePendingChangeRequests.js +8 -0
- package/plugins/hooks/updatePendingChangeRequests.js.map +1 -1
- package/plugins/hooks/updateTotalComments.js +9 -0
- package/plugins/hooks/updateTotalComments.js.map +1 -1
- package/plugins/hooks/validateChangeRequest.js +16 -0
- package/plugins/hooks/validateChangeRequest.js.map +1 -1
- package/plugins/hooks/validateComment.js +12 -1
- package/plugins/hooks/validateComment.js.map +1 -1
- package/plugins/hooks/validateContentReview.js +6 -0
- package/plugins/hooks/validateContentReview.js.map +1 -1
- package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js +15 -0
- package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js.map +1 -1
- package/plugins/pageBuilder/apwContentPagePlugins.js +4 -0
- package/plugins/pageBuilder/apwContentPagePlugins.js.map +1 -1
- package/plugins/pageBuilder/extendPbPageSettingsSchema.js +6 -1
- package/plugins/pageBuilder/extendPbPageSettingsSchema.js.map +1 -1
- package/plugins/pageBuilder/index.js +11 -0
- package/plugins/pageBuilder/index.js.map +1 -1
- package/plugins/pageBuilder/linkContentReviewToPage.js +16 -0
- package/plugins/pageBuilder/linkContentReviewToPage.js.map +1 -1
- package/plugins/pageBuilder/linkWorkflowToPage.js +31 -1
- package/plugins/pageBuilder/linkWorkflowToPage.js.map +1 -1
- package/plugins/pageBuilder/notifications/changeRequestNotification.js +4 -0
- package/plugins/pageBuilder/notifications/changeRequestNotification.js.map +1 -1
- package/plugins/pageBuilder/notifications/commentNotification.js +4 -0
- package/plugins/pageBuilder/notifications/commentNotification.js.map +1 -1
- package/plugins/pageBuilder/notifications/contentReviewNotification.js +4 -0
- package/plugins/pageBuilder/notifications/contentReviewNotification.js.map +1 -1
- package/plugins/pageBuilder/notifications/contentUrl.js +7 -1
- package/plugins/pageBuilder/notifications/contentUrl.js.map +1 -1
- package/plugins/pageBuilder/triggerContentReview.js +11 -0
- package/plugins/pageBuilder/triggerContentReview.js.map +1 -1
- package/plugins/pageBuilder/updateContentReviewStatus.js +12 -0
- package/plugins/pageBuilder/updateContentReviewStatus.js.map +1 -1
- package/plugins/pageBuilder/utils.js +35 -1
- package/plugins/pageBuilder/utils.js.map +1 -1
- package/plugins/utils.js +43 -0
- package/plugins/utils.js.map +1 -1
- package/scheduler/createScheduleActionMethods.js +20 -1
- package/scheduler/createScheduleActionMethods.js.map +1 -1
- package/scheduler/handlers/executeAction/index.js +33 -9
- package/scheduler/handlers/executeAction/index.js.map +1 -1
- package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js +5 -0
- package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js.map +1 -1
- package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js +21 -0
- package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js.map +1 -1
- package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js +27 -4
- package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js.map +1 -1
- package/scheduler/handlers/executeAction/security.js +11 -0
- package/scheduler/handlers/executeAction/security.js.map +1 -1
- package/scheduler/handlers/scheduleAction/index.js +25 -5
- package/scheduler/handlers/scheduleAction/index.js.map +1 -1
- package/scheduler/handlers/scheduleAction/scheduleAction.utils.js +23 -2
- package/scheduler/handlers/scheduleAction/scheduleAction.utils.js.map +1 -1
- package/scheduler/handlers/utils.js +40 -3
- package/scheduler/handlers/utils.js.map +1 -1
- package/scheduler/index.js +3 -0
- package/scheduler/index.js.map +1 -1
- package/scheduler/types.js +6 -0
- package/scheduler/types.js.map +1 -1
- package/storageOperations/changeRequestStorageOperations.js +19 -0
- package/storageOperations/changeRequestStorageOperations.js.map +1 -1
- package/storageOperations/commentStorageOperations.js +21 -0
- package/storageOperations/commentStorageOperations.js.map +1 -1
- package/storageOperations/contentReviewStorageOperations.js +17 -0
- package/storageOperations/contentReviewStorageOperations.js.map +1 -1
- package/storageOperations/index.js +14 -0
- package/storageOperations/index.js.map +1 -1
- package/storageOperations/models/changeRequest.model.js +9 -0
- package/storageOperations/models/changeRequest.model.js.map +1 -1
- package/storageOperations/models/comment.model.js +8 -0
- package/storageOperations/models/comment.model.js.map +1 -1
- package/storageOperations/models/contentModelPluginFactory.js +5 -0
- package/storageOperations/models/contentModelPluginFactory.js.map +1 -1
- package/storageOperations/models/contentReview.model.js +26 -0
- package/storageOperations/models/contentReview.model.js.map +1 -1
- package/storageOperations/models/index.js +24 -2
- package/storageOperations/models/index.js.map +1 -1
- package/storageOperations/models/reviewer.model.js +8 -0
- package/storageOperations/models/reviewer.model.js.map +1 -1
- package/storageOperations/models/utils.js +4 -0
- package/storageOperations/models/utils.js.map +1 -1
- package/storageOperations/models/workflow.model.js +23 -0
- package/storageOperations/models/workflow.model.js.map +1 -1
- package/storageOperations/reviewerStorageOperations.js +17 -0
- package/storageOperations/reviewerStorageOperations.js.map +1 -1
- package/storageOperations/workflowStorageOperations.js +19 -0
- package/storageOperations/workflowStorageOperations.js.map +1 -1
- package/types.js +14 -0
- package/types.js.map +1 -1
- package/utils/contentApwSettingsPlugin.js +6 -0
- package/utils/contentApwSettingsPlugin.js.map +1 -1
- package/utils/errors.js +17 -0
- package/utils/errors.js.map +1 -1
- package/utils/fieldResolver.js +12 -2
- package/utils/fieldResolver.js.map +1 -1
- package/utils/resolve.js +3 -0
- package/utils/resolve.js.map +1 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["createReviewerMethods","storageOperations","onReviewerBeforeCreate","createTopic","onReviewerAfterCreate","onReviewerBeforeUpdate","onReviewerAfterUpdate","onReviewerBeforeDelete","onReviewerAfterDelete","get","id","getReviewer","list","params","listReviewers","create","data","publish","input","reviewer","createReviewer","update","original","updateReviewer","delete","deleteReviewer"],"sources":["createReviewerMethods.ts"],"sourcesContent":["import {\n ApwReviewerCrud,\n CreateApwParams,\n OnReviewerAfterCreateTopicParams,\n OnReviewerAfterDeleteTopicParams,\n OnReviewerAfterUpdateTopicParams,\n OnReviewerBeforeCreateTopicParams,\n OnReviewerBeforeDeleteTopicParams,\n OnReviewerBeforeUpdateTopicParams\n} from \"~/types\";\nimport { createTopic } from \"@webiny/pubsub\";\n\nexport function createReviewerMethods({ storageOperations }: CreateApwParams): ApwReviewerCrud {\n // create\n const onReviewerBeforeCreate = createTopic<OnReviewerBeforeCreateTopicParams>(\n \"apw.onReviewerBeforeCreate\"\n );\n const onReviewerAfterCreate = createTopic<OnReviewerAfterCreateTopicParams>(\n \"apw.onReviewerAfterCreate\"\n );\n // update\n const onReviewerBeforeUpdate = createTopic<OnReviewerBeforeUpdateTopicParams>(\n \"apw.onReviewerBeforeUpdate\"\n );\n const onReviewerAfterUpdate = createTopic<OnReviewerAfterUpdateTopicParams>(\n \"apw.onReviewerAfterUpdate\"\n );\n // delete\n const onReviewerBeforeDelete = createTopic<OnReviewerBeforeDeleteTopicParams>(\n \"apw.onReviewerBeforeDelete\"\n );\n const onReviewerAfterDelete = createTopic<OnReviewerAfterDeleteTopicParams>(\n \"apw.onReviewerAfterDelete\"\n );\n return {\n /**\n * Lifecycle events\n */\n onReviewerBeforeCreate,\n onReviewerAfterCreate,\n onReviewerBeforeUpdate,\n onReviewerAfterUpdate,\n onReviewerBeforeDelete,\n onReviewerAfterDelete,\n async get(id) {\n return storageOperations.getReviewer({ id });\n },\n async list(params) {\n return storageOperations.listReviewers(params);\n },\n async create(data) {\n await onReviewerBeforeCreate.publish({ input: data });\n\n const reviewer = await storageOperations.createReviewer({ data });\n\n await onReviewerAfterCreate.publish({ reviewer });\n\n return reviewer;\n },\n async update(id, data) {\n const original = await storageOperations.getReviewer({ id });\n\n await onReviewerBeforeUpdate.publish({ original, input: { id, data } });\n\n const reviewer = await storageOperations.updateReviewer({ id, data });\n\n await onReviewerAfterUpdate.publish({ original, input: { id, data }, reviewer });\n\n return reviewer;\n },\n async delete(id: string) {\n const reviewer = await storageOperations.getReviewer({ id });\n\n await onReviewerBeforeDelete.publish({ reviewer });\n\n await storageOperations.deleteReviewer({ id });\n\n await onReviewerAfterDelete.publish({ reviewer });\n\n return true;\n }\n };\n}\n"],"mappings":"
|
1
|
+
{"version":3,"names":["createReviewerMethods","storageOperations","onReviewerBeforeCreate","createTopic","onReviewerAfterCreate","onReviewerBeforeUpdate","onReviewerAfterUpdate","onReviewerBeforeDelete","onReviewerAfterDelete","get","id","getReviewer","list","params","listReviewers","create","data","publish","input","reviewer","createReviewer","update","original","updateReviewer","delete","deleteReviewer"],"sources":["createReviewerMethods.ts"],"sourcesContent":["import {\n ApwReviewerCrud,\n CreateApwParams,\n OnReviewerAfterCreateTopicParams,\n OnReviewerAfterDeleteTopicParams,\n OnReviewerAfterUpdateTopicParams,\n OnReviewerBeforeCreateTopicParams,\n OnReviewerBeforeDeleteTopicParams,\n OnReviewerBeforeUpdateTopicParams\n} from \"~/types\";\nimport { createTopic } from \"@webiny/pubsub\";\n\nexport function createReviewerMethods({ storageOperations }: CreateApwParams): ApwReviewerCrud {\n // create\n const onReviewerBeforeCreate = createTopic<OnReviewerBeforeCreateTopicParams>(\n \"apw.onReviewerBeforeCreate\"\n );\n const onReviewerAfterCreate = createTopic<OnReviewerAfterCreateTopicParams>(\n \"apw.onReviewerAfterCreate\"\n );\n // update\n const onReviewerBeforeUpdate = createTopic<OnReviewerBeforeUpdateTopicParams>(\n \"apw.onReviewerBeforeUpdate\"\n );\n const onReviewerAfterUpdate = createTopic<OnReviewerAfterUpdateTopicParams>(\n \"apw.onReviewerAfterUpdate\"\n );\n // delete\n const onReviewerBeforeDelete = createTopic<OnReviewerBeforeDeleteTopicParams>(\n \"apw.onReviewerBeforeDelete\"\n );\n const onReviewerAfterDelete = createTopic<OnReviewerAfterDeleteTopicParams>(\n \"apw.onReviewerAfterDelete\"\n );\n return {\n /**\n * Lifecycle events\n */\n onReviewerBeforeCreate,\n onReviewerAfterCreate,\n onReviewerBeforeUpdate,\n onReviewerAfterUpdate,\n onReviewerBeforeDelete,\n onReviewerAfterDelete,\n async get(id) {\n return storageOperations.getReviewer({ id });\n },\n async list(params) {\n return storageOperations.listReviewers(params);\n },\n async create(data) {\n await onReviewerBeforeCreate.publish({ input: data });\n\n const reviewer = await storageOperations.createReviewer({ data });\n\n await onReviewerAfterCreate.publish({ reviewer });\n\n return reviewer;\n },\n async update(id, data) {\n const original = await storageOperations.getReviewer({ id });\n\n await onReviewerBeforeUpdate.publish({ original, input: { id, data } });\n\n const reviewer = await storageOperations.updateReviewer({ id, data });\n\n await onReviewerAfterUpdate.publish({ original, input: { id, data }, reviewer });\n\n return reviewer;\n },\n async delete(id: string) {\n const reviewer = await storageOperations.getReviewer({ id });\n\n await onReviewerBeforeDelete.publish({ reviewer });\n\n await storageOperations.deleteReviewer({ id });\n\n await onReviewerAfterDelete.publish({ reviewer });\n\n return true;\n }\n };\n}\n"],"mappings":";;;;;;;AAUA;;AAEO,SAASA,qBAAT,CAA+B;EAAEC;AAAF,CAA/B,EAAwF;EAC3F;EACA,MAAMC,sBAAsB,GAAG,IAAAC,mBAAA,EAC3B,4BAD2B,CAA/B;EAGA,MAAMC,qBAAqB,GAAG,IAAAD,mBAAA,EAC1B,2BAD0B,CAA9B,CAL2F,CAQ3F;;EACA,MAAME,sBAAsB,GAAG,IAAAF,mBAAA,EAC3B,4BAD2B,CAA/B;EAGA,MAAMG,qBAAqB,GAAG,IAAAH,mBAAA,EAC1B,2BAD0B,CAA9B,CAZ2F,CAe3F;;EACA,MAAMI,sBAAsB,GAAG,IAAAJ,mBAAA,EAC3B,4BAD2B,CAA/B;EAGA,MAAMK,qBAAqB,GAAG,IAAAL,mBAAA,EAC1B,2BAD0B,CAA9B;EAGA,OAAO;IACH;AACR;AACA;IACQD,sBAJG;IAKHE,qBALG;IAMHC,sBANG;IAOHC,qBAPG;IAQHC,sBARG;IASHC,qBATG;;IAUH,MAAMC,GAAN,CAAUC,EAAV,EAAc;MACV,OAAOT,iBAAiB,CAACU,WAAlB,CAA8B;QAAED;MAAF,CAA9B,CAAP;IACH,CAZE;;IAaH,MAAME,IAAN,CAAWC,MAAX,EAAmB;MACf,OAAOZ,iBAAiB,CAACa,aAAlB,CAAgCD,MAAhC,CAAP;IACH,CAfE;;IAgBH,MAAME,MAAN,CAAaC,IAAb,EAAmB;MACf,MAAMd,sBAAsB,CAACe,OAAvB,CAA+B;QAAEC,KAAK,EAAEF;MAAT,CAA/B,CAAN;MAEA,MAAMG,QAAQ,GAAG,MAAMlB,iBAAiB,CAACmB,cAAlB,CAAiC;QAAEJ;MAAF,CAAjC,CAAvB;MAEA,MAAMZ,qBAAqB,CAACa,OAAtB,CAA8B;QAAEE;MAAF,CAA9B,CAAN;MAEA,OAAOA,QAAP;IACH,CAxBE;;IAyBH,MAAME,MAAN,CAAaX,EAAb,EAAiBM,IAAjB,EAAuB;MACnB,MAAMM,QAAQ,GAAG,MAAMrB,iBAAiB,CAACU,WAAlB,CAA8B;QAAED;MAAF,CAA9B,CAAvB;MAEA,MAAML,sBAAsB,CAACY,OAAvB,CAA+B;QAAEK,QAAF;QAAYJ,KAAK,EAAE;UAAER,EAAF;UAAMM;QAAN;MAAnB,CAA/B,CAAN;MAEA,MAAMG,QAAQ,GAAG,MAAMlB,iBAAiB,CAACsB,cAAlB,CAAiC;QAAEb,EAAF;QAAMM;MAAN,CAAjC,CAAvB;MAEA,MAAMV,qBAAqB,CAACW,OAAtB,CAA8B;QAAEK,QAAF;QAAYJ,KAAK,EAAE;UAAER,EAAF;UAAMM;QAAN,CAAnB;QAAiCG;MAAjC,CAA9B,CAAN;MAEA,OAAOA,QAAP;IACH,CAnCE;;IAoCH,MAAMK,MAAN,CAAad,EAAb,EAAyB;MACrB,MAAMS,QAAQ,GAAG,MAAMlB,iBAAiB,CAACU,WAAlB,CAA8B;QAAED;MAAF,CAA9B,CAAvB;MAEA,MAAMH,sBAAsB,CAACU,OAAvB,CAA+B;QAAEE;MAAF,CAA/B,CAAN;MAEA,MAAMlB,iBAAiB,CAACwB,cAAlB,CAAiC;QAAEf;MAAF,CAAjC,CAAN;MAEA,MAAMF,qBAAqB,CAACS,OAAtB,CAA8B;QAAEE;MAAF,CAA9B,CAAN;MAEA,OAAO,IAAP;IACH;;EA9CE,CAAP;AAgDH"}
|
@@ -4,30 +4,37 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.createWorkflowMethods = createWorkflowMethods;
|
7
|
+
|
7
8
|
var _pubsub = require("@webiny/pubsub");
|
9
|
+
|
8
10
|
var _apiSecurity = require("@webiny/api-security");
|
11
|
+
|
9
12
|
function createWorkflowMethods({
|
10
13
|
storageOperations,
|
11
14
|
getPermission
|
12
15
|
}) {
|
13
16
|
// create
|
14
17
|
const onWorkflowBeforeCreate = (0, _pubsub.createTopic)("apw.onWorkflowBeforeCreate");
|
15
|
-
const onWorkflowAfterCreate = (0, _pubsub.createTopic)("apw.onWorkflowAfterCreate");
|
16
|
-
|
18
|
+
const onWorkflowAfterCreate = (0, _pubsub.createTopic)("apw.onWorkflowAfterCreate"); // update
|
19
|
+
|
17
20
|
const onWorkflowBeforeUpdate = (0, _pubsub.createTopic)("apw.onWorkflowBeforeUpdate");
|
18
|
-
const onWorkflowAfterUpdate = (0, _pubsub.createTopic)("apw.onWorkflowAfterUpdate");
|
19
|
-
|
21
|
+
const onWorkflowAfterUpdate = (0, _pubsub.createTopic)("apw.onWorkflowAfterUpdate"); // delete
|
22
|
+
|
20
23
|
const onWorkflowBeforeDelete = (0, _pubsub.createTopic)("apw.onWorkflowBeforeDelete");
|
21
24
|
const onWorkflowAfterDelete = (0, _pubsub.createTopic)("apw.onWorkflowAfterDelete");
|
25
|
+
|
22
26
|
const validateAccess = async () => {
|
23
27
|
const permission = await getPermission("apw.publishingWorkflows");
|
28
|
+
|
24
29
|
if (!!permission) {
|
25
30
|
return;
|
26
31
|
}
|
32
|
+
|
27
33
|
throw new _apiSecurity.NotAuthorizedError({
|
28
34
|
message: "Not authorized to access publishing workflows."
|
29
35
|
});
|
30
36
|
};
|
37
|
+
|
31
38
|
return {
|
32
39
|
/**
|
33
40
|
* Lifecycle events
|
@@ -38,14 +45,17 @@ function createWorkflowMethods({
|
|
38
45
|
onWorkflowAfterUpdate,
|
39
46
|
onWorkflowBeforeDelete,
|
40
47
|
onWorkflowAfterDelete,
|
48
|
+
|
41
49
|
async get(id) {
|
42
50
|
return storageOperations.getWorkflow({
|
43
51
|
id
|
44
52
|
});
|
45
53
|
},
|
54
|
+
|
46
55
|
async list(params) {
|
47
56
|
return storageOperations.listWorkflows(params || {});
|
48
57
|
},
|
58
|
+
|
49
59
|
async create(data) {
|
50
60
|
await validateAccess();
|
51
61
|
await onWorkflowBeforeCreate.publish({
|
@@ -59,6 +69,7 @@ function createWorkflowMethods({
|
|
59
69
|
});
|
60
70
|
return workflow;
|
61
71
|
},
|
72
|
+
|
62
73
|
async update(id, data) {
|
63
74
|
await validateAccess();
|
64
75
|
const original = await storageOperations.getWorkflow({
|
@@ -85,6 +96,7 @@ function createWorkflowMethods({
|
|
85
96
|
});
|
86
97
|
return workflow;
|
87
98
|
},
|
99
|
+
|
88
100
|
async delete(id) {
|
89
101
|
await validateAccess();
|
90
102
|
const workflow = await storageOperations.getWorkflow({
|
@@ -101,5 +113,6 @@ function createWorkflowMethods({
|
|
101
113
|
});
|
102
114
|
return true;
|
103
115
|
}
|
116
|
+
|
104
117
|
};
|
105
118
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["createWorkflowMethods","storageOperations","getPermission","onWorkflowBeforeCreate","createTopic","onWorkflowAfterCreate","onWorkflowBeforeUpdate","onWorkflowAfterUpdate","onWorkflowBeforeDelete","onWorkflowAfterDelete","validateAccess","permission","NotAuthorizedError","message","get","id","getWorkflow","list","params","listWorkflows","create","data","publish","input","workflow","createWorkflow","update","original","updateWorkflow","delete","deleteWorkflow"],"sources":["createWorkflowMethods.ts"],"sourcesContent":["import {\n ApwWorkflowCrud,\n CreateApwParams,\n OnWorkflowAfterCreateTopicParams,\n OnWorkflowAfterDeleteTopicParams,\n OnWorkflowAfterUpdateTopicParams,\n OnWorkflowBeforeCreateTopicParams,\n OnWorkflowBeforeDeleteTopicParams,\n OnWorkflowBeforeUpdateTopicParams\n} from \"~/types\";\nimport { createTopic } from \"@webiny/pubsub\";\nimport { NotAuthorizedError } from \"@webiny/api-security\";\n\nexport function createWorkflowMethods({\n storageOperations,\n getPermission\n}: CreateApwParams): ApwWorkflowCrud {\n // create\n const onWorkflowBeforeCreate = createTopic<OnWorkflowBeforeCreateTopicParams>(\n \"apw.onWorkflowBeforeCreate\"\n );\n const onWorkflowAfterCreate = createTopic<OnWorkflowAfterCreateTopicParams>(\n \"apw.onWorkflowAfterCreate\"\n );\n // update\n const onWorkflowBeforeUpdate = createTopic<OnWorkflowBeforeUpdateTopicParams>(\n \"apw.onWorkflowBeforeUpdate\"\n );\n const onWorkflowAfterUpdate = createTopic<OnWorkflowAfterUpdateTopicParams>(\n \"apw.onWorkflowAfterUpdate\"\n );\n // delete\n const onWorkflowBeforeDelete = createTopic<OnWorkflowBeforeDeleteTopicParams>(\n \"apw.onWorkflowBeforeDelete\"\n );\n const onWorkflowAfterDelete = createTopic<OnWorkflowAfterDeleteTopicParams>(\n \"apw.onWorkflowAfterDelete\"\n );\n\n const validateAccess = async (): Promise<void> => {\n const permission = await getPermission(\"apw.publishingWorkflows\");\n if (!!permission) {\n return;\n }\n throw new NotAuthorizedError({\n message: \"Not authorized to access publishing workflows.\"\n });\n };\n\n return {\n /**\n * Lifecycle events\n */\n onWorkflowBeforeCreate,\n onWorkflowAfterCreate,\n onWorkflowBeforeUpdate,\n onWorkflowAfterUpdate,\n onWorkflowBeforeDelete,\n onWorkflowAfterDelete,\n async get(id) {\n return storageOperations.getWorkflow({ id });\n },\n async list(params) {\n return storageOperations.listWorkflows(params || {});\n },\n async create(data) {\n await validateAccess();\n await onWorkflowBeforeCreate.publish({ input: data });\n\n const workflow = await storageOperations.createWorkflow({ data });\n\n await onWorkflowAfterCreate.publish({ workflow });\n\n return workflow;\n },\n async update(id, data) {\n await validateAccess();\n const original = await storageOperations.getWorkflow({ id });\n\n await onWorkflowBeforeUpdate.publish({ original, input: { id, data } });\n\n const workflow = await storageOperations.updateWorkflow({ id, data });\n\n await onWorkflowAfterUpdate.publish({ original, input: { id, data }, workflow });\n\n return workflow;\n },\n async delete(id: string) {\n await validateAccess();\n const workflow = await storageOperations.getWorkflow({ id });\n\n await onWorkflowBeforeDelete.publish({ workflow });\n\n await storageOperations.deleteWorkflow({ id });\n\n await onWorkflowAfterDelete.publish({ workflow });\n\n return true;\n }\n };\n}\n"],"mappings":"
|
1
|
+
{"version":3,"names":["createWorkflowMethods","storageOperations","getPermission","onWorkflowBeforeCreate","createTopic","onWorkflowAfterCreate","onWorkflowBeforeUpdate","onWorkflowAfterUpdate","onWorkflowBeforeDelete","onWorkflowAfterDelete","validateAccess","permission","NotAuthorizedError","message","get","id","getWorkflow","list","params","listWorkflows","create","data","publish","input","workflow","createWorkflow","update","original","updateWorkflow","delete","deleteWorkflow"],"sources":["createWorkflowMethods.ts"],"sourcesContent":["import {\n ApwWorkflowCrud,\n CreateApwParams,\n OnWorkflowAfterCreateTopicParams,\n OnWorkflowAfterDeleteTopicParams,\n OnWorkflowAfterUpdateTopicParams,\n OnWorkflowBeforeCreateTopicParams,\n OnWorkflowBeforeDeleteTopicParams,\n OnWorkflowBeforeUpdateTopicParams\n} from \"~/types\";\nimport { createTopic } from \"@webiny/pubsub\";\nimport { NotAuthorizedError } from \"@webiny/api-security\";\n\nexport function createWorkflowMethods({\n storageOperations,\n getPermission\n}: CreateApwParams): ApwWorkflowCrud {\n // create\n const onWorkflowBeforeCreate = createTopic<OnWorkflowBeforeCreateTopicParams>(\n \"apw.onWorkflowBeforeCreate\"\n );\n const onWorkflowAfterCreate = createTopic<OnWorkflowAfterCreateTopicParams>(\n \"apw.onWorkflowAfterCreate\"\n );\n // update\n const onWorkflowBeforeUpdate = createTopic<OnWorkflowBeforeUpdateTopicParams>(\n \"apw.onWorkflowBeforeUpdate\"\n );\n const onWorkflowAfterUpdate = createTopic<OnWorkflowAfterUpdateTopicParams>(\n \"apw.onWorkflowAfterUpdate\"\n );\n // delete\n const onWorkflowBeforeDelete = createTopic<OnWorkflowBeforeDeleteTopicParams>(\n \"apw.onWorkflowBeforeDelete\"\n );\n const onWorkflowAfterDelete = createTopic<OnWorkflowAfterDeleteTopicParams>(\n \"apw.onWorkflowAfterDelete\"\n );\n\n const validateAccess = async (): Promise<void> => {\n const permission = await getPermission(\"apw.publishingWorkflows\");\n if (!!permission) {\n return;\n }\n throw new NotAuthorizedError({\n message: \"Not authorized to access publishing workflows.\"\n });\n };\n\n return {\n /**\n * Lifecycle events\n */\n onWorkflowBeforeCreate,\n onWorkflowAfterCreate,\n onWorkflowBeforeUpdate,\n onWorkflowAfterUpdate,\n onWorkflowBeforeDelete,\n onWorkflowAfterDelete,\n async get(id) {\n return storageOperations.getWorkflow({ id });\n },\n async list(params) {\n return storageOperations.listWorkflows(params || {});\n },\n async create(data) {\n await validateAccess();\n await onWorkflowBeforeCreate.publish({ input: data });\n\n const workflow = await storageOperations.createWorkflow({ data });\n\n await onWorkflowAfterCreate.publish({ workflow });\n\n return workflow;\n },\n async update(id, data) {\n await validateAccess();\n const original = await storageOperations.getWorkflow({ id });\n\n await onWorkflowBeforeUpdate.publish({ original, input: { id, data } });\n\n const workflow = await storageOperations.updateWorkflow({ id, data });\n\n await onWorkflowAfterUpdate.publish({ original, input: { id, data }, workflow });\n\n return workflow;\n },\n async delete(id: string) {\n await validateAccess();\n const workflow = await storageOperations.getWorkflow({ id });\n\n await onWorkflowBeforeDelete.publish({ workflow });\n\n await storageOperations.deleteWorkflow({ id });\n\n await onWorkflowAfterDelete.publish({ workflow });\n\n return true;\n }\n };\n}\n"],"mappings":"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"}
|
package/crud/index.js
CHANGED
@@ -1,16 +1,24 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
4
|
+
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
5
6
|
value: true
|
6
7
|
});
|
7
8
|
exports.createApw = void 0;
|
9
|
+
|
8
10
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
11
|
+
|
9
12
|
var _createWorkflowMethods = require("./createWorkflowMethods");
|
13
|
+
|
10
14
|
var _createReviewerMethods = require("./createReviewerMethods");
|
15
|
+
|
11
16
|
var _createCommentMethods = require("./createCommentMethods");
|
17
|
+
|
12
18
|
var _createChangeRequestMethods = require("./createChangeRequestMethods");
|
19
|
+
|
13
20
|
var _createContentReviewMethods = require("./createContentReviewMethods");
|
21
|
+
|
14
22
|
const createApw = params => {
|
15
23
|
const contentGetters = new Map();
|
16
24
|
const contentPublisher = new Map();
|
@@ -18,39 +26,54 @@ const createApw = params => {
|
|
18
26
|
const workflowMethods = (0, _createWorkflowMethods.createWorkflowMethods)(params);
|
19
27
|
const reviewerMethods = (0, _createReviewerMethods.createReviewerMethods)(params);
|
20
28
|
const changeRequestMethods = (0, _createChangeRequestMethods.createChangeRequestMethods)(params);
|
29
|
+
|
21
30
|
function getContentGetter(type) {
|
22
31
|
const getter = contentGetters.get(type);
|
32
|
+
|
23
33
|
if (!getter) {
|
24
34
|
throw new Error(`No "ContentGetter" loader found for type: "${type}". You must define a loader.`);
|
25
35
|
}
|
36
|
+
|
26
37
|
return getter;
|
27
38
|
}
|
39
|
+
|
28
40
|
function getContentUnPublisher(type) {
|
29
41
|
const getter = contentUnPublisher.get(type);
|
42
|
+
|
30
43
|
if (!getter) {
|
31
44
|
throw new Error(`No "Content UnPublisher" loader found for type: "${type}". You must define a loader.`);
|
32
45
|
}
|
46
|
+
|
33
47
|
return getter;
|
34
48
|
}
|
49
|
+
|
35
50
|
function getContentPublisher(type) {
|
36
51
|
const getter = contentPublisher.get(type);
|
52
|
+
|
37
53
|
if (!getter) {
|
38
54
|
throw new Error(`No "ContentPublisher" loader found for type: "${type}". You must define a loader.`);
|
39
55
|
}
|
56
|
+
|
40
57
|
return getter;
|
41
58
|
}
|
59
|
+
|
42
60
|
return {
|
43
61
|
addContentPublisher(type, func) {
|
44
62
|
contentPublisher.set(type, func);
|
45
63
|
},
|
64
|
+
|
46
65
|
getContentPublisher,
|
66
|
+
|
47
67
|
addContentGetter(type, func) {
|
48
68
|
contentGetters.set(type, func);
|
49
69
|
},
|
70
|
+
|
50
71
|
getContentGetter,
|
72
|
+
|
51
73
|
addContentUnPublisher(type, func) {
|
52
74
|
contentUnPublisher.set(type, func);
|
53
75
|
},
|
76
|
+
|
54
77
|
getContentUnPublisher,
|
55
78
|
workflow: workflowMethods,
|
56
79
|
reviewer: reviewerMethods,
|
@@ -62,10 +85,12 @@ const createApw = params => {
|
|
62
85
|
getContentPublisher,
|
63
86
|
getContentUnPublisher
|
64
87
|
})),
|
88
|
+
|
65
89
|
/**
|
66
90
|
* Add scheduler to context so that we can access it later. For example, during testing.
|
67
91
|
*/
|
68
92
|
scheduleAction: params.scheduler
|
69
93
|
};
|
70
94
|
};
|
95
|
+
|
71
96
|
exports.createApw = createApw;
|
package/crud/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["createApw","params","contentGetters","Map","contentPublisher","contentUnPublisher","workflowMethods","createWorkflowMethods","reviewerMethods","createReviewerMethods","changeRequestMethods","createChangeRequestMethods","getContentGetter","type","getter","get","Error","getContentUnPublisher","getContentPublisher","addContentPublisher","func","set","addContentGetter","addContentUnPublisher","workflow","reviewer","changeRequest","comment","createCommentMethods","contentReview","createContentReviewMethods","getReviewer","bind","scheduleAction","scheduler"],"sources":["index.ts"],"sourcesContent":["import { createWorkflowMethods } from \"./createWorkflowMethods\";\nimport { createReviewerMethods } from \"./createReviewerMethods\";\nimport { createCommentMethods } from \"./createCommentMethods\";\nimport { createChangeRequestMethods } from \"./createChangeRequestMethods\";\nimport { createContentReviewMethods } from \"./createContentReviewMethods\";\nimport {\n AdvancedPublishingWorkflow,\n ApwContentTypes,\n ContentGetter,\n ContentPublisher,\n ContentUnPublisher,\n CreateApwParams\n} from \"~/types\";\n\nexport const createApw = (params: CreateApwParams): AdvancedPublishingWorkflow => {\n const contentGetters = new Map<ApwContentTypes, ContentGetter>();\n const contentPublisher = new Map<ApwContentTypes, ContentPublisher>();\n const contentUnPublisher = new Map<ApwContentTypes, ContentUnPublisher>();\n\n const workflowMethods = createWorkflowMethods(params);\n const reviewerMethods = createReviewerMethods(params);\n const changeRequestMethods = createChangeRequestMethods(params);\n\n function getContentGetter(type: ApwContentTypes) {\n const getter = contentGetters.get(type);\n if (!getter) {\n throw new Error(\n `No \"ContentGetter\" loader found for type: \"${type}\". You must define a loader.`\n );\n }\n return getter;\n }\n\n function getContentUnPublisher(type: ApwContentTypes) {\n const getter = contentUnPublisher.get(type);\n if (!getter) {\n throw new Error(\n `No \"Content UnPublisher\" loader found for type: \"${type}\". You must define a loader.`\n );\n }\n return getter;\n }\n\n function getContentPublisher(type: ApwContentTypes) {\n const getter = contentPublisher.get(type);\n if (!getter) {\n throw new Error(\n `No \"ContentPublisher\" loader found for type: \"${type}\". You must define a loader.`\n );\n }\n return getter;\n }\n\n return {\n addContentPublisher(type, func) {\n contentPublisher.set(type, func);\n },\n getContentPublisher,\n addContentGetter(type, func) {\n contentGetters.set(type, func);\n },\n getContentGetter,\n addContentUnPublisher(type, func) {\n contentUnPublisher.set(type, func);\n },\n getContentUnPublisher,\n workflow: workflowMethods,\n reviewer: reviewerMethods,\n changeRequest: changeRequestMethods,\n comment: createCommentMethods(params),\n contentReview: createContentReviewMethods({\n ...params,\n getReviewer: reviewerMethods.get.bind(reviewerMethods),\n getContentGetter,\n getContentPublisher,\n getContentUnPublisher\n }),\n /**\n * Add scheduler to context so that we can access it later. For example, during testing.\n */\n scheduleAction: params.scheduler\n };\n};\n"],"mappings":"
|
1
|
+
{"version":3,"names":["createApw","params","contentGetters","Map","contentPublisher","contentUnPublisher","workflowMethods","createWorkflowMethods","reviewerMethods","createReviewerMethods","changeRequestMethods","createChangeRequestMethods","getContentGetter","type","getter","get","Error","getContentUnPublisher","getContentPublisher","addContentPublisher","func","set","addContentGetter","addContentUnPublisher","workflow","reviewer","changeRequest","comment","createCommentMethods","contentReview","createContentReviewMethods","getReviewer","bind","scheduleAction","scheduler"],"sources":["index.ts"],"sourcesContent":["import { createWorkflowMethods } from \"./createWorkflowMethods\";\nimport { createReviewerMethods } from \"./createReviewerMethods\";\nimport { createCommentMethods } from \"./createCommentMethods\";\nimport { createChangeRequestMethods } from \"./createChangeRequestMethods\";\nimport { createContentReviewMethods } from \"./createContentReviewMethods\";\nimport {\n AdvancedPublishingWorkflow,\n ApwContentTypes,\n ContentGetter,\n ContentPublisher,\n ContentUnPublisher,\n CreateApwParams\n} from \"~/types\";\n\nexport const createApw = (params: CreateApwParams): AdvancedPublishingWorkflow => {\n const contentGetters = new Map<ApwContentTypes, ContentGetter>();\n const contentPublisher = new Map<ApwContentTypes, ContentPublisher>();\n const contentUnPublisher = new Map<ApwContentTypes, ContentUnPublisher>();\n\n const workflowMethods = createWorkflowMethods(params);\n const reviewerMethods = createReviewerMethods(params);\n const changeRequestMethods = createChangeRequestMethods(params);\n\n function getContentGetter(type: ApwContentTypes) {\n const getter = contentGetters.get(type);\n if (!getter) {\n throw new Error(\n `No \"ContentGetter\" loader found for type: \"${type}\". You must define a loader.`\n );\n }\n return getter;\n }\n\n function getContentUnPublisher(type: ApwContentTypes) {\n const getter = contentUnPublisher.get(type);\n if (!getter) {\n throw new Error(\n `No \"Content UnPublisher\" loader found for type: \"${type}\". You must define a loader.`\n );\n }\n return getter;\n }\n\n function getContentPublisher(type: ApwContentTypes) {\n const getter = contentPublisher.get(type);\n if (!getter) {\n throw new Error(\n `No \"ContentPublisher\" loader found for type: \"${type}\". You must define a loader.`\n );\n }\n return getter;\n }\n\n return {\n addContentPublisher(type, func) {\n contentPublisher.set(type, func);\n },\n getContentPublisher,\n addContentGetter(type, func) {\n contentGetters.set(type, func);\n },\n getContentGetter,\n addContentUnPublisher(type, func) {\n contentUnPublisher.set(type, func);\n },\n getContentUnPublisher,\n workflow: workflowMethods,\n reviewer: reviewerMethods,\n changeRequest: changeRequestMethods,\n comment: createCommentMethods(params),\n contentReview: createContentReviewMethods({\n ...params,\n getReviewer: reviewerMethods.get.bind(reviewerMethods),\n getContentGetter,\n getContentPublisher,\n getContentUnPublisher\n }),\n /**\n * Add scheduler to context so that we can access it later. For example, during testing.\n */\n scheduleAction: params.scheduler\n };\n};\n"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AAUO,MAAMA,SAAS,GAAIC,MAAD,IAAyD;EAC9E,MAAMC,cAAc,GAAG,IAAIC,GAAJ,EAAvB;EACA,MAAMC,gBAAgB,GAAG,IAAID,GAAJ,EAAzB;EACA,MAAME,kBAAkB,GAAG,IAAIF,GAAJ,EAA3B;EAEA,MAAMG,eAAe,GAAG,IAAAC,4CAAA,EAAsBN,MAAtB,CAAxB;EACA,MAAMO,eAAe,GAAG,IAAAC,4CAAA,EAAsBR,MAAtB,CAAxB;EACA,MAAMS,oBAAoB,GAAG,IAAAC,sDAAA,EAA2BV,MAA3B,CAA7B;;EAEA,SAASW,gBAAT,CAA0BC,IAA1B,EAAiD;IAC7C,MAAMC,MAAM,GAAGZ,cAAc,CAACa,GAAf,CAAmBF,IAAnB,CAAf;;IACA,IAAI,CAACC,MAAL,EAAa;MACT,MAAM,IAAIE,KAAJ,CACD,8CAA6CH,IAAK,8BADjD,CAAN;IAGH;;IACD,OAAOC,MAAP;EACH;;EAED,SAASG,qBAAT,CAA+BJ,IAA/B,EAAsD;IAClD,MAAMC,MAAM,GAAGT,kBAAkB,CAACU,GAAnB,CAAuBF,IAAvB,CAAf;;IACA,IAAI,CAACC,MAAL,EAAa;MACT,MAAM,IAAIE,KAAJ,CACD,oDAAmDH,IAAK,8BADvD,CAAN;IAGH;;IACD,OAAOC,MAAP;EACH;;EAED,SAASI,mBAAT,CAA6BL,IAA7B,EAAoD;IAChD,MAAMC,MAAM,GAAGV,gBAAgB,CAACW,GAAjB,CAAqBF,IAArB,CAAf;;IACA,IAAI,CAACC,MAAL,EAAa;MACT,MAAM,IAAIE,KAAJ,CACD,iDAAgDH,IAAK,8BADpD,CAAN;IAGH;;IACD,OAAOC,MAAP;EACH;;EAED,OAAO;IACHK,mBAAmB,CAACN,IAAD,EAAOO,IAAP,EAAa;MAC5BhB,gBAAgB,CAACiB,GAAjB,CAAqBR,IAArB,EAA2BO,IAA3B;IACH,CAHE;;IAIHF,mBAJG;;IAKHI,gBAAgB,CAACT,IAAD,EAAOO,IAAP,EAAa;MACzBlB,cAAc,CAACmB,GAAf,CAAmBR,IAAnB,EAAyBO,IAAzB;IACH,CAPE;;IAQHR,gBARG;;IASHW,qBAAqB,CAACV,IAAD,EAAOO,IAAP,EAAa;MAC9Bf,kBAAkB,CAACgB,GAAnB,CAAuBR,IAAvB,EAA6BO,IAA7B;IACH,CAXE;;IAYHH,qBAZG;IAaHO,QAAQ,EAAElB,eAbP;IAcHmB,QAAQ,EAAEjB,eAdP;IAeHkB,aAAa,EAAEhB,oBAfZ;IAgBHiB,OAAO,EAAE,IAAAC,0CAAA,EAAqB3B,MAArB,CAhBN;IAiBH4B,aAAa,EAAE,IAAAC,sDAAA,8DACR7B,MADQ;MAEX8B,WAAW,EAAEvB,eAAe,CAACO,GAAhB,CAAoBiB,IAApB,CAAyBxB,eAAzB,CAFF;MAGXI,gBAHW;MAIXM,mBAJW;MAKXD;IALW,GAjBZ;;IAwBH;AACR;AACA;IACQgB,cAAc,EAAEhC,MAAM,CAACiC;EA3BpB,CAAP;AA6BH,CApEM"}
|
package/crud/utils.js
CHANGED
@@ -1,24 +1,35 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
4
|
+
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
5
6
|
value: true
|
6
7
|
});
|
7
8
|
exports.INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META = void 0;
|
8
9
|
exports.checkValidDateTime = checkValidDateTime;
|
9
10
|
exports.getPendingRequiredSteps = exports.filterContentReviewsByRequiresMyAttention = void 0;
|
11
|
+
|
10
12
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
13
|
+
|
11
14
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
15
|
+
|
12
16
|
var _dayjs = _interopRequireDefault(require("dayjs"));
|
17
|
+
|
13
18
|
var _utc = _interopRequireDefault(require("dayjs/plugin/utc"));
|
19
|
+
|
14
20
|
var _cloneDeep = _interopRequireDefault(require("lodash/cloneDeep"));
|
21
|
+
|
15
22
|
var _set = _interopRequireDefault(require("lodash/set"));
|
23
|
+
|
16
24
|
var _types = require("../types");
|
25
|
+
|
17
26
|
_dayjs.default.extend(_utc.default);
|
27
|
+
|
18
28
|
function checkValidDateTime(datetime) {
|
19
29
|
if (typeof datetime !== "string") {
|
20
30
|
return;
|
21
31
|
}
|
32
|
+
|
22
33
|
if (!(0, _dayjs.default)(datetime).isValid()) {
|
23
34
|
throw new _error.default({
|
24
35
|
message: `Invalid input "datetime" should be an ISO string.`,
|
@@ -28,7 +39,9 @@ function checkValidDateTime(datetime) {
|
|
28
39
|
}
|
29
40
|
});
|
30
41
|
}
|
42
|
+
|
31
43
|
const today = _dayjs.default.utc();
|
44
|
+
|
32
45
|
if ((0, _dayjs.default)(datetime).isBefore(today)) {
|
33
46
|
throw new _error.default({
|
34
47
|
message: `Cannot schedule for a past "datetime".`,
|
@@ -39,15 +52,19 @@ function checkValidDateTime(datetime) {
|
|
39
52
|
});
|
40
53
|
}
|
41
54
|
}
|
55
|
+
|
42
56
|
const getPendingRequiredSteps = (steps, predicate) => {
|
43
57
|
return steps.filter(step => {
|
44
58
|
const isRequiredStep = [_types.ApwWorkflowStepTypes.MANDATORY_BLOCKING, _types.ApwWorkflowStepTypes.MANDATORY_NON_BLOCKING].includes(step.type);
|
59
|
+
|
45
60
|
if (!isRequiredStep) {
|
46
61
|
return false;
|
47
62
|
}
|
63
|
+
|
48
64
|
return predicate(step);
|
49
65
|
});
|
50
66
|
};
|
67
|
+
|
51
68
|
exports.getPendingRequiredSteps = getPendingRequiredSteps;
|
52
69
|
const INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META = {
|
53
70
|
scheduledOn: null,
|
@@ -55,6 +72,7 @@ const INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META = {
|
|
55
72
|
scheduledActionId: null
|
56
73
|
};
|
57
74
|
exports.INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META = INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META;
|
75
|
+
|
58
76
|
/**
|
59
77
|
* Filter "content reviews" that are "underReview" and current user is a reviewer for the active step.
|
60
78
|
* That is the user is able to provide sign-off or comment.
|
@@ -69,6 +87,7 @@ const filterContentReviewsByRequiresMyAttention = async params => {
|
|
69
87
|
/**
|
70
88
|
* Get all "content reviews" with status "underReview"
|
71
89
|
*/
|
90
|
+
|
72
91
|
const newListParams = (0, _set.default)((0, _cloneDeep.default)(listParams), "where.reviewStatus", _types.ApwContentReviewStatus.UNDER_REVIEW);
|
73
92
|
const [contentReviews, meta] = await listContentReviews(newListParams);
|
74
93
|
const identity = getIdentity();
|
@@ -76,13 +95,17 @@ const filterContentReviewsByRequiresMyAttention = async params => {
|
|
76
95
|
/**
|
77
96
|
* Filter items where current user is a reviewer for the active step.
|
78
97
|
*/
|
98
|
+
|
79
99
|
for (let i = 0; i < contentReviews.length; i++) {
|
80
100
|
const contentReview = contentReviews[i];
|
81
101
|
const activeStep = contentReview.steps.find(step => step.status === _types.ApwContentReviewStepStatus.ACTIVE);
|
102
|
+
|
82
103
|
if (!activeStep) {
|
83
104
|
continue;
|
84
105
|
}
|
106
|
+
|
85
107
|
let requiresMyAttention = false;
|
108
|
+
|
86
109
|
for (let j = 0; j < activeStep.reviewers.length; j++) {
|
87
110
|
const {
|
88
111
|
id
|
@@ -90,21 +113,26 @@ const filterContentReviewsByRequiresMyAttention = async params => {
|
|
90
113
|
/**
|
91
114
|
* Load reviewer
|
92
115
|
*/
|
116
|
+
|
93
117
|
const reviewer = await getReviewer(id);
|
94
118
|
/**
|
95
119
|
* Check if the current logged in user is the reviewer.
|
96
120
|
*/
|
121
|
+
|
97
122
|
if (reviewer.identityId === identity.id) {
|
98
123
|
requiresMyAttention = true;
|
99
124
|
break;
|
100
125
|
}
|
101
126
|
}
|
127
|
+
|
102
128
|
if (requiresMyAttention) {
|
103
129
|
filteredItems.push(contentReview);
|
104
130
|
}
|
105
131
|
}
|
132
|
+
|
106
133
|
return [filteredItems, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, meta), {}, {
|
107
134
|
totalCount: filteredItems.length
|
108
135
|
})];
|
109
136
|
};
|
137
|
+
|
110
138
|
exports.filterContentReviewsByRequiresMyAttention = filterContentReviewsByRequiresMyAttention;
|
package/crud/utils.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["dayjs","extend","utc","checkValidDateTime","datetime","isValid","Error","message","code","data","today","isBefore","getPendingRequiredSteps","steps","predicate","filter","step","isRequiredStep","ApwWorkflowStepTypes","MANDATORY_BLOCKING","MANDATORY_NON_BLOCKING","includes","type","INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META","scheduledOn","scheduledBy","scheduledActionId","filterContentReviewsByRequiresMyAttention","params","listContentReviews","listParams","getIdentity","getReviewer","newListParams","set","cloneDeep","ApwContentReviewStatus","UNDER_REVIEW","contentReviews","meta","identity","filteredItems","i","length","contentReview","activeStep","find","status","ApwContentReviewStepStatus","ACTIVE","requiresMyAttention","j","reviewers","id","reviewer","identityId","push","totalCount"],"sources":["utils.ts"],"sourcesContent":["import Error from \"@webiny/error\";\nimport dayjs from \"dayjs\";\nimport utc from \"dayjs/plugin/utc\";\nimport cloneDeep from \"lodash/cloneDeep\";\nimport set from \"lodash/set\";\nimport {\n ApwContentReview,\n ApwContentReviewListParams,\n ApwContentReviewStatus,\n ApwContentReviewStep,\n ApwContentReviewStepStatus,\n ApwWorkflowStepTypes,\n ListMeta\n} from \"~/types\";\nimport { CreateContentReviewMethodsParams } from \"./createContentReviewMethods\";\n\ndayjs.extend(utc);\n\nexport function checkValidDateTime(datetime: string | undefined): void {\n if (typeof datetime !== \"string\") {\n return;\n }\n\n if (!dayjs(datetime).isValid()) {\n throw new Error({\n message: `Invalid input \"datetime\" should be an ISO string.`,\n code: \"INVALID_DATETIME_FORMAT\",\n data: {\n datetime\n }\n });\n }\n const today = dayjs.utc();\n\n if (dayjs(datetime).isBefore(today)) {\n throw new Error({\n message: `Cannot schedule for a past \"datetime\".`,\n code: \"PAST_DATETIME\",\n data: {\n datetime\n }\n });\n }\n}\n\nexport interface GetPendingRequiredSteps {\n (\n steps: ApwContentReviewStep[],\n predicate: (step: ApwContentReviewStep) => boolean\n ): ApwContentReviewStep[];\n}\n\nexport const getPendingRequiredSteps: GetPendingRequiredSteps = (steps, predicate) => {\n return steps.filter(step => {\n const isRequiredStep = [\n ApwWorkflowStepTypes.MANDATORY_BLOCKING,\n ApwWorkflowStepTypes.MANDATORY_NON_BLOCKING\n ].includes(step.type);\n\n if (!isRequiredStep) {\n return false;\n }\n\n return predicate(step);\n });\n};\n\nexport const INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META = {\n scheduledOn: null,\n scheduledBy: null,\n scheduledActionId: null\n};\n\nexport interface FilterContentReviewsParams\n extends Pick<CreateContentReviewMethodsParams, \"getReviewer\" | \"getIdentity\"> {\n listParams: ApwContentReviewListParams;\n listContentReviews: CreateContentReviewMethodsParams[\"storageOperations\"][\"listContentReviews\"];\n}\n\n/**\n * Filter \"content reviews\" that are \"underReview\" and current user is a reviewer for the active step.\n * That is the user is able to provide sign-off or comment.\n */\nexport const filterContentReviewsByRequiresMyAttention = async (\n params: FilterContentReviewsParams\n): Promise<[ApwContentReview[], ListMeta]> => {\n const { listContentReviews, listParams, getIdentity, getReviewer } = params;\n /**\n * Get all \"content reviews\" with status \"underReview\"\n */\n const newListParams = set(\n cloneDeep(listParams),\n \"where.reviewStatus\",\n ApwContentReviewStatus.UNDER_REVIEW\n );\n const [contentReviews, meta] = await listContentReviews(newListParams);\n\n const identity = getIdentity();\n const filteredItems = [];\n /**\n * Filter items where current user is a reviewer for the active step.\n */\n for (let i = 0; i < contentReviews.length; i++) {\n const contentReview = contentReviews[i];\n\n const activeStep = contentReview.steps.find(\n step => step.status === ApwContentReviewStepStatus.ACTIVE\n );\n\n if (!activeStep) {\n continue;\n }\n\n let requiresMyAttention = false;\n\n for (let j = 0; j < activeStep.reviewers.length; j++) {\n const { id } = activeStep.reviewers[j];\n /**\n * Load reviewer\n */\n const reviewer = await getReviewer(id);\n /**\n * Check if the current logged in user is the reviewer.\n */\n if (reviewer.identityId === identity.id) {\n requiresMyAttention = true;\n break;\n }\n }\n\n if (requiresMyAttention) {\n filteredItems.push(contentReview);\n }\n }\n\n return [\n filteredItems,\n {\n ...meta,\n totalCount: filteredItems.length\n }\n ];\n};\n"],"mappings":"
|
1
|
+
{"version":3,"names":["dayjs","extend","utc","checkValidDateTime","datetime","isValid","Error","message","code","data","today","isBefore","getPendingRequiredSteps","steps","predicate","filter","step","isRequiredStep","ApwWorkflowStepTypes","MANDATORY_BLOCKING","MANDATORY_NON_BLOCKING","includes","type","INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META","scheduledOn","scheduledBy","scheduledActionId","filterContentReviewsByRequiresMyAttention","params","listContentReviews","listParams","getIdentity","getReviewer","newListParams","set","cloneDeep","ApwContentReviewStatus","UNDER_REVIEW","contentReviews","meta","identity","filteredItems","i","length","contentReview","activeStep","find","status","ApwContentReviewStepStatus","ACTIVE","requiresMyAttention","j","reviewers","id","reviewer","identityId","push","totalCount"],"sources":["utils.ts"],"sourcesContent":["import Error from \"@webiny/error\";\nimport dayjs from \"dayjs\";\nimport utc from \"dayjs/plugin/utc\";\nimport cloneDeep from \"lodash/cloneDeep\";\nimport set from \"lodash/set\";\nimport {\n ApwContentReview,\n ApwContentReviewListParams,\n ApwContentReviewStatus,\n ApwContentReviewStep,\n ApwContentReviewStepStatus,\n ApwWorkflowStepTypes,\n ListMeta\n} from \"~/types\";\nimport { CreateContentReviewMethodsParams } from \"./createContentReviewMethods\";\n\ndayjs.extend(utc);\n\nexport function checkValidDateTime(datetime: string | undefined): void {\n if (typeof datetime !== \"string\") {\n return;\n }\n\n if (!dayjs(datetime).isValid()) {\n throw new Error({\n message: `Invalid input \"datetime\" should be an ISO string.`,\n code: \"INVALID_DATETIME_FORMAT\",\n data: {\n datetime\n }\n });\n }\n const today = dayjs.utc();\n\n if (dayjs(datetime).isBefore(today)) {\n throw new Error({\n message: `Cannot schedule for a past \"datetime\".`,\n code: \"PAST_DATETIME\",\n data: {\n datetime\n }\n });\n }\n}\n\nexport interface GetPendingRequiredSteps {\n (\n steps: ApwContentReviewStep[],\n predicate: (step: ApwContentReviewStep) => boolean\n ): ApwContentReviewStep[];\n}\n\nexport const getPendingRequiredSteps: GetPendingRequiredSteps = (steps, predicate) => {\n return steps.filter(step => {\n const isRequiredStep = [\n ApwWorkflowStepTypes.MANDATORY_BLOCKING,\n ApwWorkflowStepTypes.MANDATORY_NON_BLOCKING\n ].includes(step.type);\n\n if (!isRequiredStep) {\n return false;\n }\n\n return predicate(step);\n });\n};\n\nexport const INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META = {\n scheduledOn: null,\n scheduledBy: null,\n scheduledActionId: null\n};\n\nexport interface FilterContentReviewsParams\n extends Pick<CreateContentReviewMethodsParams, \"getReviewer\" | \"getIdentity\"> {\n listParams: ApwContentReviewListParams;\n listContentReviews: CreateContentReviewMethodsParams[\"storageOperations\"][\"listContentReviews\"];\n}\n\n/**\n * Filter \"content reviews\" that are \"underReview\" and current user is a reviewer for the active step.\n * That is the user is able to provide sign-off or comment.\n */\nexport const filterContentReviewsByRequiresMyAttention = async (\n params: FilterContentReviewsParams\n): Promise<[ApwContentReview[], ListMeta]> => {\n const { listContentReviews, listParams, getIdentity, getReviewer } = params;\n /**\n * Get all \"content reviews\" with status \"underReview\"\n */\n const newListParams = set(\n cloneDeep(listParams),\n \"where.reviewStatus\",\n ApwContentReviewStatus.UNDER_REVIEW\n );\n const [contentReviews, meta] = await listContentReviews(newListParams);\n\n const identity = getIdentity();\n const filteredItems = [];\n /**\n * Filter items where current user is a reviewer for the active step.\n */\n for (let i = 0; i < contentReviews.length; i++) {\n const contentReview = contentReviews[i];\n\n const activeStep = contentReview.steps.find(\n step => step.status === ApwContentReviewStepStatus.ACTIVE\n );\n\n if (!activeStep) {\n continue;\n }\n\n let requiresMyAttention = false;\n\n for (let j = 0; j < activeStep.reviewers.length; j++) {\n const { id } = activeStep.reviewers[j];\n /**\n * Load reviewer\n */\n const reviewer = await getReviewer(id);\n /**\n * Check if the current logged in user is the reviewer.\n */\n if (reviewer.identityId === identity.id) {\n requiresMyAttention = true;\n break;\n }\n }\n\n if (requiresMyAttention) {\n filteredItems.push(contentReview);\n }\n }\n\n return [\n filteredItems,\n {\n ...meta,\n totalCount: filteredItems.length\n }\n ];\n};\n"],"mappings":"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"}
|
package/index.js
CHANGED
@@ -1,28 +1,38 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
4
|
+
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
5
6
|
value: true
|
6
7
|
});
|
7
8
|
exports.createApwPageBuilderContext = exports.createApwHeadlessCmsContext = exports.createApwGraphQL = void 0;
|
9
|
+
|
8
10
|
var _graphql = _interopRequireDefault(require("./plugins/graphql"));
|
11
|
+
|
9
12
|
var _context = require("./plugins/context");
|
13
|
+
|
10
14
|
var _apiMailer = require("@webiny/api-mailer");
|
15
|
+
|
11
16
|
var _apiAdminSettings = require("@webiny/api-admin-settings");
|
17
|
+
|
12
18
|
/**
|
13
19
|
* We have separated context and GraphQL creation so user can initialize only context if required.
|
14
20
|
* GraphQL will not work without context, but context will without GraphQL.
|
15
21
|
*/
|
16
|
-
|
17
22
|
const createApwHeadlessCmsContext = params => {
|
18
23
|
return [...(0, _apiAdminSettings.createAdminSettingsContext)(), ...(0, _apiMailer.createMailerContext)(), (0, _context.createApwHeadlessCmsContext)(params)];
|
19
24
|
};
|
25
|
+
|
20
26
|
exports.createApwHeadlessCmsContext = createApwHeadlessCmsContext;
|
27
|
+
|
21
28
|
const createApwPageBuilderContext = params => {
|
22
29
|
return [...(0, _apiAdminSettings.createAdminSettingsContext)(), ...(0, _apiMailer.createMailerContext)(), ...(0, _apiMailer.createMailerGraphQL)(), (0, _context.createApwPageBuilderContext)(params)];
|
23
30
|
};
|
31
|
+
|
24
32
|
exports.createApwPageBuilderContext = createApwPageBuilderContext;
|
33
|
+
|
25
34
|
const createApwGraphQL = () => {
|
26
35
|
return [(0, _graphql.default)()];
|
27
36
|
};
|
37
|
+
|
28
38
|
exports.createApwGraphQL = createApwGraphQL;
|
package/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["createApwHeadlessCmsContext","params","createAdminSettingsContext","createMailerContext","createHeadlessCms","createApwPageBuilderContext","createMailerGraphQL","createPageBuilder","createApwGraphQL","graphql"],"sources":["index.ts"],"sourcesContent":["/**\n * We have separated context and GraphQL creation so user can initialize only context if required.\n * GraphQL will not work without context, but context will without GraphQL.\n */\nimport graphql from \"~/plugins/graphql\";\nimport {\n createApwHeadlessCmsContext as createHeadlessCms,\n createApwPageBuilderContext as createPageBuilder\n} from \"./plugins/context\";\nimport { CreateApwContextParams } from \"./scheduler/types\";\nimport { createMailerContext, createMailerGraphQL } from \"@webiny/api-mailer\";\nimport { createAdminSettingsContext } from \"@webiny/api-admin-settings\";\n\nexport const createApwHeadlessCmsContext = (params: CreateApwContextParams) => {\n return [...createAdminSettingsContext(), ...createMailerContext(), createHeadlessCms(params)];\n};\n\nexport const createApwPageBuilderContext = (params: CreateApwContextParams) => {\n return [\n ...createAdminSettingsContext(),\n ...createMailerContext(),\n ...createMailerGraphQL(),\n createPageBuilder(params)\n ];\n};\n\nexport const createApwGraphQL = () => {\n return [graphql()];\n};\n"],"mappings":"
|
1
|
+
{"version":3,"names":["createApwHeadlessCmsContext","params","createAdminSettingsContext","createMailerContext","createHeadlessCms","createApwPageBuilderContext","createMailerGraphQL","createPageBuilder","createApwGraphQL","graphql"],"sources":["index.ts"],"sourcesContent":["/**\n * We have separated context and GraphQL creation so user can initialize only context if required.\n * GraphQL will not work without context, but context will without GraphQL.\n */\nimport graphql from \"~/plugins/graphql\";\nimport {\n createApwHeadlessCmsContext as createHeadlessCms,\n createApwPageBuilderContext as createPageBuilder\n} from \"./plugins/context\";\nimport { CreateApwContextParams } from \"./scheduler/types\";\nimport { createMailerContext, createMailerGraphQL } from \"@webiny/api-mailer\";\nimport { createAdminSettingsContext } from \"@webiny/api-admin-settings\";\n\nexport const createApwHeadlessCmsContext = (params: CreateApwContextParams) => {\n return [...createAdminSettingsContext(), ...createMailerContext(), createHeadlessCms(params)];\n};\n\nexport const createApwPageBuilderContext = (params: CreateApwContextParams) => {\n return [\n ...createAdminSettingsContext(),\n ...createMailerContext(),\n ...createMailerGraphQL(),\n createPageBuilder(params)\n ];\n};\n\nexport const createApwGraphQL = () => {\n return [graphql()];\n};\n"],"mappings":";;;;;;;;;AAIA;;AACA;;AAKA;;AACA;;AAXA;AACA;AACA;AACA;AAUO,MAAMA,2BAA2B,GAAIC,MAAD,IAAoC;EAC3E,OAAO,CAAC,GAAG,IAAAC,4CAAA,GAAJ,EAAkC,GAAG,IAAAC,8BAAA,GAArC,EAA4D,IAAAC,oCAAA,EAAkBH,MAAlB,CAA5D,CAAP;AACH,CAFM;;;;AAIA,MAAMI,2BAA2B,GAAIJ,MAAD,IAAoC;EAC3E,OAAO,CACH,GAAG,IAAAC,4CAAA,GADA,EAEH,GAAG,IAAAC,8BAAA,GAFA,EAGH,GAAG,IAAAG,8BAAA,GAHA,EAIH,IAAAC,oCAAA,EAAkBN,MAAlB,CAJG,CAAP;AAMH,CAPM;;;;AASA,MAAMO,gBAAgB,GAAG,MAAM;EAClC,OAAO,CAAC,IAAAC,gBAAA,GAAD,CAAP;AACH,CAFM"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@webiny/api-apw",
|
3
|
-
"version": "0.0.0-unstable.
|
3
|
+
"version": "0.0.0-unstable.78f581c1d2",
|
4
4
|
"keywords": [
|
5
5
|
"apw:base"
|
6
6
|
],
|
@@ -14,31 +14,31 @@
|
|
14
14
|
"author": "Webiny Ltd",
|
15
15
|
"license": "MIT",
|
16
16
|
"dependencies": {
|
17
|
-
"@aws-sdk/client-cloudwatch-events": "3.
|
18
|
-
"@babel/runtime": "7.
|
17
|
+
"@aws-sdk/client-cloudwatch-events": "3.186.0",
|
18
|
+
"@babel/runtime": "7.19.0",
|
19
19
|
"@commodo/fields": "1.1.2-beta.20",
|
20
|
-
"@webiny/api": "0.0.0-unstable.
|
21
|
-
"@webiny/api-admin-settings": "0.0.0-unstable.
|
22
|
-
"@webiny/api-headless-cms": "0.0.0-unstable.
|
23
|
-
"@webiny/api-i18n": "0.0.0-unstable.
|
24
|
-
"@webiny/api-i18n-ddb": "0.0.0-unstable.
|
25
|
-
"@webiny/api-mailer": "0.0.0-unstable.
|
26
|
-
"@webiny/api-page-builder": "0.0.0-unstable.
|
27
|
-
"@webiny/api-security": "0.0.0-unstable.
|
28
|
-
"@webiny/api-tenancy": "0.0.0-unstable.
|
29
|
-
"@webiny/api-wcp": "0.0.0-unstable.
|
30
|
-
"@webiny/db-dynamodb": "0.0.0-unstable.
|
31
|
-
"@webiny/error": "0.0.0-unstable.
|
32
|
-
"@webiny/handler": "0.0.0-unstable.
|
33
|
-
"@webiny/handler-client": "0.0.0-unstable.
|
34
|
-
"@webiny/handler-db": "0.0.0-unstable.
|
35
|
-
"@webiny/handler-graphql": "0.0.0-unstable.
|
36
|
-
"@webiny/handler-logs": "0.0.0-unstable.
|
37
|
-
"@webiny/plugins": "0.0.0-unstable.
|
38
|
-
"@webiny/pubsub": "0.0.0-unstable.
|
39
|
-
"@webiny/utils": "0.0.0-unstable.
|
40
|
-
"@webiny/validation": "0.0.0-unstable.
|
41
|
-
"dayjs": "1.11.
|
20
|
+
"@webiny/api": "0.0.0-unstable.78f581c1d2",
|
21
|
+
"@webiny/api-admin-settings": "0.0.0-unstable.78f581c1d2",
|
22
|
+
"@webiny/api-headless-cms": "0.0.0-unstable.78f581c1d2",
|
23
|
+
"@webiny/api-i18n": "0.0.0-unstable.78f581c1d2",
|
24
|
+
"@webiny/api-i18n-ddb": "0.0.0-unstable.78f581c1d2",
|
25
|
+
"@webiny/api-mailer": "0.0.0-unstable.78f581c1d2",
|
26
|
+
"@webiny/api-page-builder": "0.0.0-unstable.78f581c1d2",
|
27
|
+
"@webiny/api-security": "0.0.0-unstable.78f581c1d2",
|
28
|
+
"@webiny/api-tenancy": "0.0.0-unstable.78f581c1d2",
|
29
|
+
"@webiny/api-wcp": "0.0.0-unstable.78f581c1d2",
|
30
|
+
"@webiny/db-dynamodb": "0.0.0-unstable.78f581c1d2",
|
31
|
+
"@webiny/error": "0.0.0-unstable.78f581c1d2",
|
32
|
+
"@webiny/handler": "0.0.0-unstable.78f581c1d2",
|
33
|
+
"@webiny/handler-client": "0.0.0-unstable.78f581c1d2",
|
34
|
+
"@webiny/handler-db": "0.0.0-unstable.78f581c1d2",
|
35
|
+
"@webiny/handler-graphql": "0.0.0-unstable.78f581c1d2",
|
36
|
+
"@webiny/handler-logs": "0.0.0-unstable.78f581c1d2",
|
37
|
+
"@webiny/plugins": "0.0.0-unstable.78f581c1d2",
|
38
|
+
"@webiny/pubsub": "0.0.0-unstable.78f581c1d2",
|
39
|
+
"@webiny/utils": "0.0.0-unstable.78f581c1d2",
|
40
|
+
"@webiny/validation": "0.0.0-unstable.78f581c1d2",
|
41
|
+
"dayjs": "1.11.5",
|
42
42
|
"lodash": "4.17.21",
|
43
43
|
"mdbid": "1.0.0"
|
44
44
|
},
|
@@ -46,14 +46,14 @@
|
|
46
46
|
"@babel/cli": "^7.19.3",
|
47
47
|
"@babel/core": "^7.19.3",
|
48
48
|
"@babel/preset-env": "^7.19.4",
|
49
|
-
"@webiny/api-headless-cms-ddb": "^0.0.0-unstable.
|
50
|
-
"@webiny/api-page-builder-so-ddb": "^0.0.0-unstable.
|
51
|
-
"@webiny/api-security-so-ddb": "^0.0.0-unstable.
|
52
|
-
"@webiny/api-tenancy-so-ddb": "^0.0.0-unstable.
|
53
|
-
"@webiny/cli": "^0.0.0-unstable.
|
54
|
-
"@webiny/handler-aws": "^0.0.0-unstable.
|
55
|
-
"@webiny/project-utils": "^0.0.0-unstable.
|
56
|
-
"@webiny/wcp": "^0.0.0-unstable.
|
49
|
+
"@webiny/api-headless-cms-ddb": "^0.0.0-unstable.78f581c1d2",
|
50
|
+
"@webiny/api-page-builder-so-ddb": "^0.0.0-unstable.78f581c1d2",
|
51
|
+
"@webiny/api-security-so-ddb": "^0.0.0-unstable.78f581c1d2",
|
52
|
+
"@webiny/api-tenancy-so-ddb": "^0.0.0-unstable.78f581c1d2",
|
53
|
+
"@webiny/cli": "^0.0.0-unstable.78f581c1d2",
|
54
|
+
"@webiny/handler-aws": "^0.0.0-unstable.78f581c1d2",
|
55
|
+
"@webiny/project-utils": "^0.0.0-unstable.78f581c1d2",
|
56
|
+
"@webiny/wcp": "^0.0.0-unstable.78f581c1d2",
|
57
57
|
"get-yarn-workspaces": "^1.0.2",
|
58
58
|
"graphql": "^15.7.2",
|
59
59
|
"jest": "^28.1.0",
|
@@ -72,5 +72,5 @@
|
|
72
72
|
"build": "yarn webiny run build",
|
73
73
|
"watch": "yarn webiny run watch"
|
74
74
|
},
|
75
|
-
"gitHead": "
|
75
|
+
"gitHead": "78f581c1d2e5e6936aa11b9452a66d2a3652a1b2"
|
76
76
|
}
|