@prisma-next/contract 0.3.0-dev.134 → 0.3.0-dev.135
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.
- package/dist/framework-components.d.mts +109 -118
- package/dist/framework-components.d.mts.map +1 -1
- package/dist/framework-components.mjs +121 -1
- package/dist/framework-components.mjs.map +1 -1
- package/dist/types-BwcW0HFt.d.mts.map +1 -1
- package/package.json +5 -4
- package/src/exports/framework-components.ts +23 -4
- package/src/framework-authoring.ts +383 -0
- package/src/framework-components.ts +14 -120
|
@@ -1,7 +1,103 @@
|
|
|
1
1
|
import { O as RenderTypeContext, z as TypesImportSpec } from "./types-BwcW0HFt.mjs";
|
|
2
2
|
|
|
3
|
+
//#region src/framework-authoring.d.ts
|
|
4
|
+
type AuthoringArgRef = {
|
|
5
|
+
readonly kind: 'arg';
|
|
6
|
+
readonly index: number;
|
|
7
|
+
readonly path?: readonly string[];
|
|
8
|
+
readonly default?: AuthoringTemplateValue;
|
|
9
|
+
};
|
|
10
|
+
type AuthoringTemplateValue = string | number | boolean | null | AuthoringArgRef | readonly AuthoringTemplateValue[] | {
|
|
11
|
+
readonly [key: string]: AuthoringTemplateValue;
|
|
12
|
+
};
|
|
13
|
+
type AuthoringArgumentDescriptor = {
|
|
14
|
+
readonly kind: 'string';
|
|
15
|
+
readonly optional?: boolean;
|
|
16
|
+
} | {
|
|
17
|
+
readonly kind: 'number';
|
|
18
|
+
readonly optional?: boolean;
|
|
19
|
+
readonly integer?: boolean;
|
|
20
|
+
readonly minimum?: number;
|
|
21
|
+
readonly maximum?: number;
|
|
22
|
+
} | {
|
|
23
|
+
readonly kind: 'stringArray';
|
|
24
|
+
readonly optional?: boolean;
|
|
25
|
+
} | {
|
|
26
|
+
readonly kind: 'object';
|
|
27
|
+
readonly optional?: boolean;
|
|
28
|
+
readonly properties: Record<string, AuthoringArgumentDescriptor>;
|
|
29
|
+
};
|
|
30
|
+
interface AuthoringStorageTypeTemplate {
|
|
31
|
+
readonly codecId: string;
|
|
32
|
+
readonly nativeType: AuthoringTemplateValue;
|
|
33
|
+
readonly typeParams?: Record<string, AuthoringTemplateValue>;
|
|
34
|
+
}
|
|
35
|
+
interface AuthoringTypeConstructorDescriptor {
|
|
36
|
+
readonly kind: 'typeConstructor';
|
|
37
|
+
readonly args?: readonly AuthoringArgumentDescriptor[];
|
|
38
|
+
readonly output: AuthoringStorageTypeTemplate;
|
|
39
|
+
}
|
|
40
|
+
interface AuthoringColumnDefaultTemplateLiteral {
|
|
41
|
+
readonly kind: 'literal';
|
|
42
|
+
readonly value: AuthoringTemplateValue;
|
|
43
|
+
}
|
|
44
|
+
interface AuthoringColumnDefaultTemplateFunction {
|
|
45
|
+
readonly kind: 'function';
|
|
46
|
+
readonly expression: AuthoringTemplateValue;
|
|
47
|
+
}
|
|
48
|
+
type AuthoringColumnDefaultTemplate = AuthoringColumnDefaultTemplateLiteral | AuthoringColumnDefaultTemplateFunction;
|
|
49
|
+
interface AuthoringFieldPresetOutput extends AuthoringStorageTypeTemplate {
|
|
50
|
+
readonly nullable?: boolean;
|
|
51
|
+
readonly default?: AuthoringColumnDefaultTemplate;
|
|
52
|
+
readonly executionDefault?: AuthoringTemplateValue;
|
|
53
|
+
readonly id?: boolean;
|
|
54
|
+
readonly unique?: boolean;
|
|
55
|
+
}
|
|
56
|
+
interface AuthoringFieldPresetDescriptor {
|
|
57
|
+
readonly kind: 'fieldPreset';
|
|
58
|
+
readonly args?: readonly AuthoringArgumentDescriptor[];
|
|
59
|
+
readonly output: AuthoringFieldPresetOutput;
|
|
60
|
+
}
|
|
61
|
+
type AuthoringTypeNamespace = {
|
|
62
|
+
readonly [name: string]: AuthoringTypeConstructorDescriptor | AuthoringTypeNamespace;
|
|
63
|
+
};
|
|
64
|
+
type AuthoringFieldNamespace = {
|
|
65
|
+
readonly [name: string]: AuthoringFieldPresetDescriptor | AuthoringFieldNamespace;
|
|
66
|
+
};
|
|
67
|
+
interface AuthoringContributions {
|
|
68
|
+
readonly type?: AuthoringTypeNamespace;
|
|
69
|
+
readonly field?: AuthoringFieldNamespace;
|
|
70
|
+
}
|
|
71
|
+
declare function isAuthoringArgRef(value: unknown): value is AuthoringArgRef;
|
|
72
|
+
declare function isAuthoringTypeConstructorDescriptor(value: unknown): value is AuthoringTypeConstructorDescriptor;
|
|
73
|
+
declare function isAuthoringFieldPresetDescriptor(value: unknown): value is AuthoringFieldPresetDescriptor;
|
|
74
|
+
declare function resolveAuthoringTemplateValue(template: AuthoringTemplateValue, args: readonly unknown[]): unknown;
|
|
75
|
+
declare function validateAuthoringHelperArguments(helperPath: string, descriptors: readonly AuthoringArgumentDescriptor[] | undefined, args: readonly unknown[]): void;
|
|
76
|
+
declare function instantiateAuthoringTypeConstructor(descriptor: AuthoringTypeConstructorDescriptor, args: readonly unknown[]): {
|
|
77
|
+
readonly codecId: string;
|
|
78
|
+
readonly nativeType: string;
|
|
79
|
+
readonly typeParams?: Record<string, unknown>;
|
|
80
|
+
};
|
|
81
|
+
declare function instantiateAuthoringFieldPreset(descriptor: AuthoringFieldPresetDescriptor, args: readonly unknown[]): {
|
|
82
|
+
readonly descriptor: {
|
|
83
|
+
readonly codecId: string;
|
|
84
|
+
readonly nativeType: string;
|
|
85
|
+
readonly typeParams?: Record<string, unknown>;
|
|
86
|
+
};
|
|
87
|
+
readonly nullable: boolean;
|
|
88
|
+
readonly default?: {
|
|
89
|
+
readonly kind: 'literal';
|
|
90
|
+
readonly value: unknown;
|
|
91
|
+
} | {
|
|
92
|
+
readonly kind: 'function';
|
|
93
|
+
readonly expression: string;
|
|
94
|
+
};
|
|
95
|
+
readonly executionDefault?: unknown;
|
|
96
|
+
readonly id: boolean;
|
|
97
|
+
readonly unique: boolean;
|
|
98
|
+
};
|
|
99
|
+
//#endregion
|
|
3
100
|
//#region src/framework-components.d.ts
|
|
4
|
-
|
|
5
101
|
/**
|
|
6
102
|
* A template-based type renderer (structured form).
|
|
7
103
|
* Uses mustache-style placeholders (e.g., `Vector<{{length}}>`) that are
|
|
@@ -151,6 +247,14 @@ interface ComponentMetadata {
|
|
|
151
247
|
readonly nativeType?: string;
|
|
152
248
|
}>;
|
|
153
249
|
};
|
|
250
|
+
/**
|
|
251
|
+
* Optional pure-data authoring contributions exposed by this component.
|
|
252
|
+
*
|
|
253
|
+
* These contributions are safe to include on pack refs and descriptors because
|
|
254
|
+
* they contain only declarative metadata. Higher-level authoring packages may
|
|
255
|
+
* project them into concrete helper functions for TS-first workflows.
|
|
256
|
+
*/
|
|
257
|
+
readonly authoring?: AuthoringContributions;
|
|
154
258
|
}
|
|
155
259
|
/**
|
|
156
260
|
* Base descriptor for any framework component.
|
|
@@ -272,7 +376,9 @@ interface PackRefBase<Kind extends string, TFamilyId extends string> extends Com
|
|
|
272
376
|
readonly id: string;
|
|
273
377
|
readonly familyId: TFamilyId;
|
|
274
378
|
readonly targetId?: string;
|
|
379
|
+
readonly authoring?: AuthoringContributions;
|
|
275
380
|
}
|
|
381
|
+
type FamilyPackRef<TFamilyId extends string = string> = PackRefBase<'family', TFamilyId>;
|
|
276
382
|
type TargetPackRef<TFamilyId extends string = string, TTargetId extends string = string> = PackRefBase<'target', TFamilyId> & {
|
|
277
383
|
readonly targetId: TTargetId;
|
|
278
384
|
};
|
|
@@ -388,142 +494,27 @@ interface ExtensionDescriptor<TFamilyId extends string, TTargetId extends string
|
|
|
388
494
|
/** The target this extension is designed for */
|
|
389
495
|
readonly targetId: TTargetId;
|
|
390
496
|
}
|
|
391
|
-
/**
|
|
392
|
-
* Union type for target-bound component descriptors.
|
|
393
|
-
*
|
|
394
|
-
* Target-bound components are those that must be compatible with a specific
|
|
395
|
-
* family+target combination. This includes targets, adapters, drivers, and
|
|
396
|
-
* extensions. Families are not target-bound.
|
|
397
|
-
*
|
|
398
|
-
* This type is used in migration and verification interfaces to enforce
|
|
399
|
-
* type-level compatibility between components.
|
|
400
|
-
*
|
|
401
|
-
* @template TFamilyId - Literal type for the family identifier
|
|
402
|
-
* @template TTargetId - Literal type for the target identifier
|
|
403
|
-
*
|
|
404
|
-
* @example
|
|
405
|
-
* ```ts
|
|
406
|
-
* // All these components must have matching familyId and targetId
|
|
407
|
-
* const components: TargetBoundComponentDescriptor<'sql', 'postgres'>[] = [
|
|
408
|
-
* postgresTarget,
|
|
409
|
-
* postgresAdapter,
|
|
410
|
-
* postgresDriver,
|
|
411
|
-
* pgvectorExtension,
|
|
412
|
-
* ];
|
|
413
|
-
* ```
|
|
414
|
-
*/
|
|
497
|
+
/** Components bound to a specific family+target combination. */
|
|
415
498
|
type TargetBoundComponentDescriptor<TFamilyId extends string, TTargetId extends string> = TargetDescriptor<TFamilyId, TTargetId> | AdapterDescriptor<TFamilyId, TTargetId> | DriverDescriptor<TFamilyId, TTargetId> | ExtensionDescriptor<TFamilyId, TTargetId>;
|
|
416
|
-
/**
|
|
417
|
-
* Base interface for family instances.
|
|
418
|
-
*
|
|
419
|
-
* A family instance is created by a family descriptor's `create()` method.
|
|
420
|
-
* This base interface carries only the identity; plane-specific interfaces
|
|
421
|
-
* add domain actions (e.g., `emitContract`, `verify` on ControlFamilyInstance).
|
|
422
|
-
*
|
|
423
|
-
* @template TFamilyId - Literal type for the family identifier (e.g., 'sql', 'document')
|
|
424
|
-
*
|
|
425
|
-
* @example
|
|
426
|
-
* ```ts
|
|
427
|
-
* const instance = sql.create({ target, adapter, driver, extensions });
|
|
428
|
-
* instance.familyId // 'sql'
|
|
429
|
-
* ```
|
|
430
|
-
*/
|
|
431
499
|
interface FamilyInstance<TFamilyId extends string> {
|
|
432
|
-
/** The family identifier (e.g., 'sql', 'document') */
|
|
433
500
|
readonly familyId: TFamilyId;
|
|
434
501
|
}
|
|
435
|
-
/**
|
|
436
|
-
* Base interface for target instances.
|
|
437
|
-
*
|
|
438
|
-
* A target instance is created by a target descriptor's `create()` method.
|
|
439
|
-
* This base interface carries only the identity; plane-specific interfaces
|
|
440
|
-
* add target-specific behavior.
|
|
441
|
-
*
|
|
442
|
-
* @template TFamilyId - Literal type for the family identifier
|
|
443
|
-
* @template TTargetId - Literal type for the target identifier (e.g., 'postgres', 'mysql')
|
|
444
|
-
*
|
|
445
|
-
* @example
|
|
446
|
-
* ```ts
|
|
447
|
-
* const instance = postgres.create();
|
|
448
|
-
* instance.familyId // 'sql'
|
|
449
|
-
* instance.targetId // 'postgres'
|
|
450
|
-
* ```
|
|
451
|
-
*/
|
|
452
502
|
interface TargetInstance<TFamilyId extends string, TTargetId extends string> {
|
|
453
|
-
/** The family this target belongs to */
|
|
454
503
|
readonly familyId: TFamilyId;
|
|
455
|
-
/** The target identifier (e.g., 'postgres', 'mysql', 'mongodb') */
|
|
456
504
|
readonly targetId: TTargetId;
|
|
457
505
|
}
|
|
458
|
-
/**
|
|
459
|
-
* Base interface for adapter instances.
|
|
460
|
-
*
|
|
461
|
-
* An adapter instance is created by an adapter descriptor's `create()` method.
|
|
462
|
-
* This base interface carries only the identity; plane-specific interfaces
|
|
463
|
-
* add adapter-specific behavior (e.g., codec registration, query lowering).
|
|
464
|
-
*
|
|
465
|
-
* @template TFamilyId - Literal type for the family identifier
|
|
466
|
-
* @template TTargetId - Literal type for the target identifier
|
|
467
|
-
*
|
|
468
|
-
* @example
|
|
469
|
-
* ```ts
|
|
470
|
-
* const instance = postgresAdapter.create();
|
|
471
|
-
* instance.familyId // 'sql'
|
|
472
|
-
* instance.targetId // 'postgres'
|
|
473
|
-
* ```
|
|
474
|
-
*/
|
|
475
506
|
interface AdapterInstance<TFamilyId extends string, TTargetId extends string> {
|
|
476
|
-
/** The family this adapter belongs to */
|
|
477
507
|
readonly familyId: TFamilyId;
|
|
478
|
-
/** The target this adapter is designed for */
|
|
479
508
|
readonly targetId: TTargetId;
|
|
480
509
|
}
|
|
481
|
-
/**
|
|
482
|
-
* Base interface for driver instances.
|
|
483
|
-
*
|
|
484
|
-
* A driver instance is created by a driver descriptor's `create()` method.
|
|
485
|
-
* This base interface carries only the identity; plane-specific interfaces
|
|
486
|
-
* add driver-specific behavior (e.g., `query`, `close` on ControlDriverInstance).
|
|
487
|
-
*
|
|
488
|
-
* @template TFamilyId - Literal type for the family identifier
|
|
489
|
-
* @template TTargetId - Literal type for the target identifier
|
|
490
|
-
*
|
|
491
|
-
* @example
|
|
492
|
-
* ```ts
|
|
493
|
-
* const instance = postgresDriver.create({ databaseUrl });
|
|
494
|
-
* instance.familyId // 'sql'
|
|
495
|
-
* instance.targetId // 'postgres'
|
|
496
|
-
* ```
|
|
497
|
-
*/
|
|
498
510
|
interface DriverInstance<TFamilyId extends string, TTargetId extends string> {
|
|
499
|
-
/** The family this driver belongs to */
|
|
500
511
|
readonly familyId: TFamilyId;
|
|
501
|
-
/** The target this driver connects to */
|
|
502
512
|
readonly targetId: TTargetId;
|
|
503
513
|
}
|
|
504
|
-
/**
|
|
505
|
-
* Base interface for extension instances.
|
|
506
|
-
*
|
|
507
|
-
* An extension instance is created by an extension descriptor's `create()` method.
|
|
508
|
-
* This base interface carries only the identity; plane-specific interfaces
|
|
509
|
-
* add extension-specific behavior.
|
|
510
|
-
*
|
|
511
|
-
* @template TFamilyId - Literal type for the family identifier
|
|
512
|
-
* @template TTargetId - Literal type for the target identifier
|
|
513
|
-
*
|
|
514
|
-
* @example
|
|
515
|
-
* ```ts
|
|
516
|
-
* const instance = pgvector.create();
|
|
517
|
-
* instance.familyId // 'sql'
|
|
518
|
-
* instance.targetId // 'postgres'
|
|
519
|
-
* ```
|
|
520
|
-
*/
|
|
521
514
|
interface ExtensionInstance<TFamilyId extends string, TTargetId extends string> {
|
|
522
|
-
/** The family this extension belongs to */
|
|
523
515
|
readonly familyId: TFamilyId;
|
|
524
|
-
/** The target this extension is designed for */
|
|
525
516
|
readonly targetId: TTargetId;
|
|
526
517
|
}
|
|
527
518
|
//#endregion
|
|
528
|
-
export { type AdapterDescriptor, type AdapterInstance, type AdapterPackRef, type ComponentDescriptor, type ComponentMetadata, type ContractComponentRequirementsCheckInput, type ContractComponentRequirementsCheckResult, type DriverDescriptor, type DriverInstance, type DriverPackRef, type ExtensionDescriptor, type ExtensionInstance, type ExtensionPackRef, type FamilyDescriptor, type FamilyInstance, type NormalizedTypeRenderer, type PackRefBase, type TargetBoundComponentDescriptor, type TargetDescriptor, type TargetInstance, type TargetPackRef, type TypeRenderer, type TypeRendererFunction, type TypeRendererTemplate, checkContractComponentRequirements, interpolateTypeTemplate, normalizeRenderer };
|
|
519
|
+
export { type AdapterDescriptor, type AdapterInstance, type AdapterPackRef, type AuthoringArgRef, type AuthoringArgumentDescriptor, type AuthoringColumnDefaultTemplate, type AuthoringContributions, type AuthoringFieldNamespace, type AuthoringFieldPresetDescriptor, type AuthoringFieldPresetOutput, type AuthoringStorageTypeTemplate, type AuthoringTemplateValue, type AuthoringTypeConstructorDescriptor, type AuthoringTypeNamespace, type ComponentDescriptor, type ComponentMetadata, type ContractComponentRequirementsCheckInput, type ContractComponentRequirementsCheckResult, type DriverDescriptor, type DriverInstance, type DriverPackRef, type ExtensionDescriptor, type ExtensionInstance, type ExtensionPackRef, type FamilyDescriptor, type FamilyInstance, type FamilyPackRef, type NormalizedTypeRenderer, type PackRefBase, type TargetBoundComponentDescriptor, type TargetDescriptor, type TargetInstance, type TargetPackRef, type TypeRenderer, type TypeRendererFunction, type TypeRendererTemplate, checkContractComponentRequirements, instantiateAuthoringFieldPreset, instantiateAuthoringTypeConstructor, interpolateTypeTemplate, isAuthoringArgRef, isAuthoringFieldPresetDescriptor, isAuthoringTypeConstructorDescriptor, normalizeRenderer, resolveAuthoringTemplateValue, validateAuthoringHelperArguments };
|
|
529
520
|
//# sourceMappingURL=framework-components.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"framework-components.d.mts","names":[],"sources":["../src/framework-components.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"framework-components.d.mts","names":[],"sources":["../src/framework-authoring.ts","../src/framework-components.ts"],"sourcesContent":[],"mappings":";;;KAEY,eAAA;;;EAAA,SAAA,IAAA,CAAA,EAAA,SAAe,MA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AvVO,MAuVP,CAAA,MAAA,EAvVsB,YAuVtB,CAAA;MAAW;;;AAEnC;AAIA;AAKA;AAKA;AAKA;6BAnW6B,cAAc;;;;;mCAKR;;;uBAEc;;uBAC1B;;;;;;;;;;;;;;uBAeA;;;;;;;;;;;;;;;;;;;;;UAsBN,iDAAiD;;iBAEjD;;;;UAMA,uCAAA;;;;8BAIa;;;;iCAIG;;UAGhB,wCAAA;;;;;;;;;;;iBAMD,kCAAA,QACP,0CACN;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA6Dc,mDAAmD;;qBAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA8BJ,6EACP;;qBAEW;;qBAGA;;;;;;UAOJ,mEACP;iBACO;;qBAEI;;uBAEE;;KAGX,mDAAmD,sBAAsB;KAEzE,sFAGR,sBAAsB;qBACL;;KAGT,uFAGR,uBAAuB;qBACN;;KAGT,yFAGR,yBAAyB;qBACR;;KAGT,sFAGR,sBAAsB;qBACL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA+BJ,8EACP;;qBAEW;;qBAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAiCJ,6EACP;;qBAEW;;qBAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA8BJ,gFACP;;qBAEW;;qBAGA;;;KAIT,qFACR,iBAAiB,WAAW,aAC5B,kBAAkB,WAAW,aAC7B,iBAAiB,WAAW,aAC5B,oBAAoB,WAAW;UAElB;qBACI;;UAGJ;qBACI;qBACA;;UAGJ;qBACI;qBACA;;UAGJ;qBACI;qBACA;;UAGJ;qBACI;qBACA"}
|
|
@@ -1,3 +1,123 @@
|
|
|
1
|
+
import { ifDefined } from "@prisma-next/utils/defined";
|
|
2
|
+
|
|
3
|
+
//#region src/framework-authoring.ts
|
|
4
|
+
function isAuthoringArgRef(value) {
|
|
5
|
+
if (typeof value !== "object" || value === null || value.kind !== "arg") return false;
|
|
6
|
+
const { index, path } = value;
|
|
7
|
+
if (typeof index !== "number" || !Number.isInteger(index) || index < 0) return false;
|
|
8
|
+
if (path !== void 0 && (!Array.isArray(path) || path.some((s) => typeof s !== "string"))) return false;
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
function isAuthoringTemplateRecord(value) {
|
|
12
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
13
|
+
}
|
|
14
|
+
function isAuthoringTypeConstructorDescriptor(value) {
|
|
15
|
+
return typeof value === "object" && value !== null && value.kind === "typeConstructor" && typeof value.output === "object" && value.output !== null;
|
|
16
|
+
}
|
|
17
|
+
function isAuthoringFieldPresetDescriptor(value) {
|
|
18
|
+
return typeof value === "object" && value !== null && value.kind === "fieldPreset" && typeof value.output === "object" && value.output !== null;
|
|
19
|
+
}
|
|
20
|
+
function resolveAuthoringTemplateValue(template, args) {
|
|
21
|
+
if (isAuthoringArgRef(template)) {
|
|
22
|
+
let value = args[template.index];
|
|
23
|
+
for (const segment of template.path ?? []) {
|
|
24
|
+
if (!isAuthoringTemplateRecord(value) || !Object.hasOwn(value, segment)) {
|
|
25
|
+
value = void 0;
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
value = value[segment];
|
|
29
|
+
}
|
|
30
|
+
if (value === void 0 && template.default !== void 0) return resolveAuthoringTemplateValue(template.default, args);
|
|
31
|
+
return value;
|
|
32
|
+
}
|
|
33
|
+
if (Array.isArray(template)) return template.map((value) => resolveAuthoringTemplateValue(value, args));
|
|
34
|
+
if (typeof template === "object" && template !== null) {
|
|
35
|
+
const resolved = {};
|
|
36
|
+
for (const [key, value] of Object.entries(template)) {
|
|
37
|
+
const resolvedValue = resolveAuthoringTemplateValue(value, args);
|
|
38
|
+
if (resolvedValue !== void 0) resolved[key] = resolvedValue;
|
|
39
|
+
}
|
|
40
|
+
return resolved;
|
|
41
|
+
}
|
|
42
|
+
return template;
|
|
43
|
+
}
|
|
44
|
+
function validateAuthoringArgument(descriptor, value, path) {
|
|
45
|
+
if (value === void 0) {
|
|
46
|
+
if (descriptor.optional) return;
|
|
47
|
+
throw new Error(`Missing required authoring helper argument at ${path}`);
|
|
48
|
+
}
|
|
49
|
+
if (descriptor.kind === "string") {
|
|
50
|
+
if (typeof value !== "string") throw new Error(`Authoring helper argument at ${path} must be a string`);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (descriptor.kind === "stringArray") {
|
|
54
|
+
if (!Array.isArray(value)) throw new Error(`Authoring helper argument at ${path} must be an array of strings`);
|
|
55
|
+
for (const entry of value) if (typeof entry !== "string") throw new Error(`Authoring helper argument at ${path} must be an array of strings`);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (descriptor.kind === "object") {
|
|
59
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) throw new Error(`Authoring helper argument at ${path} must be an object`);
|
|
60
|
+
const input = value;
|
|
61
|
+
const expectedKeys = new Set(Object.keys(descriptor.properties));
|
|
62
|
+
for (const key of Object.keys(input)) if (!expectedKeys.has(key)) throw new Error(`Authoring helper argument at ${path} contains unknown property "${key}"`);
|
|
63
|
+
for (const [key, propertyDescriptor] of Object.entries(descriptor.properties)) validateAuthoringArgument(propertyDescriptor, input[key], `${path}.${key}`);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (typeof value !== "number" || Number.isNaN(value)) throw new Error(`Authoring helper argument at ${path} must be a number`);
|
|
67
|
+
if (descriptor.integer && !Number.isInteger(value)) throw new Error(`Authoring helper argument at ${path} must be an integer`);
|
|
68
|
+
if (descriptor.minimum !== void 0 && value < descriptor.minimum) throw new Error(`Authoring helper argument at ${path} must be >= ${descriptor.minimum}, received ${value}`);
|
|
69
|
+
if (descriptor.maximum !== void 0 && value > descriptor.maximum) throw new Error(`Authoring helper argument at ${path} must be <= ${descriptor.maximum}, received ${value}`);
|
|
70
|
+
}
|
|
71
|
+
function validateAuthoringHelperArguments(helperPath, descriptors, args) {
|
|
72
|
+
const expected = descriptors ?? [];
|
|
73
|
+
const minimumArgs = expected.reduce((count, descriptor, index) => descriptor.optional ? count : index + 1, 0);
|
|
74
|
+
if (args.length < minimumArgs || args.length > expected.length) throw new Error(`${helperPath} expects ${minimumArgs === expected.length ? expected.length : `${minimumArgs}-${expected.length}`} argument(s), received ${args.length}`);
|
|
75
|
+
expected.forEach((descriptor, index) => {
|
|
76
|
+
validateAuthoringArgument(descriptor, args[index], `${helperPath}[${index}]`);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
function resolveAuthoringStorageTypeTemplate(template, args) {
|
|
80
|
+
const nativeType = resolveAuthoringTemplateValue(template.nativeType, args);
|
|
81
|
+
if (typeof nativeType !== "string") throw new Error(`Resolved authoring nativeType must be a string for codec "${template.codecId}", received ${String(nativeType)}`);
|
|
82
|
+
const typeParams = template.typeParams === void 0 ? void 0 : resolveAuthoringTemplateValue(template.typeParams, args);
|
|
83
|
+
if (typeParams !== void 0 && !isAuthoringTemplateRecord(typeParams)) throw new Error(`Resolved authoring typeParams must be an object for codec "${template.codecId}", received ${String(typeParams)}`);
|
|
84
|
+
return {
|
|
85
|
+
codecId: template.codecId,
|
|
86
|
+
nativeType,
|
|
87
|
+
...typeParams === void 0 ? {} : { typeParams }
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
function resolveAuthoringColumnDefaultTemplate(template, args) {
|
|
91
|
+
if (template.kind === "literal") {
|
|
92
|
+
const value = resolveAuthoringTemplateValue(template.value, args);
|
|
93
|
+
if (value === void 0) throw new Error("Resolved authoring literal default must not be undefined");
|
|
94
|
+
return {
|
|
95
|
+
kind: "literal",
|
|
96
|
+
value
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
const expression = resolveAuthoringTemplateValue(template.expression, args);
|
|
100
|
+
if (expression === void 0 || typeof expression === "object" && expression !== null) throw new Error(`Resolved authoring function default expression must resolve to a primitive, received ${String(expression)}`);
|
|
101
|
+
return {
|
|
102
|
+
kind: "function",
|
|
103
|
+
expression: String(expression)
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
function instantiateAuthoringTypeConstructor(descriptor, args) {
|
|
107
|
+
return resolveAuthoringStorageTypeTemplate(descriptor.output, args);
|
|
108
|
+
}
|
|
109
|
+
function instantiateAuthoringFieldPreset(descriptor, args) {
|
|
110
|
+
return {
|
|
111
|
+
descriptor: resolveAuthoringStorageTypeTemplate(descriptor.output, args),
|
|
112
|
+
nullable: descriptor.output.nullable ?? false,
|
|
113
|
+
...ifDefined("default", descriptor.output.default !== void 0 ? resolveAuthoringColumnDefaultTemplate(descriptor.output.default, args) : void 0),
|
|
114
|
+
...ifDefined("executionDefault", descriptor.output.executionDefault !== void 0 ? resolveAuthoringTemplateValue(descriptor.output.executionDefault, args) : void 0),
|
|
115
|
+
id: descriptor.output.id ?? false,
|
|
116
|
+
unique: descriptor.output.unique ?? false
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
//#endregion
|
|
1
121
|
//#region src/framework-components.ts
|
|
2
122
|
/**
|
|
3
123
|
* Interpolates a template string with params values.
|
|
@@ -66,5 +186,5 @@ function checkContractComponentRequirements(input) {
|
|
|
66
186
|
}
|
|
67
187
|
|
|
68
188
|
//#endregion
|
|
69
|
-
export { checkContractComponentRequirements, interpolateTypeTemplate, normalizeRenderer };
|
|
189
|
+
export { checkContractComponentRequirements, instantiateAuthoringFieldPreset, instantiateAuthoringTypeConstructor, interpolateTypeTemplate, isAuthoringArgRef, isAuthoringFieldPresetDescriptor, isAuthoringTypeConstructorDescriptor, normalizeRenderer, resolveAuthoringTemplateValue, validateAuthoringHelperArguments };
|
|
70
190
|
//# sourceMappingURL=framework-components.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"framework-components.mjs","names":[],"sources":["../src/framework-components.ts"],"sourcesContent":["import type { RenderTypeContext, TypesImportSpec } from './types';\n\n/**\n * A template-based type renderer (structured form).\n * Uses mustache-style placeholders (e.g., `Vector<{{length}}>`) that are\n * replaced with typeParams values during rendering.\n *\n * @example\n * ```ts\n * { kind: 'template', template: 'Vector<{{length}}>' }\n * // With typeParams { length: 1536 }, renders: 'Vector<1536>'\n * ```\n */\nexport interface TypeRendererTemplate {\n readonly kind: 'template';\n /** Template string with `{{key}}` placeholders for typeParams values */\n readonly template: string;\n}\n\n/**\n * A function-based type renderer for full control over type expression generation.\n *\n * @example\n * ```ts\n * {\n * kind: 'function',\n * render: (params, ctx) => `Vector<${params.length}>`\n * }\n * ```\n */\nexport interface TypeRendererFunction {\n readonly kind: 'function';\n /** Render function that produces a TypeScript type expression */\n readonly render: (params: Record<string, unknown>, ctx: RenderTypeContext) => string;\n}\n\n/**\n * A raw template string type renderer (convenience form).\n * Shorthand for TypeRendererTemplate - just the template string without wrapper.\n *\n * @example\n * ```ts\n * 'Vector<{{length}}>'\n * // Equivalent to: { kind: 'template', template: 'Vector<{{length}}>' }\n * ```\n */\nexport type TypeRendererString = string;\n\n/**\n * A raw function type renderer (convenience form).\n * Shorthand for TypeRendererFunction - just the function without wrapper.\n *\n * @example\n * ```ts\n * (params, ctx) => `Vector<${params.length}>`\n * // Equivalent to: { kind: 'function', render: ... }\n * ```\n */\nexport type TypeRendererRawFunction = (\n params: Record<string, unknown>,\n ctx: RenderTypeContext,\n) => string;\n\n/**\n * Union of type renderer formats.\n *\n * Supports both structured forms (with `kind` discriminator) and convenience forms:\n * - `string` - Template string with `{{key}}` placeholders (manifest-safe, JSON-serializable)\n * - `function` - Render function for full control (requires runtime execution)\n * - `{ kind: 'template', template: string }` - Structured template form\n * - `{ kind: 'function', render: fn }` - Structured function form\n *\n * Templates are normalized to functions during pack assembly.\n * **Prefer template strings** for most cases - they are JSON-serializable.\n */\nexport type TypeRenderer =\n | TypeRendererString\n | TypeRendererRawFunction\n | TypeRendererTemplate\n | TypeRendererFunction;\n\n/**\n * Normalized type renderer - always a function after assembly.\n * This is the form received by the emitter.\n */\nexport interface NormalizedTypeRenderer {\n readonly codecId: string;\n readonly render: (params: Record<string, unknown>, ctx: RenderTypeContext) => string;\n}\n\n/**\n * Interpolates a template string with params values.\n * Used internally by normalizeRenderer to compile templates to functions.\n *\n * @throws Error if a placeholder key is not found in params (except 'CodecTypes')\n */\nexport function interpolateTypeTemplate(\n template: string,\n params: Record<string, unknown>,\n ctx: RenderTypeContext,\n): string {\n return template.replace(/\\{\\{(\\w+)\\}\\}/g, (_, key: string) => {\n if (key === 'CodecTypes') return ctx.codecTypesName;\n const value = params[key];\n if (value === undefined) {\n throw new Error(\n `Missing template parameter \"${key}\" in template \"${template}\". ` +\n `Available params: ${Object.keys(params).join(', ') || '(none)'}`,\n );\n }\n return String(value);\n });\n}\n\n/**\n * Normalizes a TypeRenderer to function form.\n * Called during pack assembly, not at emission time.\n *\n * Handles all TypeRenderer forms:\n * - Raw string template: `'Vector<{{length}}>'`\n * - Raw function: `(params, ctx) => ...`\n * - Structured template: `{ kind: 'template', template: '...' }`\n * - Structured function: `{ kind: 'function', render: fn }`\n */\nexport function normalizeRenderer(codecId: string, renderer: TypeRenderer): NormalizedTypeRenderer {\n // Handle raw string (template shorthand)\n if (typeof renderer === 'string') {\n return {\n codecId,\n render: (params, ctx) => interpolateTypeTemplate(renderer, params, ctx),\n };\n }\n\n // Handle raw function (function shorthand)\n if (typeof renderer === 'function') {\n return { codecId, render: renderer };\n }\n\n // Handle structured function form\n if (renderer.kind === 'function') {\n return { codecId, render: renderer.render };\n }\n\n // Handle structured template form\n const { template } = renderer;\n return {\n codecId,\n render: (params, ctx) => interpolateTypeTemplate(template, params, ctx),\n };\n}\n\n/**\n * Declarative fields that describe component metadata.\n */\nexport interface ComponentMetadata {\n /** Component version (semver) */\n readonly version: string;\n\n /**\n * Capabilities this component provides.\n *\n * For adapters, capabilities must be declared on the adapter descriptor (so they are emitted into\n * the contract) and also exposed in runtime adapter code (e.g. `adapter.profile.capabilities`);\n * keep these declarations in sync. Targets are identifiers/descriptors and typically do not\n * declare capabilities.\n */\n readonly capabilities?: Record<string, unknown>;\n\n /** Type imports for contract.d.ts generation */\n readonly types?: {\n readonly codecTypes?: {\n /**\n * Base codec types import spec.\n * Optional: adapters typically provide this, extensions usually don't.\n */\n readonly import?: TypesImportSpec;\n /**\n * Optional renderers for parameterized codecs owned by this component.\n * Key is codecId (e.g., 'pg/vector@1'), value is the type renderer.\n *\n * Templates are normalized to functions during pack assembly.\n * Duplicate codecId across descriptors is a hard error.\n */\n readonly parameterized?: Record<string, TypeRenderer>;\n /**\n * Optional additional type-only imports required by parameterized renderers.\n *\n * These imports are included in generated `contract.d.ts` but are NOT treated as\n * codec type maps (i.e., they should not be intersected into `export type CodecTypes = ...`).\n *\n * Example: `Vector<N>` for pgvector renderers that emit `Vector<{{length}}>`\n */\n readonly typeImports?: ReadonlyArray<TypesImportSpec>;\n /**\n * Optional control-plane hooks keyed by codecId.\n * Used by family-specific planners/verifiers to handle storage types.\n */\n readonly controlPlaneHooks?: Record<string, unknown>;\n };\n readonly operationTypes?: { readonly import: TypesImportSpec };\n readonly storage?: ReadonlyArray<{\n readonly typeId: string;\n readonly familyId: string;\n readonly targetId: string;\n readonly nativeType?: string;\n }>;\n };\n}\n\n/**\n * Base descriptor for any framework component.\n *\n * All component descriptors share these fundamental properties that identify\n * the component and provide its metadata. This interface is extended by\n * specific descriptor types (FamilyDescriptor, TargetDescriptor, etc.).\n *\n * @template Kind - Discriminator literal identifying the component type.\n * Built-in kinds are 'family', 'target', 'adapter', 'driver', 'extension',\n * but the type accepts any string to allow ecosystem extensions.\n *\n * @example\n * ```ts\n * // All descriptors have these properties\n * descriptor.kind // The Kind type parameter (e.g., 'family', 'target', or custom kinds)\n * descriptor.id // Unique string identifier (e.g., 'sql', 'postgres')\n * descriptor.version // Component version (semver)\n * ```\n */\nexport interface ComponentDescriptor<Kind extends string> extends ComponentMetadata {\n /** Discriminator identifying the component type */\n readonly kind: Kind;\n\n /** Unique identifier for this component (e.g., 'sql', 'postgres', 'pgvector') */\n readonly id: string;\n}\n\nexport interface ContractComponentRequirementsCheckInput {\n readonly contract: {\n readonly target: string;\n readonly targetFamily?: string | undefined;\n readonly extensionPacks?: Record<string, unknown> | undefined;\n };\n readonly expectedTargetFamily?: string | undefined;\n readonly expectedTargetId?: string | undefined;\n readonly providedComponentIds: Iterable<string>;\n}\n\nexport interface ContractComponentRequirementsCheckResult {\n readonly familyMismatch?: { readonly expected: string; readonly actual: string } | undefined;\n readonly targetMismatch?: { readonly expected: string; readonly actual: string } | undefined;\n readonly missingExtensionPackIds: readonly string[];\n}\n\nexport function checkContractComponentRequirements(\n input: ContractComponentRequirementsCheckInput,\n): ContractComponentRequirementsCheckResult {\n const providedIds = new Set<string>();\n for (const id of input.providedComponentIds) {\n providedIds.add(id);\n }\n\n const requiredExtensionPackIds = input.contract.extensionPacks\n ? Object.keys(input.contract.extensionPacks)\n : [];\n const missingExtensionPackIds = requiredExtensionPackIds.filter((id) => !providedIds.has(id));\n\n const expectedTargetFamily = input.expectedTargetFamily;\n const contractTargetFamily = input.contract.targetFamily;\n const familyMismatch =\n expectedTargetFamily !== undefined &&\n contractTargetFamily !== undefined &&\n contractTargetFamily !== expectedTargetFamily\n ? { expected: expectedTargetFamily, actual: contractTargetFamily }\n : undefined;\n\n const expectedTargetId = input.expectedTargetId;\n const contractTargetId = input.contract.target;\n const targetMismatch =\n expectedTargetId !== undefined && contractTargetId !== expectedTargetId\n ? { expected: expectedTargetId, actual: contractTargetId }\n : undefined;\n\n return {\n ...(familyMismatch ? { familyMismatch } : {}),\n ...(targetMismatch ? { targetMismatch } : {}),\n missingExtensionPackIds,\n };\n}\n\n/**\n * Descriptor for a family component.\n *\n * A \"family\" represents a category of data sources with shared semantics\n * (e.g., SQL databases, document stores). Families define:\n * - Query semantics and operations (SELECT, INSERT, find, aggregate, etc.)\n * - Contract structure (tables vs collections, columns vs fields)\n * - Type system and codecs\n *\n * Families are the top-level grouping. Each family contains multiple targets\n * (e.g., SQL family contains Postgres, MySQL, SQLite targets).\n *\n * Extended by plane-specific descriptors:\n * - `ControlFamilyDescriptor` - adds `hook` for CLI/tooling operations\n * - `RuntimeFamilyDescriptor` - adds runtime-specific factory methods\n *\n * @template TFamilyId - Literal type for the family identifier (e.g., 'sql', 'document')\n *\n * @example\n * ```ts\n * import sql from '@prisma-next/family-sql/control';\n *\n * sql.kind // 'family'\n * sql.familyId // 'sql'\n * sql.id // 'sql'\n * ```\n */\nexport interface FamilyDescriptor<TFamilyId extends string> extends ComponentDescriptor<'family'> {\n /** The family identifier (e.g., 'sql', 'document') */\n readonly familyId: TFamilyId;\n}\n\n/**\n * Descriptor for a target component.\n *\n * A \"target\" represents a specific database or data store within a family\n * (e.g., Postgres, MySQL, MongoDB). Targets define:\n * - Native type mappings (e.g., Postgres int4 → TypeScript number)\n * - Target-specific capabilities (e.g., RETURNING, LATERAL joins)\n *\n * Targets are bound to a family and provide the target-specific implementation\n * details that adapters and drivers use.\n *\n * Extended by plane-specific descriptors:\n * - `ControlTargetDescriptor` - adds optional `migrations` capability\n * - `RuntimeTargetDescriptor` - adds runtime factory method\n *\n * @template TFamilyId - Literal type for the family identifier\n * @template TTargetId - Literal type for the target identifier (e.g., 'postgres', 'mysql')\n *\n * @example\n * ```ts\n * import postgres from '@prisma-next/target-postgres/control';\n *\n * postgres.kind // 'target'\n * postgres.familyId // 'sql'\n * postgres.targetId // 'postgres'\n * ```\n */\nexport interface TargetDescriptor<TFamilyId extends string, TTargetId extends string>\n extends ComponentDescriptor<'target'> {\n /** The family this target belongs to */\n readonly familyId: TFamilyId;\n\n /** The target identifier (e.g., 'postgres', 'mysql', 'mongodb') */\n readonly targetId: TTargetId;\n}\n\n/**\n * Base shape for any pack reference.\n * Pack refs are pure JSON-friendly objects safe to import in authoring flows.\n */\nexport interface PackRefBase<Kind extends string, TFamilyId extends string>\n extends ComponentMetadata {\n readonly kind: Kind;\n readonly id: string;\n readonly familyId: TFamilyId;\n readonly targetId?: string;\n}\n\nexport type TargetPackRef<\n TFamilyId extends string = string,\n TTargetId extends string = string,\n> = PackRefBase<'target', TFamilyId> & {\n readonly targetId: TTargetId;\n};\n\nexport type AdapterPackRef<\n TFamilyId extends string = string,\n TTargetId extends string = string,\n> = PackRefBase<'adapter', TFamilyId> & {\n readonly targetId: TTargetId;\n};\n\nexport type ExtensionPackRef<\n TFamilyId extends string = string,\n TTargetId extends string = string,\n> = PackRefBase<'extension', TFamilyId> & {\n readonly targetId: TTargetId;\n};\n\nexport type DriverPackRef<\n TFamilyId extends string = string,\n TTargetId extends string = string,\n> = PackRefBase<'driver', TFamilyId> & {\n readonly targetId: TTargetId;\n};\n\n/**\n * Descriptor for an adapter component.\n *\n * An \"adapter\" provides the protocol and dialect implementation for a target.\n * Adapters handle:\n * - SQL/query generation (lowering AST to target-specific syntax)\n * - Codec registration (encoding/decoding between JS and wire types)\n * - Type mappings and coercions\n *\n * Adapters are bound to a specific family+target combination and work with\n * any compatible driver for that target.\n *\n * Extended by plane-specific descriptors:\n * - `ControlAdapterDescriptor` - control-plane factory\n * - `RuntimeAdapterDescriptor` - runtime factory\n *\n * @template TFamilyId - Literal type for the family identifier\n * @template TTargetId - Literal type for the target identifier\n *\n * @example\n * ```ts\n * import postgresAdapter from '@prisma-next/adapter-postgres/control';\n *\n * postgresAdapter.kind // 'adapter'\n * postgresAdapter.familyId // 'sql'\n * postgresAdapter.targetId // 'postgres'\n * ```\n */\nexport interface AdapterDescriptor<TFamilyId extends string, TTargetId extends string>\n extends ComponentDescriptor<'adapter'> {\n /** The family this adapter belongs to */\n readonly familyId: TFamilyId;\n\n /** The target this adapter is designed for */\n readonly targetId: TTargetId;\n}\n\n/**\n * Descriptor for a driver component.\n *\n * A \"driver\" provides the connection and execution layer for a target.\n * Drivers handle:\n * - Connection management (pooling, timeouts, retries)\n * - Query execution (sending SQL/commands, receiving results)\n * - Transaction management\n * - Wire protocol communication\n *\n * Drivers are bound to a specific family+target and work with any compatible\n * adapter. Multiple drivers can exist for the same target (e.g., node-postgres\n * vs postgres.js for Postgres).\n *\n * Extended by plane-specific descriptors:\n * - `ControlDriverDescriptor` - creates driver from connection URL\n * - `RuntimeDriverDescriptor` - creates driver with runtime options\n *\n * @template TFamilyId - Literal type for the family identifier\n * @template TTargetId - Literal type for the target identifier\n *\n * @example\n * ```ts\n * import postgresDriver from '@prisma-next/driver-postgres/control';\n *\n * postgresDriver.kind // 'driver'\n * postgresDriver.familyId // 'sql'\n * postgresDriver.targetId // 'postgres'\n * ```\n */\nexport interface DriverDescriptor<TFamilyId extends string, TTargetId extends string>\n extends ComponentDescriptor<'driver'> {\n /** The family this driver belongs to */\n readonly familyId: TFamilyId;\n\n /** The target this driver connects to */\n readonly targetId: TTargetId;\n}\n\n/**\n * Descriptor for an extension component.\n *\n * An \"extension\" adds optional capabilities to a target. Extensions can provide:\n * - Additional operations (e.g., vector similarity search with pgvector)\n * - Custom types and codecs (e.g., vector type)\n * - Extended query capabilities\n *\n * Extensions are bound to a specific family+target and are registered in the\n * config alongside the core components. Multiple extensions can be used together.\n *\n * Extended by plane-specific descriptors:\n * - `ControlExtensionDescriptor` - control-plane extension factory\n * - `RuntimeExtensionDescriptor` - runtime extension factory\n *\n * @template TFamilyId - Literal type for the family identifier\n * @template TTargetId - Literal type for the target identifier\n *\n * @example\n * ```ts\n * import pgvector from '@prisma-next/extension-pgvector/control';\n *\n * pgvector.kind // 'extension'\n * pgvector.familyId // 'sql'\n * pgvector.targetId // 'postgres'\n * ```\n */\nexport interface ExtensionDescriptor<TFamilyId extends string, TTargetId extends string>\n extends ComponentDescriptor<'extension'> {\n /** The family this extension belongs to */\n readonly familyId: TFamilyId;\n\n /** The target this extension is designed for */\n readonly targetId: TTargetId;\n}\n\n/**\n * Union type for target-bound component descriptors.\n *\n * Target-bound components are those that must be compatible with a specific\n * family+target combination. This includes targets, adapters, drivers, and\n * extensions. Families are not target-bound.\n *\n * This type is used in migration and verification interfaces to enforce\n * type-level compatibility between components.\n *\n * @template TFamilyId - Literal type for the family identifier\n * @template TTargetId - Literal type for the target identifier\n *\n * @example\n * ```ts\n * // All these components must have matching familyId and targetId\n * const components: TargetBoundComponentDescriptor<'sql', 'postgres'>[] = [\n * postgresTarget,\n * postgresAdapter,\n * postgresDriver,\n * pgvectorExtension,\n * ];\n * ```\n */\nexport type TargetBoundComponentDescriptor<TFamilyId extends string, TTargetId extends string> =\n | TargetDescriptor<TFamilyId, TTargetId>\n | AdapterDescriptor<TFamilyId, TTargetId>\n | DriverDescriptor<TFamilyId, TTargetId>\n | ExtensionDescriptor<TFamilyId, TTargetId>;\n\n/**\n * Base interface for family instances.\n *\n * A family instance is created by a family descriptor's `create()` method.\n * This base interface carries only the identity; plane-specific interfaces\n * add domain actions (e.g., `emitContract`, `verify` on ControlFamilyInstance).\n *\n * @template TFamilyId - Literal type for the family identifier (e.g., 'sql', 'document')\n *\n * @example\n * ```ts\n * const instance = sql.create({ target, adapter, driver, extensions });\n * instance.familyId // 'sql'\n * ```\n */\nexport interface FamilyInstance<TFamilyId extends string> {\n /** The family identifier (e.g., 'sql', 'document') */\n readonly familyId: TFamilyId;\n}\n\n/**\n * Base interface for target instances.\n *\n * A target instance is created by a target descriptor's `create()` method.\n * This base interface carries only the identity; plane-specific interfaces\n * add target-specific behavior.\n *\n * @template TFamilyId - Literal type for the family identifier\n * @template TTargetId - Literal type for the target identifier (e.g., 'postgres', 'mysql')\n *\n * @example\n * ```ts\n * const instance = postgres.create();\n * instance.familyId // 'sql'\n * instance.targetId // 'postgres'\n * ```\n */\nexport interface TargetInstance<TFamilyId extends string, TTargetId extends string> {\n /** The family this target belongs to */\n readonly familyId: TFamilyId;\n\n /** The target identifier (e.g., 'postgres', 'mysql', 'mongodb') */\n readonly targetId: TTargetId;\n}\n\n/**\n * Base interface for adapter instances.\n *\n * An adapter instance is created by an adapter descriptor's `create()` method.\n * This base interface carries only the identity; plane-specific interfaces\n * add adapter-specific behavior (e.g., codec registration, query lowering).\n *\n * @template TFamilyId - Literal type for the family identifier\n * @template TTargetId - Literal type for the target identifier\n *\n * @example\n * ```ts\n * const instance = postgresAdapter.create();\n * instance.familyId // 'sql'\n * instance.targetId // 'postgres'\n * ```\n */\nexport interface AdapterInstance<TFamilyId extends string, TTargetId extends string> {\n /** The family this adapter belongs to */\n readonly familyId: TFamilyId;\n\n /** The target this adapter is designed for */\n readonly targetId: TTargetId;\n}\n\n/**\n * Base interface for driver instances.\n *\n * A driver instance is created by a driver descriptor's `create()` method.\n * This base interface carries only the identity; plane-specific interfaces\n * add driver-specific behavior (e.g., `query`, `close` on ControlDriverInstance).\n *\n * @template TFamilyId - Literal type for the family identifier\n * @template TTargetId - Literal type for the target identifier\n *\n * @example\n * ```ts\n * const instance = postgresDriver.create({ databaseUrl });\n * instance.familyId // 'sql'\n * instance.targetId // 'postgres'\n * ```\n */\nexport interface DriverInstance<TFamilyId extends string, TTargetId extends string> {\n /** The family this driver belongs to */\n readonly familyId: TFamilyId;\n\n /** The target this driver connects to */\n readonly targetId: TTargetId;\n}\n\n/**\n * Base interface for extension instances.\n *\n * An extension instance is created by an extension descriptor's `create()` method.\n * This base interface carries only the identity; plane-specific interfaces\n * add extension-specific behavior.\n *\n * @template TFamilyId - Literal type for the family identifier\n * @template TTargetId - Literal type for the target identifier\n *\n * @example\n * ```ts\n * const instance = pgvector.create();\n * instance.familyId // 'sql'\n * instance.targetId // 'postgres'\n * ```\n */\nexport interface ExtensionInstance<TFamilyId extends string, TTargetId extends string> {\n /** The family this extension belongs to */\n readonly familyId: TFamilyId;\n\n /** The target this extension is designed for */\n readonly targetId: TTargetId;\n}\n"],"mappings":";;;;;;;AAgGA,SAAgB,wBACd,UACA,QACA,KACQ;AACR,QAAO,SAAS,QAAQ,mBAAmB,GAAG,QAAgB;AAC5D,MAAI,QAAQ,aAAc,QAAO,IAAI;EACrC,MAAM,QAAQ,OAAO;AACrB,MAAI,UAAU,OACZ,OAAM,IAAI,MACR,+BAA+B,IAAI,iBAAiB,SAAS,uBACtC,OAAO,KAAK,OAAO,CAAC,KAAK,KAAK,IAAI,WAC1D;AAEH,SAAO,OAAO,MAAM;GACpB;;;;;;;;;;;;AAaJ,SAAgB,kBAAkB,SAAiB,UAAgD;AAEjG,KAAI,OAAO,aAAa,SACtB,QAAO;EACL;EACA,SAAS,QAAQ,QAAQ,wBAAwB,UAAU,QAAQ,IAAI;EACxE;AAIH,KAAI,OAAO,aAAa,WACtB,QAAO;EAAE;EAAS,QAAQ;EAAU;AAItC,KAAI,SAAS,SAAS,WACpB,QAAO;EAAE;EAAS,QAAQ,SAAS;EAAQ;CAI7C,MAAM,EAAE,aAAa;AACrB,QAAO;EACL;EACA,SAAS,QAAQ,QAAQ,wBAAwB,UAAU,QAAQ,IAAI;EACxE;;AAyGH,SAAgB,mCACd,OAC0C;CAC1C,MAAM,8BAAc,IAAI,KAAa;AACrC,MAAK,MAAM,MAAM,MAAM,qBACrB,aAAY,IAAI,GAAG;CAMrB,MAAM,2BAH2B,MAAM,SAAS,iBAC5C,OAAO,KAAK,MAAM,SAAS,eAAe,GAC1C,EAAE,EACmD,QAAQ,OAAO,CAAC,YAAY,IAAI,GAAG,CAAC;CAE7F,MAAM,uBAAuB,MAAM;CACnC,MAAM,uBAAuB,MAAM,SAAS;CAC5C,MAAM,iBACJ,yBAAyB,UACzB,yBAAyB,UACzB,yBAAyB,uBACrB;EAAE,UAAU;EAAsB,QAAQ;EAAsB,GAChE;CAEN,MAAM,mBAAmB,MAAM;CAC/B,MAAM,mBAAmB,MAAM,SAAS;CACxC,MAAM,iBACJ,qBAAqB,UAAa,qBAAqB,mBACnD;EAAE,UAAU;EAAkB,QAAQ;EAAkB,GACxD;AAEN,QAAO;EACL,GAAI,iBAAiB,EAAE,gBAAgB,GAAG,EAAE;EAC5C,GAAI,iBAAiB,EAAE,gBAAgB,GAAG,EAAE;EAC5C;EACD"}
|
|
1
|
+
{"version":3,"file":"framework-components.mjs","names":["resolved: Record<string, unknown>"],"sources":["../src/framework-authoring.ts","../src/framework-components.ts"],"sourcesContent":["import { ifDefined } from '@prisma-next/utils/defined';\n\nexport type AuthoringArgRef = {\n readonly kind: 'arg';\n readonly index: number;\n readonly path?: readonly string[];\n readonly default?: AuthoringTemplateValue;\n};\n\nexport type AuthoringTemplateValue =\n | string\n | number\n | boolean\n | null\n | AuthoringArgRef\n | readonly AuthoringTemplateValue[]\n | { readonly [key: string]: AuthoringTemplateValue };\n\nexport type AuthoringArgumentDescriptor =\n | {\n readonly kind: 'string';\n readonly optional?: boolean;\n }\n | {\n readonly kind: 'number';\n readonly optional?: boolean;\n readonly integer?: boolean;\n readonly minimum?: number;\n readonly maximum?: number;\n }\n | {\n readonly kind: 'stringArray';\n readonly optional?: boolean;\n }\n | {\n readonly kind: 'object';\n readonly optional?: boolean;\n readonly properties: Record<string, AuthoringArgumentDescriptor>;\n };\n\nexport interface AuthoringStorageTypeTemplate {\n readonly codecId: string;\n readonly nativeType: AuthoringTemplateValue;\n readonly typeParams?: Record<string, AuthoringTemplateValue>;\n}\n\nexport interface AuthoringTypeConstructorDescriptor {\n readonly kind: 'typeConstructor';\n readonly args?: readonly AuthoringArgumentDescriptor[];\n readonly output: AuthoringStorageTypeTemplate;\n}\n\nexport interface AuthoringColumnDefaultTemplateLiteral {\n readonly kind: 'literal';\n readonly value: AuthoringTemplateValue;\n}\n\nexport interface AuthoringColumnDefaultTemplateFunction {\n readonly kind: 'function';\n readonly expression: AuthoringTemplateValue;\n}\n\nexport type AuthoringColumnDefaultTemplate =\n | AuthoringColumnDefaultTemplateLiteral\n | AuthoringColumnDefaultTemplateFunction;\n\nexport interface AuthoringFieldPresetOutput extends AuthoringStorageTypeTemplate {\n readonly nullable?: boolean;\n readonly default?: AuthoringColumnDefaultTemplate;\n readonly executionDefault?: AuthoringTemplateValue;\n readonly id?: boolean;\n readonly unique?: boolean;\n}\n\nexport interface AuthoringFieldPresetDescriptor {\n readonly kind: 'fieldPreset';\n readonly args?: readonly AuthoringArgumentDescriptor[];\n readonly output: AuthoringFieldPresetOutput;\n}\n\nexport type AuthoringTypeNamespace = {\n readonly [name: string]: AuthoringTypeConstructorDescriptor | AuthoringTypeNamespace;\n};\n\nexport type AuthoringFieldNamespace = {\n readonly [name: string]: AuthoringFieldPresetDescriptor | AuthoringFieldNamespace;\n};\n\nexport interface AuthoringContributions {\n readonly type?: AuthoringTypeNamespace;\n readonly field?: AuthoringFieldNamespace;\n}\n\nexport function isAuthoringArgRef(value: unknown): value is AuthoringArgRef {\n if (typeof value !== 'object' || value === null || (value as { kind?: unknown }).kind !== 'arg') {\n return false;\n }\n const { index, path } = value as { index?: unknown; path?: unknown };\n if (typeof index !== 'number' || !Number.isInteger(index) || index < 0) {\n return false;\n }\n if (path !== undefined && (!Array.isArray(path) || path.some((s) => typeof s !== 'string'))) {\n return false;\n }\n return true;\n}\n\nfunction isAuthoringTemplateRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nexport function isAuthoringTypeConstructorDescriptor(\n value: unknown,\n): value is AuthoringTypeConstructorDescriptor {\n return (\n typeof value === 'object' &&\n value !== null &&\n (value as { kind?: unknown }).kind === 'typeConstructor' &&\n typeof (value as { output?: unknown }).output === 'object' &&\n (value as { output?: unknown }).output !== null\n );\n}\n\nexport function isAuthoringFieldPresetDescriptor(\n value: unknown,\n): value is AuthoringFieldPresetDescriptor {\n return (\n typeof value === 'object' &&\n value !== null &&\n (value as { kind?: unknown }).kind === 'fieldPreset' &&\n typeof (value as { output?: unknown }).output === 'object' &&\n (value as { output?: unknown }).output !== null\n );\n}\n\nexport function resolveAuthoringTemplateValue(\n template: AuthoringTemplateValue,\n args: readonly unknown[],\n): unknown {\n if (isAuthoringArgRef(template)) {\n let value = args[template.index];\n\n for (const segment of template.path ?? []) {\n if (!isAuthoringTemplateRecord(value) || !Object.hasOwn(value, segment)) {\n value = undefined;\n break;\n }\n value = (value as Record<string, unknown>)[segment];\n }\n\n if (value === undefined && template.default !== undefined) {\n return resolveAuthoringTemplateValue(template.default, args);\n }\n\n return value;\n }\n if (Array.isArray(template)) {\n return template.map((value) => resolveAuthoringTemplateValue(value, args));\n }\n if (typeof template === 'object' && template !== null) {\n const resolved: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(template)) {\n const resolvedValue = resolveAuthoringTemplateValue(value, args);\n if (resolvedValue !== undefined) {\n resolved[key] = resolvedValue;\n }\n }\n return resolved;\n }\n return template;\n}\n\nfunction validateAuthoringArgument(\n descriptor: AuthoringArgumentDescriptor,\n value: unknown,\n path: string,\n): void {\n if (value === undefined) {\n if (descriptor.optional) {\n return;\n }\n throw new Error(`Missing required authoring helper argument at ${path}`);\n }\n\n if (descriptor.kind === 'string') {\n if (typeof value !== 'string') {\n throw new Error(`Authoring helper argument at ${path} must be a string`);\n }\n return;\n }\n\n if (descriptor.kind === 'stringArray') {\n if (!Array.isArray(value)) {\n throw new Error(`Authoring helper argument at ${path} must be an array of strings`);\n }\n for (const entry of value) {\n if (typeof entry !== 'string') {\n throw new Error(`Authoring helper argument at ${path} must be an array of strings`);\n }\n }\n return;\n }\n\n if (descriptor.kind === 'object') {\n if (typeof value !== 'object' || value === null || Array.isArray(value)) {\n throw new Error(`Authoring helper argument at ${path} must be an object`);\n }\n\n const input = value as Record<string, unknown>;\n const expectedKeys = new Set(Object.keys(descriptor.properties));\n\n for (const key of Object.keys(input)) {\n if (!expectedKeys.has(key)) {\n throw new Error(`Authoring helper argument at ${path} contains unknown property \"${key}\"`);\n }\n }\n\n for (const [key, propertyDescriptor] of Object.entries(descriptor.properties)) {\n validateAuthoringArgument(propertyDescriptor, input[key], `${path}.${key}`);\n }\n\n return;\n }\n\n if (typeof value !== 'number' || Number.isNaN(value)) {\n throw new Error(`Authoring helper argument at ${path} must be a number`);\n }\n\n if (descriptor.integer && !Number.isInteger(value)) {\n throw new Error(`Authoring helper argument at ${path} must be an integer`);\n }\n if (descriptor.minimum !== undefined && value < descriptor.minimum) {\n throw new Error(\n `Authoring helper argument at ${path} must be >= ${descriptor.minimum}, received ${value}`,\n );\n }\n if (descriptor.maximum !== undefined && value > descriptor.maximum) {\n throw new Error(\n `Authoring helper argument at ${path} must be <= ${descriptor.maximum}, received ${value}`,\n );\n }\n}\n\nexport function validateAuthoringHelperArguments(\n helperPath: string,\n descriptors: readonly AuthoringArgumentDescriptor[] | undefined,\n args: readonly unknown[],\n): void {\n const expected = descriptors ?? [];\n const minimumArgs = expected.reduce(\n (count, descriptor, index) => (descriptor.optional ? count : index + 1),\n 0,\n );\n if (args.length < minimumArgs || args.length > expected.length) {\n throw new Error(\n `${helperPath} expects ${minimumArgs === expected.length ? expected.length : `${minimumArgs}-${expected.length}`} argument(s), received ${args.length}`,\n );\n }\n\n expected.forEach((descriptor, index) => {\n validateAuthoringArgument(descriptor, args[index], `${helperPath}[${index}]`);\n });\n}\n\nfunction resolveAuthoringStorageTypeTemplate(\n template: AuthoringStorageTypeTemplate,\n args: readonly unknown[],\n): {\n readonly codecId: string;\n readonly nativeType: string;\n readonly typeParams?: Record<string, unknown>;\n} {\n const nativeType = resolveAuthoringTemplateValue(template.nativeType, args);\n if (typeof nativeType !== 'string') {\n throw new Error(\n `Resolved authoring nativeType must be a string for codec \"${template.codecId}\", received ${String(nativeType)}`,\n );\n }\n const typeParams =\n template.typeParams === undefined\n ? undefined\n : resolveAuthoringTemplateValue(template.typeParams, args);\n if (typeParams !== undefined && !isAuthoringTemplateRecord(typeParams)) {\n throw new Error(\n `Resolved authoring typeParams must be an object for codec \"${template.codecId}\", received ${String(typeParams)}`,\n );\n }\n\n return {\n codecId: template.codecId,\n nativeType,\n ...(typeParams === undefined ? {} : { typeParams }),\n };\n}\n\nfunction resolveAuthoringColumnDefaultTemplate(\n template: AuthoringColumnDefaultTemplate,\n args: readonly unknown[],\n):\n | {\n readonly kind: 'literal';\n readonly value: unknown;\n }\n | {\n readonly kind: 'function';\n readonly expression: string;\n } {\n if (template.kind === 'literal') {\n const value = resolveAuthoringTemplateValue(template.value, args);\n if (value === undefined) {\n throw new Error('Resolved authoring literal default must not be undefined');\n }\n return {\n kind: 'literal',\n value,\n };\n }\n\n const expression = resolveAuthoringTemplateValue(template.expression, args);\n if (expression === undefined || (typeof expression === 'object' && expression !== null)) {\n throw new Error(\n `Resolved authoring function default expression must resolve to a primitive, received ${String(expression)}`,\n );\n }\n return {\n kind: 'function',\n expression: String(expression),\n };\n}\n\nexport function instantiateAuthoringTypeConstructor(\n descriptor: AuthoringTypeConstructorDescriptor,\n args: readonly unknown[],\n): {\n readonly codecId: string;\n readonly nativeType: string;\n readonly typeParams?: Record<string, unknown>;\n} {\n return resolveAuthoringStorageTypeTemplate(descriptor.output, args);\n}\n\nexport function instantiateAuthoringFieldPreset(\n descriptor: AuthoringFieldPresetDescriptor,\n args: readonly unknown[],\n): {\n readonly descriptor: {\n readonly codecId: string;\n readonly nativeType: string;\n readonly typeParams?: Record<string, unknown>;\n };\n readonly nullable: boolean;\n readonly default?:\n | {\n readonly kind: 'literal';\n readonly value: unknown;\n }\n | {\n readonly kind: 'function';\n readonly expression: string;\n };\n readonly executionDefault?: unknown;\n readonly id: boolean;\n readonly unique: boolean;\n} {\n return {\n descriptor: resolveAuthoringStorageTypeTemplate(descriptor.output, args),\n nullable: descriptor.output.nullable ?? false,\n ...ifDefined(\n 'default',\n descriptor.output.default !== undefined\n ? resolveAuthoringColumnDefaultTemplate(descriptor.output.default, args)\n : undefined,\n ),\n ...ifDefined(\n 'executionDefault',\n descriptor.output.executionDefault !== undefined\n ? resolveAuthoringTemplateValue(descriptor.output.executionDefault, args)\n : undefined,\n ),\n id: descriptor.output.id ?? false,\n unique: descriptor.output.unique ?? false,\n };\n}\n","import type { AuthoringContributions } from './framework-authoring';\nimport type { RenderTypeContext, TypesImportSpec } from './types';\n\n/**\n * A template-based type renderer (structured form).\n * Uses mustache-style placeholders (e.g., `Vector<{{length}}>`) that are\n * replaced with typeParams values during rendering.\n *\n * @example\n * ```ts\n * { kind: 'template', template: 'Vector<{{length}}>' }\n * // With typeParams { length: 1536 }, renders: 'Vector<1536>'\n * ```\n */\nexport interface TypeRendererTemplate {\n readonly kind: 'template';\n /** Template string with `{{key}}` placeholders for typeParams values */\n readonly template: string;\n}\n\n/**\n * A function-based type renderer for full control over type expression generation.\n *\n * @example\n * ```ts\n * {\n * kind: 'function',\n * render: (params, ctx) => `Vector<${params.length}>`\n * }\n * ```\n */\nexport interface TypeRendererFunction {\n readonly kind: 'function';\n /** Render function that produces a TypeScript type expression */\n readonly render: (params: Record<string, unknown>, ctx: RenderTypeContext) => string;\n}\n\n/**\n * A raw template string type renderer (convenience form).\n * Shorthand for TypeRendererTemplate - just the template string without wrapper.\n *\n * @example\n * ```ts\n * 'Vector<{{length}}>'\n * // Equivalent to: { kind: 'template', template: 'Vector<{{length}}>' }\n * ```\n */\nexport type TypeRendererString = string;\n\n/**\n * A raw function type renderer (convenience form).\n * Shorthand for TypeRendererFunction - just the function without wrapper.\n *\n * @example\n * ```ts\n * (params, ctx) => `Vector<${params.length}>`\n * // Equivalent to: { kind: 'function', render: ... }\n * ```\n */\nexport type TypeRendererRawFunction = (\n params: Record<string, unknown>,\n ctx: RenderTypeContext,\n) => string;\n\n/**\n * Union of type renderer formats.\n *\n * Supports both structured forms (with `kind` discriminator) and convenience forms:\n * - `string` - Template string with `{{key}}` placeholders (manifest-safe, JSON-serializable)\n * - `function` - Render function for full control (requires runtime execution)\n * - `{ kind: 'template', template: string }` - Structured template form\n * - `{ kind: 'function', render: fn }` - Structured function form\n *\n * Templates are normalized to functions during pack assembly.\n * **Prefer template strings** for most cases - they are JSON-serializable.\n */\nexport type TypeRenderer =\n | TypeRendererString\n | TypeRendererRawFunction\n | TypeRendererTemplate\n | TypeRendererFunction;\n\n/**\n * Normalized type renderer - always a function after assembly.\n * This is the form received by the emitter.\n */\nexport interface NormalizedTypeRenderer {\n readonly codecId: string;\n readonly render: (params: Record<string, unknown>, ctx: RenderTypeContext) => string;\n}\n\n/**\n * Interpolates a template string with params values.\n * Used internally by normalizeRenderer to compile templates to functions.\n *\n * @throws Error if a placeholder key is not found in params (except 'CodecTypes')\n */\nexport function interpolateTypeTemplate(\n template: string,\n params: Record<string, unknown>,\n ctx: RenderTypeContext,\n): string {\n return template.replace(/\\{\\{(\\w+)\\}\\}/g, (_, key: string) => {\n if (key === 'CodecTypes') return ctx.codecTypesName;\n const value = params[key];\n if (value === undefined) {\n throw new Error(\n `Missing template parameter \"${key}\" in template \"${template}\". ` +\n `Available params: ${Object.keys(params).join(', ') || '(none)'}`,\n );\n }\n return String(value);\n });\n}\n\n/**\n * Normalizes a TypeRenderer to function form.\n * Called during pack assembly, not at emission time.\n *\n * Handles all TypeRenderer forms:\n * - Raw string template: `'Vector<{{length}}>'`\n * - Raw function: `(params, ctx) => ...`\n * - Structured template: `{ kind: 'template', template: '...' }`\n * - Structured function: `{ kind: 'function', render: fn }`\n */\nexport function normalizeRenderer(codecId: string, renderer: TypeRenderer): NormalizedTypeRenderer {\n // Handle raw string (template shorthand)\n if (typeof renderer === 'string') {\n return {\n codecId,\n render: (params, ctx) => interpolateTypeTemplate(renderer, params, ctx),\n };\n }\n\n // Handle raw function (function shorthand)\n if (typeof renderer === 'function') {\n return { codecId, render: renderer };\n }\n\n // Handle structured function form\n if (renderer.kind === 'function') {\n return { codecId, render: renderer.render };\n }\n\n // Handle structured template form\n const { template } = renderer;\n return {\n codecId,\n render: (params, ctx) => interpolateTypeTemplate(template, params, ctx),\n };\n}\n\n/**\n * Declarative fields that describe component metadata.\n */\nexport interface ComponentMetadata {\n /** Component version (semver) */\n readonly version: string;\n\n /**\n * Capabilities this component provides.\n *\n * For adapters, capabilities must be declared on the adapter descriptor (so they are emitted into\n * the contract) and also exposed in runtime adapter code (e.g. `adapter.profile.capabilities`);\n * keep these declarations in sync. Targets are identifiers/descriptors and typically do not\n * declare capabilities.\n */\n readonly capabilities?: Record<string, unknown>;\n\n /** Type imports for contract.d.ts generation */\n readonly types?: {\n readonly codecTypes?: {\n /**\n * Base codec types import spec.\n * Optional: adapters typically provide this, extensions usually don't.\n */\n readonly import?: TypesImportSpec;\n /**\n * Optional renderers for parameterized codecs owned by this component.\n * Key is codecId (e.g., 'pg/vector@1'), value is the type renderer.\n *\n * Templates are normalized to functions during pack assembly.\n * Duplicate codecId across descriptors is a hard error.\n */\n readonly parameterized?: Record<string, TypeRenderer>;\n /**\n * Optional additional type-only imports required by parameterized renderers.\n *\n * These imports are included in generated `contract.d.ts` but are NOT treated as\n * codec type maps (i.e., they should not be intersected into `export type CodecTypes = ...`).\n *\n * Example: `Vector<N>` for pgvector renderers that emit `Vector<{{length}}>`\n */\n readonly typeImports?: ReadonlyArray<TypesImportSpec>;\n /**\n * Optional control-plane hooks keyed by codecId.\n * Used by family-specific planners/verifiers to handle storage types.\n */\n readonly controlPlaneHooks?: Record<string, unknown>;\n };\n readonly operationTypes?: { readonly import: TypesImportSpec };\n readonly storage?: ReadonlyArray<{\n readonly typeId: string;\n readonly familyId: string;\n readonly targetId: string;\n readonly nativeType?: string;\n }>;\n };\n\n /**\n * Optional pure-data authoring contributions exposed by this component.\n *\n * These contributions are safe to include on pack refs and descriptors because\n * they contain only declarative metadata. Higher-level authoring packages may\n * project them into concrete helper functions for TS-first workflows.\n */\n readonly authoring?: AuthoringContributions;\n}\n\n/**\n * Base descriptor for any framework component.\n *\n * All component descriptors share these fundamental properties that identify\n * the component and provide its metadata. This interface is extended by\n * specific descriptor types (FamilyDescriptor, TargetDescriptor, etc.).\n *\n * @template Kind - Discriminator literal identifying the component type.\n * Built-in kinds are 'family', 'target', 'adapter', 'driver', 'extension',\n * but the type accepts any string to allow ecosystem extensions.\n *\n * @example\n * ```ts\n * // All descriptors have these properties\n * descriptor.kind // The Kind type parameter (e.g., 'family', 'target', or custom kinds)\n * descriptor.id // Unique string identifier (e.g., 'sql', 'postgres')\n * descriptor.version // Component version (semver)\n * ```\n */\nexport interface ComponentDescriptor<Kind extends string> extends ComponentMetadata {\n /** Discriminator identifying the component type */\n readonly kind: Kind;\n\n /** Unique identifier for this component (e.g., 'sql', 'postgres', 'pgvector') */\n readonly id: string;\n}\n\nexport interface ContractComponentRequirementsCheckInput {\n readonly contract: {\n readonly target: string;\n readonly targetFamily?: string | undefined;\n readonly extensionPacks?: Record<string, unknown> | undefined;\n };\n readonly expectedTargetFamily?: string | undefined;\n readonly expectedTargetId?: string | undefined;\n readonly providedComponentIds: Iterable<string>;\n}\n\nexport interface ContractComponentRequirementsCheckResult {\n readonly familyMismatch?: { readonly expected: string; readonly actual: string } | undefined;\n readonly targetMismatch?: { readonly expected: string; readonly actual: string } | undefined;\n readonly missingExtensionPackIds: readonly string[];\n}\n\nexport function checkContractComponentRequirements(\n input: ContractComponentRequirementsCheckInput,\n): ContractComponentRequirementsCheckResult {\n const providedIds = new Set<string>();\n for (const id of input.providedComponentIds) {\n providedIds.add(id);\n }\n\n const requiredExtensionPackIds = input.contract.extensionPacks\n ? Object.keys(input.contract.extensionPacks)\n : [];\n const missingExtensionPackIds = requiredExtensionPackIds.filter((id) => !providedIds.has(id));\n\n const expectedTargetFamily = input.expectedTargetFamily;\n const contractTargetFamily = input.contract.targetFamily;\n const familyMismatch =\n expectedTargetFamily !== undefined &&\n contractTargetFamily !== undefined &&\n contractTargetFamily !== expectedTargetFamily\n ? { expected: expectedTargetFamily, actual: contractTargetFamily }\n : undefined;\n\n const expectedTargetId = input.expectedTargetId;\n const contractTargetId = input.contract.target;\n const targetMismatch =\n expectedTargetId !== undefined && contractTargetId !== expectedTargetId\n ? { expected: expectedTargetId, actual: contractTargetId }\n : undefined;\n\n return {\n ...(familyMismatch ? { familyMismatch } : {}),\n ...(targetMismatch ? { targetMismatch } : {}),\n missingExtensionPackIds,\n };\n}\n\n/**\n * Descriptor for a family component.\n *\n * A \"family\" represents a category of data sources with shared semantics\n * (e.g., SQL databases, document stores). Families define:\n * - Query semantics and operations (SELECT, INSERT, find, aggregate, etc.)\n * - Contract structure (tables vs collections, columns vs fields)\n * - Type system and codecs\n *\n * Families are the top-level grouping. Each family contains multiple targets\n * (e.g., SQL family contains Postgres, MySQL, SQLite targets).\n *\n * Extended by plane-specific descriptors:\n * - `ControlFamilyDescriptor` - adds `hook` for CLI/tooling operations\n * - `RuntimeFamilyDescriptor` - adds runtime-specific factory methods\n *\n * @template TFamilyId - Literal type for the family identifier (e.g., 'sql', 'document')\n *\n * @example\n * ```ts\n * import sql from '@prisma-next/family-sql/control';\n *\n * sql.kind // 'family'\n * sql.familyId // 'sql'\n * sql.id // 'sql'\n * ```\n */\nexport interface FamilyDescriptor<TFamilyId extends string> extends ComponentDescriptor<'family'> {\n /** The family identifier (e.g., 'sql', 'document') */\n readonly familyId: TFamilyId;\n}\n\n/**\n * Descriptor for a target component.\n *\n * A \"target\" represents a specific database or data store within a family\n * (e.g., Postgres, MySQL, MongoDB). Targets define:\n * - Native type mappings (e.g., Postgres int4 → TypeScript number)\n * - Target-specific capabilities (e.g., RETURNING, LATERAL joins)\n *\n * Targets are bound to a family and provide the target-specific implementation\n * details that adapters and drivers use.\n *\n * Extended by plane-specific descriptors:\n * - `ControlTargetDescriptor` - adds optional `migrations` capability\n * - `RuntimeTargetDescriptor` - adds runtime factory method\n *\n * @template TFamilyId - Literal type for the family identifier\n * @template TTargetId - Literal type for the target identifier (e.g., 'postgres', 'mysql')\n *\n * @example\n * ```ts\n * import postgres from '@prisma-next/target-postgres/control';\n *\n * postgres.kind // 'target'\n * postgres.familyId // 'sql'\n * postgres.targetId // 'postgres'\n * ```\n */\nexport interface TargetDescriptor<TFamilyId extends string, TTargetId extends string>\n extends ComponentDescriptor<'target'> {\n /** The family this target belongs to */\n readonly familyId: TFamilyId;\n\n /** The target identifier (e.g., 'postgres', 'mysql', 'mongodb') */\n readonly targetId: TTargetId;\n}\n\n/**\n * Base shape for any pack reference.\n * Pack refs are pure JSON-friendly objects safe to import in authoring flows.\n */\nexport interface PackRefBase<Kind extends string, TFamilyId extends string>\n extends ComponentMetadata {\n readonly kind: Kind;\n readonly id: string;\n readonly familyId: TFamilyId;\n readonly targetId?: string;\n readonly authoring?: AuthoringContributions;\n}\n\nexport type FamilyPackRef<TFamilyId extends string = string> = PackRefBase<'family', TFamilyId>;\n\nexport type TargetPackRef<\n TFamilyId extends string = string,\n TTargetId extends string = string,\n> = PackRefBase<'target', TFamilyId> & {\n readonly targetId: TTargetId;\n};\n\nexport type AdapterPackRef<\n TFamilyId extends string = string,\n TTargetId extends string = string,\n> = PackRefBase<'adapter', TFamilyId> & {\n readonly targetId: TTargetId;\n};\n\nexport type ExtensionPackRef<\n TFamilyId extends string = string,\n TTargetId extends string = string,\n> = PackRefBase<'extension', TFamilyId> & {\n readonly targetId: TTargetId;\n};\n\nexport type DriverPackRef<\n TFamilyId extends string = string,\n TTargetId extends string = string,\n> = PackRefBase<'driver', TFamilyId> & {\n readonly targetId: TTargetId;\n};\n\n/**\n * Descriptor for an adapter component.\n *\n * An \"adapter\" provides the protocol and dialect implementation for a target.\n * Adapters handle:\n * - SQL/query generation (lowering AST to target-specific syntax)\n * - Codec registration (encoding/decoding between JS and wire types)\n * - Type mappings and coercions\n *\n * Adapters are bound to a specific family+target combination and work with\n * any compatible driver for that target.\n *\n * Extended by plane-specific descriptors:\n * - `ControlAdapterDescriptor` - control-plane factory\n * - `RuntimeAdapterDescriptor` - runtime factory\n *\n * @template TFamilyId - Literal type for the family identifier\n * @template TTargetId - Literal type for the target identifier\n *\n * @example\n * ```ts\n * import postgresAdapter from '@prisma-next/adapter-postgres/control';\n *\n * postgresAdapter.kind // 'adapter'\n * postgresAdapter.familyId // 'sql'\n * postgresAdapter.targetId // 'postgres'\n * ```\n */\nexport interface AdapterDescriptor<TFamilyId extends string, TTargetId extends string>\n extends ComponentDescriptor<'adapter'> {\n /** The family this adapter belongs to */\n readonly familyId: TFamilyId;\n\n /** The target this adapter is designed for */\n readonly targetId: TTargetId;\n}\n\n/**\n * Descriptor for a driver component.\n *\n * A \"driver\" provides the connection and execution layer for a target.\n * Drivers handle:\n * - Connection management (pooling, timeouts, retries)\n * - Query execution (sending SQL/commands, receiving results)\n * - Transaction management\n * - Wire protocol communication\n *\n * Drivers are bound to a specific family+target and work with any compatible\n * adapter. Multiple drivers can exist for the same target (e.g., node-postgres\n * vs postgres.js for Postgres).\n *\n * Extended by plane-specific descriptors:\n * - `ControlDriverDescriptor` - creates driver from connection URL\n * - `RuntimeDriverDescriptor` - creates driver with runtime options\n *\n * @template TFamilyId - Literal type for the family identifier\n * @template TTargetId - Literal type for the target identifier\n *\n * @example\n * ```ts\n * import postgresDriver from '@prisma-next/driver-postgres/control';\n *\n * postgresDriver.kind // 'driver'\n * postgresDriver.familyId // 'sql'\n * postgresDriver.targetId // 'postgres'\n * ```\n */\nexport interface DriverDescriptor<TFamilyId extends string, TTargetId extends string>\n extends ComponentDescriptor<'driver'> {\n /** The family this driver belongs to */\n readonly familyId: TFamilyId;\n\n /** The target this driver connects to */\n readonly targetId: TTargetId;\n}\n\n/**\n * Descriptor for an extension component.\n *\n * An \"extension\" adds optional capabilities to a target. Extensions can provide:\n * - Additional operations (e.g., vector similarity search with pgvector)\n * - Custom types and codecs (e.g., vector type)\n * - Extended query capabilities\n *\n * Extensions are bound to a specific family+target and are registered in the\n * config alongside the core components. Multiple extensions can be used together.\n *\n * Extended by plane-specific descriptors:\n * - `ControlExtensionDescriptor` - control-plane extension factory\n * - `RuntimeExtensionDescriptor` - runtime extension factory\n *\n * @template TFamilyId - Literal type for the family identifier\n * @template TTargetId - Literal type for the target identifier\n *\n * @example\n * ```ts\n * import pgvector from '@prisma-next/extension-pgvector/control';\n *\n * pgvector.kind // 'extension'\n * pgvector.familyId // 'sql'\n * pgvector.targetId // 'postgres'\n * ```\n */\nexport interface ExtensionDescriptor<TFamilyId extends string, TTargetId extends string>\n extends ComponentDescriptor<'extension'> {\n /** The family this extension belongs to */\n readonly familyId: TFamilyId;\n\n /** The target this extension is designed for */\n readonly targetId: TTargetId;\n}\n\n/** Components bound to a specific family+target combination. */\nexport type TargetBoundComponentDescriptor<TFamilyId extends string, TTargetId extends string> =\n | TargetDescriptor<TFamilyId, TTargetId>\n | AdapterDescriptor<TFamilyId, TTargetId>\n | DriverDescriptor<TFamilyId, TTargetId>\n | ExtensionDescriptor<TFamilyId, TTargetId>;\n\nexport interface FamilyInstance<TFamilyId extends string> {\n readonly familyId: TFamilyId;\n}\n\nexport interface TargetInstance<TFamilyId extends string, TTargetId extends string> {\n readonly familyId: TFamilyId;\n readonly targetId: TTargetId;\n}\n\nexport interface AdapterInstance<TFamilyId extends string, TTargetId extends string> {\n readonly familyId: TFamilyId;\n readonly targetId: TTargetId;\n}\n\nexport interface DriverInstance<TFamilyId extends string, TTargetId extends string> {\n readonly familyId: TFamilyId;\n readonly targetId: TTargetId;\n}\n\nexport interface ExtensionInstance<TFamilyId extends string, TTargetId extends string> {\n readonly familyId: TFamilyId;\n readonly targetId: TTargetId;\n}\n"],"mappings":";;;AA6FA,SAAgB,kBAAkB,OAA0C;AAC1E,KAAI,OAAO,UAAU,YAAY,UAAU,QAAS,MAA6B,SAAS,MACxF,QAAO;CAET,MAAM,EAAE,OAAO,SAAS;AACxB,KAAI,OAAO,UAAU,YAAY,CAAC,OAAO,UAAU,MAAM,IAAI,QAAQ,EACnE,QAAO;AAET,KAAI,SAAS,WAAc,CAAC,MAAM,QAAQ,KAAK,IAAI,KAAK,MAAM,MAAM,OAAO,MAAM,SAAS,EACxF,QAAO;AAET,QAAO;;AAGT,SAAS,0BAA0B,OAAkD;AACnF,QAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,MAAM;;AAG7E,SAAgB,qCACd,OAC6C;AAC7C,QACE,OAAO,UAAU,YACjB,UAAU,QACT,MAA6B,SAAS,qBACvC,OAAQ,MAA+B,WAAW,YACjD,MAA+B,WAAW;;AAI/C,SAAgB,iCACd,OACyC;AACzC,QACE,OAAO,UAAU,YACjB,UAAU,QACT,MAA6B,SAAS,iBACvC,OAAQ,MAA+B,WAAW,YACjD,MAA+B,WAAW;;AAI/C,SAAgB,8BACd,UACA,MACS;AACT,KAAI,kBAAkB,SAAS,EAAE;EAC/B,IAAI,QAAQ,KAAK,SAAS;AAE1B,OAAK,MAAM,WAAW,SAAS,QAAQ,EAAE,EAAE;AACzC,OAA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E;EAC5C;EACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types-BwcW0HFt.d.mts","names":[],"sources":["../src/domain-types.ts","../src/types.ts"],"sourcesContent":[],"mappings":";;;;KAAY,WAAA;;;;AAAA,KAKA,gBAAA,GALW;EAKX,SAAA,WAAgB,EAAA,SAAA,MAAA,EAAA;EAKhB,SAAA,YAAA,EAAA,SAAuB,
|
|
1
|
+
{"version":3,"file":"types-BwcW0HFt.d.mts","names":[],"sources":["../src/domain-types.ts","../src/types.ts"],"sourcesContent":[],"mappings":";;;;KAAY,WAAA;;;;AAAA,KAKA,gBAAA,GALW;EAKX,SAAA,WAAgB,EAAA,SAAA,MAAA,EAAA;EAKhB,SAAA,YAAA,EAAA,SAAuB,MAAA,EAGpB;AAGf,CAAA;AAKY,KAXA,uBAAA,GAWiB;EAEjB,SAAA,EAAA,EAAA,MAAA;EAIA,SAAA,WAAA,EAAkB,KAAA,GAAA,KAAA,GAAA,KAAA;EAIlB,SAAA,EAAA,EAlBG,gBAkBQ;CACW;AAAf,KAhBP,mBAAA,GAgBO;EACkB,SAAA,EAAA,EAAA,MAAA;EAAf,SAAA,WAAA,EAAA,KAAA,GAAA,KAAA;CACF;AACO,KAdf,cAAA,GAAiB,uBAcF,GAd4B,mBAc5B;AACU,KAbzB,mBAAA,GAayB;EAAf,SAAA,KAAA,EAAA,MAAA;CAAM;AAKvB,KAdO,kBAAA,GAce;EAC4C,SAAA,KAAA,EAAA,MAAA;CAAf;AAArC,KAXP,WAAA,GAWO;EAAM,SAAA,MAAA,EAVN,MAUM,CAAA,MAAA,EAVS,WAUT,CAAA;EAGb,SAAA,SAAA,EAZU,MAYW,CAAA,MAAA,EAZI,cAYJ,CAAA;EACb,SAAA,OAAA,EAZA,MAYA,CAAA,MAAA,EAAA,OAAA,CAAA;EACe,SAAA,aAAA,CAAA,EAZR,mBAYQ;EAErB,SAAA,QAAA,CAAA,EAbQ,MAaR,CAAA,MAAA,EAbuB,kBAavB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4BwC,UAnJvB,aAmJuB,CAAA,MAAA,OAAA,EAAA,MAAA,OAAA,CAAA,CAAA;EAAd,SAAA,GAAA,EAAA,MAAA;EAMZ,SAAA,MAAA,EAAA,SAAA,OAAA,EAAA;EAA4B,SAAA,GAAA,CAAA,EAtJzB,GAsJyB;EA+B9B,SAAA,IAAA,EApLK,QAoLO;EAwBP;;;;EA4BuB,SAAA,IAAA,CAAA,EAnOtB,GAmOsB;;;;;;;;;;KAxN5B,gBACV,UAAU,sCAAsC;;;;;;iBAKlC,kBAAA,iCAAmD;;;;;UAalD,oBAAA;;;;;sBAKK;;iBAEL;;;;;;UAQA,eAAA;;;;;;;;;UAUA,iBAAA;+BACc;8BACD,cAAc;kCACV,cAAc;0BACtB;;;;;iCAKO,YAAY;;;;;;UAO5B,iBAAA;;;;;;;UAQA,eAAA;;4BAEW,8BAA8B;;;;;UAMzC,4BAAA;;;;;;oCAMmB,YAAY;;;;;sCAKV,cAAc;;;;;uCAKb,cAAc;;;;;;UAOpC,gBAAA;;;;;;;oBAQG,iBAAiB;;;;;wBAMb;;;;;;;;;;4BAYhB,8BACc,cAAc,wCACV,cAAc;;;;eAM1B;;;;;;;;;;;;;;;;;;;KA+BF,YAAA,sBAEE,8BAA8B;;;;;;;;;;;;;;;;;;;;;UAsB3B,4BAAA;;;;;;;;;;+BAWc;;;;;;;;;;+BAWA;;;;;yBAMN"}
|
package/package.json
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma-next/contract",
|
|
3
|
-
"version": "0.3.0-dev.
|
|
3
|
+
"version": "0.3.0-dev.135",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"description": "Data contract type definitions and JSON schema for Prisma Next",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@prisma-next/operations": "0.3.0-dev.
|
|
8
|
+
"@prisma-next/operations": "0.3.0-dev.135",
|
|
9
|
+
"@prisma-next/utils": "0.3.0-dev.135"
|
|
9
10
|
},
|
|
10
11
|
"devDependencies": {
|
|
11
12
|
"tsdown": "0.18.4",
|
|
12
13
|
"typescript": "5.9.3",
|
|
13
14
|
"vitest": "4.0.17",
|
|
15
|
+
"@prisma-next/test-utils": "0.0.1",
|
|
14
16
|
"@prisma-next/tsconfig": "0.0.0",
|
|
15
|
-
"@prisma-next/tsdown": "0.0.0"
|
|
16
|
-
"@prisma-next/test-utils": "0.0.1"
|
|
17
|
+
"@prisma-next/tsdown": "0.0.0"
|
|
17
18
|
},
|
|
18
19
|
"files": [
|
|
19
20
|
"dist",
|
|
@@ -1,7 +1,27 @@
|
|
|
1
1
|
export type {
|
|
2
|
-
|
|
2
|
+
AuthoringArgRef,
|
|
3
|
+
AuthoringArgumentDescriptor,
|
|
4
|
+
AuthoringColumnDefaultTemplate,
|
|
5
|
+
AuthoringContributions,
|
|
6
|
+
AuthoringFieldNamespace,
|
|
7
|
+
AuthoringFieldPresetDescriptor,
|
|
8
|
+
AuthoringFieldPresetOutput,
|
|
9
|
+
AuthoringStorageTypeTemplate,
|
|
10
|
+
AuthoringTemplateValue,
|
|
11
|
+
AuthoringTypeConstructorDescriptor,
|
|
12
|
+
AuthoringTypeNamespace,
|
|
13
|
+
} from '../framework-authoring';
|
|
14
|
+
export {
|
|
15
|
+
instantiateAuthoringFieldPreset,
|
|
16
|
+
instantiateAuthoringTypeConstructor,
|
|
17
|
+
isAuthoringArgRef,
|
|
18
|
+
isAuthoringFieldPresetDescriptor,
|
|
19
|
+
isAuthoringTypeConstructorDescriptor,
|
|
20
|
+
resolveAuthoringTemplateValue,
|
|
21
|
+
validateAuthoringHelperArguments,
|
|
22
|
+
} from '../framework-authoring';
|
|
23
|
+
export type {
|
|
3
24
|
AdapterDescriptor,
|
|
4
|
-
// Instances
|
|
5
25
|
AdapterInstance,
|
|
6
26
|
AdapterPackRef,
|
|
7
27
|
ComponentDescriptor,
|
|
@@ -16,7 +36,7 @@ export type {
|
|
|
16
36
|
ExtensionPackRef,
|
|
17
37
|
FamilyDescriptor,
|
|
18
38
|
FamilyInstance,
|
|
19
|
-
|
|
39
|
+
FamilyPackRef,
|
|
20
40
|
NormalizedTypeRenderer,
|
|
21
41
|
PackRefBase,
|
|
22
42
|
TargetBoundComponentDescriptor,
|
|
@@ -27,7 +47,6 @@ export type {
|
|
|
27
47
|
TypeRendererFunction,
|
|
28
48
|
TypeRendererTemplate,
|
|
29
49
|
} from '../framework-components';
|
|
30
|
-
|
|
31
50
|
export {
|
|
32
51
|
checkContractComponentRequirements,
|
|
33
52
|
interpolateTypeTemplate,
|
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
import { ifDefined } from '@prisma-next/utils/defined';
|
|
2
|
+
|
|
3
|
+
export type AuthoringArgRef = {
|
|
4
|
+
readonly kind: 'arg';
|
|
5
|
+
readonly index: number;
|
|
6
|
+
readonly path?: readonly string[];
|
|
7
|
+
readonly default?: AuthoringTemplateValue;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export type AuthoringTemplateValue =
|
|
11
|
+
| string
|
|
12
|
+
| number
|
|
13
|
+
| boolean
|
|
14
|
+
| null
|
|
15
|
+
| AuthoringArgRef
|
|
16
|
+
| readonly AuthoringTemplateValue[]
|
|
17
|
+
| { readonly [key: string]: AuthoringTemplateValue };
|
|
18
|
+
|
|
19
|
+
export type AuthoringArgumentDescriptor =
|
|
20
|
+
| {
|
|
21
|
+
readonly kind: 'string';
|
|
22
|
+
readonly optional?: boolean;
|
|
23
|
+
}
|
|
24
|
+
| {
|
|
25
|
+
readonly kind: 'number';
|
|
26
|
+
readonly optional?: boolean;
|
|
27
|
+
readonly integer?: boolean;
|
|
28
|
+
readonly minimum?: number;
|
|
29
|
+
readonly maximum?: number;
|
|
30
|
+
}
|
|
31
|
+
| {
|
|
32
|
+
readonly kind: 'stringArray';
|
|
33
|
+
readonly optional?: boolean;
|
|
34
|
+
}
|
|
35
|
+
| {
|
|
36
|
+
readonly kind: 'object';
|
|
37
|
+
readonly optional?: boolean;
|
|
38
|
+
readonly properties: Record<string, AuthoringArgumentDescriptor>;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export interface AuthoringStorageTypeTemplate {
|
|
42
|
+
readonly codecId: string;
|
|
43
|
+
readonly nativeType: AuthoringTemplateValue;
|
|
44
|
+
readonly typeParams?: Record<string, AuthoringTemplateValue>;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface AuthoringTypeConstructorDescriptor {
|
|
48
|
+
readonly kind: 'typeConstructor';
|
|
49
|
+
readonly args?: readonly AuthoringArgumentDescriptor[];
|
|
50
|
+
readonly output: AuthoringStorageTypeTemplate;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface AuthoringColumnDefaultTemplateLiteral {
|
|
54
|
+
readonly kind: 'literal';
|
|
55
|
+
readonly value: AuthoringTemplateValue;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface AuthoringColumnDefaultTemplateFunction {
|
|
59
|
+
readonly kind: 'function';
|
|
60
|
+
readonly expression: AuthoringTemplateValue;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export type AuthoringColumnDefaultTemplate =
|
|
64
|
+
| AuthoringColumnDefaultTemplateLiteral
|
|
65
|
+
| AuthoringColumnDefaultTemplateFunction;
|
|
66
|
+
|
|
67
|
+
export interface AuthoringFieldPresetOutput extends AuthoringStorageTypeTemplate {
|
|
68
|
+
readonly nullable?: boolean;
|
|
69
|
+
readonly default?: AuthoringColumnDefaultTemplate;
|
|
70
|
+
readonly executionDefault?: AuthoringTemplateValue;
|
|
71
|
+
readonly id?: boolean;
|
|
72
|
+
readonly unique?: boolean;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface AuthoringFieldPresetDescriptor {
|
|
76
|
+
readonly kind: 'fieldPreset';
|
|
77
|
+
readonly args?: readonly AuthoringArgumentDescriptor[];
|
|
78
|
+
readonly output: AuthoringFieldPresetOutput;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export type AuthoringTypeNamespace = {
|
|
82
|
+
readonly [name: string]: AuthoringTypeConstructorDescriptor | AuthoringTypeNamespace;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export type AuthoringFieldNamespace = {
|
|
86
|
+
readonly [name: string]: AuthoringFieldPresetDescriptor | AuthoringFieldNamespace;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export interface AuthoringContributions {
|
|
90
|
+
readonly type?: AuthoringTypeNamespace;
|
|
91
|
+
readonly field?: AuthoringFieldNamespace;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export function isAuthoringArgRef(value: unknown): value is AuthoringArgRef {
|
|
95
|
+
if (typeof value !== 'object' || value === null || (value as { kind?: unknown }).kind !== 'arg') {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
const { index, path } = value as { index?: unknown; path?: unknown };
|
|
99
|
+
if (typeof index !== 'number' || !Number.isInteger(index) || index < 0) {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
if (path !== undefined && (!Array.isArray(path) || path.some((s) => typeof s !== 'string'))) {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
return true;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function isAuthoringTemplateRecord(value: unknown): value is Record<string, unknown> {
|
|
109
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export function isAuthoringTypeConstructorDescriptor(
|
|
113
|
+
value: unknown,
|
|
114
|
+
): value is AuthoringTypeConstructorDescriptor {
|
|
115
|
+
return (
|
|
116
|
+
typeof value === 'object' &&
|
|
117
|
+
value !== null &&
|
|
118
|
+
(value as { kind?: unknown }).kind === 'typeConstructor' &&
|
|
119
|
+
typeof (value as { output?: unknown }).output === 'object' &&
|
|
120
|
+
(value as { output?: unknown }).output !== null
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export function isAuthoringFieldPresetDescriptor(
|
|
125
|
+
value: unknown,
|
|
126
|
+
): value is AuthoringFieldPresetDescriptor {
|
|
127
|
+
return (
|
|
128
|
+
typeof value === 'object' &&
|
|
129
|
+
value !== null &&
|
|
130
|
+
(value as { kind?: unknown }).kind === 'fieldPreset' &&
|
|
131
|
+
typeof (value as { output?: unknown }).output === 'object' &&
|
|
132
|
+
(value as { output?: unknown }).output !== null
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export function resolveAuthoringTemplateValue(
|
|
137
|
+
template: AuthoringTemplateValue,
|
|
138
|
+
args: readonly unknown[],
|
|
139
|
+
): unknown {
|
|
140
|
+
if (isAuthoringArgRef(template)) {
|
|
141
|
+
let value = args[template.index];
|
|
142
|
+
|
|
143
|
+
for (const segment of template.path ?? []) {
|
|
144
|
+
if (!isAuthoringTemplateRecord(value) || !Object.hasOwn(value, segment)) {
|
|
145
|
+
value = undefined;
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
value = (value as Record<string, unknown>)[segment];
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (value === undefined && template.default !== undefined) {
|
|
152
|
+
return resolveAuthoringTemplateValue(template.default, args);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
return value;
|
|
156
|
+
}
|
|
157
|
+
if (Array.isArray(template)) {
|
|
158
|
+
return template.map((value) => resolveAuthoringTemplateValue(value, args));
|
|
159
|
+
}
|
|
160
|
+
if (typeof template === 'object' && template !== null) {
|
|
161
|
+
const resolved: Record<string, unknown> = {};
|
|
162
|
+
for (const [key, value] of Object.entries(template)) {
|
|
163
|
+
const resolvedValue = resolveAuthoringTemplateValue(value, args);
|
|
164
|
+
if (resolvedValue !== undefined) {
|
|
165
|
+
resolved[key] = resolvedValue;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return resolved;
|
|
169
|
+
}
|
|
170
|
+
return template;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function validateAuthoringArgument(
|
|
174
|
+
descriptor: AuthoringArgumentDescriptor,
|
|
175
|
+
value: unknown,
|
|
176
|
+
path: string,
|
|
177
|
+
): void {
|
|
178
|
+
if (value === undefined) {
|
|
179
|
+
if (descriptor.optional) {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
throw new Error(`Missing required authoring helper argument at ${path}`);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
if (descriptor.kind === 'string') {
|
|
186
|
+
if (typeof value !== 'string') {
|
|
187
|
+
throw new Error(`Authoring helper argument at ${path} must be a string`);
|
|
188
|
+
}
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
if (descriptor.kind === 'stringArray') {
|
|
193
|
+
if (!Array.isArray(value)) {
|
|
194
|
+
throw new Error(`Authoring helper argument at ${path} must be an array of strings`);
|
|
195
|
+
}
|
|
196
|
+
for (const entry of value) {
|
|
197
|
+
if (typeof entry !== 'string') {
|
|
198
|
+
throw new Error(`Authoring helper argument at ${path} must be an array of strings`);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
if (descriptor.kind === 'object') {
|
|
205
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
|
|
206
|
+
throw new Error(`Authoring helper argument at ${path} must be an object`);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
const input = value as Record<string, unknown>;
|
|
210
|
+
const expectedKeys = new Set(Object.keys(descriptor.properties));
|
|
211
|
+
|
|
212
|
+
for (const key of Object.keys(input)) {
|
|
213
|
+
if (!expectedKeys.has(key)) {
|
|
214
|
+
throw new Error(`Authoring helper argument at ${path} contains unknown property "${key}"`);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
for (const [key, propertyDescriptor] of Object.entries(descriptor.properties)) {
|
|
219
|
+
validateAuthoringArgument(propertyDescriptor, input[key], `${path}.${key}`);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
if (typeof value !== 'number' || Number.isNaN(value)) {
|
|
226
|
+
throw new Error(`Authoring helper argument at ${path} must be a number`);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
if (descriptor.integer && !Number.isInteger(value)) {
|
|
230
|
+
throw new Error(`Authoring helper argument at ${path} must be an integer`);
|
|
231
|
+
}
|
|
232
|
+
if (descriptor.minimum !== undefined && value < descriptor.minimum) {
|
|
233
|
+
throw new Error(
|
|
234
|
+
`Authoring helper argument at ${path} must be >= ${descriptor.minimum}, received ${value}`,
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
if (descriptor.maximum !== undefined && value > descriptor.maximum) {
|
|
238
|
+
throw new Error(
|
|
239
|
+
`Authoring helper argument at ${path} must be <= ${descriptor.maximum}, received ${value}`,
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export function validateAuthoringHelperArguments(
|
|
245
|
+
helperPath: string,
|
|
246
|
+
descriptors: readonly AuthoringArgumentDescriptor[] | undefined,
|
|
247
|
+
args: readonly unknown[],
|
|
248
|
+
): void {
|
|
249
|
+
const expected = descriptors ?? [];
|
|
250
|
+
const minimumArgs = expected.reduce(
|
|
251
|
+
(count, descriptor, index) => (descriptor.optional ? count : index + 1),
|
|
252
|
+
0,
|
|
253
|
+
);
|
|
254
|
+
if (args.length < minimumArgs || args.length > expected.length) {
|
|
255
|
+
throw new Error(
|
|
256
|
+
`${helperPath} expects ${minimumArgs === expected.length ? expected.length : `${minimumArgs}-${expected.length}`} argument(s), received ${args.length}`,
|
|
257
|
+
);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
expected.forEach((descriptor, index) => {
|
|
261
|
+
validateAuthoringArgument(descriptor, args[index], `${helperPath}[${index}]`);
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
function resolveAuthoringStorageTypeTemplate(
|
|
266
|
+
template: AuthoringStorageTypeTemplate,
|
|
267
|
+
args: readonly unknown[],
|
|
268
|
+
): {
|
|
269
|
+
readonly codecId: string;
|
|
270
|
+
readonly nativeType: string;
|
|
271
|
+
readonly typeParams?: Record<string, unknown>;
|
|
272
|
+
} {
|
|
273
|
+
const nativeType = resolveAuthoringTemplateValue(template.nativeType, args);
|
|
274
|
+
if (typeof nativeType !== 'string') {
|
|
275
|
+
throw new Error(
|
|
276
|
+
`Resolved authoring nativeType must be a string for codec "${template.codecId}", received ${String(nativeType)}`,
|
|
277
|
+
);
|
|
278
|
+
}
|
|
279
|
+
const typeParams =
|
|
280
|
+
template.typeParams === undefined
|
|
281
|
+
? undefined
|
|
282
|
+
: resolveAuthoringTemplateValue(template.typeParams, args);
|
|
283
|
+
if (typeParams !== undefined && !isAuthoringTemplateRecord(typeParams)) {
|
|
284
|
+
throw new Error(
|
|
285
|
+
`Resolved authoring typeParams must be an object for codec "${template.codecId}", received ${String(typeParams)}`,
|
|
286
|
+
);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
return {
|
|
290
|
+
codecId: template.codecId,
|
|
291
|
+
nativeType,
|
|
292
|
+
...(typeParams === undefined ? {} : { typeParams }),
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
function resolveAuthoringColumnDefaultTemplate(
|
|
297
|
+
template: AuthoringColumnDefaultTemplate,
|
|
298
|
+
args: readonly unknown[],
|
|
299
|
+
):
|
|
300
|
+
| {
|
|
301
|
+
readonly kind: 'literal';
|
|
302
|
+
readonly value: unknown;
|
|
303
|
+
}
|
|
304
|
+
| {
|
|
305
|
+
readonly kind: 'function';
|
|
306
|
+
readonly expression: string;
|
|
307
|
+
} {
|
|
308
|
+
if (template.kind === 'literal') {
|
|
309
|
+
const value = resolveAuthoringTemplateValue(template.value, args);
|
|
310
|
+
if (value === undefined) {
|
|
311
|
+
throw new Error('Resolved authoring literal default must not be undefined');
|
|
312
|
+
}
|
|
313
|
+
return {
|
|
314
|
+
kind: 'literal',
|
|
315
|
+
value,
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
const expression = resolveAuthoringTemplateValue(template.expression, args);
|
|
320
|
+
if (expression === undefined || (typeof expression === 'object' && expression !== null)) {
|
|
321
|
+
throw new Error(
|
|
322
|
+
`Resolved authoring function default expression must resolve to a primitive, received ${String(expression)}`,
|
|
323
|
+
);
|
|
324
|
+
}
|
|
325
|
+
return {
|
|
326
|
+
kind: 'function',
|
|
327
|
+
expression: String(expression),
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
export function instantiateAuthoringTypeConstructor(
|
|
332
|
+
descriptor: AuthoringTypeConstructorDescriptor,
|
|
333
|
+
args: readonly unknown[],
|
|
334
|
+
): {
|
|
335
|
+
readonly codecId: string;
|
|
336
|
+
readonly nativeType: string;
|
|
337
|
+
readonly typeParams?: Record<string, unknown>;
|
|
338
|
+
} {
|
|
339
|
+
return resolveAuthoringStorageTypeTemplate(descriptor.output, args);
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
export function instantiateAuthoringFieldPreset(
|
|
343
|
+
descriptor: AuthoringFieldPresetDescriptor,
|
|
344
|
+
args: readonly unknown[],
|
|
345
|
+
): {
|
|
346
|
+
readonly descriptor: {
|
|
347
|
+
readonly codecId: string;
|
|
348
|
+
readonly nativeType: string;
|
|
349
|
+
readonly typeParams?: Record<string, unknown>;
|
|
350
|
+
};
|
|
351
|
+
readonly nullable: boolean;
|
|
352
|
+
readonly default?:
|
|
353
|
+
| {
|
|
354
|
+
readonly kind: 'literal';
|
|
355
|
+
readonly value: unknown;
|
|
356
|
+
}
|
|
357
|
+
| {
|
|
358
|
+
readonly kind: 'function';
|
|
359
|
+
readonly expression: string;
|
|
360
|
+
};
|
|
361
|
+
readonly executionDefault?: unknown;
|
|
362
|
+
readonly id: boolean;
|
|
363
|
+
readonly unique: boolean;
|
|
364
|
+
} {
|
|
365
|
+
return {
|
|
366
|
+
descriptor: resolveAuthoringStorageTypeTemplate(descriptor.output, args),
|
|
367
|
+
nullable: descriptor.output.nullable ?? false,
|
|
368
|
+
...ifDefined(
|
|
369
|
+
'default',
|
|
370
|
+
descriptor.output.default !== undefined
|
|
371
|
+
? resolveAuthoringColumnDefaultTemplate(descriptor.output.default, args)
|
|
372
|
+
: undefined,
|
|
373
|
+
),
|
|
374
|
+
...ifDefined(
|
|
375
|
+
'executionDefault',
|
|
376
|
+
descriptor.output.executionDefault !== undefined
|
|
377
|
+
? resolveAuthoringTemplateValue(descriptor.output.executionDefault, args)
|
|
378
|
+
: undefined,
|
|
379
|
+
),
|
|
380
|
+
id: descriptor.output.id ?? false,
|
|
381
|
+
unique: descriptor.output.unique ?? false,
|
|
382
|
+
};
|
|
383
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AuthoringContributions } from './framework-authoring';
|
|
1
2
|
import type { RenderTypeContext, TypesImportSpec } from './types';
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -205,6 +206,15 @@ export interface ComponentMetadata {
|
|
|
205
206
|
readonly nativeType?: string;
|
|
206
207
|
}>;
|
|
207
208
|
};
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Optional pure-data authoring contributions exposed by this component.
|
|
212
|
+
*
|
|
213
|
+
* These contributions are safe to include on pack refs and descriptors because
|
|
214
|
+
* they contain only declarative metadata. Higher-level authoring packages may
|
|
215
|
+
* project them into concrete helper functions for TS-first workflows.
|
|
216
|
+
*/
|
|
217
|
+
readonly authoring?: AuthoringContributions;
|
|
208
218
|
}
|
|
209
219
|
|
|
210
220
|
/**
|
|
@@ -365,8 +375,11 @@ export interface PackRefBase<Kind extends string, TFamilyId extends string>
|
|
|
365
375
|
readonly id: string;
|
|
366
376
|
readonly familyId: TFamilyId;
|
|
367
377
|
readonly targetId?: string;
|
|
378
|
+
readonly authoring?: AuthoringContributions;
|
|
368
379
|
}
|
|
369
380
|
|
|
381
|
+
export type FamilyPackRef<TFamilyId extends string = string> = PackRefBase<'family', TFamilyId>;
|
|
382
|
+
|
|
370
383
|
export type TargetPackRef<
|
|
371
384
|
TFamilyId extends string = string,
|
|
372
385
|
TTargetId extends string = string,
|
|
@@ -507,152 +520,33 @@ export interface ExtensionDescriptor<TFamilyId extends string, TTargetId extends
|
|
|
507
520
|
readonly targetId: TTargetId;
|
|
508
521
|
}
|
|
509
522
|
|
|
510
|
-
/**
|
|
511
|
-
* Union type for target-bound component descriptors.
|
|
512
|
-
*
|
|
513
|
-
* Target-bound components are those that must be compatible with a specific
|
|
514
|
-
* family+target combination. This includes targets, adapters, drivers, and
|
|
515
|
-
* extensions. Families are not target-bound.
|
|
516
|
-
*
|
|
517
|
-
* This type is used in migration and verification interfaces to enforce
|
|
518
|
-
* type-level compatibility between components.
|
|
519
|
-
*
|
|
520
|
-
* @template TFamilyId - Literal type for the family identifier
|
|
521
|
-
* @template TTargetId - Literal type for the target identifier
|
|
522
|
-
*
|
|
523
|
-
* @example
|
|
524
|
-
* ```ts
|
|
525
|
-
* // All these components must have matching familyId and targetId
|
|
526
|
-
* const components: TargetBoundComponentDescriptor<'sql', 'postgres'>[] = [
|
|
527
|
-
* postgresTarget,
|
|
528
|
-
* postgresAdapter,
|
|
529
|
-
* postgresDriver,
|
|
530
|
-
* pgvectorExtension,
|
|
531
|
-
* ];
|
|
532
|
-
* ```
|
|
533
|
-
*/
|
|
523
|
+
/** Components bound to a specific family+target combination. */
|
|
534
524
|
export type TargetBoundComponentDescriptor<TFamilyId extends string, TTargetId extends string> =
|
|
535
525
|
| TargetDescriptor<TFamilyId, TTargetId>
|
|
536
526
|
| AdapterDescriptor<TFamilyId, TTargetId>
|
|
537
527
|
| DriverDescriptor<TFamilyId, TTargetId>
|
|
538
528
|
| ExtensionDescriptor<TFamilyId, TTargetId>;
|
|
539
529
|
|
|
540
|
-
/**
|
|
541
|
-
* Base interface for family instances.
|
|
542
|
-
*
|
|
543
|
-
* A family instance is created by a family descriptor's `create()` method.
|
|
544
|
-
* This base interface carries only the identity; plane-specific interfaces
|
|
545
|
-
* add domain actions (e.g., `emitContract`, `verify` on ControlFamilyInstance).
|
|
546
|
-
*
|
|
547
|
-
* @template TFamilyId - Literal type for the family identifier (e.g., 'sql', 'document')
|
|
548
|
-
*
|
|
549
|
-
* @example
|
|
550
|
-
* ```ts
|
|
551
|
-
* const instance = sql.create({ target, adapter, driver, extensions });
|
|
552
|
-
* instance.familyId // 'sql'
|
|
553
|
-
* ```
|
|
554
|
-
*/
|
|
555
530
|
export interface FamilyInstance<TFamilyId extends string> {
|
|
556
|
-
/** The family identifier (e.g., 'sql', 'document') */
|
|
557
531
|
readonly familyId: TFamilyId;
|
|
558
532
|
}
|
|
559
533
|
|
|
560
|
-
/**
|
|
561
|
-
* Base interface for target instances.
|
|
562
|
-
*
|
|
563
|
-
* A target instance is created by a target descriptor's `create()` method.
|
|
564
|
-
* This base interface carries only the identity; plane-specific interfaces
|
|
565
|
-
* add target-specific behavior.
|
|
566
|
-
*
|
|
567
|
-
* @template TFamilyId - Literal type for the family identifier
|
|
568
|
-
* @template TTargetId - Literal type for the target identifier (e.g., 'postgres', 'mysql')
|
|
569
|
-
*
|
|
570
|
-
* @example
|
|
571
|
-
* ```ts
|
|
572
|
-
* const instance = postgres.create();
|
|
573
|
-
* instance.familyId // 'sql'
|
|
574
|
-
* instance.targetId // 'postgres'
|
|
575
|
-
* ```
|
|
576
|
-
*/
|
|
577
534
|
export interface TargetInstance<TFamilyId extends string, TTargetId extends string> {
|
|
578
|
-
/** The family this target belongs to */
|
|
579
535
|
readonly familyId: TFamilyId;
|
|
580
|
-
|
|
581
|
-
/** The target identifier (e.g., 'postgres', 'mysql', 'mongodb') */
|
|
582
536
|
readonly targetId: TTargetId;
|
|
583
537
|
}
|
|
584
538
|
|
|
585
|
-
/**
|
|
586
|
-
* Base interface for adapter instances.
|
|
587
|
-
*
|
|
588
|
-
* An adapter instance is created by an adapter descriptor's `create()` method.
|
|
589
|
-
* This base interface carries only the identity; plane-specific interfaces
|
|
590
|
-
* add adapter-specific behavior (e.g., codec registration, query lowering).
|
|
591
|
-
*
|
|
592
|
-
* @template TFamilyId - Literal type for the family identifier
|
|
593
|
-
* @template TTargetId - Literal type for the target identifier
|
|
594
|
-
*
|
|
595
|
-
* @example
|
|
596
|
-
* ```ts
|
|
597
|
-
* const instance = postgresAdapter.create();
|
|
598
|
-
* instance.familyId // 'sql'
|
|
599
|
-
* instance.targetId // 'postgres'
|
|
600
|
-
* ```
|
|
601
|
-
*/
|
|
602
539
|
export interface AdapterInstance<TFamilyId extends string, TTargetId extends string> {
|
|
603
|
-
/** The family this adapter belongs to */
|
|
604
540
|
readonly familyId: TFamilyId;
|
|
605
|
-
|
|
606
|
-
/** The target this adapter is designed for */
|
|
607
541
|
readonly targetId: TTargetId;
|
|
608
542
|
}
|
|
609
543
|
|
|
610
|
-
/**
|
|
611
|
-
* Base interface for driver instances.
|
|
612
|
-
*
|
|
613
|
-
* A driver instance is created by a driver descriptor's `create()` method.
|
|
614
|
-
* This base interface carries only the identity; plane-specific interfaces
|
|
615
|
-
* add driver-specific behavior (e.g., `query`, `close` on ControlDriverInstance).
|
|
616
|
-
*
|
|
617
|
-
* @template TFamilyId - Literal type for the family identifier
|
|
618
|
-
* @template TTargetId - Literal type for the target identifier
|
|
619
|
-
*
|
|
620
|
-
* @example
|
|
621
|
-
* ```ts
|
|
622
|
-
* const instance = postgresDriver.create({ databaseUrl });
|
|
623
|
-
* instance.familyId // 'sql'
|
|
624
|
-
* instance.targetId // 'postgres'
|
|
625
|
-
* ```
|
|
626
|
-
*/
|
|
627
544
|
export interface DriverInstance<TFamilyId extends string, TTargetId extends string> {
|
|
628
|
-
/** The family this driver belongs to */
|
|
629
545
|
readonly familyId: TFamilyId;
|
|
630
|
-
|
|
631
|
-
/** The target this driver connects to */
|
|
632
546
|
readonly targetId: TTargetId;
|
|
633
547
|
}
|
|
634
548
|
|
|
635
|
-
/**
|
|
636
|
-
* Base interface for extension instances.
|
|
637
|
-
*
|
|
638
|
-
* An extension instance is created by an extension descriptor's `create()` method.
|
|
639
|
-
* This base interface carries only the identity; plane-specific interfaces
|
|
640
|
-
* add extension-specific behavior.
|
|
641
|
-
*
|
|
642
|
-
* @template TFamilyId - Literal type for the family identifier
|
|
643
|
-
* @template TTargetId - Literal type for the target identifier
|
|
644
|
-
*
|
|
645
|
-
* @example
|
|
646
|
-
* ```ts
|
|
647
|
-
* const instance = pgvector.create();
|
|
648
|
-
* instance.familyId // 'sql'
|
|
649
|
-
* instance.targetId // 'postgres'
|
|
650
|
-
* ```
|
|
651
|
-
*/
|
|
652
549
|
export interface ExtensionInstance<TFamilyId extends string, TTargetId extends string> {
|
|
653
|
-
/** The family this extension belongs to */
|
|
654
550
|
readonly familyId: TFamilyId;
|
|
655
|
-
|
|
656
|
-
/** The target this extension is designed for */
|
|
657
551
|
readonly targetId: TTargetId;
|
|
658
552
|
}
|