@webiny/api-headless-cms-workflows 0.0.0-unstable.6f45466a1d → 0.0.0-unstable.7c2def32a7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/CmsWorkflowsFeature.d.ts +4 -0
  2. package/CmsWorkflowsFeature.js +24 -0
  3. package/CmsWorkflowsFeature.js.map +1 -0
  4. package/features/EntryWorkflows/decorators/CmsWorkflowStateContextProvider.d.ts +15 -0
  5. package/features/EntryWorkflows/decorators/CmsWorkflowStateContextProvider.js +35 -0
  6. package/features/EntryWorkflows/decorators/CmsWorkflowStateContextProvider.js.map +1 -0
  7. package/features/EntryWorkflows/decorators/CmsWorkflowStateFilter.d.ts +13 -0
  8. package/features/EntryWorkflows/decorators/CmsWorkflowStateFilter.js +45 -0
  9. package/features/EntryWorkflows/decorators/CmsWorkflowStateFilter.js.map +1 -0
  10. package/features/EntryWorkflows/errors.d.ts +11 -0
  11. package/features/EntryWorkflows/errors.js +12 -0
  12. package/features/EntryWorkflows/errors.js.map +1 -0
  13. package/features/EntryWorkflows/feature.d.ts +4 -1
  14. package/features/EntryWorkflows/feature.js +19 -10
  15. package/features/EntryWorkflows/feature.js.map +1 -1
  16. package/features/EntryWorkflows/handlers/BlockMoveOnActiveWorkflowState.d.ts +11 -0
  17. package/features/EntryWorkflows/handlers/BlockMoveOnActiveWorkflowState.js +37 -0
  18. package/features/EntryWorkflows/handlers/BlockMoveOnActiveWorkflowState.js.map +1 -0
  19. package/features/EntryWorkflows/handlers/ClearEntryStateOnWorkflowStateAfterDelete.d.ts +1 -1
  20. package/features/EntryWorkflows/handlers/ClearEntryStateOnWorkflowStateAfterDelete.js +24 -22
  21. package/features/EntryWorkflows/handlers/ClearEntryStateOnWorkflowStateAfterDelete.js.map +1 -1
  22. package/features/EntryWorkflows/handlers/ClearEntryStateOnWorkflowStateCancel.d.ts +13 -0
  23. package/features/EntryWorkflows/handlers/ClearEntryStateOnWorkflowStateCancel.js +35 -0
  24. package/features/EntryWorkflows/handlers/ClearEntryStateOnWorkflowStateCancel.js.map +1 -0
  25. package/features/EntryWorkflows/handlers/DeleteWorkflowStateOnEntryAfterDelete.d.ts +1 -1
  26. package/features/EntryWorkflows/handlers/DeleteWorkflowStateOnEntryAfterDelete.js +16 -19
  27. package/features/EntryWorkflows/handlers/DeleteWorkflowStateOnEntryAfterDelete.js.map +1 -1
  28. package/features/EntryWorkflows/handlers/DeleteWorkflowsOnModelAfterDelete.d.ts +1 -1
  29. package/features/EntryWorkflows/handlers/DeleteWorkflowsOnModelAfterDelete.js +29 -32
  30. package/features/EntryWorkflows/handlers/DeleteWorkflowsOnModelAfterDelete.js.map +1 -1
  31. package/features/EntryWorkflows/handlers/UpdateEntryOnWorkflowStateAfterCreate.d.ts +1 -1
  32. package/features/EntryWorkflows/handlers/UpdateEntryOnWorkflowStateAfterCreate.js +25 -23
  33. package/features/EntryWorkflows/handlers/UpdateEntryOnWorkflowStateAfterCreate.js.map +1 -1
  34. package/features/EntryWorkflows/handlers/UpdateEntryOnWorkflowStateAfterUpdate.d.ts +1 -1
  35. package/features/EntryWorkflows/handlers/UpdateEntryOnWorkflowStateAfterUpdate.js +24 -23
  36. package/features/EntryWorkflows/handlers/UpdateEntryOnWorkflowStateAfterUpdate.js.map +1 -1
  37. package/features/EntryWorkflows/handlers/ValidateWorkflowStateOnEntryBeforePublish.d.ts +1 -1
  38. package/features/EntryWorkflows/handlers/ValidateWorkflowStateOnEntryBeforePublish.js +34 -36
  39. package/features/EntryWorkflows/handlers/ValidateWorkflowStateOnEntryBeforePublish.js.map +1 -1
  40. package/features/EntryWorkflows/index.js +0 -2
  41. package/features/Workflows/feature.d.ts +4 -1
  42. package/features/Workflows/feature.js +6 -5
  43. package/features/Workflows/feature.js.map +1 -1
  44. package/features/Workflows/handlers/DisallowUnpublishableModelsOnBeforeCreate.d.ts +1 -1
  45. package/features/Workflows/handlers/DisallowUnpublishableModelsOnBeforeCreate.js +17 -22
  46. package/features/Workflows/handlers/DisallowUnpublishableModelsOnBeforeCreate.js.map +1 -1
  47. package/features/Workflows/index.js +0 -2
  48. package/graphql/entrySystemSchema.d.ts +2 -0
  49. package/graphql/entrySystemSchema.js +18 -0
  50. package/graphql/entrySystemSchema.js.map +1 -0
  51. package/index.d.ts +1 -1
  52. package/index.js +1 -20
  53. package/package.json +26 -18
  54. package/utils/appName.js +6 -11
  55. package/utils/appName.js.map +1 -1
  56. package/utils/modelAllowed.js +5 -9
  57. package/utils/modelAllowed.js.map +1 -1
  58. package/utils/state.d.ts +2 -2
  59. package/utils/state.js +9 -8
  60. package/utils/state.js.map +1 -1
  61. package/features/EntryWorkflows/index.js.map +0 -1
  62. package/features/Workflows/index.js.map +0 -1
  63. package/index.js.map +0 -1
package/package.json CHANGED
@@ -1,8 +1,11 @@
1
1
  {
2
2
  "name": "@webiny/api-headless-cms-workflows",
3
- "version": "0.0.0-unstable.6f45466a1d",
3
+ "version": "0.0.0-unstable.7c2def32a7",
4
4
  "type": "module",
5
- "main": "index.js",
5
+ "exports": {
6
+ ".": "./index.js",
7
+ "./*": "./*"
8
+ },
6
9
  "description": "Headless CMS Workflows",
7
10
  "keywords": [
8
11
  "api-headless-cms-workflows:base"
@@ -14,25 +17,30 @@
14
17
  },
15
18
  "license": "MIT",
16
19
  "dependencies": {
17
- "@webiny/api": "0.0.0-unstable.6f45466a1d",
18
- "@webiny/api-core": "0.0.0-unstable.6f45466a1d",
19
- "@webiny/api-headless-cms": "0.0.0-unstable.6f45466a1d",
20
- "@webiny/api-workflows": "0.0.0-unstable.6f45466a1d",
21
- "@webiny/error": "0.0.0-unstable.6f45466a1d",
22
- "@webiny/feature": "0.0.0-unstable.6f45466a1d"
20
+ "@webiny/api": "0.0.0-unstable.7c2def32a7",
21
+ "@webiny/api-aco": "0.0.0-unstable.7c2def32a7",
22
+ "@webiny/api-core": "0.0.0-unstable.7c2def32a7",
23
+ "@webiny/api-headless-cms": "0.0.0-unstable.7c2def32a7",
24
+ "@webiny/api-workflows": "0.0.0-unstable.7c2def32a7",
25
+ "@webiny/error": "0.0.0-unstable.7c2def32a7",
26
+ "@webiny/feature": "0.0.0-unstable.7c2def32a7",
27
+ "@webiny/shared-aco": "0.0.0-unstable.7c2def32a7"
23
28
  },
24
29
  "devDependencies": {
25
- "@webiny/build-tools": "0.0.0-unstable.6f45466a1d",
26
- "@webiny/plugins": "0.0.0-unstable.6f45466a1d",
27
- "@webiny/project-utils": "0.0.0-unstable.6f45466a1d",
28
- "@webiny/testing": "0.0.0-unstable.6f45466a1d",
29
- "@webiny/wcp": "0.0.0-unstable.6f45466a1d",
30
- "typescript": "5.9.3",
31
- "vitest": "3.2.4"
30
+ "@webiny/api-core-testing": "0.0.0-unstable.7c2def32a7",
31
+ "@webiny/api-headless-cms-testing": "0.0.0-unstable.7c2def32a7",
32
+ "@webiny/api-opensearch": "0.0.0-unstable.7c2def32a7",
33
+ "@webiny/build-tools": "0.0.0-unstable.7c2def32a7",
34
+ "@webiny/handler": "0.0.0-unstable.7c2def32a7",
35
+ "@webiny/plugins": "0.0.0-unstable.7c2def32a7",
36
+ "@webiny/wcp": "0.0.0-unstable.7c2def32a7",
37
+ "typescript": "7.0.2",
38
+ "vitest": "4.1.11"
32
39
  },
33
40
  "publishConfig": {
34
- "access": "public",
35
- "directory": "dist"
41
+ "access": "public"
36
42
  },
37
- "gitHead": "6f45466a1d9fb94f6156923501eb90ac303b81a5"
43
+ "webiny": {
44
+ "publishFrom": "dist"
45
+ }
38
46
  }
package/utils/appName.js CHANGED
@@ -1,14 +1,9 @@
1
- export const createWorkflowAppName = ({
2
- model
3
- }) => {
4
- return `cms.${model.modelId}`;
5
- };
6
- export const getModelIdFromAppName = app => {
7
- const matched = app.match(/^cms\.([a-zA-Z0-9_-]+)$/);
8
- if (!matched) {
9
- return null;
10
- }
11
- return matched ? matched[1] : null;
1
+ const createWorkflowAppName = ({ model })=>`cms.${model.modelId}`;
2
+ const getModelIdFromAppName = (app)=>{
3
+ const matched = app.match(/^cms\.([a-zA-Z0-9_-]+)$/);
4
+ if (!matched) return null;
5
+ return matched ? matched[1] : null;
12
6
  };
7
+ export { createWorkflowAppName, getModelIdFromAppName };
13
8
 
14
9
  //# sourceMappingURL=appName.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createWorkflowAppName","model","modelId","getModelIdFromAppName","app","matched","match"],"sources":["appName.ts"],"sourcesContent":["import type { CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\n\ninterface IParams {\n model: Pick<CmsModel, \"modelId\">;\n}\nexport const createWorkflowAppName = ({ model }: IParams): string => {\n return `cms.${model.modelId}`;\n};\n\nexport const getModelIdFromAppName = (app: string): string | null => {\n const matched = app.match(/^cms\\.([a-zA-Z0-9_-]+)$/);\n if (!matched) {\n return null;\n }\n return matched ? matched[1] : null;\n};\n"],"mappings":"AAKA,OAAO,MAAMA,qBAAqB,GAAGA,CAAC;EAAEC;AAAe,CAAC,KAAa;EACjE,OAAO,OAAOA,KAAK,CAACC,OAAO,EAAE;AACjC,CAAC;AAED,OAAO,MAAMC,qBAAqB,GAAIC,GAAW,IAAoB;EACjE,MAAMC,OAAO,GAAGD,GAAG,CAACE,KAAK,CAAC,yBAAyB,CAAC;EACpD,IAAI,CAACD,OAAO,EAAE;IACV,OAAO,IAAI;EACf;EACA,OAAOA,OAAO,GAAGA,OAAO,CAAC,CAAC,CAAC,GAAG,IAAI;AACtC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"utils/appName.js","sources":["../../src/utils/appName.ts"],"sourcesContent":["import type { CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\n\ninterface IParams {\n model: Pick<CmsModel, \"modelId\">;\n}\nexport const createWorkflowAppName = ({ model }: IParams): string => {\n return `cms.${model.modelId}`;\n};\n\nexport const getModelIdFromAppName = (app: string): string | null => {\n const matched = app.match(/^cms\\.([a-zA-Z0-9_-]+)$/);\n if (!matched) {\n return null;\n }\n return matched ? matched[1] : null;\n};\n"],"names":["createWorkflowAppName","model","getModelIdFromAppName","app","matched"],"mappings":"AAKO,MAAMA,wBAAwB,CAAC,EAAEC,KAAK,EAAW,GAC7C,CAAC,IAAI,EAAEA,MAAM,OAAO,EAAE;AAG1B,MAAMC,wBAAwB,CAACC;IAClC,MAAMC,UAAUD,IAAI,KAAK,CAAC;IAC1B,IAAI,CAACC,SACD,OAAO;IAEX,OAAOA,UAAUA,OAAO,CAAC,EAAE,GAAG;AAClC"}
@@ -1,13 +1,9 @@
1
1
  import { CMS_MODEL_SINGLETON_TAG } from "@webiny/api-headless-cms/constants.js";
2
- export const isModelAllowed = model => {
3
- if (model.isPrivate) {
4
- return false;
5
- }
6
- // TODO remove when we allow singleton models to have workflows.
7
- else if (model.tags?.includes(CMS_MODEL_SINGLETON_TAG)) {
8
- return false;
9
- }
10
- return true;
2
+ const isModelAllowed = (model)=>{
3
+ if (model.isPrivate) return false;
4
+ if (model.tags?.includes(CMS_MODEL_SINGLETON_TAG)) return false;
5
+ return true;
11
6
  };
7
+ export { isModelAllowed };
12
8
 
13
9
  //# sourceMappingURL=modelAllowed.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["CMS_MODEL_SINGLETON_TAG","isModelAllowed","model","isPrivate","tags","includes"],"sources":["modelAllowed.ts"],"sourcesContent":["import type { CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\nimport { CMS_MODEL_SINGLETON_TAG } from \"@webiny/api-headless-cms/constants.js\";\n\nexport const isModelAllowed = (model: Pick<CmsModel, \"isPrivate\" | \"tags\">): boolean => {\n if (model.isPrivate) {\n return false;\n }\n // TODO remove when we allow singleton models to have workflows.\n else if (model.tags?.includes(CMS_MODEL_SINGLETON_TAG)) {\n return false;\n }\n return true;\n};\n"],"mappings":"AACA,SAASA,uBAAuB,QAAQ,uCAAuC;AAE/E,OAAO,MAAMC,cAAc,GAAIC,KAA2C,IAAc;EACpF,IAAIA,KAAK,CAACC,SAAS,EAAE;IACjB,OAAO,KAAK;EAChB;EACA;EAAA,KACK,IAAID,KAAK,CAACE,IAAI,EAAEC,QAAQ,CAACL,uBAAuB,CAAC,EAAE;IACpD,OAAO,KAAK;EAChB;EACA,OAAO,IAAI;AACf,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"utils/modelAllowed.js","sources":["../../src/utils/modelAllowed.ts"],"sourcesContent":["import type { CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\nimport { CMS_MODEL_SINGLETON_TAG } from \"@webiny/api-headless-cms/constants.js\";\n\nexport const isModelAllowed = (model: Pick<CmsModel, \"isPrivate\" | \"tags\">): boolean => {\n if (model.isPrivate) {\n return false;\n }\n // TODO remove when we allow singleton models to have workflows.\n else if (model.tags?.includes(CMS_MODEL_SINGLETON_TAG)) {\n return false;\n }\n return true;\n};\n"],"names":["isModelAllowed","model","CMS_MODEL_SINGLETON_TAG"],"mappings":";AAGO,MAAMA,iBAAiB,CAACC;IAC3B,IAAIA,MAAM,SAAS,EACf,OAAO;IAGN,IAAIA,MAAM,IAAI,EAAE,SAASC,0BAC1B,OAAO;IAEX,OAAO;AACX"}
package/utils/state.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import type { IEntryState } from "@webiny/api-headless-cms/types/index.js";
1
+ import type { ICmsEntryWorkflowState } from "@webiny/api-workflows/types.js";
2
2
  import type { WorkflowState } from "@webiny/api-workflows/domain/workflowState/WorkflowState.js";
3
- export declare const getStateValues: (state: WorkflowState) => IEntryState;
3
+ export declare const getStateValues: (state: WorkflowState) => ICmsEntryWorkflowState;
package/utils/state.js CHANGED
@@ -1,11 +1,12 @@
1
- export const getStateValues = state => {
2
- const activeStep = state.currentStep;
3
- return {
4
- workflowId: state.workflowId,
5
- stepId: activeStep.id,
6
- stepName: activeStep.title,
7
- state: activeStep.state
8
- };
1
+ const getStateValues = (state)=>{
2
+ const activeStep = state.currentStep;
3
+ return {
4
+ workflowId: state.workflowId,
5
+ stepId: activeStep.id,
6
+ stepName: activeStep.title,
7
+ state: activeStep.state
8
+ };
9
9
  };
10
+ export { getStateValues };
10
11
 
11
12
  //# sourceMappingURL=state.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["getStateValues","state","activeStep","currentStep","workflowId","stepId","id","stepName","title"],"sources":["state.ts"],"sourcesContent":["import type { IEntryState } from \"@webiny/api-headless-cms/types/index.js\";\nimport type { WorkflowState } from \"@webiny/api-workflows/domain/workflowState/WorkflowState.js\";\n\nexport const getStateValues = (state: WorkflowState): IEntryState => {\n const activeStep = state.currentStep;\n\n return {\n workflowId: state.workflowId,\n stepId: activeStep.id,\n stepName: activeStep.title,\n state: activeStep.state\n };\n};\n"],"mappings":"AAGA,OAAO,MAAMA,cAAc,GAAIC,KAAoB,IAAkB;EACjE,MAAMC,UAAU,GAAGD,KAAK,CAACE,WAAW;EAEpC,OAAO;IACHC,UAAU,EAAEH,KAAK,CAACG,UAAU;IAC5BC,MAAM,EAAEH,UAAU,CAACI,EAAE;IACrBC,QAAQ,EAAEL,UAAU,CAACM,KAAK;IAC1BP,KAAK,EAAEC,UAAU,CAACD;EACtB,CAAC;AACL,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"utils/state.js","sources":["../../src/utils/state.ts"],"sourcesContent":["import type { ICmsEntryWorkflowState } from \"@webiny/api-workflows/types.js\";\nimport type { WorkflowState } from \"@webiny/api-workflows/domain/workflowState/WorkflowState.js\";\n\nexport const getStateValues = (state: WorkflowState): ICmsEntryWorkflowState => {\n const activeStep = state.currentStep;\n\n return {\n workflowId: state.workflowId,\n stepId: activeStep.id,\n stepName: activeStep.title,\n state: activeStep.state\n };\n};\n"],"names":["getStateValues","state","activeStep"],"mappings":"AAGO,MAAMA,iBAAiB,CAACC;IAC3B,MAAMC,aAAaD,MAAM,WAAW;IAEpC,OAAO;QACH,YAAYA,MAAM,UAAU;QAC5B,QAAQC,WAAW,EAAE;QACrB,UAAUA,WAAW,KAAK;QAC1B,OAAOA,WAAW,KAAK;IAC3B;AACJ"}
@@ -1 +0,0 @@
1
- {"version":3,"names":["EntryWorkflowsFeature"],"sources":["index.ts"],"sourcesContent":["export { EntryWorkflowsFeature } from \"./feature.js\";\n"],"mappings":"AAAA,SAASA,qBAAqB","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":["WorkflowsFeature"],"sources":["index.ts"],"sourcesContent":["export { WorkflowsFeature } from \"./feature.js\";\n"],"mappings":"AAAA,SAASA,gBAAgB","ignoreList":[]}
package/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"names":["createContextPlugin","EntryWorkflowsFeature","WcpContext","WorkflowsFeature","createHeadlessCmsWorkflows","plugin","context","wcpContext","container","resolve","canUseWorkflows","register","name"],"sources":["index.ts"],"sourcesContent":["import { createContextPlugin } from \"@webiny/api\";\nimport { EntryWorkflowsFeature } from \"./features/EntryWorkflows/feature.js\";\nimport { WcpContext } from \"@webiny/api-core/features/wcp/WcpContext/index.js\";\nimport { WorkflowsFeature } from \"~/features/Workflows/index.js\";\n\nexport const createHeadlessCmsWorkflows = () => {\n const plugin = createContextPlugin(async context => {\n const wcpContext = context.container.resolve(WcpContext);\n\n if (!wcpContext.canUseWorkflows()) {\n return;\n }\n\n // Register features\n EntryWorkflowsFeature.register(context.container, context);\n WorkflowsFeature.register(context.container);\n });\n\n plugin.name = \"headless-cms-workflows.context\";\n\n return plugin;\n};\n"],"mappings":"AAAA,SAASA,mBAAmB,QAAQ,aAAa;AACjD,SAASC,qBAAqB;AAC9B,SAASC,UAAU,QAAQ,mDAAmD;AAC9E,SAASC,gBAAgB;AAEzB,OAAO,MAAMC,0BAA0B,GAAGA,CAAA,KAAM;EAC5C,MAAMC,MAAM,GAAGL,mBAAmB,CAAC,MAAMM,OAAO,IAAI;IAChD,MAAMC,UAAU,GAAGD,OAAO,CAACE,SAAS,CAACC,OAAO,CAACP,UAAU,CAAC;IAExD,IAAI,CAACK,UAAU,CAACG,eAAe,CAAC,CAAC,EAAE;MAC/B;IACJ;;IAEA;IACAT,qBAAqB,CAACU,QAAQ,CAACL,OAAO,CAACE,SAAS,EAAEF,OAAO,CAAC;IAC1DH,gBAAgB,CAACQ,QAAQ,CAACL,OAAO,CAACE,SAAS,CAAC;EAChD,CAAC,CAAC;EAEFH,MAAM,CAACO,IAAI,GAAG,gCAAgC;EAE9C,OAAOP,MAAM;AACjB,CAAC","ignoreList":[]}