payload 3.94.0-internal.78c6d86 → 3.94.1

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 (106) hide show
  1. package/dist/admin/functions/index.d.ts +2 -0
  2. package/dist/admin/functions/index.d.ts.map +1 -1
  3. package/dist/admin/functions/index.js.map +1 -1
  4. package/dist/auth/defaultAdminPanelUserAccess.d.ts +5 -0
  5. package/dist/auth/defaultAdminPanelUserAccess.d.ts.map +1 -0
  6. package/dist/auth/defaultAdminPanelUserAccess.js +3 -0
  7. package/dist/auth/defaultAdminPanelUserAccess.js.map +1 -0
  8. package/dist/auth/defaultAdminPanelUserAccess.spec.js +44 -0
  9. package/dist/auth/defaultAdminPanelUserAccess.spec.js.map +1 -0
  10. package/dist/auth/extractJWT.d.ts.map +1 -1
  11. package/dist/auth/extractJWT.js +29 -3
  12. package/dist/auth/extractJWT.js.map +1 -1
  13. package/dist/auth/extractJWT.spec.js +121 -0
  14. package/dist/auth/extractJWT.spec.js.map +1 -0
  15. package/dist/auth/isCrossSiteNavigation.d.ts +7 -0
  16. package/dist/auth/isCrossSiteNavigation.d.ts.map +1 -0
  17. package/dist/auth/isCrossSiteNavigation.js +9 -0
  18. package/dist/auth/isCrossSiteNavigation.js.map +1 -0
  19. package/dist/auth/strategies/jwt.js +2 -1
  20. package/dist/auth/strategies/jwt.js.map +1 -1
  21. package/dist/bin/generateImportMap/utilities/resolveImportMapFilePath.d.ts.map +1 -1
  22. package/dist/bin/generateImportMap/utilities/resolveImportMapFilePath.js +4 -2
  23. package/dist/bin/generateImportMap/utilities/resolveImportMapFilePath.js.map +1 -1
  24. package/dist/collections/operations/findByID.d.ts.map +1 -1
  25. package/dist/collections/operations/findByID.js +1 -3
  26. package/dist/collections/operations/findByID.js.map +1 -1
  27. package/dist/collections/operations/update.d.ts.map +1 -1
  28. package/dist/collections/operations/update.js +24 -1
  29. package/dist/collections/operations/update.js.map +1 -1
  30. package/dist/collections/operations/utilities/update.d.ts +2 -1
  31. package/dist/collections/operations/utilities/update.d.ts.map +1 -1
  32. package/dist/collections/operations/utilities/update.js +11 -1
  33. package/dist/collections/operations/utilities/update.js.map +1 -1
  34. package/dist/database/types.d.ts +2 -0
  35. package/dist/database/types.d.ts.map +1 -1
  36. package/dist/database/types.js.map +1 -1
  37. package/dist/exports/shared.d.ts +1 -0
  38. package/dist/exports/shared.d.ts.map +1 -1
  39. package/dist/exports/shared.js +1 -0
  40. package/dist/exports/shared.js.map +1 -1
  41. package/dist/fields/baseFields/slug/generateSlug.d.ts +4 -0
  42. package/dist/fields/baseFields/slug/generateSlug.d.ts.map +1 -1
  43. package/dist/fields/baseFields/slug/generateSlug.js +11 -3
  44. package/dist/fields/baseFields/slug/generateSlug.js.map +1 -1
  45. package/dist/fields/hooks/beforeValidate/getFallbackValue.d.ts.map +1 -1
  46. package/dist/fields/hooks/beforeValidate/getFallbackValue.js +3 -2
  47. package/dist/fields/hooks/beforeValidate/getFallbackValue.js.map +1 -1
  48. package/dist/index.bundled.d.ts +63 -4
  49. package/dist/index.d.ts +1 -0
  50. package/dist/index.d.ts.map +1 -1
  51. package/dist/index.js +13 -2
  52. package/dist/index.js.map +1 -1
  53. package/dist/index.spec.js +107 -0
  54. package/dist/index.spec.js.map +1 -0
  55. package/dist/queues/endpoints/handleSchedules.d.ts.map +1 -1
  56. package/dist/queues/endpoints/handleSchedules.js +2 -0
  57. package/dist/queues/endpoints/handleSchedules.js.map +1 -1
  58. package/dist/queues/endpoints/ignoreCrossSiteNavigationUser.d.ts +10 -0
  59. package/dist/queues/endpoints/ignoreCrossSiteNavigationUser.d.ts.map +1 -0
  60. package/dist/queues/endpoints/ignoreCrossSiteNavigationUser.js +14 -0
  61. package/dist/queues/endpoints/ignoreCrossSiteNavigationUser.js.map +1 -0
  62. package/dist/queues/endpoints/run.d.ts.map +1 -1
  63. package/dist/queues/endpoints/run.js +2 -0
  64. package/dist/queues/endpoints/run.js.map +1 -1
  65. package/dist/queues/operations/runJobs/index.d.ts.map +1 -1
  66. package/dist/queues/operations/runJobs/index.js +30 -8
  67. package/dist/queues/operations/runJobs/index.js.map +1 -1
  68. package/dist/queues/utilities/jobClaim.d.ts +4 -0
  69. package/dist/queues/utilities/jobClaim.d.ts.map +1 -0
  70. package/dist/queues/utilities/jobClaim.js +18 -0
  71. package/dist/queues/utilities/jobClaim.js.map +1 -0
  72. package/dist/queues/utilities/updateJob.d.ts.map +1 -1
  73. package/dist/queues/utilities/updateJob.js +165 -5
  74. package/dist/queues/utilities/updateJob.js.map +1 -1
  75. package/dist/utilities/checkDocumentLockStatus.d.ts.map +1 -1
  76. package/dist/utilities/checkDocumentLockStatus.js +3 -1
  77. package/dist/utilities/checkDocumentLockStatus.js.map +1 -1
  78. package/dist/utilities/deepMerge.d.ts +55 -3
  79. package/dist/utilities/deepMerge.d.ts.map +1 -1
  80. package/dist/utilities/deepMerge.js +97 -2
  81. package/dist/utilities/deepMerge.js.map +1 -1
  82. package/dist/utilities/deepMerge.spec.js +332 -0
  83. package/dist/utilities/deepMerge.spec.js.map +1 -0
  84. package/dist/utilities/getDateOnlyComparison.d.ts +27 -0
  85. package/dist/utilities/getDateOnlyComparison.d.ts.map +1 -0
  86. package/dist/utilities/getDateOnlyComparison.js +162 -0
  87. package/dist/utilities/getDateOnlyComparison.js.map +1 -0
  88. package/dist/utilities/telemetry/featureInfo/getFeatureInfo.d.ts.map +1 -1
  89. package/dist/utilities/telemetry/featureInfo/getFeatureInfo.js +41 -7
  90. package/dist/utilities/telemetry/featureInfo/getFeatureInfo.js.map +1 -1
  91. package/dist/utilities/telemetry/featureInfo/types.d.ts +4 -1
  92. package/dist/utilities/telemetry/featureInfo/types.d.ts.map +1 -1
  93. package/dist/utilities/telemetry/featureInfo/types.js.map +1 -1
  94. package/dist/utilities/telemetry/index.d.ts +3 -5
  95. package/dist/utilities/telemetry/index.d.ts.map +1 -1
  96. package/dist/utilities/telemetry/index.js +14 -3
  97. package/dist/utilities/telemetry/index.js.map +1 -1
  98. package/dist/utilities/telemetry/widgetType.d.ts +6 -0
  99. package/dist/utilities/telemetry/widgetType.d.ts.map +1 -0
  100. package/dist/utilities/telemetry/widgetType.js +17 -0
  101. package/dist/utilities/telemetry/widgetType.js.map +1 -0
  102. package/package.json +3 -4
  103. package/dist/fields/hooks/beforeChange/cloneDataFromOriginalDoc.d.ts +0 -3
  104. package/dist/fields/hooks/beforeChange/cloneDataFromOriginalDoc.d.ts.map +0 -1
  105. package/dist/fields/hooks/beforeChange/cloneDataFromOriginalDoc.js +0 -20
  106. package/dist/fields/hooks/beforeChange/cloneDataFromOriginalDoc.js.map +0 -1
@@ -0,0 +1,332 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { deepMerge, deepMergeWithCombinedArrays, deepMergeWithReactComponents, deepMergeWithSourceArrays } from './deepMerge.js';
3
+ describe('deepMerge', ()=>{
4
+ it('should deeply merge nested objects with source taking precedence', ()=>{
5
+ const result = deepMerge({
6
+ a: {
7
+ b: 1,
8
+ c: 2
9
+ },
10
+ d: 1
11
+ }, {
12
+ a: {
13
+ c: 3,
14
+ e: 4
15
+ },
16
+ f: 5
17
+ });
18
+ expect(result).toStrictEqual({
19
+ a: {
20
+ b: 1,
21
+ c: 3,
22
+ e: 4
23
+ },
24
+ d: 1,
25
+ f: 5
26
+ });
27
+ });
28
+ it('should not mutate its arguments and should clone nested values', ()=>{
29
+ const target = {
30
+ nested: {
31
+ value: 1
32
+ }
33
+ };
34
+ const source = {
35
+ other: {
36
+ value: 2
37
+ }
38
+ };
39
+ const result = deepMerge(target, source);
40
+ expect(target).toStrictEqual({
41
+ nested: {
42
+ value: 1
43
+ }
44
+ });
45
+ expect(source).toStrictEqual({
46
+ other: {
47
+ value: 2
48
+ }
49
+ });
50
+ expect(result.nested).not.toBe(target.nested);
51
+ expect(result.other).not.toBe(source.other);
52
+ });
53
+ it('should keep references when clone is false', ()=>{
54
+ const nested = {
55
+ value: 1
56
+ };
57
+ const result = deepMerge({}, {
58
+ nested
59
+ }, {
60
+ clone: false
61
+ });
62
+ expect(result.nested).toBe(nested);
63
+ });
64
+ it('should concatenate arrays by default', ()=>{
65
+ const result = deepMerge({
66
+ list: [
67
+ 1,
68
+ 2
69
+ ]
70
+ }, {
71
+ list: [
72
+ 3
73
+ ]
74
+ });
75
+ expect(result).toStrictEqual({
76
+ list: [
77
+ 1,
78
+ 2,
79
+ 3
80
+ ]
81
+ });
82
+ });
83
+ it('should not deeply merge dates and regular expressions', ()=>{
84
+ const date = new Date();
85
+ const regex = /test/;
86
+ const result = deepMerge({
87
+ date: {},
88
+ regex: {}
89
+ }, {
90
+ date,
91
+ regex
92
+ });
93
+ expect(result.date).toBe(date);
94
+ expect(result.regex).toBe(regex);
95
+ });
96
+ it('should merge enumerable symbol keys', ()=>{
97
+ const symbol = Symbol('key');
98
+ const result = deepMerge({
99
+ [symbol]: {
100
+ a: 1
101
+ }
102
+ }, {
103
+ [symbol]: {
104
+ b: 2
105
+ }
106
+ });
107
+ expect(result[symbol]).toStrictEqual({
108
+ a: 1,
109
+ b: 2
110
+ });
111
+ });
112
+ it('should use customMerge for matching keys', ()=>{
113
+ const result = deepMerge({
114
+ a: {
115
+ x: 1
116
+ },
117
+ b: {
118
+ x: 1
119
+ }
120
+ }, {
121
+ a: {
122
+ y: 2
123
+ },
124
+ b: {
125
+ y: 2
126
+ }
127
+ }, {
128
+ customMerge: (key)=>key === 'a' ? (_x, y)=>y : undefined
129
+ });
130
+ expect(result).toStrictEqual({
131
+ a: {
132
+ y: 2
133
+ },
134
+ b: {
135
+ x: 1,
136
+ y: 2
137
+ }
138
+ });
139
+ });
140
+ it('should merge all objects with deepMerge.all', ()=>{
141
+ const result = deepMerge.all([
142
+ {
143
+ a: {
144
+ x: 1
145
+ }
146
+ },
147
+ {
148
+ a: {
149
+ y: 2
150
+ }
151
+ },
152
+ {
153
+ b: 3
154
+ }
155
+ ]);
156
+ expect(result).toStrictEqual({
157
+ a: {
158
+ x: 1,
159
+ y: 2
160
+ },
161
+ b: 3
162
+ });
163
+ });
164
+ it('should not poison the prototype of the result via a __proto__ key in the source', ()=>{
165
+ const target = JSON.parse('{"__proto__": {}}');
166
+ const source = JSON.parse('{"__proto__": {"isAdmin": true}}');
167
+ const result = deepMerge(target, source);
168
+ expect(Object.getPrototypeOf(result)).toBe(Object.prototype);
169
+ expect(result.isAdmin).toBeUndefined();
170
+ });
171
+ it('should not poison the prototype of the result via a __proto__ key in the target', ()=>{
172
+ const target = JSON.parse('{"__proto__": {"isAdmin": true}}');
173
+ const result = deepMerge(target, {});
174
+ expect(Object.getPrototypeOf(result)).toBe(Object.prototype);
175
+ expect(result.isAdmin).toBeUndefined();
176
+ });
177
+ it('should not pollute Object.prototype via constructor.prototype', ()=>{
178
+ const source = JSON.parse('{"constructor": {"prototype": {"polluted": true}}}');
179
+ deepMerge({}, source);
180
+ expect({}.polluted).toBeUndefined();
181
+ });
182
+ it('should not poison the prototype via a nested __proto__ key that only exists in the source', ()=>{
183
+ const source = JSON.parse('{"a": {"__proto__": {"isAdmin": true}}}');
184
+ const result = deepMerge({}, source);
185
+ expect(Object.getPrototypeOf(result.a)).toBe(Object.prototype);
186
+ expect(result.a.isAdmin).toBeUndefined();
187
+ });
188
+ it('should not poison the prototype via a __proto__ key inside array items', ()=>{
189
+ const source = JSON.parse('{"list": [{"__proto__": {"isAdmin": true}}]}');
190
+ const result = deepMerge({
191
+ list: []
192
+ }, source);
193
+ expect(Object.getPrototypeOf(result.list[0])).toBe(Object.prototype);
194
+ expect(result.list[0].isAdmin).toBeUndefined();
195
+ });
196
+ it('should not mutate the passed options object', ()=>{
197
+ const options = {
198
+ clone: true
199
+ };
200
+ deepMerge({
201
+ a: [
202
+ 1
203
+ ]
204
+ }, {
205
+ a: [
206
+ 2
207
+ ]
208
+ }, options);
209
+ expect(options).toStrictEqual({
210
+ clone: true
211
+ });
212
+ });
213
+ it('should not clone React 18 or React 19 elements', ()=>{
214
+ const react18Element = {
215
+ $$typeof: Symbol.for('react.element'),
216
+ props: {}
217
+ };
218
+ const react19Element = {
219
+ $$typeof: Symbol.for('react.transitional.element'),
220
+ props: {}
221
+ };
222
+ const result = deepMerge({}, {
223
+ react18: react18Element,
224
+ react19: react19Element
225
+ });
226
+ expect(result.react18).toBe(react18Element);
227
+ expect(result.react19).toBe(react19Element);
228
+ });
229
+ it('should accept the signatures of the former deepmerge dependency', ()=>{
230
+ const isMergeableObject = (value)=>Object.prototype.toString.call(value) === '[object Object]';
231
+ const options = {
232
+ isMergeableObject
233
+ };
234
+ const arrayMergeOptions = {
235
+ cloneUnlessOtherwiseSpecified: (value)=>value,
236
+ isMergeableObject
237
+ };
238
+ const merged = deepMerge.all([
239
+ {
240
+ a: 1
241
+ },
242
+ {
243
+ b: 'b'
244
+ }
245
+ ], options);
246
+ const typed = deepMerge.all([
247
+ {
248
+ a: 1
249
+ },
250
+ {
251
+ b: 'b'
252
+ }
253
+ ]);
254
+ expect(merged).toStrictEqual({
255
+ a: 1,
256
+ b: 'b'
257
+ });
258
+ expect(typed.b).toBe('b');
259
+ expect(arrayMergeOptions.cloneUnlessOtherwiseSpecified(merged)).toBe(merged);
260
+ });
261
+ });
262
+ describe('deepMergeWithSourceArrays', ()=>{
263
+ it('should replace target arrays with source arrays', ()=>{
264
+ const result = deepMergeWithSourceArrays({
265
+ list: [
266
+ 1,
267
+ 2
268
+ ],
269
+ keep: true
270
+ }, {
271
+ list: [
272
+ 3
273
+ ]
274
+ });
275
+ expect(result).toStrictEqual({
276
+ keep: true,
277
+ list: [
278
+ 3
279
+ ]
280
+ });
281
+ });
282
+ });
283
+ describe('deepMergeWithCombinedArrays', ()=>{
284
+ it('should merge array items by index and append new primitives', ()=>{
285
+ const result = deepMergeWithCombinedArrays({
286
+ list: [
287
+ {
288
+ a: 1
289
+ },
290
+ 'x'
291
+ ]
292
+ }, {
293
+ list: [
294
+ {
295
+ b: 2
296
+ },
297
+ 'y',
298
+ 'z'
299
+ ]
300
+ });
301
+ expect(result).toStrictEqual({
302
+ list: [
303
+ {
304
+ a: 1,
305
+ b: 2
306
+ },
307
+ 'x',
308
+ 'y',
309
+ 'z'
310
+ ]
311
+ });
312
+ });
313
+ });
314
+ describe('deepMergeWithReactComponents', ()=>{
315
+ it('should not clone functions', ()=>{
316
+ const Component = ()=>null;
317
+ const result = deepMergeWithReactComponents({
318
+ admin: {
319
+ components: {}
320
+ }
321
+ }, {
322
+ admin: {
323
+ components: {
324
+ Field: Component
325
+ }
326
+ }
327
+ });
328
+ expect(result.admin.components.Field).toBe(Component);
329
+ });
330
+ });
331
+
332
+ //# sourceMappingURL=deepMerge.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utilities/deepMerge.spec.ts"],"sourcesContent":["import { describe, expect, it } from 'vitest'\n\nimport {\n deepMerge,\n deepMergeWithCombinedArrays,\n deepMergeWithReactComponents,\n deepMergeWithSourceArrays,\n} from './deepMerge.js'\n\ndescribe('deepMerge', () => {\n it('should deeply merge nested objects with source taking precedence', () => {\n const result = deepMerge<Record<string, unknown>>(\n { a: { b: 1, c: 2 }, d: 1 },\n { a: { c: 3, e: 4 }, f: 5 },\n )\n\n expect(result).toStrictEqual({ a: { b: 1, c: 3, e: 4 }, d: 1, f: 5 })\n })\n\n it('should not mutate its arguments and should clone nested values', () => {\n const target = { nested: { value: 1 } }\n const source = { other: { value: 2 } }\n\n const result = deepMerge<Record<string, any>>(target, source)\n\n expect(target).toStrictEqual({ nested: { value: 1 } })\n expect(source).toStrictEqual({ other: { value: 2 } })\n expect(result.nested).not.toBe(target.nested)\n expect(result.other).not.toBe(source.other)\n })\n\n it('should keep references when clone is false', () => {\n const nested = { value: 1 }\n\n const result = deepMerge<Record<string, any>>({}, { nested }, { clone: false })\n\n expect(result.nested).toBe(nested)\n })\n\n it('should concatenate arrays by default', () => {\n const result = deepMerge<Record<string, unknown>>({ list: [1, 2] }, { list: [3] })\n\n expect(result).toStrictEqual({ list: [1, 2, 3] })\n })\n\n it('should not deeply merge dates and regular expressions', () => {\n const date = new Date()\n const regex = /test/\n\n const result = deepMerge<Record<string, unknown>>({ date: {}, regex: {} }, { date, regex })\n\n expect(result.date).toBe(date)\n expect(result.regex).toBe(regex)\n })\n\n it('should merge enumerable symbol keys', () => {\n const symbol = Symbol('key')\n\n const result = deepMerge<Record<symbol, unknown>>(\n { [symbol]: { a: 1 } },\n { [symbol]: { b: 2 } },\n )\n\n expect(result[symbol]).toStrictEqual({ a: 1, b: 2 })\n })\n\n it('should use customMerge for matching keys', () => {\n const result = deepMerge<Record<string, unknown>>(\n { a: { x: 1 }, b: { x: 1 } },\n { a: { y: 2 }, b: { y: 2 } },\n { customMerge: (key) => (key === 'a' ? (_x, y) => y : undefined) },\n )\n\n expect(result).toStrictEqual({ a: { y: 2 }, b: { x: 1, y: 2 } })\n })\n\n it('should merge all objects with deepMerge.all', () => {\n const result = deepMerge.all<Record<string, unknown>>([\n { a: { x: 1 } },\n { a: { y: 2 } },\n { b: 3 },\n ])\n\n expect(result).toStrictEqual({ a: { x: 1, y: 2 }, b: 3 })\n })\n\n it('should not poison the prototype of the result via a __proto__ key in the source', () => {\n const target = JSON.parse('{\"__proto__\": {}}')\n const source = JSON.parse('{\"__proto__\": {\"isAdmin\": true}}')\n\n const result = deepMerge<Record<string, unknown>>(target, source)\n\n expect(Object.getPrototypeOf(result)).toBe(Object.prototype)\n expect(result.isAdmin).toBeUndefined()\n })\n\n it('should not poison the prototype of the result via a __proto__ key in the target', () => {\n const target = JSON.parse('{\"__proto__\": {\"isAdmin\": true}}')\n\n const result = deepMerge<Record<string, unknown>>(target, {})\n\n expect(Object.getPrototypeOf(result)).toBe(Object.prototype)\n expect(result.isAdmin).toBeUndefined()\n })\n\n it('should not pollute Object.prototype via constructor.prototype', () => {\n const source = JSON.parse('{\"constructor\": {\"prototype\": {\"polluted\": true}}}')\n\n deepMerge({}, source)\n\n expect(({} as Record<string, unknown>).polluted).toBeUndefined()\n })\n\n it('should not poison the prototype via a nested __proto__ key that only exists in the source', () => {\n const source = JSON.parse('{\"a\": {\"__proto__\": {\"isAdmin\": true}}}')\n\n const result = deepMerge<Record<string, any>>({}, source)\n\n expect(Object.getPrototypeOf(result.a)).toBe(Object.prototype)\n expect(result.a.isAdmin).toBeUndefined()\n })\n\n it('should not poison the prototype via a __proto__ key inside array items', () => {\n const source = JSON.parse('{\"list\": [{\"__proto__\": {\"isAdmin\": true}}]}')\n\n const result = deepMerge<Record<string, any>>({ list: [] }, source)\n\n expect(Object.getPrototypeOf(result.list[0])).toBe(Object.prototype)\n expect(result.list[0].isAdmin).toBeUndefined()\n })\n\n it('should not mutate the passed options object', () => {\n const options: deepMerge.Options = { clone: true }\n\n deepMerge({ a: [1] }, { a: [2] }, options)\n\n expect(options).toStrictEqual({ clone: true })\n })\n\n it('should not clone React 18 or React 19 elements', () => {\n const react18Element = { $$typeof: Symbol.for('react.element'), props: {} }\n const react19Element = { $$typeof: Symbol.for('react.transitional.element'), props: {} }\n\n const result = deepMerge<Record<string, unknown>>(\n {},\n { react18: react18Element, react19: react19Element },\n )\n\n expect(result.react18).toBe(react18Element)\n expect(result.react19).toBe(react19Element)\n })\n\n it('should accept the signatures of the former deepmerge dependency', () => {\n const isMergeableObject = (value: object) =>\n Object.prototype.toString.call(value) === '[object Object]'\n const options: deepMerge.Options = { isMergeableObject }\n const arrayMergeOptions: deepMerge.ArrayMergeOptions = {\n cloneUnlessOtherwiseSpecified: (value: object): object => value,\n isMergeableObject,\n }\n\n const merged: object = deepMerge.all([{ a: 1 }, { b: 'b' }], options)\n const typed = deepMerge.all<{ a: number; b: string }>([{ a: 1 }, { b: 'b' }])\n\n expect(merged).toStrictEqual({ a: 1, b: 'b' })\n expect(typed.b).toBe('b')\n expect(arrayMergeOptions.cloneUnlessOtherwiseSpecified(merged)).toBe(merged)\n })\n})\n\ndescribe('deepMergeWithSourceArrays', () => {\n it('should replace target arrays with source arrays', () => {\n const result = deepMergeWithSourceArrays<Record<string, unknown>>(\n { list: [1, 2], keep: true },\n { list: [3] },\n )\n\n expect(result).toStrictEqual({ keep: true, list: [3] })\n })\n})\n\ndescribe('deepMergeWithCombinedArrays', () => {\n it('should merge array items by index and append new primitives', () => {\n const result = deepMergeWithCombinedArrays<Record<string, unknown>>(\n { list: [{ a: 1 }, 'x'] },\n { list: [{ b: 2 }, 'y', 'z'] },\n )\n\n expect(result).toStrictEqual({ list: [{ a: 1, b: 2 }, 'x', 'y', 'z'] })\n })\n})\n\ndescribe('deepMergeWithReactComponents', () => {\n it('should not clone functions', () => {\n const Component = () => null\n\n const result = deepMergeWithReactComponents<Record<string, unknown>>(\n { admin: { components: {} } },\n { admin: { components: { Field: Component } } },\n )\n\n expect((result.admin as any).components.Field).toBe(Component)\n })\n})\n"],"names":["describe","expect","it","deepMerge","deepMergeWithCombinedArrays","deepMergeWithReactComponents","deepMergeWithSourceArrays","result","a","b","c","d","e","f","toStrictEqual","target","nested","value","source","other","not","toBe","clone","list","date","Date","regex","symbol","Symbol","x","y","customMerge","key","_x","undefined","all","JSON","parse","Object","getPrototypeOf","prototype","isAdmin","toBeUndefined","polluted","options","react18Element","$$typeof","for","props","react19Element","react18","react19","isMergeableObject","toString","call","arrayMergeOptions","cloneUnlessOtherwiseSpecified","merged","typed","keep","Component","admin","components","Field"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,SAAQ;AAE7C,SACEC,SAAS,EACTC,2BAA2B,EAC3BC,4BAA4B,EAC5BC,yBAAyB,QACpB,iBAAgB;AAEvBN,SAAS,aAAa;IACpBE,GAAG,oEAAoE;QACrE,MAAMK,SAASJ,UACb;YAAEK,GAAG;gBAAEC,GAAG;gBAAGC,GAAG;YAAE;YAAGC,GAAG;QAAE,GAC1B;YAAEH,GAAG;gBAAEE,GAAG;gBAAGE,GAAG;YAAE;YAAGC,GAAG;QAAE;QAG5BZ,OAAOM,QAAQO,aAAa,CAAC;YAAEN,GAAG;gBAAEC,GAAG;gBAAGC,GAAG;gBAAGE,GAAG;YAAE;YAAGD,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+BAA+B;IACtCE,GAAG,+DAA+D;QAChE,MAAMK,SAASH,4BACb;YAAEmB,MAAM;gBAAC;oBAAEf,GAAG;gBAAE;gBAAG;aAAI;QAAC,GACxB;YAAEe,MAAM;gBAAC;oBAAEd,GAAG;gBAAE;gBAAG;gBAAK;aAAI;QAAC;QAG/BR,OAAOM,QAAQO,aAAa,CAAC;YAAES,MAAM;gBAAC;oBAAEf,GAAG;oBAAGC,GAAG;gBAAE;gBAAG;gBAAK;gBAAK;aAAI;QAAC;IACvE;AACF;AAEAT,SAAS,gCAAgC;IACvCE,GAAG,8BAA8B;QAC/B,MAAM0D,YAAY,IAAM;QAExB,MAAMrD,SAASF,6BACb;YAAEwD,OAAO;gBAAEC,YAAY,CAAC;YAAE;QAAE,GAC5B;YAAED,OAAO;gBAAEC,YAAY;oBAAEC,OAAOH;gBAAU;YAAE;QAAE;QAGhD3D,OAAO,AAACM,OAAOsD,KAAK,CAASC,UAAU,CAACC,KAAK,EAAE1C,IAAI,CAACuC;IACtD;AACF"}
@@ -0,0 +1,27 @@
1
+ import type { SanitizedConfig } from '../config/types.js';
2
+ import type { DateFieldClient, FlattenedField } from '../fields/config/types.js';
3
+ import type { Operator } from '../types/constants.js';
4
+ export type DateOnlyConstraint = {
5
+ operator: 'greater_than_equal' | 'less_than';
6
+ value: Date;
7
+ };
8
+ export type DateOnlyComparison = {
9
+ constraints: DateOnlyConstraint[];
10
+ isNegated: boolean;
11
+ };
12
+ export declare const isDateOnlyFilter: ({ field, operator, }: {
13
+ field: DateFieldClient | FlattenedField;
14
+ operator: Operator;
15
+ }) => boolean;
16
+ export declare const isDateOnlyFilterValue: (value: unknown) => boolean;
17
+ /**
18
+ * Converts a date-only filter value into timestamp constraints in the field's configured timezone.
19
+ * Timestamp values and unsupported operators retain their existing comparison behavior.
20
+ */
21
+ export declare const getDateOnlyComparison: ({ config, field, operator, value, }: {
22
+ config: SanitizedConfig;
23
+ field: FlattenedField;
24
+ operator: Operator;
25
+ value: unknown;
26
+ }) => DateOnlyComparison | undefined;
27
+ //# sourceMappingURL=getDateOnlyComparison.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getDateOnlyComparison.d.ts","sourceRoot":"","sources":["../../src/utilities/getDateOnlyComparison.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAChF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAErD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,oBAAoB,GAAG,WAAW,CAAA;IAC5C,KAAK,EAAE,IAAI,CAAA;CACZ,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,WAAW,EAAE,kBAAkB,EAAE,CAAA;IACjC,SAAS,EAAE,OAAO,CAAA;CACnB,CAAA;AAmBD,eAAO,MAAM,gBAAgB,yBAG1B;IACD,KAAK,EAAE,eAAe,GAAG,cAAc,CAAA;IACvC,QAAQ,EAAE,QAAQ,CAAA;CACnB,KAAG,OAYH,CAAA;AAED,eAAO,MAAM,qBAAqB,UAAW,OAAO,KAAG,OAA2C,CAAA;AAElG;;;GAGG;AACH,eAAO,MAAM,qBAAqB,wCAK/B;IACD,MAAM,EAAE,eAAe,CAAA;IACvB,KAAK,EAAE,cAAc,CAAA;IACrB,QAAQ,EAAE,QAAQ,CAAA;IAClB,KAAK,EAAE,OAAO,CAAA;CACf,KAAG,kBAAkB,GAAG,SA2DxB,CAAA"}
@@ -0,0 +1,162 @@
1
+ const calendarDayPattern = /^(\d{4})-(\d{2})-(\d{2})$/;
2
+ const fixedOffsetPattern = /^([+-])(\d{2}):(\d{2})$/;
3
+ const supportedOperators = new Set([
4
+ 'equals',
5
+ 'greater_than',
6
+ 'greater_than_equal',
7
+ 'less_than',
8
+ 'less_than_equal',
9
+ 'not_equals'
10
+ ]);
11
+ export const isDateOnlyFilter = ({ field, operator })=>{
12
+ if (field.type !== 'date') {
13
+ return false;
14
+ }
15
+ const pickerAppearance = field.admin?.date?.pickerAppearance;
16
+ return supportedOperators.has(operator) && [
17
+ 'dayOnly',
18
+ 'default'
19
+ ].includes(pickerAppearance ?? 'default');
20
+ };
21
+ export const isDateOnlyFilterValue = (value)=>Boolean(parseCalendarDay(value));
22
+ /**
23
+ * Converts a date-only filter value into timestamp constraints in the field's configured timezone.
24
+ * Timestamp values and unsupported operators retain their existing comparison behavior.
25
+ */ export const getDateOnlyComparison = ({ config, field, operator, value })=>{
26
+ if (field.type !== 'date' || !isDateOnlyFilterValue(value) || !isDateOnlyFilter({
27
+ field,
28
+ operator
29
+ })) {
30
+ return undefined;
31
+ }
32
+ const date = parseCalendarDay(value);
33
+ const supportedTimezones = field.timezone ? typeof field.timezone === 'object' && field.timezone.supportedTimezones ? field.timezone.supportedTimezones : config.admin.timezones.supportedTimezones : undefined;
34
+ const timezone = (supportedTimezones?.length === 1 ? supportedTimezones[0]?.value : undefined) ?? (typeof field.timezone === 'object' ? field.timezone.defaultTimezone : field.timezone ? config.admin.timezones.defaultTimezone : undefined) ?? 'UTC';
35
+ const nextDate = addCalendarDay(date);
36
+ const start = getCalendarDayStart({
37
+ date,
38
+ timezone
39
+ });
40
+ const next = getCalendarDayStart({
41
+ date: nextDate,
42
+ timezone
43
+ });
44
+ if (operator === 'equals' || operator === 'not_equals') {
45
+ return {
46
+ constraints: [
47
+ {
48
+ operator: 'greater_than_equal',
49
+ value: start
50
+ },
51
+ {
52
+ operator: 'less_than',
53
+ value: next
54
+ }
55
+ ],
56
+ isNegated: operator === 'not_equals'
57
+ };
58
+ }
59
+ if (operator === 'greater_than' || operator === 'greater_than_equal') {
60
+ return {
61
+ constraints: [
62
+ {
63
+ operator: 'greater_than_equal',
64
+ value: operator === 'greater_than' ? next : start
65
+ }
66
+ ],
67
+ isNegated: false
68
+ };
69
+ }
70
+ return {
71
+ constraints: [
72
+ {
73
+ operator: 'less_than',
74
+ value: operator === 'less_than' ? start : next
75
+ }
76
+ ],
77
+ isNegated: false
78
+ };
79
+ };
80
+ const parseCalendarDay = (value)=>{
81
+ if (typeof value !== 'string') {
82
+ return undefined;
83
+ }
84
+ const match = calendarDayPattern.exec(value);
85
+ if (!match) {
86
+ return undefined;
87
+ }
88
+ const date = {
89
+ day: Number(match[3]),
90
+ month: Number(match[2]),
91
+ year: Number(match[1])
92
+ };
93
+ return isValidCalendarDay(date) ? date : undefined;
94
+ };
95
+ const addCalendarDay = ({ day, month, year })=>{
96
+ const next = createUTCDate({
97
+ day: day + 1,
98
+ month,
99
+ year
100
+ });
101
+ return {
102
+ day: next.getUTCDate(),
103
+ month: next.getUTCMonth() + 1,
104
+ year: next.getUTCFullYear()
105
+ };
106
+ };
107
+ const getCalendarDayStart = ({ date, timezone })=>{
108
+ const utcMidnight = createUTCDate(date).getTime();
109
+ const fixedOffset = fixedOffsetPattern.exec(timezone);
110
+ if (fixedOffset) {
111
+ const direction = fixedOffset[1] === '+' ? 1 : -1;
112
+ const offsetMinutes = direction * (Number(fixedOffset[2]) * 60 + Number(fixedOffset[3]));
113
+ return new Date(utcMidnight - offsetMinutes * 60_000);
114
+ }
115
+ const formatter = new Intl.DateTimeFormat('en-US', {
116
+ day: '2-digit',
117
+ era: 'short',
118
+ month: '2-digit',
119
+ timeZone: timezone,
120
+ year: 'numeric'
121
+ });
122
+ const target = toCalendarDayNumber(date);
123
+ let low = utcMidnight - 48 * 60 * 60 * 1000;
124
+ let high = utcMidnight + 48 * 60 * 60 * 1000;
125
+ while(low < high){
126
+ const midpoint = Math.floor((low + high) / 2);
127
+ if (getFormattedCalendarDayNumber({
128
+ formatter,
129
+ timestamp: midpoint
130
+ }) < target) {
131
+ low = midpoint + 1;
132
+ } else {
133
+ high = midpoint;
134
+ }
135
+ }
136
+ return new Date(low);
137
+ };
138
+ const getFormattedCalendarDayNumber = ({ formatter, timestamp })=>{
139
+ const parts = formatter.formatToParts(timestamp);
140
+ const year = Number(parts.find(({ type })=>type === 'year')?.value);
141
+ return toCalendarDayNumber({
142
+ day: Number(parts.find(({ type })=>type === 'day')?.value),
143
+ month: Number(parts.find(({ type })=>type === 'month')?.value),
144
+ year: parts.find(({ type })=>type === 'era')?.value === 'BC' ? 1 - year : year
145
+ });
146
+ };
147
+ const isValidCalendarDay = ({ day, month, year })=>{
148
+ const parsed = createUTCDate({
149
+ day,
150
+ month,
151
+ year
152
+ });
153
+ return parsed.getUTCFullYear() === year && parsed.getUTCMonth() === month - 1 && parsed.getUTCDate() === day;
154
+ };
155
+ const createUTCDate = ({ day, month, year })=>{
156
+ const date = new Date(0);
157
+ date.setUTCFullYear(year, month - 1, day);
158
+ return date;
159
+ };
160
+ const toCalendarDayNumber = ({ day, month, year })=>year * 10_000 + month * 100 + day;
161
+
162
+ //# sourceMappingURL=getDateOnlyComparison.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utilities/getDateOnlyComparison.ts"],"sourcesContent":["import type { SanitizedConfig } from '../config/types.js'\nimport type { DateFieldClient, FlattenedField } from '../fields/config/types.js'\nimport type { Operator } from '../types/constants.js'\n\nexport type DateOnlyConstraint = {\n operator: 'greater_than_equal' | 'less_than'\n value: Date\n}\n\nexport type DateOnlyComparison = {\n constraints: DateOnlyConstraint[]\n isNegated: boolean\n}\n\nconst calendarDayPattern = /^(\\d{4})-(\\d{2})-(\\d{2})$/\nconst fixedOffsetPattern = /^([+-])(\\d{2}):(\\d{2})$/\nconst supportedOperators = new Set<Operator>([\n 'equals',\n 'greater_than',\n 'greater_than_equal',\n 'less_than',\n 'less_than_equal',\n 'not_equals',\n])\n\ntype CalendarDay = {\n day: number\n month: number\n year: number\n}\n\nexport const isDateOnlyFilter = ({\n field,\n operator,\n}: {\n field: DateFieldClient | FlattenedField\n operator: Operator\n}): boolean => {\n if (field.type !== 'date') {\n return false\n }\n\n const pickerAppearance = (field.admin?.date as { pickerAppearance?: string } | undefined)\n ?.pickerAppearance\n\n return (\n supportedOperators.has(operator) &&\n ['dayOnly', 'default'].includes(pickerAppearance ?? 'default')\n )\n}\n\nexport const isDateOnlyFilterValue = (value: unknown): boolean => Boolean(parseCalendarDay(value))\n\n/**\n * Converts a date-only filter value into timestamp constraints in the field's configured timezone.\n * Timestamp values and unsupported operators retain their existing comparison behavior.\n */\nexport const getDateOnlyComparison = ({\n config,\n field,\n operator,\n value,\n}: {\n config: SanitizedConfig\n field: FlattenedField\n operator: Operator\n value: unknown\n}): DateOnlyComparison | undefined => {\n if (\n field.type !== 'date' ||\n !isDateOnlyFilterValue(value) ||\n !isDateOnlyFilter({ field, operator })\n ) {\n return undefined\n }\n\n const date = parseCalendarDay(value)!\n\n const supportedTimezones = field.timezone\n ? typeof field.timezone === 'object' && field.timezone.supportedTimezones\n ? field.timezone.supportedTimezones\n : config.admin.timezones.supportedTimezones\n : undefined\n const timezone =\n (supportedTimezones?.length === 1 ? supportedTimezones[0]?.value : undefined) ??\n (typeof field.timezone === 'object'\n ? field.timezone.defaultTimezone\n : field.timezone\n ? config.admin.timezones.defaultTimezone\n : undefined) ??\n 'UTC'\n const nextDate = addCalendarDay(date)\n const start = getCalendarDayStart({ date, timezone })\n const next = getCalendarDayStart({ date: nextDate, timezone })\n\n if (operator === 'equals' || operator === 'not_equals') {\n return {\n constraints: [\n { operator: 'greater_than_equal', value: start },\n { operator: 'less_than', value: next },\n ],\n isNegated: operator === 'not_equals',\n }\n }\n\n if (operator === 'greater_than' || operator === 'greater_than_equal') {\n return {\n constraints: [\n {\n operator: 'greater_than_equal',\n value: operator === 'greater_than' ? next : start,\n },\n ],\n isNegated: false,\n }\n }\n\n return {\n constraints: [\n {\n operator: 'less_than',\n value: operator === 'less_than' ? start : next,\n },\n ],\n isNegated: false,\n }\n}\n\nconst parseCalendarDay = (value: unknown): CalendarDay | undefined => {\n if (typeof value !== 'string') {\n return undefined\n }\n\n const match = calendarDayPattern.exec(value)\n\n if (!match) {\n return undefined\n }\n\n const date = {\n day: Number(match[3]),\n month: Number(match[2]),\n year: Number(match[1]),\n }\n\n return isValidCalendarDay(date) ? date : undefined\n}\n\nconst addCalendarDay = ({ day, month, year }: CalendarDay): CalendarDay => {\n const next = createUTCDate({ day: day + 1, month, year })\n\n return {\n day: next.getUTCDate(),\n month: next.getUTCMonth() + 1,\n year: next.getUTCFullYear(),\n }\n}\n\nconst getCalendarDayStart = ({ date, timezone }: { date: CalendarDay; timezone: string }): Date => {\n const utcMidnight = createUTCDate(date).getTime()\n const fixedOffset = fixedOffsetPattern.exec(timezone)\n\n if (fixedOffset) {\n const direction = fixedOffset[1] === '+' ? 1 : -1\n const offsetMinutes = direction * (Number(fixedOffset[2]) * 60 + Number(fixedOffset[3]))\n\n return new Date(utcMidnight - offsetMinutes * 60_000)\n }\n\n const formatter = new Intl.DateTimeFormat('en-US', {\n day: '2-digit',\n era: 'short',\n month: '2-digit',\n timeZone: timezone,\n year: 'numeric',\n })\n const target = toCalendarDayNumber(date)\n let low = utcMidnight - 48 * 60 * 60 * 1000\n let high = utcMidnight + 48 * 60 * 60 * 1000\n\n while (low < high) {\n const midpoint = Math.floor((low + high) / 2)\n\n if (getFormattedCalendarDayNumber({ formatter, timestamp: midpoint }) < target) {\n low = midpoint + 1\n } else {\n high = midpoint\n }\n }\n\n return new Date(low)\n}\n\nconst getFormattedCalendarDayNumber = ({\n formatter,\n timestamp,\n}: {\n formatter: Intl.DateTimeFormat\n timestamp: number\n}): number => {\n const parts = formatter.formatToParts(timestamp)\n const year = Number(parts.find(({ type }) => type === 'year')?.value)\n\n return toCalendarDayNumber({\n day: Number(parts.find(({ type }) => type === 'day')?.value),\n month: Number(parts.find(({ type }) => type === 'month')?.value),\n year: parts.find(({ type }) => type === 'era')?.value === 'BC' ? 1 - year : year,\n })\n}\n\nconst isValidCalendarDay = ({ day, month, year }: CalendarDay): boolean => {\n const parsed = createUTCDate({ day, month, year })\n\n return (\n parsed.getUTCFullYear() === year &&\n parsed.getUTCMonth() === month - 1 &&\n parsed.getUTCDate() === day\n )\n}\n\nconst createUTCDate = ({ day, month, year }: CalendarDay): Date => {\n const date = new Date(0)\n\n date.setUTCFullYear(year, month - 1, day)\n\n return date\n}\n\nconst toCalendarDayNumber = ({ day, month, year }: CalendarDay): number =>\n year * 10_000 + month * 100 + day\n"],"names":["calendarDayPattern","fixedOffsetPattern","supportedOperators","Set","isDateOnlyFilter","field","operator","type","pickerAppearance","admin","date","has","includes","isDateOnlyFilterValue","value","Boolean","parseCalendarDay","getDateOnlyComparison","config","undefined","supportedTimezones","timezone","timezones","length","defaultTimezone","nextDate","addCalendarDay","start","getCalendarDayStart","next","constraints","isNegated","match","exec","day","Number","month","year","isValidCalendarDay","createUTCDate","getUTCDate","getUTCMonth","getUTCFullYear","utcMidnight","getTime","fixedOffset","direction","offsetMinutes","Date","formatter","Intl","DateTimeFormat","era","timeZone","target","toCalendarDayNumber","low","high","midpoint","Math","floor","getFormattedCalendarDayNumber","timestamp","parts","formatToParts","find","parsed","setUTCFullYear"],"mappings":"AAcA,MAAMA,qBAAqB;AAC3B,MAAMC,qBAAqB;AAC3B,MAAMC,qBAAqB,IAAIC,IAAc;IAC3C;IACA;IACA;IACA;IACA;IACA;CACD;AAQD,OAAO,MAAMC,mBAAmB,CAAC,EAC/BC,KAAK,EACLC,QAAQ,EAIT;IACC,IAAID,MAAME,IAAI,KAAK,QAAQ;QACzB,OAAO;IACT;IAEA,MAAMC,mBAAoBH,MAAMI,KAAK,EAAEC,MACnCF;IAEJ,OACEN,mBAAmBS,GAAG,CAACL,aACvB;QAAC;QAAW;KAAU,CAACM,QAAQ,CAACJ,oBAAoB;AAExD,EAAC;AAED,OAAO,MAAMK,wBAAwB,CAACC,QAA4BC,QAAQC,iBAAiBF,QAAO;AAElG;;;CAGC,GACD,OAAO,MAAMG,wBAAwB,CAAC,EACpCC,MAAM,EACNb,KAAK,EACLC,QAAQ,EACRQ,KAAK,EAMN;IACC,IACET,MAAME,IAAI,KAAK,UACf,CAACM,sBAAsBC,UACv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Ae,GAC5DA,OAAO,SAASD,QAAQ,MAAMF"}
@@ -1 +1 @@
1
- {"version":3,"file":"getFeatureInfo.d.ts","sourceRoot":"","sources":["../../../../src/utilities/telemetry/featureInfo/getFeatureInfo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAE/D,OAAO,KAAK,EAAE,WAAW,EAAmB,MAAM,YAAY,CAAA;AAI9D,eAAO,MAAM,cAAc,WAAY,eAAe,KAAG,WAoBxD,CAAA"}
1
+ {"version":3,"file":"getFeatureInfo.d.ts","sourceRoot":"","sources":["../../../../src/utilities/telemetry/featureInfo/getFeatureInfo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAE/D,OAAO,KAAK,EAAE,WAAW,EAAmB,MAAM,YAAY,CAAA;AAM9D,eAAO,MAAM,cAAc,WAAY,eAAe,KAAG,WAqBxD,CAAA"}
@@ -1,4 +1,6 @@
1
1
  import { defaultUserCollection } from '../../../auth/defaultUser.js';
2
+ import { traverseFields } from '../../traverseFields.js';
3
+ import { getTelemetryWidgetType } from '../widgetType.js';
2
4
  export const getFeatureInfo = (config)=>{
3
5
  const telemetryConfig = sanitizeTelemetryConfig(config);
4
6
  return Object.assign({}, ...[
@@ -13,7 +15,8 @@ export const getFeatureInfo = (config)=>{
13
15
  collectTrash,
14
16
  collectUploadAndMedia,
15
17
  collectVersionsAndDrafts,
16
- collectRichTextFeatures
18
+ collectRichTextFeatures,
19
+ collectRichTextFieldCount
17
20
  ].map((collect)=>safelyCollect(()=>collect(telemetryConfig))));
18
21
  };
19
22
  const safelyCollect = (collect)=>{
@@ -23,8 +26,6 @@ const safelyCollect = (collect)=>{
23
26
  return {};
24
27
  }
25
28
  };
26
- // sanitization adds 3 system widgets that we need to account for
27
- const SYSTEM_WIDGET_COUNT = 3;
28
29
  const SYSTEM_COLLECTION_SLUGS = [
29
30
  'payload-locked-documents',
30
31
  'payload-migrations',
@@ -78,13 +79,21 @@ const SYSTEM_GLOBAL_SLUGS = new Set([
78
79
  return config;
79
80
  }
80
81
  };
81
- const collectAdminCustomization = (config)=>({
82
+ const collectAdminCustomization = (config)=>{
83
+ const widgetTypes = (config.admin?.dashboard?.widgets ?? []).map(({ Component })=>getTelemetryWidgetType({
84
+ component: Component
85
+ })).filter((type)=>type !== null);
86
+ return {
82
87
  adminCustomization: {
83
88
  customAdminComponentCount: countRootAdminComponents(config),
84
89
  customAdminViewCount: Object.keys(config.admin?.components?.views ?? {}).length,
85
- customDashboardWidgetCount: Math.max(0, (config.admin?.dashboard?.widgets?.length ?? 0) - SYSTEM_WIDGET_COUNT)
90
+ customDashboardWidgetCount: widgetTypes.filter((type)=>type === 'custom').length,
91
+ widgetTypes: [
92
+ ...new Set(widgetTypes)
93
+ ].sort()
86
94
  }
87
- });
95
+ };
96
+ };
88
97
  const collectAuthentication = (config)=>{
89
98
  const authCollections = (config.collections ?? []).filter(({ auth })=>Boolean(auth));
90
99
  return {
@@ -107,7 +116,6 @@ const collectBasicDenominators = (config)=>({
107
116
  });
108
117
  const collectI18n = (config)=>({
109
118
  i18n: {
110
- hasCustomAdminTranslations: Object.keys(config.i18n?.translations ?? {}).length > 0,
111
119
  supportedAdminLanguageCount: config.i18n?.supportedLanguages ? Object.keys(config.i18n.supportedLanguages).length : 1
112
120
  }
113
121
  });
@@ -171,6 +179,32 @@ const collectRichTextFeatures = (config)=>{
171
179
  ].filter((f)=>featureSet.has(f))
172
180
  };
173
181
  };
182
+ const collectRichTextFieldCount = (config)=>{
183
+ const visitedFields = new Set();
184
+ let fieldCount = 0;
185
+ for (const entity of [
186
+ ...config.collections ?? [],
187
+ ...config.globals ?? []
188
+ ]){
189
+ traverseFields({
190
+ callback: ({ field, next })=>{
191
+ // Skip shared and recursive block definitions already counted.
192
+ if (visitedFields.has(field)) {
193
+ return next?.();
194
+ }
195
+ visitedFields.add(field);
196
+ if (field.type === 'richText') {
197
+ fieldCount++;
198
+ }
199
+ },
200
+ config,
201
+ fields: entity.fields
202
+ });
203
+ }
204
+ return {
205
+ richTextFieldCount: fieldCount
206
+ };
207
+ };
174
208
  const collectTrash = (config)=>({
175
209
  trashCollectionCount: (config.collections ?? []).filter(({ trash })=>Boolean(trash)).length
176
210
  });