@webiny/api-website-builder-workflows 6.5.0-beta.11 → 6.5.0-beta.13

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.
@@ -7,7 +7,7 @@ class ValidateWorkflowStateOnPageBeforePublishImpl {
7
7
  this.getTargetState = getTargetState;
8
8
  }
9
9
  async handle(event) {
10
- const { page } = event.payload;
10
+ const { original: page } = event.payload;
11
11
  const stateResult = await this.getTargetState.execute({
12
12
  app: WB_PAGE_APP,
13
13
  targetRevisionId: page.id
@@ -1 +1 @@
1
- {"version":3,"file":"features/PageWorkflows/handlers/ValidateWorkflowStateOnPageBeforePublish.js","sources":["../../../../src/features/PageWorkflows/handlers/ValidateWorkflowStateOnPageBeforePublish.ts"],"sourcesContent":["import { WebinyError } from \"@webiny/error\";\nimport { PageBeforePublishEventHandler } from \"@webiny/api-website-builder/features/pages/PublishPage/index.js\";\nimport { WB_PAGE_APP } from \"~/utils/appName.js\";\nimport { GetTargetWorkflowStateUseCase } from \"@webiny/api-workflows/features/workflowState/GetTargetWorkflowState/index.js\";\n\nclass ValidateWorkflowStateOnPageBeforePublishImpl\n implements PageBeforePublishEventHandler.Interface\n{\n constructor(private getTargetState: GetTargetWorkflowStateUseCase.Interface) {}\n\n async handle(event: PageBeforePublishEventHandler.Event): Promise<void> {\n const { page } = event.payload;\n\n const stateResult = await this.getTargetState.execute({\n app: WB_PAGE_APP,\n targetRevisionId: page.id\n });\n\n if (stateResult.isFail()) {\n if (stateResult.error.code === \"Workflows/State/NotFound\") {\n /**\n * If page workflows don't have custom states, there is no need to validate anything.\n */\n return;\n }\n }\n\n const state = stateResult.value;\n\n if (state?.done) {\n return;\n }\n\n throw new WebinyError(\n \"Cannot publish page because its workflow state is not completed.\",\n \"WORKFLOW_STATE_NOT_COMPLETED\",\n {\n app: WB_PAGE_APP,\n pageId: page.id,\n state: {\n ...state\n }\n }\n );\n }\n}\n\nexport const ValidateWorkflowStateOnPageBeforePublish =\n PageBeforePublishEventHandler.createImplementation({\n implementation: ValidateWorkflowStateOnPageBeforePublishImpl,\n dependencies: [GetTargetWorkflowStateUseCase]\n });\n"],"names":["ValidateWorkflowStateOnPageBeforePublishImpl","getTargetState","event","page","stateResult","WB_PAGE_APP","state","WebinyError","ValidateWorkflowStateOnPageBeforePublish","PageBeforePublishEventHandler","GetTargetWorkflowStateUseCase"],"mappings":";;;;AAKA,MAAMA;IAGF,YAAoBC,cAAuD,CAAE;aAAzDA,cAAc,GAAdA;IAA0D;IAE9E,MAAM,OAAOC,KAA0C,EAAiB;QACpE,MAAM,EAAEC,IAAI,EAAE,GAAGD,MAAM,OAAO;QAE9B,MAAME,cAAc,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;YAClD,KAAKC;YACL,kBAAkBF,KAAK,EAAE;QAC7B;QAEA,IAAIC,YAAY,MAAM,IAClB;YAAA,IAAIA,AAA2B,+BAA3BA,YAAY,KAAK,CAAC,IAAI,EAItB;QACJ;QAGJ,MAAME,QAAQF,YAAY,KAAK;QAE/B,IAAIE,OAAO,MACP;QAGJ,MAAM,IAAIC,YACN,oEACA,gCACA;YACI,KAAKF;YACL,QAAQF,KAAK,EAAE;YACf,OAAO;gBACH,GAAGG,KAAK;YACZ;QACJ;IAER;AACJ;AAEO,MAAME,2CACTC,8BAA8B,oBAAoB,CAAC;IAC/C,gBAAgBT;IAChB,cAAc;QAACU;KAA8B;AACjD"}
1
+ {"version":3,"file":"features/PageWorkflows/handlers/ValidateWorkflowStateOnPageBeforePublish.js","sources":["../../../../src/features/PageWorkflows/handlers/ValidateWorkflowStateOnPageBeforePublish.ts"],"sourcesContent":["import { WebinyError } from \"@webiny/error\";\nimport { PageBeforePublishEventHandler } from \"@webiny/api-website-builder/features/pages/PublishPage/index.js\";\nimport { WB_PAGE_APP } from \"~/utils/appName.js\";\nimport { GetTargetWorkflowStateUseCase } from \"@webiny/api-workflows/features/workflowState/GetTargetWorkflowState/index.js\";\n\nclass ValidateWorkflowStateOnPageBeforePublishImpl\n implements PageBeforePublishEventHandler.Interface\n{\n constructor(private getTargetState: GetTargetWorkflowStateUseCase.Interface) {}\n\n async handle(event: PageBeforePublishEventHandler.Event): Promise<void> {\n const { original: page } = event.payload;\n\n const stateResult = await this.getTargetState.execute({\n app: WB_PAGE_APP,\n targetRevisionId: page.id\n });\n\n if (stateResult.isFail()) {\n if (stateResult.error.code === \"Workflows/State/NotFound\") {\n /**\n * If page workflows don't have custom states, there is no need to validate anything.\n */\n return;\n }\n }\n\n const state = stateResult.value;\n\n if (state?.done) {\n return;\n }\n\n throw new WebinyError(\n \"Cannot publish page because its workflow state is not completed.\",\n \"WORKFLOW_STATE_NOT_COMPLETED\",\n {\n app: WB_PAGE_APP,\n pageId: page.id,\n state: {\n ...state\n }\n }\n );\n }\n}\n\nexport const ValidateWorkflowStateOnPageBeforePublish =\n PageBeforePublishEventHandler.createImplementation({\n implementation: ValidateWorkflowStateOnPageBeforePublishImpl,\n dependencies: [GetTargetWorkflowStateUseCase]\n });\n"],"names":["ValidateWorkflowStateOnPageBeforePublishImpl","getTargetState","event","page","stateResult","WB_PAGE_APP","state","WebinyError","ValidateWorkflowStateOnPageBeforePublish","PageBeforePublishEventHandler","GetTargetWorkflowStateUseCase"],"mappings":";;;;AAKA,MAAMA;IAGF,YAAoBC,cAAuD,CAAE;aAAzDA,cAAc,GAAdA;IAA0D;IAE9E,MAAM,OAAOC,KAA0C,EAAiB;QACpE,MAAM,EAAE,UAAUC,IAAI,EAAE,GAAGD,MAAM,OAAO;QAExC,MAAME,cAAc,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;YAClD,KAAKC;YACL,kBAAkBF,KAAK,EAAE;QAC7B;QAEA,IAAIC,YAAY,MAAM,IAClB;YAAA,IAAIA,AAA2B,+BAA3BA,YAAY,KAAK,CAAC,IAAI,EAItB;QACJ;QAGJ,MAAME,QAAQF,YAAY,KAAK;QAE/B,IAAIE,OAAO,MACP;QAGJ,MAAM,IAAIC,YACN,oEACA,gCACA;YACI,KAAKF;YACL,QAAQF,KAAK,EAAE;YACf,OAAO;gBACH,GAAGG,KAAK;YACZ;QACJ;IAER;AACJ;AAEO,MAAME,2CACTC,8BAA8B,oBAAoB,CAAC;IAC/C,gBAAgBT;IAChB,cAAc;QAACU;KAA8B;AACjD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/api-website-builder-workflows",
3
- "version": "6.5.0-beta.11",
3
+ "version": "6.5.0-beta.13",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./index.js",
@@ -17,23 +17,23 @@
17
17
  },
18
18
  "license": "MIT",
19
19
  "dependencies": {
20
- "@webiny/api": "6.5.0-beta.11",
21
- "@webiny/api-aco": "6.5.0-beta.11",
22
- "@webiny/api-core": "6.5.0-beta.11",
23
- "@webiny/api-website-builder": "6.5.0-beta.11",
24
- "@webiny/api-workflows": "6.5.0-beta.11",
25
- "@webiny/error": "6.5.0-beta.11",
26
- "@webiny/feature": "6.5.0-beta.11",
27
- "@webiny/handler-graphql": "6.5.0-beta.11",
28
- "@webiny/shared-aco": "6.5.0-beta.11"
20
+ "@webiny/api": "6.5.0-beta.13",
21
+ "@webiny/api-aco": "6.5.0-beta.13",
22
+ "@webiny/api-core": "6.5.0-beta.13",
23
+ "@webiny/api-website-builder": "6.5.0-beta.13",
24
+ "@webiny/api-workflows": "6.5.0-beta.13",
25
+ "@webiny/error": "6.5.0-beta.13",
26
+ "@webiny/feature": "6.5.0-beta.13",
27
+ "@webiny/handler-graphql": "6.5.0-beta.13",
28
+ "@webiny/shared-aco": "6.5.0-beta.13"
29
29
  },
30
30
  "devDependencies": {
31
- "@webiny/build-tools": "6.5.0-beta.11",
32
- "@webiny/plugins": "6.5.0-beta.11",
33
- "@webiny/project-utils": "6.5.0-beta.11",
34
- "@webiny/testing": "6.5.0-beta.11",
31
+ "@webiny/build-tools": "6.5.0-beta.13",
32
+ "@webiny/plugins": "6.5.0-beta.13",
33
+ "@webiny/project-utils": "6.5.0-beta.13",
34
+ "@webiny/testing": "6.5.0-beta.13",
35
35
  "typescript": "7.0.2",
36
- "vitest": "5.0.3"
36
+ "vitest": "5.0.5"
37
37
  },
38
38
  "publishConfig": {
39
39
  "access": "public"