@prisma-next/config 0.3.0-dev.98 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/{config-types-JXY6wmXW.d.mts → config-types-B_uoLKIE.d.mts} +11 -5
- package/dist/config-types-B_uoLKIE.d.mts.map +1 -0
- package/dist/config-types.d.mts +1 -1
- package/dist/config-types.mjs.map +1 -1
- package/dist/config-validation.d.mts +1 -1
- package/dist/config-validation.mjs +1 -1
- package/dist/config-validation.mjs.map +1 -1
- package/package.json +5 -5
- package/src/config-types.ts +4 -4
- package/src/config-validation.ts +2 -2
- package/src/contract-source-types.ts +8 -2
- package/dist/config-types-JXY6wmXW.d.mts.map +0 -1
- package/dist/types-kA81phZc.d.mts +0 -197
- package/dist/types-kA81phZc.d.mts.map +0 -1
- package/dist/types.d.mts +0 -2
- package/dist/types.mjs +0 -1
- package/src/exports/types.ts +0 -13
- package/src/types.ts +0 -316
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ This package owns the shared config contract used by tooling and authoring packa
|
|
|
20
20
|
## Non-responsibilities
|
|
21
21
|
|
|
22
22
|
- Config file discovery/loading (`c12`, file I/O) - handled by `@prisma-next/cli`
|
|
23
|
-
- CLI error envelope formatting and rendering - handled by CLI/
|
|
23
|
+
- CLI error envelope formatting and rendering - handled by CLI/errors package error utilities
|
|
24
24
|
- Control-plane migration operations and runtime actions
|
|
25
25
|
|
|
26
26
|
## Usage
|
|
@@ -34,7 +34,7 @@ const config = defineConfig({
|
|
|
34
34
|
target: postgresTargetDescriptor,
|
|
35
35
|
adapter: postgresAdapterDescriptor,
|
|
36
36
|
contract: {
|
|
37
|
-
source: async () => /* Result<
|
|
37
|
+
source: async () => /* Result<Contract, ContractSourceDiagnostics> */ null as never,
|
|
38
38
|
},
|
|
39
39
|
});
|
|
40
40
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ControlAdapterDescriptor, ControlDriverDescriptor, ControlDriverInstance, ControlExtensionDescriptor, ControlFamilyDescriptor, ControlTargetDescriptor } from "@prisma-next/framework-components/control";
|
|
2
|
+
import { Contract } from "@prisma-next/contract/types";
|
|
3
3
|
import { Result } from "@prisma-next/utils/result";
|
|
4
4
|
|
|
5
5
|
//#region src/contract-source-types.d.ts
|
|
@@ -17,6 +17,12 @@ interface ContractSourceDiagnostic {
|
|
|
17
17
|
readonly message: string;
|
|
18
18
|
readonly sourceId?: string;
|
|
19
19
|
readonly span?: ContractSourceDiagnosticSpan;
|
|
20
|
+
/**
|
|
21
|
+
* Optional structured payload for machine-readable consumers (agents,
|
|
22
|
+
* IDE extensions, CLI auto-fix). Human-readable prose lives in `message`;
|
|
23
|
+
* `data` carries the extracted facts (e.g. `{ namespace: 'pgvector' }`).
|
|
24
|
+
*/
|
|
25
|
+
readonly data?: Readonly<Record<string, unknown>>;
|
|
20
26
|
}
|
|
21
27
|
interface ContractSourceDiagnostics {
|
|
22
28
|
readonly summary: string;
|
|
@@ -26,7 +32,7 @@ interface ContractSourceDiagnostics {
|
|
|
26
32
|
interface ContractSourceContext {
|
|
27
33
|
readonly composedExtensionPacks: readonly string[];
|
|
28
34
|
}
|
|
29
|
-
type ContractSourceProvider = (context: ContractSourceContext) => Promise<Result<
|
|
35
|
+
type ContractSourceProvider = (context: ContractSourceContext) => Promise<Result<Contract, ContractSourceDiagnostics>>;
|
|
30
36
|
//#endregion
|
|
31
37
|
//#region src/config-types.d.ts
|
|
32
38
|
/**
|
|
@@ -35,7 +41,7 @@ type ContractSourceProvider = (context: ContractSourceContext) => Promise<Result
|
|
|
35
41
|
interface ContractConfig {
|
|
36
42
|
/**
|
|
37
43
|
* Contract source provider. The provider is always async and must return
|
|
38
|
-
* a Result containing either
|
|
44
|
+
* a Result containing either a Contract or structured diagnostics.
|
|
39
45
|
*/
|
|
40
46
|
readonly source: ContractSourceProvider;
|
|
41
47
|
/**
|
|
@@ -103,4 +109,4 @@ interface PrismaNextConfig<TFamilyId extends string = string, TTargetId extends
|
|
|
103
109
|
declare function defineConfig<TFamilyId extends string = string, TTargetId extends string = string>(config: PrismaNextConfig<TFamilyId, TTargetId>): PrismaNextConfig<TFamilyId, TTargetId>;
|
|
104
110
|
//#endregion
|
|
105
111
|
export { ContractSourceDiagnostic as a, ContractSourceDiagnostics as c, ContractSourceContext as i, ContractSourceProvider as l, PrismaNextConfig as n, ContractSourceDiagnosticPosition as o, defineConfig as r, ContractSourceDiagnosticSpan as s, ContractConfig as t };
|
|
106
|
-
//# sourceMappingURL=config-types-
|
|
112
|
+
//# sourceMappingURL=config-types-B_uoLKIE.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-types-B_uoLKIE.d.mts","names":[],"sources":["../src/contract-source-types.ts","../src/config-types.ts"],"sourcesContent":[],"mappings":";;;;;UAGiB,gCAAA;;;EAAA,SAAA,MAAA,EAAA,MAAA;AAMjB;AAKiB,UALA,4BAAA,CAKwB;EAIvB,SAAA,KAAA,EARA,gCAQA;EAMS,SAAA,GAAA,EAbX,gCAaW;;AAAD,UAVT,wBAAA,CAUS;EAGT,SAAA,IAAA,EAAA,MAAA;EAMA,SAAA,OAAA,EAAA,MAAqB;EAI1B,SAAA,QAAA,CAAA,EAAA,MAAsB;EACvB,SAAA,IAAA,CAAA,EApBO,4BAoBP;EACS;;;;;kBAfF,SAAS;;UAGV,yBAAA;ECPA,SAAA,OAAA,EAAc,MAAA;EAqBd,SAAA,WAAgB,EAAA,SDZA,wBCYA,EAAA;EAKU,SAAA,IAAA,CAAA,EDhBzB,MCgByB,CAAA,MAAA,EAAA,OAAA,CAAA;;AACA,UDd1B,qBAAA,CCc0B;EAAW,SAAA,sBAAA,EAAA,SAAA,MAAA,EAAA;;AACT,KDXjC,sBAAA,GCWiC,CAAA,OAAA,EDVlC,qBCUkC,EAAA,GDTxC,OCSwC,CDThC,MCSgC,CDTzB,QCSyB,EDTf,yBCSe,CAAA,CAAA;;;ADlC7C;;;AAUkB,UCJD,cAAA,CDIC;EAAQ;AAG1B;AAMA;AAIA;EACW,SAAA,MAAA,ECbQ,sBDaR;EACS;;;;EAAR,SAAA,MAAA,CAAA,EAAA,MAAA;;;;ACnBZ;AAqBA;;;;;AAMmB,UANF,gBAME,CAAA,kBAAA,MAAA,GAAA,MAAA,EAAA,kBAAA,MAAA,GAAA,MAAA,EAAA,cAAA,OAAA,CAAA,CAAA;EAC0B,SAAA,MAAA,EAF1B,uBAE0B,CAFF,SAEE,CAAA;EAAW,SAAA,MAAA,EADrC,uBACqC,CADb,SACa,EADF,SACE,CAAA;EAApC,SAAA,OAAA,EAAA,wBAAA,CAAyB,SAAzB,EAAoC,SAApC,CAAA;EAC4C,SAAA,cAAA,CAAA,EAAA,SAA3B,0BAA2B,CAAA,SAAA,EAAW,SAAX,CAAA,EAAA;EAAW;;;;;;EAUvE,SAAA,MAAA,CAAA,EAHgB,uBAGhB,CAFA,SAEA,EADA,SACA,EAAA,qBAAA,CAAsB,SAAtB,EAAiC,SAAjC,CAAA,EACA,WADA,CAAA;EACA;;;;EAkBgC,SAAA,EAAA,CAAA,EAAA;IAkDpB;;;;;IAEe,SAAA,UAAA,CAAA,EA1DL,WA0DK;EAA5B,CAAA;EAAgB;;;;sBApDG;;;;;;;;;;;;;;;;;;;;iBAkDN,2FACN,iBAAiB,WAAW,aACnC,iBAAiB,WAAW"}
|
package/dist/config-types.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as ContractSourceDiagnostic, c as ContractSourceDiagnostics, i as ContractSourceContext, l as ContractSourceProvider, n as PrismaNextConfig, o as ContractSourceDiagnosticPosition, r as defineConfig, s as ContractSourceDiagnosticSpan, t as ContractConfig } from "./config-types-
|
|
1
|
+
import { a as ContractSourceDiagnostic, c as ContractSourceDiagnostics, i as ContractSourceContext, l as ContractSourceProvider, n as PrismaNextConfig, o as ContractSourceDiagnosticPosition, r as defineConfig, s as ContractSourceDiagnosticSpan, t as ContractConfig } from "./config-types-B_uoLKIE.mjs";
|
|
2
2
|
export { type ContractConfig, type ContractSourceContext, type ContractSourceDiagnostic, type ContractSourceDiagnosticPosition, type ContractSourceDiagnosticSpan, type ContractSourceDiagnostics, type ContractSourceProvider, type PrismaNextConfig, defineConfig };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-types.mjs","names":["normalizedContract: ContractConfig"],"sources":["../src/config-types.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"config-types.mjs","names":["normalizedContract: ContractConfig"],"sources":["../src/config-types.ts"],"sourcesContent":["import type {\n ControlAdapterDescriptor,\n ControlDriverDescriptor,\n ControlDriverInstance,\n ControlExtensionDescriptor,\n ControlFamilyDescriptor,\n ControlTargetDescriptor,\n} from '@prisma-next/framework-components/control';\nimport { type } from 'arktype';\nimport type { ContractSourceProvider } from './contract-source-types';\n\n/**\n * Type alias for CLI driver instances.\n * Uses string for both family and target IDs for maximum flexibility.\n */\nexport type CliDriver = ControlDriverInstance<string, string>;\n\n/**\n * Contract configuration specifying source and artifact locations.\n */\nexport interface ContractConfig {\n /**\n * Contract source provider. The provider is always async and must return\n * a Result containing either a Contract or structured diagnostics.\n */\n readonly source: ContractSourceProvider;\n /**\n * Path to contract.json artifact. Defaults to 'src/prisma/contract.json'.\n * The .d.ts types file will be colocated (e.g., contract.json -> contract.d.ts).\n */\n readonly output?: string;\n}\n\n/**\n * Configuration for Prisma Next CLI.\n * Uses Control*Descriptor types for type-safe wiring with compile-time compatibility checks.\n *\n * @template TFamilyId - The family ID (e.g., 'sql', 'document')\n * @template TTargetId - The target ID (e.g., 'postgres', 'mysql')\n * @template TConnection - The driver connection input type (defaults to `unknown` for config flexibility)\n */\nexport interface PrismaNextConfig<\n TFamilyId extends string = string,\n TTargetId extends string = string,\n TConnection = unknown,\n> {\n readonly family: ControlFamilyDescriptor<TFamilyId>;\n readonly target: ControlTargetDescriptor<TFamilyId, TTargetId>;\n readonly adapter: ControlAdapterDescriptor<TFamilyId, TTargetId>;\n readonly extensionPacks?: readonly ControlExtensionDescriptor<TFamilyId, TTargetId>[];\n /**\n * Driver descriptor for DB-connected CLI commands.\n * Required for DB-connected commands (e.g., db verify).\n * Optional for commands that don't need database access (e.g., emit).\n * The driver's connection type matches the TConnection config parameter.\n */\n readonly driver?: ControlDriverDescriptor<\n TFamilyId,\n TTargetId,\n ControlDriverInstance<TFamilyId, TTargetId>,\n TConnection\n >;\n /**\n * Database connection configuration.\n * The connection type is driver-specific (e.g., URL string for Postgres).\n */\n readonly db?: {\n /**\n * Driver-specific connection input.\n * For Postgres: a connection string (URL).\n * For other drivers: may be a structured object.\n */\n readonly connection?: TConnection;\n };\n /**\n * Contract configuration. Specifies source and artifact locations.\n * Required for emit command; optional for other commands that only read artifacts.\n */\n readonly contract?: ContractConfig;\n /**\n * Migration configuration. Controls where on-disk migration packages are stored.\n */\n readonly migrations?: {\n /** Directory for migration packages, relative to config file. Defaults to 'migrations'. */\n readonly dir?: string;\n };\n}\n\n/**\n * Arktype schema for ContractConfig validation.\n * Validates presence/shape only.\n * contract.source is validated as a provider function at runtime in defineConfig().\n */\nconst ContractConfigSchema = type({\n source: 'unknown', // Runtime check enforces provider function shape\n 'output?': 'string',\n});\n\n/**\n * Arktype schema for PrismaNextConfig validation.\n * Note: This validates structure only. Descriptor objects (family, target, adapter) are validated separately.\n */\nconst MigrationsConfigSchema = type({\n 'dir?': 'string',\n});\n\nconst PrismaNextConfigSchema = type({\n family: 'unknown', // ControlFamilyDescriptor - validated separately\n target: 'unknown', // ControlTargetDescriptor - validated separately\n adapter: 'unknown', // ControlAdapterDescriptor - validated separately\n 'extensionPacks?': 'unknown[]',\n 'driver?': 'unknown', // ControlDriverDescriptor - validated separately (optional)\n 'db?': 'unknown',\n 'contract?': ContractConfigSchema,\n 'migrations?': MigrationsConfigSchema,\n});\n\n/**\n * Helper function to define a Prisma Next config.\n * Validates and normalizes the config using Arktype, then returns the normalized IR.\n *\n * Normalization:\n * - contract.output defaults to 'src/prisma/contract.json' if missing\n *\n * @param config - Raw config input from user\n * @returns Normalized config IR with defaults applied\n * @throws Error if config structure is invalid\n */\nexport function defineConfig<TFamilyId extends string = string, TTargetId extends string = string>(\n config: PrismaNextConfig<TFamilyId, TTargetId>,\n): PrismaNextConfig<TFamilyId, TTargetId> {\n // Validate structure using Arktype\n const validated = PrismaNextConfigSchema(config);\n if (validated instanceof type.errors) {\n const messages = validated.map((p: { message: string }) => p.message).join('; ');\n throw new Error(`Config validation failed: ${messages}`);\n }\n\n // Normalize contract config if present\n if (config.contract) {\n // Validate contract.source provider function shape at runtime.\n const source = config.contract.source;\n if (typeof source !== 'function') {\n throw new Error('Config.contract.source must be a provider function');\n }\n\n // Apply defaults\n const output = config.contract.output ?? 'src/prisma/contract.json';\n\n const normalizedContract: ContractConfig = {\n source: config.contract.source,\n output,\n };\n\n // Return normalized config\n return {\n ...config,\n contract: normalizedContract,\n };\n }\n\n // Return config as-is if no contract (preserve literal types)\n return config;\n}\n"],"mappings":";;;;;;;;AA6FA,MAAM,uBAAuB,KAAK;CAChC,QAAQ;CACR,WAAW;CACZ,CAAC;;;;;AAMF,MAAM,yBAAyB,KAAK,EAClC,QAAQ,UACT,CAAC;AAEF,MAAM,yBAAyB,KAAK;CAClC,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,mBAAmB;CACnB,WAAW;CACX,OAAO;CACP,aAAa;CACb,eAAe;CAChB,CAAC;;;;;;;;;;;;AAaF,SAAgB,aACd,QACwC;CAExC,MAAM,YAAY,uBAAuB,OAAO;AAChD,KAAI,qBAAqB,KAAK,QAAQ;EACpC,MAAM,WAAW,UAAU,KAAK,MAA2B,EAAE,QAAQ,CAAC,KAAK,KAAK;AAChF,QAAM,IAAI,MAAM,6BAA6B,WAAW;;AAI1D,KAAI,OAAO,UAAU;AAGnB,MAAI,OADW,OAAO,SAAS,WACT,WACpB,OAAM,IAAI,MAAM,qDAAqD;EAIvE,MAAM,SAAS,OAAO,SAAS,UAAU;EAEzC,MAAMA,qBAAqC;GACzC,QAAQ,OAAO,SAAS;GACxB;GACD;AAGD,SAAO;GACL,GAAG;GACH,UAAU;GACX;;AAIH,QAAO"}
|
|
@@ -33,7 +33,7 @@ function validateConfig(config) {
|
|
|
33
33
|
if (typeof family["id"] !== "string") throwValidation("family.id", "Config.family must have id: string");
|
|
34
34
|
if (typeof family["familyId"] !== "string") throwValidation("family.familyId", "Config.family must have familyId: string");
|
|
35
35
|
if (typeof family["version"] !== "string") throwValidation("family.version", "Config.family must have version: string");
|
|
36
|
-
if (!family["
|
|
36
|
+
if (!family["emission"] || typeof family["emission"] !== "object") throwValidation("family.emission", "Config.family must have emission: EmissionSpi");
|
|
37
37
|
if (typeof family["create"] !== "function") throwValidation("family.create", "Config.family must have create: function");
|
|
38
38
|
const familyId = family["familyId"];
|
|
39
39
|
const target = configObj["target"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-validation.mjs","names":[],"sources":["../src/errors.ts","../src/config-validation.ts"],"sourcesContent":["export class ConfigValidationError extends Error {\n readonly field: string;\n readonly why: string;\n\n constructor(field: string, why?: string) {\n super(why ?? `Config must have a \"${field}\" field`);\n this.name = 'ConfigValidationError';\n this.field = field;\n this.why = why ?? `Config must have a \"${field}\" field`;\n }\n}\n","import type { PrismaNextConfig } from './config-types';\nimport { ConfigValidationError } from './errors';\n\nfunction throwValidation(field: string, why?: string): never {\n throw new ConfigValidationError(field, why);\n}\n\n/**\n * Validates that the config has the required structure.\n * This is pure validation logic with no file I/O or CLI awareness.\n *\n * @param config - Config object to validate\n * @throws ConfigValidationError if config structure is invalid\n */\nexport function validateConfig(config: unknown): asserts config is PrismaNextConfig {\n if (!config || typeof config !== 'object') {\n throwValidation('object', 'Config must be an object');\n }\n\n const configObj = config as Record<string, unknown>;\n\n if (!configObj['family']) {\n throwValidation('family');\n }\n\n if (!configObj['target']) {\n throwValidation('target');\n }\n\n if (!configObj['adapter']) {\n throwValidation('adapter');\n }\n\n // Validate family descriptor\n const family = configObj['family'] as Record<string, unknown>;\n if (family['kind'] !== 'family') {\n throwValidation('family.kind', 'Config.family must have kind: \"family\"');\n }\n if (typeof family['id'] !== 'string') {\n throwValidation('family.id', 'Config.family must have id: string');\n }\n if (typeof family['familyId'] !== 'string') {\n throwValidation('family.familyId', 'Config.family must have familyId: string');\n }\n if (typeof family['version'] !== 'string') {\n throwValidation('family.version', 'Config.family must have version: string');\n }\n if (!family['hook'] || typeof family['hook'] !== 'object') {\n throwValidation('family.hook', 'Config.family must have hook: TargetFamilyHook');\n }\n if (typeof family['create'] !== 'function') {\n throwValidation('family.create', 'Config.family must have create: function');\n }\n\n const familyId = family['familyId'] as string;\n\n // Validate target descriptor\n const target = configObj['target'] as Record<string, unknown>;\n if (target['kind'] !== 'target') {\n throwValidation('target.kind', 'Config.target must have kind: \"target\"');\n }\n if (typeof target['id'] !== 'string') {\n throwValidation('target.id', 'Config.target must have id: string');\n }\n if (typeof target['familyId'] !== 'string') {\n throwValidation('target.familyId', 'Config.target must have familyId: string');\n }\n if (typeof target['version'] !== 'string') {\n throwValidation('target.version', 'Config.target must have version: string');\n }\n if (target['familyId'] !== familyId) {\n throwValidation(\n 'target.familyId',\n `Config.target.familyId must match Config.family.familyId (expected: ${familyId}, got: ${target['familyId']})`,\n );\n }\n if (typeof target['targetId'] !== 'string') {\n throwValidation('target.targetId', 'Config.target must have targetId: string');\n }\n if (typeof target['create'] !== 'function') {\n throwValidation('target.create', 'Config.target must have create: function');\n }\n const expectedTargetId = target['targetId'] as string;\n\n // Validate adapter descriptor\n const adapter = configObj['adapter'] as Record<string, unknown>;\n if (adapter['kind'] !== 'adapter') {\n throwValidation('adapter.kind', 'Config.adapter must have kind: \"adapter\"');\n }\n if (typeof adapter['id'] !== 'string') {\n throwValidation('adapter.id', 'Config.adapter must have id: string');\n }\n if (typeof adapter['familyId'] !== 'string') {\n throwValidation('adapter.familyId', 'Config.adapter must have familyId: string');\n }\n if (typeof adapter['version'] !== 'string') {\n throwValidation('adapter.version', 'Config.adapter must have version: string');\n }\n if (adapter['familyId'] !== familyId) {\n throwValidation(\n 'adapter.familyId',\n `Config.adapter.familyId must match Config.family.familyId (expected: ${familyId}, got: ${adapter['familyId']})`,\n );\n }\n if (typeof adapter['targetId'] !== 'string') {\n throwValidation('adapter.targetId', 'Config.adapter must have targetId: string');\n }\n if (adapter['targetId'] !== expectedTargetId) {\n throwValidation(\n 'adapter.targetId',\n `Config.adapter.targetId must match Config.target.targetId (expected: ${expectedTargetId}, got: ${adapter['targetId']})`,\n );\n }\n if (typeof adapter['create'] !== 'function') {\n throwValidation('adapter.create', 'Config.adapter must have create: function');\n }\n\n if (configObj['extensions'] !== undefined) {\n throwValidation('extensions', 'Config.extensions is not supported; use Config.extensionPacks');\n }\n\n // Validate extensionPacks array if present\n if (configObj['extensionPacks'] !== undefined) {\n if (!Array.isArray(configObj['extensionPacks'])) {\n throwValidation('extensionPacks', 'Config.extensionPacks must be an array');\n }\n for (const ext of configObj['extensionPacks']) {\n if (!ext || typeof ext !== 'object') {\n throwValidation(\n 'extensionPacks[]',\n 'Config.extensionPacks must contain ControlExtensionDescriptor objects',\n );\n }\n const extObj = ext as Record<string, unknown>;\n if (extObj['kind'] !== 'extension') {\n throwValidation(\n 'extensionPacks[].kind',\n 'Config.extensionPacks items must have kind: \"extension\"',\n );\n }\n if (typeof extObj['id'] !== 'string') {\n throwValidation('extensionPacks[].id', 'Config.extensionPacks items must have id: string');\n }\n if (typeof extObj['familyId'] !== 'string') {\n throwValidation(\n 'extensionPacks[].familyId',\n 'Config.extensionPacks items must have familyId: string',\n );\n }\n if (typeof extObj['version'] !== 'string') {\n throwValidation(\n 'extensionPacks[].version',\n 'Config.extensionPacks items must have version: string',\n );\n }\n if (extObj['familyId'] !== familyId) {\n throwValidation(\n 'extensionPacks[].familyId',\n `Config.extensionPacks[].familyId must match Config.family.familyId (expected: ${familyId}, got: ${extObj['familyId']})`,\n );\n }\n if (typeof extObj['targetId'] !== 'string') {\n throwValidation(\n 'extensionPacks[].targetId',\n 'Config.extensionPacks items must have targetId: string',\n );\n }\n if (extObj['targetId'] !== expectedTargetId) {\n throwValidation(\n 'extensionPacks[].targetId',\n `Config.extensionPacks[].targetId must match Config.target.targetId (expected: ${expectedTargetId}, got: ${extObj['targetId']})`,\n );\n }\n if (typeof extObj['create'] !== 'function') {\n throwValidation(\n 'extensionPacks[].create',\n 'Config.extensionPacks items must have create: function',\n );\n }\n }\n }\n\n // Validate driver descriptor if present\n if (configObj['driver'] !== undefined) {\n const driver = configObj['driver'] as Record<string, unknown>;\n if (driver['kind'] !== 'driver') {\n throwValidation('driver.kind', 'Config.driver must have kind: \"driver\"');\n }\n if (typeof driver['id'] !== 'string') {\n throwValidation('driver.id', 'Config.driver must have id: string');\n }\n if (typeof driver['version'] !== 'string') {\n throwValidation('driver.version', 'Config.driver must have version: string');\n }\n if (typeof driver['familyId'] !== 'string') {\n throwValidation('driver.familyId', 'Config.driver must have familyId: string');\n }\n if (driver['familyId'] !== familyId) {\n throwValidation(\n 'driver.familyId',\n `Config.driver.familyId must match Config.family.familyId (expected: ${familyId}, got: ${driver['familyId']})`,\n );\n }\n if (typeof driver['targetId'] !== 'string') {\n throwValidation('driver.targetId', 'Config.driver must have targetId: string');\n }\n if (driver['targetId'] !== expectedTargetId) {\n throwValidation(\n 'driver.targetId',\n `Config.driver.targetId must match Config.target.targetId (expected: ${expectedTargetId}, got: ${driver['targetId']})`,\n );\n }\n if (typeof driver['create'] !== 'function') {\n throwValidation('driver.create', 'Config.driver must have create: function');\n }\n }\n\n // Validate contract config if present (structure validation - defineConfig() handles normalization)\n if (configObj['contract'] !== undefined) {\n const contract = configObj['contract'] as Record<string, unknown>;\n if (!contract || typeof contract !== 'object') {\n throwValidation('contract', 'Config.contract must be an object');\n }\n if (!Object.hasOwn(contract, 'source')) {\n throwValidation(\n 'contract.source',\n 'Config.contract.source is required when contract is provided',\n );\n }\n\n if (typeof contract['source'] !== 'function') {\n throwValidation('contract.source', 'Config.contract.source must be a provider function');\n }\n\n if (contract['output'] !== undefined && typeof contract['output'] !== 'string') {\n throwValidation('contract.output', 'Config.contract.output must be a string when provided');\n }\n }\n}\n"],"mappings":";AAAA,IAAa,wBAAb,cAA2C,MAAM;CAC/C,AAAS;CACT,AAAS;CAET,YAAY,OAAe,KAAc;AACvC,QAAM,OAAO,uBAAuB,MAAM,SAAS;AACnD,OAAK,OAAO;AACZ,OAAK,QAAQ;AACb,OAAK,MAAM,OAAO,uBAAuB,MAAM;;;;;;ACLnD,SAAS,gBAAgB,OAAe,KAAqB;AAC3D,OAAM,IAAI,sBAAsB,OAAO,IAAI;;;;;;;;;AAU7C,SAAgB,eAAe,QAAqD;AAClF,KAAI,CAAC,UAAU,OAAO,WAAW,SAC/B,iBAAgB,UAAU,2BAA2B;CAGvD,MAAM,YAAY;AAElB,KAAI,CAAC,UAAU,UACb,iBAAgB,SAAS;AAG3B,KAAI,CAAC,UAAU,UACb,iBAAgB,SAAS;AAG3B,KAAI,CAAC,UAAU,WACb,iBAAgB,UAAU;CAI5B,MAAM,SAAS,UAAU;AACzB,KAAI,OAAO,YAAY,SACrB,iBAAgB,eAAe,2CAAyC;AAE1E,KAAI,OAAO,OAAO,UAAU,SAC1B,iBAAgB,aAAa,qCAAqC;AAEpE,KAAI,OAAO,OAAO,gBAAgB,SAChC,iBAAgB,mBAAmB,2CAA2C;AAEhF,KAAI,OAAO,OAAO,eAAe,SAC/B,iBAAgB,kBAAkB,0CAA0C;AAE9E,KAAI,CAAC,OAAO,WAAW,OAAO,OAAO,YAAY,SAC/C,iBAAgB,eAAe,iDAAiD;AAElF,KAAI,OAAO,OAAO,cAAc,WAC9B,iBAAgB,iBAAiB,2CAA2C;CAG9E,MAAM,WAAW,OAAO;CAGxB,MAAM,SAAS,UAAU;AACzB,KAAI,OAAO,YAAY,SACrB,iBAAgB,eAAe,2CAAyC;AAE1E,KAAI,OAAO,OAAO,UAAU,SAC1B,iBAAgB,aAAa,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B,YAAY,oCAAoC;AAElE,MAAI,CAAC,OAAO,OAAO,UAAU,SAAS,CACpC,iBACE,mBACA,+DACD;AAGH,MAAI,OAAO,SAAS,cAAc,WAChC,iBAAgB,mBAAmB,qDAAqD;AAG1F,MAAI,SAAS,cAAc,UAAa,OAAO,SAAS,cAAc,SACpE,iBAAgB,mBAAmB,wDAAwD"}
|
|
1
|
+
{"version":3,"file":"config-validation.mjs","names":[],"sources":["../src/errors.ts","../src/config-validation.ts"],"sourcesContent":["export class ConfigValidationError extends Error {\n readonly field: string;\n readonly why: string;\n\n constructor(field: string, why?: string) {\n super(why ?? `Config must have a \"${field}\" field`);\n this.name = 'ConfigValidationError';\n this.field = field;\n this.why = why ?? `Config must have a \"${field}\" field`;\n }\n}\n","import type { PrismaNextConfig } from './config-types';\nimport { ConfigValidationError } from './errors';\n\nfunction throwValidation(field: string, why?: string): never {\n throw new ConfigValidationError(field, why);\n}\n\n/**\n * Validates that the config has the required structure.\n * This is pure validation logic with no file I/O or CLI awareness.\n *\n * @param config - Config object to validate\n * @throws ConfigValidationError if config structure is invalid\n */\nexport function validateConfig(config: unknown): asserts config is PrismaNextConfig {\n if (!config || typeof config !== 'object') {\n throwValidation('object', 'Config must be an object');\n }\n\n const configObj = config as Record<string, unknown>;\n\n if (!configObj['family']) {\n throwValidation('family');\n }\n\n if (!configObj['target']) {\n throwValidation('target');\n }\n\n if (!configObj['adapter']) {\n throwValidation('adapter');\n }\n\n // Validate family descriptor\n const family = configObj['family'] as Record<string, unknown>;\n if (family['kind'] !== 'family') {\n throwValidation('family.kind', 'Config.family must have kind: \"family\"');\n }\n if (typeof family['id'] !== 'string') {\n throwValidation('family.id', 'Config.family must have id: string');\n }\n if (typeof family['familyId'] !== 'string') {\n throwValidation('family.familyId', 'Config.family must have familyId: string');\n }\n if (typeof family['version'] !== 'string') {\n throwValidation('family.version', 'Config.family must have version: string');\n }\n if (!family['emission'] || typeof family['emission'] !== 'object') {\n throwValidation('family.emission', 'Config.family must have emission: EmissionSpi');\n }\n if (typeof family['create'] !== 'function') {\n throwValidation('family.create', 'Config.family must have create: function');\n }\n\n const familyId = family['familyId'] as string;\n\n // Validate target descriptor\n const target = configObj['target'] as Record<string, unknown>;\n if (target['kind'] !== 'target') {\n throwValidation('target.kind', 'Config.target must have kind: \"target\"');\n }\n if (typeof target['id'] !== 'string') {\n throwValidation('target.id', 'Config.target must have id: string');\n }\n if (typeof target['familyId'] !== 'string') {\n throwValidation('target.familyId', 'Config.target must have familyId: string');\n }\n if (typeof target['version'] !== 'string') {\n throwValidation('target.version', 'Config.target must have version: string');\n }\n if (target['familyId'] !== familyId) {\n throwValidation(\n 'target.familyId',\n `Config.target.familyId must match Config.family.familyId (expected: ${familyId}, got: ${target['familyId']})`,\n );\n }\n if (typeof target['targetId'] !== 'string') {\n throwValidation('target.targetId', 'Config.target must have targetId: string');\n }\n if (typeof target['create'] !== 'function') {\n throwValidation('target.create', 'Config.target must have create: function');\n }\n const expectedTargetId = target['targetId'] as string;\n\n // Validate adapter descriptor\n const adapter = configObj['adapter'] as Record<string, unknown>;\n if (adapter['kind'] !== 'adapter') {\n throwValidation('adapter.kind', 'Config.adapter must have kind: \"adapter\"');\n }\n if (typeof adapter['id'] !== 'string') {\n throwValidation('adapter.id', 'Config.adapter must have id: string');\n }\n if (typeof adapter['familyId'] !== 'string') {\n throwValidation('adapter.familyId', 'Config.adapter must have familyId: string');\n }\n if (typeof adapter['version'] !== 'string') {\n throwValidation('adapter.version', 'Config.adapter must have version: string');\n }\n if (adapter['familyId'] !== familyId) {\n throwValidation(\n 'adapter.familyId',\n `Config.adapter.familyId must match Config.family.familyId (expected: ${familyId}, got: ${adapter['familyId']})`,\n );\n }\n if (typeof adapter['targetId'] !== 'string') {\n throwValidation('adapter.targetId', 'Config.adapter must have targetId: string');\n }\n if (adapter['targetId'] !== expectedTargetId) {\n throwValidation(\n 'adapter.targetId',\n `Config.adapter.targetId must match Config.target.targetId (expected: ${expectedTargetId}, got: ${adapter['targetId']})`,\n );\n }\n if (typeof adapter['create'] !== 'function') {\n throwValidation('adapter.create', 'Config.adapter must have create: function');\n }\n\n if (configObj['extensions'] !== undefined) {\n throwValidation('extensions', 'Config.extensions is not supported; use Config.extensionPacks');\n }\n\n // Validate extensionPacks array if present\n if (configObj['extensionPacks'] !== undefined) {\n if (!Array.isArray(configObj['extensionPacks'])) {\n throwValidation('extensionPacks', 'Config.extensionPacks must be an array');\n }\n for (const ext of configObj['extensionPacks']) {\n if (!ext || typeof ext !== 'object') {\n throwValidation(\n 'extensionPacks[]',\n 'Config.extensionPacks must contain ControlExtensionDescriptor objects',\n );\n }\n const extObj = ext as Record<string, unknown>;\n if (extObj['kind'] !== 'extension') {\n throwValidation(\n 'extensionPacks[].kind',\n 'Config.extensionPacks items must have kind: \"extension\"',\n );\n }\n if (typeof extObj['id'] !== 'string') {\n throwValidation('extensionPacks[].id', 'Config.extensionPacks items must have id: string');\n }\n if (typeof extObj['familyId'] !== 'string') {\n throwValidation(\n 'extensionPacks[].familyId',\n 'Config.extensionPacks items must have familyId: string',\n );\n }\n if (typeof extObj['version'] !== 'string') {\n throwValidation(\n 'extensionPacks[].version',\n 'Config.extensionPacks items must have version: string',\n );\n }\n if (extObj['familyId'] !== familyId) {\n throwValidation(\n 'extensionPacks[].familyId',\n `Config.extensionPacks[].familyId must match Config.family.familyId (expected: ${familyId}, got: ${extObj['familyId']})`,\n );\n }\n if (typeof extObj['targetId'] !== 'string') {\n throwValidation(\n 'extensionPacks[].targetId',\n 'Config.extensionPacks items must have targetId: string',\n );\n }\n if (extObj['targetId'] !== expectedTargetId) {\n throwValidation(\n 'extensionPacks[].targetId',\n `Config.extensionPacks[].targetId must match Config.target.targetId (expected: ${expectedTargetId}, got: ${extObj['targetId']})`,\n );\n }\n if (typeof extObj['create'] !== 'function') {\n throwValidation(\n 'extensionPacks[].create',\n 'Config.extensionPacks items must have create: function',\n );\n }\n }\n }\n\n // Validate driver descriptor if present\n if (configObj['driver'] !== undefined) {\n const driver = configObj['driver'] as Record<string, unknown>;\n if (driver['kind'] !== 'driver') {\n throwValidation('driver.kind', 'Config.driver must have kind: \"driver\"');\n }\n if (typeof driver['id'] !== 'string') {\n throwValidation('driver.id', 'Config.driver must have id: string');\n }\n if (typeof driver['version'] !== 'string') {\n throwValidation('driver.version', 'Config.driver must have version: string');\n }\n if (typeof driver['familyId'] !== 'string') {\n throwValidation('driver.familyId', 'Config.driver must have familyId: string');\n }\n if (driver['familyId'] !== familyId) {\n throwValidation(\n 'driver.familyId',\n `Config.driver.familyId must match Config.family.familyId (expected: ${familyId}, got: ${driver['familyId']})`,\n );\n }\n if (typeof driver['targetId'] !== 'string') {\n throwValidation('driver.targetId', 'Config.driver must have targetId: string');\n }\n if (driver['targetId'] !== expectedTargetId) {\n throwValidation(\n 'driver.targetId',\n `Config.driver.targetId must match Config.target.targetId (expected: ${expectedTargetId}, got: ${driver['targetId']})`,\n );\n }\n if (typeof driver['create'] !== 'function') {\n throwValidation('driver.create', 'Config.driver must have create: function');\n }\n }\n\n // Validate contract config if present (structure validation - defineConfig() handles normalization)\n if (configObj['contract'] !== undefined) {\n const contract = configObj['contract'] as Record<string, unknown>;\n if (!contract || typeof contract !== 'object') {\n throwValidation('contract', 'Config.contract must be an object');\n }\n if (!Object.hasOwn(contract, 'source')) {\n throwValidation(\n 'contract.source',\n 'Config.contract.source is required when contract is provided',\n );\n }\n\n if (typeof contract['source'] !== 'function') {\n throwValidation('contract.source', 'Config.contract.source must be a provider function');\n }\n\n if (contract['output'] !== undefined && typeof contract['output'] !== 'string') {\n throwValidation('contract.output', 'Config.contract.output must be a string when provided');\n }\n }\n}\n"],"mappings":";AAAA,IAAa,wBAAb,cAA2C,MAAM;CAC/C,AAAS;CACT,AAAS;CAET,YAAY,OAAe,KAAc;AACvC,QAAM,OAAO,uBAAuB,MAAM,SAAS;AACnD,OAAK,OAAO;AACZ,OAAK,QAAQ;AACb,OAAK,MAAM,OAAO,uBAAuB,MAAM;;;;;;ACLnD,SAAS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
+
"version": "0.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"description": "Prisma Next config authoring types and validation",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"arktype": "^2.1.26",
|
|
9
|
-
"@prisma-next/contract": "0.3.0
|
|
10
|
-
"@prisma-next/
|
|
9
|
+
"@prisma-next/contract": "0.3.0",
|
|
10
|
+
"@prisma-next/framework-components": "0.3.0",
|
|
11
|
+
"@prisma-next/utils": "0.3.0"
|
|
11
12
|
},
|
|
12
13
|
"devDependencies": {
|
|
13
14
|
"tsdown": "0.18.4",
|
|
@@ -26,13 +27,12 @@
|
|
|
26
27
|
"exports": {
|
|
27
28
|
"./config-types": "./dist/config-types.mjs",
|
|
28
29
|
"./config-validation": "./dist/config-validation.mjs",
|
|
29
|
-
"./types": "./dist/types.mjs",
|
|
30
30
|
"./package.json": "./package.json"
|
|
31
31
|
},
|
|
32
32
|
"repository": {
|
|
33
33
|
"type": "git",
|
|
34
34
|
"url": "https://github.com/prisma/prisma-next.git",
|
|
35
|
-
"directory": "packages/1-framework/1-core/
|
|
35
|
+
"directory": "packages/1-framework/1-core/config"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"build": "tsdown",
|
package/src/config-types.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { type } from 'arktype';
|
|
2
|
-
import type { ContractSourceProvider } from './contract-source-types';
|
|
3
1
|
import type {
|
|
4
2
|
ControlAdapterDescriptor,
|
|
5
3
|
ControlDriverDescriptor,
|
|
@@ -7,7 +5,9 @@ import type {
|
|
|
7
5
|
ControlExtensionDescriptor,
|
|
8
6
|
ControlFamilyDescriptor,
|
|
9
7
|
ControlTargetDescriptor,
|
|
10
|
-
} from '
|
|
8
|
+
} from '@prisma-next/framework-components/control';
|
|
9
|
+
import { type } from 'arktype';
|
|
10
|
+
import type { ContractSourceProvider } from './contract-source-types';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Type alias for CLI driver instances.
|
|
@@ -21,7 +21,7 @@ export type CliDriver = ControlDriverInstance<string, string>;
|
|
|
21
21
|
export interface ContractConfig {
|
|
22
22
|
/**
|
|
23
23
|
* Contract source provider. The provider is always async and must return
|
|
24
|
-
* a Result containing either
|
|
24
|
+
* a Result containing either a Contract or structured diagnostics.
|
|
25
25
|
*/
|
|
26
26
|
readonly source: ContractSourceProvider;
|
|
27
27
|
/**
|
package/src/config-validation.ts
CHANGED
|
@@ -45,8 +45,8 @@ export function validateConfig(config: unknown): asserts config is PrismaNextCon
|
|
|
45
45
|
if (typeof family['version'] !== 'string') {
|
|
46
46
|
throwValidation('family.version', 'Config.family must have version: string');
|
|
47
47
|
}
|
|
48
|
-
if (!family['
|
|
49
|
-
throwValidation('family.
|
|
48
|
+
if (!family['emission'] || typeof family['emission'] !== 'object') {
|
|
49
|
+
throwValidation('family.emission', 'Config.family must have emission: EmissionSpi');
|
|
50
50
|
}
|
|
51
51
|
if (typeof family['create'] !== 'function') {
|
|
52
52
|
throwValidation('family.create', 'Config.family must have create: function');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Contract } from '@prisma-next/contract/types';
|
|
2
2
|
import type { Result } from '@prisma-next/utils/result';
|
|
3
3
|
|
|
4
4
|
export interface ContractSourceDiagnosticPosition {
|
|
@@ -17,6 +17,12 @@ export interface ContractSourceDiagnostic {
|
|
|
17
17
|
readonly message: string;
|
|
18
18
|
readonly sourceId?: string;
|
|
19
19
|
readonly span?: ContractSourceDiagnosticSpan;
|
|
20
|
+
/**
|
|
21
|
+
* Optional structured payload for machine-readable consumers (agents,
|
|
22
|
+
* IDE extensions, CLI auto-fix). Human-readable prose lives in `message`;
|
|
23
|
+
* `data` carries the extracted facts (e.g. `{ namespace: 'pgvector' }`).
|
|
24
|
+
*/
|
|
25
|
+
readonly data?: Readonly<Record<string, unknown>>;
|
|
20
26
|
}
|
|
21
27
|
|
|
22
28
|
export interface ContractSourceDiagnostics {
|
|
@@ -31,4 +37,4 @@ export interface ContractSourceContext {
|
|
|
31
37
|
|
|
32
38
|
export type ContractSourceProvider = (
|
|
33
39
|
context: ContractSourceContext,
|
|
34
|
-
) => Promise<Result<
|
|
40
|
+
) => Promise<Result<Contract, ContractSourceDiagnostics>>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config-types-JXY6wmXW.d.mts","names":[],"sources":["../src/contract-source-types.ts","../src/config-types.ts"],"sourcesContent":[],"mappings":";;;;;UAGiB,gCAAA;;;EAAA,SAAA,MAAA,EAAA,MAAA;AAMjB;AAKiB,UALA,4BAAA,CASC;EAGD,SAAA,KAAA,EAXC,gCAae;EAIhB,SAAA,GAAA,EAhBD,gCAgBsB;AAItC;AACW,UAlBM,wBAAA,CAkBN;EACS,SAAA,IAAA,EAAA,MAAA;EAAY,SAAA,OAAA,EAAA,MAAA;EAAnB,SAAA,QAAA,CAAA,EAAA,MAAA;EAAR,SAAA,IAAA,CAAA,EAfa,4BAeb;;UAZY,yBAAA;;iCAEgB;ECHhB,SAAA,IAAA,CAAA,EDIC,MCJa,CAAA,MAKZ,EAAA,OAAA,CAAA;AAgBnB;AAK2C,UDnB1B,qBAAA,CCmB0B;EAAxB,SAAA,sBAAA,EAAA,SAAA,MAAA,EAAA;;AACmC,KDhB1C,sBAAA,GCgB0C,CAAA,OAAA,EDf3C,qBCe2C,EAAA,GDdjD,OCciD,CDdzC,MCcyC,CDdlC,UCckC,EDdtB,yBCcsB,CAAA,CAAA;;;ADjCtD;AAOA;AAMA;AAIY,UCXK,cAAA,CDWiB;EACvB;;;;EACN,SAAA,MAAA,ECRc,sBDQd;EAAO;;;;ECbK,SAAA,MAAA,CAAA,EAAc,MAAA;AAqB/B;;;;;;;;;AAQgE,UAR/C,gBAQ+C,CAAA,kBAAA,MAAA,GAAA,MAAA,EAAA,kBAAA,MAAA,GAAA,MAAA,EAAA,cAAA,OAAA,CAAA,CAAA;EAAW,SAAA,MAAA,EAHxD,uBAGwD,CAHhC,SAGgC,CAAA;EAAtC,SAAA,MAAA,EAFlB,uBAEkB,CAFM,SAEN,EAFiB,SAEjB,CAAA;EAQjC,SAAA,OAAA,EATgB,wBAShB,CATyC,SASzC,EAToD,SASpD,CAAA;EACA,SAAA,cAAA,CAAA,EAAA,SATiC,0BASjC,CAT4D,SAS5D,EATuE,SASvE,CAAA,EAAA;EACsB;;;;;;EAmBJ,SAAA,MAAA,CAAA,EAtBF,uBAsBE,CArBlB,SAqBkB,EApBlB,SAoBkB,EAnBlB,qBAmBkB,CAnBI,SAmBJ,EAnBe,SAmBf,CAAA,EAlBlB,WAkBkB,CAAA;EAAc;AAkDpC;;;EACU,SAAA,EAAA,CAAA,EAAA;IACU;;;;;0BA1DM;;;;;;sBAMJ;;;;;;;;;;;;;;;;;;;;iBAkDN,2FACN,iBAAiB,WAAW,aACnC,iBAAiB,WAAW"}
|
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
import { ContractIR } from "@prisma-next/contract/ir";
|
|
2
|
-
import { AdapterDescriptor, AdapterInstance, DriverDescriptor, DriverInstance, ExtensionDescriptor, ExtensionInstance, FamilyDescriptor, FamilyInstance, TargetBoundComponentDescriptor, TargetDescriptor, TargetInstance } from "@prisma-next/contract/framework-components";
|
|
3
|
-
import { ContractMarkerRecord, TargetFamilyHook } from "@prisma-next/contract/types";
|
|
4
|
-
|
|
5
|
-
//#region src/types.d.ts
|
|
6
|
-
type SchemaNodeKind = 'root' | 'namespace' | 'collection' | 'entity' | 'field' | 'index' | 'dependency';
|
|
7
|
-
interface SchemaTreeNode {
|
|
8
|
-
readonly kind: SchemaNodeKind;
|
|
9
|
-
readonly id: string;
|
|
10
|
-
readonly label: string;
|
|
11
|
-
readonly meta?: Record<string, unknown>;
|
|
12
|
-
readonly children?: readonly SchemaTreeNode[];
|
|
13
|
-
}
|
|
14
|
-
interface CoreSchemaView {
|
|
15
|
-
readonly root: SchemaTreeNode;
|
|
16
|
-
}
|
|
17
|
-
interface ControlFamilyInstance<TFamilyId extends string, TSchemaIR = unknown> extends FamilyInstance<TFamilyId> {
|
|
18
|
-
validateContractIR(contractJson: unknown): ContractIR;
|
|
19
|
-
verify(options: {
|
|
20
|
-
readonly driver: ControlDriverInstance<TFamilyId, string>;
|
|
21
|
-
readonly contractIR: unknown;
|
|
22
|
-
readonly expectedTargetId: string;
|
|
23
|
-
readonly contractPath: string;
|
|
24
|
-
readonly configPath?: string;
|
|
25
|
-
}): Promise<VerifyDatabaseResult>;
|
|
26
|
-
schemaVerify(options: {
|
|
27
|
-
readonly driver: ControlDriverInstance<TFamilyId, string>;
|
|
28
|
-
readonly contractIR: unknown;
|
|
29
|
-
readonly strict: boolean;
|
|
30
|
-
readonly contractPath: string;
|
|
31
|
-
readonly configPath?: string;
|
|
32
|
-
readonly frameworkComponents: ReadonlyArray<TargetBoundComponentDescriptor<TFamilyId, string>>;
|
|
33
|
-
}): Promise<VerifyDatabaseSchemaResult>;
|
|
34
|
-
sign(options: {
|
|
35
|
-
readonly driver: ControlDriverInstance<TFamilyId, string>;
|
|
36
|
-
readonly contractIR: unknown;
|
|
37
|
-
readonly contractPath: string;
|
|
38
|
-
readonly configPath?: string;
|
|
39
|
-
}): Promise<SignDatabaseResult>;
|
|
40
|
-
readMarker(options: {
|
|
41
|
-
readonly driver: ControlDriverInstance<TFamilyId, string>;
|
|
42
|
-
}): Promise<ContractMarkerRecord | null>;
|
|
43
|
-
introspect(options: {
|
|
44
|
-
readonly driver: ControlDriverInstance<TFamilyId, string>;
|
|
45
|
-
readonly contractIR?: unknown;
|
|
46
|
-
}): Promise<TSchemaIR>;
|
|
47
|
-
toSchemaView?(schema: TSchemaIR): CoreSchemaView;
|
|
48
|
-
emitContract(options: {
|
|
49
|
-
readonly contractIR: unknown;
|
|
50
|
-
}): Promise<EmitContractResult>;
|
|
51
|
-
}
|
|
52
|
-
interface ControlTargetInstance<TFamilyId extends string, TTargetId extends string> extends TargetInstance<TFamilyId, TTargetId> {}
|
|
53
|
-
interface ControlAdapterInstance<TFamilyId extends string, TTargetId extends string> extends AdapterInstance<TFamilyId, TTargetId> {}
|
|
54
|
-
interface ControlDriverInstance<TFamilyId extends string, TTargetId extends string> extends DriverInstance<TFamilyId, TTargetId> {
|
|
55
|
-
query<Row = Record<string, unknown>>(sql: string, params?: readonly unknown[]): Promise<{
|
|
56
|
-
readonly rows: Row[];
|
|
57
|
-
}>;
|
|
58
|
-
close(): Promise<void>;
|
|
59
|
-
}
|
|
60
|
-
interface ControlExtensionInstance<TFamilyId extends string, TTargetId extends string> extends ExtensionInstance<TFamilyId, TTargetId> {}
|
|
61
|
-
interface ControlPlaneStack<TFamilyId extends string, TTargetId extends string> {
|
|
62
|
-
readonly target: ControlTargetDescriptor<TFamilyId, TTargetId>;
|
|
63
|
-
readonly adapter: ControlAdapterDescriptor<TFamilyId, TTargetId>;
|
|
64
|
-
readonly driver: ControlDriverDescriptor<TFamilyId, TTargetId> | undefined;
|
|
65
|
-
readonly extensionPacks: readonly ControlExtensionDescriptor<TFamilyId, TTargetId>[];
|
|
66
|
-
}
|
|
67
|
-
interface ControlFamilyDescriptor<TFamilyId extends string, TFamilyInstance extends ControlFamilyInstance<TFamilyId> = ControlFamilyInstance<TFamilyId>> extends FamilyDescriptor<TFamilyId> {
|
|
68
|
-
readonly hook: TargetFamilyHook;
|
|
69
|
-
create<TTargetId extends string>(stack: ControlPlaneStack<TFamilyId, TTargetId>): TFamilyInstance;
|
|
70
|
-
}
|
|
71
|
-
interface ControlTargetDescriptor<TFamilyId extends string, TTargetId extends string, TTargetInstance extends ControlTargetInstance<TFamilyId, TTargetId> = ControlTargetInstance<TFamilyId, TTargetId>> extends TargetDescriptor<TFamilyId, TTargetId> {
|
|
72
|
-
create(): TTargetInstance;
|
|
73
|
-
}
|
|
74
|
-
interface ControlAdapterDescriptor<TFamilyId extends string, TTargetId extends string, TAdapterInstance extends ControlAdapterInstance<TFamilyId, TTargetId> = ControlAdapterInstance<TFamilyId, TTargetId>> extends AdapterDescriptor<TFamilyId, TTargetId> {
|
|
75
|
-
create(): TAdapterInstance;
|
|
76
|
-
}
|
|
77
|
-
interface ControlDriverDescriptor<TFamilyId extends string, TTargetId extends string, TDriverInstance extends ControlDriverInstance<TFamilyId, TTargetId> = ControlDriverInstance<TFamilyId, TTargetId>, TConnection = string> extends DriverDescriptor<TFamilyId, TTargetId> {
|
|
78
|
-
create(connection: TConnection): Promise<TDriverInstance>;
|
|
79
|
-
}
|
|
80
|
-
interface ControlExtensionDescriptor<TFamilyId extends string, TTargetId extends string, TExtensionInstance extends ControlExtensionInstance<TFamilyId, TTargetId> = ControlExtensionInstance<TFamilyId, TTargetId>> extends ExtensionDescriptor<TFamilyId, TTargetId> {
|
|
81
|
-
create(): TExtensionInstance;
|
|
82
|
-
}
|
|
83
|
-
interface VerifyDatabaseResult {
|
|
84
|
-
readonly ok: boolean;
|
|
85
|
-
readonly code?: string;
|
|
86
|
-
readonly summary: string;
|
|
87
|
-
readonly contract: {
|
|
88
|
-
readonly storageHash: string;
|
|
89
|
-
readonly profileHash?: string;
|
|
90
|
-
};
|
|
91
|
-
readonly marker?: {
|
|
92
|
-
readonly storageHash?: string;
|
|
93
|
-
readonly profileHash?: string;
|
|
94
|
-
};
|
|
95
|
-
readonly target: {
|
|
96
|
-
readonly expected: string;
|
|
97
|
-
readonly actual?: string;
|
|
98
|
-
};
|
|
99
|
-
readonly missingCodecs?: readonly string[];
|
|
100
|
-
readonly codecCoverageSkipped?: boolean;
|
|
101
|
-
readonly meta?: {
|
|
102
|
-
readonly configPath?: string;
|
|
103
|
-
readonly contractPath: string;
|
|
104
|
-
};
|
|
105
|
-
readonly timings: {
|
|
106
|
-
readonly total: number;
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
interface SchemaIssue {
|
|
110
|
-
readonly kind: 'missing_table' | 'missing_column' | 'extra_table' | 'extra_column' | 'extra_primary_key' | 'extra_foreign_key' | 'extra_unique_constraint' | 'extra_index' | 'type_mismatch' | 'type_missing' | 'type_values_mismatch' | 'nullability_mismatch' | 'primary_key_mismatch' | 'foreign_key_mismatch' | 'unique_constraint_mismatch' | 'index_mismatch' | 'dependency_missing' | 'default_missing' | 'default_mismatch';
|
|
111
|
-
readonly table?: string;
|
|
112
|
-
readonly column?: string;
|
|
113
|
-
readonly indexOrConstraint?: string;
|
|
114
|
-
readonly typeName?: string;
|
|
115
|
-
readonly expected?: string;
|
|
116
|
-
readonly actual?: string;
|
|
117
|
-
readonly message: string;
|
|
118
|
-
}
|
|
119
|
-
interface SchemaVerificationNode {
|
|
120
|
-
readonly status: 'pass' | 'warn' | 'fail';
|
|
121
|
-
readonly kind: string;
|
|
122
|
-
readonly name: string;
|
|
123
|
-
readonly contractPath: string;
|
|
124
|
-
readonly code: string;
|
|
125
|
-
readonly message: string;
|
|
126
|
-
readonly expected: unknown;
|
|
127
|
-
readonly actual: unknown;
|
|
128
|
-
readonly children: readonly SchemaVerificationNode[];
|
|
129
|
-
}
|
|
130
|
-
interface VerifyDatabaseSchemaResult {
|
|
131
|
-
readonly ok: boolean;
|
|
132
|
-
readonly code?: string;
|
|
133
|
-
readonly summary: string;
|
|
134
|
-
readonly contract: {
|
|
135
|
-
readonly storageHash: string;
|
|
136
|
-
readonly profileHash?: string;
|
|
137
|
-
};
|
|
138
|
-
readonly target: {
|
|
139
|
-
readonly expected: string;
|
|
140
|
-
readonly actual?: string;
|
|
141
|
-
};
|
|
142
|
-
readonly schema: {
|
|
143
|
-
readonly issues: readonly SchemaIssue[];
|
|
144
|
-
readonly root: SchemaVerificationNode;
|
|
145
|
-
readonly counts: {
|
|
146
|
-
readonly pass: number;
|
|
147
|
-
readonly warn: number;
|
|
148
|
-
readonly fail: number;
|
|
149
|
-
readonly totalNodes: number;
|
|
150
|
-
};
|
|
151
|
-
};
|
|
152
|
-
readonly meta?: {
|
|
153
|
-
readonly configPath?: string;
|
|
154
|
-
readonly contractPath?: string;
|
|
155
|
-
readonly strict: boolean;
|
|
156
|
-
};
|
|
157
|
-
readonly timings: {
|
|
158
|
-
readonly total: number;
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
interface EmitContractResult {
|
|
162
|
-
readonly contractJson: string;
|
|
163
|
-
readonly contractDts: string;
|
|
164
|
-
readonly storageHash: string;
|
|
165
|
-
readonly executionHash?: string;
|
|
166
|
-
readonly profileHash: string;
|
|
167
|
-
}
|
|
168
|
-
interface SignDatabaseResult {
|
|
169
|
-
readonly ok: boolean;
|
|
170
|
-
readonly summary: string;
|
|
171
|
-
readonly contract: {
|
|
172
|
-
readonly storageHash: string;
|
|
173
|
-
readonly profileHash?: string;
|
|
174
|
-
};
|
|
175
|
-
readonly target: {
|
|
176
|
-
readonly expected: string;
|
|
177
|
-
readonly actual?: string;
|
|
178
|
-
};
|
|
179
|
-
readonly marker: {
|
|
180
|
-
readonly created: boolean;
|
|
181
|
-
readonly updated: boolean;
|
|
182
|
-
readonly previous?: {
|
|
183
|
-
readonly storageHash?: string;
|
|
184
|
-
readonly profileHash?: string;
|
|
185
|
-
};
|
|
186
|
-
};
|
|
187
|
-
readonly meta?: {
|
|
188
|
-
readonly configPath?: string;
|
|
189
|
-
readonly contractPath: string;
|
|
190
|
-
};
|
|
191
|
-
readonly timings: {
|
|
192
|
-
readonly total: number;
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
//#endregion
|
|
196
|
-
export { ControlExtensionDescriptor as a, ControlFamilyInstance as c, ControlTargetInstance as d, ControlDriverInstance as i, ControlPlaneStack as l, ControlAdapterInstance as n, ControlExtensionInstance as o, ControlDriverDescriptor as r, ControlFamilyDescriptor as s, ControlAdapterDescriptor as t, ControlTargetDescriptor as u };
|
|
197
|
-
//# sourceMappingURL=types-kA81phZc.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types-kA81phZc.d.mts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";;;;;KAgBY,cAAA;UASK,cAAA;EATL,SAAA,IAAA,EAUK,c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AAA,MAAA;EAC7B,CAAA;EADF,SAAA,MAAA,EAAA;IAAmB,SAAA,QAAA,EAAA,MAAA;IAUZ,SAAA,MAAA,CAAA,EAAA,MAAoB;EA2BpB,CAAA;EA8BA,SAAA,MAAA,EAAA;IAYA,SAAA,MAAA,EAAA,SAaa,WAAA,EAAA;IAmBb,SAAA,IAAA,EAlBE,sBAkBgB;IAyBlB,SAAA,MAAA,EAAkB;;;;;;;;;;;;;;;;UAzBlB,kBAAA;;;;;;;UAyBA,kBAAA"}
|
package/dist/types.d.mts
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { a as ControlExtensionDescriptor, c as ControlFamilyInstance, d as ControlTargetInstance, i as ControlDriverInstance, l as ControlPlaneStack, n as ControlAdapterInstance, o as ControlExtensionInstance, r as ControlDriverDescriptor, s as ControlFamilyDescriptor, t as ControlAdapterDescriptor, u as ControlTargetDescriptor } from "./types-kA81phZc.mjs";
|
|
2
|
-
export { type ControlAdapterDescriptor, type ControlAdapterInstance, type ControlDriverDescriptor, type ControlDriverInstance, type ControlExtensionDescriptor, type ControlExtensionInstance, type ControlFamilyDescriptor, type ControlFamilyInstance, type ControlPlaneStack, type ControlTargetDescriptor, type ControlTargetInstance };
|
package/dist/types.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|
package/src/exports/types.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export type {
|
|
2
|
-
ControlAdapterDescriptor,
|
|
3
|
-
ControlAdapterInstance,
|
|
4
|
-
ControlDriverDescriptor,
|
|
5
|
-
ControlDriverInstance,
|
|
6
|
-
ControlExtensionDescriptor,
|
|
7
|
-
ControlExtensionInstance,
|
|
8
|
-
ControlFamilyDescriptor,
|
|
9
|
-
ControlFamilyInstance,
|
|
10
|
-
ControlPlaneStack,
|
|
11
|
-
ControlTargetDescriptor,
|
|
12
|
-
ControlTargetInstance,
|
|
13
|
-
} from '../types';
|
package/src/types.ts
DELETED
|
@@ -1,316 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
AdapterDescriptor,
|
|
3
|
-
AdapterInstance,
|
|
4
|
-
DriverDescriptor,
|
|
5
|
-
DriverInstance,
|
|
6
|
-
ExtensionDescriptor,
|
|
7
|
-
ExtensionInstance,
|
|
8
|
-
FamilyDescriptor,
|
|
9
|
-
FamilyInstance,
|
|
10
|
-
TargetBoundComponentDescriptor,
|
|
11
|
-
TargetDescriptor,
|
|
12
|
-
TargetInstance,
|
|
13
|
-
} from '@prisma-next/contract/framework-components';
|
|
14
|
-
import type { ContractIR } from '@prisma-next/contract/ir';
|
|
15
|
-
import type { ContractMarkerRecord, TargetFamilyHook } from '@prisma-next/contract/types';
|
|
16
|
-
|
|
17
|
-
export type SchemaNodeKind =
|
|
18
|
-
| 'root'
|
|
19
|
-
| 'namespace'
|
|
20
|
-
| 'collection'
|
|
21
|
-
| 'entity'
|
|
22
|
-
| 'field'
|
|
23
|
-
| 'index'
|
|
24
|
-
| 'dependency';
|
|
25
|
-
|
|
26
|
-
export interface SchemaTreeNode {
|
|
27
|
-
readonly kind: SchemaNodeKind;
|
|
28
|
-
readonly id: string;
|
|
29
|
-
readonly label: string;
|
|
30
|
-
readonly meta?: Record<string, unknown>;
|
|
31
|
-
readonly children?: readonly SchemaTreeNode[];
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export interface CoreSchemaView {
|
|
35
|
-
readonly root: SchemaTreeNode;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export interface ControlFamilyInstance<TFamilyId extends string, TSchemaIR = unknown>
|
|
39
|
-
extends FamilyInstance<TFamilyId> {
|
|
40
|
-
validateContractIR(contractJson: unknown): ContractIR;
|
|
41
|
-
|
|
42
|
-
verify(options: {
|
|
43
|
-
readonly driver: ControlDriverInstance<TFamilyId, string>;
|
|
44
|
-
readonly contractIR: unknown;
|
|
45
|
-
readonly expectedTargetId: string;
|
|
46
|
-
readonly contractPath: string;
|
|
47
|
-
readonly configPath?: string;
|
|
48
|
-
}): Promise<VerifyDatabaseResult>;
|
|
49
|
-
|
|
50
|
-
schemaVerify(options: {
|
|
51
|
-
readonly driver: ControlDriverInstance<TFamilyId, string>;
|
|
52
|
-
readonly contractIR: unknown;
|
|
53
|
-
readonly strict: boolean;
|
|
54
|
-
readonly contractPath: string;
|
|
55
|
-
readonly configPath?: string;
|
|
56
|
-
readonly frameworkComponents: ReadonlyArray<TargetBoundComponentDescriptor<TFamilyId, string>>;
|
|
57
|
-
}): Promise<VerifyDatabaseSchemaResult>;
|
|
58
|
-
|
|
59
|
-
sign(options: {
|
|
60
|
-
readonly driver: ControlDriverInstance<TFamilyId, string>;
|
|
61
|
-
readonly contractIR: unknown;
|
|
62
|
-
readonly contractPath: string;
|
|
63
|
-
readonly configPath?: string;
|
|
64
|
-
}): Promise<SignDatabaseResult>;
|
|
65
|
-
|
|
66
|
-
readMarker(options: {
|
|
67
|
-
readonly driver: ControlDriverInstance<TFamilyId, string>;
|
|
68
|
-
}): Promise<ContractMarkerRecord | null>;
|
|
69
|
-
|
|
70
|
-
introspect(options: {
|
|
71
|
-
readonly driver: ControlDriverInstance<TFamilyId, string>;
|
|
72
|
-
readonly contractIR?: unknown;
|
|
73
|
-
}): Promise<TSchemaIR>;
|
|
74
|
-
|
|
75
|
-
toSchemaView?(schema: TSchemaIR): CoreSchemaView;
|
|
76
|
-
|
|
77
|
-
emitContract(options: { readonly contractIR: unknown }): Promise<EmitContractResult>;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export interface ControlTargetInstance<TFamilyId extends string, TTargetId extends string>
|
|
81
|
-
extends TargetInstance<TFamilyId, TTargetId> {}
|
|
82
|
-
|
|
83
|
-
export interface ControlAdapterInstance<TFamilyId extends string, TTargetId extends string>
|
|
84
|
-
extends AdapterInstance<TFamilyId, TTargetId> {}
|
|
85
|
-
|
|
86
|
-
export interface ControlDriverInstance<TFamilyId extends string, TTargetId extends string>
|
|
87
|
-
extends DriverInstance<TFamilyId, TTargetId> {
|
|
88
|
-
query<Row = Record<string, unknown>>(
|
|
89
|
-
sql: string,
|
|
90
|
-
params?: readonly unknown[],
|
|
91
|
-
): Promise<{ readonly rows: Row[] }>;
|
|
92
|
-
close(): Promise<void>;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export interface ControlExtensionInstance<TFamilyId extends string, TTargetId extends string>
|
|
96
|
-
extends ExtensionInstance<TFamilyId, TTargetId> {}
|
|
97
|
-
|
|
98
|
-
export interface ControlPlaneStack<TFamilyId extends string, TTargetId extends string> {
|
|
99
|
-
readonly target: ControlTargetDescriptor<TFamilyId, TTargetId>;
|
|
100
|
-
readonly adapter: ControlAdapterDescriptor<TFamilyId, TTargetId>;
|
|
101
|
-
readonly driver: ControlDriverDescriptor<TFamilyId, TTargetId> | undefined;
|
|
102
|
-
readonly extensionPacks: readonly ControlExtensionDescriptor<TFamilyId, TTargetId>[];
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
export interface ControlFamilyDescriptor<
|
|
106
|
-
TFamilyId extends string,
|
|
107
|
-
TFamilyInstance extends ControlFamilyInstance<TFamilyId> = ControlFamilyInstance<TFamilyId>,
|
|
108
|
-
> extends FamilyDescriptor<TFamilyId> {
|
|
109
|
-
readonly hook: TargetFamilyHook;
|
|
110
|
-
create<TTargetId extends string>(stack: ControlPlaneStack<TFamilyId, TTargetId>): TFamilyInstance;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export interface ControlTargetDescriptor<
|
|
114
|
-
TFamilyId extends string,
|
|
115
|
-
TTargetId extends string,
|
|
116
|
-
TTargetInstance extends ControlTargetInstance<TFamilyId, TTargetId> = ControlTargetInstance<
|
|
117
|
-
TFamilyId,
|
|
118
|
-
TTargetId
|
|
119
|
-
>,
|
|
120
|
-
> extends TargetDescriptor<TFamilyId, TTargetId> {
|
|
121
|
-
create(): TTargetInstance;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
export interface ControlAdapterDescriptor<
|
|
125
|
-
TFamilyId extends string,
|
|
126
|
-
TTargetId extends string,
|
|
127
|
-
TAdapterInstance extends ControlAdapterInstance<TFamilyId, TTargetId> = ControlAdapterInstance<
|
|
128
|
-
TFamilyId,
|
|
129
|
-
TTargetId
|
|
130
|
-
>,
|
|
131
|
-
> extends AdapterDescriptor<TFamilyId, TTargetId> {
|
|
132
|
-
create(): TAdapterInstance;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
export interface ControlDriverDescriptor<
|
|
136
|
-
TFamilyId extends string,
|
|
137
|
-
TTargetId extends string,
|
|
138
|
-
TDriverInstance extends ControlDriverInstance<TFamilyId, TTargetId> = ControlDriverInstance<
|
|
139
|
-
TFamilyId,
|
|
140
|
-
TTargetId
|
|
141
|
-
>,
|
|
142
|
-
TConnection = string,
|
|
143
|
-
> extends DriverDescriptor<TFamilyId, TTargetId> {
|
|
144
|
-
create(connection: TConnection): Promise<TDriverInstance>;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
export interface ControlExtensionDescriptor<
|
|
148
|
-
TFamilyId extends string,
|
|
149
|
-
TTargetId extends string,
|
|
150
|
-
TExtensionInstance extends ControlExtensionInstance<
|
|
151
|
-
TFamilyId,
|
|
152
|
-
TTargetId
|
|
153
|
-
> = ControlExtensionInstance<TFamilyId, TTargetId>,
|
|
154
|
-
> extends ExtensionDescriptor<TFamilyId, TTargetId> {
|
|
155
|
-
create(): TExtensionInstance;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
export interface OperationContext {
|
|
159
|
-
readonly contractPath?: string;
|
|
160
|
-
readonly configPath?: string;
|
|
161
|
-
readonly meta?: Readonly<Record<string, unknown>>;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
export interface VerifyDatabaseResult {
|
|
165
|
-
readonly ok: boolean;
|
|
166
|
-
readonly code?: string;
|
|
167
|
-
readonly summary: string;
|
|
168
|
-
readonly contract: {
|
|
169
|
-
readonly storageHash: string;
|
|
170
|
-
readonly profileHash?: string;
|
|
171
|
-
};
|
|
172
|
-
readonly marker?: {
|
|
173
|
-
readonly storageHash?: string;
|
|
174
|
-
readonly profileHash?: string;
|
|
175
|
-
};
|
|
176
|
-
readonly target: {
|
|
177
|
-
readonly expected: string;
|
|
178
|
-
readonly actual?: string;
|
|
179
|
-
};
|
|
180
|
-
readonly missingCodecs?: readonly string[];
|
|
181
|
-
readonly codecCoverageSkipped?: boolean;
|
|
182
|
-
readonly meta?: {
|
|
183
|
-
readonly configPath?: string;
|
|
184
|
-
readonly contractPath: string;
|
|
185
|
-
};
|
|
186
|
-
readonly timings: {
|
|
187
|
-
readonly total: number;
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
export interface SchemaIssue {
|
|
192
|
-
readonly kind:
|
|
193
|
-
| 'missing_table'
|
|
194
|
-
| 'missing_column'
|
|
195
|
-
| 'extra_table'
|
|
196
|
-
| 'extra_column'
|
|
197
|
-
| 'extra_primary_key'
|
|
198
|
-
| 'extra_foreign_key'
|
|
199
|
-
| 'extra_unique_constraint'
|
|
200
|
-
| 'extra_index'
|
|
201
|
-
| 'type_mismatch'
|
|
202
|
-
| 'type_missing'
|
|
203
|
-
| 'type_values_mismatch'
|
|
204
|
-
| 'nullability_mismatch'
|
|
205
|
-
| 'primary_key_mismatch'
|
|
206
|
-
| 'foreign_key_mismatch'
|
|
207
|
-
| 'unique_constraint_mismatch'
|
|
208
|
-
| 'index_mismatch'
|
|
209
|
-
| 'dependency_missing'
|
|
210
|
-
| 'default_missing'
|
|
211
|
-
| 'default_mismatch';
|
|
212
|
-
readonly table?: string;
|
|
213
|
-
readonly column?: string;
|
|
214
|
-
readonly indexOrConstraint?: string;
|
|
215
|
-
readonly typeName?: string;
|
|
216
|
-
readonly expected?: string;
|
|
217
|
-
readonly actual?: string;
|
|
218
|
-
readonly message: string;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
export interface SchemaVerificationNode {
|
|
222
|
-
readonly status: 'pass' | 'warn' | 'fail';
|
|
223
|
-
readonly kind: string;
|
|
224
|
-
readonly name: string;
|
|
225
|
-
readonly contractPath: string;
|
|
226
|
-
readonly code: string;
|
|
227
|
-
readonly message: string;
|
|
228
|
-
readonly expected: unknown;
|
|
229
|
-
readonly actual: unknown;
|
|
230
|
-
readonly children: readonly SchemaVerificationNode[];
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
export interface VerifyDatabaseSchemaResult {
|
|
234
|
-
readonly ok: boolean;
|
|
235
|
-
readonly code?: string;
|
|
236
|
-
readonly summary: string;
|
|
237
|
-
readonly contract: {
|
|
238
|
-
readonly storageHash: string;
|
|
239
|
-
readonly profileHash?: string;
|
|
240
|
-
};
|
|
241
|
-
readonly target: {
|
|
242
|
-
readonly expected: string;
|
|
243
|
-
readonly actual?: string;
|
|
244
|
-
};
|
|
245
|
-
readonly schema: {
|
|
246
|
-
readonly issues: readonly SchemaIssue[];
|
|
247
|
-
readonly root: SchemaVerificationNode;
|
|
248
|
-
readonly counts: {
|
|
249
|
-
readonly pass: number;
|
|
250
|
-
readonly warn: number;
|
|
251
|
-
readonly fail: number;
|
|
252
|
-
readonly totalNodes: number;
|
|
253
|
-
};
|
|
254
|
-
};
|
|
255
|
-
readonly meta?: {
|
|
256
|
-
readonly configPath?: string;
|
|
257
|
-
readonly contractPath?: string;
|
|
258
|
-
readonly strict: boolean;
|
|
259
|
-
};
|
|
260
|
-
readonly timings: {
|
|
261
|
-
readonly total: number;
|
|
262
|
-
};
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
export interface EmitContractResult {
|
|
266
|
-
readonly contractJson: string;
|
|
267
|
-
readonly contractDts: string;
|
|
268
|
-
readonly storageHash: string;
|
|
269
|
-
readonly executionHash?: string;
|
|
270
|
-
readonly profileHash: string;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
export interface IntrospectSchemaResult<TSchemaIR> {
|
|
274
|
-
readonly ok: true;
|
|
275
|
-
readonly summary: string;
|
|
276
|
-
readonly target: {
|
|
277
|
-
readonly familyId: string;
|
|
278
|
-
readonly id: string;
|
|
279
|
-
};
|
|
280
|
-
readonly schema: TSchemaIR;
|
|
281
|
-
readonly meta?: {
|
|
282
|
-
readonly configPath?: string;
|
|
283
|
-
readonly dbUrl?: string;
|
|
284
|
-
};
|
|
285
|
-
readonly timings: {
|
|
286
|
-
readonly total: number;
|
|
287
|
-
};
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
export interface SignDatabaseResult {
|
|
291
|
-
readonly ok: boolean;
|
|
292
|
-
readonly summary: string;
|
|
293
|
-
readonly contract: {
|
|
294
|
-
readonly storageHash: string;
|
|
295
|
-
readonly profileHash?: string;
|
|
296
|
-
};
|
|
297
|
-
readonly target: {
|
|
298
|
-
readonly expected: string;
|
|
299
|
-
readonly actual?: string;
|
|
300
|
-
};
|
|
301
|
-
readonly marker: {
|
|
302
|
-
readonly created: boolean;
|
|
303
|
-
readonly updated: boolean;
|
|
304
|
-
readonly previous?: {
|
|
305
|
-
readonly storageHash?: string;
|
|
306
|
-
readonly profileHash?: string;
|
|
307
|
-
};
|
|
308
|
-
};
|
|
309
|
-
readonly meta?: {
|
|
310
|
-
readonly configPath?: string;
|
|
311
|
-
readonly contractPath: string;
|
|
312
|
-
};
|
|
313
|
-
readonly timings: {
|
|
314
|
-
readonly total: number;
|
|
315
|
-
};
|
|
316
|
-
}
|