@geekmidas/cli 9.2.0 → 9.3.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 (47) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/README.md +1 -1
  3. package/dist/{config-Bbu1JKvf.mjs → config-D7AVl-qm.mjs} +2 -2
  4. package/dist/{config-Bbu1JKvf.mjs.map → config-D7AVl-qm.mjs.map} +1 -1
  5. package/dist/{config-DujV8DbR.cjs → config-DcxHEHPB.cjs} +2 -2
  6. package/dist/{config-DujV8DbR.cjs.map → config-DcxHEHPB.cjs.map} +1 -1
  7. package/dist/config.cjs +2 -2
  8. package/dist/config.mjs +2 -2
  9. package/dist/index.cjs +73 -27
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.mjs +73 -27
  12. package/dist/index.mjs.map +1 -1
  13. package/dist/{openapi-C5rXJTtj.mjs → openapi-BlIiUahn.mjs} +7 -2
  14. package/dist/{openapi-C5rXJTtj.mjs.map → openapi-BlIiUahn.mjs.map} +1 -1
  15. package/dist/{openapi-B_IGZDVu.cjs → openapi-C-YgZHyd.cjs} +7 -2
  16. package/dist/{openapi-B_IGZDVu.cjs.map → openapi-C-YgZHyd.cjs.map} +1 -1
  17. package/dist/openapi.cjs +3 -3
  18. package/dist/openapi.mjs +3 -3
  19. package/dist/{setup-DDXUXzzl.mjs → setup-A-BX8JUm.mjs} +3 -3
  20. package/dist/{setup-DDXUXzzl.mjs.map → setup-A-BX8JUm.mjs.map} +1 -1
  21. package/dist/setup-BDB9lvEI.cjs +8 -0
  22. package/dist/{setup-Dh-B7YTX.mjs → setup-BzftAUve.mjs} +3 -3
  23. package/dist/{setup-WZ-xqAQO.cjs → setup-C2UhXWhN.cjs} +3 -3
  24. package/dist/{setup-WZ-xqAQO.cjs.map → setup-C2UhXWhN.cjs.map} +1 -1
  25. package/dist/types-BWQDiooe.d.cts.map +1 -1
  26. package/dist/workspace/index.cjs +1 -1
  27. package/dist/workspace/index.mjs +1 -1
  28. package/dist/workspace-CqXfzYyp.cjs +6704 -0
  29. package/dist/workspace-CqXfzYyp.cjs.map +1 -0
  30. package/dist/workspace-DrBWGtI7.mjs +6579 -0
  31. package/dist/workspace-DrBWGtI7.mjs.map +1 -0
  32. package/docs/manifest-refactor-design.md +1 -1
  33. package/examples/cron-example.ts +1 -1
  34. package/package.json +10 -10
  35. package/src/__tests__/test-helpers.ts +4 -4
  36. package/src/build/__tests__/index-new.spec.ts +3 -3
  37. package/src/build/__tests__/manifests.spec.ts +2 -2
  38. package/src/generators/CronGenerator.ts +72 -1
  39. package/src/generators/OpenApiTsGenerator.ts +21 -0
  40. package/src/generators/__tests__/CronGenerator.spec.ts +74 -23
  41. package/src/generators/__tests__/Generator.bustCache.spec.ts +16 -8
  42. package/src/init/versions.ts +19 -19
  43. package/dist/setup-DLwhfyt-.cjs +0 -8
  44. package/dist/workspace-CQTT7HJQ.cjs +0 -4361
  45. package/dist/workspace-CQTT7HJQ.cjs.map +0 -1
  46. package/dist/workspace-D-37Ylqo.mjs +0 -4236
  47. package/dist/workspace-D-37Ylqo.mjs.map +0 -1
@@ -79,7 +79,7 @@ export const manifest = {
79
79
  {
80
80
  name: 'dailyReport',
81
81
  handler: '.gkm/aws-lambda/dailyReport.handler',
82
- schedule: 'rate(1 day)',
82
+ schedule: 'cron(0 0 * * ? *)',
83
83
  timeout: 300,
84
84
  memorySize: 256,
85
85
  environment: [],
@@ -31,7 +31,7 @@ export const dailyReport = c
31
31
  * Example cron that runs every hour
32
32
  */
33
33
  export const hourlyCleanup = c
34
- .schedule('rate(1 hour)')
34
+ .schedule('cron(0 * * * *)')
35
35
  .timeout(300000) // 5 minutes
36
36
  .handle(async ({ logger }) => {
37
37
  logger.info('Running hourly cleanup');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geekmidas/cli",
3
- "version": "9.2.0",
3
+ "version": "9.3.0",
4
4
  "description": "CLI tools for building Lambda handlers, server applications, and generating OpenAPI specs",
5
5
  "private": false,
6
6
  "type": "module",
@@ -81,12 +81,12 @@
81
81
  "prompts": "~2.4.2",
82
82
  "tsx": "~4.20.3",
83
83
  "yaml": "~2.8.2",
84
- "@geekmidas/constructs": "~9.2.0",
85
- "@geekmidas/envkit": "~9.2.0",
86
- "@geekmidas/errors": "~9.2.0",
87
- "@geekmidas/logger": "~9.2.0",
88
- "@geekmidas/manifest": "9.2.0",
89
- "@geekmidas/schema": "~9.2.0"
84
+ "@geekmidas/constructs": "~9.3.0",
85
+ "@geekmidas/envkit": "~9.3.0",
86
+ "@geekmidas/errors": "~9.3.0",
87
+ "@geekmidas/logger": "~9.3.0",
88
+ "@geekmidas/manifest": "9.3.0",
89
+ "@geekmidas/schema": "~9.3.0"
90
90
  },
91
91
  "devDependencies": {
92
92
  "@types/lodash.kebabcase": "^4.1.9",
@@ -95,11 +95,11 @@
95
95
  "@types/prompts": "~2.4.9",
96
96
  "typescript": "^5.8.2",
97
97
  "vitest": "^3.2.4",
98
- "zod": "~4.1.13",
99
- "@geekmidas/testkit": "9.2.0"
98
+ "zod": "~4.6.6",
99
+ "@geekmidas/testkit": "9.3.0"
100
100
  },
101
101
  "peerDependencies": {
102
- "@geekmidas/telescope": "^9.2.0"
102
+ "@geekmidas/telescope": "^9.3.0"
103
103
  },
104
104
  "peerDependenciesMeta": {
105
105
  "@geekmidas/telescope": {
@@ -96,7 +96,7 @@ export async function createMockCronFile(
96
96
  dir: string,
97
97
  filename: string,
98
98
  exportName: string,
99
- schedule = 'rate(1 hour)',
99
+ schedule = 'cron(0 * * * *)',
100
100
  ): Promise<string> {
101
101
  const content = `
102
102
  import { CronBuilder } from '@geekmidas/constructs/crons';
@@ -134,11 +134,11 @@ export function createTestFunction(timeout: number = 30) {
134
134
  }
135
135
 
136
136
  export function createTestCron(
137
- schedule: ScheduleExpression = 'rate(1 hour)',
137
+ schedule: ScheduleExpression | null = 'cron(0 * * * *)',
138
138
  timeout: number = 30,
139
139
  ) {
140
- const builder = new CronBuilder()
141
- .schedule(schedule)
140
+ const cron = new CronBuilder();
141
+ const builder = (schedule ? cron.schedule(schedule) : cron)
142
142
  .output(z.object({ processed: z.number() }))
143
143
  .timeout(timeout);
144
144
  return builder.handle(async () => {
@@ -39,7 +39,7 @@ describe('buildCommand', () => {
39
39
  dir,
40
40
  'src/crons/cleanup.ts',
41
41
  'cleanupCron',
42
- 'rate(1 day)',
42
+ 'cron(0 0 * * *)',
43
43
  );
44
44
 
45
45
  // Create a basic config file
@@ -136,7 +136,7 @@ export default {
136
136
  dir,
137
137
  'src/crons/dailyCleanup.ts',
138
138
  'dailyCleanupCron',
139
- 'rate(1 day)',
139
+ 'cron(0 0 * * *)',
140
140
  );
141
141
  await createMockCronFile(
142
142
  dir,
@@ -243,7 +243,7 @@ export default {
243
243
  // Verify crons are included
244
244
  expect(manifestContent).toContain('dailyCleanupCron');
245
245
  expect(manifestContent).toContain('hourlyReportCron');
246
- expect(manifestContent).toContain('rate(1 day)');
246
+ expect(manifestContent).toContain('cron(0 0 * * ? *)');
247
247
  expect(manifestContent).toContain('cron(0 * * * ? *)');
248
248
  } finally {
249
249
  process.chdir(originalCwd);
@@ -97,7 +97,7 @@ describe('generateAwsManifest', () => {
97
97
  {
98
98
  name: 'dailyCleanup',
99
99
  handler: '.gkm/aws/dailyCleanup.handler',
100
- schedule: 'rate(1 day)',
100
+ schedule: 'cron(0 0 * * *)',
101
101
  timeout: 300,
102
102
  memorySize: 256,
103
103
  environment: [],
@@ -110,7 +110,7 @@ describe('generateAwsManifest', () => {
110
110
  const content = await readFile(manifestPath, 'utf-8');
111
111
 
112
112
  expect(content).toContain('dailyCleanup');
113
- expect(content).toContain('rate(1 day)');
113
+ expect(content).toContain('cron(0 0 * * *)');
114
114
  });
115
115
 
116
116
  itWithDir(
@@ -1,6 +1,11 @@
1
1
  import { mkdir, writeFile } from 'node:fs/promises';
2
2
  import { dirname, join, relative } from 'node:path';
3
3
  import { Cron } from '@geekmidas/constructs/crons';
4
+ import {
5
+ type CronField,
6
+ InvalidCronExpressionError,
7
+ toAwsCron,
8
+ } from '@geekmidas/manifest';
4
9
  import type { BuildContext } from '../build/types';
5
10
  import type { CronInfo } from '../types';
6
11
  import {
@@ -24,6 +29,8 @@ export class CronGenerator extends ConstructGenerator<
24
29
  const provider = options?.provider || 'aws-lambda';
25
30
  const logger = console;
26
31
  const cronInfos: CronInfo[] = [];
32
+ // Every provider validates, so `gkm dev` fails like `gkm build` does.
33
+ const schedules = resolveSchedules(constructs, logger);
27
34
 
28
35
  if (constructs.length === 0 || provider !== 'aws-lambda') {
29
36
  return cronInfos;
@@ -48,7 +55,7 @@ export class CronGenerator extends ConstructGenerator<
48
55
  /\.ts$/,
49
56
  '.handler',
50
57
  ),
51
- schedule: construct.schedule || 'rate(1 hour)',
58
+ schedule: schedules.get(key) as string,
52
59
  timeout: construct.timeout,
53
60
  memorySize: construct.memorySize,
54
61
  environment: await construct.getEnvironment({
@@ -104,3 +111,67 @@ export const handler = adapter.handler;
104
111
  return handlerPath;
105
112
  }
106
113
  }
114
+
115
+ /** A cron whose schedule failed validation. */
116
+ export interface InvalidCronSchedule {
117
+ cron: string;
118
+ schedule: string;
119
+ /** Absent when the schedule isn't `cron(…)` with 5 or 6 fields. */
120
+ field?: CronField;
121
+ token: string;
122
+ }
123
+
124
+ /** One or more crons have an invalid schedule; all of them are listed. */
125
+ export class InvalidCronSchedulesError extends Error {
126
+ constructor(readonly crons: InvalidCronSchedule[]) {
127
+ super('Invalid cron schedules', { cause: { crons } });
128
+ this.name = 'InvalidCronSchedulesError';
129
+ }
130
+ }
131
+
132
+ /** Hourly, when a cron sets no schedule. */
133
+ const DEFAULT_SCHEDULE = 'cron(0 * * * *)';
134
+
135
+ /**
136
+ * Each cron's schedule in the AWS form the manifest records, keyed by cron.
137
+ * Every schedule is validated, since a cast or JavaScript caller gets past
138
+ * the types, and all invalid ones are reported together.
139
+ *
140
+ * @throws {InvalidCronSchedulesError}
141
+ */
142
+ function resolveSchedules(
143
+ constructs: GeneratedConstruct<
144
+ Cron<any, any, any, any, any, any, any, any>
145
+ >[],
146
+ logger: Pick<Console, 'warn'>,
147
+ ): Map<string, string> {
148
+ const schedules = new Map<string, string>();
149
+ const invalid: InvalidCronSchedule[] = [];
150
+
151
+ for (const { key, construct } of constructs) {
152
+ const schedule = construct.schedule ?? DEFAULT_SCHEDULE;
153
+ try {
154
+ const { expression, warnings } = toAwsCron(schedule);
155
+ for (const warning of warnings) {
156
+ logger.warn('Cron schedule converted to AWS approximately', {
157
+ cron: key,
158
+ schedule,
159
+ expression,
160
+ ...warning,
161
+ });
162
+ }
163
+ schedules.set(key, expression);
164
+ } catch (error) {
165
+ if (!(error instanceof InvalidCronExpressionError)) throw error;
166
+ invalid.push({
167
+ cron: key,
168
+ schedule,
169
+ field: error.field,
170
+ token: error.token,
171
+ });
172
+ }
173
+ }
174
+
175
+ if (invalid.length > 0) throw new InvalidCronSchedulesError(invalid);
176
+ return schedules;
177
+ }
@@ -426,6 +426,27 @@ export class OpenApiTsGenerator {
426
426
 
427
427
  // Remove $defs from the schema before converting to interface
428
428
  const { $defs, ...schemaWithoutDefs } = jsonSchema;
429
+
430
+ // A schema that *is* a registered schema converts to nothing but a
431
+ // `$ref` at it, and the def it points at has already been collected
432
+ // above — so emitting a declaration here as well produces
433
+ // `export type User = User`, a circular alias that is not a type.
434
+ //
435
+ // Zod used to inline this case and only started emitting the `$ref` in
436
+ // 4.6, which is how the bug arrived without the generator changing.
437
+ const ref = (schemaWithoutDefs as { $ref?: string }).$ref;
438
+ if (
439
+ ref &&
440
+ Object.keys(schemaWithoutDefs).every(
441
+ (k) => k === '$ref' || k === '$schema',
442
+ )
443
+ ) {
444
+ const target = ref.split('/').pop();
445
+ // The def's own interface is the declaration. Only alias it when the
446
+ // names actually differ, which is when the alias says something.
447
+ return target === name ? null : `export type ${name} = ${target};`;
448
+ }
449
+
429
450
  return this.jsonSchemaToInterface(schemaWithoutDefs, name);
430
451
  } catch {
431
452
  return null;
@@ -15,7 +15,7 @@ import {
15
15
  createTempDir,
16
16
  createTestCron,
17
17
  } from '../../__tests__/test-helpers';
18
- import { CronGenerator } from '../CronGenerator';
18
+ import { CronGenerator, InvalidCronSchedulesError } from '../CronGenerator';
19
19
  import type { GeneratedConstruct } from '../Generator';
20
20
 
21
21
  describe('CronGenerator', () => {
@@ -37,7 +37,7 @@ describe('CronGenerator', () => {
37
37
 
38
38
  describe('isConstruct', () => {
39
39
  it('should identify valid crons', () => {
40
- const testCron = createTestCron('rate(1 hour)', 30);
40
+ const testCron = createTestCron('cron(0 * * * *)', 30);
41
41
  expect(generator.isConstruct(testCron)).toBe(true);
42
42
  });
43
43
 
@@ -51,7 +51,7 @@ describe('CronGenerator', () => {
51
51
  describe('build', () => {
52
52
  const _createMockCronConstruct = (
53
53
  key: string,
54
- schedule: ScheduleExpression = 'rate(1 hour)',
54
+ schedule: ScheduleExpression = 'cron(0 * * * *)',
55
55
  timeout: number = 30,
56
56
  ): GeneratedConstruct<Cron<any, any, any, any>> => ({
57
57
  key,
@@ -74,13 +74,13 @@ describe('CronGenerator', () => {
74
74
  cronsDir,
75
75
  'dailyReport.ts',
76
76
  'dailyReport',
77
- 'rate(1 day)',
77
+ 'cron(0 0 * * *)',
78
78
  ),
79
79
  createMockCronFile(
80
80
  cronsDir,
81
81
  'hourlyCleanup.ts',
82
82
  'hourlyCleanup',
83
- 'rate(1 hour)',
83
+ 'cron(0 * * * *)',
84
84
  ),
85
85
  createMockCronFile(
86
86
  cronsDir,
@@ -109,12 +109,12 @@ describe('CronGenerator', () => {
109
109
  expect(dailyReport).toMatchObject({
110
110
  name: 'dailyReport',
111
111
  handler: expect.stringContaining('crons/dailyReport.handler'),
112
- schedule: 'rate(1 day)',
112
+ schedule: 'cron(0 0 * * ? *)',
113
113
  });
114
114
  expect(hourlyCleanup).toMatchObject({
115
115
  name: 'hourlyCleanup',
116
116
  handler: expect.stringContaining('crons/hourlyCleanup.handler'),
117
- schedule: 'rate(1 hour)',
117
+ schedule: 'cron(0 * * * ? *)',
118
118
  });
119
119
  expect(weeklyBackup).toMatchObject({
120
120
  name: 'weeklyBackup',
@@ -190,8 +190,7 @@ describe('CronGenerator', () => {
190
190
  });
191
191
 
192
192
  it('should use default schedule when none provided', async () => {
193
- // Create a cron with empty schedule that will use default
194
- const cronWithDefaultSchedule = createTestCron(undefined, 30);
193
+ const cronWithDefaultSchedule = createTestCron(null, 30);
195
194
 
196
195
  const construct: GeneratedConstruct<Cron<any, any, any, any>> = {
197
196
  key: 'defaultScheduleCron',
@@ -210,8 +209,18 @@ describe('CronGenerator', () => {
210
209
  { provider: 'aws-lambda' },
211
210
  );
212
211
 
213
- // Since the construct has a schedule, it should use that or default logic
214
- expect(cronInfos[0].schedule).toBeDefined();
212
+ expect(cronInfos[0].schedule).toBe('cron(0 * * * ? *)');
213
+ });
214
+
215
+ it('keeps day-of-week when a Unix schedule restricts both day fields', async () => {
216
+ const cronInfos = await generator.build(
217
+ context,
218
+ [_createMockCronConstruct('monthly', 'cron(0 9 1 * MON)')],
219
+ outputDir,
220
+ { provider: 'aws-lambda' },
221
+ );
222
+
223
+ expect(cronInfos[0].schedule).toBe('cron(0 9 ? * MON *)');
215
224
  });
216
225
 
217
226
  itWithDir(
@@ -225,7 +234,7 @@ describe('CronGenerator', () => {
225
234
  nestedDir,
226
235
  'deepCron.ts',
227
236
  'deepCron',
228
- 'rate(1 day)',
237
+ 'cron(0 0 * * *)',
229
238
  );
230
239
 
231
240
  const constructs = await generator.load(
@@ -259,7 +268,7 @@ describe('CronGenerator', () => {
259
268
  cronsDir,
260
269
  'testCron.ts',
261
270
  'testCron',
262
- 'rate(1 hour)',
271
+ 'cron(0 * * * *)',
263
272
  );
264
273
 
265
274
  const constructs = await generator.load('**/crons/*.ts', dir);
@@ -286,7 +295,7 @@ describe('CronGenerator', () => {
286
295
  cronsDir,
287
296
  'testCron.ts',
288
297
  'testCron',
289
- 'rate(1 hour)',
298
+ 'cron(0 * * * *)',
290
299
  );
291
300
 
292
301
  const constructs = await generator.load('**/crons/*.ts', dir);
@@ -313,7 +322,7 @@ describe('CronGenerator', () => {
313
322
  cronsDir,
314
323
  'testCron.ts',
315
324
  'testCron',
316
- 'rate(1 hour)',
325
+ 'cron(0 * * * *)',
317
326
  );
318
327
 
319
328
  const constructs = await generator.load('**/crons/*.ts', dir);
@@ -330,6 +339,48 @@ describe('CronGenerator', () => {
330
339
  );
331
340
  });
332
341
 
342
+ it.each([
343
+ 'aws-lambda',
344
+ 'server',
345
+ ] as const)('fails the %s build listing every invalid schedule', async (provider) => {
346
+ const build = generator.build(
347
+ context,
348
+ [
349
+ _createMockCronConstruct('valid', 'cron(0 8 * * *)'),
350
+ _createMockCronConstruct(
351
+ 'badHour',
352
+ 'cron(0 25 * * *)' as ScheduleExpression,
353
+ ),
354
+ _createMockCronConstruct('rate', 'rate(1 day)' as ScheduleExpression),
355
+ ],
356
+ outputDir,
357
+ { provider },
358
+ );
359
+
360
+ await expect(build).rejects.toThrow(InvalidCronSchedulesError);
361
+ await expect(build).rejects.toThrow(
362
+ expect.objectContaining({
363
+ message: 'Invalid cron schedules',
364
+ cause: {
365
+ crons: [
366
+ {
367
+ cron: 'badHour',
368
+ schedule: 'cron(0 25 * * *)',
369
+ field: 'hour',
370
+ token: '25',
371
+ },
372
+ {
373
+ cron: 'rate',
374
+ schedule: 'rate(1 day)',
375
+ field: undefined,
376
+ token: 'rate(1 day)',
377
+ },
378
+ ],
379
+ },
380
+ }),
381
+ );
382
+ });
383
+
333
384
  it('should return empty array for empty constructs', async () => {
334
385
  const cronInfos = await generator.build(context, [], outputDir, {
335
386
  provider: 'aws-lambda',
@@ -348,7 +399,7 @@ describe('CronGenerator', () => {
348
399
  cronsDir,
349
400
  'defaultCron.ts',
350
401
  'defaultCron',
351
- 'rate(1 hour)',
402
+ 'cron(0 * * * *)',
352
403
  );
353
404
 
354
405
  const constructs = await generator.load('**/crons/*.ts', dir);
@@ -375,7 +426,7 @@ describe('CronGenerator', () => {
375
426
  cronsDir,
376
427
  'rateCron.ts',
377
428
  'rateCron',
378
- 'rate(5 minutes)',
429
+ 'cron(*/5 * * * *)',
379
430
  ),
380
431
  createMockCronFile(
381
432
  cronsDir,
@@ -387,7 +438,7 @@ describe('CronGenerator', () => {
387
438
  cronsDir,
388
439
  'dailyRate.ts',
389
440
  'dailyRate',
390
- 'rate(1 day)',
441
+ 'cron(0 0 * * *)',
391
442
  ),
392
443
  ]);
393
444
 
@@ -402,9 +453,9 @@ describe('CronGenerator', () => {
402
453
  const cronExpression = cronInfos.find((c) => c.name === 'cronExpression');
403
454
  const dailyRate = cronInfos.find((c) => c.name === 'dailyRate');
404
455
 
405
- expect(rateCron?.schedule).toBe('rate(5 minutes)');
456
+ expect(rateCron?.schedule).toBe('cron(*/5 * * * ? *)');
406
457
  expect(cronExpression?.schedule).toBe('cron(0 12 * * ? *)');
407
- expect(dailyRate?.schedule).toBe('rate(1 day)');
458
+ expect(dailyRate?.schedule).toBe('cron(0 0 * * ? *)');
408
459
  });
409
460
 
410
461
  itWithDir(
@@ -419,13 +470,13 @@ describe('CronGenerator', () => {
419
470
  cronsDir,
420
471
  'quickCron.ts',
421
472
  'quickCron',
422
- 'rate(1 minute)',
473
+ 'cron(* * * * *)',
423
474
  ),
424
475
  createMockCronFile(
425
476
  cronsDir,
426
477
  'slowCron.ts',
427
478
  'slowCron',
428
- 'rate(1 hour)',
479
+ 'cron(0 * * * *)',
429
480
  ),
430
481
  ]);
431
482
 
@@ -467,7 +518,7 @@ describe('CronGenerator', () => {
467
518
  cronsDir,
468
519
  'customCron.ts',
469
520
  'customCron',
470
- 'rate(1 hour)',
521
+ 'cron(0 * * * *)',
471
522
  );
472
523
 
473
524
  const constructs = await generator.load('**/crons/*.ts', dir);
@@ -7,17 +7,25 @@ import { EndpointGenerator } from '../EndpointGenerator';
7
7
  import { clearZodGlobalRegistry } from '../Generator';
8
8
 
9
9
  describe('clearZodGlobalRegistry', () => {
10
- it('removes an id from the global registry so the same id can be re-registered', () => {
11
- // Register once — succeeds
12
- z.object({ x: z.string() }).meta({ id: 'BustCacheSchema_A' });
10
+ it('removes a registered id from the global registry', () => {
11
+ const registry = (
12
+ globalThis as {
13
+ __zod_globalRegistry?: { _idmap?: Map<string, unknown> };
14
+ }
15
+ ).__zod_globalRegistry;
13
16
 
14
- // Re-registering without clearing throws
15
- expect(() =>
16
- z.object({ y: z.string() }).meta({ id: 'BustCacheSchema_A' }),
17
- ).toThrow(/already exists in the registry/);
17
+ z.object({ x: z.string() }).meta({ id: 'BustCacheSchema_A' });
18
+ expect(registry?._idmap?.has('BustCacheSchema_A')).toBe(true);
18
19
 
19
- // After clearing, the id can be registered again
20
+ // The contract is that the id is gone, asserted on the registry itself.
21
+ // This used to be asserted by re-registering and expecting a throw, which
22
+ // stopped meaning anything in Zod 4.6: a duplicate id is accepted now
23
+ // rather than rejected. That made the test pass for the wrong reason
24
+ // first, and then fail for the wrong reason — neither of which was ever
25
+ // about `clearZodGlobalRegistry`.
20
26
  clearZodGlobalRegistry();
27
+ expect(registry?._idmap?.has('BustCacheSchema_A')).toBe(false);
28
+
21
29
  expect(() =>
22
30
  z.object({ z: z.string() }).meta({ id: 'BustCacheSchema_A' }),
23
31
  ).not.toThrow();
@@ -27,25 +27,25 @@ export const CLI_VERSION = `~${pkg.version}`;
27
27
  * Run: pnpm --filter @geekmidas/cli sync-versions
28
28
  */
29
29
  export const GEEKMIDAS_VERSIONS = {
30
- '@geekmidas/audit': '~9.1.0',
31
- '@geekmidas/auth': '~9.1.0',
32
- '@geekmidas/cache': '~9.1.0',
33
- '@geekmidas/client': '~9.1.0',
34
- '@geekmidas/cloud': '~9.1.0',
35
- '@geekmidas/constructs': '~9.1.0',
36
- '@geekmidas/db': '~9.1.0',
37
- '@geekmidas/emailkit': '~9.1.0',
38
- '@geekmidas/envkit': '~9.1.0',
39
- '@geekmidas/errors': '~9.1.0',
40
- '@geekmidas/events': '~9.1.0',
41
- '@geekmidas/logger': '~9.1.0',
42
- '@geekmidas/rate-limit': '~9.1.0',
43
- '@geekmidas/schema': '~9.1.0',
44
- '@geekmidas/services': '~9.1.0',
45
- '@geekmidas/storage': '~9.1.0',
46
- '@geekmidas/studio': '~9.1.0',
47
- '@geekmidas/telescope': '~9.1.0',
48
- '@geekmidas/testkit': '~9.1.0',
30
+ '@geekmidas/audit': '~9.2.1',
31
+ '@geekmidas/auth': '~9.2.1',
32
+ '@geekmidas/cache': '~9.2.1',
33
+ '@geekmidas/client': '~9.2.1',
34
+ '@geekmidas/cloud': '~9.2.1',
35
+ '@geekmidas/constructs': '~9.2.1',
36
+ '@geekmidas/db': '~9.2.1',
37
+ '@geekmidas/emailkit': '~9.2.1',
38
+ '@geekmidas/envkit': '~9.2.1',
39
+ '@geekmidas/errors': '~9.2.1',
40
+ '@geekmidas/events': '~9.2.1',
41
+ '@geekmidas/logger': '~9.2.1',
42
+ '@geekmidas/rate-limit': '~9.2.1',
43
+ '@geekmidas/schema': '~9.2.1',
44
+ '@geekmidas/services': '~9.2.1',
45
+ '@geekmidas/storage': '~9.2.1',
46
+ '@geekmidas/studio': '~9.2.1',
47
+ '@geekmidas/telescope': '~9.2.1',
48
+ '@geekmidas/testkit': '~9.2.1',
49
49
  '@geekmidas/cli': CLI_VERSION,
50
50
  } as const;
51
51
 
@@ -1,8 +0,0 @@
1
- require('./workspace-CQTT7HJQ.cjs');
2
- require('./config-DujV8DbR.cjs');
3
- require('./fullstack-secrets-BYzi6Hwl.cjs');
4
- require('./storage-B1wvztiJ.cjs');
5
- const require_setup = require('./setup-WZ-xqAQO.cjs');
6
- require('./sync-o_CtEbvR.cjs');
7
-
8
- exports.ensureStageSecrets = require_setup.ensureStageSecrets;