@strapi/review-workflows 5.56.0 → 5.57.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/dist/server/audit-logs.js +123 -0
  2. package/dist/server/audit-logs.js.map +1 -0
  3. package/dist/server/audit-logs.mjs +116 -0
  4. package/dist/server/audit-logs.mjs.map +1 -0
  5. package/dist/server/bootstrap.js +7 -0
  6. package/dist/server/bootstrap.js.map +1 -1
  7. package/dist/server/bootstrap.mjs +7 -0
  8. package/dist/server/bootstrap.mjs.map +1 -1
  9. package/dist/server/controllers/workflows.js +8 -6
  10. package/dist/server/controllers/workflows.js.map +1 -1
  11. package/dist/server/controllers/workflows.mjs +8 -6
  12. package/dist/server/controllers/workflows.mjs.map +1 -1
  13. package/dist/server/middlewares/review-workflows.js +7 -3
  14. package/dist/server/middlewares/review-workflows.js.map +1 -1
  15. package/dist/server/middlewares/review-workflows.mjs +7 -3
  16. package/dist/server/middlewares/review-workflows.mjs.map +1 -1
  17. package/dist/server/migrations/handle-deleted-ct-in-workflows.js +2 -2
  18. package/dist/server/migrations/handle-deleted-ct-in-workflows.js.map +1 -1
  19. package/dist/server/migrations/handle-deleted-ct-in-workflows.mjs +2 -2
  20. package/dist/server/migrations/handle-deleted-ct-in-workflows.mjs.map +1 -1
  21. package/dist/server/migrations/multiple-workflows.js +2 -5
  22. package/dist/server/migrations/multiple-workflows.js.map +1 -1
  23. package/dist/server/migrations/multiple-workflows.mjs +2 -5
  24. package/dist/server/migrations/multiple-workflows.mjs.map +1 -1
  25. package/dist/server/register.js +4 -7
  26. package/dist/server/register.js.map +1 -1
  27. package/dist/server/register.mjs +4 -7
  28. package/dist/server/register.mjs.map +1 -1
  29. package/dist/server/services/assignees.js +18 -2
  30. package/dist/server/services/assignees.js.map +1 -1
  31. package/dist/server/services/assignees.mjs +19 -3
  32. package/dist/server/services/assignees.mjs.map +1 -1
  33. package/dist/server/services/document-service-middleware.js +2 -3
  34. package/dist/server/services/document-service-middleware.js.map +1 -1
  35. package/dist/server/services/document-service-middleware.mjs +2 -3
  36. package/dist/server/services/document-service-middleware.mjs.map +1 -1
  37. package/dist/server/services/metrics/weekly-metrics.js +8 -8
  38. package/dist/server/services/metrics/weekly-metrics.js.map +1 -1
  39. package/dist/server/services/metrics/weekly-metrics.mjs +4 -4
  40. package/dist/server/services/metrics/weekly-metrics.mjs.map +1 -1
  41. package/dist/server/services/stage-permissions.js +1 -2
  42. package/dist/server/services/stage-permissions.js.map +1 -1
  43. package/dist/server/services/stage-permissions.mjs +1 -2
  44. package/dist/server/services/stage-permissions.mjs.map +1 -1
  45. package/dist/server/services/stages.js +8 -8
  46. package/dist/server/services/stages.js.map +1 -1
  47. package/dist/server/services/stages.mjs +7 -7
  48. package/dist/server/services/stages.mjs.map +1 -1
  49. package/dist/server/services/validation.js +1 -2
  50. package/dist/server/services/validation.js.map +1 -1
  51. package/dist/server/services/validation.mjs +1 -2
  52. package/dist/server/services/validation.mjs.map +1 -1
  53. package/dist/server/services/workflow-content-types.js +23 -6
  54. package/dist/server/services/workflow-content-types.js.map +1 -1
  55. package/dist/server/services/workflow-content-types.mjs +21 -4
  56. package/dist/server/services/workflow-content-types.mjs.map +1 -1
  57. package/dist/server/services/workflows.js +91 -13
  58. package/dist/server/services/workflows.js.map +1 -1
  59. package/dist/server/services/workflows.mjs +91 -13
  60. package/dist/server/services/workflows.mjs.map +1 -1
  61. package/dist/server/src/audit-logs.d.ts +112 -0
  62. package/dist/server/src/audit-logs.d.ts.map +1 -0
  63. package/dist/server/src/bootstrap.d.ts.map +1 -1
  64. package/dist/server/src/controllers/workflows.d.ts.map +1 -1
  65. package/dist/server/src/index.d.ts +1 -1
  66. package/dist/server/src/index.d.ts.map +1 -1
  67. package/dist/server/src/middlewares/review-workflows.d.ts.map +1 -1
  68. package/dist/server/src/migrations/handle-deleted-ct-in-workflows.d.ts.map +1 -1
  69. package/dist/server/src/migrations/multiple-workflows.d.ts.map +1 -1
  70. package/dist/server/src/register.d.ts.map +1 -1
  71. package/dist/server/src/services/assignees.d.ts.map +1 -1
  72. package/dist/server/src/services/document-service-middleware.d.ts.map +1 -1
  73. package/dist/server/src/services/index.d.ts +1 -1
  74. package/dist/server/src/services/index.d.ts.map +1 -1
  75. package/dist/server/src/services/metrics/weekly-metrics.d.ts +1 -1
  76. package/dist/server/src/services/metrics/weekly-metrics.d.ts.map +1 -1
  77. package/dist/server/src/services/stage-permissions.d.ts.map +1 -1
  78. package/dist/server/src/services/validation.d.ts.map +1 -1
  79. package/dist/server/src/services/workflow-content-types.d.ts +10 -3
  80. package/dist/server/src/services/workflow-content-types.d.ts.map +1 -1
  81. package/dist/server/src/services/workflows.d.ts.map +1 -1
  82. package/dist/server/src/utils/review-workflows.d.ts +12 -8
  83. package/dist/server/src/utils/review-workflows.d.ts.map +1 -1
  84. package/dist/server/utils/review-workflows.js +8 -13
  85. package/dist/server/utils/review-workflows.js.map +1 -1
  86. package/dist/server/utils/review-workflows.mjs +8 -13
  87. package/dist/server/utils/review-workflows.mjs.map +1 -1
  88. package/package.json +5 -5
@@ -0,0 +1,112 @@
1
+ import type { Core, Data, Modules, UID } from '@strapi/types';
2
+ export declare const AUDITED_EVENTS: {
3
+ readonly WORKFLOW_CREATE: "workflow.create";
4
+ readonly WORKFLOW_UPDATE: "workflow.update";
5
+ readonly WORKFLOW_DELETE: "workflow.delete";
6
+ readonly ENTRY_ASSIGNEE_UPDATE: "entry.assignee.update";
7
+ };
8
+ /** A stage as stored in the log: roles by name, sorted, so order alone is not a change. */
9
+ export interface StageSnapshot {
10
+ name: string;
11
+ color: string | null;
12
+ fromPermissions: string[];
13
+ toPermissions: string[];
14
+ }
15
+ export interface WorkflowSnapshot {
16
+ name: string;
17
+ contentTypes: string[];
18
+ stages: StageSnapshot[];
19
+ stageRequiredToPublish: string | null;
20
+ }
21
+ export declare const WORKFLOW_TRACKED_FIELDS: readonly ["name", "contentTypes", "stages", "stageRequiredToPublish"];
22
+ export type WorkflowChanges = {
23
+ [K in keyof WorkflowSnapshot]?: Modules.AuditLogs.FieldChange<WorkflowSnapshot[K]>;
24
+ };
25
+ /** A workflow row read with WORKFLOW_POPULATE. Without the populated roles, the permission lists come out empty. */
26
+ export interface WorkflowRow {
27
+ id: Data.ID;
28
+ name: string;
29
+ contentTypes?: string[] | null;
30
+ stages?: Array<{
31
+ name: string;
32
+ color?: string | null;
33
+ permissions?: Array<{
34
+ actionParameters?: {
35
+ from?: unknown;
36
+ to?: unknown;
37
+ } | null;
38
+ role?: {
39
+ name: string;
40
+ } | null;
41
+ }> | null;
42
+ }> | null;
43
+ stageRequiredToPublish?: {
44
+ name: string;
45
+ } | null;
46
+ }
47
+ export interface WorkflowEvent {
48
+ workflowId: Data.ID;
49
+ name: string;
50
+ }
51
+ export type WorkflowCreateDetails = Omit<WorkflowSnapshot, 'name'>;
52
+ export type WorkflowCreateEvent = WorkflowEvent & WorkflowCreateDetails;
53
+ export interface WorkflowUpdateDetails {
54
+ changes: WorkflowChanges;
55
+ }
56
+ export type WorkflowUpdateEvent = WorkflowEvent & WorkflowUpdateDetails;
57
+ export interface EntryEvent {
58
+ uid: UID.ContentType;
59
+ documentId: string;
60
+ locale: string | null;
61
+ }
62
+ export interface AssigneeUpdateDetails {
63
+ locale: string | null;
64
+ changes: {
65
+ assignee: Modules.AuditLogs.FieldChange<Data.ID | null>;
66
+ };
67
+ }
68
+ export type AssigneeUpdateEvent = EntryEvent & Pick<AssigneeUpdateDetails, 'changes'>;
69
+ interface StageRef {
70
+ id: Data.ID;
71
+ name: string;
72
+ }
73
+ export interface StageUpdateDetails {
74
+ locale: string | null;
75
+ workflow: {
76
+ id: Data.ID;
77
+ name: string | null;
78
+ };
79
+ changes: {
80
+ stage: Modules.AuditLogs.FieldChange<StageRef>;
81
+ };
82
+ }
83
+ /** The payload of the existing review-workflows.updateEntryStage webhook event. */
84
+ export interface StageUpdateEvent {
85
+ uid: UID.ContentType;
86
+ entity: {
87
+ documentId: string;
88
+ locale?: string | null;
89
+ };
90
+ workflow: {
91
+ id: Data.ID;
92
+ stages: {
93
+ from: StageRef;
94
+ to: StageRef;
95
+ };
96
+ };
97
+ }
98
+ export declare const toWorkflowSnapshot: (row: WorkflowRow) => WorkflowSnapshot;
99
+ export declare const getWorkflowChanges: (previous: WorkflowSnapshot, next: WorkflowSnapshot) => WorkflowChanges;
100
+ export declare const toWorkflowEvent: (row: WorkflowRow) => WorkflowEvent;
101
+ /**
102
+ * The part of the audit-logs lifecycle service used by this plugin.
103
+ * The full service type lives in the Admin EE package and cannot be imported here.
104
+ */
105
+ interface AuditLogsLifecycle {
106
+ registerEvent<TDetails, TResource extends Modules.AuditLogs.Resource>(name: string, transform: Modules.AuditLogs.EventTransformer<TDetails, TResource>): void;
107
+ }
108
+ export declare const registerAuditEvents: ({ strapi }: {
109
+ strapi: Core.Strapi;
110
+ }, auditLogsLifecycle: AuditLogsLifecycle) => void;
111
+ export {};
112
+ //# sourceMappingURL=audit-logs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit-logs.d.ts","sourceRoot":"","sources":["../../../server/src/audit-logs.ts"],"names":[],"mappings":"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"}
@@ -1 +1 @@
1
- {"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../../server/src/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;yBAyCf,YAAY;IAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAA;CAAE;AAAzD,wBAiBE"}
1
+ {"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../../server/src/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;yBA0Cf,YAAY;IAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAA;CAAE;AAAzD,wBAsBE"}
@@ -1 +1 @@
1
- {"version":3,"file":"workflows.d.ts","sourceRoot":"","sources":["../../../../server/src/controllers/workflows.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;;IAuFjC;;OAEG;gBACe,OAAO;IAuBzB;;OAEG;gBACe,OAAO;IAmCzB;;OAEG;gBACe,OAAO;IAwBzB;;OAEG;cACa,OAAO;;AA/FzB,wBAoHE"}
1
+ {"version":3,"file":"workflows.d.ts","sourceRoot":"","sources":["../../../../server/src/controllers/workflows.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;;IAsFjC;;OAEG;gBACe,OAAO;IAuBzB;;OAEG;gBACe,OAAO;IAmCzB;;OAEG;gBACe,OAAO;IAwBzB;;OAEG;cACa,OAAO;;AA/FzB,wBAwHE"}
@@ -228,7 +228,7 @@ declare const _default: {
228
228
  computeMetrics(): Promise<{
229
229
  numberOfActiveWorkflows: number;
230
230
  avgStagesCount: number;
231
- maxStagesCount: unknown;
231
+ maxStagesCount: number | undefined;
232
232
  activatedContentTypes: number;
233
233
  }>;
234
234
  sendMetrics(): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../server/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA6By/C,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAA8zC,CAAC;oCAAoB,CAAC;0BAAM,CAAC;;wBAAgB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AADt2F,wBAA2B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../server/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA6B0oE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAA+pB,CAAC;oCAAoB,CAAC;0BAAM,CAAC;;wBAAgB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AADx1F,wBAA2B"}
@@ -1 +1 @@
1
- {"version":3,"file":"review-workflows.d.ts","sourceRoot":"","sources":["../../../../server/src/middlewares/review-workflows.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAI1C;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,QAqBxD;;;;AAED,wBAEE"}
1
+ {"version":3,"file":"review-workflows.d.ts","sourceRoot":"","sources":["../../../../server/src/middlewares/review-workflows.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAE1C;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,QAwBxD;;;;AAED,wBAEE"}
@@ -1 +1 @@
1
- {"version":3,"file":"handle-deleted-ct-in-workflows.d.ts","sourceRoot":"","sources":["../../../../server/src/migrations/handle-deleted-ct-in-workflows.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,iBAAe,2BAA2B,CAAC,EAAE,eAAe,EAAE,YAAY,EAAE,EAAE,GAAG,iBAwBhF;AAED,eAAe,2BAA2B,CAAC"}
1
+ {"version":3,"file":"handle-deleted-ct-in-workflows.d.ts","sourceRoot":"","sources":["../../../../server/src/migrations/handle-deleted-ct-in-workflows.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,iBAAe,2BAA2B,CAAC,EAAE,eAAe,EAAE,YAAY,EAAE,EAAE,GAAG,iBAyBhF;AAED,eAAe,2BAA2B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"multiple-workflows.d.ts","sourceRoot":"","sources":["../../../../server/src/migrations/multiple-workflows.ts"],"names":[],"mappings":"AAGA,iBAAe,4BAA4B,CAAC,EAAE,eAAe,EAAE,YAAY,EAAE,EAAE,GAAG,iBAqBjF;AAED,eAAe,4BAA4B,CAAC"}
1
+ {"version":3,"file":"multiple-workflows.d.ts","sourceRoot":"","sources":["../../../../server/src/migrations/multiple-workflows.ts"],"names":[],"mappings":"AAGA,iBAAe,4BAA4B,CAAC,EAAE,eAAe,EAAE,YAAY,EAAE,EAAE,GAAG,iBAuBjF;AAED,eAAe,4BAA4B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../server/src/register.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAO,MAAM,eAAe,CAAC;yBAqGzB,YAAY;IAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAA;CAAE;AAAzD,wBA4BE"}
1
+ {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../server/src/register.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAO,MAAM,eAAe,CAAC;yBAoGzB,YAAY;IAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAA;CAAE;AAAzD,wBAyBE"}
@@ -1 +1 @@
1
- {"version":3,"file":"assignees.d.ts","sourceRoot":"","sources":["../../../../server/src/services/assignees.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;yBAQ/B,YAAY;IAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAA;CAAE;6BAIhB,MAAM,GAAG,MAAM,SAAS,GAAG,CAAC,WAAW;IAUtE;;OAEG;yCAEe;QACd,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;QACpB,UAAU,EAAE,MAAM,CAAC;QACnB,MAAM,EAAE,MAAM,CAAC;QACf,SAAS,EAAE,MAAM,CAAC;KACnB,SACM,GAAG,CAAC,WAAW,cACV,MAAM,GAAG,IAAI;;AAzB/B,wBA8DE"}
1
+ {"version":3,"file":"assignees.d.ts","sourceRoot":"","sources":["../../../../server/src/services/assignees.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;yBAQ/B,YAAY;IAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAA;CAAE;6BAIhB,MAAM,GAAG,MAAM,SAAS,GAAG,CAAC,WAAW;IAUtE;;OAEG;yCAEe;QACd,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;QACpB,UAAU,EAAE,MAAM,CAAC;QACnB,MAAM,EAAE,MAAM,CAAC;QACf,SAAS,EAAE,MAAM,CAAC;KACnB,SACM,GAAG,CAAC,WAAW,cACV,MAAM,GAAG,IAAI;;AAzB/B,wBAyEE"}
@@ -1 +1 @@
1
- {"version":3,"file":"document-service-middleware.d.ts","sourceRoot":"","sources":["../../../../server/src/services/document-service-middleware.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;;;;;;AAuJ7C,wBAIG"}
1
+ {"version":3,"file":"document-service-middleware.d.ts","sourceRoot":"","sources":["../../../../server/src/services/document-service-middleware.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;;;;;;AAsJ7C,wBAIG"}
@@ -126,7 +126,7 @@ declare const _default: {
126
126
  computeMetrics(): Promise<{
127
127
  numberOfActiveWorkflows: number;
128
128
  avgStagesCount: number;
129
- maxStagesCount: unknown;
129
+ maxStagesCount: number | undefined;
130
130
  activatedContentTypes: number;
131
131
  }>;
132
132
  sendMetrics(): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../server/src/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;oBAqBw5C,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAA8zC,CAAC;gCAAoB,CAAC;sBAAM,CAAC;;oBAAgB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAXrwF,wBAUE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../server/src/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;oBAqByiE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAA+pB,CAAC;gCAAoB,CAAC;sBAAM,CAAC;;oBAAgB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAXvvF,wBAUE"}
@@ -5,7 +5,7 @@ declare const _default: ({ strapi }: {
5
5
  computeMetrics(): Promise<{
6
6
  numberOfActiveWorkflows: number;
7
7
  avgStagesCount: number;
8
- maxStagesCount: unknown;
8
+ maxStagesCount: number | undefined;
9
9
  activatedContentTypes: number;
10
10
  }>;
11
11
  sendMetrics(): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"weekly-metrics.d.ts","sourceRoot":"","sources":["../../../../../server/src/services/metrics/weekly-metrics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;yBAU1B,YAAY;IAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAA;CAAE;;;;;;;;;;;AAAnD,wBAsEE"}
1
+ {"version":3,"file":"weekly-metrics.d.ts","sourceRoot":"","sources":["../../../../../server/src/services/metrics/weekly-metrics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;yBAU1B,YAAY;IAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAA;CAAE;;;;;;;;;;;AAAnD,wBAgEE"}
@@ -1 +1 @@
1
- {"version":3,"file":"stage-permissions.d.ts","sourceRoot":"","sources":["../../../../server/src/services/stage-permissions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;yBAS1B,YAAY;IAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAA;CAAE;6CAkB5C;QACD,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;QACf,SAAS,EAAE,MAAM,CAAC;KACnB;8BAgB+B;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,EAAE;6CAOpF;QACD,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;KACjB;gCAeiC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE;4BAGzD;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE;gBAIlC,MAAM,aAAa,MAAM;oCAqBC,MAAM;IAqB5C;;;OAGG;+CACwC;QACzC,WAAW,CAAC,EAAE;YAAE,gBAAgB,CAAC,EAAE;gBAAE,EAAE,CAAC,EAAE,MAAM,CAAA;aAAE,CAAC;YAAC,IAAI,CAAC,EAAE;gBAAE,EAAE,EAAE,MAAM,CAAA;aAAE,GAAG,MAAM,CAAA;SAAE,EAAE,CAAC;KACxF;;AAvHL,wBA6IE"}
1
+ {"version":3,"file":"stage-permissions.d.ts","sourceRoot":"","sources":["../../../../server/src/services/stage-permissions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;yBAQ1B,YAAY;IAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAA;CAAE;6CAkB5C;QACD,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;QACf,SAAS,EAAE,MAAM,CAAC;KACnB;8BAgB+B;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,EAAE;6CAOpF;QACD,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;KACjB;gCAeiC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE;4BAGzD;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE;gBAIlC,MAAM,aAAa,MAAM;oCAqBC,MAAM;IAqB5C;;;OAGG;+CACwC;QACzC,WAAW,CAAC,EAAE;YAAE,gBAAgB,CAAC,EAAE;gBAAE,EAAE,CAAC,EAAE,MAAM,CAAA;aAAE,CAAC;YAAC,IAAI,CAAC,EAAE;gBAAE,EAAE,EAAE,MAAM,CAAA;aAAE,GAAG,MAAM,CAAA;SAAE,EAAE,CAAC;KACxF;;AAvHL,wBA6IE"}
@@ -1 +1 @@
1
- {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../../server/src/services/validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;yBAS1B,YAAY;IAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAA;CAAE;;;;;uDAMI,GAAG;IAWtD;;;;OAIG;mCAC4B,GAAG;4CAcY,GAAG;IASjD;;;;;OAKG;;;AAlDP,wBA2DE"}
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../../server/src/services/validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;yBAQ1B,YAAY;IAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAA;CAAE;;;;;uDAMI,GAAG;IAWtD;;;;OAIG;mCAC4B,GAAG;4CAcY,GAAG;IASjD;;;;;OAKG;;;AAlDP,wBA2DE"}
@@ -1,4 +1,11 @@
1
- import type { Core } from '@strapi/types';
1
+ import type { Core, Data } from '@strapi/types';
2
+ /** A workflow that lost content types to another one, as read after the write. */
3
+ export interface ContentTypeTransfer {
4
+ workflowId: Data.ID;
5
+ name: string;
6
+ before: string[];
7
+ after: string[];
8
+ }
2
9
  declare const _default: ({ strapi }: {
3
10
  strapi: Core.Strapi;
4
11
  }) => {
@@ -9,13 +16,13 @@ declare const _default: ({ strapi }: {
9
16
  * @param {Array<string>} options.destContentTypes - The content types assigned to the new workflow
10
17
  * @param {Workflow.Stage} options.stageId - The new stage to assign the entities to
11
18
  */
12
- migrate({ srcContentTypes, destContentTypes, stageId }: any): Promise<void>;
19
+ migrate({ srcContentTypes, destContentTypes, stageId, }: any): Promise<ContentTypeTransfer[]>;
13
20
  /**
14
21
  * Filters the content types assigned to a workflow
15
22
  * @param {Workflow} srcWorkflow - The workflow to transfer from
16
23
  * @param {string} uid - The content type uid
17
24
  */
18
- transferContentTypes(srcWorkflow: any, uid: any): Promise<void>;
25
+ transferContentTypes(srcWorkflow: any, uid: any): Promise<ContentTypeTransfer>;
19
26
  };
20
27
  export default _default;
21
28
  //# sourceMappingURL=workflow-content-types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-content-types.d.ts","sourceRoot":"","sources":["../../../../server/src/services/workflow-content-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;yBAM1B,YAAY;IAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAA;CAAE;IAiB/C;;;;;;OAMG;4DACgE,GAAG;IAqCtE;;;;OAIG;sCACqC,GAAG,OAAO,GAAG;;AAlEzD,wBA8EE"}
1
+ {"version":3,"file":"workflow-content-types.d.ts","sourceRoot":"","sources":["../../../../server/src/services/workflow-content-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAMhD,kFAAkF;AAClF,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,IAAI,CAAC,EAAE,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;yBAEe,YAAY;IAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAA;CAAE;IAiB/C;;;;;;OAMG;6DAKA,GAAG,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC;IA6CvC;;;;OAIG;sCACqC,GAAG,OAAO,GAAG,GAAG,OAAO,CAAC,mBAAmB,CAAC;;AA9ExF,wBAiGE"}
@@ -1 +1 @@
1
- {"version":3,"file":"workflows.d.ts","sourceRoot":"","sources":["../../../../server/src/services/workflows.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;yBA4B1B,YAAY;IAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAA;CAAE;IAM/C;;;;;OAKG;gBACc,GAAG;IAapB;;;;;OAKG;iBACU,GAAG,SAAQ;QAAE,QAAQ,CAAC,EAAE,GAAG,CAAA;KAAE;IAW1C;;;;;OAKG;iBACgB;QAAE,IAAI,EAAE,GAAG,CAAA;KAAE;IAkDhC;;;;;;OAMG;qBACoB,GAAG,QAAQ,GAAG;IA2ErC;;;;;;OAMG;qBACoB,GAAG,QAAQ,GAAG;IAmCrC;;;OAGG;;IAKH;;;;;OAKG;6BAC4B,GAAG,SAAQ,GAAG;IAM7C;;;;;;;OAOG;+BAC8B,GAAG;IAOpC;;;;;OAKG;4CAC2C,GAAG;IAcjD;;;;;;OAMG;0CACmC,GAAG,YAAY,GAAG;;AA5R5D,wBAuSE"}
1
+ {"version":3,"file":"workflows.d.ts","sourceRoot":"","sources":["../../../../server/src/services/workflows.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;yBAkC1B,YAAY;IAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAA;CAAE;IAmB/C;;;;;OAKG;gBACc,GAAG;IAapB;;;;;OAKG;iBACU,GAAG,SAAQ;QAAE,QAAQ,CAAC,EAAE,GAAG,CAAA;KAAE;IAW1C;;;;;OAKG;iBACgB;QAAE,IAAI,EAAE,GAAG,CAAA;KAAE;IAgEhC;;;;;;OAMG;qBACoB,GAAG,QAAQ,GAAG;IAkGrC;;;;;;OAMG;qBACoB,GAAG,QAAQ,GAAG;IAwCrC;;;OAGG;;IAKH;;;;;OAKG;6BAC4B,GAAG,SAAQ,GAAG;IAM7C;;;;;;;OAOG;+BAC8B,GAAG;IAOpC;;;;;OAKG;4CAC2C,GAAG;IAcjD;;;;;;OAMG;0CACmC,GAAG,YAAY,GAAG;;AAnV5D,wBA8VE"}
@@ -1,6 +1,8 @@
1
1
  import type { Core } from '@strapi/types';
2
- export declare const getVisibleContentTypesUID: (...args: any[]) => any;
3
- export declare const hasStageAttribute: import("lodash/fp").LodashHas1x1;
2
+ /** Returns the content types that can use review workflow stages. */
3
+ export declare const getVisibleContentTypesUID: (contentTypes: Core.Strapi["contentTypes"]) => Array<keyof Core.Strapi["contentTypes"]>;
4
+ /** Checks whether a content type stores a review workflow stage. */
5
+ export declare const hasStageAttribute: (contentType: unknown) => boolean;
4
6
  export declare const getWorkflowContentTypeFilter: ({ strapi }: {
5
7
  strapi: Core.Strapi;
6
8
  }, contentType: any) => {
@@ -10,13 +12,15 @@ export declare const getWorkflowContentTypeFilter: ({ strapi }: {
10
12
  $contains: string;
11
13
  $jsonSupersetOf?: undefined;
12
14
  };
13
- export declare const clampMaxWorkflows: import("lodash/fp").LodashClamp1x3;
14
- export declare const clampMaxStagesPerWorkflow: import("lodash/fp").LodashClamp1x3;
15
+ /** Constrains the workflow limit to the supported range. */
16
+ export declare const clampMaxWorkflows: (value: number) => number;
17
+ /** Constrains the stage limit to the supported range. */
18
+ export declare const clampMaxStagesPerWorkflow: (value: number) => number;
15
19
  declare const _default: {
16
- clampMaxWorkflows: import("lodash/fp").LodashClamp1x3;
17
- clampMaxStagesPerWorkflow: import("lodash/fp").LodashClamp1x3;
18
- getVisibleContentTypesUID: (...args: any[]) => any;
19
- hasStageAttribute: import("lodash/fp").LodashHas1x1;
20
+ clampMaxWorkflows: (value: number) => number;
21
+ clampMaxStagesPerWorkflow: (value: number) => number;
22
+ getVisibleContentTypesUID: (contentTypes: Core.Strapi["contentTypes"]) => Array<keyof Core.Strapi["contentTypes"]>;
23
+ hasStageAttribute: (contentType: unknown) => boolean;
20
24
  getWorkflowContentTypeFilter: ({ strapi }: {
21
25
  strapi: Core.Strapi;
22
26
  }, contentType: any) => {
@@ -1 +1 @@
1
- {"version":3,"file":"review-workflows.d.ts","sourceRoot":"","sources":["../../../../server/src/utils/review-workflows.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAQ1C,eAAO,MAAM,yBAAyB,yBASpC,CAAC;AAEH,eAAO,MAAM,iBAAiB,kCAA8C,CAAC;AAE7E,eAAO,MAAM,4BAA4B,GACvC,YAAY;IAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAA;CAAE,EACnC,aAAa,GAAG;;;;;;CAMjB,CAAC;AAEF,eAAO,MAAM,iBAAiB,oCAA0B,CAAC;AACzD,eAAO,MAAM,yBAAyB,oCAAoC,CAAC;;;;;;+CAV7D;QAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAA;KAAE,eACtB,GAAG;;;;;;;;AAWlB,wBAME"}
1
+ {"version":3,"file":"review-workflows.d.ts","sourceRoot":"","sources":["../../../../server/src/utils/review-workflows.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAQ1C,qEAAqE;AACrE,eAAO,MAAM,yBAAyB,GAAI,cAAc,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,KAQ5E,KAAK,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC;AAEhD,oEAAoE;AACpE,eAAO,MAAM,iBAAiB,GAAI,aAAa,OAAO,YACI,CAAC;AAE3D,eAAO,MAAM,4BAA4B,GACvC,YAAY;IAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAA;CAAE,EACnC,aAAa,GAAG;;;;;;CAMjB,CAAC;AAEF,4DAA4D;AAC5D,eAAO,MAAM,iBAAiB,GAAI,OAAO,MAAM,WAAmC,CAAC;AACnF,yDAAyD;AACzD,eAAO,MAAM,yBAAyB,GAAI,OAAO,MAAM,WACb,CAAC;;+BAHF,MAAM;uCAEE,MAAM;8CA3BC,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,KAQ5E,KAAK,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;qCAGA,OAAO;+CAIxC;QAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAA;KAAE,eACtB,GAAG;;;;;;;;AAclB,wBAME"}
@@ -1,18 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var fp = require('lodash/fp');
3
+ var lodash = require('lodash');
4
4
  var workflows = require('../constants/workflows.js');
5
5
 
6
- const getVisibleContentTypesUID = fp.pipe([
7
- // Pick only content-types visible in the content-manager and option is not false
8
- fp.pickBy((value)=>fp.getOr(true, 'pluginOptions.content-manager.visible', value) && !fp.getOr(false, 'options.noStageAttribute', value)),
9
- // Get UIDs
10
- fp.keys
11
- ]);
12
- const hasStageAttribute = fp.has([
13
- 'attributes',
14
- workflows.ENTITY_STAGE_ATTRIBUTE
15
- ]);
6
+ /** Returns the content types that can use review workflow stages. */ const getVisibleContentTypesUID = (contentTypes)=>Object.keys(lodash.pickBy(contentTypes, (value)=>lodash.get(value, 'pluginOptions.content-manager.visible', true) && !lodash.get(value, 'options.noStageAttribute', false)));
7
+ /** Checks whether a content type stores a review workflow stage. */ const hasStageAttribute = (contentType)=>lodash.has(contentType, [
8
+ 'attributes',
9
+ workflows.ENTITY_STAGE_ATTRIBUTE
10
+ ]);
16
11
  const getWorkflowContentTypeFilter = ({ strapi }, contentType)=>{
17
12
  if (strapi.db.dialect.supportsOperator('$jsonSupersetOf')) {
18
13
  return {
@@ -25,8 +20,8 @@ const getWorkflowContentTypeFilter = ({ strapi }, contentType)=>{
25
20
  $contains: `"${contentType}"`
26
21
  };
27
22
  };
28
- const clampMaxWorkflows = fp.clamp(1, workflows.MAX_WORKFLOWS);
29
- const clampMaxStagesPerWorkflow = fp.clamp(1, workflows.MAX_STAGES_PER_WORKFLOW);
23
+ /** Constrains the workflow limit to the supported range. */ const clampMaxWorkflows = (value)=>lodash.clamp(value, 1, workflows.MAX_WORKFLOWS);
24
+ /** Constrains the stage limit to the supported range. */ const clampMaxStagesPerWorkflow = (value)=>lodash.clamp(value, 1, workflows.MAX_STAGES_PER_WORKFLOW);
30
25
 
31
26
  exports.clampMaxStagesPerWorkflow = clampMaxStagesPerWorkflow;
32
27
  exports.clampMaxWorkflows = clampMaxWorkflows;
@@ -1 +1 @@
1
- {"version":3,"file":"review-workflows.js","sources":["../../../server/src/utils/review-workflows.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\nimport { getOr, keys, pickBy, pipe, has, clamp } from 'lodash/fp';\nimport {\n ENTITY_STAGE_ATTRIBUTE,\n MAX_WORKFLOWS,\n MAX_STAGES_PER_WORKFLOW,\n} from '../constants/workflows';\n\nexport const getVisibleContentTypesUID = pipe([\n // Pick only content-types visible in the content-manager and option is not false\n pickBy(\n (value) =>\n getOr(true, 'pluginOptions.content-manager.visible', value) &&\n !getOr(false, 'options.noStageAttribute', value)\n ),\n // Get UIDs\n keys,\n]);\n\nexport const hasStageAttribute = has(['attributes', ENTITY_STAGE_ATTRIBUTE]);\n\nexport const getWorkflowContentTypeFilter = (\n { strapi }: { strapi: Core.Strapi },\n contentType: any\n) => {\n if (strapi.db.dialect.supportsOperator('$jsonSupersetOf')) {\n return { $jsonSupersetOf: JSON.stringify([contentType]) };\n }\n return { $contains: `\"${contentType}\"` };\n};\n\nexport const clampMaxWorkflows = clamp(1, MAX_WORKFLOWS);\nexport const clampMaxStagesPerWorkflow = clamp(1, MAX_STAGES_PER_WORKFLOW);\n\nexport default {\n clampMaxWorkflows,\n clampMaxStagesPerWorkflow,\n getVisibleContentTypesUID,\n hasStageAttribute,\n getWorkflowContentTypeFilter,\n};\n"],"names":["getVisibleContentTypesUID","pipe","pickBy","value","getOr","keys","hasStageAttribute","has","ENTITY_STAGE_ATTRIBUTE","getWorkflowContentTypeFilter","strapi","contentType","db","dialect","supportsOperator","$jsonSupersetOf","JSON","stringify","$contains","clampMaxWorkflows","clamp","MAX_WORKFLOWS","clampMaxStagesPerWorkflow","MAX_STAGES_PER_WORKFLOW"],"mappings":";;;;;AAQO,MAAMA,4BAA4BC,OAAAA,CAAK;;IAE5CC,SAAAA,CACE,CAACC,QACCC,QAAAA,CAAM,IAAA,EAAM,yCAAyCD,KAAAA,CAAAA,IACrD,CAACC,QAAAA,CAAM,KAAA,EAAO,0BAAA,EAA4BD,KAAAA,CAAAA,CAAAA;;AAG9CE,IAAAA;CACD;AAEM,MAAMC,oBAAoBC,MAAAA,CAAI;AAAC,IAAA,YAAA;AAAcC,IAAAA;CAAuB;MAE9DC,4BAAAA,GAA+B,CAC1C,EAAEC,MAAM,EAA2B,EACnCC,WAAAA,GAAAA;AAEA,IAAA,IAAID,OAAOE,EAAE,CAACC,OAAO,CAACC,gBAAgB,CAAC,iBAAA,CAAA,EAAoB;QACzD,OAAO;YAAEC,eAAAA,EAAiBC,IAAAA,CAAKC,SAAS,CAAC;AAACN,gBAAAA;AAAY,aAAA;AAAE,SAAA;AAC1D,IAAA;IACA,OAAO;AAAEO,QAAAA,SAAAA,EAAW,CAAC,CAAC,EAAEP,WAAAA,CAAY,CAAC;AAAE,KAAA;AACzC;AAEO,MAAMQ,iBAAAA,GAAoBC,QAAAA,CAAM,CAAA,EAAGC,uBAAAA;AACnC,MAAMC,yBAAAA,GAA4BF,QAAAA,CAAM,CAAA,EAAGG,iCAAAA;;;;;;;;"}
1
+ {"version":3,"file":"review-workflows.js","sources":["../../../server/src/utils/review-workflows.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\nimport { get, pickBy, has, clamp } from 'lodash';\nimport {\n ENTITY_STAGE_ATTRIBUTE,\n MAX_WORKFLOWS,\n MAX_STAGES_PER_WORKFLOW,\n} from '../constants/workflows';\n\n/** Returns the content types that can use review workflow stages. */\nexport const getVisibleContentTypesUID = (contentTypes: Core.Strapi['contentTypes']) =>\n Object.keys(\n pickBy(\n contentTypes,\n (value) =>\n get(value, 'pluginOptions.content-manager.visible', true) &&\n !get(value, 'options.noStageAttribute', false)\n )\n ) as Array<keyof Core.Strapi['contentTypes']>;\n\n/** Checks whether a content type stores a review workflow stage. */\nexport const hasStageAttribute = (contentType: unknown) =>\n has(contentType, ['attributes', ENTITY_STAGE_ATTRIBUTE]);\n\nexport const getWorkflowContentTypeFilter = (\n { strapi }: { strapi: Core.Strapi },\n contentType: any\n) => {\n if (strapi.db.dialect.supportsOperator('$jsonSupersetOf')) {\n return { $jsonSupersetOf: JSON.stringify([contentType]) };\n }\n return { $contains: `\"${contentType}\"` };\n};\n\n/** Constrains the workflow limit to the supported range. */\nexport const clampMaxWorkflows = (value: number) => clamp(value, 1, MAX_WORKFLOWS);\n/** Constrains the stage limit to the supported range. */\nexport const clampMaxStagesPerWorkflow = (value: number) =>\n clamp(value, 1, MAX_STAGES_PER_WORKFLOW);\n\nexport default {\n clampMaxWorkflows,\n clampMaxStagesPerWorkflow,\n getVisibleContentTypesUID,\n hasStageAttribute,\n getWorkflowContentTypeFilter,\n};\n"],"names":["getVisibleContentTypesUID","contentTypes","Object","keys","pickBy","value","get","hasStageAttribute","contentType","has","ENTITY_STAGE_ATTRIBUTE","getWorkflowContentTypeFilter","strapi","db","dialect","supportsOperator","$jsonSupersetOf","JSON","stringify","$contains","clampMaxWorkflows","clamp","MAX_WORKFLOWS","clampMaxStagesPerWorkflow","MAX_STAGES_PER_WORKFLOW"],"mappings":";;;;;AAQA,sEACO,MAAMA,yBAAAA,GAA4B,CAACC,YAAAA,GACxCC,MAAAA,CAAOC,IAAI,CACTC,aAAAA,CACEH,cACA,CAACI,KAAAA,GACCC,WAAID,KAAAA,EAAO,uCAAA,EAAyC,SACpD,CAACC,UAAAA,CAAID,KAAAA,EAAO,0BAAA,EAA4B,KAAA,CAAA,CAAA;AAIhD,qEACO,MAAME,oBAAoB,CAACC,WAAAA,GAChCC,WAAID,WAAAA,EAAa;AAAC,QAAA,YAAA;AAAcE,QAAAA;KAAuB;MAE5CC,4BAAAA,GAA+B,CAC1C,EAAEC,MAAM,EAA2B,EACnCJ,WAAAA,GAAAA;AAEA,IAAA,IAAII,OAAOC,EAAE,CAACC,OAAO,CAACC,gBAAgB,CAAC,iBAAA,CAAA,EAAoB;QACzD,OAAO;YAAEC,eAAAA,EAAiBC,IAAAA,CAAKC,SAAS,CAAC;AAACV,gBAAAA;AAAY,aAAA;AAAE,SAAA;AAC1D,IAAA;IACA,OAAO;AAAEW,QAAAA,SAAAA,EAAW,CAAC,CAAC,EAAEX,WAAAA,CAAY,CAAC;AAAE,KAAA;AACzC;AAEA,6DACO,MAAMY,iBAAAA,GAAoB,CAACf,KAAAA,GAAkBgB,YAAAA,CAAMhB,KAAAA,EAAO,CAAA,EAAGiB,uBAAAA;AACpE,0DACO,MAAMC,yBAAAA,GAA4B,CAAClB,KAAAA,GACxCgB,YAAAA,CAAMhB,KAAAA,EAAO,CAAA,EAAGmB,iCAAAA;;;;;;;;"}
@@ -1,16 +1,11 @@
1
- import { pipe, keys, pickBy, getOr, has, clamp } from 'lodash/fp';
1
+ import { has, clamp, pickBy, get } from 'lodash';
2
2
  import { ENTITY_STAGE_ATTRIBUTE, MAX_WORKFLOWS, MAX_STAGES_PER_WORKFLOW } from '../constants/workflows.mjs';
3
3
 
4
- const getVisibleContentTypesUID = pipe([
5
- // Pick only content-types visible in the content-manager and option is not false
6
- pickBy((value)=>getOr(true, 'pluginOptions.content-manager.visible', value) && !getOr(false, 'options.noStageAttribute', value)),
7
- // Get UIDs
8
- keys
9
- ]);
10
- const hasStageAttribute = has([
11
- 'attributes',
12
- ENTITY_STAGE_ATTRIBUTE
13
- ]);
4
+ /** Returns the content types that can use review workflow stages. */ const getVisibleContentTypesUID = (contentTypes)=>Object.keys(pickBy(contentTypes, (value)=>get(value, 'pluginOptions.content-manager.visible', true) && !get(value, 'options.noStageAttribute', false)));
5
+ /** Checks whether a content type stores a review workflow stage. */ const hasStageAttribute = (contentType)=>has(contentType, [
6
+ 'attributes',
7
+ ENTITY_STAGE_ATTRIBUTE
8
+ ]);
14
9
  const getWorkflowContentTypeFilter = ({ strapi }, contentType)=>{
15
10
  if (strapi.db.dialect.supportsOperator('$jsonSupersetOf')) {
16
11
  return {
@@ -23,8 +18,8 @@ const getWorkflowContentTypeFilter = ({ strapi }, contentType)=>{
23
18
  $contains: `"${contentType}"`
24
19
  };
25
20
  };
26
- const clampMaxWorkflows = clamp(1, MAX_WORKFLOWS);
27
- const clampMaxStagesPerWorkflow = clamp(1, MAX_STAGES_PER_WORKFLOW);
21
+ /** Constrains the workflow limit to the supported range. */ const clampMaxWorkflows = (value)=>clamp(value, 1, MAX_WORKFLOWS);
22
+ /** Constrains the stage limit to the supported range. */ const clampMaxStagesPerWorkflow = (value)=>clamp(value, 1, MAX_STAGES_PER_WORKFLOW);
28
23
 
29
24
  export { clampMaxStagesPerWorkflow, clampMaxWorkflows, getVisibleContentTypesUID, getWorkflowContentTypeFilter, hasStageAttribute };
30
25
  //# sourceMappingURL=review-workflows.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"review-workflows.mjs","sources":["../../../server/src/utils/review-workflows.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\nimport { getOr, keys, pickBy, pipe, has, clamp } from 'lodash/fp';\nimport {\n ENTITY_STAGE_ATTRIBUTE,\n MAX_WORKFLOWS,\n MAX_STAGES_PER_WORKFLOW,\n} from '../constants/workflows';\n\nexport const getVisibleContentTypesUID = pipe([\n // Pick only content-types visible in the content-manager and option is not false\n pickBy(\n (value) =>\n getOr(true, 'pluginOptions.content-manager.visible', value) &&\n !getOr(false, 'options.noStageAttribute', value)\n ),\n // Get UIDs\n keys,\n]);\n\nexport const hasStageAttribute = has(['attributes', ENTITY_STAGE_ATTRIBUTE]);\n\nexport const getWorkflowContentTypeFilter = (\n { strapi }: { strapi: Core.Strapi },\n contentType: any\n) => {\n if (strapi.db.dialect.supportsOperator('$jsonSupersetOf')) {\n return { $jsonSupersetOf: JSON.stringify([contentType]) };\n }\n return { $contains: `\"${contentType}\"` };\n};\n\nexport const clampMaxWorkflows = clamp(1, MAX_WORKFLOWS);\nexport const clampMaxStagesPerWorkflow = clamp(1, MAX_STAGES_PER_WORKFLOW);\n\nexport default {\n clampMaxWorkflows,\n clampMaxStagesPerWorkflow,\n getVisibleContentTypesUID,\n hasStageAttribute,\n getWorkflowContentTypeFilter,\n};\n"],"names":["getVisibleContentTypesUID","pipe","pickBy","value","getOr","keys","hasStageAttribute","has","ENTITY_STAGE_ATTRIBUTE","getWorkflowContentTypeFilter","strapi","contentType","db","dialect","supportsOperator","$jsonSupersetOf","JSON","stringify","$contains","clampMaxWorkflows","clamp","MAX_WORKFLOWS","clampMaxStagesPerWorkflow","MAX_STAGES_PER_WORKFLOW"],"mappings":";;;AAQO,MAAMA,4BAA4BC,IAAAA,CAAK;;IAE5CC,MAAAA,CACE,CAACC,QACCC,KAAAA,CAAM,IAAA,EAAM,yCAAyCD,KAAAA,CAAAA,IACrD,CAACC,KAAAA,CAAM,KAAA,EAAO,0BAAA,EAA4BD,KAAAA,CAAAA,CAAAA;;AAG9CE,IAAAA;CACD;AAEM,MAAMC,oBAAoBC,GAAAA,CAAI;AAAC,IAAA,YAAA;AAAcC,IAAAA;CAAuB;MAE9DC,4BAAAA,GAA+B,CAC1C,EAAEC,MAAM,EAA2B,EACnCC,WAAAA,GAAAA;AAEA,IAAA,IAAID,OAAOE,EAAE,CAACC,OAAO,CAACC,gBAAgB,CAAC,iBAAA,CAAA,EAAoB;QACzD,OAAO;YAAEC,eAAAA,EAAiBC,IAAAA,CAAKC,SAAS,CAAC;AAACN,gBAAAA;AAAY,aAAA;AAAE,SAAA;AAC1D,IAAA;IACA,OAAO;AAAEO,QAAAA,SAAAA,EAAW,CAAC,CAAC,EAAEP,WAAAA,CAAY,CAAC;AAAE,KAAA;AACzC;AAEO,MAAMQ,iBAAAA,GAAoBC,KAAAA,CAAM,CAAA,EAAGC,aAAAA;AACnC,MAAMC,yBAAAA,GAA4BF,KAAAA,CAAM,CAAA,EAAGG,uBAAAA;;;;"}
1
+ {"version":3,"file":"review-workflows.mjs","sources":["../../../server/src/utils/review-workflows.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\nimport { get, pickBy, has, clamp } from 'lodash';\nimport {\n ENTITY_STAGE_ATTRIBUTE,\n MAX_WORKFLOWS,\n MAX_STAGES_PER_WORKFLOW,\n} from '../constants/workflows';\n\n/** Returns the content types that can use review workflow stages. */\nexport const getVisibleContentTypesUID = (contentTypes: Core.Strapi['contentTypes']) =>\n Object.keys(\n pickBy(\n contentTypes,\n (value) =>\n get(value, 'pluginOptions.content-manager.visible', true) &&\n !get(value, 'options.noStageAttribute', false)\n )\n ) as Array<keyof Core.Strapi['contentTypes']>;\n\n/** Checks whether a content type stores a review workflow stage. */\nexport const hasStageAttribute = (contentType: unknown) =>\n has(contentType, ['attributes', ENTITY_STAGE_ATTRIBUTE]);\n\nexport const getWorkflowContentTypeFilter = (\n { strapi }: { strapi: Core.Strapi },\n contentType: any\n) => {\n if (strapi.db.dialect.supportsOperator('$jsonSupersetOf')) {\n return { $jsonSupersetOf: JSON.stringify([contentType]) };\n }\n return { $contains: `\"${contentType}\"` };\n};\n\n/** Constrains the workflow limit to the supported range. */\nexport const clampMaxWorkflows = (value: number) => clamp(value, 1, MAX_WORKFLOWS);\n/** Constrains the stage limit to the supported range. */\nexport const clampMaxStagesPerWorkflow = (value: number) =>\n clamp(value, 1, MAX_STAGES_PER_WORKFLOW);\n\nexport default {\n clampMaxWorkflows,\n clampMaxStagesPerWorkflow,\n getVisibleContentTypesUID,\n hasStageAttribute,\n getWorkflowContentTypeFilter,\n};\n"],"names":["getVisibleContentTypesUID","contentTypes","Object","keys","pickBy","value","get","hasStageAttribute","contentType","has","ENTITY_STAGE_ATTRIBUTE","getWorkflowContentTypeFilter","strapi","db","dialect","supportsOperator","$jsonSupersetOf","JSON","stringify","$contains","clampMaxWorkflows","clamp","MAX_WORKFLOWS","clampMaxStagesPerWorkflow","MAX_STAGES_PER_WORKFLOW"],"mappings":";;;AAQA,sEACO,MAAMA,yBAAAA,GAA4B,CAACC,YAAAA,GACxCC,MAAAA,CAAOC,IAAI,CACTC,MAAAA,CACEH,cACA,CAACI,KAAAA,GACCC,IAAID,KAAAA,EAAO,uCAAA,EAAyC,SACpD,CAACC,GAAAA,CAAID,KAAAA,EAAO,0BAAA,EAA4B,KAAA,CAAA,CAAA;AAIhD,qEACO,MAAME,oBAAoB,CAACC,WAAAA,GAChCC,IAAID,WAAAA,EAAa;AAAC,QAAA,YAAA;AAAcE,QAAAA;KAAuB;MAE5CC,4BAAAA,GAA+B,CAC1C,EAAEC,MAAM,EAA2B,EACnCJ,WAAAA,GAAAA;AAEA,IAAA,IAAII,OAAOC,EAAE,CAACC,OAAO,CAACC,gBAAgB,CAAC,iBAAA,CAAA,EAAoB;QACzD,OAAO;YAAEC,eAAAA,EAAiBC,IAAAA,CAAKC,SAAS,CAAC;AAACV,gBAAAA;AAAY,aAAA;AAAE,SAAA;AAC1D,IAAA;IACA,OAAO;AAAEW,QAAAA,SAAAA,EAAW,CAAC,CAAC,EAAEX,WAAAA,CAAY,CAAC;AAAE,KAAA;AACzC;AAEA,6DACO,MAAMY,iBAAAA,GAAoB,CAACf,KAAAA,GAAkBgB,KAAAA,CAAMhB,KAAAA,EAAO,CAAA,EAAGiB,aAAAA;AACpE,0DACO,MAAMC,yBAAAA,GAA4B,CAAClB,KAAAA,GACxCgB,KAAAA,CAAMhB,KAAAA,EAAO,CAAA,EAAGmB,uBAAAA;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/review-workflows",
3
- "version": "5.56.0",
3
+ "version": "5.57.0",
4
4
  "description": "Review workflows for your content",
5
5
  "homepage": "https://strapi.io",
6
6
  "bugs": {
@@ -64,7 +64,7 @@
64
64
  "@reduxjs/toolkit": "1.9.7",
65
65
  "@strapi/design-system": "2.2.4",
66
66
  "@strapi/icons": "2.2.4",
67
- "@strapi/utils": "5.56.0",
67
+ "@strapi/utils": "5.57.0",
68
68
  "date-fns": "2.30.0",
69
69
  "fractional-indexing": "3.2.0",
70
70
  "koa": "2.16.4",
@@ -78,9 +78,9 @@
78
78
  "yup": "0.32.9"
79
79
  },
80
80
  "devDependencies": {
81
- "@strapi/admin": "5.56.0",
82
- "@strapi/content-manager": "5.56.0",
83
- "@strapi/types": "5.56.0",
81
+ "@strapi/admin": "5.57.0",
82
+ "@strapi/content-manager": "5.57.0",
83
+ "@strapi/types": "5.57.0",
84
84
  "@testing-library/dom": "10.4.1",
85
85
  "@testing-library/jest-dom": "6.9.1",
86
86
  "@testing-library/react": "16.3.2",