@prisma-next/emitter 0.3.0-dev.13 → 0.3.0-dev.130

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.
@@ -128,7 +128,7 @@ describe('emitter integration', () => {
128
128
 
129
129
  const result = await emit(ir, options, mockSqlHook);
130
130
 
131
- expect(result.coreHash).toMatch(/^sha256:[a-f0-9]{64}$/);
131
+ expect(result.storageHash).toMatch(/^sha256:[a-f0-9]{64}$/);
132
132
  expect(result.contractDts).toContain('export type Contract');
133
133
  expect(result.contractDts).toContain('CodecTypes');
134
134
  expect(result.contractDts).toContain('LaneCodecTypes');
@@ -138,7 +138,7 @@ describe('emitter integration', () => {
138
138
  schemaVersion: '1',
139
139
  targetFamily: 'sql',
140
140
  target: 'postgres',
141
- coreHash: result.coreHash,
141
+ storageHash: result.storageHash,
142
142
  storage: {
143
143
  tables: {
144
144
  user: expect.anything(),
@@ -197,78 +197,82 @@ describe('emitter integration', () => {
197
197
  const result1 = await emit(ir, options, mockSqlHook);
198
198
  const result2 = await emit(ir, options, mockSqlHook);
199
199
 
200
- expect(result1.coreHash).toBe(result2.coreHash);
200
+ expect(result1.storageHash).toBe(result2.storageHash);
201
201
  expect(result1.contractDts).toBe(result2.contractDts);
202
202
  expect(result1.contractJson).toBe(result2.contractJson);
203
203
  });
204
204
 
205
- it('round-trip: IR → JSON → parse JSON → compare', async () => {
206
- const ir = createContractIR({
207
- models: {
208
- User: {
209
- storage: { table: 'user' },
210
- fields: {
211
- id: { column: 'id' },
212
- email: { column: 'email' },
205
+ it(
206
+ 'round-trip: IR JSON → parse JSON → compare',
207
+ async () => {
208
+ const ir = createContractIR({
209
+ models: {
210
+ User: {
211
+ storage: { table: 'user' },
212
+ fields: {
213
+ id: { column: 'id' },
214
+ email: { column: 'email' },
215
+ },
216
+ relations: {},
213
217
  },
214
- relations: {},
215
218
  },
216
- },
217
- storage: {
218
- tables: {
219
- user: {
220
- columns: {
221
- id: { codecId: 'pg/int4@1', nativeType: 'int4', nullable: false },
222
- email: { codecId: 'pg/text@1', nativeType: 'text', nullable: false },
219
+ storage: {
220
+ tables: {
221
+ user: {
222
+ columns: {
223
+ id: { codecId: 'pg/int4@1', nativeType: 'int4', nullable: false },
224
+ email: { codecId: 'pg/text@1', nativeType: 'text', nullable: false },
225
+ },
226
+ primaryKey: { columns: ['id'] },
227
+ uniques: [],
228
+ indexes: [],
229
+ foreignKeys: [],
223
230
  },
224
- primaryKey: { columns: ['id'] },
225
- uniques: [],
226
- indexes: [],
227
- foreignKeys: [],
228
231
  },
229
232
  },
230
- },
231
- extensionPacks: {
232
- postgres: {
233
- version: '0.0.1',
233
+ extensionPacks: {
234
+ postgres: {
235
+ version: '0.0.1',
236
+ },
237
+ pg: {},
234
238
  },
235
- pg: {},
236
- },
237
- });
239
+ });
238
240
 
239
- // Create minimal test data (emitter tests don't load packs)
240
- const operationRegistry = createOperationRegistry();
241
- const codecTypeImports: TypesImportSpec[] = [];
242
- const operationTypeImports: TypesImportSpec[] = [];
243
- const extensionIds = ['postgres', 'pg'];
244
- const options: EmitOptions = {
245
- outputDir: '',
246
- operationRegistry,
247
- codecTypeImports,
248
- operationTypeImports,
249
- extensionIds,
250
- };
241
+ // Create minimal test data (emitter tests don't load packs)
242
+ const operationRegistry = createOperationRegistry();
243
+ const codecTypeImports: TypesImportSpec[] = [];
244
+ const operationTypeImports: TypesImportSpec[] = [];
245
+ const extensionIds = ['postgres', 'pg'];
246
+ const options: EmitOptions = {
247
+ outputDir: '',
248
+ operationRegistry,
249
+ codecTypeImports,
250
+ operationTypeImports,
251
+ extensionIds,
252
+ };
251
253
 
252
- const result1 = await emit(ir, options, mockSqlHook);
253
- const contractJson1 = JSON.parse(result1.contractJson) as Record<string, unknown>;
254
+ const result1 = await emit(ir, options, mockSqlHook);
255
+ const contractJson1 = JSON.parse(result1.contractJson) as Record<string, unknown>;
254
256
 
255
- const ir2 = createContractIR({
256
- schemaVersion: contractJson1['schemaVersion'] as string,
257
- targetFamily: contractJson1['targetFamily'] as string,
258
- target: contractJson1['target'] as string,
259
- models: contractJson1['models'] as Record<string, unknown>,
260
- relations: (contractJson1['relations'] as Record<string, unknown>) || {},
261
- storage: contractJson1['storage'] as Record<string, unknown>,
262
- extensionPacks: contractJson1['extensionPacks'] as Record<string, unknown>,
263
- capabilities:
264
- (contractJson1['capabilities'] as Record<string, Record<string, boolean>>) || {},
265
- meta: (contractJson1['meta'] as Record<string, unknown>) || {},
266
- sources: (contractJson1['sources'] as Record<string, unknown>) || {},
267
- });
257
+ const ir2 = createContractIR({
258
+ schemaVersion: contractJson1['schemaVersion'] as string,
259
+ targetFamily: contractJson1['targetFamily'] as string,
260
+ target: contractJson1['target'] as string,
261
+ models: contractJson1['models'] as Record<string, unknown>,
262
+ relations: (contractJson1['relations'] as Record<string, unknown>) || {},
263
+ storage: contractJson1['storage'] as Record<string, unknown>,
264
+ extensionPacks: contractJson1['extensionPacks'] as Record<string, unknown>,
265
+ capabilities:
266
+ (contractJson1['capabilities'] as Record<string, Record<string, boolean>>) || {},
267
+ meta: (contractJson1['meta'] as Record<string, unknown>) || {},
268
+ sources: (contractJson1['sources'] as Record<string, unknown>) || {},
269
+ });
268
270
 
269
- const result2 = await emit(ir2, options, mockSqlHook);
271
+ const result2 = await emit(ir2, options, mockSqlHook);
270
272
 
271
- expect(result1.contractJson).toBe(result2.contractJson);
272
- expect(result1.coreHash).toBe(result2.coreHash);
273
- });
273
+ expect(result1.contractJson).toBe(result2.contractJson);
274
+ expect(result1.storageHash).toBe(result2.storageHash);
275
+ },
276
+ timeouts.typeScriptCompilation,
277
+ );
274
278
  });
@@ -133,7 +133,7 @@ describe('emitter round-trip', () => {
133
133
  const result2 = await emit(ir2, options, mockSqlHook);
134
134
 
135
135
  expect(result1.contractJson).toBe(result2.contractJson);
136
- expect(result1.coreHash).toBe(result2.coreHash);
136
+ expect(result1.storageHash).toBe(result2.storageHash);
137
137
  },
138
138
  timeouts.typeScriptCompilation,
139
139
  );
@@ -230,7 +230,7 @@ describe('emitter round-trip', () => {
230
230
  const result2 = await emit(ir2, options, mockSqlHook);
231
231
 
232
232
  expect(result1.contractJson).toBe(result2.contractJson);
233
- expect(result1.coreHash).toBe(result2.coreHash);
233
+ expect(result1.storageHash).toBe(result2.storageHash);
234
234
  });
235
235
 
236
236
  it('round-trip with nullable fields', async () => {
@@ -289,7 +289,7 @@ describe('emitter round-trip', () => {
289
289
  const result2 = await emit(ir2, options, mockSqlHook);
290
290
 
291
291
  expect(result1.contractJson).toBe(result2.contractJson);
292
- expect(result1.coreHash).toBe(result2.coreHash);
292
+ expect(result1.storageHash).toBe(result2.storageHash);
293
293
 
294
294
  const parsed2 = JSON.parse(result2.contractJson) as Record<string, unknown>;
295
295
  const storage = parsed2['storage'] as Record<string, unknown>;
@@ -364,7 +364,7 @@ describe('emitter round-trip', () => {
364
364
  const result2 = await emit(ir2, options, mockSqlHook);
365
365
 
366
366
  expect(result1.contractJson).toBe(result2.contractJson);
367
- expect(result1.coreHash).toBe(result2.coreHash);
367
+ expect(result1.storageHash).toBe(result2.storageHash);
368
368
  expect(result1.profileHash).toBe(result2.profileHash);
369
369
  });
370
370
  });
@@ -1,8 +1,9 @@
1
1
  import type { ContractIR } from '@prisma-next/contract/ir';
2
2
  import type {
3
+ GenerateContractTypesOptions,
3
4
  TargetFamilyHook,
5
+ TypeRenderEntry,
4
6
  TypesImportSpec,
5
- ValidationContext,
6
7
  } from '@prisma-next/contract/types';
7
8
  import type { EmitOptions } from '@prisma-next/core-control-plane/emission';
8
9
  import { emit } from '@prisma-next/core-control-plane/emission';
@@ -13,7 +14,7 @@ import { createContractIR } from './utils';
13
14
 
14
15
  const mockSqlHook: TargetFamilyHook = {
15
16
  id: 'sql',
16
- validateTypes: (ir: ContractIR, _ctx: ValidationContext) => {
17
+ validateTypes: (ir: ContractIR) => {
17
18
  const storage = ir.storage as
18
19
  | { tables?: Record<string, { columns?: Record<string, { codecId?: string }> }> }
19
20
  | undefined;
@@ -45,11 +46,12 @@ const mockSqlHook: TargetFamilyHook = {
45
46
  throw new Error(`Expected targetFamily "sql", got "${ir.targetFamily}"`);
46
47
  }
47
48
  },
48
- generateContractTypes: (ir: ContractIR, _codecTypeImports, _operationTypeImports) => {
49
+ generateContractTypes: (ir: ContractIR, _codecTypeImports, _operationTypeImports, _hashes) => {
49
50
  // Access ir properties to satisfy lint rules, but we don't use them in the mock
50
51
  void ir;
51
52
  void _codecTypeImports;
52
53
  void _operationTypeImports;
54
+ void _hashes;
53
55
  return `// Generated contract types
54
56
  export type CodecTypes = Record<string, never>;
55
57
  export type LaneCodecTypes = CodecTypes;
@@ -109,7 +111,7 @@ describe('emitter', () => {
109
111
  };
110
112
 
111
113
  const result = await emit(ir, options, mockSqlHook);
112
- expect(result.coreHash).toMatch(/^sha256:[a-f0-9]{64}$/);
114
+ expect(result.storageHash).toMatch(/^sha256:[a-f0-9]{64}$/);
113
115
  expect(result.contractDts).toContain('export type Contract');
114
116
  expect(result.contractDts).toContain('CodecTypes');
115
117
 
@@ -426,23 +428,6 @@ describe('emitter', () => {
426
428
  await expect(emit(ir, options, mockSqlHook)).rejects.toThrow('ContractIR must have storage');
427
429
  });
428
430
 
429
- it('throws error when relations is missing', async () => {
430
- const ir = createContractIR({
431
- relations: undefined as unknown as Record<string, unknown>,
432
- }) as ContractIR;
433
-
434
- const operationRegistry = createOperationRegistry();
435
- const options: EmitOptions = {
436
- outputDir: '',
437
- operationRegistry,
438
- codecTypeImports: [],
439
- operationTypeImports: [],
440
- extensionIds: [],
441
- };
442
-
443
- await expect(emit(ir, options, mockSqlHook)).rejects.toThrow('ContractIR must have relations');
444
- });
445
-
446
431
  it('throws error when relations is not an object', async () => {
447
432
  const ir = createContractIR({
448
433
  relations: 'not-an-object' as unknown as Record<string, unknown>,
@@ -457,7 +442,9 @@ describe('emitter', () => {
457
442
  extensionIds: [],
458
443
  };
459
444
 
460
- await expect(emit(ir, options, mockSqlHook)).rejects.toThrow('ContractIR must have relations');
445
+ await expect(emit(ir, options, mockSqlHook)).rejects.toThrow(
446
+ 'ContractIR relations must be an object when provided',
447
+ );
461
448
  });
462
449
 
463
450
  it('throws error when extension packs are missing', async () => {
@@ -570,10 +557,12 @@ describe('emitter', () => {
570
557
  await expect(emit(ir, options, mockSqlHook)).rejects.toThrow('ContractIR must have meta');
571
558
  });
572
559
 
573
- it('throws error when sources is missing', async () => {
560
+ it('omits sources from emitted contract artifact', async () => {
574
561
  const ir = createContractIR({
575
- sources: undefined as unknown as Record<string, unknown>,
576
- }) as ContractIR;
562
+ sources: {
563
+ schema: { sourceId: 'schema.prisma' },
564
+ },
565
+ });
577
566
 
578
567
  const operationRegistry = createOperationRegistry();
579
568
  const options: EmitOptions = {
@@ -584,24 +573,68 @@ describe('emitter', () => {
584
573
  extensionIds: [],
585
574
  };
586
575
 
587
- await expect(emit(ir, options, mockSqlHook)).rejects.toThrow('ContractIR must have sources');
576
+ const result = await emit(ir, options, mockSqlHook);
577
+ const contractJson = JSON.parse(result.contractJson) as Record<string, unknown>;
578
+ expect(contractJson).not.toHaveProperty('sources');
588
579
  });
589
580
 
590
- it('throws error when sources is not an object', async () => {
581
+ it('accepts meta keys when family validation allows them', async () => {
591
582
  const ir = createContractIR({
592
- sources: 'not-an-object' as unknown as Record<string, unknown>,
593
- }) as ContractIR;
583
+ meta: {
584
+ sourceId: 'schema.prisma',
585
+ schemaPath: '/tmp/schema.prisma',
586
+ source: 'psl',
587
+ },
588
+ });
594
589
 
595
- const operationRegistry = createOperationRegistry();
596
590
  const options: EmitOptions = {
597
591
  outputDir: '',
598
- operationRegistry,
592
+ operationRegistry: createOperationRegistry(),
593
+ codecTypeImports: [],
594
+ operationTypeImports: [],
595
+ extensionIds: [],
596
+ };
597
+
598
+ await expect(emit(ir, options, mockSqlHook)).resolves.toMatchObject({
599
+ contractJson: expect.any(String),
600
+ contractDts: expect.any(String),
601
+ });
602
+ });
603
+
604
+ it('accepts canonical section keys when family validation allows them', async () => {
605
+ const ir = createContractIR({
606
+ storage: {
607
+ tables: {
608
+ user: {
609
+ columns: {
610
+ id: {
611
+ codecId: 'pg/int4@1',
612
+ nativeType: 'int4',
613
+ nullable: false,
614
+ sourceId: 'schema.prisma',
615
+ },
616
+ },
617
+ primaryKey: { columns: ['id'] },
618
+ uniques: [],
619
+ indexes: [],
620
+ foreignKeys: [],
621
+ },
622
+ },
623
+ } as unknown as Record<string, unknown>,
624
+ });
625
+
626
+ const options: EmitOptions = {
627
+ outputDir: '',
628
+ operationRegistry: createOperationRegistry(),
599
629
  codecTypeImports: [],
600
630
  operationTypeImports: [],
601
631
  extensionIds: [],
602
632
  };
603
633
 
604
- await expect(emit(ir, options, mockSqlHook)).rejects.toThrow('ContractIR must have sources');
634
+ await expect(emit(ir, options, mockSqlHook)).resolves.toMatchObject({
635
+ contractJson: expect.any(String),
636
+ contractDts: expect.any(String),
637
+ });
605
638
  });
606
639
 
607
640
  it('emits contract even when extensionIds are not in contract.extensionPacks', async () => {
@@ -623,9 +656,10 @@ describe('emitter', () => {
623
656
  throw new Error(`Expected targetFamily "sql", got "${ir.targetFamily}"`);
624
657
  }
625
658
  },
626
- generateContractTypes: (_ir, _codecTypeImports, _operationTypeImports) => {
659
+ generateContractTypes: (_ir, _codecTypeImports, _operationTypeImports, _hashes) => {
627
660
  void _codecTypeImports;
628
661
  void _operationTypeImports;
662
+ void _hashes;
629
663
  return `// Generated contract types
630
664
  export type CodecTypes = Record<string, never>;
631
665
  export type LaneCodecTypes = CodecTypes;
@@ -647,4 +681,56 @@ export type Contract = unknown;
647
681
  expect(result.contractJson).toBeDefined();
648
682
  expect(result.contractDts).toBeDefined();
649
683
  });
684
+
685
+ it('passes parameterizedRenderers to generateContractTypes options', async () => {
686
+ const ir = createContractIR({
687
+ storage: {
688
+ tables: {},
689
+ },
690
+ });
691
+
692
+ let receivedOptions: GenerateContractTypesOptions | undefined;
693
+
694
+ const mockHookCapturingOptions: TargetFamilyHook = {
695
+ id: 'sql',
696
+ validateTypes: () => {},
697
+ validateStructure: () => {},
698
+ generateContractTypes: (_ir, _codecTypeImports, _operationTypeImports, _hashes, options) => {
699
+ receivedOptions = options;
700
+ return `// Generated contract types
701
+ export type CodecTypes = Record<string, never>;
702
+ export type LaneCodecTypes = CodecTypes;
703
+ export type Contract = unknown;
704
+ `;
705
+ },
706
+ };
707
+
708
+ const vectorRenderer: TypeRenderEntry = {
709
+ codecId: 'pg/vector@1',
710
+ render: (params) => `Vector<${params['length']}>`,
711
+ };
712
+
713
+ const parameterizedRenderers = new Map<string, TypeRenderEntry>();
714
+ parameterizedRenderers.set('pg/vector@1', vectorRenderer);
715
+
716
+ const options: EmitOptions = {
717
+ outputDir: '',
718
+ operationRegistry: createOperationRegistry(),
719
+ codecTypeImports: [],
720
+ operationTypeImports: [],
721
+ extensionIds: [],
722
+ parameterizedRenderers,
723
+ };
724
+
725
+ await emit(ir, options, mockHookCapturingOptions);
726
+
727
+ expect(receivedOptions).toBeDefined();
728
+ expect(receivedOptions?.parameterizedRenderers).toBeDefined();
729
+ expect(receivedOptions?.parameterizedRenderers?.size).toBe(1);
730
+
731
+ const entry = receivedOptions?.parameterizedRenderers?.get('pg/vector@1');
732
+ expect(entry).toBeDefined();
733
+ expect(entry?.codecId).toBe('pg/vector@1');
734
+ expect(entry?.render({ length: 1536 }, { codecTypesName: 'CodecTypes' })).toBe('Vector<1536>');
735
+ });
650
736
  });
@@ -7,13 +7,13 @@ describe('emitter factories', () => {
7
7
  const header = irHeader({
8
8
  target: 'postgres',
9
9
  targetFamily: 'sql',
10
- coreHash: 'sha256:abc123',
10
+ storageHash: 'sha256:abc123',
11
11
  });
12
12
  expect(header).toEqual({
13
13
  schemaVersion: '1',
14
14
  target: 'postgres',
15
15
  targetFamily: 'sql',
16
- coreHash: 'sha256:abc123',
16
+ storageHash: 'sha256:abc123',
17
17
  });
18
18
  });
19
19
 
@@ -21,14 +21,14 @@ describe('emitter factories', () => {
21
21
  const header = irHeader({
22
22
  target: 'postgres',
23
23
  targetFamily: 'sql',
24
- coreHash: 'sha256:abc123',
24
+ storageHash: 'sha256:abc123',
25
25
  profileHash: 'sha256:def456',
26
26
  });
27
27
  expect(header).toEqual({
28
28
  schemaVersion: '1',
29
29
  target: 'postgres',
30
30
  targetFamily: 'sql',
31
- coreHash: 'sha256:abc123',
31
+ storageHash: 'sha256:abc123',
32
32
  profileHash: 'sha256:def456',
33
33
  });
34
34
  });
@@ -37,7 +37,7 @@ describe('emitter factories', () => {
37
37
  const header = irHeader({
38
38
  target: 'mongodb',
39
39
  targetFamily: 'document',
40
- coreHash: 'sha256:xyz789',
40
+ storageHash: 'sha256:xyz789',
41
41
  });
42
42
  expect(header.targetFamily).toBe('document');
43
43
  expect(header.target).toBe('mongodb');
@@ -149,7 +149,7 @@ describe('emitter factories', () => {
149
149
  const header = irHeader({
150
150
  target: 'postgres',
151
151
  targetFamily: 'sql',
152
- coreHash: 'sha256:abc123',
152
+ storageHash: 'sha256:abc123',
153
153
  });
154
154
  const meta = irMeta({
155
155
  capabilities: {
@@ -171,7 +171,7 @@ describe('emitter factories', () => {
171
171
  expect(ir.schemaVersion).toBe('1');
172
172
  expect(ir.target).toBe('postgres');
173
173
  expect(ir.targetFamily).toBe('sql');
174
- // Note: coreHash is not part of ContractIR (it's computed by emitter)
174
+ // Note: storageHash is not part of ContractIR (it's computed by emitter)
175
175
  expect(ir.storage).toEqual(storage);
176
176
  expect(ir.models).toEqual(models);
177
177
  expect(ir.relations).toEqual(relations);
@@ -187,7 +187,7 @@ describe('emitter factories', () => {
187
187
  const header = irHeader({
188
188
  target: 'postgres',
189
189
  targetFamily: 'sql',
190
- coreHash: 'sha256:abc123',
190
+ storageHash: 'sha256:abc123',
191
191
  profileHash: 'sha256:def456',
192
192
  });
193
193
  const meta = irMeta({});
@@ -213,7 +213,7 @@ describe('emitter factories', () => {
213
213
  const header = irHeader({
214
214
  target: 'postgres',
215
215
  targetFamily: 'sql',
216
- coreHash: 'sha256:abc123',
216
+ storageHash: 'sha256:abc123',
217
217
  });
218
218
  const meta = irMeta({
219
219
  capabilities: {
@@ -251,7 +251,7 @@ describe('emitter factories', () => {
251
251
  const header = irHeader({
252
252
  target: 'mongodb',
253
253
  targetFamily: 'document',
254
- coreHash: 'sha256:xyz789',
254
+ storageHash: 'sha256:xyz789',
255
255
  });
256
256
  const meta = irMeta({});
257
257
  const storage = { document: { collections: {} } };
@@ -1,8 +1,8 @@
1
- import { computeCoreHash, computeProfileHash } from '@prisma-next/core-control-plane/emission';
1
+ import { computeProfileHash, computeStorageHash } from '@prisma-next/core-control-plane/emission';
2
2
  import { describe, expect, it } from 'vitest';
3
3
 
4
4
  describe('hashing', () => {
5
- it('computes core hash', () => {
5
+ it('computes storage hash', () => {
6
6
  const contract = {
7
7
  schemaVersion: '1',
8
8
  targetFamily: 'sql',
@@ -16,7 +16,7 @@ describe('hashing', () => {
16
16
  sources: {},
17
17
  };
18
18
 
19
- const hash = computeCoreHash(contract);
19
+ const hash = computeStorageHash(contract);
20
20
  expect(hash).toMatch(/^sha256:[a-f0-9]{64}$/);
21
21
  });
22
22
 
@@ -52,8 +52,8 @@ describe('hashing', () => {
52
52
  sources: {},
53
53
  };
54
54
 
55
- const hash1 = computeCoreHash(contract);
56
- const hash2 = computeCoreHash(contract);
55
+ const hash1 = computeStorageHash(contract);
56
+ const hash2 = computeStorageHash(contract);
57
57
  expect(hash1).toBe(hash2);
58
58
  });
59
59
  });
package/test/utils.ts CHANGED
@@ -9,12 +9,12 @@ import { type ContractIR, irHeader, irMeta } from '@prisma-next/contract/ir';
9
9
  * from the result (useful for testing validation of missing fields).
10
10
  */
11
11
  export function createContractIR(
12
- overrides: Partial<ContractIR> & { coreHash?: string; profileHash?: string } = {},
12
+ overrides: Partial<ContractIR> & { storageHash?: string; profileHash?: string } = {},
13
13
  ): ContractIR {
14
14
  // Check if fields are explicitly undefined (not just missing)
15
15
  const hasTarget = 'target' in overrides;
16
16
  const hasTargetFamily = 'targetFamily' in overrides;
17
- const hasCoreHash = 'coreHash' in overrides;
17
+ const hasStorageHash = 'storageHash' in overrides;
18
18
  const hasSchemaVersion = 'schemaVersion' in overrides;
19
19
  const hasModels = 'models' in overrides;
20
20
  const hasRelations = 'relations' in overrides;
@@ -28,7 +28,7 @@ export function createContractIR(
28
28
  const headerOpts: {
29
29
  target?: string;
30
30
  targetFamily?: string;
31
- coreHash?: string;
31
+ storageHash?: string;
32
32
  profileHash?: string;
33
33
  } = {};
34
34
 
@@ -44,10 +44,10 @@ export function createContractIR(
44
44
  headerOpts.targetFamily = 'sql';
45
45
  }
46
46
 
47
- if (hasCoreHash && overrides.coreHash !== undefined) {
48
- headerOpts.coreHash = overrides.coreHash;
49
- } else if (!hasCoreHash) {
50
- headerOpts.coreHash = 'sha256:test';
47
+ if (hasStorageHash && overrides.storageHash !== undefined) {
48
+ headerOpts.storageHash = overrides.storageHash;
49
+ } else if (!hasStorageHash) {
50
+ headerOpts.storageHash = 'sha256:test';
51
51
  }
52
52
 
53
53
  // profileHash is not part of ContractIR, but we can accept it for header creation
@@ -59,7 +59,7 @@ export function createContractIR(
59
59
  headerOpts as {
60
60
  target: string;
61
61
  targetFamily: string;
62
- coreHash: string;
62
+ storageHash: string;
63
63
  profileHash?: string;
64
64
  },
65
65
  );
@@ -99,7 +99,7 @@ export function createContractIR(
99
99
 
100
100
  const meta = irMeta(Object.keys(metaOpts).length > 0 ? metaOpts : undefined);
101
101
 
102
- // Build result by constructing the object directly (ContractIR doesn't include coreHash/profileHash)
102
+ // Build result by constructing the object directly (ContractIR doesn't include storageHash/profileHash)
103
103
  // When fields are explicitly undefined, include them as undefined (tests use type assertions to bypass TS)
104
104
  const result = {
105
105
  schemaVersion:
@@ -1,6 +0,0 @@
1
- // src/exports/index.ts
2
- import { emit } from "@prisma-next/core-control-plane/emission";
3
- export {
4
- emit
5
- };
6
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/exports/index.ts"],"sourcesContent":["// Re-export types from @prisma-next/contract for backward compatibility\nexport type {\n TargetFamilyHook,\n TypesImportSpec,\n ValidationContext,\n} from '@prisma-next/contract/types';\nexport type { EmitOptions, EmitResult } from '@prisma-next/core-control-plane/emission';\n// Re-export emit function and types from core-control-plane\nexport { emit } from '@prisma-next/core-control-plane/emission';\n"],"mappings":";AAQA,SAAS,YAAY;","names":[]}
@@ -1,4 +0,0 @@
1
- export type { TargetFamilyHook, TypesImportSpec, ValidationContext, } from '@prisma-next/contract/types';
2
- export type { EmitOptions, EmitResult } from '@prisma-next/core-control-plane/emission';
3
- export { emit } from '@prisma-next/core-control-plane/emission';
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/exports/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,gBAAgB,EAChB,eAAe,EACf,iBAAiB,GAClB,MAAM,6BAA6B,CAAC;AACrC,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAExF,OAAO,EAAE,IAAI,EAAE,MAAM,0CAA0C,CAAC"}
@@ -1,2 +0,0 @@
1
- export type { TargetFamilyHook, TypesImportSpec, ValidationContext, } from '@prisma-next/contract/types';
2
- //# sourceMappingURL=target-family.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"target-family.d.ts","sourceRoot":"","sources":["../../src/target-family.ts"],"names":[],"mappings":"AAEA,YAAY,EACV,gBAAgB,EAChB,eAAe,EACf,iBAAiB,GAClB,MAAM,6BAA6B,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../test/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAoB,MAAM,0BAA0B,CAAC;AAE7E;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,GAAE,OAAO,CAAC,UAAU,CAAC,GAAG;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAO,GAChF,UAAU,CAyJZ"}