@strapi/review-workflows 5.50.0 → 5.50.2

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 (87) hide show
  1. package/dist/admin/index.js +1 -0
  2. package/dist/admin/index.js.map +1 -1
  3. package/dist/admin/index.mjs +1 -0
  4. package/dist/admin/index.mjs.map +1 -1
  5. package/dist/admin/routes/content-manager/model/components/AssigneeFilter.js +1 -1
  6. package/dist/admin/routes/content-manager/model/components/AssigneeFilter.js.map +1 -1
  7. package/dist/admin/routes/content-manager/model/components/AssigneeFilter.mjs +1 -1
  8. package/dist/admin/routes/content-manager/model/components/AssigneeFilter.mjs.map +1 -1
  9. package/dist/admin/routes/content-manager/model/components/StageFilter.js.map +1 -1
  10. package/dist/admin/routes/content-manager/model/components/StageFilter.mjs.map +1 -1
  11. package/dist/admin/routes/settings/components/Stages.js +4 -3
  12. package/dist/admin/routes/settings/components/Stages.js.map +1 -1
  13. package/dist/admin/routes/settings/components/Stages.mjs +4 -3
  14. package/dist/admin/routes/settings/components/Stages.mjs.map +1 -1
  15. package/dist/admin/routes/settings/components/WorkflowAttributes.js +2 -2
  16. package/dist/admin/routes/settings/components/WorkflowAttributes.js.map +1 -1
  17. package/dist/admin/routes/settings/components/WorkflowAttributes.mjs +2 -2
  18. package/dist/admin/routes/settings/components/WorkflowAttributes.mjs.map +1 -1
  19. package/dist/admin/src/routes/content-manager/model/constants.d.ts +2 -2
  20. package/dist/admin/src/routes/settings/components/Stages.d.ts +1 -1
  21. package/dist/admin/src/services/admin.d.ts +1 -1
  22. package/dist/admin/src/services/api.d.ts +1 -1
  23. package/dist/admin/src/services/content-manager.d.ts +8 -8
  24. package/dist/admin/src/services/settings.d.ts +1392 -1392
  25. package/dist/admin/src/utils/api.d.ts +2 -2
  26. package/dist/admin/src/utils/cm-hooks.d.ts +2 -2
  27. package/dist/admin/translations/ko.json.js +41 -0
  28. package/dist/admin/translations/ko.json.js.map +1 -0
  29. package/dist/admin/translations/ko.json.mjs +39 -0
  30. package/dist/admin/translations/ko.json.mjs.map +1 -0
  31. package/dist/admin/translations/pl.json.js +34 -1
  32. package/dist/admin/translations/pl.json.js.map +1 -1
  33. package/dist/admin/translations/pl.json.mjs +34 -1
  34. package/dist/admin/translations/pl.json.mjs.map +1 -1
  35. package/dist/admin/utils/api.js.map +1 -1
  36. package/dist/admin/utils/api.mjs.map +1 -1
  37. package/dist/server/bootstrap.js +4 -4
  38. package/dist/server/bootstrap.js.map +1 -1
  39. package/dist/server/bootstrap.mjs +4 -4
  40. package/dist/server/bootstrap.mjs.map +1 -1
  41. package/dist/server/constants/workflows.js +1 -1
  42. package/dist/server/constants/workflows.js.map +1 -1
  43. package/dist/server/constants/workflows.mjs +1 -1
  44. package/dist/server/constants/workflows.mjs.map +1 -1
  45. package/dist/server/controllers/stages.js.map +1 -1
  46. package/dist/server/controllers/stages.mjs.map +1 -1
  47. package/dist/server/controllers/workflows.js.map +1 -1
  48. package/dist/server/controllers/workflows.mjs.map +1 -1
  49. package/dist/server/destroy.js +1 -1
  50. package/dist/server/destroy.js.map +1 -1
  51. package/dist/server/destroy.mjs +1 -1
  52. package/dist/server/destroy.mjs.map +1 -1
  53. package/dist/server/register.js +0 -2
  54. package/dist/server/register.js.map +1 -1
  55. package/dist/server/register.mjs +0 -2
  56. package/dist/server/register.mjs.map +1 -1
  57. package/dist/server/services/assignees.js.map +1 -1
  58. package/dist/server/services/assignees.mjs.map +1 -1
  59. package/dist/server/services/document-service-middleware.js +3 -3
  60. package/dist/server/services/document-service-middleware.js.map +1 -1
  61. package/dist/server/services/document-service-middleware.mjs +3 -3
  62. package/dist/server/services/document-service-middleware.mjs.map +1 -1
  63. package/dist/server/services/stages.js.map +1 -1
  64. package/dist/server/services/stages.mjs.map +1 -1
  65. package/dist/server/src/bootstrap.d.ts +4 -1
  66. package/dist/server/src/bootstrap.d.ts.map +1 -1
  67. package/dist/server/src/constants/workflows.d.ts +1 -1
  68. package/dist/server/src/destroy.d.ts +1 -4
  69. package/dist/server/src/destroy.d.ts.map +1 -1
  70. package/dist/server/src/homepage/index.d.ts +3 -3
  71. package/dist/server/src/homepage/routes/index.d.ts +1 -1
  72. package/dist/server/src/homepage/services/index.d.ts +1 -1
  73. package/dist/server/src/index.d.ts +18 -18
  74. package/dist/server/src/register.d.ts.map +1 -1
  75. package/dist/server/src/routes/index.d.ts +1 -1
  76. package/dist/server/src/services/assignees.d.ts +2 -2
  77. package/dist/server/src/services/assignees.d.ts.map +1 -1
  78. package/dist/server/src/services/index.d.ts +13 -13
  79. package/dist/server/src/services/stages.d.ts +1 -1
  80. package/dist/server/src/services/stages.d.ts.map +1 -1
  81. package/package.json +20 -9
  82. package/dist/server/migrations/shorten-stage-attribute.js +0 -49
  83. package/dist/server/migrations/shorten-stage-attribute.js.map +0 -1
  84. package/dist/server/migrations/shorten-stage-attribute.mjs +0 -43
  85. package/dist/server/migrations/shorten-stage-attribute.mjs.map +0 -1
  86. package/dist/server/src/migrations/shorten-stage-attribute.d.ts +0 -6
  87. package/dist/server/src/migrations/shorten-stage-attribute.d.ts.map +0 -1
@@ -1,11 +1,11 @@
1
1
  declare const _default: {
2
2
  homepage: ({ strapi }: {
3
- strapi: import("@strapi/types/dist/core").Strapi;
3
+ strapi: import("@strapi/types/dist/core/strapi.js").Strapi;
4
4
  }) => {
5
5
  getRecentlyAssignedDocuments(): Promise<import("../../../shared/contracts/homepage").GetRecentlyAssignedDocuments.Response["data"]>;
6
6
  };
7
7
  workflows: ({ strapi }: {
8
- strapi: import("@strapi/types/dist/core").Strapi;
8
+ strapi: import("@strapi/types/dist/core/strapi.js").Strapi;
9
9
  }) => {
10
10
  find(opts?: any): Promise<any[]>;
11
11
  findById(id: any, opts?: {
@@ -23,7 +23,7 @@ declare const _default: {
23
23
  assertStageBelongsToWorkflow(stageId: any, workflow: any): void;
24
24
  };
25
25
  stages: ({ strapi }: {
26
- strapi: import("@strapi/types/dist/core").Strapi;
26
+ strapi: import("@strapi/types/dist/core/strapi.js").Strapi;
27
27
  }) => {
28
28
  find({ workflowId, populate }: any): Promise<any[]>;
29
29
  findById(id: string | number, { populate }?: any): Promise<any>;
@@ -39,12 +39,12 @@ declare const _default: {
39
39
  documentId: string;
40
40
  locale: string;
41
41
  updatedAt: string;
42
- }, model: import("@strapi/types/dist/uid").ContentType, stageId: any): Promise<import("@strapi/types/dist/modules/documents").AnyDocument | null>;
42
+ }, model: import("@strapi/types/dist/uid/index.js").ContentType, stageId: any): Promise<import("@strapi/types/dist/modules/documents/index.js").AnyDocument | null>;
43
43
  updateEntitiesStage(contentTypeUID: any, { fromStageId, toStageId }: any): Promise<number | number[]>;
44
44
  deleteAllEntitiesStage(contentTypeUID: any): Promise<number>;
45
45
  };
46
46
  'stage-permissions': ({ strapi }: {
47
- strapi: import("@strapi/types/dist/core").Strapi;
47
+ strapi: import("@strapi/types/dist/core/strapi.js").Strapi;
48
48
  }) => {
49
49
  register({ roleId, action, fromStage, }: {
50
50
  roleId: number;
@@ -83,18 +83,18 @@ declare const _default: {
83
83
  }): boolean;
84
84
  };
85
85
  assignees: ({ strapi }: {
86
- strapi: import("@strapi/types/dist/core").Strapi;
86
+ strapi: import("@strapi/types/dist/core/strapi.js").Strapi;
87
87
  }) => {
88
- findEntityAssigneeId(id: string | number, model: import("@strapi/types/dist/uid").ContentType): Promise<any>;
88
+ findEntityAssigneeId(id: string | number, model: import("@strapi/types/dist/uid/index.js").ContentType): Promise<any>;
89
89
  updateEntityAssignee(entityToUpdate: {
90
90
  id: number | string;
91
91
  documentId: string;
92
92
  locale: string;
93
93
  updatedAt: string;
94
- }, model: import("@strapi/types/dist/uid").ContentType, assigneeId: string | null): Promise<import("@strapi/types/dist/modules/documents").AnyDocument | null>;
94
+ }, model: import("@strapi/types/dist/uid/index.js").ContentType, assigneeId: string | null): Promise<import("@strapi/types/dist/modules/documents/index.js").AnyDocument | null>;
95
95
  };
96
96
  validation: ({ strapi }: {
97
- strapi: import("@strapi/types/dist/core").Strapi;
97
+ strapi: import("@strapi/types/dist/core/strapi.js").Strapi;
98
98
  }) => {
99
99
  limits: {
100
100
  numberOfWorkflows: number;
@@ -106,9 +106,9 @@ declare const _default: {
106
106
  validateWorkflowCount(countAddedWorkflows?: number): Promise<void>;
107
107
  };
108
108
  'document-service-middlewares': () => {
109
- assignStageOnCreate: import("@strapi/types/dist/modules/documents/middleware").Middleware;
110
- handleStageOnUpdate: import("@strapi/types/dist/modules/documents/middleware").Middleware;
111
- checkStageBeforePublish: import("@strapi/types/dist/modules/documents/middleware").Middleware;
109
+ assignStageOnCreate: import("@strapi/types/dist/modules/documents/middleware.js").Middleware;
110
+ handleStageOnUpdate: import("@strapi/types/dist/modules/documents/middleware.js").Middleware;
111
+ checkStageBeforePublish: import("@strapi/types/dist/modules/documents/middleware.js").Middleware;
112
112
  };
113
113
  'workflow-metrics': {
114
114
  sendDidCreateStage: () => Promise<void>;
@@ -121,7 +121,7 @@ declare const _default: {
121
121
  sendDidEditAssignee: (fromId: any, toId: any) => Promise<void>;
122
122
  };
123
123
  'workflow-weekly-metrics': ({ strapi }: {
124
- strapi: import("@strapi/types/dist/core").Strapi;
124
+ strapi: import("@strapi/types/dist/core/strapi.js").Strapi;
125
125
  }) => {
126
126
  computeMetrics(): Promise<{
127
127
  numberOfActiveWorkflows: number;
@@ -19,7 +19,7 @@ declare const _default: ({ strapi }: {
19
19
  documentId: string;
20
20
  locale: string;
21
21
  updatedAt: string;
22
- }, model: UID.ContentType, stageId: any): Promise<import("@strapi/types/dist/modules/documents").AnyDocument | null>;
22
+ }, model: UID.ContentType, stageId: any): Promise<import("@strapi/types/dist/modules/documents/index.js").AnyDocument | null>;
23
23
  /**
24
24
  * Updates entity stages of a content type:
25
25
  * - If fromStageId is undefined, all entities with an existing stage will be assigned the new stage
@@ -1 +1 @@
1
- {"version":3,"file":"stages.d.ts","sourceRoot":"","sources":["../../../../server/src/services/stages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;yBAkB/B,YAAY;IAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAA;CAAE;mCAMhB,GAAG;iBAOrB,MAAM,GAAG,MAAM,iBAAgB,GAAG;2BAOlB,GAAG,eAAc,GAAG;qBA2D1B,GAAG,aAAa,GAAG;kBAqEtB,GAAG;uBAaE,GAAG;mCAQS,GAAG;2BAKlB,GAAG;6BAYM,GAAG,cAAc,GAAG;IAkDnD;;OAEG;iCAEe;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,WACb,GAAG;IAoCd;;;;;;;;;;;;;OAaG;wCACuC,GAAG,8BAA8B,GAAG;IAwC9E;;;;OAIG;2CAC0C,GAAG;;AAtVpD,wBAgWE"}
1
+ {"version":3,"file":"stages.d.ts","sourceRoot":"","sources":["../../../../server/src/services/stages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;yBAiB/B,YAAY;IAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAA;CAAE;mCAMhB,GAAG;iBAOrB,MAAM,GAAG,MAAM,iBAAgB,GAAG;2BAOlB,GAAG,eAAc,GAAG;qBA2D1B,GAAG,aAAa,GAAG;kBAqEtB,GAAG;uBAaE,GAAG;mCAQS,GAAG;2BAKlB,GAAG;6BAYM,GAAG,cAAc,GAAG;IAkDnD;;OAEG;iCAEe;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,WACb,GAAG;IAoCd;;;;;;;;;;;;;OAaG;wCACuC,GAAG,8BAA8B,GAAG;IAwC9E;;;;OAIG;2CAC0C,GAAG;;AAtVpD,wBAgWE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/review-workflows",
3
- "version": "5.50.0",
3
+ "version": "5.50.2",
4
4
  "description": "Review workflows for your content",
5
5
  "homepage": "https://strapi.io",
6
6
  "bugs": {
@@ -52,9 +52,9 @@
52
52
  "build:types:server": "run -T tsc -p server/tsconfig.build.json --emitDeclarationOnly",
53
53
  "build:types:admin": "run -T tsc -p admin/tsconfig.build.json --emitDeclarationOnly",
54
54
  "clean": "run -T rimraf ./dist",
55
- "lint": "run -T eslint .",
55
+ "lint": "run -T eslint . --max-warnings=0",
56
56
  "test:front": "run -T cross-env IS_EE=true jest --config ./jest.config.front.js",
57
- "test:ts:back": "run -T tsc --noEmit -p server/tsconfig.json",
57
+ "test:ts:back": "run -T tsc -p server/tsconfig.json",
58
58
  "test:ts:front": "run -T tsc -p admin/tsconfig.json",
59
59
  "test:unit": "run -T jest",
60
60
  "test:unit:watch": "run -T jest --watch",
@@ -62,22 +62,32 @@
62
62
  },
63
63
  "dependencies": {
64
64
  "@reduxjs/toolkit": "1.9.7",
65
- "@strapi/design-system": "2.2.1",
66
- "@strapi/icons": "2.2.1",
67
- "@strapi/utils": "5.50.0",
65
+ "@strapi/design-system": "2.2.3",
66
+ "@strapi/icons": "2.2.3",
67
+ "@strapi/utils": "5.50.2",
68
+ "date-fns": "2.30.0",
68
69
  "fractional-indexing": "3.2.0",
70
+ "koa": "2.16.4",
71
+ "lodash": "4.18.1",
69
72
  "react-dnd": "16.0.1",
70
73
  "react-dnd-html5-backend": "16.0.1",
71
74
  "react-helmet": "^6.1.0",
72
75
  "react-intl": "6.6.2",
73
76
  "react-redux": "8.1.3",
77
+ "semver": "7.7.4",
74
78
  "yup": "0.32.9"
75
79
  },
76
80
  "devDependencies": {
77
- "@strapi/admin": "5.50.0",
78
- "@strapi/content-manager": "5.50.0",
79
- "@strapi/types": "5.50.0",
81
+ "@strapi/admin": "5.50.2",
82
+ "@strapi/content-manager": "5.50.2",
83
+ "@strapi/types": "5.50.2",
84
+ "@testing-library/dom": "10.4.1",
85
+ "@testing-library/jest-dom": "6.9.1",
80
86
  "@testing-library/react": "16.3.2",
87
+ "@types/jest": "29.5.2",
88
+ "@types/node": "20.19.41",
89
+ "jest": "29.6.0",
90
+ "koa-body": "6.0.1",
81
91
  "msw": "2.13.4",
82
92
  "react": "18.3.1",
83
93
  "react-dom": "18.3.1",
@@ -87,6 +97,7 @@
87
97
  "peerDependencies": {
88
98
  "@strapi/admin": "^5.0.0",
89
99
  "@strapi/content-manager": "^5.0.0",
100
+ "@strapi/types": "^5.0.0",
90
101
  "react": "^17.0.0 || ^18.0.0",
91
102
  "react-dom": "^17.0.0 || ^18.0.0",
92
103
  "react-router-dom": "^6.30.3",
@@ -1,49 +0,0 @@
1
- 'use strict';
2
-
3
- var semver = require('semver');
4
- var fp = require('lodash/fp');
5
- var workflows = require('../constants/workflows.js');
6
-
7
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
8
-
9
- var semver__default = /*#__PURE__*/_interopDefault(semver);
10
-
11
- function checkVersionThreshold(startVersion, currentVersion, thresholdVersion) {
12
- return semver__default.default.gte(currentVersion, thresholdVersion) && semver__default.default.lt(startVersion, thresholdVersion);
13
- }
14
- /**
15
- * Shorten strapi stage name
16
- */ async function migrateStageAttribute({ oldContentTypes, contentTypes }) {
17
- const getRWVersion = fp.getOr('0.0.0', `${workflows.STAGE_MODEL_UID}.options.version`);
18
- const oldRWVersion = getRWVersion(oldContentTypes);
19
- const currentRWVersion = getRWVersion(contentTypes);
20
- checkVersionThreshold(oldRWVersion, currentRWVersion, '1.1.0');
21
- // TODO: Find tables with something else than `findTables` function
22
- // if (migrationNeeded) {
23
- // const oldAttributeTableName = 'strapi_review_workflows_stage';
24
- // const newAttributeTableName = 'strapi_stage';
25
- // // const tables = await findTables({ strapi }, new RegExp(oldAttributeTableName));
26
- // await async.map(tables, async (tableName: string) => {
27
- // const newTableName = tableName.replace(oldAttributeTableName, newAttributeTableName);
28
- // const alreadyHasNextTable = await strapi.db.connection.schema.hasTable(newTableName);
29
- // // The table can be already created but empty. In order to rename the old one, we need to drop the previously created empty one.
30
- // if (alreadyHasNextTable) {
31
- // const dataInTable = await strapi.db.connection(newTableName).select().limit(1);
32
- // if (!dataInTable.length) {
33
- // await strapi.db.connection.schema.dropTable(newTableName);
34
- // }
35
- // }
36
- // try {
37
- // await strapi.db.connection.schema.renameTable(tableName, newTableName);
38
- // } catch (e: any) {
39
- // strapi.log.warn(
40
- // `An error occurred during the migration of ${tableName} table to ${newTableName}.\nIf ${newTableName} already exists, migration can't be done automatically.`
41
- // );
42
- // strapi.log.warn(e.message);
43
- // }
44
- // });
45
- // }
46
- }
47
-
48
- module.exports = migrateStageAttribute;
49
- //# sourceMappingURL=shorten-stage-attribute.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"shorten-stage-attribute.js","sources":["../../../server/src/migrations/shorten-stage-attribute.ts"],"sourcesContent":["import semver from 'semver';\nimport { getOr } from 'lodash/fp';\nimport { async } from '@strapi/utils';\nimport { STAGE_MODEL_UID } from '../constants/workflows';\n\nfunction checkVersionThreshold(\n startVersion: string,\n currentVersion: string,\n thresholdVersion: string\n) {\n return semver.gte(currentVersion, thresholdVersion) && semver.lt(startVersion, thresholdVersion);\n}\n\n/**\n * Shorten strapi stage name\n */\nasync function migrateStageAttribute({ oldContentTypes, contentTypes }: any) {\n const getRWVersion = getOr('0.0.0', `${STAGE_MODEL_UID}.options.version`);\n const oldRWVersion = getRWVersion(oldContentTypes);\n const currentRWVersion = getRWVersion(contentTypes);\n\n const migrationNeeded = checkVersionThreshold(oldRWVersion, currentRWVersion, '1.1.0');\n\n // TODO: Find tables with something else than `findTables` function\n // if (migrationNeeded) {\n // const oldAttributeTableName = 'strapi_review_workflows_stage';\n // const newAttributeTableName = 'strapi_stage';\n // // const tables = await findTables({ strapi }, new RegExp(oldAttributeTableName));\n\n // await async.map(tables, async (tableName: string) => {\n // const newTableName = tableName.replace(oldAttributeTableName, newAttributeTableName);\n // const alreadyHasNextTable = await strapi.db.connection.schema.hasTable(newTableName);\n\n // // The table can be already created but empty. In order to rename the old one, we need to drop the previously created empty one.\n // if (alreadyHasNextTable) {\n // const dataInTable = await strapi.db.connection(newTableName).select().limit(1);\n // if (!dataInTable.length) {\n // await strapi.db.connection.schema.dropTable(newTableName);\n // }\n // }\n\n // try {\n // await strapi.db.connection.schema.renameTable(tableName, newTableName);\n // } catch (e: any) {\n // strapi.log.warn(\n // `An error occurred during the migration of ${tableName} table to ${newTableName}.\\nIf ${newTableName} already exists, migration can't be done automatically.`\n // );\n // strapi.log.warn(e.message);\n // }\n // });\n // }\n}\n\nexport default migrateStageAttribute;\n"],"names":["checkVersionThreshold","startVersion","currentVersion","thresholdVersion","semver","gte","lt","migrateStageAttribute","oldContentTypes","contentTypes","getRWVersion","getOr","STAGE_MODEL_UID","oldRWVersion","currentRWVersion"],"mappings":";;;;;;;;;;AAKA,SAASA,qBAAAA,CACPC,YAAoB,EACpBC,cAAsB,EACtBC,gBAAwB,EAAA;IAExB,OAAOC,uBAAAA,CAAOC,GAAG,CAACH,cAAAA,EAAgBC,qBAAqBC,uBAAAA,CAAOE,EAAE,CAACL,YAAAA,EAAcE,gBAAAA,CAAAA;AACjF;AAEA;;AAEC,IACD,eAAeI,qBAAAA,CAAsB,EAAEC,eAAe,EAAEC,YAAY,EAAO,EAAA;AACzE,IAAA,MAAMC,eAAeC,QAAAA,CAAM,OAAA,EAAS,CAAA,EAAGC,yBAAAA,CAAgB,gBAAgB,CAAC,CAAA;AACxE,IAAA,MAAMC,eAAeH,YAAAA,CAAaF,eAAAA,CAAAA;AAClC,IAAA,MAAMM,mBAAmBJ,YAAAA,CAAaD,YAAAA,CAAAA;IAEdT,qBAAAA,CAAsBa,YAAAA,EAAcC,gBAAAA,EAAkB,OAAA;AAE9E;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF;;;;"}
@@ -1,43 +0,0 @@
1
- import semver from 'semver';
2
- import { getOr } from 'lodash/fp';
3
- import { STAGE_MODEL_UID } from '../constants/workflows.mjs';
4
-
5
- function checkVersionThreshold(startVersion, currentVersion, thresholdVersion) {
6
- return semver.gte(currentVersion, thresholdVersion) && semver.lt(startVersion, thresholdVersion);
7
- }
8
- /**
9
- * Shorten strapi stage name
10
- */ async function migrateStageAttribute({ oldContentTypes, contentTypes }) {
11
- const getRWVersion = getOr('0.0.0', `${STAGE_MODEL_UID}.options.version`);
12
- const oldRWVersion = getRWVersion(oldContentTypes);
13
- const currentRWVersion = getRWVersion(contentTypes);
14
- checkVersionThreshold(oldRWVersion, currentRWVersion, '1.1.0');
15
- // TODO: Find tables with something else than `findTables` function
16
- // if (migrationNeeded) {
17
- // const oldAttributeTableName = 'strapi_review_workflows_stage';
18
- // const newAttributeTableName = 'strapi_stage';
19
- // // const tables = await findTables({ strapi }, new RegExp(oldAttributeTableName));
20
- // await async.map(tables, async (tableName: string) => {
21
- // const newTableName = tableName.replace(oldAttributeTableName, newAttributeTableName);
22
- // const alreadyHasNextTable = await strapi.db.connection.schema.hasTable(newTableName);
23
- // // The table can be already created but empty. In order to rename the old one, we need to drop the previously created empty one.
24
- // if (alreadyHasNextTable) {
25
- // const dataInTable = await strapi.db.connection(newTableName).select().limit(1);
26
- // if (!dataInTable.length) {
27
- // await strapi.db.connection.schema.dropTable(newTableName);
28
- // }
29
- // }
30
- // try {
31
- // await strapi.db.connection.schema.renameTable(tableName, newTableName);
32
- // } catch (e: any) {
33
- // strapi.log.warn(
34
- // `An error occurred during the migration of ${tableName} table to ${newTableName}.\nIf ${newTableName} already exists, migration can't be done automatically.`
35
- // );
36
- // strapi.log.warn(e.message);
37
- // }
38
- // });
39
- // }
40
- }
41
-
42
- export { migrateStageAttribute as default };
43
- //# sourceMappingURL=shorten-stage-attribute.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"shorten-stage-attribute.mjs","sources":["../../../server/src/migrations/shorten-stage-attribute.ts"],"sourcesContent":["import semver from 'semver';\nimport { getOr } from 'lodash/fp';\nimport { async } from '@strapi/utils';\nimport { STAGE_MODEL_UID } from '../constants/workflows';\n\nfunction checkVersionThreshold(\n startVersion: string,\n currentVersion: string,\n thresholdVersion: string\n) {\n return semver.gte(currentVersion, thresholdVersion) && semver.lt(startVersion, thresholdVersion);\n}\n\n/**\n * Shorten strapi stage name\n */\nasync function migrateStageAttribute({ oldContentTypes, contentTypes }: any) {\n const getRWVersion = getOr('0.0.0', `${STAGE_MODEL_UID}.options.version`);\n const oldRWVersion = getRWVersion(oldContentTypes);\n const currentRWVersion = getRWVersion(contentTypes);\n\n const migrationNeeded = checkVersionThreshold(oldRWVersion, currentRWVersion, '1.1.0');\n\n // TODO: Find tables with something else than `findTables` function\n // if (migrationNeeded) {\n // const oldAttributeTableName = 'strapi_review_workflows_stage';\n // const newAttributeTableName = 'strapi_stage';\n // // const tables = await findTables({ strapi }, new RegExp(oldAttributeTableName));\n\n // await async.map(tables, async (tableName: string) => {\n // const newTableName = tableName.replace(oldAttributeTableName, newAttributeTableName);\n // const alreadyHasNextTable = await strapi.db.connection.schema.hasTable(newTableName);\n\n // // The table can be already created but empty. In order to rename the old one, we need to drop the previously created empty one.\n // if (alreadyHasNextTable) {\n // const dataInTable = await strapi.db.connection(newTableName).select().limit(1);\n // if (!dataInTable.length) {\n // await strapi.db.connection.schema.dropTable(newTableName);\n // }\n // }\n\n // try {\n // await strapi.db.connection.schema.renameTable(tableName, newTableName);\n // } catch (e: any) {\n // strapi.log.warn(\n // `An error occurred during the migration of ${tableName} table to ${newTableName}.\\nIf ${newTableName} already exists, migration can't be done automatically.`\n // );\n // strapi.log.warn(e.message);\n // }\n // });\n // }\n}\n\nexport default migrateStageAttribute;\n"],"names":["checkVersionThreshold","startVersion","currentVersion","thresholdVersion","semver","gte","lt","migrateStageAttribute","oldContentTypes","contentTypes","getRWVersion","getOr","STAGE_MODEL_UID","oldRWVersion","currentRWVersion"],"mappings":";;;;AAKA,SAASA,qBAAAA,CACPC,YAAoB,EACpBC,cAAsB,EACtBC,gBAAwB,EAAA;IAExB,OAAOC,MAAAA,CAAOC,GAAG,CAACH,cAAAA,EAAgBC,qBAAqBC,MAAAA,CAAOE,EAAE,CAACL,YAAAA,EAAcE,gBAAAA,CAAAA;AACjF;AAEA;;AAEC,IACD,eAAeI,qBAAAA,CAAsB,EAAEC,eAAe,EAAEC,YAAY,EAAO,EAAA;AACzE,IAAA,MAAMC,eAAeC,KAAAA,CAAM,OAAA,EAAS,CAAA,EAAGC,eAAAA,CAAgB,gBAAgB,CAAC,CAAA;AACxE,IAAA,MAAMC,eAAeH,YAAAA,CAAaF,eAAAA,CAAAA;AAClC,IAAA,MAAMM,mBAAmBJ,YAAAA,CAAaD,YAAAA,CAAAA;IAEdT,qBAAAA,CAAsBa,YAAAA,EAAcC,gBAAAA,EAAkB,OAAA;AAE9E;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF;;;;"}
@@ -1,6 +0,0 @@
1
- /**
2
- * Shorten strapi stage name
3
- */
4
- declare function migrateStageAttribute({ oldContentTypes, contentTypes }: any): Promise<void>;
5
- export default migrateStageAttribute;
6
- //# sourceMappingURL=shorten-stage-attribute.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"shorten-stage-attribute.d.ts","sourceRoot":"","sources":["../../../../server/src/migrations/shorten-stage-attribute.ts"],"names":[],"mappings":"AAaA;;GAEG;AACH,iBAAe,qBAAqB,CAAC,EAAE,eAAe,EAAE,YAAY,EAAE,EAAE,GAAG,iBAmC1E;AAED,eAAe,qBAAqB,CAAC"}