@prisma-next/emitter 0.5.0-dev.82 → 0.5.0-dev.84
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/README.md +1 -2
- package/dist/exports/index.d.mts +1 -2
- package/dist/exports/index.d.mts.map +1 -1
- package/dist/exports/index.mjs +4 -6
- package/dist/exports/index.mjs.map +1 -1
- package/package.json +7 -7
- package/src/emit-types.ts +0 -1
- package/src/emit.ts +1 -2
- package/src/generate-contract-dts.ts +1 -4
package/README.md
CHANGED
|
@@ -25,7 +25,7 @@ Provide a deterministic, verifiable representation of the application's data con
|
|
|
25
25
|
- **Validate**: Core structure validation (family-specific validation is the caller's responsibility)
|
|
26
26
|
- **Canonicalize**: Compute `storageHash` (schema meaning), `executionHash` (execution defaults), and `profileHash` (capabilities/pins) from canonical JSON
|
|
27
27
|
- **Emit**: Generate `contract.json` and `contract.d.ts` with family-specific type generation
|
|
28
|
-
- **Descriptor-Agnostic**: The emitter is completely agnostic to how descriptors are produced. It receives pre-assembled `OperationRegistry`, `codecTypeImports`,
|
|
28
|
+
- **Descriptor-Agnostic**: The emitter is completely agnostic to how descriptors are produced. It receives pre-assembled `OperationRegistry`, `codecTypeImports`, and `extensionIds` from the CLI or family helpers—no pack manifest parsing happens inside the emitter.
|
|
29
29
|
|
|
30
30
|
**Note**: The emitter does NOT normalize contracts. Normalization must happen in the contract builder when the contract is created. The emitter assumes contracts are already normalized (all required fields present, including `schemaVersion`, `models`, `relations`, `storage`, `extensions`, `capabilities`, `meta`, and `sources`). All fields can be empty objects/arrays, but they must be present.
|
|
31
31
|
|
|
@@ -162,7 +162,6 @@ const result = await emit(contract, {
|
|
|
162
162
|
outputDir: './dist',
|
|
163
163
|
operationRegistry: createOperationRegistry(), // Pre-assembled from packs
|
|
164
164
|
codecTypeImports: [], // Extracted from packs (codec types)
|
|
165
|
-
operationTypeImports: [], // Extracted from packs (operation types)
|
|
166
165
|
extensionIds: ['postgres', 'pg'], // Extracted from packs
|
|
167
166
|
}, sqlEmission);
|
|
168
167
|
|
package/dist/exports/index.d.mts
CHANGED
|
@@ -18,7 +18,6 @@ declare function getEmittedArtifactPaths(outputJsonPath: string): EmittedArtifac
|
|
|
18
18
|
*/
|
|
19
19
|
interface EmitStackInput {
|
|
20
20
|
readonly codecTypeImports?: ReadonlyArray<TypesImportSpec>;
|
|
21
|
-
readonly operationTypeImports?: ReadonlyArray<TypesImportSpec>;
|
|
22
21
|
readonly queryOperationTypeImports?: ReadonlyArray<TypesImportSpec>;
|
|
23
22
|
readonly extensionIds?: ReadonlyArray<string>;
|
|
24
23
|
readonly codecLookup?: CodecLookup;
|
|
@@ -38,7 +37,7 @@ interface EmitResult {
|
|
|
38
37
|
declare function emit(contract: Contract, stack: EmitStackInput, targetFamily: EmissionSpi, options?: EmitOptions): Promise<EmitResult>;
|
|
39
38
|
//#endregion
|
|
40
39
|
//#region src/generate-contract-dts.d.ts
|
|
41
|
-
declare function generateContractDts(contract: Contract, emitter: EmissionSpi, codecTypeImports: ReadonlyArray<TypesImportSpec>,
|
|
40
|
+
declare function generateContractDts(contract: Contract, emitter: EmissionSpi, codecTypeImports: ReadonlyArray<TypesImportSpec>, hashes: {
|
|
42
41
|
readonly storageHash: string;
|
|
43
42
|
readonly executionHash?: string;
|
|
44
43
|
readonly profileHash: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/artifact-paths.ts","../../src/emit-types.ts","../../src/emit.ts","../../src/generate-contract-dts.ts"],"mappings":";;;;;;UAEiB,oBAAA;EAAA,SACN,QAAA;EAAA,SACA,OAAA;AAAA;AAAA,iBAGK,uBAAA,CAAwB,cAAA,WAAyB,oBAAA;;;;;;;AALjE;UCMiB,cAAA;EAAA,SACN,gBAAA,GAAmB,aAAA,CAAc,eAAA;EAAA,SACjC,
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/artifact-paths.ts","../../src/emit-types.ts","../../src/emit.ts","../../src/generate-contract-dts.ts"],"mappings":";;;;;;UAEiB,oBAAA;EAAA,SACN,QAAA;EAAA,SACA,OAAA;AAAA;AAAA,iBAGK,uBAAA,CAAwB,cAAA,WAAyB,oBAAA;;;;;;;AALjE;UCMiB,cAAA;EAAA,SACN,gBAAA,GAAmB,aAAA,CAAc,eAAA;EAAA,SACjC,yBAAA,GAA4B,aAAA,CAAc,eAAA;EAAA,SAC1C,YAAA,GAAe,aAAA;EAAA,SACf,WAAA,GAAc,WAAA;AAAA;AAAA,UAGR,WAAA;EAAA,SACN,cAAA;AAAA;AAAA,UAGM,UAAA;EAAA,SACN,YAAA;EAAA,SACA,WAAA;EAAA,SACA,WAAA;EAAA,SACA,aAAA;EAAA,SACA,WAAA;AAAA;;;iBCbW,IAAA,CACpB,QAAA,EAAU,QAAA,EACV,KAAA,EAAO,cAAA,EACP,YAAA,EAAc,WAAA,EACd,OAAA,GAAU,WAAA,GACT,OAAA,CAAQ,UAAA;;;iBCKK,mBAAA,CACd,QAAA,EAAU,QAAA,EACV,OAAA,EAAS,WAAA,EACT,gBAAA,EAAkB,aAAA,CAAc,eAAA,GAChC,MAAA;EAAA,SACW,WAAA;EAAA,SACA,aAAA;EAAA,SACA,WAAA;AAAA,GAEX,OAAA,GAAU,4BAAA,EACV,WAAA,GAAc,WAAA"}
|
package/dist/exports/index.mjs
CHANGED
|
@@ -13,14 +13,13 @@ function getEmittedArtifactPaths(outputJsonPath) {
|
|
|
13
13
|
}
|
|
14
14
|
//#endregion
|
|
15
15
|
//#region src/generate-contract-dts.ts
|
|
16
|
-
function generateContractDts(contract, emitter, codecTypeImports,
|
|
17
|
-
const allImports = [...codecTypeImports
|
|
16
|
+
function generateContractDts(contract, emitter, codecTypeImports, hashes, options, codecLookup) {
|
|
17
|
+
const allImports = [...codecTypeImports];
|
|
18
18
|
if (options?.queryOperationTypeImports) allImports.push(...options.queryOperationTypeImports);
|
|
19
19
|
const importLines = generateImportLines(deduplicateImports(allImports));
|
|
20
20
|
const familyImportLines = emitter.getFamilyImports();
|
|
21
21
|
const hashAliases = generateHashTypeAliases(hashes);
|
|
22
22
|
const codecTypes = generateCodecTypeIntersection(codecTypeImports, "CodecTypes");
|
|
23
|
-
const operationTypes = generateCodecTypeIntersection(operationTypeImports, "OperationTypes");
|
|
24
23
|
const familyTypeAliases = emitter.getFamilyTypeAliases(options);
|
|
25
24
|
const typeMapsExpr = emitter.getTypeMapsExpression();
|
|
26
25
|
const storageType = emitter.generateStorageType(contract, "StorageHash");
|
|
@@ -53,7 +52,6 @@ import type {
|
|
|
53
52
|
${hashAliases}
|
|
54
53
|
|
|
55
54
|
export type CodecTypes = ${codecTypes};
|
|
56
|
-
export type OperationTypes = ${operationTypes};
|
|
57
55
|
${familyTypeAliases}
|
|
58
56
|
${valueObjectTypeAliases}
|
|
59
57
|
export type FieldOutputTypes = ${fieldTypesMaps.output};
|
|
@@ -82,7 +80,7 @@ ${contractWrapper}
|
|
|
82
80
|
const SCHEMA_VERSION = "1";
|
|
83
81
|
async function emit(contract, stack, targetFamily, options) {
|
|
84
82
|
if (options?.outputJsonPath !== void 0) getEmittedArtifactPaths(options.outputJsonPath);
|
|
85
|
-
const { codecTypeImports,
|
|
83
|
+
const { codecTypeImports, queryOperationTypeImports } = stack;
|
|
86
84
|
const { storageHash } = contract.storage;
|
|
87
85
|
const executionHash = contract.execution?.executionHash;
|
|
88
86
|
const { profileHash } = contract;
|
|
@@ -103,7 +101,7 @@ async function emit(contract, stack, targetFamily, options) {
|
|
|
103
101
|
};
|
|
104
102
|
return {
|
|
105
103
|
contractJson: contractJsonString,
|
|
106
|
-
contractDts: await format(generateContractDts(contract, targetFamily, codecTypeImports ?? [],
|
|
104
|
+
contractDts: await format(generateContractDts(contract, targetFamily, codecTypeImports ?? [], contractTypeHashes, generateOptions, stack.codecLookup), {
|
|
107
105
|
parser: "typescript",
|
|
108
106
|
singleQuote: true,
|
|
109
107
|
semi: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/artifact-paths.ts","../../src/generate-contract-dts.ts","../../src/emit.ts"],"sourcesContent":["const JSON_EXTENSION = '.json';\n\nexport interface EmittedArtifactPaths {\n readonly jsonPath: string;\n readonly dtsPath: string;\n}\n\nexport function getEmittedArtifactPaths(outputJsonPath: string): EmittedArtifactPaths {\n if (!outputJsonPath.endsWith(JSON_EXTENSION)) {\n throw new Error('Contract output path must end with .json');\n }\n\n return {\n jsonPath: outputJsonPath,\n dtsPath: `${outputJsonPath.slice(0, -JSON_EXTENSION.length)}.d.ts`,\n };\n}\n","import type { Contract, ContractModel, ContractValueObject } from '@prisma-next/contract/types';\nimport type { CodecLookup } from '@prisma-next/framework-components/codec';\nimport type {\n EmissionSpi,\n GenerateContractTypesOptions,\n TypesImportSpec,\n} from '@prisma-next/framework-components/emission';\nimport {\n deduplicateImports,\n generateBothFieldTypesMaps,\n generateCodecTypeIntersection,\n generateHashTypeAliases,\n generateImportLines,\n generateModelsType,\n generateRootsType,\n generateValueObjectsDescriptorType,\n generateValueObjectTypeAliases,\n serializeExecutionType,\n serializeValue,\n} from './domain-type-generation';\n\nexport function generateContractDts(\n contract: Contract,\n emitter: EmissionSpi,\n codecTypeImports: ReadonlyArray<TypesImportSpec>,\n
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/artifact-paths.ts","../../src/generate-contract-dts.ts","../../src/emit.ts"],"sourcesContent":["const JSON_EXTENSION = '.json';\n\nexport interface EmittedArtifactPaths {\n readonly jsonPath: string;\n readonly dtsPath: string;\n}\n\nexport function getEmittedArtifactPaths(outputJsonPath: string): EmittedArtifactPaths {\n if (!outputJsonPath.endsWith(JSON_EXTENSION)) {\n throw new Error('Contract output path must end with .json');\n }\n\n return {\n jsonPath: outputJsonPath,\n dtsPath: `${outputJsonPath.slice(0, -JSON_EXTENSION.length)}.d.ts`,\n };\n}\n","import type { Contract, ContractModel, ContractValueObject } from '@prisma-next/contract/types';\nimport type { CodecLookup } from '@prisma-next/framework-components/codec';\nimport type {\n EmissionSpi,\n GenerateContractTypesOptions,\n TypesImportSpec,\n} from '@prisma-next/framework-components/emission';\nimport {\n deduplicateImports,\n generateBothFieldTypesMaps,\n generateCodecTypeIntersection,\n generateHashTypeAliases,\n generateImportLines,\n generateModelsType,\n generateRootsType,\n generateValueObjectsDescriptorType,\n generateValueObjectTypeAliases,\n serializeExecutionType,\n serializeValue,\n} from './domain-type-generation';\n\nexport function generateContractDts(\n contract: Contract,\n emitter: EmissionSpi,\n codecTypeImports: ReadonlyArray<TypesImportSpec>,\n hashes: {\n readonly storageHash: string;\n readonly executionHash?: string;\n readonly profileHash: string;\n },\n options?: GenerateContractTypesOptions,\n codecLookup?: CodecLookup,\n): string {\n const allImports: TypesImportSpec[] = [...codecTypeImports];\n if (options?.queryOperationTypeImports) {\n allImports.push(...options.queryOperationTypeImports);\n }\n const uniqueImports = deduplicateImports(allImports);\n const importLines = generateImportLines(uniqueImports);\n\n const familyImportLines = emitter.getFamilyImports();\n\n const hashAliases = generateHashTypeAliases(hashes);\n\n const codecTypes = generateCodecTypeIntersection(codecTypeImports, 'CodecTypes');\n\n const familyTypeAliases = emitter.getFamilyTypeAliases(options);\n\n const typeMapsExpr = emitter.getTypeMapsExpression();\n\n const storageType = emitter.generateStorageType(contract, 'StorageHash');\n\n const modelsType = generateModelsType(\n contract.models as Record<string, ContractModel>,\n (name, model) => emitter.generateModelStorageType(name, model),\n );\n\n const rootsType = generateRootsType(contract.roots);\n\n const valueObjects = contract.valueObjects as Record<string, ContractValueObject> | undefined;\n const valueObjectTypeAliases = generateValueObjectTypeAliases(valueObjects, codecLookup);\n const valueObjectsDescriptor = generateValueObjectsDescriptorType(valueObjects);\n\n const executionClause =\n contract.execution !== undefined\n ? `\\n readonly execution: ${serializeExecutionType(contract.execution)};`\n : '';\n\n const resolveFieldTypeParams = emitter.resolveFieldTypeParams\n ? (modelName: string, fieldName: string) => {\n const model = (contract.models as Record<string, ContractModel> | undefined)?.[modelName];\n if (!model) return undefined;\n return emitter.resolveFieldTypeParams?.(modelName, fieldName, model, contract);\n }\n : undefined;\n\n const fieldTypesMaps = generateBothFieldTypesMaps(\n contract.models as Record<string, ContractModel> | undefined,\n codecLookup,\n resolveFieldTypeParams,\n );\n\n const contractWrapper = emitter.getContractWrapper('ContractBase', 'TypeMaps');\n\n return `// ⚠️ GENERATED FILE - DO NOT EDIT\n// This file is automatically generated by 'prisma-next contract emit'.\n// To regenerate, run: prisma-next contract emit\n${importLines.join('\\n')}\n\n${familyImportLines.join('\\n')}\nimport type {\n Contract as ContractType,\n ExecutionHashBase,\n ProfileHashBase,\n StorageHashBase,\n} from '@prisma-next/contract/types';\n\n${hashAliases}\n\nexport type CodecTypes = ${codecTypes};\n${familyTypeAliases}\n${valueObjectTypeAliases}\nexport type FieldOutputTypes = ${fieldTypesMaps.output};\nexport type FieldInputTypes = ${fieldTypesMaps.input};\nexport type TypeMaps = ${typeMapsExpr};\n\ntype ContractBase = ContractType<\n${storageType},\n${modelsType}\n> & {\n readonly target: ${serializeValue(contract.target)};\n readonly targetFamily: ${serializeValue(contract.targetFamily)};\n readonly roots: ${rootsType};\n readonly capabilities: ${serializeValue(contract.capabilities)};\n readonly extensionPacks: ${serializeValue(contract.extensionPacks)};${executionClause}\n readonly meta: ${serializeValue(contract.meta)};\n ${valueObjects ? `readonly valueObjects: ${valueObjectsDescriptor};` : ''}\n readonly profileHash: ProfileHash;\n};\n\n${contractWrapper}\n`;\n}\n","import { canonicalizeContractToObject } from '@prisma-next/contract/hashing';\nimport type { Contract } from '@prisma-next/contract/types';\nimport type { EmissionSpi } from '@prisma-next/framework-components/emission';\nimport { ifDefined } from '@prisma-next/utils/defined';\nimport { format } from 'prettier';\nimport { getEmittedArtifactPaths } from './artifact-paths';\nimport type { EmitOptions, EmitResult, EmitStackInput } from './emit-types';\nimport { generateContractDts } from './generate-contract-dts';\n\nconst SCHEMA_VERSION = '1';\n\nexport async function emit(\n contract: Contract,\n stack: EmitStackInput,\n targetFamily: EmissionSpi,\n options?: EmitOptions,\n): Promise<EmitResult> {\n if (options?.outputJsonPath !== undefined) {\n getEmittedArtifactPaths(options.outputJsonPath);\n }\n\n const { codecTypeImports, queryOperationTypeImports } = stack;\n\n const { storageHash } = contract.storage;\n const executionHash = contract.execution?.executionHash;\n const { profileHash } = contract;\n\n const canonicalized = canonicalizeContractToObject(contract, {\n schemaVersion: SCHEMA_VERSION,\n });\n const contractJsonString = JSON.stringify(\n {\n ...canonicalized,\n _generated: {\n warning: '⚠️ GENERATED FILE - DO NOT EDIT',\n message: 'This file is automatically generated by \"prisma-next contract emit\".',\n regenerate: 'To regenerate, run: prisma-next contract emit',\n },\n },\n null,\n 2,\n );\n\n const generateOptions = queryOperationTypeImports ? { queryOperationTypeImports } : undefined;\n\n const contractTypeHashes = {\n storageHash,\n ...ifDefined('executionHash', executionHash),\n profileHash,\n };\n const contractDtsRaw = generateContractDts(\n contract,\n targetFamily,\n codecTypeImports ?? [],\n contractTypeHashes,\n generateOptions,\n stack.codecLookup,\n );\n const contractDts = await format(contractDtsRaw, {\n parser: 'typescript',\n singleQuote: true,\n semi: true,\n printWidth: 100,\n });\n\n return {\n contractJson: contractJsonString,\n contractDts,\n storageHash,\n ...ifDefined('executionHash', executionHash),\n profileHash,\n };\n}\n"],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma-next/emitter",
|
|
3
|
-
"version": "0.5.0-dev.
|
|
3
|
+
"version": "0.5.0-dev.84",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"arktype": "^2.1.29",
|
|
13
13
|
"prettier": "^3.8.3",
|
|
14
|
-
"@prisma-next/
|
|
15
|
-
"@prisma-next/
|
|
16
|
-
"@prisma-next/utils": "0.5.0-dev.
|
|
17
|
-
"@prisma-next/
|
|
14
|
+
"@prisma-next/framework-components": "0.5.0-dev.84",
|
|
15
|
+
"@prisma-next/contract": "0.5.0-dev.84",
|
|
16
|
+
"@prisma-next/utils": "0.5.0-dev.84",
|
|
17
|
+
"@prisma-next/operations": "0.5.0-dev.84"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@types/node": "24.10.4",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"typescript": "5.9.3",
|
|
23
23
|
"vitest": "4.1.5",
|
|
24
24
|
"@prisma-next/test-utils": "0.0.1",
|
|
25
|
-
"@prisma-next/
|
|
26
|
-
"@prisma-next/
|
|
25
|
+
"@prisma-next/tsdown": "0.0.0",
|
|
26
|
+
"@prisma-next/tsconfig": "0.0.0"
|
|
27
27
|
},
|
|
28
28
|
"exports": {
|
|
29
29
|
".": {
|
package/src/emit-types.ts
CHANGED
|
@@ -8,7 +8,6 @@ import type { TypesImportSpec } from '@prisma-next/framework-components/emission
|
|
|
8
8
|
*/
|
|
9
9
|
export interface EmitStackInput {
|
|
10
10
|
readonly codecTypeImports?: ReadonlyArray<TypesImportSpec>;
|
|
11
|
-
readonly operationTypeImports?: ReadonlyArray<TypesImportSpec>;
|
|
12
11
|
readonly queryOperationTypeImports?: ReadonlyArray<TypesImportSpec>;
|
|
13
12
|
readonly extensionIds?: ReadonlyArray<string>;
|
|
14
13
|
readonly codecLookup?: CodecLookup;
|
package/src/emit.ts
CHANGED
|
@@ -19,7 +19,7 @@ export async function emit(
|
|
|
19
19
|
getEmittedArtifactPaths(options.outputJsonPath);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
const { codecTypeImports,
|
|
22
|
+
const { codecTypeImports, queryOperationTypeImports } = stack;
|
|
23
23
|
|
|
24
24
|
const { storageHash } = contract.storage;
|
|
25
25
|
const executionHash = contract.execution?.executionHash;
|
|
@@ -52,7 +52,6 @@ export async function emit(
|
|
|
52
52
|
contract,
|
|
53
53
|
targetFamily,
|
|
54
54
|
codecTypeImports ?? [],
|
|
55
|
-
operationTypeImports ?? [],
|
|
56
55
|
contractTypeHashes,
|
|
57
56
|
generateOptions,
|
|
58
57
|
stack.codecLookup,
|
|
@@ -23,7 +23,6 @@ export function generateContractDts(
|
|
|
23
23
|
contract: Contract,
|
|
24
24
|
emitter: EmissionSpi,
|
|
25
25
|
codecTypeImports: ReadonlyArray<TypesImportSpec>,
|
|
26
|
-
operationTypeImports: ReadonlyArray<TypesImportSpec>,
|
|
27
26
|
hashes: {
|
|
28
27
|
readonly storageHash: string;
|
|
29
28
|
readonly executionHash?: string;
|
|
@@ -32,7 +31,7 @@ export function generateContractDts(
|
|
|
32
31
|
options?: GenerateContractTypesOptions,
|
|
33
32
|
codecLookup?: CodecLookup,
|
|
34
33
|
): string {
|
|
35
|
-
const allImports: TypesImportSpec[] = [...codecTypeImports
|
|
34
|
+
const allImports: TypesImportSpec[] = [...codecTypeImports];
|
|
36
35
|
if (options?.queryOperationTypeImports) {
|
|
37
36
|
allImports.push(...options.queryOperationTypeImports);
|
|
38
37
|
}
|
|
@@ -44,7 +43,6 @@ export function generateContractDts(
|
|
|
44
43
|
const hashAliases = generateHashTypeAliases(hashes);
|
|
45
44
|
|
|
46
45
|
const codecTypes = generateCodecTypeIntersection(codecTypeImports, 'CodecTypes');
|
|
47
|
-
const operationTypes = generateCodecTypeIntersection(operationTypeImports, 'OperationTypes');
|
|
48
46
|
|
|
49
47
|
const familyTypeAliases = emitter.getFamilyTypeAliases(options);
|
|
50
48
|
|
|
@@ -100,7 +98,6 @@ import type {
|
|
|
100
98
|
${hashAliases}
|
|
101
99
|
|
|
102
100
|
export type CodecTypes = ${codecTypes};
|
|
103
|
-
export type OperationTypes = ${operationTypes};
|
|
104
101
|
${familyTypeAliases}
|
|
105
102
|
${valueObjectTypeAliases}
|
|
106
103
|
export type FieldOutputTypes = ${fieldTypesMaps.output};
|