payload 3.70.0 → 3.71.0-internal-debug.cd77e5d

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/collections/config/types.d.ts +9 -2
  2. package/dist/collections/config/types.d.ts.map +1 -1
  3. package/dist/collections/config/types.js.map +1 -1
  4. package/dist/collections/operations/local/find.d.ts +7 -3
  5. package/dist/collections/operations/local/find.d.ts.map +1 -1
  6. package/dist/collections/operations/local/find.js.map +1 -1
  7. package/dist/config/sanitize.d.ts.map +1 -1
  8. package/dist/config/sanitize.js +6 -8
  9. package/dist/config/sanitize.js.map +1 -1
  10. package/dist/config/types.d.ts +7 -0
  11. package/dist/config/types.d.ts.map +1 -1
  12. package/dist/config/types.js.map +1 -1
  13. package/dist/fields/baseFields/timezone/baseField.d.ts +4 -1
  14. package/dist/fields/baseFields/timezone/baseField.d.ts.map +1 -1
  15. package/dist/fields/baseFields/timezone/baseField.js +2 -1
  16. package/dist/fields/baseFields/timezone/baseField.js.map +1 -1
  17. package/dist/fields/config/client.d.ts.map +1 -1
  18. package/dist/fields/config/client.js +10 -0
  19. package/dist/fields/config/client.js.map +1 -1
  20. package/dist/fields/config/sanitize.d.ts.map +1 -1
  21. package/dist/fields/config/sanitize.js +14 -1
  22. package/dist/fields/config/sanitize.js.map +1 -1
  23. package/dist/fields/config/types.d.ts +33 -2
  24. package/dist/fields/config/types.d.ts.map +1 -1
  25. package/dist/fields/config/types.js.map +1 -1
  26. package/dist/fields/hooks/afterRead/index.d.ts.map +1 -1
  27. package/dist/fields/hooks/afterRead/index.js +1 -0
  28. package/dist/fields/hooks/afterRead/index.js.map +1 -1
  29. package/dist/fields/hooks/afterRead/promise.d.ts +9 -1
  30. package/dist/fields/hooks/afterRead/promise.d.ts.map +1 -1
  31. package/dist/fields/hooks/afterRead/promise.js +15 -2
  32. package/dist/fields/hooks/afterRead/promise.js.map +1 -1
  33. package/dist/fields/hooks/afterRead/traverseFields.d.ts +9 -1
  34. package/dist/fields/hooks/afterRead/traverseFields.d.ts.map +1 -1
  35. package/dist/fields/hooks/afterRead/traverseFields.js +2 -1
  36. package/dist/fields/hooks/afterRead/traverseFields.js.map +1 -1
  37. package/dist/index.bundled.d.ts +108 -23
  38. package/dist/index.d.ts +7 -2
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +1 -0
  41. package/dist/index.js.map +1 -1
  42. package/dist/queues/config/types/index.d.ts +8 -10
  43. package/dist/queues/config/types/index.d.ts.map +1 -1
  44. package/dist/queues/config/types/index.js.map +1 -1
  45. package/dist/queues/config/types/taskTypes.d.ts +16 -6
  46. package/dist/queues/config/types/taskTypes.d.ts.map +1 -1
  47. package/dist/queues/config/types/taskTypes.js.map +1 -1
  48. package/dist/queues/config/types/workflowTypes.d.ts +2 -2
  49. package/dist/queues/config/types/workflowTypes.d.ts.map +1 -1
  50. package/dist/queues/config/types/workflowTypes.js.map +1 -1
  51. package/dist/queues/errors/index.d.ts +5 -6
  52. package/dist/queues/errors/index.d.ts.map +1 -1
  53. package/dist/queues/errors/index.js +6 -5
  54. package/dist/queues/errors/index.js.map +1 -1
  55. package/dist/queues/operations/runJobs/index.d.ts +1 -1
  56. package/dist/queues/operations/runJobs/index.d.ts.map +1 -1
  57. package/dist/queues/operations/runJobs/index.js +28 -6
  58. package/dist/queues/operations/runJobs/index.js.map +1 -1
  59. package/dist/queues/operations/runJobs/runJob/getRunTaskFunction.d.ts.map +1 -1
  60. package/dist/queues/operations/runJobs/runJob/getRunTaskFunction.js +5 -1
  61. package/dist/queues/operations/runJobs/runJob/getRunTaskFunction.js.map +1 -1
  62. package/dist/queues/operations/runJobs/runJob/getUpdateJobFunction.js +1 -3
  63. package/dist/queues/operations/runJobs/runJob/getUpdateJobFunction.js.map +1 -1
  64. package/dist/types/index.d.ts +3 -1
  65. package/dist/types/index.d.ts.map +1 -1
  66. package/dist/types/index.js.map +1 -1
  67. package/dist/utilities/configToJSONSchema.d.ts.map +1 -1
  68. package/dist/utilities/configToJSONSchema.js +14 -1
  69. package/dist/utilities/configToJSONSchema.js.map +1 -1
  70. package/dist/utilities/isolateObjectProperty.d.ts.map +1 -1
  71. package/dist/utilities/isolateObjectProperty.js +7 -4
  72. package/dist/utilities/isolateObjectProperty.js.map +1 -1
  73. package/dist/utilities/isolateObjectProperty.spec.js +120 -0
  74. package/dist/utilities/isolateObjectProperty.spec.js.map +1 -0
  75. package/dist/utilities/optionsAreEqual.d.ts +7 -0
  76. package/dist/utilities/optionsAreEqual.d.ts.map +1 -0
  77. package/dist/utilities/optionsAreEqual.js +35 -0
  78. package/dist/utilities/optionsAreEqual.js.map +1 -0
  79. package/dist/utilities/optionsAreEqual.spec.js +319 -0
  80. package/dist/utilities/optionsAreEqual.spec.js.map +1 -0
  81. package/dist/utilities/validateTimezones.d.ts +20 -0
  82. package/dist/utilities/validateTimezones.d.ts.map +1 -0
  83. package/dist/utilities/validateTimezones.js +76 -0
  84. package/dist/utilities/validateTimezones.js.map +1 -0
  85. package/dist/utilities/validateTimezones.spec.js +493 -0
  86. package/dist/utilities/validateTimezones.spec.js.map +1 -0
  87. package/package.json +2 -2
@@ -0,0 +1,493 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { InvalidConfiguration } from '../errors/index.js';
3
+ import { validateTimezones } from './validateTimezones.js';
4
+ describe('validateTimezones', ()=>{
5
+ describe('valid timezones', ()=>{
6
+ it('should accept UTC timezone', ()=>{
7
+ expect(()=>validateTimezones({
8
+ timezones: [
9
+ {
10
+ label: 'UTC',
11
+ value: 'UTC'
12
+ }
13
+ ]
14
+ })).not.toThrow();
15
+ });
16
+ it.each([
17
+ 'America/New_York',
18
+ 'America/Los_Angeles',
19
+ 'America/Chicago',
20
+ 'Europe/London',
21
+ 'Europe/Paris',
22
+ 'Europe/Berlin',
23
+ 'Asia/Tokyo',
24
+ 'Asia/Shanghai',
25
+ 'Asia/Singapore',
26
+ 'Australia/Sydney',
27
+ 'Pacific/Auckland'
28
+ ])('should accept valid IANA timezone: %s', (timezone)=>{
29
+ expect(()=>validateTimezones({
30
+ timezones: [
31
+ {
32
+ label: timezone,
33
+ value: timezone
34
+ }
35
+ ]
36
+ })).not.toThrow();
37
+ });
38
+ it('should accept multiple valid timezones', ()=>{
39
+ expect(()=>validateTimezones({
40
+ timezones: [
41
+ {
42
+ label: 'New York',
43
+ value: 'America/New_York'
44
+ },
45
+ {
46
+ label: 'London',
47
+ value: 'Europe/London'
48
+ },
49
+ {
50
+ label: 'Tokyo',
51
+ value: 'Asia/Tokyo'
52
+ }
53
+ ]
54
+ })).not.toThrow();
55
+ });
56
+ it('should accept empty array', ()=>{
57
+ expect(()=>validateTimezones({
58
+ timezones: []
59
+ })).not.toThrow();
60
+ });
61
+ it('should accept undefined timezones', ()=>{
62
+ expect(()=>validateTimezones({
63
+ timezones: undefined
64
+ })).not.toThrow();
65
+ });
66
+ });
67
+ describe('invalid timezones', ()=>{
68
+ it('should throw for completely invalid timezone', ()=>{
69
+ expect(()=>validateTimezones({
70
+ timezones: [
71
+ {
72
+ label: 'Invalid',
73
+ value: 'Invalid/Timezone'
74
+ }
75
+ ]
76
+ })).toThrow(InvalidConfiguration);
77
+ });
78
+ it('should throw for made up timezone', ()=>{
79
+ expect(()=>validateTimezones({
80
+ timezones: [
81
+ {
82
+ label: 'Fake',
83
+ value: 'Fake/Place'
84
+ }
85
+ ]
86
+ })).toThrow(InvalidConfiguration);
87
+ });
88
+ it('should throw for empty string timezone value', ()=>{
89
+ expect(()=>validateTimezones({
90
+ timezones: [
91
+ {
92
+ label: 'Empty',
93
+ value: ''
94
+ }
95
+ ]
96
+ })).toThrow(InvalidConfiguration);
97
+ });
98
+ it('should throw for random string timezone', ()=>{
99
+ expect(()=>validateTimezones({
100
+ timezones: [
101
+ {
102
+ label: 'Random',
103
+ value: 'not-a-timezone'
104
+ }
105
+ ]
106
+ })).toThrow(InvalidConfiguration);
107
+ });
108
+ });
109
+ describe('misspelled timezones', ()=>{
110
+ it.each([
111
+ [
112
+ 'Asian/Tokyo',
113
+ 'Asia/Tokyo'
114
+ ],
115
+ [
116
+ 'Asian/Shanghai',
117
+ 'Asia/Shanghai'
118
+ ],
119
+ [
120
+ 'Asian/Singapore',
121
+ 'Asia/Singapore'
122
+ ],
123
+ [
124
+ 'Asian/Seoul',
125
+ 'Asia/Seoul'
126
+ ],
127
+ [
128
+ 'Asian/Bangkok',
129
+ 'Asia/Bangkok'
130
+ ]
131
+ ])('should throw for misspelled "Asian/" instead of "Asia/": %s', (misspelled)=>{
132
+ expect(()=>validateTimezones({
133
+ timezones: [
134
+ {
135
+ label: misspelled,
136
+ value: misspelled
137
+ }
138
+ ]
139
+ })).toThrow(InvalidConfiguration);
140
+ });
141
+ it.each([
142
+ [
143
+ 'Americas/New_York',
144
+ 'America/New_York'
145
+ ],
146
+ [
147
+ 'Americas/Los_Angeles',
148
+ 'America/Los_Angeles'
149
+ ],
150
+ [
151
+ 'Americas/Chicago',
152
+ 'America/Chicago'
153
+ ]
154
+ ])('should throw for misspelled "Americas/" instead of "America/": %s', (misspelled)=>{
155
+ expect(()=>validateTimezones({
156
+ timezones: [
157
+ {
158
+ label: misspelled,
159
+ value: misspelled
160
+ }
161
+ ]
162
+ })).toThrow(InvalidConfiguration);
163
+ });
164
+ it.each([
165
+ [
166
+ 'Europ/London',
167
+ 'Europe/London'
168
+ ],
169
+ [
170
+ 'Euorpe/Paris',
171
+ 'Europe/Paris'
172
+ ],
173
+ [
174
+ 'Europa/Berlin',
175
+ 'Europe/Berlin'
176
+ ]
177
+ ])('should throw for misspelled Europe region: %s', (misspelled)=>{
178
+ expect(()=>validateTimezones({
179
+ timezones: [
180
+ {
181
+ label: misspelled,
182
+ value: misspelled
183
+ }
184
+ ]
185
+ })).toThrow(InvalidConfiguration);
186
+ });
187
+ it.each([
188
+ [
189
+ 'Australa/Sydney',
190
+ 'Australia/Sydney'
191
+ ],
192
+ [
193
+ 'Austrlia/Melbourne',
194
+ 'Australia/Melbourne'
195
+ ]
196
+ ])('should throw for misspelled Australia region: %s', (misspelled)=>{
197
+ expect(()=>validateTimezones({
198
+ timezones: [
199
+ {
200
+ label: misspelled,
201
+ value: misspelled
202
+ }
203
+ ]
204
+ })).toThrow(InvalidConfiguration);
205
+ });
206
+ it.each([
207
+ [
208
+ 'Pacific/Aukland',
209
+ 'Pacific/Auckland'
210
+ ],
211
+ [
212
+ 'Pacfic/Auckland',
213
+ 'Pacific/Auckland'
214
+ ]
215
+ ])('should throw for misspelled Pacific region or city: %s', (misspelled)=>{
216
+ expect(()=>validateTimezones({
217
+ timezones: [
218
+ {
219
+ label: misspelled,
220
+ value: misspelled
221
+ }
222
+ ]
223
+ })).toThrow(InvalidConfiguration);
224
+ });
225
+ it.each([
226
+ 'America/NewYork',
227
+ 'America/New-York',
228
+ 'America/newyork'
229
+ ])('should throw for incorrectly formatted city name: %s', (misspelled)=>{
230
+ expect(()=>validateTimezones({
231
+ timezones: [
232
+ {
233
+ label: misspelled,
234
+ value: misspelled
235
+ }
236
+ ]
237
+ })).toThrow(InvalidConfiguration);
238
+ });
239
+ // Note: Intl API is case-insensitive, so lowercase versions like 'america/new_york' are valid
240
+ it('should accept lowercase timezone (Intl API is case-insensitive)', ()=>{
241
+ expect(()=>validateTimezones({
242
+ timezones: [
243
+ {
244
+ label: 'lowercase',
245
+ value: 'america/new_york'
246
+ }
247
+ ]
248
+ })).not.toThrow();
249
+ });
250
+ });
251
+ describe('error messages', ()=>{
252
+ it('should include timezone value in error message', ()=>{
253
+ expect(()=>validateTimezones({
254
+ timezones: [
255
+ {
256
+ label: 'Bad',
257
+ value: 'Invalid/Zone'
258
+ }
259
+ ]
260
+ })).toThrow(/Invalid\/Zone/);
261
+ });
262
+ it('should include source in error message when provided', ()=>{
263
+ expect(()=>validateTimezones({
264
+ source: 'admin.timezones.supportedTimezones',
265
+ timezones: [
266
+ {
267
+ label: 'Bad',
268
+ value: 'Invalid/Zone'
269
+ }
270
+ ]
271
+ })).toThrow(/admin\.timezones\.supportedTimezones/);
272
+ });
273
+ it('should include field name in source for field-level errors', ()=>{
274
+ expect(()=>validateTimezones({
275
+ source: 'field "publishedAt" timezone.supportedTimezones',
276
+ timezones: [
277
+ {
278
+ label: 'Bad',
279
+ value: 'Asian/Tokyo'
280
+ }
281
+ ]
282
+ })).toThrow(/field "publishedAt"/);
283
+ });
284
+ });
285
+ describe('mixed valid and invalid timezones', ()=>{
286
+ it('should throw when array contains at least one invalid timezone', ()=>{
287
+ expect(()=>validateTimezones({
288
+ timezones: [
289
+ {
290
+ label: 'New York',
291
+ value: 'America/New_York'
292
+ },
293
+ {
294
+ label: 'Invalid',
295
+ value: 'Asian/Tokyo'
296
+ },
297
+ {
298
+ label: 'London',
299
+ value: 'Europe/London'
300
+ }
301
+ ]
302
+ })).toThrow(InvalidConfiguration);
303
+ });
304
+ it('should throw on first invalid timezone encountered', ()=>{
305
+ expect(()=>validateTimezones({
306
+ timezones: [
307
+ {
308
+ label: 'First Invalid',
309
+ value: 'Fake/First'
310
+ },
311
+ {
312
+ label: 'Second Invalid',
313
+ value: 'Fake/Second'
314
+ }
315
+ ]
316
+ })).toThrow(/Fake\/First/);
317
+ });
318
+ });
319
+ describe('UTC offset timezones', ()=>{
320
+ describe('valid UTC offsets', ()=>{
321
+ it.each([
322
+ '+00:00',
323
+ '-00:00',
324
+ '+05:30',
325
+ '-08:00',
326
+ '+12:00',
327
+ '-12:00',
328
+ '+14:00',
329
+ '+09:30',
330
+ '+05:45'
331
+ ])('should accept valid HH:mm format offset: %s', (offset)=>{
332
+ expect(()=>validateTimezones({
333
+ timezones: [
334
+ {
335
+ label: `UTC${offset}`,
336
+ value: offset
337
+ }
338
+ ]
339
+ })).not.toThrow();
340
+ });
341
+ it('should accept mixed IANA and offset timezones', ()=>{
342
+ expect(()=>validateTimezones({
343
+ timezones: [
344
+ {
345
+ label: 'New York',
346
+ value: 'America/New_York'
347
+ },
348
+ {
349
+ label: 'UTC+5:30',
350
+ value: '+05:30'
351
+ },
352
+ {
353
+ label: 'UTC',
354
+ value: 'UTC'
355
+ },
356
+ {
357
+ label: 'UTC-8',
358
+ value: '-08:00'
359
+ }
360
+ ]
361
+ })).not.toThrow();
362
+ });
363
+ });
364
+ describe('invalid UTC offsets', ()=>{
365
+ it.each([
366
+ '+0530',
367
+ '-0800',
368
+ '+0000',
369
+ '+1200',
370
+ '+00',
371
+ '-08',
372
+ '+9',
373
+ '-5'
374
+ ])('should throw for non-HH:mm format offset: %s', (offset)=>{
375
+ expect(()=>validateTimezones({
376
+ timezones: [
377
+ {
378
+ label: `Invalid ${offset}`,
379
+ value: offset
380
+ }
381
+ ]
382
+ })).toThrow(InvalidConfiguration);
383
+ });
384
+ it.each([
385
+ '+15:00',
386
+ '-13:00',
387
+ '+25:00',
388
+ '-20:00'
389
+ ])('should throw for out of range hour offset: %s', (offset)=>{
390
+ expect(()=>validateTimezones({
391
+ timezones: [
392
+ {
393
+ label: `Invalid ${offset}`,
394
+ value: offset
395
+ }
396
+ ]
397
+ })).toThrow(InvalidConfiguration);
398
+ });
399
+ it.each([
400
+ '+05:60',
401
+ '-08:99',
402
+ '+12:75',
403
+ '+00:61'
404
+ ])('should throw for invalid minutes in offset: %s', (offset)=>{
405
+ expect(()=>validateTimezones({
406
+ timezones: [
407
+ {
408
+ label: `Invalid ${offset}`,
409
+ value: offset
410
+ }
411
+ ]
412
+ })).toThrow(InvalidConfiguration);
413
+ });
414
+ it.each([
415
+ '05:30',
416
+ '0800',
417
+ '12',
418
+ '530'
419
+ ])('should throw for offset missing sign: %s', (offset)=>{
420
+ expect(()=>validateTimezones({
421
+ timezones: [
422
+ {
423
+ label: `Missing sign ${offset}`,
424
+ value: offset
425
+ }
426
+ ]
427
+ })).toThrow(InvalidConfiguration);
428
+ });
429
+ it.each([
430
+ '++05:30',
431
+ '--08:00',
432
+ '+-05:30',
433
+ '-+08:00'
434
+ ])('should throw for malformed sign in offset: %s', (offset)=>{
435
+ expect(()=>validateTimezones({
436
+ timezones: [
437
+ {
438
+ label: `Malformed ${offset}`,
439
+ value: offset
440
+ }
441
+ ]
442
+ })).toThrow(InvalidConfiguration);
443
+ });
444
+ it.each([
445
+ '+ 05:30',
446
+ '- 08:00',
447
+ '+05 :30',
448
+ '+05: 30'
449
+ ])('should throw for offset with spaces: %s', (offset)=>{
450
+ expect(()=>validateTimezones({
451
+ timezones: [
452
+ {
453
+ label: `Spaced ${offset}`,
454
+ value: offset
455
+ }
456
+ ]
457
+ })).toThrow(InvalidConfiguration);
458
+ });
459
+ it.each([
460
+ '+5:',
461
+ '+:30',
462
+ ':',
463
+ '+:',
464
+ '-:'
465
+ ])('should throw for incomplete offset format: %s', (offset)=>{
466
+ expect(()=>validateTimezones({
467
+ timezones: [
468
+ {
469
+ label: `Incomplete ${offset}`,
470
+ value: offset
471
+ }
472
+ ]
473
+ })).toThrow(InvalidConfiguration);
474
+ });
475
+ it.each([
476
+ '+05:30:00',
477
+ '+05:30:30',
478
+ '-08:00:00'
479
+ ])('should throw for offset with seconds: %s', (offset)=>{
480
+ expect(()=>validateTimezones({
481
+ timezones: [
482
+ {
483
+ label: `With seconds ${offset}`,
484
+ value: offset
485
+ }
486
+ ]
487
+ })).toThrow(InvalidConfiguration);
488
+ });
489
+ });
490
+ });
491
+ });
492
+
493
+ //# sourceMappingURL=validateTimezones.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utilities/validateTimezones.spec.ts"],"sourcesContent":["import { describe, expect, it } from 'vitest'\n\nimport { InvalidConfiguration } from '../errors/index.js'\nimport { validateTimezones } from './validateTimezones.js'\n\ndescribe('validateTimezones', () => {\n describe('valid timezones', () => {\n it('should accept UTC timezone', () => {\n expect(() =>\n validateTimezones({\n timezones: [{ label: 'UTC', value: 'UTC' }],\n }),\n ).not.toThrow()\n })\n\n it.each([\n 'America/New_York',\n 'America/Los_Angeles',\n 'America/Chicago',\n 'Europe/London',\n 'Europe/Paris',\n 'Europe/Berlin',\n 'Asia/Tokyo',\n 'Asia/Shanghai',\n 'Asia/Singapore',\n 'Australia/Sydney',\n 'Pacific/Auckland',\n ])('should accept valid IANA timezone: %s', (timezone) => {\n expect(() =>\n validateTimezones({\n timezones: [{ label: timezone, value: timezone }],\n }),\n ).not.toThrow()\n })\n\n it('should accept multiple valid timezones', () => {\n expect(() =>\n validateTimezones({\n timezones: [\n { label: 'New York', value: 'America/New_York' },\n { label: 'London', value: 'Europe/London' },\n { label: 'Tokyo', value: 'Asia/Tokyo' },\n ],\n }),\n ).not.toThrow()\n })\n\n it('should accept empty array', () => {\n expect(() =>\n validateTimezones({\n timezones: [],\n }),\n ).not.toThrow()\n })\n\n it('should accept undefined timezones', () => {\n expect(() =>\n validateTimezones({\n timezones: undefined,\n }),\n ).not.toThrow()\n })\n })\n\n describe('invalid timezones', () => {\n it('should throw for completely invalid timezone', () => {\n expect(() =>\n validateTimezones({\n timezones: [{ label: 'Invalid', value: 'Invalid/Timezone' }],\n }),\n ).toThrow(InvalidConfiguration)\n })\n\n it('should throw for made up timezone', () => {\n expect(() =>\n validateTimezones({\n timezones: [{ label: 'Fake', value: 'Fake/Place' }],\n }),\n ).toThrow(InvalidConfiguration)\n })\n\n it('should throw for empty string timezone value', () => {\n expect(() =>\n validateTimezones({\n timezones: [{ label: 'Empty', value: '' }],\n }),\n ).toThrow(InvalidConfiguration)\n })\n\n it('should throw for random string timezone', () => {\n expect(() =>\n validateTimezones({\n timezones: [{ label: 'Random', value: 'not-a-timezone' }],\n }),\n ).toThrow(InvalidConfiguration)\n })\n })\n\n describe('misspelled timezones', () => {\n it.each([\n ['Asian/Tokyo', 'Asia/Tokyo'],\n ['Asian/Shanghai', 'Asia/Shanghai'],\n ['Asian/Singapore', 'Asia/Singapore'],\n ['Asian/Seoul', 'Asia/Seoul'],\n ['Asian/Bangkok', 'Asia/Bangkok'],\n ])('should throw for misspelled \"Asian/\" instead of \"Asia/\": %s', (misspelled) => {\n expect(() =>\n validateTimezones({\n timezones: [{ label: misspelled, value: misspelled }],\n }),\n ).toThrow(InvalidConfiguration)\n })\n\n it.each([\n ['Americas/New_York', 'America/New_York'],\n ['Americas/Los_Angeles', 'America/Los_Angeles'],\n ['Americas/Chicago', 'America/Chicago'],\n ])('should throw for misspelled \"Americas/\" instead of \"America/\": %s', (misspelled) => {\n expect(() =>\n validateTimezones({\n timezones: [{ label: misspelled, value: misspelled }],\n }),\n ).toThrow(InvalidConfiguration)\n })\n\n it.each([\n ['Europ/London', 'Europe/London'],\n ['Euorpe/Paris', 'Europe/Paris'],\n ['Europa/Berlin', 'Europe/Berlin'],\n ])('should throw for misspelled Europe region: %s', (misspelled) => {\n expect(() =>\n validateTimezones({\n timezones: [{ label: misspelled, value: misspelled }],\n }),\n ).toThrow(InvalidConfiguration)\n })\n\n it.each([\n ['Australa/Sydney', 'Australia/Sydney'],\n ['Austrlia/Melbourne', 'Australia/Melbourne'],\n ])('should throw for misspelled Australia region: %s', (misspelled) => {\n expect(() =>\n validateTimezones({\n timezones: [{ label: misspelled, value: misspelled }],\n }),\n ).toThrow(InvalidConfiguration)\n })\n\n it.each([\n ['Pacific/Aukland', 'Pacific/Auckland'],\n ['Pacfic/Auckland', 'Pacific/Auckland'],\n ])('should throw for misspelled Pacific region or city: %s', (misspelled) => {\n expect(() =>\n validateTimezones({\n timezones: [{ label: misspelled, value: misspelled }],\n }),\n ).toThrow(InvalidConfiguration)\n })\n\n it.each([\n 'America/NewYork', // missing underscore\n 'America/New-York', // hyphen instead of underscore\n 'America/newyork', // missing underscore and wrong case for city\n ])('should throw for incorrectly formatted city name: %s', (misspelled) => {\n expect(() =>\n validateTimezones({\n timezones: [{ label: misspelled, value: misspelled }],\n }),\n ).toThrow(InvalidConfiguration)\n })\n\n // Note: Intl API is case-insensitive, so lowercase versions like 'america/new_york' are valid\n it('should accept lowercase timezone (Intl API is case-insensitive)', () => {\n expect(() =>\n validateTimezones({\n timezones: [{ label: 'lowercase', value: 'america/new_york' }],\n }),\n ).not.toThrow()\n })\n })\n\n describe('error messages', () => {\n it('should include timezone value in error message', () => {\n expect(() =>\n validateTimezones({\n timezones: [{ label: 'Bad', value: 'Invalid/Zone' }],\n }),\n ).toThrow(/Invalid\\/Zone/)\n })\n\n it('should include source in error message when provided', () => {\n expect(() =>\n validateTimezones({\n source: 'admin.timezones.supportedTimezones',\n timezones: [{ label: 'Bad', value: 'Invalid/Zone' }],\n }),\n ).toThrow(/admin\\.timezones\\.supportedTimezones/)\n })\n\n it('should include field name in source for field-level errors', () => {\n expect(() =>\n validateTimezones({\n source: 'field \"publishedAt\" timezone.supportedTimezones',\n timezones: [{ label: 'Bad', value: 'Asian/Tokyo' }],\n }),\n ).toThrow(/field \"publishedAt\"/)\n })\n })\n\n describe('mixed valid and invalid timezones', () => {\n it('should throw when array contains at least one invalid timezone', () => {\n expect(() =>\n validateTimezones({\n timezones: [\n { label: 'New York', value: 'America/New_York' },\n { label: 'Invalid', value: 'Asian/Tokyo' }, // misspelled\n { label: 'London', value: 'Europe/London' },\n ],\n }),\n ).toThrow(InvalidConfiguration)\n })\n\n it('should throw on first invalid timezone encountered', () => {\n expect(() =>\n validateTimezones({\n timezones: [\n { label: 'First Invalid', value: 'Fake/First' },\n { label: 'Second Invalid', value: 'Fake/Second' },\n ],\n }),\n ).toThrow(/Fake\\/First/)\n })\n })\n\n describe('UTC offset timezones', () => {\n describe('valid UTC offsets', () => {\n it.each([\n '+00:00',\n '-00:00',\n '+05:30',\n '-08:00',\n '+12:00',\n '-12:00',\n '+14:00', // max positive offset (Line Islands)\n '+09:30', // half-hour offset\n '+05:45', // 45-minute offset (Nepal)\n ])('should accept valid HH:mm format offset: %s', (offset) => {\n expect(() =>\n validateTimezones({\n timezones: [{ label: `UTC${offset}`, value: offset }],\n }),\n ).not.toThrow()\n })\n\n it('should accept mixed IANA and offset timezones', () => {\n expect(() =>\n validateTimezones({\n timezones: [\n { label: 'New York', value: 'America/New_York' },\n { label: 'UTC+5:30', value: '+05:30' },\n { label: 'UTC', value: 'UTC' },\n { label: 'UTC-8', value: '-08:00' },\n ],\n }),\n ).not.toThrow()\n })\n })\n\n describe('invalid UTC offsets', () => {\n it.each(['+0530', '-0800', '+0000', '+1200', '+00', '-08', '+9', '-5'])(\n 'should throw for non-HH:mm format offset: %s',\n (offset) => {\n expect(() =>\n validateTimezones({\n timezones: [{ label: `Invalid ${offset}`, value: offset }],\n }),\n ).toThrow(InvalidConfiguration)\n },\n )\n\n it.each(['+15:00', '-13:00', '+25:00', '-20:00'])(\n 'should throw for out of range hour offset: %s',\n (offset) => {\n expect(() =>\n validateTimezones({\n timezones: [{ label: `Invalid ${offset}`, value: offset }],\n }),\n ).toThrow(InvalidConfiguration)\n },\n )\n\n it.each(['+05:60', '-08:99', '+12:75', '+00:61'])(\n 'should throw for invalid minutes in offset: %s',\n (offset) => {\n expect(() =>\n validateTimezones({\n timezones: [{ label: `Invalid ${offset}`, value: offset }],\n }),\n ).toThrow(InvalidConfiguration)\n },\n )\n\n it.each(['05:30', '0800', '12', '530'])(\n 'should throw for offset missing sign: %s',\n (offset) => {\n expect(() =>\n validateTimezones({\n timezones: [{ label: `Missing sign ${offset}`, value: offset }],\n }),\n ).toThrow(InvalidConfiguration)\n },\n )\n\n it.each(['++05:30', '--08:00', '+-05:30', '-+08:00'])(\n 'should throw for malformed sign in offset: %s',\n (offset) => {\n expect(() =>\n validateTimezones({\n timezones: [{ label: `Malformed ${offset}`, value: offset }],\n }),\n ).toThrow(InvalidConfiguration)\n },\n )\n\n it.each(['+ 05:30', '- 08:00', '+05 :30', '+05: 30'])(\n 'should throw for offset with spaces: %s',\n (offset) => {\n expect(() =>\n validateTimezones({\n timezones: [{ label: `Spaced ${offset}`, value: offset }],\n }),\n ).toThrow(InvalidConfiguration)\n },\n )\n\n it.each(['+5:', '+:30', ':', '+:', '-:'])(\n 'should throw for incomplete offset format: %s',\n (offset) => {\n expect(() =>\n validateTimezones({\n timezones: [{ label: `Incomplete ${offset}`, value: offset }],\n }),\n ).toThrow(InvalidConfiguration)\n },\n )\n\n it.each(['+05:30:00', '+05:30:30', '-08:00:00'])(\n 'should throw for offset with seconds: %s',\n (offset) => {\n expect(() =>\n validateTimezones({\n timezones: [{ label: `With seconds ${offset}`, value: offset }],\n }),\n ).toThrow(InvalidConfiguration)\n },\n )\n })\n })\n})\n"],"names":["describe","expect","it","InvalidConfiguration","validateTimezones","timezones","label","value","not","toThrow","each","timezone","undefined","misspelled","source","offset"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,SAAQ;AAE7C,SAASC,oBAAoB,QAAQ,qBAAoB;AACzD,SAASC,iBAAiB,QAAQ,yBAAwB;AAE1DJ,SAAS,qBAAqB;IAC5BA,SAAS,mBAAmB;QAC1BE,GAAG,8BAA8B;YAC/BD,OAAO,IACLG,kBAAkB;oBAChBC,WAAW;wBAAC;4BAAEC,OAAO;4BAAOC,OAAO;wBAAM;qBAAE;gBAC7C,IACAC,GAAG,CAACC,OAAO;QACf;QAEAP,GAAGQ,IAAI,CAAC;YACN;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;SACD,EAAE,yCAAyC,CAACC;YAC3CV,OAAO,IACLG,kBAAkB;oBAChBC,WAAW;wBAAC;4BAAEC,OAAOK;4BAAUJ,OAAOI;wBAAS;qBAAE;gBACnD,IACAH,GAAG,CAACC,OAAO;QACf;QAEAP,GAAG,0CAA0C;YAC3CD,OAAO,IACLG,kBAAkB;oBAChBC,WAAW;wBACT;4BAAEC,OAAO;4BAAYC,OAAO;wBAAmB;wBAC/C;4BAAED,OAAO;4BAAUC,OAAO;wBAAgB;wBAC1C;4BAAED,OAAO;4BAASC,OAAO;wBAAa;qBACvC;gBACH,IACAC,GAAG,CAACC,OAAO;QACf;QAEAP,GAAG,6BAA6B;YAC9BD,OAAO,IACLG,kBAAkB;oBAChBC,WAAW,EAAE;gBACf,IACAG,GAAG,CAACC,OAAO;QACf;QAEAP,GAAG,qCAAqC;YACtCD,OAAO,IACLG,kBAAkB;oBAChBC,WAAWO;gBACb,IACAJ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AC;gBAAW;gBAAW;gBAAW;aAAU,EAClD,iDACA,CAACK;gBACCd,OAAO,IACLG,kBAAkB;wBAChBC,WAAW;4BAAC;gCAAEC,OAAO,CAAC,UAAU,EAAES,QAAQ;gCAAER,OAAOQ;4BAAO;yBAAE;oBAC9D,IACAN,OAAO,CAACN;YACZ;YAGFD,GAAGQ,IAAI,CAAC;gBAAC;gBAAW;gBAAW;gBAAW;aAAU,EAClD,2CACA,CAACK;gBACCd,OAAO,IACLG,kBAAkB;wBAChBC,WAAW;4BAAC;gCAAEC,OAAO,CAAC,OAAO,EAAES,QAAQ;gCAAER,OAAOQ;4BAAO;yBAAE;oBAC3D,IACAN,OAAO,CAACN;YACZ;YAGFD,GAAGQ,IAAI,CAAC;gBAAC;gBAAO;gBAAQ;gBAAK;gBAAM;aAAK,EACtC,iDACA,CAACK;gBACCd,OAAO,IACLG,kBAAkB;wBAChBC,WAAW;4BAAC;gCAAEC,OAAO,CAAC,WAAW,EAAES,QAAQ;gCAAER,OAAOQ;4BAAO;yBAAE;oBAC/D,IACAN,OAAO,CAACN;YACZ;YAGFD,GAAGQ,IAAI,CAAC;gBAAC;gBAAa;gBAAa;aAAY,EAC7C,4CACA,CAACK;gBACCd,OAAO,IACLG,kBAAkB;wBAChBC,WAAW;4BAAC;gCAAEC,OAAO,CAAC,aAAa,EAAES,QAAQ;gCAAER,OAAOQ;4BAAO;yBAAE;oBACjE,IACAN,OAAO,CAACN;YACZ;QAEJ;IACF;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payload",
3
- "version": "3.70.0",
3
+ "version": "3.71.0-internal-debug.cd77e5d",
4
4
  "description": "Node, React, Headless CMS and Application Framework built on Next.js",
5
5
  "keywords": [
6
6
  "admin panel",
@@ -111,7 +111,7 @@
111
111
  "undici": "7.10.0",
112
112
  "uuid": "10.0.0",
113
113
  "ws": "^8.16.0",
114
- "@payloadcms/translations": "3.70.0"
114
+ "@payloadcms/translations": "3.71.0-internal-debug.cd77e5d"
115
115
  },
116
116
  "devDependencies": {
117
117
  "@hyrious/esbuild-plugin-commonjs": "0.2.6",