@webiny/api-apw 0.0.0-unstable.990c3ab1b6 → 0.0.0-unstable.99666aeb00
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/crud/createContentReviewMethods.js +20 -5
- package/crud/createContentReviewMethods.js.map +1 -1
- package/index.d.ts +1 -2
- package/index.js +1 -5
- package/index.js.map +1 -1
- package/package.json +40 -47
- package/plugins/context.d.ts +0 -1
- package/plugins/context.js +2 -16
- package/plugins/context.js.map +1 -1
- package/plugins/graphql/changeRequest.gql.js +2 -2
- package/plugins/graphql/changeRequest.gql.js.map +1 -1
- package/plugins/graphql/comment.gql.js +2 -2
- package/plugins/graphql/comment.gql.js.map +1 -1
- package/plugins/graphql/contentReview.gql.js +5 -5
- package/plugins/graphql/contentReview.gql.js.map +1 -1
- package/plugins/graphql/reviewer.gql.js +2 -2
- package/plugins/graphql/reviewer.gql.js.map +1 -1
- package/plugins/graphql/workflow.gql.js +2 -2
- package/plugins/graphql/workflow.gql.js.map +1 -1
- package/plugins/graphql.js +2 -2
- package/plugins/graphql.js.map +1 -1
- package/plugins/hooks/initializeContentReviewSteps.js +8 -2
- package/plugins/hooks/initializeContentReviewSteps.js.map +1 -1
- package/plugins/hooks/notifications/changeRequestAfterCreate.js +3 -8
- package/plugins/hooks/notifications/changeRequestAfterCreate.js.map +1 -1
- package/plugins/hooks/notifications/commentAfterCreate.js +3 -8
- package/plugins/hooks/notifications/commentAfterCreate.js.map +1 -1
- package/plugins/hooks/notifications/contentReviewAfterCreate.js +3 -8
- package/plugins/hooks/notifications/contentReviewAfterCreate.js.map +1 -1
- package/plugins/hooks/notifications/reviewers.js +15 -14
- package/plugins/hooks/notifications/reviewers.js.map +1 -1
- package/scheduler/createScheduleActionMethods.js +2 -7
- package/scheduler/createScheduleActionMethods.js.map +1 -1
- package/scheduler/handlers/executeAction/index.d.ts +1 -1
- package/scheduler/handlers/executeAction/index.js +37 -7
- package/scheduler/handlers/executeAction/index.js.map +1 -1
- package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.d.ts +6 -0
- package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js +14 -0
- package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js.map +1 -1
- package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.d.ts +2 -3
- package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js +7 -2
- package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js.map +1 -1
- package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.d.ts +2 -2
- package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js +3 -59
- package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js.map +1 -1
- package/scheduler/handlers/scheduleAction/index.d.ts +1 -1
- package/scheduler/handlers/scheduleAction/index.js +5 -1
- package/scheduler/handlers/scheduleAction/index.js.map +1 -1
- package/scheduler/handlers/scheduleAction/scheduleAction.utils.js +2 -0
- package/scheduler/handlers/scheduleAction/scheduleAction.utils.js.map +1 -1
- package/scheduler/handlers/utils.d.ts +1 -2
- package/scheduler/handlers/utils.js +0 -1
- package/scheduler/handlers/utils.js.map +1 -1
- package/scheduler/types.d.ts +2 -20
- package/scheduler/types.js +0 -5
- package/scheduler/types.js.map +1 -1
- package/storageOperations/changeRequestStorageOperations.js +20 -20
- package/storageOperations/changeRequestStorageOperations.js.map +1 -1
- package/storageOperations/commentStorageOperations.js +23 -23
- package/storageOperations/commentStorageOperations.js.map +1 -1
- package/storageOperations/contentReviewStorageOperations.js +20 -20
- package/storageOperations/contentReviewStorageOperations.js.map +1 -1
- package/storageOperations/models/contentModelPluginFactory.d.ts +3 -10
- package/storageOperations/models/contentModelPluginFactory.js +3 -6
- package/storageOperations/models/contentModelPluginFactory.js.map +1 -1
- package/storageOperations/models/index.js +0 -4
- package/storageOperations/models/index.js.map +1 -1
- package/storageOperations/reviewerStorageOperations.js +23 -28
- package/storageOperations/reviewerStorageOperations.js.map +1 -1
- package/storageOperations/workflowStorageOperations.js +20 -18
- package/storageOperations/workflowStorageOperations.js.map +1 -1
- package/types.d.ts +6 -5
- package/types.js.map +1 -1
- package/utils/resolve.d.ts +1 -1
@@ -243,11 +243,13 @@ function createContentReviewMethods(params) {
|
|
243
243
|
return true;
|
244
244
|
},
|
245
245
|
async retractSignOff(id, stepId) {
|
246
|
-
|
246
|
+
var _contentReview$conten;
|
247
|
+
const contentReview = await this.get(id);
|
247
248
|
const {
|
248
249
|
steps,
|
249
|
-
reviewStatus
|
250
|
-
|
250
|
+
reviewStatus,
|
251
|
+
content
|
252
|
+
} = contentReview;
|
251
253
|
const stepIndex = steps.findIndex(step => step.id === stepId);
|
252
254
|
const currentStep = steps[stepIndex];
|
253
255
|
const identity = getIdentity();
|
@@ -262,7 +264,7 @@ function createContentReviewMethods(params) {
|
|
262
264
|
*/
|
263
265
|
if (!hasPermission) {
|
264
266
|
throw new _errors.NotAuthorizedError({
|
265
|
-
entry,
|
267
|
+
entry: contentReview,
|
266
268
|
input: {
|
267
269
|
id,
|
268
270
|
step: stepId
|
@@ -274,7 +276,7 @@ function createContentReviewMethods(params) {
|
|
274
276
|
*/
|
275
277
|
if (currentStep.status !== _types.ApwContentReviewStepStatus.DONE) {
|
276
278
|
throw new _errors.NoSignOffProvidedError({
|
277
|
-
entry,
|
279
|
+
entry: contentReview,
|
278
280
|
input: {
|
279
281
|
id,
|
280
282
|
step: stepId
|
@@ -319,7 +321,20 @@ function createContentReviewMethods(params) {
|
|
319
321
|
if (pendingRequiredSteps.length !== 0) {
|
320
322
|
newStatus = _types.ApwContentReviewStatus.UNDER_REVIEW;
|
321
323
|
}
|
324
|
+
|
325
|
+
/**
|
326
|
+
* We need to delete the scheduled action if one was created.
|
327
|
+
*/
|
328
|
+
const scheduledActionId = (_contentReview$conten = contentReview.content) === null || _contentReview$conten === void 0 ? void 0 : _contentReview$conten.scheduledActionId;
|
329
|
+
if (!!scheduledActionId) {
|
330
|
+
await scheduler.delete(scheduledActionId);
|
331
|
+
}
|
322
332
|
await this.update(id, {
|
333
|
+
content: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, content), {}, {
|
334
|
+
scheduledOn: null,
|
335
|
+
scheduledBy: null,
|
336
|
+
scheduledActionId: null
|
337
|
+
}),
|
323
338
|
steps: updatedSteps,
|
324
339
|
reviewStatus: newStatus
|
325
340
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["createContentReviewMethods","params","getIdentity","storageOperations","getReviewer","getContentGetter","getContentPublisher","getContentUnPublisher","scheduler","handlerClient","getTenant","getLocale","plugins","onContentReviewBeforeCreate","createTopic","onContentReviewAfterCreate","onContentReviewBeforeUpdate","onContentReviewAfterUpdate","onContentReviewBeforeDelete","onContentReviewAfterDelete","onContentReviewBeforeList","get","id","getContentReview","list","where","publish","reviewStatus","filterContentReviewsByRequiresMyAttention","listParams","listContentReviews","create","data","input","ApwContentReviewStatus","UNDER_REVIEW","contentReview","createContentReview","update","original","updateContentReview","delete","deleteContentReview","provideSignOff","stepId","entry","steps","stepIndex","findIndex","step","currentStep","previousStep","identity","hasPermission","hasReviewer","NotAuthorizedError","status","ApwContentReviewStepStatus","DONE","type","ApwWorkflowStepTypes","MANDATORY_BLOCKING","StepMissingError","pendingChangeRequests","PendingChangeRequestsError","ACTIVE","StepInActiveError","previousStepStatus","updatedSteps","map","index","signOffProvidedOn","Date","toISOString","signOffProvidedBy","getNextStepStatus","newStatus","pendingRequiredSteps","getPendingRequiredSteps","length","READY_TO_BE_PUBLISHED","retractSignOff","NoSignOffProvidedError","isReviewRequired","contentGetter","content","settings","contentReviewId","contentApwSettingsPlugin","getContentApwSettingsPlugin","getContentReviewId","workflowId","getWorkflowId","publishContent","datetime","Error","message","code","checkValidDateTime","contentPublisher","action","ApwScheduleActionTypes","PUBLISH","entryId","modelId","scheduledActionId","scheduleAction","scheduledOn","scheduledBy","unpublishContent","PUBLISHED","contentUnPublisher","UNPUBLISH","scheduledAction","process","env","NODE_ENV","invoke","name","String","APW_SCHEDULER_SCHEDULE_ACTION_HANDLER","payload","tenant","locale","await","description","deleteScheduledAction","INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META"],"sources":["createContentReviewMethods.ts"],"sourcesContent":["import get from \"lodash/get\";\nimport { createTopic } from \"@webiny/pubsub\";\nimport Error from \"@webiny/error\";\nimport {\n AdvancedPublishingWorkflow,\n ApwContentReview,\n ApwContentReviewCrud,\n ApwContentReviewStatus,\n ApwContentReviewStepStatus,\n ApwReviewerCrud,\n ApwScheduleActionData,\n ApwWorkflowStepTypes,\n CreateApwContentReviewParams,\n CreateApwParams,\n OnContentReviewAfterCreateTopicParams,\n OnContentReviewAfterDeleteTopicParams,\n OnContentReviewAfterUpdateTopicParams,\n OnContentReviewBeforeCreateTopicParams,\n OnContentReviewBeforeDeleteTopicParams,\n OnContentReviewBeforeListTopicParams,\n OnContentReviewBeforeUpdateTopicParams,\n UpdateApwContentReviewParams\n} from \"~/types\";\nimport { getNextStepStatus, hasReviewer } from \"~/plugins/utils\";\nimport {\n NoSignOffProvidedError,\n NotAuthorizedError,\n PendingChangeRequestsError,\n StepInActiveError,\n StepMissingError\n} from \"~/utils/errors\";\nimport { ApwScheduleActionTypes } from \"~/scheduler/types\";\nimport {\n checkValidDateTime,\n filterContentReviewsByRequiresMyAttention,\n getPendingRequiredSteps,\n INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META\n} from \"./utils\";\nimport { getContentApwSettingsPlugin } from \"~/utils/contentApwSettingsPlugin\";\nimport { PluginsContainer } from \"@webiny/plugins\";\n\nexport interface CreateContentReviewMethodsParams extends CreateApwParams {\n getReviewer: ApwReviewerCrud[\"get\"];\n getContentGetter: AdvancedPublishingWorkflow[\"getContentGetter\"];\n getContentPublisher: AdvancedPublishingWorkflow[\"getContentPublisher\"];\n getContentUnPublisher: AdvancedPublishingWorkflow[\"getContentUnPublisher\"];\n plugins: PluginsContainer;\n}\n\nexport function createContentReviewMethods(\n params: CreateContentReviewMethodsParams\n): ApwContentReviewCrud {\n const {\n getIdentity,\n storageOperations,\n getReviewer,\n getContentGetter,\n getContentPublisher,\n getContentUnPublisher,\n scheduler,\n handlerClient,\n getTenant,\n getLocale,\n plugins\n } = params;\n\n // create\n const onContentReviewBeforeCreate = createTopic<OnContentReviewBeforeCreateTopicParams>(\n \"apw.onContentReviewBeforeCreate\"\n );\n const onContentReviewAfterCreate = createTopic<OnContentReviewAfterCreateTopicParams>(\n \"apw.onContentReviewAfterCreate\"\n );\n // update\n const onContentReviewBeforeUpdate = createTopic<OnContentReviewBeforeUpdateTopicParams>(\n \"apw.onContentReviewBeforeUpdate\"\n );\n const onContentReviewAfterUpdate = createTopic<OnContentReviewAfterUpdateTopicParams>(\n \"apw.onContentReviewAfterUpdate\"\n );\n // delete\n const onContentReviewBeforeDelete = createTopic<OnContentReviewBeforeDeleteTopicParams>(\n \"apw.onContentReviewBeforeDelete\"\n );\n const onContentReviewAfterDelete = createTopic<OnContentReviewAfterDeleteTopicParams>(\n \"apw.onContentReviewAfterDelete\"\n );\n // list\n const onContentReviewBeforeList = createTopic<OnContentReviewBeforeListTopicParams>(\n \"apw.onContentReviewBeforeList\"\n );\n return {\n /**\n * Lifecycle events\n */\n onContentReviewBeforeCreate,\n onContentReviewAfterCreate,\n onContentReviewBeforeUpdate,\n onContentReviewAfterUpdate,\n onContentReviewBeforeDelete,\n onContentReviewAfterDelete,\n onContentReviewBeforeList,\n async get(id) {\n return storageOperations.getContentReview({ id });\n },\n async list(params) {\n const where = params.where || {};\n\n await onContentReviewBeforeList.publish({\n where\n });\n\n if (where.reviewStatus === \"requiresMyAttention\") {\n return filterContentReviewsByRequiresMyAttention({\n listParams: {\n ...params,\n where\n },\n listContentReviews: storageOperations.listContentReviews,\n getReviewer,\n getIdentity\n });\n }\n\n return storageOperations.listContentReviews({\n ...params,\n where\n });\n },\n async create(data: Omit<CreateApwContentReviewParams, \"reviewStatus\">) {\n const input: CreateApwContentReviewParams = {\n ...data,\n reviewStatus: ApwContentReviewStatus.UNDER_REVIEW\n };\n await onContentReviewBeforeCreate.publish({ input });\n\n const contentReview = await storageOperations.createContentReview({\n data: input\n });\n\n await onContentReviewAfterCreate.publish({ contentReview });\n\n return contentReview;\n },\n async update(id, data: UpdateApwContentReviewParams) {\n const original = await storageOperations.getContentReview({ id });\n\n await onContentReviewBeforeUpdate.publish({ original, input: { id, data } });\n\n const contentReview = await storageOperations.updateContentReview({\n id,\n data\n });\n\n await onContentReviewAfterUpdate.publish({\n original,\n input: { id, data },\n contentReview\n });\n\n return contentReview;\n },\n async delete(id) {\n const contentReview = await storageOperations.getContentReview({ id });\n\n await onContentReviewBeforeDelete.publish({ contentReview });\n\n await storageOperations.deleteContentReview({ id });\n\n await onContentReviewAfterDelete.publish({ contentReview });\n\n return true;\n },\n async provideSignOff(this: ApwContentReviewCrud, id, stepId) {\n const entry: ApwContentReview = await this.get(id);\n const { steps, reviewStatus } = entry;\n const stepIndex = steps.findIndex(step => step.id === stepId);\n const currentStep = steps[stepIndex];\n const previousStep = steps[stepIndex - 1];\n\n const identity = getIdentity();\n const hasPermission = await hasReviewer({\n getReviewer,\n identity,\n step: currentStep\n });\n\n /**\n * Check whether the sign-off is requested by a reviewer.\n */\n if (!hasPermission) {\n throw new NotAuthorizedError({ entry, input: { id, step: stepId } });\n }\n /**\n * Don't allow sign off, if previous step is of \"mandatory_blocking\" type and undone.\n */\n if (\n previousStep &&\n previousStep.status !== ApwContentReviewStepStatus.DONE &&\n previousStep.type === ApwWorkflowStepTypes.MANDATORY_BLOCKING\n ) {\n throw new StepMissingError({ entry, input: { id, step: stepId } });\n }\n /**\n * Don't allow sign off, if there are pending change requests.\n */\n if (currentStep.pendingChangeRequests > 0) {\n throw new PendingChangeRequestsError({ entry, input: { id, step: stepId } });\n }\n /**\n * Don't allow sign off, if current step is not in \"active\" state.\n */\n if (currentStep.status !== ApwContentReviewStepStatus.ACTIVE) {\n throw new StepInActiveError({ entry, input: { id, step: stepId } });\n }\n let previousStepStatus: ApwContentReviewStepStatus;\n /*\n * Provide sign-off for give step.\n */\n const updatedSteps = steps.map((step, index) => {\n if (index === stepIndex) {\n previousStepStatus = ApwContentReviewStepStatus.DONE;\n return {\n ...step,\n status: ApwContentReviewStepStatus.DONE,\n signOffProvidedOn: new Date().toISOString(),\n signOffProvidedBy: identity\n };\n }\n /**\n * Update next steps status based on type.\n */\n if (index > stepIndex) {\n const previousStep = steps[index - 1];\n\n previousStepStatus = getNextStepStatus(previousStep.type, previousStepStatus);\n return {\n ...step,\n status: previousStepStatus\n };\n }\n\n return step;\n });\n /**\n * Check for pending steps\n */\n let newStatus = reviewStatus;\n const pendingRequiredSteps = getPendingRequiredSteps(\n updatedSteps,\n step => typeof step.signOffProvidedOn !== \"string\"\n );\n\n /**\n * If there are no required steps that are pending, set the status to \"READY_TO_BE_PUBLISHED\".\n */\n if (pendingRequiredSteps.length === 0) {\n newStatus = ApwContentReviewStatus.READY_TO_BE_PUBLISHED;\n }\n\n /**\n * Save updated steps.\n */\n await this.update(id, {\n steps: updatedSteps,\n reviewStatus: newStatus\n });\n return true;\n },\n async retractSignOff(this: ApwContentReviewCrud, id, stepId) {\n const entry: ApwContentReview = await this.get(id);\n const { steps, reviewStatus } = entry;\n const stepIndex = steps.findIndex(step => step.id === stepId);\n const currentStep = steps[stepIndex];\n\n const identity = getIdentity();\n\n const hasPermission = await hasReviewer({\n getReviewer,\n identity,\n step: currentStep\n });\n\n /**\n * Check whether the retract sign-off is requested by a reviewer.\n */\n if (!hasPermission) {\n throw new NotAuthorizedError({ entry, input: { id, step: stepId } });\n }\n /**\n * Don't allow, if step in not \"done\" i.e. no sign-off was provided for it.\n */\n if (currentStep.status !== ApwContentReviewStepStatus.DONE) {\n throw new NoSignOffProvidedError({ entry, input: { id, step: stepId } });\n }\n let previousStepStatus: ApwContentReviewStepStatus;\n\n /*\n * Retract sign-off for give step.\n */\n const updatedSteps = steps.map((step, index) => {\n if (index === stepIndex) {\n previousStepStatus = ApwContentReviewStepStatus.ACTIVE;\n return {\n ...step,\n status: previousStepStatus,\n signOffProvidedOn: null,\n signOffProvidedBy: null\n };\n }\n /**\n * Set next step status as \"inactive\".\n */\n if (index > stepIndex) {\n const previousStep = steps[index - 1];\n\n previousStepStatus = getNextStepStatus(previousStep.type, previousStepStatus);\n\n return {\n ...step,\n status: previousStepStatus\n };\n }\n\n return step;\n });\n\n /**\n * Check for pending steps\n */\n let newStatus = reviewStatus;\n const pendingRequiredSteps = getPendingRequiredSteps(\n updatedSteps,\n step => step.signOffProvidedOn === null\n );\n /**\n * If there are required steps that are pending, set the status to \"UNDER_REVIEW\".\n */\n if (pendingRequiredSteps.length !== 0) {\n newStatus = ApwContentReviewStatus.UNDER_REVIEW;\n }\n\n await this.update(id, {\n steps: updatedSteps,\n reviewStatus: newStatus\n });\n return true;\n },\n async isReviewRequired(data) {\n const contentGetter = getContentGetter(data.type);\n const content = await contentGetter(data.id, data.settings);\n\n let isReviewRequired = false;\n let contentReviewId: string | null = null;\n\n const contentApwSettingsPlugin = getContentApwSettingsPlugin({\n plugins,\n type: data.type\n });\n\n if (contentApwSettingsPlugin) {\n contentReviewId = contentApwSettingsPlugin.getContentReviewId(content);\n const workflowId = contentApwSettingsPlugin.getWorkflowId(content);\n if (workflowId) {\n isReviewRequired = true;\n }\n }\n\n return {\n isReviewRequired,\n contentReviewId\n };\n },\n async publishContent(this: ApwContentReviewCrud, id: string, datetime) {\n const { content, reviewStatus } = await this.get(id);\n const identity = getIdentity();\n\n if (reviewStatus !== ApwContentReviewStatus.READY_TO_BE_PUBLISHED) {\n throw new Error({\n message: `Cannot publish content because it is not yet ready to be published.`,\n code: \"NOT_READY_TO_BE_PUBLISHED\",\n data: {\n id,\n status: reviewStatus,\n content\n }\n });\n }\n\n checkValidDateTime(datetime);\n\n /**\n * If datetime is present it means we're scheduling this action.\n * And if not, we are publishing immediately.\n */\n if (!datetime) {\n const contentPublisher = getContentPublisher(content.type);\n\n await contentPublisher(content.id, content.settings);\n\n return true;\n }\n\n const data: ApwScheduleActionData = {\n action: ApwScheduleActionTypes.PUBLISH,\n type: content.type,\n entryId: content.id,\n modelId: content.settings?.modelId,\n datetime\n };\n const scheduledActionId = await this.scheduleAction(data);\n /**\n * Update scheduled related meta data.\n */\n await this.update(id, {\n content: {\n ...content,\n scheduledOn: datetime,\n scheduledBy: identity.id,\n scheduledActionId\n }\n });\n\n return true;\n },\n async unpublishContent(this: ApwContentReviewCrud, id: string, datetime) {\n const { content, reviewStatus } = await this.get(id);\n const identity = getIdentity();\n\n if (reviewStatus !== ApwContentReviewStatus.PUBLISHED) {\n throw new Error({\n message: `Cannot unpublish content because it is not yet published.`,\n code: \"NOT_YET_PUBLISHED\",\n data: {\n id,\n status: reviewStatus,\n content\n }\n });\n }\n checkValidDateTime(datetime);\n\n /**\n * If datetime is present it means we're scheduling this action.\n * If not, we are unpublishing immediately.\n */\n if (!datetime) {\n const contentUnPublisher = getContentUnPublisher(content.type);\n\n await contentUnPublisher(content.id, content.settings);\n\n return true;\n }\n\n const scheduledActionId = await this.scheduleAction({\n action: ApwScheduleActionTypes.UNPUBLISH,\n type: content.type,\n entryId: content.id,\n modelId: content.settings?.modelId,\n datetime\n });\n /**\n * Update scheduled related meta data.\n */\n await this.update(id, {\n content: {\n ...content,\n scheduledOn: datetime,\n scheduledBy: identity.id,\n scheduledActionId\n }\n });\n\n return true;\n },\n async scheduleAction(data) {\n // Save input in DB\n const scheduledAction = await scheduler.create(data);\n /**\n * This function contains logic of lambda invocation.\n * Current we're not mocking it, therefore, we're just returning true.\n */\n if (process.env.NODE_ENV === \"test\") {\n return scheduledAction.id;\n }\n // Invoke handler\n await handlerClient.invoke({\n name: String(process.env.APW_SCHEDULER_SCHEDULE_ACTION_HANDLER),\n payload: {\n tenant: getTenant().id,\n locale: getLocale().code\n },\n await: false,\n description: \"APW scheduler handler\"\n });\n return scheduledAction.id;\n },\n async deleteScheduledAction(id) {\n const contentReview = await this.get(id);\n const scheduledActionId = get(contentReview, \"content.scheduledActionId\");\n\n /**\n * Check if there is any action scheduled for this \"content review\".\n */\n if (!scheduledActionId) {\n throw new Error({\n message: `There is no action scheduled for content review.`,\n code: \"NO_ACTION_SCHEDULED\",\n data: {\n id\n }\n });\n }\n /**\n * Delete scheduled action.\n */\n await scheduler.delete(scheduledActionId);\n\n /**\n * Reset scheduled related meta data.\n */\n await this.update(id, {\n content: {\n ...contentReview.content,\n ...INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META\n }\n });\n\n return true;\n }\n };\n}\n"],"mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AAoBA;AACA;AAOA;AACA;AAMA;AAWO,SAASA,0BAA0B,CACtCC,MAAwC,EACpB;EACpB,MAAM;IACFC,WAAW;IACXC,iBAAiB;IACjBC,WAAW;IACXC,gBAAgB;IAChBC,mBAAmB;IACnBC,qBAAqB;IACrBC,SAAS;IACTC,aAAa;IACbC,SAAS;IACTC,SAAS;IACTC;EACJ,CAAC,GAAGX,MAAM;;EAEV;EACA,MAAMY,2BAA2B,GAAG,IAAAC,mBAAW,EAC3C,iCAAiC,CACpC;EACD,MAAMC,0BAA0B,GAAG,IAAAD,mBAAW,EAC1C,gCAAgC,CACnC;EACD;EACA,MAAME,2BAA2B,GAAG,IAAAF,mBAAW,EAC3C,iCAAiC,CACpC;EACD,MAAMG,0BAA0B,GAAG,IAAAH,mBAAW,EAC1C,gCAAgC,CACnC;EACD;EACA,MAAMI,2BAA2B,GAAG,IAAAJ,mBAAW,EAC3C,iCAAiC,CACpC;EACD,MAAMK,0BAA0B,GAAG,IAAAL,mBAAW,EAC1C,gCAAgC,CACnC;EACD;EACA,MAAMM,yBAAyB,GAAG,IAAAN,mBAAW,EACzC,+BAA+B,CAClC;EACD,OAAO;IACH;AACR;AACA;IACQD,2BAA2B;IAC3BE,0BAA0B;IAC1BC,2BAA2B;IAC3BC,0BAA0B;IAC1BC,2BAA2B;IAC3BC,0BAA0B;IAC1BC,yBAAyB;IACzB,MAAMC,GAA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ACK,qCAAqC,CAAC;QAC/DC,OAAO,EAAE;UACLC,MAAM,EAAEhH,SAAS,EAAE,CAACY,EAAE;UACtBqG,MAAM,EAAEhH,SAAS,EAAE,CAACsF;QACxB,CAAC;QACD2B,KAAK,EAAE,KAAK;QACZC,WAAW,EAAE;MACjB,CAAC,CAAC;MACF,OAAOZ,eAAe,CAAC3F,EAAE;IAC7B,CAAC;IACD,MAAMwG,qBAAqB,CAACxG,EAAE,EAAE;MAC5B,MAAMc,aAAa,GAAG,MAAM,IAAI,CAACf,GAAG,CAACC,EAAE,CAAC;MACxC,MAAMmF,iBAAiB,GAAG,IAAApF,YAAG,EAACe,aAAa,EAAE,2BAA2B,CAAC;;MAEzE;AACZ;AACA;MACY,IAAI,CAACqE,iBAAiB,EAAE;QACpB,MAAM,IAAIV,cAAK,CAAC;UACZC,OAAO,EAAG,kDAAiD;UAC3DC,IAAI,EAAE,qBAAqB;UAC3BjE,IAAI,EAAE;YACFV;UACJ;QACJ,CAAC,CAAC;MACN;MACA;AACZ;AACA;MACY,MAAMd,SAAS,CAACiC,MAAM,CAACgE,iBAAiB,CAAC;;MAEzC;AACZ;AACA;MACY,MAAM,IAAI,CAACnE,MAAM,CAAChB,EAAE,EAAE;QAClB+D,OAAO,8DACAjD,aAAa,CAACiD,OAAO,GACrB0C,oDAA4C;MAEvD,CAAC,CAAC;MAEF,OAAO,IAAI;IACf;EACJ,CAAC;AACL"}
|
1
|
+
{"version":3,"names":["createContentReviewMethods","params","getIdentity","storageOperations","getReviewer","getContentGetter","getContentPublisher","getContentUnPublisher","scheduler","handlerClient","getTenant","getLocale","plugins","onContentReviewBeforeCreate","createTopic","onContentReviewAfterCreate","onContentReviewBeforeUpdate","onContentReviewAfterUpdate","onContentReviewBeforeDelete","onContentReviewAfterDelete","onContentReviewBeforeList","get","id","getContentReview","list","where","publish","reviewStatus","filterContentReviewsByRequiresMyAttention","listParams","listContentReviews","create","data","input","ApwContentReviewStatus","UNDER_REVIEW","contentReview","createContentReview","update","original","updateContentReview","delete","deleteContentReview","provideSignOff","stepId","entry","steps","stepIndex","findIndex","step","currentStep","previousStep","identity","hasPermission","hasReviewer","NotAuthorizedError","status","ApwContentReviewStepStatus","DONE","type","ApwWorkflowStepTypes","MANDATORY_BLOCKING","StepMissingError","pendingChangeRequests","PendingChangeRequestsError","ACTIVE","StepInActiveError","previousStepStatus","updatedSteps","map","index","signOffProvidedOn","Date","toISOString","signOffProvidedBy","getNextStepStatus","newStatus","pendingRequiredSteps","getPendingRequiredSteps","length","READY_TO_BE_PUBLISHED","retractSignOff","content","NoSignOffProvidedError","scheduledActionId","scheduledOn","scheduledBy","isReviewRequired","contentGetter","settings","contentReviewId","contentApwSettingsPlugin","getContentApwSettingsPlugin","getContentReviewId","workflowId","getWorkflowId","publishContent","datetime","Error","message","code","checkValidDateTime","contentPublisher","action","ApwScheduleActionTypes","PUBLISH","entryId","modelId","scheduleAction","unpublishContent","PUBLISHED","contentUnPublisher","UNPUBLISH","scheduledAction","process","env","NODE_ENV","invoke","name","String","APW_SCHEDULER_SCHEDULE_ACTION_HANDLER","payload","tenant","locale","await","description","deleteScheduledAction","INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META"],"sources":["createContentReviewMethods.ts"],"sourcesContent":["import get from \"lodash/get\";\nimport { createTopic } from \"@webiny/pubsub\";\nimport Error from \"@webiny/error\";\nimport {\n AdvancedPublishingWorkflow,\n ApwContentReview,\n ApwContentReviewCrud,\n ApwContentReviewStatus,\n ApwContentReviewStepStatus,\n ApwReviewerCrud,\n ApwScheduleActionData,\n ApwWorkflowStepTypes,\n CreateApwContentReviewParams,\n CreateApwParams,\n OnContentReviewAfterCreateTopicParams,\n OnContentReviewAfterDeleteTopicParams,\n OnContentReviewAfterUpdateTopicParams,\n OnContentReviewBeforeCreateTopicParams,\n OnContentReviewBeforeDeleteTopicParams,\n OnContentReviewBeforeListTopicParams,\n OnContentReviewBeforeUpdateTopicParams,\n UpdateApwContentReviewParams\n} from \"~/types\";\nimport { getNextStepStatus, hasReviewer } from \"~/plugins/utils\";\nimport {\n NoSignOffProvidedError,\n NotAuthorizedError,\n PendingChangeRequestsError,\n StepInActiveError,\n StepMissingError\n} from \"~/utils/errors\";\nimport { ApwScheduleActionTypes } from \"~/scheduler/types\";\nimport {\n checkValidDateTime,\n filterContentReviewsByRequiresMyAttention,\n getPendingRequiredSteps,\n INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META\n} from \"./utils\";\nimport { getContentApwSettingsPlugin } from \"~/utils/contentApwSettingsPlugin\";\nimport { PluginsContainer } from \"@webiny/plugins\";\n\nexport interface CreateContentReviewMethodsParams extends CreateApwParams {\n getReviewer: ApwReviewerCrud[\"get\"];\n getContentGetter: AdvancedPublishingWorkflow[\"getContentGetter\"];\n getContentPublisher: AdvancedPublishingWorkflow[\"getContentPublisher\"];\n getContentUnPublisher: AdvancedPublishingWorkflow[\"getContentUnPublisher\"];\n plugins: PluginsContainer;\n}\n\nexport function createContentReviewMethods(\n params: CreateContentReviewMethodsParams\n): ApwContentReviewCrud {\n const {\n getIdentity,\n storageOperations,\n getReviewer,\n getContentGetter,\n getContentPublisher,\n getContentUnPublisher,\n scheduler,\n handlerClient,\n getTenant,\n getLocale,\n plugins\n } = params;\n\n // create\n const onContentReviewBeforeCreate = createTopic<OnContentReviewBeforeCreateTopicParams>(\n \"apw.onContentReviewBeforeCreate\"\n );\n const onContentReviewAfterCreate = createTopic<OnContentReviewAfterCreateTopicParams>(\n \"apw.onContentReviewAfterCreate\"\n );\n // update\n const onContentReviewBeforeUpdate = createTopic<OnContentReviewBeforeUpdateTopicParams>(\n \"apw.onContentReviewBeforeUpdate\"\n );\n const onContentReviewAfterUpdate = createTopic<OnContentReviewAfterUpdateTopicParams>(\n \"apw.onContentReviewAfterUpdate\"\n );\n // delete\n const onContentReviewBeforeDelete = createTopic<OnContentReviewBeforeDeleteTopicParams>(\n \"apw.onContentReviewBeforeDelete\"\n );\n const onContentReviewAfterDelete = createTopic<OnContentReviewAfterDeleteTopicParams>(\n \"apw.onContentReviewAfterDelete\"\n );\n // list\n const onContentReviewBeforeList = createTopic<OnContentReviewBeforeListTopicParams>(\n \"apw.onContentReviewBeforeList\"\n );\n return {\n /**\n * Lifecycle events\n */\n onContentReviewBeforeCreate,\n onContentReviewAfterCreate,\n onContentReviewBeforeUpdate,\n onContentReviewAfterUpdate,\n onContentReviewBeforeDelete,\n onContentReviewAfterDelete,\n onContentReviewBeforeList,\n async get(id) {\n return storageOperations.getContentReview({ id });\n },\n async list(params) {\n const where = params.where || {};\n\n await onContentReviewBeforeList.publish({\n where\n });\n\n if (where.reviewStatus === \"requiresMyAttention\") {\n return filterContentReviewsByRequiresMyAttention({\n listParams: {\n ...params,\n where\n },\n listContentReviews: storageOperations.listContentReviews,\n getReviewer,\n getIdentity\n });\n }\n\n return storageOperations.listContentReviews({\n ...params,\n where\n });\n },\n async create(data: Omit<CreateApwContentReviewParams, \"reviewStatus\">) {\n const input: CreateApwContentReviewParams = {\n ...data,\n reviewStatus: ApwContentReviewStatus.UNDER_REVIEW\n };\n await onContentReviewBeforeCreate.publish({ input });\n\n const contentReview = await storageOperations.createContentReview({\n data: input\n });\n\n await onContentReviewAfterCreate.publish({ contentReview });\n\n return contentReview;\n },\n async update(id, data: UpdateApwContentReviewParams) {\n const original = await storageOperations.getContentReview({ id });\n\n await onContentReviewBeforeUpdate.publish({ original, input: { id, data } });\n\n const contentReview = await storageOperations.updateContentReview({\n id,\n data\n });\n\n await onContentReviewAfterUpdate.publish({\n original,\n input: { id, data },\n contentReview\n });\n\n return contentReview;\n },\n async delete(id) {\n const contentReview = await storageOperations.getContentReview({ id });\n\n await onContentReviewBeforeDelete.publish({ contentReview });\n\n await storageOperations.deleteContentReview({ id });\n\n await onContentReviewAfterDelete.publish({ contentReview });\n\n return true;\n },\n async provideSignOff(this: ApwContentReviewCrud, id, stepId) {\n const entry: ApwContentReview = await this.get(id);\n const { steps, reviewStatus } = entry;\n const stepIndex = steps.findIndex(step => step.id === stepId);\n const currentStep = steps[stepIndex];\n const previousStep = steps[stepIndex - 1];\n\n const identity = getIdentity();\n const hasPermission = await hasReviewer({\n getReviewer,\n identity,\n step: currentStep\n });\n\n /**\n * Check whether the sign-off is requested by a reviewer.\n */\n if (!hasPermission) {\n throw new NotAuthorizedError({ entry, input: { id, step: stepId } });\n }\n /**\n * Don't allow sign off, if previous step is of \"mandatory_blocking\" type and undone.\n */\n if (\n previousStep &&\n previousStep.status !== ApwContentReviewStepStatus.DONE &&\n previousStep.type === ApwWorkflowStepTypes.MANDATORY_BLOCKING\n ) {\n throw new StepMissingError({ entry, input: { id, step: stepId } });\n }\n /**\n * Don't allow sign off, if there are pending change requests.\n */\n if (currentStep.pendingChangeRequests > 0) {\n throw new PendingChangeRequestsError({ entry, input: { id, step: stepId } });\n }\n /**\n * Don't allow sign off, if current step is not in \"active\" state.\n */\n if (currentStep.status !== ApwContentReviewStepStatus.ACTIVE) {\n throw new StepInActiveError({ entry, input: { id, step: stepId } });\n }\n let previousStepStatus: ApwContentReviewStepStatus;\n /*\n * Provide sign-off for give step.\n */\n const updatedSteps = steps.map((step, index) => {\n if (index === stepIndex) {\n previousStepStatus = ApwContentReviewStepStatus.DONE;\n return {\n ...step,\n status: ApwContentReviewStepStatus.DONE,\n signOffProvidedOn: new Date().toISOString(),\n signOffProvidedBy: identity\n };\n }\n /**\n * Update next steps status based on type.\n */\n if (index > stepIndex) {\n const previousStep = steps[index - 1];\n\n previousStepStatus = getNextStepStatus(previousStep.type, previousStepStatus);\n return {\n ...step,\n status: previousStepStatus\n };\n }\n\n return step;\n });\n /**\n * Check for pending steps\n */\n let newStatus = reviewStatus;\n const pendingRequiredSteps = getPendingRequiredSteps(\n updatedSteps,\n step => typeof step.signOffProvidedOn !== \"string\"\n );\n\n /**\n * If there are no required steps that are pending, set the status to \"READY_TO_BE_PUBLISHED\".\n */\n if (pendingRequiredSteps.length === 0) {\n newStatus = ApwContentReviewStatus.READY_TO_BE_PUBLISHED;\n }\n\n /**\n * Save updated steps.\n */\n await this.update(id, {\n steps: updatedSteps,\n reviewStatus: newStatus\n });\n return true;\n },\n async retractSignOff(this: ApwContentReviewCrud, id, stepId) {\n const contentReview = await this.get(id);\n const { steps, reviewStatus, content } = contentReview;\n\n const stepIndex = steps.findIndex(step => step.id === stepId);\n const currentStep = steps[stepIndex];\n\n const identity = getIdentity();\n\n const hasPermission = await hasReviewer({\n getReviewer,\n identity,\n step: currentStep\n });\n\n /**\n * Check whether the retract sign-off is requested by a reviewer.\n */\n if (!hasPermission) {\n throw new NotAuthorizedError({\n entry: contentReview,\n input: {\n id,\n step: stepId\n }\n });\n }\n /**\n * Don't allow, if step in not \"done\" i.e. no sign-off was provided for it.\n */\n if (currentStep.status !== ApwContentReviewStepStatus.DONE) {\n throw new NoSignOffProvidedError({\n entry: contentReview,\n input: {\n id,\n step: stepId\n }\n });\n }\n let previousStepStatus: ApwContentReviewStepStatus;\n\n /*\n * Retract sign-off for give step.\n */\n const updatedSteps = steps.map((step, index) => {\n if (index === stepIndex) {\n previousStepStatus = ApwContentReviewStepStatus.ACTIVE;\n return {\n ...step,\n status: previousStepStatus,\n signOffProvidedOn: null,\n signOffProvidedBy: null\n };\n }\n /**\n * Set next step status as \"inactive\".\n */\n if (index > stepIndex) {\n const previousStep = steps[index - 1];\n\n previousStepStatus = getNextStepStatus(previousStep.type, previousStepStatus);\n\n return {\n ...step,\n status: previousStepStatus\n };\n }\n\n return step;\n });\n\n /**\n * Check for pending steps\n */\n let newStatus = reviewStatus;\n const pendingRequiredSteps = getPendingRequiredSteps(\n updatedSteps,\n step => step.signOffProvidedOn === null\n );\n /**\n * If there are required steps that are pending, set the status to \"UNDER_REVIEW\".\n */\n if (pendingRequiredSteps.length !== 0) {\n newStatus = ApwContentReviewStatus.UNDER_REVIEW;\n }\n\n /**\n * We need to delete the scheduled action if one was created.\n */\n const scheduledActionId = contentReview.content?.scheduledActionId;\n if (!!scheduledActionId) {\n await scheduler.delete(scheduledActionId);\n }\n\n await this.update(id, {\n content: {\n ...content,\n scheduledOn: null,\n scheduledBy: null,\n scheduledActionId: null\n },\n steps: updatedSteps,\n reviewStatus: newStatus\n });\n return true;\n },\n async isReviewRequired(data) {\n const contentGetter = getContentGetter(data.type);\n const content = await contentGetter(data.id, data.settings);\n\n let isReviewRequired = false;\n let contentReviewId: string | null = null;\n\n const contentApwSettingsPlugin = getContentApwSettingsPlugin({\n plugins,\n type: data.type\n });\n\n if (contentApwSettingsPlugin) {\n contentReviewId = contentApwSettingsPlugin.getContentReviewId(content);\n const workflowId = contentApwSettingsPlugin.getWorkflowId(content);\n if (workflowId) {\n isReviewRequired = true;\n }\n }\n\n return {\n isReviewRequired,\n contentReviewId\n };\n },\n async publishContent(this: ApwContentReviewCrud, id: string, datetime) {\n const { content, reviewStatus } = await this.get(id);\n const identity = getIdentity();\n\n if (reviewStatus !== ApwContentReviewStatus.READY_TO_BE_PUBLISHED) {\n throw new Error({\n message: `Cannot publish content because it is not yet ready to be published.`,\n code: \"NOT_READY_TO_BE_PUBLISHED\",\n data: {\n id,\n status: reviewStatus,\n content\n }\n });\n }\n\n checkValidDateTime(datetime);\n\n /**\n * If datetime is present it means we're scheduling this action.\n * And if not, we are publishing immediately.\n */\n if (!datetime) {\n const contentPublisher = getContentPublisher(content.type);\n\n await contentPublisher(content.id, content.settings);\n\n return true;\n }\n\n const data: ApwScheduleActionData = {\n action: ApwScheduleActionTypes.PUBLISH,\n type: content.type,\n entryId: content.id,\n modelId: content.settings?.modelId,\n datetime\n };\n const scheduledActionId = await this.scheduleAction(data);\n /**\n * Update scheduled related meta data.\n */\n await this.update(id, {\n content: {\n ...content,\n scheduledOn: datetime,\n scheduledBy: identity.id,\n scheduledActionId\n }\n });\n\n return true;\n },\n async unpublishContent(this: ApwContentReviewCrud, id: string, datetime) {\n const { content, reviewStatus } = await this.get(id);\n const identity = getIdentity();\n\n if (reviewStatus !== ApwContentReviewStatus.PUBLISHED) {\n throw new Error({\n message: `Cannot unpublish content because it is not yet published.`,\n code: \"NOT_YET_PUBLISHED\",\n data: {\n id,\n status: reviewStatus,\n content\n }\n });\n }\n checkValidDateTime(datetime);\n\n /**\n * If datetime is present it means we're scheduling this action.\n * If not, we are unpublishing immediately.\n */\n if (!datetime) {\n const contentUnPublisher = getContentUnPublisher(content.type);\n\n await contentUnPublisher(content.id, content.settings);\n\n return true;\n }\n\n const scheduledActionId = await this.scheduleAction({\n action: ApwScheduleActionTypes.UNPUBLISH,\n type: content.type,\n entryId: content.id,\n modelId: content.settings?.modelId,\n datetime\n });\n /**\n * Update scheduled related meta data.\n */\n await this.update(id, {\n content: {\n ...content,\n scheduledOn: datetime,\n scheduledBy: identity.id,\n scheduledActionId\n }\n });\n\n return true;\n },\n async scheduleAction(data) {\n // Save input in DB\n const scheduledAction = await scheduler.create(data);\n /**\n * This function contains logic of lambda invocation.\n * Current we're not mocking it, therefore, we're just returning true.\n */\n if (process.env.NODE_ENV === \"test\") {\n return scheduledAction.id;\n }\n // Invoke handler\n await handlerClient.invoke({\n name: String(process.env.APW_SCHEDULER_SCHEDULE_ACTION_HANDLER),\n payload: {\n tenant: getTenant().id,\n locale: getLocale().code\n },\n await: false,\n description: \"APW scheduler handler\"\n });\n return scheduledAction.id;\n },\n async deleteScheduledAction(id) {\n const contentReview = await this.get(id);\n const scheduledActionId = get(contentReview, \"content.scheduledActionId\");\n\n /**\n * Check if there is any action scheduled for this \"content review\".\n */\n if (!scheduledActionId) {\n throw new Error({\n message: `There is no action scheduled for content review.`,\n code: \"NO_ACTION_SCHEDULED\",\n data: {\n id\n }\n });\n }\n /**\n * Delete scheduled action.\n */\n await scheduler.delete(scheduledActionId);\n\n /**\n * Reset scheduled related meta data.\n */\n await this.update(id, {\n content: {\n ...contentReview.content,\n ...INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META\n }\n });\n\n return true;\n }\n };\n}\n"],"mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AAoBA;AACA;AAOA;AACA;AAMA;AAWO,SAAS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hH,SAAS,EAAE,CAACY,EAAE;UACtBqG,MAAM,EAAEhH,SAAS,EAAE,CAACyF;QACxB,CAAC;QACDwB,KAAK,EAAE,KAAK;QACZC,WAAW,EAAE;MACjB,CAAC,CAAC;MACF,OAAOZ,eAAe,CAAC3F,EAAE;IAC7B,CAAC;IACD,MAAMwG,qBAAqB,CAACxG,EAAE,EAAE;MAC5B,MAAMc,aAAa,GAAG,MAAM,IAAI,CAACf,GAAG,CAACC,EAAE,CAAC;MACxC,MAAM8D,iBAAiB,GAAG,IAAA/D,YAAG,EAACe,aAAa,EAAE,2BAA2B,CAAC;;MAEzE;AACZ;AACA;MACY,IAAI,CAACgD,iBAAiB,EAAE;QACpB,MAAM,IAAIc,cAAK,CAAC;UACZC,OAAO,EAAG,kDAAiD;UAC3DC,IAAI,EAAE,qBAAqB;UAC3BpE,IAAI,EAAE;YACFV;UACJ;QACJ,CAAC,CAAC;MACN;MACA;AACZ;AACA;MACY,MAAMd,SAAS,CAACiC,MAAM,CAAC2C,iBAAiB,CAAC;;MAEzC;AACZ;AACA;MACY,MAAM,IAAI,CAAC9C,MAAM,CAAChB,EAAE,EAAE;QAClB4D,OAAO,8DACA9C,aAAa,CAAC8C,OAAO,GACrB6C,oDAA4C;MAEvD,CAAC,CAAC;MAEF,OAAO,IAAI;IACf;EACJ,CAAC;AACL"}
|
package/index.d.ts
CHANGED
@@ -1,4 +1,3 @@
|
|
1
1
|
import { CreateApwContextParams } from "./scheduler/types";
|
2
|
-
export declare const
|
3
|
-
export declare const createApwPageBuilderContext: (params: CreateApwContextParams) => (import("@webiny/api").ContextPlugin<import("./types").ApwContext> | import("@webiny/plugins/types").Plugin<Record<string, any>> | import("@webiny/plugins/types").PluginCollection | import("@webiny/handler-graphql").GraphQLSchemaPlugin<import("@webiny/api-mailer/types").MailerContext>)[];
|
2
|
+
export declare const createApwPageBuilderContext: (params: CreateApwContextParams) => (import("@webiny/plugins/types").Plugin<Record<string, any>> | import("@webiny/plugins/types").PluginCollection | import("@webiny/api").ContextPlugin<import("./types").ApwContext> | import("@webiny/handler-graphql").GraphQLSchemaPlugin<import("@webiny/api-mailer/types").MailerContext>)[];
|
4
3
|
export declare const createApwGraphQL: () => import("@webiny/api").ContextPlugin<import("./types").ApwContext>[];
|
package/index.js
CHANGED
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
5
5
|
value: true
|
6
6
|
});
|
7
|
-
exports.createApwPageBuilderContext = exports.
|
7
|
+
exports.createApwPageBuilderContext = exports.createApwGraphQL = void 0;
|
8
8
|
var _graphql = _interopRequireDefault(require("./plugins/graphql"));
|
9
9
|
var _context = require("./plugins/context");
|
10
10
|
var _apiMailer = require("@webiny/api-mailer");
|
@@ -14,10 +14,6 @@ var _apiAdminSettings = require("@webiny/api-admin-settings");
|
|
14
14
|
* GraphQL will not work without context, but context will without GraphQL.
|
15
15
|
*/
|
16
16
|
|
17
|
-
const createApwHeadlessCmsContext = params => {
|
18
|
-
return [...(0, _apiAdminSettings.createAdminSettingsContext)(), ...(0, _apiMailer.createMailerContext)(), (0, _context.createApwHeadlessCmsContext)(params)];
|
19
|
-
};
|
20
|
-
exports.createApwHeadlessCmsContext = createApwHeadlessCmsContext;
|
21
17
|
const createApwPageBuilderContext = params => {
|
22
18
|
return [...(0, _apiAdminSettings.createAdminSettingsContext)(), ...(0, _apiMailer.createMailerContext)(), ...(0, _apiMailer.createMailerGraphQL)(), (0, _context.createApwPageBuilderContext)(params)];
|
23
19
|
};
|
package/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["
|
1
|
+
{"version":3,"names":["createApwPageBuilderContext","params","createAdminSettingsContext","createMailerContext","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 { createApwPageBuilderContext as createPageBuilder } 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 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;AAEA;AACA;AARA;AACA;AACA;AACA;;AAOO,MAAMA,2BAA2B,GAAIC,MAA8B,IAAK;EAC3E,OAAO,CACH,GAAG,IAAAC,4CAA0B,GAAE,EAC/B,GAAG,IAAAC,8BAAmB,GAAE,EACxB,GAAG,IAAAC,8BAAmB,GAAE,EACxB,IAAAC,oCAAiB,EAACJ,MAAM,CAAC,CAC5B;AACL,CAAC;AAAC;AAEK,MAAMK,gBAAgB,GAAG,MAAM;EAClC,OAAO,CAAC,IAAAC,gBAAO,GAAE,CAAC;AACtB,CAAC;AAAC"}
|
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.99666aeb00",
|
4
4
|
"keywords": [
|
5
5
|
"apw:base"
|
6
6
|
],
|
@@ -14,54 +14,47 @@
|
|
14
14
|
"author": "Webiny Ltd",
|
15
15
|
"license": "MIT",
|
16
16
|
"dependencies": {
|
17
|
-
"@aws-sdk/client-cloudwatch-events": "3.
|
18
|
-
"@babel/runtime": "7.20.
|
17
|
+
"@aws-sdk/client-cloudwatch-events": "3.54.1",
|
18
|
+
"@babel/runtime": "7.20.13",
|
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-
|
25
|
-
"@webiny/api-
|
26
|
-
"@webiny/api-
|
27
|
-
"@webiny/api-
|
28
|
-
"@webiny/api-
|
29
|
-
"@webiny/
|
30
|
-
"@webiny/
|
31
|
-
"@webiny/
|
32
|
-
"@webiny/handler": "0.0.0-unstable.
|
33
|
-
"@webiny/handler-
|
34
|
-
"@webiny/handler-
|
35
|
-
"@webiny/handler-
|
36
|
-
"@webiny/
|
37
|
-
"@webiny/
|
38
|
-
"@webiny/
|
39
|
-
"@webiny/
|
40
|
-
"
|
41
|
-
"
|
42
|
-
"lodash": "4.17.21",
|
43
|
-
"mdbid": "1.0.0"
|
20
|
+
"@webiny/api": "0.0.0-unstable.99666aeb00",
|
21
|
+
"@webiny/api-admin-settings": "0.0.0-unstable.99666aeb00",
|
22
|
+
"@webiny/api-headless-cms": "0.0.0-unstable.99666aeb00",
|
23
|
+
"@webiny/api-i18n": "0.0.0-unstable.99666aeb00",
|
24
|
+
"@webiny/api-mailer": "0.0.0-unstable.99666aeb00",
|
25
|
+
"@webiny/api-page-builder": "0.0.0-unstable.99666aeb00",
|
26
|
+
"@webiny/api-security": "0.0.0-unstable.99666aeb00",
|
27
|
+
"@webiny/api-tenancy": "0.0.0-unstable.99666aeb00",
|
28
|
+
"@webiny/api-wcp": "0.0.0-unstable.99666aeb00",
|
29
|
+
"@webiny/db-dynamodb": "0.0.0-unstable.99666aeb00",
|
30
|
+
"@webiny/error": "0.0.0-unstable.99666aeb00",
|
31
|
+
"@webiny/handler": "0.0.0-unstable.99666aeb00",
|
32
|
+
"@webiny/handler-client": "0.0.0-unstable.99666aeb00",
|
33
|
+
"@webiny/handler-db": "0.0.0-unstable.99666aeb00",
|
34
|
+
"@webiny/handler-graphql": "0.0.0-unstable.99666aeb00",
|
35
|
+
"@webiny/handler-logs": "0.0.0-unstable.99666aeb00",
|
36
|
+
"@webiny/plugins": "0.0.0-unstable.99666aeb00",
|
37
|
+
"@webiny/pubsub": "0.0.0-unstable.99666aeb00",
|
38
|
+
"@webiny/utils": "0.0.0-unstable.99666aeb00",
|
39
|
+
"@webiny/validation": "0.0.0-unstable.99666aeb00",
|
40
|
+
"dayjs": "1.11.7",
|
41
|
+
"lodash": "4.17.21"
|
44
42
|
},
|
45
43
|
"devDependencies": {
|
46
|
-
"@babel/cli": "
|
47
|
-
"@babel/core": "
|
48
|
-
"@babel/preset-env": "
|
49
|
-
"@webiny/
|
50
|
-
"@webiny/
|
51
|
-
"@webiny/
|
52
|
-
"@webiny/
|
53
|
-
"
|
54
|
-
"
|
55
|
-
"
|
56
|
-
"
|
57
|
-
"
|
58
|
-
"
|
59
|
-
"
|
60
|
-
"mdbid": "^1.0.0",
|
61
|
-
"prettier": "^2.3.2",
|
62
|
-
"rimraf": "^3.0.2",
|
63
|
-
"sinon": "^9.0.2",
|
64
|
-
"ttypescript": "^1.5.12",
|
44
|
+
"@babel/cli": "7.20.7",
|
45
|
+
"@babel/core": "7.20.12",
|
46
|
+
"@babel/preset-env": "7.20.2",
|
47
|
+
"@webiny/cli": "0.0.0-unstable.99666aeb00",
|
48
|
+
"@webiny/handler-aws": "0.0.0-unstable.99666aeb00",
|
49
|
+
"@webiny/project-utils": "0.0.0-unstable.99666aeb00",
|
50
|
+
"@webiny/wcp": "0.0.0-unstable.99666aeb00",
|
51
|
+
"get-yarn-workspaces": "1.0.2",
|
52
|
+
"graphql": "15.8.0",
|
53
|
+
"jest": "29.5.0",
|
54
|
+
"prettier": "2.8.3",
|
55
|
+
"rimraf": "3.0.2",
|
56
|
+
"sinon": "9.2.4",
|
57
|
+
"ttypescript": "1.5.15",
|
65
58
|
"typescript": "4.7.4"
|
66
59
|
},
|
67
60
|
"publishConfig": {
|
@@ -72,5 +65,5 @@
|
|
72
65
|
"build": "yarn webiny run build",
|
73
66
|
"watch": "yarn webiny run watch"
|
74
67
|
},
|
75
|
-
"gitHead": "
|
68
|
+
"gitHead": "99666aeb00056c56292eeb5dbb6aba7fda2439e2"
|
76
69
|
}
|
package/plugins/context.d.ts
CHANGED
@@ -2,4 +2,3 @@ import { ContextPlugin } from "@webiny/api";
|
|
2
2
|
import { ApwContext } from "../types";
|
3
3
|
import { CreateApwContextParams } from "../scheduler/types";
|
4
4
|
export declare const createApwPageBuilderContext: (params: CreateApwContextParams) => ContextPlugin<ApwContext>;
|
5
|
-
export declare const createApwHeadlessCmsContext: (params: CreateApwContextParams) => ContextPlugin<ApwContext>;
|
package/plugins/context.js
CHANGED
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
5
5
|
value: true
|
6
6
|
});
|
7
|
-
exports.createApwPageBuilderContext =
|
7
|
+
exports.createApwPageBuilderContext = void 0;
|
8
8
|
var _hooks = require("./hooks");
|
9
9
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
10
10
|
var _api = require("@webiny/api");
|
@@ -98,18 +98,4 @@ const createApwPageBuilderContext = params => {
|
|
98
98
|
context.plugins.register((0, _extendPbPageSettingsSchema.extendPbPageSettingsSchema)());
|
99
99
|
});
|
100
100
|
};
|
101
|
-
exports.createApwPageBuilderContext = createApwPageBuilderContext;
|
102
|
-
const createApwHeadlessCmsContext = params => {
|
103
|
-
return new _api.ContextPlugin(async context => {
|
104
|
-
if (!context.wcp.canUseFeature("advancedPublishingWorkflow")) {
|
105
|
-
return;
|
106
|
-
} else if ((0, _utils.isInstallationPending)(context)) {
|
107
|
-
return;
|
108
|
-
}
|
109
|
-
await setupApwContext(params).apply(context);
|
110
|
-
await setupApwHeadlessCms().apply(context);
|
111
|
-
await (0, _hooks.attachApwHooks)().apply(context);
|
112
|
-
await (0, _security.createCustomAuth)(params).apply(context);
|
113
|
-
});
|
114
|
-
};
|
115
|
-
exports.createApwHeadlessCmsContext = createApwHeadlessCmsContext;
|
101
|
+
exports.createApwPageBuilderContext = createApwPageBuilderContext;
|
package/plugins/context.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["setupApwContext","params","ContextPlugin","context","tenancy","security","i18n","handlerClient","isInstallationPending","getLocale","locale","getContentLocale","WebinyError","getTenant","getCurrentTenant","getPermission","name","getIdentity","scheduler","createScheduler","storageOperations","apw","createApw","createStorageOperations","cms","getCmsContext","plugins","setupApwPageBuilder","apwPageBuilderHooks","setupApwHeadlessCms","apwCmsHooks","createApwPageBuilderContext","wcp","canUseFeature","apply","apwContentPagePlugins","attachApwHooks","createCustomAuth","register","extendPbPageSettingsSchema"
|
1
|
+
{"version":3,"names":["setupApwContext","params","ContextPlugin","context","tenancy","security","i18n","handlerClient","isInstallationPending","getLocale","locale","getContentLocale","WebinyError","getTenant","getCurrentTenant","getPermission","name","getIdentity","scheduler","createScheduler","storageOperations","apw","createApw","createStorageOperations","cms","getCmsContext","plugins","setupApwPageBuilder","apwPageBuilderHooks","setupApwHeadlessCms","apwCmsHooks","createApwPageBuilderContext","wcp","canUseFeature","apply","apwContentPagePlugins","attachApwHooks","createCustomAuth","register","extendPbPageSettingsSchema"],"sources":["context.ts"],"sourcesContent":["import { attachApwHooks } from \"./hooks\";\nimport WebinyError from \"@webiny/error\";\nimport { ContextPlugin } from \"@webiny/api\";\nimport { ApwContext } from \"~/types\";\nimport { createApw } from \"~/crud\";\nimport { apwPageBuilderHooks } from \"./pageBuilder\";\nimport { createStorageOperations } from \"~/storageOperations\";\nimport { SecurityPermission } from \"@webiny/api-security/types\";\nimport { Tenant } from \"@webiny/api-tenancy/types\";\nimport { CreateApwContextParams } from \"~/scheduler/types\";\nimport { createScheduler } from \"~/scheduler\";\nimport { createCustomAuth } from \"~/scheduler/handlers/executeAction/security\";\nimport { isInstallationPending } from \"./utils\";\nimport { extendPbPageSettingsSchema } from \"~/plugins/pageBuilder/extendPbPageSettingsSchema\";\nimport { apwContentPagePlugins } from \"~/plugins/pageBuilder/apwContentPagePlugins\";\nimport { apwCmsHooks } from \"~/plugins/cms\";\nimport { I18NLocale } from \"@webiny/api-i18n/types\";\n\nconst setupApwContext = (params: CreateApwContextParams) =>\n new ContextPlugin<ApwContext>(async context => {\n const { tenancy, security, i18n, handlerClient } = context;\n\n if (isInstallationPending({ tenancy, i18n })) {\n return;\n }\n\n const getLocale = (): I18NLocale => {\n const locale = i18n.getContentLocale();\n if (!locale) {\n throw new WebinyError(\n \"Missing content locale in api-apw/plugins/context.ts\",\n \"LOCALE_ERROR\"\n );\n }\n\n return locale;\n };\n\n const getTenant = (): Tenant => {\n return tenancy.getCurrentTenant();\n };\n\n const getPermission = async (name: string): Promise<SecurityPermission | null> => {\n return security.getPermission(name);\n };\n const getIdentity = () => security.getIdentity();\n\n const scheduler = createScheduler({\n getLocale,\n getIdentity,\n getTenant,\n getPermission,\n storageOperations: params.storageOperations\n });\n\n context.apw = createApw({\n getLocale,\n getIdentity,\n getTenant,\n getPermission,\n storageOperations: createStorageOperations({\n /**\n * TODO: We need to figure out a way to pass \"cms\" from outside (e.g. apps/api/graphql)\n */\n cms: context.cms,\n /**\n * TODO: This is required for \"entryFieldFromStorageTransform\" which access plugins from context.\n */\n getCmsContext: () => context,\n security\n }),\n scheduler,\n handlerClient,\n plugins: context.plugins\n });\n });\n\nconst setupApwPageBuilder = () => {\n return new ContextPlugin<ApwContext>(async context => {\n apwPageBuilderHooks(context);\n });\n};\n\nconst setupApwHeadlessCms = () => {\n return new ContextPlugin<ApwContext>(async context => {\n apwCmsHooks(context);\n });\n};\n\nexport const createApwPageBuilderContext = (params: CreateApwContextParams) => {\n return new ContextPlugin<ApwContext>(async context => {\n if (!context.wcp.canUseFeature(\"advancedPublishingWorkflow\")) {\n return;\n } else if (isInstallationPending(context)) {\n return;\n }\n\n await setupApwContext(params).apply(context);\n await setupApwPageBuilder().apply(context);\n await setupApwHeadlessCms().apply(context);\n await apwContentPagePlugins().apply(context);\n await attachApwHooks().apply(context);\n await createCustomAuth(params).apply(context);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AAC"}
|
@@ -15,7 +15,7 @@ const workflowSchema = new _plugins.GraphQLSchemaPlugin({
|
|
15
15
|
id: ID
|
16
16
|
savedOn: DateTime
|
17
17
|
createdOn: DateTime
|
18
|
-
createdBy:
|
18
|
+
createdBy: ApwIdentity
|
19
19
|
# ChangeRequest specific fields
|
20
20
|
step: String!
|
21
21
|
title: String!
|
@@ -35,7 +35,7 @@ const workflowSchema = new _plugins.GraphQLSchemaPlugin({
|
|
35
35
|
id: ID
|
36
36
|
savedOn: DateTime
|
37
37
|
createdOn: DateTime
|
38
|
-
createdBy:
|
38
|
+
createdBy: ApwIdentity
|
39
39
|
# ChangeRequest specific fields
|
40
40
|
step: String!
|
41
41
|
title: String!
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["workflowSchema","GraphQLSchemaPlugin","typeDefs","resolvers","ApwQuery","getChangeRequest","_","args","context","resolve","apw","changeRequest","get","id","listChangeRequests","entries","meta","list","ListResponse","e","ErrorResponse","ApwMutation","createChangeRequest","create","data","updateChangeRequest","update","deleteChangeRequest","delete"],"sources":["changeRequest.gql.ts"],"sourcesContent":["import { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins\";\nimport { ErrorResponse, ListResponse } from \"@webiny/handler-graphql\";\nimport { ApwChangeRequestListParams, ApwContext } from \"~/types\";\nimport resolve from \"~/utils/resolve\";\n\nconst workflowSchema = new GraphQLSchemaPlugin<ApwContext>({\n typeDefs: /* GraphQL */ `\n type ApwChangeRequestListItem {\n # System generated fields\n id: ID\n savedOn: DateTime\n createdOn: DateTime\n createdBy:
|
1
|
+
{"version":3,"names":["workflowSchema","GraphQLSchemaPlugin","typeDefs","resolvers","ApwQuery","getChangeRequest","_","args","context","resolve","apw","changeRequest","get","id","listChangeRequests","entries","meta","list","ListResponse","e","ErrorResponse","ApwMutation","createChangeRequest","create","data","updateChangeRequest","update","deleteChangeRequest","delete"],"sources":["changeRequest.gql.ts"],"sourcesContent":["import { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins\";\nimport { ErrorResponse, ListResponse } from \"@webiny/handler-graphql\";\nimport { ApwChangeRequestListParams, ApwContext } from \"~/types\";\nimport resolve from \"~/utils/resolve\";\n\nconst workflowSchema = new GraphQLSchemaPlugin<ApwContext>({\n typeDefs: /* GraphQL */ `\n type ApwChangeRequestListItem {\n # System generated fields\n id: ID\n savedOn: DateTime\n createdOn: DateTime\n createdBy: ApwIdentity\n # ChangeRequest specific fields\n step: String!\n title: String!\n body: JSON!\n resolved: Boolean\n media: JSON\n }\n\n type ApwListChangeRequestsResponse {\n data: [ApwChangeRequestListItem]\n error: ApwError\n meta: ApwMeta\n }\n\n type ApwChangeRequest {\n # System generated fields\n id: ID\n savedOn: DateTime\n createdOn: DateTime\n createdBy: ApwIdentity\n # ChangeRequest specific fields\n step: String!\n title: String!\n body: JSON!\n resolved: Boolean\n media: JSON\n }\n\n type ApwChangeRequestResponse {\n data: ApwChangeRequest\n error: ApwError\n }\n\n type ApwDeleteChangeRequestResponse {\n data: Boolean\n error: ApwError\n }\n\n enum ApwListChangeRequestSort {\n id_ASC\n id_DESC\n savedOn_ASC\n savedOn_DESC\n createdOn_ASC\n createdOn_DESC\n publishedOn_ASC\n publishedOn_DESC\n title_ASC\n title_DESC\n }\n\n input ApwCreateChangeRequestInput {\n step: String!\n title: String!\n body: JSON!\n resolved: Boolean\n media: JSON\n }\n\n input ApwUpdateChangeRequestInput {\n title: String\n body: JSON\n resolved: Boolean\n media: JSON\n }\n\n input ApwListChangeRequestWhereInput {\n id: ID\n step: String\n }\n\n input ApwListChangeRequestSearchInput {\n query: String\n }\n\n extend type ApwQuery {\n getChangeRequest(id: ID!): ApwChangeRequestResponse\n\n listChangeRequests(\n where: ApwListChangeRequestWhereInput\n limit: Int\n after: String\n sort: [ApwListChangeRequestSort!]\n search: ApwListChangeRequestSearchInput\n ): ApwListChangeRequestsResponse\n }\n\n extend type ApwMutation {\n createChangeRequest(data: ApwCreateChangeRequestInput!): ApwChangeRequestResponse\n\n updateChangeRequest(\n id: ID!\n data: ApwUpdateChangeRequestInput!\n ): ApwChangeRequestResponse\n\n deleteChangeRequest(id: ID!): ApwDeleteChangeRequestResponse\n }\n `,\n resolvers: {\n ApwQuery: {\n getChangeRequest: async (_, args: any, context) => {\n return resolve(() => context.apw.changeRequest.get(args.id));\n },\n listChangeRequests: async (_, args: any, context) => {\n try {\n /**\n * We know that args is ApwChangeRequestListParams.\n */\n const [entries, meta] = await context.apw.changeRequest.list(\n args as unknown as ApwChangeRequestListParams\n );\n return new ListResponse(entries, meta);\n } catch (e) {\n return new ErrorResponse(e);\n }\n }\n },\n ApwMutation: {\n createChangeRequest: async (_, args: any, context) => {\n return resolve(() => context.apw.changeRequest.create(args.data));\n },\n updateChangeRequest: async (_, args: any, context) => {\n return resolve(() => context.apw.changeRequest.update(args.id, args.data));\n },\n deleteChangeRequest: async (_, args: any, context) => {\n return resolve(() => context.apw.changeRequest.delete(args.id));\n }\n }\n }\n});\n\nexport default workflowSchema;\n"],"mappings":";;;;;;;AAAA;AACA;AAEA;AAEA,MAAMA,cAAc,GAAG,IAAIC,4BAAmB,CAAa;EACvDC,QAAQ,EAAE,aAAe;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;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C,CAAC;MACnE;IACJ;EACJ;AACJ,CAAC,CAAC;AAAC,eAEYb,cAAc;AAAA"}
|
@@ -15,7 +15,7 @@ const workflowSchema = new _plugins.GraphQLSchemaPlugin({
|
|
15
15
|
id: ID
|
16
16
|
savedOn: DateTime
|
17
17
|
createdOn: DateTime
|
18
|
-
createdBy:
|
18
|
+
createdBy: ApwIdentity
|
19
19
|
# Comment specific fields
|
20
20
|
body: JSON
|
21
21
|
changeRequest: ID
|
@@ -34,7 +34,7 @@ const workflowSchema = new _plugins.GraphQLSchemaPlugin({
|
|
34
34
|
id: ID
|
35
35
|
savedOn: DateTime
|
36
36
|
createdOn: DateTime
|
37
|
-
createdBy:
|
37
|
+
createdBy: ApwIdentity
|
38
38
|
# Comment specific fields
|
39
39
|
body: JSON
|
40
40
|
changeRequest: ID
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["workflowSchema","GraphQLSchemaPlugin","typeDefs","resolvers","ApwQuery","getComment","_","args","context","resolve","apw","comment","get","id","listComments","entries","meta","list","ListResponse","e","ErrorResponse","ApwMutation","createComment","create","data","updateComment","update","deleteComment","delete"],"sources":["comment.gql.ts"],"sourcesContent":["import { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins\";\nimport { ErrorResponse, ListResponse } from \"@webiny/handler-graphql\";\nimport { ApwContext, ApwCommentListParams } from \"~/types\";\nimport resolve from \"~/utils/resolve\";\n\nconst workflowSchema = new GraphQLSchemaPlugin<ApwContext>({\n typeDefs: /* GraphQL */ `\n type ApwCommentListItem {\n # System generated fields\n id: ID\n savedOn: DateTime\n createdOn: DateTime\n createdBy:
|
1
|
+
{"version":3,"names":["workflowSchema","GraphQLSchemaPlugin","typeDefs","resolvers","ApwQuery","getComment","_","args","context","resolve","apw","comment","get","id","listComments","entries","meta","list","ListResponse","e","ErrorResponse","ApwMutation","createComment","create","data","updateComment","update","deleteComment","delete"],"sources":["comment.gql.ts"],"sourcesContent":["import { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins\";\nimport { ErrorResponse, ListResponse } from \"@webiny/handler-graphql\";\nimport { ApwContext, ApwCommentListParams } from \"~/types\";\nimport resolve from \"~/utils/resolve\";\n\nconst workflowSchema = new GraphQLSchemaPlugin<ApwContext>({\n typeDefs: /* GraphQL */ `\n type ApwCommentListItem {\n # System generated fields\n id: ID\n savedOn: DateTime\n createdOn: DateTime\n createdBy: ApwIdentity\n # Comment specific fields\n body: JSON\n changeRequest: ID\n # TODO: Remove ApwRefField\n media: JSON\n }\n\n type ApwListCommentsResponse {\n data: [ApwCommentListItem]\n error: ApwError\n meta: ApwMeta\n }\n\n type ApwComment {\n # System generated fields\n id: ID\n savedOn: DateTime\n createdOn: DateTime\n createdBy: ApwIdentity\n # Comment specific fields\n body: JSON\n changeRequest: ID\n media: JSON\n }\n\n type ApwCommentResponse {\n data: ApwComment\n error: ApwError\n }\n\n type ApwDeleteCommentResponse {\n data: Boolean\n error: ApwError\n }\n\n enum ApwListCommentsSort {\n id_ASC\n id_DESC\n savedOn_ASC\n savedOn_DESC\n createdOn_ASC\n createdOn_DESC\n }\n\n input ApwCreateCommentInput {\n body: JSON!\n changeRequest: ID!\n media: JSON\n }\n\n input ApwUpdateCommentInput {\n body: JSON!\n }\n\n input ApwListCommentsWhereInput {\n id: ID\n id_not: ID\n id_in: [ID!]\n id_not_in: [ID!]\n createdOn: DateTime\n createdOn_gt: DateTime\n createdOn_gte: DateTime\n createdOn_lt: DateTime\n createdOn_lte: DateTime\n createdOn_between: [DateTime!]\n createdOn_not_between: [DateTime!]\n savedOn: DateTime\n savedOn_gt: DateTime\n savedOn_gte: DateTime\n savedOn_lt: DateTime\n savedOn_lte: DateTime\n savedOn_between: [DateTime!]\n savedOn_not_between: [DateTime!]\n createdBy: String\n createdBy_not: String\n createdBy_in: [String!]\n createdBy_not_in: [String!]\n ownedBy: String\n ownedBy_not: String\n ownedBy_in: [String!]\n ownedBy_not_in: [String!]\n changeRequest: ApwRefFieldWhereInput\n }\n\n extend type ApwQuery {\n getComment(id: ID!): ApwCommentResponse\n\n listComments(\n where: ApwListCommentsWhereInput\n limit: Int\n after: String\n sort: [ApwListCommentsSort!]\n ): ApwListCommentsResponse\n }\n\n extend type ApwMutation {\n createComment(data: ApwCreateCommentInput!): ApwCommentResponse\n\n updateComment(id: ID!, data: ApwUpdateCommentInput!): ApwCommentResponse\n\n deleteComment(id: ID!): ApwDeleteCommentResponse\n }\n `,\n resolvers: {\n ApwQuery: {\n getComment: async (_, args: any, context) => {\n return resolve(() => context.apw.comment.get(args.id));\n },\n listComments: async (_, args: any, context) => {\n try {\n /**\n * We know that args is ApwCommentListParams.\n */\n const [entries, meta] = await context.apw.comment.list(\n args as unknown as ApwCommentListParams\n );\n return new ListResponse(entries, meta);\n } catch (e) {\n return new ErrorResponse(e);\n }\n }\n },\n ApwMutation: {\n createComment: async (_, args: any, context) => {\n return resolve(() => context.apw.comment.create(args.data));\n },\n updateComment: async (_, args: any, context) => {\n return resolve(() => context.apw.comment.update(args.id, args.data));\n },\n deleteComment: async (_, args: any, context) => {\n return resolve(() => context.apw.comment.delete(args.id));\n }\n }\n }\n});\n\nexport default workflowSchema;\n"],"mappings":";;;;;;;AAAA;AACA;AAEA;AAEA,MAAMA,cAAc,GAAG,IAAIC,4BAAmB,CAAa;EACvDC,QAAQ,EAAE,aAAe;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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K;QAC5C,OAAO,IAAAC,gBAAO,EAAC,MAAMD,OAAO,CAACE,GAAG,CAACC,OAAO,CAACiB,MAAM,CAACrB,IAAI,CAACM,EAAE,CAAC,CAAC;MAC7D;IACJ;EACJ;AACJ,CAAC,CAAC;AAAC,eAEYb,cAAc;AAAA"}
|
@@ -16,7 +16,7 @@ const contentReviewSchema = new _plugins.GraphQLSchemaPlugin({
|
|
16
16
|
id: ID
|
17
17
|
savedOn: DateTime
|
18
18
|
createdOn: DateTime
|
19
|
-
createdBy:
|
19
|
+
createdBy: ApwIdentity
|
20
20
|
# ContentReview specific fields
|
21
21
|
title: String
|
22
22
|
steps: [ApwContentReviewStep]
|
@@ -72,7 +72,7 @@ const contentReviewSchema = new _plugins.GraphQLSchemaPlugin({
|
|
72
72
|
title: String
|
73
73
|
pendingChangeRequests: Int
|
74
74
|
signOffProvidedOn: DateTime
|
75
|
-
signOffProvidedBy:
|
75
|
+
signOffProvidedBy: ApwIdentity
|
76
76
|
}
|
77
77
|
|
78
78
|
type ApwContentReview {
|
@@ -80,7 +80,7 @@ const contentReviewSchema = new _plugins.GraphQLSchemaPlugin({
|
|
80
80
|
id: ID
|
81
81
|
savedOn: DateTime
|
82
82
|
createdOn: DateTime
|
83
|
-
createdBy:
|
83
|
+
createdBy: ApwIdentity
|
84
84
|
# ContentReview specific fields
|
85
85
|
title: String
|
86
86
|
steps: [ApwContentReviewStep]
|
@@ -152,9 +152,9 @@ const contentReviewSchema = new _plugins.GraphQLSchemaPlugin({
|
|
152
152
|
version: Int!
|
153
153
|
settings: ApwContentReviewContentSettings
|
154
154
|
publishedOn: String
|
155
|
-
publishedBy:
|
155
|
+
publishedBy: ApwIdentity
|
156
156
|
scheduledOn: DateTime
|
157
|
-
scheduledBy:
|
157
|
+
scheduledBy: ApwIdentity
|
158
158
|
}
|
159
159
|
|
160
160
|
input ApwContentReviewContentInput {
|