@strapi/core 5.50.1 → 5.51.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 (71) hide show
  1. package/dist/compile.d.ts +1 -1
  2. package/dist/core-api/routes/validation/common.d.ts +3 -3
  3. package/dist/core-api/routes/validation/common.d.ts.map +1 -1
  4. package/dist/core-api/service/collection-type.d.ts +2 -2
  5. package/dist/core-api/service/single-type.d.ts +2 -2
  6. package/dist/domain/content-type/index.d.ts +1 -1
  7. package/dist/domain/content-type/index.d.ts.map +1 -1
  8. package/dist/domain/content-type/index.js +9 -0
  9. package/dist/domain/content-type/index.js.map +1 -1
  10. package/dist/domain/content-type/index.mjs +9 -0
  11. package/dist/domain/content-type/index.mjs.map +1 -1
  12. package/dist/domain/content-type/validator.d.ts.map +1 -1
  13. package/dist/domain/content-type/validator.js.map +1 -1
  14. package/dist/domain/content-type/validator.mjs.map +1 -1
  15. package/dist/ee/index.js.map +1 -1
  16. package/dist/ee/index.mjs.map +1 -1
  17. package/dist/ee/license.d.ts +1 -1
  18. package/dist/ee/license.d.ts.map +1 -1
  19. package/dist/ee/license.js +51 -8
  20. package/dist/ee/license.js.map +1 -1
  21. package/dist/ee/license.mjs +32 -8
  22. package/dist/ee/license.mjs.map +1 -1
  23. package/dist/migrations/database/5.0.0-discard-drafts.d.ts.map +1 -1
  24. package/dist/migrations/database/5.0.0-discard-drafts.js +77 -7
  25. package/dist/migrations/database/5.0.0-discard-drafts.js.map +1 -1
  26. package/dist/migrations/database/5.0.0-discard-drafts.mjs +77 -7
  27. package/dist/migrations/database/5.0.0-discard-drafts.mjs.map +1 -1
  28. package/dist/package.json.js +18 -16
  29. package/dist/package.json.js.map +1 -1
  30. package/dist/package.json.mjs +18 -16
  31. package/dist/package.json.mjs.map +1 -1
  32. package/dist/services/document-service/attributes/index.d.ts +1 -1
  33. package/dist/services/document-service/attributes/index.d.ts.map +1 -1
  34. package/dist/services/document-service/components.d.ts +2 -2
  35. package/dist/services/document-service/components.d.ts.map +1 -1
  36. package/dist/services/document-service/first-published-at.d.ts.map +1 -1
  37. package/dist/services/document-service/first-published-at.js +9 -2
  38. package/dist/services/document-service/first-published-at.js.map +1 -1
  39. package/dist/services/document-service/first-published-at.mjs +9 -2
  40. package/dist/services/document-service/first-published-at.mjs.map +1 -1
  41. package/dist/services/document-service/repository.d.ts.map +1 -1
  42. package/dist/services/document-service/repository.js +31 -11
  43. package/dist/services/document-service/repository.js.map +1 -1
  44. package/dist/services/document-service/repository.mjs +30 -10
  45. package/dist/services/document-service/repository.mjs.map +1 -1
  46. package/dist/services/document-service/utils/clone-relations.d.ts +7 -0
  47. package/dist/services/document-service/utils/clone-relations.d.ts.map +1 -0
  48. package/dist/services/document-service/utils/clone-relations.js +124 -0
  49. package/dist/services/document-service/utils/clone-relations.js.map +1 -0
  50. package/dist/services/document-service/utils/clone-relations.mjs +121 -0
  51. package/dist/services/document-service/utils/clone-relations.mjs.map +1 -0
  52. package/dist/services/entity-validator/validators.d.ts.map +1 -1
  53. package/dist/services/entity-validator/validators.js +6 -0
  54. package/dist/services/entity-validator/validators.js.map +1 -1
  55. package/dist/services/entity-validator/validators.mjs +6 -0
  56. package/dist/services/entity-validator/validators.mjs.map +1 -1
  57. package/dist/services/mcp/tools/log.d.ts +2 -2
  58. package/dist/services/mcp/tools/log.d.ts.map +1 -1
  59. package/dist/utils/fetch.d.ts +1 -1
  60. package/dist/utils/fetch.d.ts.map +1 -1
  61. package/dist/utils/fetch.js +2 -2
  62. package/dist/utils/fetch.js.map +1 -1
  63. package/dist/utils/fetch.mjs +2 -2
  64. package/dist/utils/fetch.mjs.map +1 -1
  65. package/dist/utils/startup-logger.d.ts.map +1 -1
  66. package/dist/utils/startup-logger.js +8 -2
  67. package/dist/utils/startup-logger.js.map +1 -1
  68. package/dist/utils/startup-logger.mjs +8 -2
  69. package/dist/utils/startup-logger.mjs.map +1 -1
  70. package/dist/utils/transform-content-types-to-models.d.ts +9 -9
  71. package/package.json +18 -16
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var name = "@strapi/core";
6
- var version = "5.50.1";
6
+ var version = "5.51.0";
7
7
  var description = "Core of Strapi";
8
8
  var homepage = "https://strapi.io";
9
9
  var bugs = {
@@ -51,8 +51,9 @@ var scripts = {
51
51
  "build:types": "run -T tsc -p tsconfig.build.json --emitDeclarationOnly",
52
52
  watch: "run -T rollup -c -w",
53
53
  clean: "run -T rimraf ./dist",
54
- lint: "run -T eslint .",
54
+ lint: "run -T eslint . --max-warnings=0",
55
55
  prepublishOnly: "yarn clean && yarn build",
56
+ "test:ts": "run -T tsc -p tsconfig.json",
56
57
  "test:unit": "run -T jest",
57
58
  "test:unit:watch": "run -T jest --watch",
58
59
  "test:unit:vitest": "vitest run",
@@ -64,15 +65,15 @@ var dependencies = {
64
65
  "@koa/router": "12.0.2",
65
66
  "@modelcontextprotocol/sdk": "1.29.0",
66
67
  "@paralleldrive/cuid2": "2.2.2",
67
- "@strapi/admin": "5.50.1",
68
- "@strapi/database": "5.50.1",
69
- "@strapi/generators": "5.50.1",
70
- "@strapi/logger": "5.50.1",
71
- "@strapi/openapi": "5.50.1",
72
- "@strapi/permissions": "5.50.1",
73
- "@strapi/types": "5.50.1",
74
- "@strapi/typescript-utils": "5.50.1",
75
- "@strapi/utils": "5.50.1",
68
+ "@strapi/admin": "5.51.0",
69
+ "@strapi/database": "5.51.0",
70
+ "@strapi/generators": "5.51.0",
71
+ "@strapi/logger": "5.51.0",
72
+ "@strapi/openapi": "5.51.0",
73
+ "@strapi/permissions": "5.51.0",
74
+ "@strapi/types": "5.51.0",
75
+ "@strapi/typescript-utils": "5.51.0",
76
+ "@strapi/utils": "5.51.0",
76
77
  "@vercel/stega": "0.1.2",
77
78
  bcryptjs: "2.4.3",
78
79
  boxen: "5.1.2",
@@ -93,7 +94,7 @@ var dependencies = {
93
94
  inquirer: "9.3.8",
94
95
  "is-docker": "2.2.1",
95
96
  "json-logic-js": "2.0.5",
96
- jsonwebtoken: "9.0.0",
97
+ jsonwebtoken: "9.0.3",
97
98
  koa: "2.16.4",
98
99
  "koa-body": "6.0.1",
99
100
  "koa-compose": "4.1.0",
@@ -116,7 +117,7 @@ var dependencies = {
116
117
  typescript: "5.9.3",
117
118
  undici: "6.27.0",
118
119
  yup: "0.32.9",
119
- zod: "3.25.67"
120
+ zod: "3.25.76"
120
121
  };
121
122
  var devDependencies = {
122
123
  "@swc/core": "1.13.5",
@@ -136,11 +137,12 @@ var devDependencies = {
136
137
  "@types/mime-types": "2.1.1",
137
138
  "@types/node": "20.19.41",
138
139
  "@types/node-schedule": "2.1.7",
139
- "eslint-config-custom": "5.50.1",
140
+ "eslint-config-custom": "5.51.0",
141
+ jest: "29.6.0",
140
142
  supertest: "7.2.2",
141
- tsconfig: "5.50.1",
143
+ tsconfig: "5.51.0",
142
144
  vitest: "catalog:",
143
- "vitest-config": "5.50.1"
145
+ "vitest-config": "5.51.0"
144
146
  };
145
147
  var engines = {
146
148
  node: ">=20.0.0 <=26.x.x",
@@ -1 +1 @@
1
- {"version":3,"file":"package.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"package.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,5 +1,5 @@
1
1
  var name = "@strapi/core";
2
- var version = "5.50.1";
2
+ var version = "5.51.0";
3
3
  var description = "Core of Strapi";
4
4
  var homepage = "https://strapi.io";
5
5
  var bugs = {
@@ -47,8 +47,9 @@ var scripts = {
47
47
  "build:types": "run -T tsc -p tsconfig.build.json --emitDeclarationOnly",
48
48
  watch: "run -T rollup -c -w",
49
49
  clean: "run -T rimraf ./dist",
50
- lint: "run -T eslint .",
50
+ lint: "run -T eslint . --max-warnings=0",
51
51
  prepublishOnly: "yarn clean && yarn build",
52
+ "test:ts": "run -T tsc -p tsconfig.json",
52
53
  "test:unit": "run -T jest",
53
54
  "test:unit:watch": "run -T jest --watch",
54
55
  "test:unit:vitest": "vitest run",
@@ -60,15 +61,15 @@ var dependencies = {
60
61
  "@koa/router": "12.0.2",
61
62
  "@modelcontextprotocol/sdk": "1.29.0",
62
63
  "@paralleldrive/cuid2": "2.2.2",
63
- "@strapi/admin": "5.50.1",
64
- "@strapi/database": "5.50.1",
65
- "@strapi/generators": "5.50.1",
66
- "@strapi/logger": "5.50.1",
67
- "@strapi/openapi": "5.50.1",
68
- "@strapi/permissions": "5.50.1",
69
- "@strapi/types": "5.50.1",
70
- "@strapi/typescript-utils": "5.50.1",
71
- "@strapi/utils": "5.50.1",
64
+ "@strapi/admin": "5.51.0",
65
+ "@strapi/database": "5.51.0",
66
+ "@strapi/generators": "5.51.0",
67
+ "@strapi/logger": "5.51.0",
68
+ "@strapi/openapi": "5.51.0",
69
+ "@strapi/permissions": "5.51.0",
70
+ "@strapi/types": "5.51.0",
71
+ "@strapi/typescript-utils": "5.51.0",
72
+ "@strapi/utils": "5.51.0",
72
73
  "@vercel/stega": "0.1.2",
73
74
  bcryptjs: "2.4.3",
74
75
  boxen: "5.1.2",
@@ -89,7 +90,7 @@ var dependencies = {
89
90
  inquirer: "9.3.8",
90
91
  "is-docker": "2.2.1",
91
92
  "json-logic-js": "2.0.5",
92
- jsonwebtoken: "9.0.0",
93
+ jsonwebtoken: "9.0.3",
93
94
  koa: "2.16.4",
94
95
  "koa-body": "6.0.1",
95
96
  "koa-compose": "4.1.0",
@@ -112,7 +113,7 @@ var dependencies = {
112
113
  typescript: "5.9.3",
113
114
  undici: "6.27.0",
114
115
  yup: "0.32.9",
115
- zod: "3.25.67"
116
+ zod: "3.25.76"
116
117
  };
117
118
  var devDependencies = {
118
119
  "@swc/core": "1.13.5",
@@ -132,11 +133,12 @@ var devDependencies = {
132
133
  "@types/mime-types": "2.1.1",
133
134
  "@types/node": "20.19.41",
134
135
  "@types/node-schedule": "2.1.7",
135
- "eslint-config-custom": "5.50.1",
136
+ "eslint-config-custom": "5.51.0",
137
+ jest: "29.6.0",
136
138
  supertest: "7.2.2",
137
- tsconfig: "5.50.1",
139
+ tsconfig: "5.51.0",
138
140
  vitest: "catalog:",
139
- "vitest-config": "5.50.1"
141
+ "vitest-config": "5.51.0"
140
142
  };
141
143
  var engines = {
142
144
  node: ">=20.0.0 <=26.x.x",
@@ -1 +1 @@
1
- {"version":3,"file":"package.json.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"package.json.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,5 +1,5 @@
1
1
  import type { UID, Modules } from '@strapi/types';
2
2
  type Data = Modules.Documents.Params.Data.Input<UID.Schema>;
3
- declare const applyTransforms: import("lodash").CurriedFunction2<import("@strapi/types/dist/struct").ComponentSchema | import("@strapi/types/dist/struct").ContentTypeSchema, Data, Data>;
3
+ declare const applyTransforms: import("lodash").CurriedFunction2<import("@strapi/types/dist/struct/schema.js").ComponentSchema | import("@strapi/types/dist/struct/schema.js").ContentTypeSchema, Data, Data>;
4
4
  export { applyTransforms };
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/services/document-service/attributes/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,OAAO,EAAU,MAAM,eAAe,CAAC;AAK1D,KAAK,IAAI,GAAG,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAE5D,QAAA,MAAM,eAAe,4JAsBnB,CAAC;AAEH,OAAO,EAAE,eAAe,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/services/document-service/attributes/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,OAAO,EAAU,MAAM,eAAe,CAAC;AAK1D,KAAK,IAAI,GAAG,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAE5D,QAAA,MAAM,eAAe,gLAsBnB,CAAC;AAEH,OAAO,EAAE,eAAe,EAAE,CAAC"}
@@ -9,7 +9,7 @@ type DynamicZoneValue = Schema.Attribute.DynamicZoneValue<UID.Component[]>;
9
9
  type ComponentBody = {
10
10
  [key: string]: ComponentValue | DynamicZoneValue;
11
11
  };
12
- declare const omitComponentData: _.CurriedFunction2<import("@strapi/types/dist/struct").ComponentSchema | import("@strapi/types/dist/struct").ContentTypeSchema, Input<UID.Schema>, Partial<Input<UID.Schema>>>;
12
+ declare const omitComponentData: _.CurriedFunction2<import("@strapi/types/dist/struct/schema.js").ComponentSchema | import("@strapi/types/dist/struct/schema.js").ContentTypeSchema, Input<UID.Schema>, Partial<Input<UID.Schema>>>;
13
13
  declare const createComponents: <TUID extends UID.Schema, TData extends Input<TUID>>(uid: TUID, data: TData) => Promise<ComponentBody>;
14
14
  declare const getComponents: <TUID extends UID.Schema>(uid: TUID, entity: {
15
15
  id: Modules.EntityService.Params.Attribute.ID;
@@ -21,7 +21,7 @@ declare const deleteComponents: <TUID extends UID.Schema, TEntity extends Data.E
21
21
  loadComponents?: boolean | undefined;
22
22
  }) => Promise<void>;
23
23
  declare const deleteComponent: <TUID extends UID.Component>(uid: TUID, componentToDelete: Data.Component<TUID>) => Promise<void>;
24
- declare const assignComponentData: _.CurriedFunction3<import("@strapi/types/dist/struct").ComponentSchema | import("@strapi/types/dist/struct").ContentTypeSchema, ComponentBody, Input<UID.Schema>, ComponentBody & Partial<Input<UID.Schema>>>;
24
+ declare const assignComponentData: _.CurriedFunction3<import("@strapi/types/dist/struct/schema.js").ComponentSchema | import("@strapi/types/dist/struct/schema.js").ContentTypeSchema, ComponentBody, Input<UID.Schema>, ComponentBody & Partial<Input<UID.Schema>>>;
25
25
  /** *************************
26
26
  Component relation handling for document operations
27
27
  ************************** */
@@ -1 +1 @@
1
- {"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../../src/services/document-service/components.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,QAAQ,CAAC;AAEvB,OAAO,KAAK,EAAS,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAUvE,KAAK,KAAK,CAAC,CAAC,SAAS,GAAG,CAAC,MAAM,IAAI,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAE1E,KAAK,gBAAgB,CAAC,IAAI,SAAS,GAAG,CAAC,M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AM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,GAAG,IAAI,CA0C1E,CAAC;AAEF;;GAEG;AACH,QAAA,MAAM,4BAA4B,GAChC,iBAAiB,MAAM,CAAC,SAAS,KAChC,KAAK,CAAC,MAAM,CAAC,WAAW,GAAG,MAAM,CAAC,SAAS,CAa7C,CAAC;AAsDF;;;GAGG;AACH,QAAA,MAAM,6BAA6B,SAE/B,UAAU,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC7B,OAAO,MAAM,CAAC,SAAS,GAAG,MAAM,CAAC,WAAW,EAC5C,KAAK,GAAG,KACP,OAAO,CAAC,OAAO,CAqBnB,CAAC;AAEF,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,6BAA6B,EAC7B,mBAAmB,EACnB,4BAA4B,GAC7B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"first-published-at.d.ts","sourceRoot":"","sources":["../../../src/services/document-service/first-published-at.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAErD,KAAK,aAAa,GAAG,CAAC,aAAa,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;AACvE,KAAK,eAAe,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,KAAK,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC;AAE9F,QAAA,MAAM,0BAA0B,GAC9B,OAAO,GAAG,EACV,QAAQ,aAAa,EACrB,aAAa,MAAM,CAAC,WAAW,iBAsBhC,CAAC;AAEF,QAAA,MAAM,0BAA0B,EAAE,eAMjC,CAAC;AAEF,OAAO,EAAE,0BAA0B,EAAE,0BAA0B,EAAE,CAAC"}
1
+ {"version":3,"file":"first-published-at.d.ts","sourceRoot":"","sources":["../../../src/services/document-service/first-published-at.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAErD,KAAK,aAAa,GAAG,CAAC,aAAa,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;AACvE,KAAK,eAAe,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,KAAK,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC;AAE9F,QAAA,MAAM,0BAA0B,GAC9B,OAAO,GAAG,EACV,QAAQ,aAAa,EACrB,aAAa,MAAM,CAAC,WAAW,iBA8BhC,CAAC;AAEF,QAAA,MAAM,0BAA0B,EAAE,eAMjC,CAAC;AAEF,OAAO,EAAE,0BAA0B,EAAE,0BAA0B,EAAE,CAAC"}
@@ -16,14 +16,21 @@ const addFirstPublishedAtToDraft = async (draft, update, contentType)=>{
16
16
  // strip media, components, dynamic zones and relations from the draft that
17
17
  // downstream publishEntry relies on. Instead we carry forward the already
18
18
  // populated draft from repository.publish's findMany with the field merged in.
19
- await update(draft, {
19
+ const updatedDraft = await update(draft, {
20
20
  data: {
21
21
  firstPublishedAt: now
22
22
  }
23
23
  });
24
24
  return {
25
25
  ...draft,
26
- firstPublishedAt: now
26
+ firstPublishedAt: now,
27
+ // Propagate the server-side updatedAt so the entry's updatedAt is not
28
+ // earlier than firstPublishedAt. Without this the entry will appear
29
+ // "modified" after its first publish (updatedAt < firstPublishedAt),
30
+ // even though the only change was stamping firstPublishedAt.
31
+ ...updatedDraft.updatedAt && {
32
+ updatedAt: updatedDraft.updatedAt
33
+ }
27
34
  };
28
35
  };
29
36
  const filterDataFirstPublishedAt = (params)=>{
@@ -1 +1 @@
1
- {"version":3,"file":"first-published-at.js","sources":["../../../src/services/document-service/first-published-at.ts"],"sourcesContent":["import { contentTypes } from '@strapi/utils';\nimport { assoc } from 'lodash/fp';\nimport type { Modules, Schema } from '@strapi/types';\n\ntype EntriesUpdate = (entryToUpdate: any, param?: any) => Promise<any>;\ntype ParamsTransform = (params: Modules.Documents.Params.All) => Modules.Documents.Params.All;\n\nconst addFirstPublishedAtToDraft = async (\n draft: any,\n update: EntriesUpdate,\n contentType: Schema.ContentType\n) => {\n if (!contentTypes.hasFirstPublishedAtField(contentType)) {\n return draft;\n }\n\n if (draft.firstPublishedAt) {\n return draft;\n }\n\n const now = new Date();\n\n // Persist to the draft DB row, but discard the return value: entries.update\n // returns an unpopulated findOne (no populate is passed through), which would\n // strip media, components, dynamic zones and relations from the draft that\n // downstream publishEntry relies on. Instead we carry forward the already\n // populated draft from repository.publish's findMany with the field merged in.\n await update(draft, {\n data: { firstPublishedAt: now },\n });\n\n return { ...draft, firstPublishedAt: now };\n};\n\nconst filterDataFirstPublishedAt: ParamsTransform = (params) => {\n if (params?.data?.firstPublishedAt) {\n return assoc(['data', 'firstPublishedAt'], null, params);\n }\n\n return params;\n};\n\nexport { addFirstPublishedAtToDraft, filterDataFirstPublishedAt };\n"],"names":["addFirstPublishedAtToDraft","draft","update","contentType","contentTypes","hasFirstPublishedAtField","firstPublishedAt","now","Date","data","filterDataFirstPublishedAt","params","assoc"],"mappings":";;;;;AAOA,MAAMA,0BAAAA,GAA6B,OACjCC,KAAAA,EACAC,MAAAA,EACAC,WAAAA,GAAAA;AAEA,IAAA,IAAI,CAACC,wBAAAA,CAAaC,wBAAwB,CAACF,WAAAA,CAAAA,EAAc;QACvD,OAAOF,KAAAA;AACT,IAAA;IAEA,IAAIA,KAAAA,CAAMK,gBAAgB,EAAE;QAC1B,OAAOL,KAAAA;AACT,IAAA;AAEA,IAAA,MAAMM,MAAM,IAAIC,IAAAA,EAAAA;;;;;;AAOhB,IAAA,MAAMN,OAAOD,KAAAA,EAAO;QAClBQ,IAAAA,EAAM;YAAEH,gBAAAA,EAAkBC;AAAI;AAChC,KAAA,CAAA;IAEA,OAAO;AAAE,QAAA,GAAGN,KAAK;QAAEK,gBAAAA,EAAkBC;AAAI,KAAA;AAC3C;AAEA,MAAMG,6BAA8C,CAACC,MAAAA,GAAAA;IACnD,IAAIA,MAAAA,EAAQF,MAAMH,gBAAAA,EAAkB;AAClC,QAAA,OAAOM,QAAAA,CAAM;AAAC,YAAA,MAAA;AAAQ,YAAA;AAAmB,SAAA,EAAE,IAAA,EAAMD,MAAAA,CAAAA;AACnD,IAAA;IAEA,OAAOA,MAAAA;AACT;;;;;"}
1
+ {"version":3,"file":"first-published-at.js","sources":["../../../src/services/document-service/first-published-at.ts"],"sourcesContent":["import { contentTypes } from '@strapi/utils';\nimport { assoc } from 'lodash/fp';\nimport type { Modules, Schema } from '@strapi/types';\n\ntype EntriesUpdate = (entryToUpdate: any, param?: any) => Promise<any>;\ntype ParamsTransform = (params: Modules.Documents.Params.All) => Modules.Documents.Params.All;\n\nconst addFirstPublishedAtToDraft = async (\n draft: any,\n update: EntriesUpdate,\n contentType: Schema.ContentType\n) => {\n if (!contentTypes.hasFirstPublishedAtField(contentType)) {\n return draft;\n }\n\n if (draft.firstPublishedAt) {\n return draft;\n }\n\n const now = new Date();\n\n // Persist to the draft DB row, but discard the return value: entries.update\n // returns an unpopulated findOne (no populate is passed through), which would\n // strip media, components, dynamic zones and relations from the draft that\n // downstream publishEntry relies on. Instead we carry forward the already\n // populated draft from repository.publish's findMany with the field merged in.\n const updatedDraft = await update(draft, {\n data: { firstPublishedAt: now },\n });\n\n return {\n ...draft,\n firstPublishedAt: now,\n // Propagate the server-side updatedAt so the entry's updatedAt is not\n // earlier than firstPublishedAt. Without this the entry will appear\n // \"modified\" after its first publish (updatedAt < firstPublishedAt),\n // even though the only change was stamping firstPublishedAt.\n ...(updatedDraft.updatedAt && { updatedAt: updatedDraft.updatedAt }),\n };\n};\n\nconst filterDataFirstPublishedAt: ParamsTransform = (params) => {\n if (params?.data?.firstPublishedAt) {\n return assoc(['data', 'firstPublishedAt'], null, params);\n }\n\n return params;\n};\n\nexport { addFirstPublishedAtToDraft, filterDataFirstPublishedAt };\n"],"names":["addFirstPublishedAtToDraft","draft","update","contentType","contentTypes","hasFirstPublishedAtField","firstPublishedAt","now","Date","updatedDraft","data","updatedAt","filterDataFirstPublishedAt","params","assoc"],"mappings":";;;;;AAOA,MAAMA,0BAAAA,GAA6B,OACjCC,KAAAA,EACAC,MAAAA,EACAC,WAAAA,GAAAA;AAEA,IAAA,IAAI,CAACC,wBAAAA,CAAaC,wBAAwB,CAACF,WAAAA,CAAAA,EAAc;QACvD,OAAOF,KAAAA;AACT,IAAA;IAEA,IAAIA,KAAAA,CAAMK,gBAAgB,EAAE;QAC1B,OAAOL,KAAAA;AACT,IAAA;AAEA,IAAA,MAAMM,MAAM,IAAIC,IAAAA,EAAAA;;;;;;IAOhB,MAAMC,YAAAA,GAAe,MAAMP,MAAAA,CAAOD,KAAAA,EAAO;QACvCS,IAAAA,EAAM;YAAEJ,gBAAAA,EAAkBC;AAAI;AAChC,KAAA,CAAA;IAEA,OAAO;AACL,QAAA,GAAGN,KAAK;QACRK,gBAAAA,EAAkBC,GAAAA;;;;;QAKlB,GAAIE,YAAAA,CAAaE,SAAS,IAAI;AAAEA,YAAAA,SAAAA,EAAWF,aAAaE;;AAC1D,KAAA;AACF;AAEA,MAAMC,6BAA8C,CAACC,MAAAA,GAAAA;IACnD,IAAIA,MAAAA,EAAQH,MAAMJ,gBAAAA,EAAkB;AAClC,QAAA,OAAOQ,QAAAA,CAAM;AAAC,YAAA,MAAA;AAAQ,YAAA;AAAmB,SAAA,EAAE,IAAA,EAAMD,MAAAA,CAAAA;AACnD,IAAA;IAEA,OAAOA,MAAAA;AACT;;;;;"}
@@ -14,14 +14,21 @@ const addFirstPublishedAtToDraft = async (draft, update, contentType)=>{
14
14
  // strip media, components, dynamic zones and relations from the draft that
15
15
  // downstream publishEntry relies on. Instead we carry forward the already
16
16
  // populated draft from repository.publish's findMany with the field merged in.
17
- await update(draft, {
17
+ const updatedDraft = await update(draft, {
18
18
  data: {
19
19
  firstPublishedAt: now
20
20
  }
21
21
  });
22
22
  return {
23
23
  ...draft,
24
- firstPublishedAt: now
24
+ firstPublishedAt: now,
25
+ // Propagate the server-side updatedAt so the entry's updatedAt is not
26
+ // earlier than firstPublishedAt. Without this the entry will appear
27
+ // "modified" after its first publish (updatedAt < firstPublishedAt),
28
+ // even though the only change was stamping firstPublishedAt.
29
+ ...updatedDraft.updatedAt && {
30
+ updatedAt: updatedDraft.updatedAt
31
+ }
25
32
  };
26
33
  };
27
34
  const filterDataFirstPublishedAt = (params)=>{
@@ -1 +1 @@
1
- {"version":3,"file":"first-published-at.mjs","sources":["../../../src/services/document-service/first-published-at.ts"],"sourcesContent":["import { contentTypes } from '@strapi/utils';\nimport { assoc } from 'lodash/fp';\nimport type { Modules, Schema } from '@strapi/types';\n\ntype EntriesUpdate = (entryToUpdate: any, param?: any) => Promise<any>;\ntype ParamsTransform = (params: Modules.Documents.Params.All) => Modules.Documents.Params.All;\n\nconst addFirstPublishedAtToDraft = async (\n draft: any,\n update: EntriesUpdate,\n contentType: Schema.ContentType\n) => {\n if (!contentTypes.hasFirstPublishedAtField(contentType)) {\n return draft;\n }\n\n if (draft.firstPublishedAt) {\n return draft;\n }\n\n const now = new Date();\n\n // Persist to the draft DB row, but discard the return value: entries.update\n // returns an unpopulated findOne (no populate is passed through), which would\n // strip media, components, dynamic zones and relations from the draft that\n // downstream publishEntry relies on. Instead we carry forward the already\n // populated draft from repository.publish's findMany with the field merged in.\n await update(draft, {\n data: { firstPublishedAt: now },\n });\n\n return { ...draft, firstPublishedAt: now };\n};\n\nconst filterDataFirstPublishedAt: ParamsTransform = (params) => {\n if (params?.data?.firstPublishedAt) {\n return assoc(['data', 'firstPublishedAt'], null, params);\n }\n\n return params;\n};\n\nexport { addFirstPublishedAtToDraft, filterDataFirstPublishedAt };\n"],"names":["addFirstPublishedAtToDraft","draft","update","contentType","contentTypes","hasFirstPublishedAtField","firstPublishedAt","now","Date","data","filterDataFirstPublishedAt","params","assoc"],"mappings":";;;AAOA,MAAMA,0BAAAA,GAA6B,OACjCC,KAAAA,EACAC,MAAAA,EACAC,WAAAA,GAAAA;AAEA,IAAA,IAAI,CAACC,YAAAA,CAAaC,wBAAwB,CAACF,WAAAA,CAAAA,EAAc;QACvD,OAAOF,KAAAA;AACT,IAAA;IAEA,IAAIA,KAAAA,CAAMK,gBAAgB,EAAE;QAC1B,OAAOL,KAAAA;AACT,IAAA;AAEA,IAAA,MAAMM,MAAM,IAAIC,IAAAA,EAAAA;;;;;;AAOhB,IAAA,MAAMN,OAAOD,KAAAA,EAAO;QAClBQ,IAAAA,EAAM;YAAEH,gBAAAA,EAAkBC;AAAI;AAChC,KAAA,CAAA;IAEA,OAAO;AAAE,QAAA,GAAGN,KAAK;QAAEK,gBAAAA,EAAkBC;AAAI,KAAA;AAC3C;AAEA,MAAMG,6BAA8C,CAACC,MAAAA,GAAAA;IACnD,IAAIA,MAAAA,EAAQF,MAAMH,gBAAAA,EAAkB;AAClC,QAAA,OAAOM,KAAAA,CAAM;AAAC,YAAA,MAAA;AAAQ,YAAA;AAAmB,SAAA,EAAE,IAAA,EAAMD,MAAAA,CAAAA;AACnD,IAAA;IAEA,OAAOA,MAAAA;AACT;;;;"}
1
+ {"version":3,"file":"first-published-at.mjs","sources":["../../../src/services/document-service/first-published-at.ts"],"sourcesContent":["import { contentTypes } from '@strapi/utils';\nimport { assoc } from 'lodash/fp';\nimport type { Modules, Schema } from '@strapi/types';\n\ntype EntriesUpdate = (entryToUpdate: any, param?: any) => Promise<any>;\ntype ParamsTransform = (params: Modules.Documents.Params.All) => Modules.Documents.Params.All;\n\nconst addFirstPublishedAtToDraft = async (\n draft: any,\n update: EntriesUpdate,\n contentType: Schema.ContentType\n) => {\n if (!contentTypes.hasFirstPublishedAtField(contentType)) {\n return draft;\n }\n\n if (draft.firstPublishedAt) {\n return draft;\n }\n\n const now = new Date();\n\n // Persist to the draft DB row, but discard the return value: entries.update\n // returns an unpopulated findOne (no populate is passed through), which would\n // strip media, components, dynamic zones and relations from the draft that\n // downstream publishEntry relies on. Instead we carry forward the already\n // populated draft from repository.publish's findMany with the field merged in.\n const updatedDraft = await update(draft, {\n data: { firstPublishedAt: now },\n });\n\n return {\n ...draft,\n firstPublishedAt: now,\n // Propagate the server-side updatedAt so the entry's updatedAt is not\n // earlier than firstPublishedAt. Without this the entry will appear\n // \"modified\" after its first publish (updatedAt < firstPublishedAt),\n // even though the only change was stamping firstPublishedAt.\n ...(updatedDraft.updatedAt && { updatedAt: updatedDraft.updatedAt }),\n };\n};\n\nconst filterDataFirstPublishedAt: ParamsTransform = (params) => {\n if (params?.data?.firstPublishedAt) {\n return assoc(['data', 'firstPublishedAt'], null, params);\n }\n\n return params;\n};\n\nexport { addFirstPublishedAtToDraft, filterDataFirstPublishedAt };\n"],"names":["addFirstPublishedAtToDraft","draft","update","contentType","contentTypes","hasFirstPublishedAtField","firstPublishedAt","now","Date","updatedDraft","data","updatedAt","filterDataFirstPublishedAt","params","assoc"],"mappings":";;;AAOA,MAAMA,0BAAAA,GAA6B,OACjCC,KAAAA,EACAC,MAAAA,EACAC,WAAAA,GAAAA;AAEA,IAAA,IAAI,CAACC,YAAAA,CAAaC,wBAAwB,CAACF,WAAAA,CAAAA,EAAc;QACvD,OAAOF,KAAAA;AACT,IAAA;IAEA,IAAIA,KAAAA,CAAMK,gBAAgB,EAAE;QAC1B,OAAOL,KAAAA;AACT,IAAA;AAEA,IAAA,MAAMM,MAAM,IAAIC,IAAAA,EAAAA;;;;;;IAOhB,MAAMC,YAAAA,GAAe,MAAMP,MAAAA,CAAOD,KAAAA,EAAO;QACvCS,IAAAA,EAAM;YAAEJ,gBAAAA,EAAkBC;AAAI;AAChC,KAAA,CAAA;IAEA,OAAO;AACL,QAAA,GAAGN,KAAK;QACRK,gBAAAA,EAAkBC,GAAAA;;;;;QAKlB,GAAIE,YAAAA,CAAaE,SAAS,IAAI;AAAEA,YAAAA,SAAAA,EAAWF,aAAaE;;AAC1D,KAAA;AACF;AAEA,MAAMC,6BAA8C,CAACC,MAAAA,GAAAA;IACnD,IAAIA,MAAAA,EAAQH,MAAMJ,gBAAAA,EAAkB;AAClC,QAAA,OAAOQ,KAAAA,CAAM;AAAC,YAAA,MAAA;AAAQ,YAAA;AAAmB,SAAA,EAAE,IAAA,EAAMD,MAAAA,CAAAA;AACnD,IAAA;IAEA,OAAOA,MAAAA;AACT;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../../src/services/document-service/repository.ts"],"names":[],"mappings":"AAWA,OAAO,EAAqB,KAAK,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAkC3E,eAAO,MAAM,2BAA2B,EAAE,uBAosBzC,CAAC"}
1
+ {"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../../src/services/document-service/repository.ts"],"names":[],"mappings":"AAWA,OAAO,EAAqB,KAAK,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAmC3E,eAAO,MAAM,2BAA2B,EAAE,uBA8tBzC,CAAC"}
@@ -19,6 +19,7 @@ var selfReferentialRelations = require('./utils/self-referential-relations.js');
19
19
  var index = require('../entity-validator/index.js');
20
20
  var firstPublishedAt = require('./first-published-at.js');
21
21
  var orderedParallel = require('./utils/ordered-parallel.js');
22
+ var cloneRelations = require('./utils/clone-relations.js');
22
23
 
23
24
  const { validators } = strapiUtils.validate;
24
25
  // we have to typecast to reconcile the differences between validator and database getModel
@@ -293,8 +294,8 @@ const createContentTypeRepository = (uid, validator = index)=>{
293
294
  return doc;
294
295
  }
295
296
  async function clone(opts = {}) {
296
- const { documentId, ...params } = opts;
297
- const queryParams = await strapiUtils.async.pipe(validateParams, draftAndPublish.filterDataPublishedAt, internationalization.defaultLocale(contentType), internationalization.multiLocaleToLookup(contentType))(params);
297
+ const { documentId, ...params$1 } = opts;
298
+ const queryParams = await strapiUtils.async.pipe(validateParams, draftAndPublish.filterDataPublishedAt, internationalization.defaultLocale(contentType), internationalization.multiLocaleToLookup(contentType))(params$1);
298
299
  // Get deep populate
299
300
  const entriesToClone = await strapi.db.query(uid).findMany({
300
301
  where: {
@@ -312,17 +313,36 @@ const createContentTypeRepository = (uid, validator = index)=>{
312
313
  ]
313
314
  })
314
315
  });
315
- const clonedEntries = await strapiUtils.async.map(entriesToClone, strapiUtils.async.pipe(fp.omit([
316
- 'id',
317
- 'createdAt',
318
- 'updatedAt'
319
- ]), // assign new documentId
320
- fp.assoc('documentId', transformContentTypesToModels.createDocumentId()), // Merge new data into it
321
- (data)=>fp.merge(data, queryParams.data), (data)=>entries$1.create({
316
+ const newDocumentId = transformContentTypesToModels.createDocumentId();
317
+ const clonedEntries = await strapiUtils.async.map(entriesToClone, async (entryToClone)=>{
318
+ const sourceEntryId = entryToClone.id;
319
+ const originalData = fp.omit([
320
+ 'id',
321
+ 'createdAt',
322
+ 'updatedAt'
323
+ ], entryToClone);
324
+ const { data, relationsToCopy } = await cloneRelations.prepareCloneData(originalData, queryParams.data, contentType, (modelUid)=>strapi.getModel(modelUid));
325
+ const dataWithDocumentId = fp.assoc('documentId', newDocumentId, data);
326
+ const doc = await entries$1.create({
327
+ ...queryParams,
328
+ data: dataWithDocumentId,
329
+ status: 'draft'
330
+ });
331
+ await cloneRelations.copyCloneRelationRows(strapi, uid, sourceEntryId, doc.id, relationsToCopy);
332
+ if (relationsToCopy.length === 0) {
333
+ return doc;
334
+ }
335
+ const selectionQuery = query.transformParamsToQuery(uid, params.pickSelectionParams({
322
336
  ...queryParams,
323
- data,
324
337
  status: 'draft'
325
- })));
338
+ }));
339
+ return strapi.db.query(uid).findOne({
340
+ ...selectionQuery,
341
+ where: {
342
+ id: doc.id
343
+ }
344
+ });
345
+ });
326
346
  clonedEntries.forEach(emitEvent('entry.create'));
327
347
  return {
328
348
  documentId: clonedEntries.at(0)?.documentId,