@vibeorm/schema 2.0.0-alpha.2 → 2.0.0-alpha.4

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.
@@ -22,6 +22,8 @@ export type DialectCapabilities = {
22
22
  readonly distinctOn: boolean;
23
23
  /** Partial (predicate) indexes. */
24
24
  readonly partialIndexes: boolean;
25
+ /** Named-constraint conflict targets (`ON CONFLICT ON CONSTRAINT …`). */
26
+ readonly conflictTargetConstraint: boolean;
25
27
  /** DDL participates in transactions (mysql auto-commits DDL). */
26
28
  readonly transactionalDdl: boolean;
27
29
  /** createManyAndReturn support (requires multi-row RETURNING). */
@@ -1 +1 @@
1
- {"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../src/capabilities.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,2DAA2D;AAC3D,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,UAAU,CAAC;AAIvE,MAAM,MAAM,mBAAmB,GAAG;IAChC,iFAAiF;IACjF,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,0DAA0D;IAC1D,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,4DAA4D;IAC5D,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,oEAAoE;IACpE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,4DAA4D;IAC5D,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,0BAA0B;IAC1B,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,mCAAmC;IACnC,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,iEAAiE;IACjE,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;IACnC,kEAAkE;IAClE,QAAQ,CAAC,mBAAmB,EAAE,OAAO,CAAC;IACtC,iDAAiD;IACjD,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,2EAA2E;IAC3E,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,uEAAuE;IACvE,QAAQ,CAAC,eAAe,EAAE,SAAS,cAAc,EAAE,CAAC;CACrD,CAAC"}
1
+ {"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../src/capabilities.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,2DAA2D;AAC3D,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,UAAU,CAAC;AAIvE,MAAM,MAAM,mBAAmB,GAAG;IAChC,iFAAiF;IACjF,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,0DAA0D;IAC1D,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,4DAA4D;IAC5D,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,oEAAoE;IACpE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,4DAA4D;IAC5D,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,0BAA0B;IAC1B,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,mCAAmC;IACnC,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,yEAAyE;IACzE,QAAQ,CAAC,wBAAwB,EAAE,OAAO,CAAC;IAC3C,iEAAiE;IACjE,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;IACnC,kEAAkE;IAClE,QAAQ,CAAC,mBAAmB,EAAE,OAAO,CAAC;IACtC,iDAAiD;IACjD,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,2EAA2E;IAC3E,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,uEAAuE;IACvE,QAAQ,CAAC,eAAe,EAAE,SAAS,cAAc,EAAE,CAAC;CACrD,CAAC"}
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  * and the VibeError contract for VibeORM v2.
4
4
  */
5
5
  export { DIALECTS, isEnumType, providerToDialect } from "./ir.ts";
6
- export type { CascadeAction, DatasourceIR, DefaultValueIR, Dialect, EnumIR, ExtensionDeclIR, FieldIR, FieldType, IndexFieldIR, IndexIR, IndexKind, ModelIR, Provider, RelationIR, RelationType, ScalarType, SchemaIR, } from "./ir.ts";
6
+ export type { CascadeAction, DatasourceIR, DefaultValueIR, Dialect, EnumIR, ExtensionDeclIR, FieldIR, FieldType, IndexFieldIR, CheckIR, IndexIR, IndexKind, ModelIR, Provider, RelationIR, RelationType, ScalarType, SchemaIR, } from "./ir.ts";
7
7
  export type { DialectCapabilities, FullTextEngine } from "./capabilities.ts";
8
8
  export { VIBE_ERROR_CODES, VibeError, internalError, unsupportedCapability } from "./errors.ts";
9
9
  export type { VibeErrorCode } from "./errors.ts";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAClE,YAAY,EACV,aAAa,EACb,YAAY,EACZ,cAAc,EACd,OAAO,EACP,MAAM,EACN,eAAe,EACf,OAAO,EACP,SAAS,EACT,YAAY,EACZ,OAAO,EACP,SAAS,EACT,OAAO,EACP,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,UAAU,EACV,QAAQ,GACT,MAAM,SAAS,CAAC;AAIjB,YAAY,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAI7E,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAChG,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAIjD,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,eAAe,CAAC;AAIvB,OAAO,EACL,wBAAwB,EACxB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
325
  for (const model of schema.models) {
326
326
  validateModel({ model, modelByName, enumNames, issues });
327
327
  }
328
+ const provider = schema.datasource.provider;
329
+ for (const model of schema.models) {
330
+ for (const index of model.indexes) {
331
+ if (index.where !== undefined && provider === "mysql") {
332
+ issues.push({
333
+ rule: "partial-index-unsupported",
334
+ message: `Partial index (where) on "${model.name}" \u2014 mysql has no partial indexes; predicates are postgres/pglite/sqlite only`,
335
+ model: model.name
336
+ });
337
+ }
338
+ if (index.nullsNotDistinct === true) {
339
+ if (index.kind !== "unique") {
340
+ issues.push({
341
+ rule: "nulls-not-distinct-non-unique",
342
+ message: `nullsNotDistinct on a non-unique index of "${model.name}" \u2014 the flag changes UNIQUE null semantics and means nothing elsewhere`,
343
+ model: model.name
344
+ });
345
+ }
346
+ if (provider === "sqlite" || provider === "mysql") {
347
+ issues.push({
348
+ rule: "nulls-not-distinct-unsupported",
349
+ message: `UNIQUE NULLS NOT DISTINCT on "${model.name}" \u2014 ${provider} treats NULLs as distinct and has no switch; the flag is postgres/pglite (15+) only`,
350
+ model: model.name
351
+ });
352
+ }
353
+ }
354
+ }
355
+ }
328
356
  return issues;
329
357
  }
330
358
  function validateModel(params) {
@@ -444,6 +472,24 @@ function validateModel(params) {
444
472
  }
445
473
  }
446
474
  }
475
+ const checkNames = new Set;
476
+ for (const check of model.checks ?? []) {
477
+ if (check.name.trim() === "" || check.expression.trim() === "") {
478
+ issues.push({
479
+ rule: "invalid-check",
480
+ message: `CHECK on "${model.name}" needs a non-empty name and expression`,
481
+ model: model.name
482
+ });
483
+ }
484
+ if (checkNames.has(check.name)) {
485
+ issues.push({
486
+ rule: "duplicate-check",
487
+ message: `Duplicate CHECK name "${check.name}" on "${model.name}" \u2014 names key the migration diff`,
488
+ model: model.name
489
+ });
490
+ }
491
+ checkNames.add(check.name);
492
+ }
447
493
  for (const index of model.indexes) {
448
494
  for (const indexField of index.fields) {
449
495
  if (!fieldNames.has(indexField.name)) {
@@ -507,4 +553,4 @@ export {
507
553
  DIALECTS
508
554
  };
509
555
 
510
- //# debugId=523507298B0E768264756E2164756E21
556
+ //# debugId=4CBFDBE2B30F1BCC64756E2164756E21
package/dist/index.js.map CHANGED
@@ -2,15 +2,15 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/ir.ts", "../src/errors.ts", "../src/reserved.ts", "../src/extension.ts", "../src/computed.ts", "../src/validate.ts", "../src/m2m.ts"],
4
4
  "sourcesContent": [
5
- "/**\n * Canonical Schema IR for VibeORM v2.\n *\n * Both schema sources (.prisma via @vibeorm/parser, TS DSL via @vibeorm/dsl)\n * compile to this IR. Everything downstream (generator, runtime, migrate,\n * extensions) consumes ONLY this — nothing else ever parses schema text.\n */\n\n// ─── Dialects & Providers ─────────────────────────────────────────\n\n/** Datasource providers a schema may declare. */\nexport type Provider = \"postgresql\" | \"pglite\" | \"sqlite\" | \"mysql\";\n\n/**\n * SQL dialects. PGlite speaks the postgres dialect — it differs only at the\n * adapter level (single connection, bundled extension set).\n */\nexport type Dialect = \"postgres\" | \"sqlite\" | \"mysql\";\n\n/** All dialects, for matrix-style iteration in tests and tooling. */\nexport const DIALECTS: readonly Dialect[] = [\"postgres\", \"sqlite\", \"mysql\"];\n\n/** Map a datasource provider to the SQL dialect it speaks. */\nexport function providerToDialect(params: { provider: Provider }): Dialect {\n const { provider } = params;\n switch (provider) {\n case \"postgresql\":\n case \"pglite\":\n return \"postgres\";\n case \"sqlite\":\n return \"sqlite\";\n case \"mysql\":\n return \"mysql\";\n }\n}\n\n// ─── Scalar & field types ─────────────────────────────────────────\n\n/** Prisma-aligned scalar types. */\nexport type ScalarType =\n | \"String\"\n | \"Boolean\"\n | \"Int\"\n | \"BigInt\"\n | \"Float\"\n | \"Decimal\"\n | \"DateTime\"\n | \"Json\"\n | \"Bytes\";\n\n/** A field's type: a scalar, or a reference to a schema enum by name. */\nexport type FieldType = ScalarType | { readonly enum: string };\n\n/** Narrow a FieldType to an enum reference. */\nexport function isEnumType(fieldType: FieldType): fieldType is { readonly enum: string } {\n return typeof fieldType === \"object\" && \"enum\" in fieldType;\n}\n\n/** Default value declarations, normalized across schema sources. */\nexport type DefaultValueIR =\n | { readonly kind: \"autoincrement\" }\n | { readonly kind: \"now\" }\n | { readonly kind: \"uuid\" }\n | { readonly kind: \"cuid\" }\n | { readonly kind: \"nanoid\" }\n | { readonly kind: \"ulid\" }\n | { readonly kind: \"literal\"; readonly value: string | number | boolean }\n | { readonly kind: \"enumValue\"; readonly value: string }\n | { readonly kind: \"dbgenerated\"; readonly sql: string };\n\n/** A scalar/enum column on a model. */\nexport type FieldIR = {\n readonly name: string;\n /** Column name in the database when it differs from `name` (@map). */\n readonly dbName?: string;\n readonly type: FieldType;\n readonly isList: boolean;\n readonly isOptional: boolean;\n readonly isId: boolean;\n readonly isUnique: boolean;\n readonly isUpdatedAt: boolean;\n readonly default?: DefaultValueIR;\n /** Dialect-native type override (@db.*), verbatim (e.g. \"VarChar(191)\"). */\n readonly nativeType?: string;\n /**\n * Column declared as Prisma `Unsupported(\"...\")` / `dsl.unsupported(\"...\")`.\n * Kept in the IR for schema fidelity (convert, migrate DDL) but excluded from\n * the queryable surface: never projected, never writable, no generated types.\n * `nativeType` carries the raw database type; `type` is a nominal \"String\".\n */\n readonly isUnsupported?: true;\n readonly documentation?: string;\n};\n\n// ─── Relations ────────────────────────────────────────────────────\n\nexport type RelationType = \"oneToOne\" | \"oneToMany\" | \"manyToOne\" | \"manyToMany\";\n\nexport type CascadeAction = \"Cascade\" | \"Restrict\" | \"NoAction\" | \"SetNull\" | \"SetDefault\";\n\n/**\n * A relation field on a model. Implicit many-to-many pairing follows the v1\n * rule (LEARNINGS.md): both sides are lists AND relation names match\n * symmetrically (both unnamed, or same name), with self-exclusion.\n */\nexport type RelationIR = {\n /** Field name on the owning model (e.g. \"posts\"). */\n readonly name: string;\n /** Owning model name. */\n readonly model: string;\n readonly targetModel: string;\n readonly type: RelationType;\n /** Explicit @relation name — disambiguates multiple relations between the same pair. */\n readonly relationName?: string;\n /** FK columns on the owning model (FK side only). */\n readonly fields?: readonly string[];\n /** Referenced columns on the target model (FK side only). */\n readonly references?: readonly string[];\n readonly onDelete?: CascadeAction;\n readonly onUpdate?: CascadeAction;\n readonly isList: boolean;\n readonly isOptional: boolean;\n};\n\n// ─── Indexes ──────────────────────────────────────────────────────\n\n/**\n * Index kind. Core kinds are closed; extensions register additional kinds\n * (e.g. \"bm25\", \"hnsw\", \"fts5\") through the extension registry.\n */\nexport type IndexKind = \"btree\" | \"unique\" | \"gin\" | \"gist\" | \"hash\" | (string & {});\n\nexport type IndexFieldIR = {\n readonly name: string;\n readonly sort?: \"asc\" | \"desc\";\n};\n\nexport type IndexIR = {\n readonly name?: string;\n readonly kind: IndexKind;\n readonly fields: readonly IndexFieldIR[];\n /** Partial index predicate (raw SQL), postgres/sqlite only (capability-gated). */\n readonly where?: string;\n};\n\n// ─── Models, enums, schema ────────────────────────────────────────\n\nexport type ModelIR = {\n readonly name: string;\n /** Table name in the database when it differs from `name` (@@map). */\n readonly dbName?: string;\n readonly fields: readonly FieldIR[];\n readonly relations: readonly RelationIR[];\n readonly indexes: readonly IndexIR[];\n /** Composite primary key (@@id). Single-field PKs use FieldIR.isId. */\n readonly primaryKey?: { readonly fields: readonly string[] };\n readonly isView: boolean;\n readonly documentation?: string;\n};\n\nexport type EnumIR = {\n readonly name: string;\n readonly dbName?: string;\n readonly values: readonly string[];\n};\n\n/** An extension declared for this schema (config and/or schema attributes). */\nexport type ExtensionDeclIR = {\n readonly name: string;\n readonly options: Readonly<Record<string, unknown>>;\n};\n\nexport type DatasourceIR = {\n readonly provider: Provider;\n /** Connection URL if the schema declares one (env-resolved at runtime, not here). */\n readonly url?: string;\n};\n\nexport type SchemaIR = {\n readonly datasource: DatasourceIR;\n readonly models: readonly ModelIR[];\n readonly enums: readonly EnumIR[];\n readonly extensions: readonly ExtensionDeclIR[];\n};\n",
5
+ "/**\n * Canonical Schema IR for VibeORM v2.\n *\n * Both schema sources (.prisma via @vibeorm/parser, TS DSL via @vibeorm/dsl)\n * compile to this IR. Everything downstream (generator, runtime, migrate,\n * extensions) consumes ONLY this — nothing else ever parses schema text.\n */\n\n// ─── Dialects & Providers ─────────────────────────────────────────\n\n/** Datasource providers a schema may declare. */\nexport type Provider = \"postgresql\" | \"pglite\" | \"sqlite\" | \"mysql\";\n\n/**\n * SQL dialects. PGlite speaks the postgres dialect — it differs only at the\n * adapter level (single connection, bundled extension set).\n */\nexport type Dialect = \"postgres\" | \"sqlite\" | \"mysql\";\n\n/** All dialects, for matrix-style iteration in tests and tooling. */\nexport const DIALECTS: readonly Dialect[] = [\"postgres\", \"sqlite\", \"mysql\"];\n\n/** Map a datasource provider to the SQL dialect it speaks. */\nexport function providerToDialect(params: { provider: Provider }): Dialect {\n const { provider } = params;\n switch (provider) {\n case \"postgresql\":\n case \"pglite\":\n return \"postgres\";\n case \"sqlite\":\n return \"sqlite\";\n case \"mysql\":\n return \"mysql\";\n }\n}\n\n// ─── Scalar & field types ─────────────────────────────────────────\n\n/** Prisma-aligned scalar types. */\nexport type ScalarType =\n | \"String\"\n | \"Boolean\"\n | \"Int\"\n | \"BigInt\"\n | \"Float\"\n | \"Decimal\"\n | \"DateTime\"\n | \"Json\"\n | \"Bytes\";\n\n/** A field's type: a scalar, or a reference to a schema enum by name. */\nexport type FieldType = ScalarType | { readonly enum: string };\n\n/** Narrow a FieldType to an enum reference. */\nexport function isEnumType(fieldType: FieldType): fieldType is { readonly enum: string } {\n return typeof fieldType === \"object\" && \"enum\" in fieldType;\n}\n\n/** Default value declarations, normalized across schema sources. */\nexport type DefaultValueIR =\n | { readonly kind: \"autoincrement\" }\n | { readonly kind: \"now\" }\n | { readonly kind: \"uuid\" }\n | { readonly kind: \"cuid\" }\n | { readonly kind: \"nanoid\" }\n | { readonly kind: \"ulid\" }\n | { readonly kind: \"literal\"; readonly value: string | number | boolean }\n | { readonly kind: \"enumValue\"; readonly value: string }\n | { readonly kind: \"dbgenerated\"; readonly sql: string };\n\n/** A scalar/enum column on a model. */\nexport type FieldIR = {\n readonly name: string;\n /** Column name in the database when it differs from `name` (@map). */\n readonly dbName?: string;\n readonly type: FieldType;\n readonly isList: boolean;\n readonly isOptional: boolean;\n readonly isId: boolean;\n readonly isUnique: boolean;\n readonly isUpdatedAt: boolean;\n readonly default?: DefaultValueIR;\n /** Dialect-native type override (@db.*), verbatim (e.g. \"VarChar(191)\"). */\n readonly nativeType?: string;\n /**\n * Column declared as Prisma `Unsupported(\"...\")` / `dsl.unsupported(\"...\")`.\n * Kept in the IR for schema fidelity (convert, migrate DDL) but excluded from\n * the queryable surface: never projected, never writable, no generated types.\n * `nativeType` carries the raw database type; `type` is a nominal \"String\".\n */\n readonly isUnsupported?: true;\n readonly documentation?: string;\n};\n\n// ─── Relations ────────────────────────────────────────────────────\n\nexport type RelationType = \"oneToOne\" | \"oneToMany\" | \"manyToOne\" | \"manyToMany\";\n\nexport type CascadeAction = \"Cascade\" | \"Restrict\" | \"NoAction\" | \"SetNull\" | \"SetDefault\";\n\n/**\n * A relation field on a model. Implicit many-to-many pairing follows the v1\n * rule (LEARNINGS.md): both sides are lists AND relation names match\n * symmetrically (both unnamed, or same name), with self-exclusion.\n */\nexport type RelationIR = {\n /** Field name on the owning model (e.g. \"posts\"). */\n readonly name: string;\n /** Owning model name. */\n readonly model: string;\n readonly targetModel: string;\n readonly type: RelationType;\n /** Explicit @relation name — disambiguates multiple relations between the same pair. */\n readonly relationName?: string;\n /** FK columns on the owning model (FK side only). */\n readonly fields?: readonly string[];\n /** Referenced columns on the target model (FK side only). */\n readonly references?: readonly string[];\n readonly onDelete?: CascadeAction;\n readonly onUpdate?: CascadeAction;\n readonly isList: boolean;\n readonly isOptional: boolean;\n};\n\n// ─── Indexes ──────────────────────────────────────────────────────\n\n/**\n * Index kind. Core kinds are closed; extensions register additional kinds\n * (e.g. \"bm25\", \"hnsw\", \"fts5\") through the extension registry.\n */\nexport type IndexKind = \"btree\" | \"unique\" | \"gin\" | \"gist\" | \"hash\" | (string & {});\n\nexport type IndexFieldIR = {\n readonly name: string;\n readonly sort?: \"asc\" | \"desc\";\n};\n\nexport type IndexIR = {\n readonly name?: string;\n readonly kind: IndexKind;\n readonly fields: readonly IndexFieldIR[];\n /** Partial index predicate (raw SQL), postgres/sqlite only (capability-gated). */\n readonly where?: string;\n /**\n * `UNIQUE NULLS NOT DISTINCT` — NULLs collide instead of always passing.\n * Unique indexes only; postgres 15+ (pglite included), capability-gated.\n */\n readonly nullsNotDistinct?: boolean;\n};\n\n// ─── Models, enums, schema ────────────────────────────────────────\n\n/**\n * A named CHECK constraint on a model. The expression is RAW SQL, rendered\n * verbatim into DDL; the NAME keys the migration diff — engines re-serialize\n * expressions on introspection, so expression text is never compared: change\n * an expression by renaming its check.\n */\nexport type CheckIR = {\n readonly name: string;\n readonly expression: string;\n};\n\nexport type ModelIR = {\n readonly name: string;\n /** Table name in the database when it differs from `name` (@@map). */\n readonly dbName?: string;\n readonly fields: readonly FieldIR[];\n readonly relations: readonly RelationIR[];\n readonly indexes: readonly IndexIR[];\n /** Named CHECK constraints (@@check) — name-keyed in the migration diff. */\n readonly checks?: readonly CheckIR[];\n /** Composite primary key (@@id). Single-field PKs use FieldIR.isId. */\n readonly primaryKey?: { readonly fields: readonly string[] };\n readonly isView: boolean;\n readonly documentation?: string;\n};\n\nexport type EnumIR = {\n readonly name: string;\n readonly dbName?: string;\n readonly values: readonly string[];\n};\n\n/** An extension declared for this schema (config and/or schema attributes). */\nexport type ExtensionDeclIR = {\n readonly name: string;\n readonly options: Readonly<Record<string, unknown>>;\n};\n\nexport type DatasourceIR = {\n readonly provider: Provider;\n /** Connection URL if the schema declares one (env-resolved at runtime, not here). */\n readonly url?: string;\n};\n\nexport type SchemaIR = {\n readonly datasource: DatasourceIR;\n readonly models: readonly ModelIR[];\n readonly enums: readonly EnumIR[];\n readonly extensions: readonly ExtensionDeclIR[];\n};\n",
6
6
  "/**\n * The VibeORM v2 error contract.\n *\n * Every error thrown by any @vibeorm package is a VibeError carrying a stable\n * string code. Callers branch on `error.code` — never on message text (the v1\n * mistake this replaces). Adapters map driver errors to these codes via\n * per-driver tables.\n */\n\n// ─── Codes ────────────────────────────────────────────────────────\n\nexport const VIBE_ERROR_CODES = [\n /** findUniqueOrThrow / findFirstOrThrow / update / delete target missing. */\n \"VIBE_NOT_FOUND\",\n /** Unique constraint violation (driver-mapped). */\n \"VIBE_UNIQUE_VIOLATION\",\n /** Foreign key constraint violation (driver-mapped). */\n \"VIBE_FK_VIOLATION\",\n /** Input failed validation before reaching the database. */\n \"VIBE_VALIDATION\",\n /** Schema IR failed structural validation. */\n \"VIBE_SCHEMA_INVALID\",\n /** Feature requested on a dialect that does not support it. */\n \"VIBE_UNSUPPORTED_CAPABILITY\",\n /** Generated client is stale relative to config/schema — re-run generate. */\n \"VIBE_STALE_CLIENT\",\n /** Configuration problem (vibeorm.config.ts, flags, env). */\n \"VIBE_CONFIG\",\n /** Migration engine failure. */\n \"VIBE_MIGRATION\",\n /** Transaction begin/commit/rollback/serialization failure (driver-mapped). */\n \"VIBE_TRANSACTION\",\n /** Driver/connection failure not mapped to a more specific code. */\n \"VIBE_ADAPTER\",\n /** Invariant broken inside VibeORM itself — always a bug, please report. */\n \"VIBE_INTERNAL\",\n] as const;\n\nexport type VibeErrorCode = (typeof VIBE_ERROR_CODES)[number];\n\n// ─── Error class ──────────────────────────────────────────────────\n\n/**\n * Base error for all VibeORM failures.\n *\n * @example\n * try { await db.user.findUniqueOrThrow({ where: { id } }); }\n * catch (e) {\n * if (e instanceof VibeError && e.code === \"VIBE_NOT_FOUND\") { ... }\n * }\n */\nexport class VibeError extends Error {\n readonly code: VibeErrorCode;\n readonly meta: Readonly<Record<string, unknown>>;\n\n constructor(params: {\n code: VibeErrorCode;\n message: string;\n meta?: Record<string, unknown>;\n cause?: unknown;\n }) {\n super(params.message, params.cause === undefined ? undefined : { cause: params.cause });\n this.name = \"VibeError\";\n this.code = params.code;\n this.meta = params.meta ?? {};\n }\n}\n\n// ─── Factories ────────────────────────────────────────────────────\n\n/** Standard capability error — used by sql/runtime/migrate/generator alike. */\nexport function unsupportedCapability(params: {\n dialect: string;\n feature: string;\n hint?: string;\n}): VibeError {\n const { dialect, feature, hint } = params;\n return new VibeError({\n code: \"VIBE_UNSUPPORTED_CAPABILITY\",\n message: `${feature} is not supported on ${dialect}${hint === undefined ? \"\" : ` — ${hint}`}`,\n meta: { dialect, feature },\n });\n}\n\n/** Internal invariant violation — always indicates a VibeORM bug. */\nexport function internalError(params: { message: string; meta?: Record<string, unknown> }): VibeError {\n return new VibeError({\n code: \"VIBE_INTERNAL\",\n message: `internal: ${params.message}`,\n meta: params.meta,\n });\n}\n",
7
7
  "/**\n * Reserved names on the generated client surface.\n *\n * Extensions claim exactly one identifier per scope (plan D9): a method or\n * namespace on opted-in model delegates, and/or a root `$name` namespace.\n * The generator rejects any extension whose name collides with these lists.\n * Snapshot-tested so the core can never silently grow into an extension's name.\n */\n\n// ─── Model delegate methods ───────────────────────────────────────\n\nexport const RESERVED_DELEGATE_NAMES: readonly string[] = [\n \"findMany\",\n \"findFirst\",\n \"findUnique\",\n \"findFirstOrThrow\",\n \"findUniqueOrThrow\",\n \"create\",\n \"createMany\",\n \"createManyAndReturn\",\n \"update\",\n \"updateMany\",\n \"upsert\",\n \"delete\",\n \"deleteMany\",\n \"count\",\n \"aggregate\",\n \"groupBy\",\n \"fields\",\n];\n\n// ─── Client $-methods ─────────────────────────────────────────────\n\nexport const RESERVED_CLIENT_NAMES: readonly string[] = [\n \"$connect\",\n \"$disconnect\",\n \"$transaction\",\n \"$queryRaw\",\n \"$queryRawUnsafe\",\n \"$executeRaw\",\n \"$executeRawUnsafe\",\n \"$on\",\n \"$extends\",\n];\n\n// ─── Reserved column-name prefix ─────────────────────────────────\n\n/**\n * Column-name prefix reserved for VibeORM's own result projections — the M2M\n * join loader's `__vibe_parent` stitch key today, hidden order/stitch fields\n * generally. A user column with this prefix would collide with a projection\n * alias and be silently misgrouped or stripped, so schema validation refuses\n * it (`reserved-column-prefix`). Unreachable from `.prisma` field-name\n * grammar, reachable via `@map` or hand-built IR. Wave-C sqlite review,\n * finding 3.\n */\nexport const RESERVED_COLUMN_PREFIX: string = \"__vibe_\";\n\n// ─── Guards ───────────────────────────────────────────────────────\n\nexport function isReservedDelegateName(params: { name: string }): boolean {\n return RESERVED_DELEGATE_NAMES.includes(params.name);\n}\n\n/** Checks the `$`-prefixed form an extension's root namespace would occupy. */\nexport function isReservedClientName(params: { name: string }): boolean {\n const withPrefix = params.name.startsWith(\"$\") ? params.name : `$${params.name}`;\n return RESERVED_CLIENT_NAMES.includes(withPrefix);\n}\n",
8
8
  "/**\n * Extension framework contract (plan §10, extensions.md).\n *\n * Hook types live HERE so every package can consume them without cycles:\n * extensions implement them (tier 1 in @vibeorm/extensions), parser/dsl route\n * schema attributes through the registry, migrate applies artifact DDL,\n * the generator bakes client surfaces (D9), and the runtime mounts them.\n *\n * All hook signatures are dependency-free on purpose: DDL is dialect-correct\n * SQL text (never migrate step objects), SQL fragments are neutral part lists\n * (@vibeorm/sql renders them), and client contributions are JS/d.ts text.\n */\n\nimport { VibeError } from \"./errors.ts\";\nimport type { Dialect, ModelIR, Provider, SchemaIR } from \"./ir.ts\";\nimport { RESERVED_CLIENT_NAMES, RESERVED_DELEGATE_NAMES } from \"./reserved.ts\";\n\n// ─── Attribute parsing (schema plane) ─────────────────────────────\n\n/** Scalar-ish values an extension attribute argument may carry. */\nexport type ExtensionAttributeValue =\n | string\n | number\n | boolean\n | readonly string[]\n | readonly number[];\n\n/**\n * One occurrence of an extension attribute, normalized identically by the\n * .prisma parser and the TS DSL (source equivalence is tested — LEARNINGS F2).\n */\nexport type ExtensionAttributeArgs = {\n /** The positional field-list argument (`[title, body]`), when present. */\n readonly fields?: readonly string[];\n /** Named arguments (`name: \"x\"`, `weights: [2, 1]`, `dims: 1536`). */\n readonly named: Readonly<Record<string, ExtensionAttributeValue>>;\n};\n\n/** A model-level attribute the extension registers (`@@search(...)`). */\nexport type ExtensionModelAttribute = {\n /** Attribute name without the `@@` prefix. */\n readonly name: string;\n /**\n * Validate and normalize one occurrence into declaration data. Returning\n * `{ error }` rejects the schema with VIBE_SCHEMA_INVALID at parse time.\n */\n readonly parse: (ctx: {\n readonly model: string;\n readonly args: ExtensionAttributeArgs;\n /** Scalar/enum field names on the model, for validation. */\n readonly fieldNames: readonly string[];\n }) =>\n | { readonly declaration: Readonly<Record<string, unknown>> }\n | { readonly error: string };\n};\n\n/** A column type the extension registers (`embedding Vector(1536)`). */\nexport type ExtensionFieldType = {\n /** Type name as written in the schema — e.g. \"Vector\". */\n readonly name: string;\n /**\n * Lower one field to a database-native column type. The field lands in the\n * IR exactly like `Unsupported(\"<nativeType>\")` (kept for DDL, excluded from\n * the core queryable surface); the declaration is merged into the\n * extension's ExtensionDeclIR for downstream planes.\n */\n readonly lower: (ctx: {\n readonly model: string;\n readonly field: string;\n /** Positional type arguments (`Vector(1536)` → [1536]). */\n readonly args: readonly (string | number)[];\n }) =>\n | {\n readonly nativeType: string;\n readonly declaration?: Readonly<Record<string, unknown>>;\n }\n | { readonly error: string };\n};\n\n// ─── Migrate plane ────────────────────────────────────────────────\n\n/**\n * The database object an artifact owns. Migrate uses this identity to\n * (a) hide extension-owned objects from the introspected IR before diffing —\n * so the core differ never schedules their drop — and (b) decide whether the\n * artifact is missing and must be created.\n */\nexport type ExtensionArtifactOwner =\n | { readonly kind: \"postgresExtension\"; readonly name: string }\n | { readonly kind: \"column\"; readonly table: string; readonly column: string }\n | { readonly kind: \"index\"; readonly table: string; readonly name: string }\n | {\n readonly kind: \"table\";\n readonly name: string;\n /** Auxiliary tables created alongside (FTS5's `_data`, `_idx`, …). */\n readonly auxiliaryPrefixes?: readonly string[];\n }\n | { readonly kind: \"trigger\"; readonly table: string; readonly name: string };\n\n/**\n * One extension-owned database object with dialect-correct DDL. `create`\n * statements must be idempotent wherever the dialect allows (IF NOT EXISTS),\n * so replays and partial applies converge.\n */\nexport type ExtensionArtifact = {\n /** Stable identity, e.g. \"search:Post:index\". Used in logs and errors. */\n readonly id: string;\n readonly owns: ExtensionArtifactOwner;\n readonly create: readonly string[];\n readonly drop: readonly string[];\n};\n\n/** Context handed to schema-scoped extension hooks. */\nexport type ExtensionSchemaContext = {\n readonly schema: SchemaIR;\n readonly dialect: Dialect;\n readonly provider: Provider;\n /** The extension factory's own options (from config / VibeClient). */\n readonly options: Readonly<Record<string, unknown>>;\n /** Normalized per-model declarations gathered from schema attributes. */\n readonly declarations: Readonly<Record<string, Readonly<Record<string, unknown>>>>;\n};\n\nexport type ExtensionMigratePlane = {\n /**\n * Every database object this extension needs for the given schema on the\n * given dialect/provider. Called by `db push` and `migrate generate`.\n * Must throw VIBE_UNSUPPORTED_CAPABILITY for a dialect that cannot ever\n * satisfy the declaration (earliest knowable moment).\n */\n readonly artifacts: (ctx: ExtensionSchemaContext) => readonly ExtensionArtifact[];\n};\n\n// ─── SQL plane ────────────────────────────────────────────────────\n\n/**\n * A neutral bound SQL fragment: literal text, bound parameters and quoted\n * identifiers, in order. @vibeorm/sql renders it (placeholders through\n * ParamCollector, identifiers through dialect.quoteIdent) — extensions never\n * hand-write `$1`/`?` or quotes.\n */\nexport type SqlFragmentPart =\n | string\n | { readonly param: unknown }\n | { readonly ident: readonly string[] };\n\nexport type SqlFragmentSpec = {\n readonly parts: readonly SqlFragmentPart[];\n};\n\n/** A where-operator the extension contributes (`{ name: { similarTo: \"x\" } }`). */\nexport type ExtensionWhereOperator = {\n /** Operator key as written in `where` objects. */\n readonly name: string;\n /**\n * Compile one use to a fragment. `column` is the already-resolved column\n * reference (alias-qualified by the caller via `ident`).\n */\n readonly compile: (ctx: {\n /** Identifier path for the column, e.g. [\"t0\", \"name\"] or [\"name\"]. */\n readonly column: readonly string[];\n readonly operand: unknown;\n readonly dialect: Dialect;\n readonly provider: Provider;\n readonly options: Readonly<Record<string, unknown>>;\n }) => { readonly fragment: SqlFragmentSpec } | { readonly error: string };\n};\n\nexport type ExtensionSqlPlane = {\n readonly whereOperators?: readonly ExtensionWhereOperator[];\n};\n\n// ─── Client plane (D9 — baked at generate time) ───────────────────\n\nexport type ExtensionImportSpec = {\n readonly from: string;\n readonly names: readonly string[];\n};\n\n/**\n * What the generator bakes for one scope. `runtimeGlue` is a JS expression\n * (may reference identifiers from `imports`) evaluating to the mount factory\n * the runtime calls with a MountContext; `dts` lines land inside the delegate\n * (model scope) or client (root scope) type body; `dtsTypes` are module-scope\n * declarations emitted once per contribution.\n */\nexport type ExtensionClientContribution = {\n readonly kind: \"method\" | \"namespace\";\n readonly runtimeGlue: string;\n readonly dts: readonly string[];\n readonly dtsTypes?: readonly string[];\n readonly imports?: readonly ExtensionImportSpec[];\n readonly dtsImports?: readonly ExtensionImportSpec[];\n};\n\n/** Generated type names the extension may reference in its d.ts text. */\nexport type ExtensionModelTypeNames = {\n /** The model payload type (e.g. \"Post\"). */\n readonly payload: string;\n readonly whereInput: string;\n};\n\nexport type ExtensionClientPlane = {\n readonly model?: (ctx: {\n readonly model: ModelIR;\n readonly schema: SchemaIR;\n readonly dialect: Dialect;\n readonly provider: Provider;\n readonly options: Readonly<Record<string, unknown>>;\n readonly declaration: Readonly<Record<string, unknown>>;\n readonly typeNames: ExtensionModelTypeNames;\n }) => ExtensionClientContribution | null;\n readonly root?: (ctx: {\n readonly schema: SchemaIR;\n readonly dialect: Dialect;\n readonly provider: Provider;\n readonly options: Readonly<Record<string, unknown>>;\n readonly declarations: Readonly<Record<string, Readonly<Record<string, unknown>>>>;\n }) => ExtensionClientContribution | null;\n};\n\n// ─── Runtime & doctor planes ──────────────────────────────────────\n\n/** Minimal SQL execution surface handed to runtime/doctor hooks. */\nexport type ExtensionSqlExecutor = (params: {\n readonly text: string;\n readonly values?: readonly unknown[];\n}) => Promise<readonly Record<string, unknown>[]>;\n\nexport type ExtensionRuntimePlane = {\n /** Session setup after connect (e.g. SET pg_trgm.similarity_threshold). */\n readonly onConnect?: (ctx: {\n readonly execute: ExtensionSqlExecutor;\n readonly dialect: Dialect;\n readonly provider: Provider;\n readonly options: Readonly<Record<string, unknown>>;\n }) => Promise<void>;\n};\n\nexport type ExtensionDoctorCheck = {\n readonly name: string;\n readonly ok: boolean;\n readonly note?: string;\n};\n\nexport type ExtensionDoctorReport = {\n readonly checks: readonly ExtensionDoctorCheck[];\n};\n\nexport type ExtensionDoctorHook = (ctx: {\n readonly execute: ExtensionSqlExecutor;\n readonly dialect: Dialect;\n readonly provider: Provider;\n readonly options: Readonly<Record<string, unknown>>;\n}) => Promise<ExtensionDoctorReport>;\n\n// ─── The extension ────────────────────────────────────────────────\n\n/**\n * A VibeORM extension instance — what an extension factory (`search()`,\n * `vector({ dims })`) returns and what config/VibeClient carry.\n */\nexport type VibeExtension = {\n /** Unique name; the ONLY identifier the extension may claim (D9). */\n readonly name: string;\n /** Embedded in the generated-client manifest for staleness checks. */\n readonly version: string;\n /** The factory's raw options — hashed into the manifest. */\n readonly options: Readonly<Record<string, unknown>>;\n /** Database extension requirements per provider (null = built in). */\n readonly requires?: Partial<\n Record<Provider, { readonly extension: string; readonly min?: string } | null>\n >;\n readonly schema?: {\n readonly modelAttributes?: readonly ExtensionModelAttribute[];\n readonly fieldTypes?: readonly ExtensionFieldType[];\n /** Index kinds this extension registers (informational). */\n readonly indexKinds?: readonly string[];\n /** Replication-class: valid with zero schema attributes. */\n readonly configOnly?: boolean;\n };\n readonly migrate?: ExtensionMigratePlane;\n readonly sql?: ExtensionSqlPlane;\n readonly client?: ExtensionClientPlane;\n readonly runtime?: ExtensionRuntimePlane;\n readonly doctor?: ExtensionDoctorHook;\n};\n\n/** Manifest entry embedded in the generated client (extensions.md §3.2). */\nexport type ExtensionManifestEntry = {\n readonly name: string;\n readonly version: string;\n readonly optionsHash: string;\n};\n\n// ─── Stable hashing (manifest) ────────────────────────────────────\n\nfunction stableSerialize(value: unknown): string {\n if (value === null || typeof value !== \"object\") return JSON.stringify(value) ?? \"undefined\";\n if (Array.isArray(value)) return `[${value.map(stableSerialize).join(\",\")}]`;\n const entries = Object.entries(value as Record<string, unknown>)\n .filter(([, entryValue]) => entryValue !== undefined)\n .sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))\n .map(([key, entryValue]) => `${JSON.stringify(key)}:${stableSerialize(entryValue)}`);\n return `{${entries.join(\",\")}}`;\n}\n\n/**\n * Deterministic hash of an extension's options for the client manifest.\n * FNV-1a 32-bit over a key-sorted serialization — stable across processes.\n */\nexport function extensionOptionsHash(params: {\n options: Readonly<Record<string, unknown>>;\n}): string {\n const text = stableSerialize(params.options);\n let hash = 0x811c9dc5;\n for (let index = 0; index < text.length; index += 1) {\n hash ^= text.charCodeAt(index);\n hash = Math.imul(hash, 0x01000193);\n }\n return (hash >>> 0).toString(16).padStart(8, \"0\");\n}\n\n/** Build the manifest entry for one extension instance. */\nexport function extensionManifestEntry(params: { extension: VibeExtension }): ExtensionManifestEntry {\n const { extension } = params;\n return {\n name: extension.name,\n version: extension.version,\n optionsHash: extensionOptionsHash({ options: extension.options }),\n };\n}\n\n// ─── defineExtension ──────────────────────────────────────────────\n\nconst EXTENSION_NAME_PATTERN = /^[a-z][a-zA-Z0-9]*$/;\n\n/**\n * Validate and freeze an extension definition. Userland extensions use this\n * exactly like tier 1 — nothing in @vibeorm/extensions is privileged.\n *\n * @example\n * export function trgm(options: TrgmOptions = {}): VibeExtension {\n * return defineExtension({ name: \"trgm\", version: VERSION, options, ... });\n * }\n */\nexport function defineExtension(extension: VibeExtension): VibeExtension {\n const { name } = extension;\n if (!EXTENSION_NAME_PATTERN.test(name)) {\n throw new VibeError({\n code: \"VIBE_CONFIG\",\n message: `extension name \"${name}\" is invalid — must match ${EXTENSION_NAME_PATTERN} (it becomes a client identifier)`,\n meta: { name },\n });\n }\n if (RESERVED_DELEGATE_NAMES.includes(name)) {\n throw new VibeError({\n code: \"VIBE_CONFIG\",\n message: `extension name \"${name}\" collides with a core delegate method`,\n meta: { name },\n });\n }\n if (RESERVED_CLIENT_NAMES.includes(`$${name}`)) {\n throw new VibeError({\n code: \"VIBE_CONFIG\",\n message: `extension name \"${name}\" collides with the core client method \"$${name}\"`,\n meta: { name },\n });\n }\n return Object.freeze(extension);\n}\n\n// ─── Registry ─────────────────────────────────────────────────────\n\n/** Configured extensions, indexed for the parser/dsl/generator/migrate. */\nexport type ExtensionRegistry = {\n readonly extensions: readonly VibeExtension[];\n readonly byName: ReadonlyMap<string, VibeExtension>;\n /** Model-attribute name (without @@) → owning extension + spec. */\n readonly modelAttributes: ReadonlyMap<\n string,\n { readonly extension: VibeExtension; readonly attribute: ExtensionModelAttribute }\n >;\n /** Field-type name → owning extension + spec. */\n readonly fieldTypes: ReadonlyMap<\n string,\n { readonly extension: VibeExtension; readonly fieldType: ExtensionFieldType }\n >;\n};\n\n/**\n * Index a configured extension list. Throws VIBE_CONFIG on duplicate\n * extension names and on attribute/type claims that collide across extensions.\n */\nexport function buildExtensionRegistry(params: {\n extensions: readonly VibeExtension[];\n}): ExtensionRegistry {\n const byName = new Map<string, VibeExtension>();\n const modelAttributes = new Map<\n string,\n { extension: VibeExtension; attribute: ExtensionModelAttribute }\n >();\n const fieldTypes = new Map<string, { extension: VibeExtension; fieldType: ExtensionFieldType }>();\n\n for (const extension of params.extensions) {\n if (byName.has(extension.name)) {\n throw new VibeError({\n code: \"VIBE_CONFIG\",\n message: `duplicate extension name \"${extension.name}\" in the configured extension list`,\n meta: { name: extension.name },\n });\n }\n byName.set(extension.name, extension);\n\n for (const attribute of extension.schema?.modelAttributes ?? []) {\n const existing = modelAttributes.get(attribute.name);\n if (existing !== undefined) {\n throw new VibeError({\n code: \"VIBE_CONFIG\",\n message: `model attribute \"@@${attribute.name}\" is claimed by both \"${existing.extension.name}\" and \"${extension.name}\"`,\n meta: { attribute: attribute.name },\n });\n }\n modelAttributes.set(attribute.name, { extension, attribute });\n }\n\n for (const fieldType of extension.schema?.fieldTypes ?? []) {\n const existing = fieldTypes.get(fieldType.name);\n if (existing !== undefined) {\n throw new VibeError({\n code: \"VIBE_CONFIG\",\n message: `field type \"${fieldType.name}\" is claimed by both \"${existing.extension.name}\" and \"${extension.name}\"`,\n meta: { fieldType: fieldType.name },\n });\n }\n fieldTypes.set(fieldType.name, { extension, fieldType });\n }\n }\n\n return { extensions: params.extensions, byName, modelAttributes, fieldTypes };\n}\n\n/** An empty registry — the default when no extensions are configured. */\nexport const EMPTY_EXTENSION_REGISTRY: ExtensionRegistry = buildExtensionRegistry({\n extensions: [],\n});\n\n// ─── IR access helpers ────────────────────────────────────────────\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\n/**\n * Merge two declaration fragments for the same (extension, model) — e.g. a\n * field-type lowering plus a model attribute. One level deep: object values\n * merge shallowly, everything else is last-wins. Used identically by the\n * .prisma parser and the TS DSL so both sources produce byte-identical IR.\n */\nexport function mergeExtensionDeclarations(params: {\n base: Readonly<Record<string, unknown>>;\n next: Readonly<Record<string, unknown>>;\n}): Record<string, unknown> {\n const out: Record<string, unknown> = { ...params.base };\n for (const [key, value] of Object.entries(params.next)) {\n const existing = out[key];\n out[key] = isPlainObject(existing) && isPlainObject(value) ? { ...existing, ...value } : value;\n }\n return out;\n}\n\n/**\n * Per-model declarations one extension gathered from schema attributes,\n * read back out of SchemaIR.extensions. Parser and DSL both store them as\n * `{ models: { [modelName]: declaration } }` in ExtensionDeclIR.options.\n */\nexport function extensionDeclarations(params: {\n schema: SchemaIR;\n name: string;\n}): Readonly<Record<string, Readonly<Record<string, unknown>>>> {\n const decl = params.schema.extensions.find((entry) => entry.name === params.name);\n if (decl === undefined) return {};\n const models = decl.options[\"models\"];\n if (models === null || typeof models !== \"object\" || Array.isArray(models)) return {};\n return models as Readonly<Record<string, Readonly<Record<string, unknown>>>>;\n}\n",
9
9
  "/**\n * Computed fields — config-declared derived properties on query results.\n *\n * The declaration lives in `vibeorm.config.ts` (so the generator can write the\n * field's TYPE into the payload `.d.ts` verbatim — rules 1/2: no inference),\n * and the SAME spec object is passed to `VibeClient({ computed })`, which runs\n * the `compute` functions at row materialization. The generated client bakes a\n * manifest of `{ model, field, type, needs }`; drift between that manifest and\n * the live config throws `VIBE_STALE_CLIENT` at construction.\n *\n * Deliberately NOT part of the Schema IR: the IR is the only schema currency\n * (rule 9) and migrate/introspection/db-push must never see a presentation-only\n * field — and compute functions would not survive IR serialization anyway.\n */\n\nimport { VibeError } from \"./errors.ts\";\nimport type { SchemaIR } from \"./ir.ts\";\nimport { RESERVED_COLUMN_PREFIX } from \"./reserved.ts\";\n\n// ─── Types ────────────────────────────────────────────────────────\n\n/** One computed field: an explicit result type, the scalars it reads, and the derivation. */\nexport type ComputedFieldSpec = {\n /** TypeScript type written VERBATIM into the generated payload (`\"string\"`, `\"number | null\"`). */\n readonly type: string;\n /**\n * Scalar fields of the model the compute reads. They are fetched whenever\n * the computed field is selected — even when not selected themselves — and\n * stripped from the result afterwards (the stitch-key pattern).\n */\n readonly needs: readonly string[];\n /**\n * Synchronous derivation. Receives the row with every `needs` scalar\n * decoded; the return value is attached under the computed field's name.\n */\n readonly compute: (row: Record<string, unknown>) => unknown;\n};\n\n/** Computed-field config: IR model name (`\"User\"`) → field name → spec. */\nexport type ComputedConfig = Readonly<Record<string, Readonly<Record<string, ComputedFieldSpec>>>>;\n\n/** What the generator bakes per computed field for the staleness gate. */\nexport type ComputedManifestEntry = {\n readonly model: string;\n readonly field: string;\n readonly type: string;\n readonly needs: readonly string[];\n};\n\n// ─── Manifest ─────────────────────────────────────────────────────\n\n/** The baked manifest for a config — model/field sorted, so output is deterministic. */\nexport function buildComputedManifest(params: { computed: ComputedConfig }): readonly ComputedManifestEntry[] {\n const { computed } = params;\n const entries: ComputedManifestEntry[] = [];\n for (const modelName of Object.keys(computed).sort()) {\n const fields = computed[modelName] ?? {};\n for (const fieldName of Object.keys(fields).sort()) {\n const spec = fields[fieldName] as ComputedFieldSpec;\n entries.push({ model: modelName, field: fieldName, type: spec.type, needs: [...spec.needs] });\n }\n }\n return entries;\n}\n\n// ─── Validation ───────────────────────────────────────────────────\n\nconst IDENTIFIER_PATTERN: RegExp = /^[A-Za-z_$][A-Za-z0-9_$]*$/;\n\n/**\n * Validate a computed-field config against a schema: models exist (by IR\n * name), field names are collision-free identifiers, `needs` name queryable\n * scalar fields, and each spec is structurally complete. Every problem is\n * reported at once in ONE `VIBE_CONFIG` error.\n */\nexport function validateComputedConfig(params: { schema: SchemaIR; computed: ComputedConfig }): void {\n const { schema, computed } = params;\n const problems: string[] = [];\n const modelByName = new Map(schema.models.map((model) => [model.name, model]));\n\n for (const [modelName, fields] of Object.entries(computed)) {\n const model = modelByName.get(modelName);\n if (model === undefined) {\n const byClientName = schema.models.find(\n (candidate) => candidate.name.charAt(0).toLowerCase() + candidate.name.slice(1) === modelName,\n );\n problems.push(\n byClientName === undefined\n ? `unknown model \"${modelName}\"`\n : `unknown model \"${modelName}\" — computed is keyed by MODEL name (\"${byClientName.name}\"), not client name`,\n );\n continue;\n }\n if (fields === null || typeof fields !== \"object\" || Array.isArray(fields)) {\n problems.push(`computed.${modelName} must be an object of field specs`);\n continue;\n }\n for (const [fieldName, spec] of Object.entries(fields)) {\n const at = `${modelName}.${fieldName}`;\n if (!IDENTIFIER_PATTERN.test(fieldName)) {\n problems.push(`\"${at}\" is not a valid identifier`);\n } else if (fieldName.startsWith(RESERVED_COLUMN_PREFIX)) {\n problems.push(`\"${at}\" uses the reserved \"${RESERVED_COLUMN_PREFIX}\" prefix`);\n }\n if (fieldName === \"_count\") problems.push(`\"${at}\" collides with the _count projection`);\n if (model.fields.some((field) => field.name === fieldName)) {\n problems.push(`\"${at}\" collides with a schema field of the same name`);\n }\n if (model.relations.some((relation) => relation.name === fieldName)) {\n problems.push(`\"${at}\" collides with a relation of the same name`);\n }\n if (spec === null || typeof spec !== \"object\") {\n problems.push(`\"${at}\" must be a spec object ({ type, needs, compute })`);\n continue;\n }\n if (typeof spec.type !== \"string\" || spec.type.trim().length === 0) {\n problems.push(`\"${at}\".type must be a non-empty TypeScript type string`);\n }\n if (typeof spec.compute !== \"function\") {\n problems.push(`\"${at}\".compute must be a function`);\n }\n if (!Array.isArray(spec.needs)) {\n problems.push(`\"${at}\".needs must be an array of scalar field names`);\n continue;\n }\n for (const need of spec.needs) {\n if (typeof need !== \"string\") {\n problems.push(`\"${at}\".needs entries must be strings`);\n continue;\n }\n const target = model.fields.find((field) => field.name === need);\n if (target === undefined) {\n problems.push(\n model.relations.some((relation) => relation.name === need)\n ? `\"${at}\".needs names the relation \"${need}\" — needs are scalar fields only`\n : `\"${at}\".needs names \"${need}\", which is not a field of ${modelName}`,\n );\n } else if (target.isUnsupported === true) {\n problems.push(`\"${at}\".needs names \"${need}\", an Unsupported(...) column — those are never queryable`);\n }\n }\n }\n }\n\n if (problems.length > 0) {\n throw new VibeError({\n code: \"VIBE_CONFIG\",\n message: `invalid computed-field config — ${problems.join(\"; \")}`,\n meta: { problems },\n });\n }\n}\n",
10
- "/**\n * Structural validation of a SchemaIR.\n *\n * Shared by both schema sources (parser + dsl), so a schema that validates here\n * validates everywhere. Source-specific rules (e.g. Prisma AMBIGUOUS_RELATION\n * candidate detection) live in the source packages and land in P1.\n */\n\nimport { isEnumType } from \"./ir.ts\";\nimport type { ModelIR, SchemaIR } from \"./ir.ts\";\nimport { VibeError } from \"./errors.ts\";\nimport { RESERVED_COLUMN_PREFIX } from \"./reserved.ts\";\n\n// ─── Issue shape ──────────────────────────────────────────────────\n\nexport type ValidationIssue = {\n /** Stable rule id, e.g. \"duplicate-model\", \"unknown-relation-target\". */\n readonly rule: string;\n readonly message: string;\n readonly model?: string;\n readonly field?: string;\n};\n\n// ─── Validation ───────────────────────────────────────────────────\n\n/** Validate a SchemaIR structurally; returns all issues found (empty = valid). */\nexport function validateSchemaIR(params: { schema: SchemaIR }): ValidationIssue[] {\n const { schema } = params;\n const issues: ValidationIssue[] = [];\n\n const modelByName = new Map<string, ModelIR>();\n for (const model of schema.models) {\n if (modelByName.has(model.name)) {\n issues.push({\n rule: \"duplicate-model\",\n message: `Duplicate model name \"${model.name}\"`,\n model: model.name,\n });\n } else {\n modelByName.set(model.name, model);\n }\n }\n\n const enumNames = new Set<string>();\n for (const enumDef of schema.enums) {\n if (enumNames.has(enumDef.name)) {\n issues.push({\n rule: \"duplicate-enum\",\n message: `Duplicate enum name \"${enumDef.name}\"`,\n });\n } else {\n enumNames.add(enumDef.name);\n }\n if (enumDef.values.length === 0) {\n issues.push({\n rule: \"empty-enum\",\n message: `Enum \"${enumDef.name}\" has no values`,\n });\n }\n }\n\n for (const model of schema.models) {\n validateModel({ model, modelByName, enumNames, issues });\n }\n\n return issues;\n}\n\nfunction validateModel(params: {\n model: ModelIR;\n modelByName: Map<string, ModelIR>;\n enumNames: Set<string>;\n issues: ValidationIssue[];\n}): void {\n const { model, modelByName, enumNames, issues } = params;\n\n // Field + relation names share one namespace on the model.\n const memberNames = new Set<string>();\n for (const field of model.fields) {\n if (memberNames.has(field.name)) {\n issues.push({\n rule: \"duplicate-field\",\n message: `Duplicate field \"${field.name}\" on model \"${model.name}\"`,\n model: model.name,\n field: field.name,\n });\n }\n memberNames.add(field.name);\n\n if (isEnumType(field.type) && !enumNames.has(field.type.enum)) {\n issues.push({\n rule: \"unknown-enum\",\n message: `Field \"${model.name}.${field.name}\" references unknown enum \"${field.type.enum}\"`,\n model: model.name,\n field: field.name,\n });\n }\n\n // The runtime aliases its own projections (M2M stitch key `__vibe_parent`,\n // hidden order fields) under this prefix; a user column there would\n // collide and be silently misgrouped/stripped. `.prisma` field names\n // cannot start with `_`, but `@map` and hand-built IR can.\n const columnName = field.dbName ?? field.name;\n if (columnName.startsWith(RESERVED_COLUMN_PREFIX)) {\n issues.push({\n rule: \"reserved-column-prefix\",\n message:\n `Field \"${model.name}.${field.name}\" maps to column \"${columnName}\" — the \"${RESERVED_COLUMN_PREFIX}\" ` +\n `prefix is reserved for VibeORM's own projection aliases`,\n model: model.name,\n field: field.name,\n });\n }\n }\n\n for (const relation of model.relations) {\n if (memberNames.has(relation.name)) {\n issues.push({\n rule: \"duplicate-field\",\n message: `Relation \"${relation.name}\" collides with another member on model \"${model.name}\"`,\n model: model.name,\n field: relation.name,\n });\n }\n memberNames.add(relation.name);\n }\n\n // Primary key presence (views are exempt).\n const fieldNames = new Set(model.fields.map((f) => f.name));\n const hasIdField = model.fields.some((f) => f.isId);\n if (!model.isView && !hasIdField && model.primaryKey === undefined) {\n issues.push({\n rule: \"missing-id\",\n message: `Model \"${model.name}\" has no @id field and no composite primary key`,\n model: model.name,\n });\n }\n if (model.primaryKey !== undefined) {\n for (const pkField of model.primaryKey.fields) {\n if (!fieldNames.has(pkField)) {\n issues.push({\n rule: \"unknown-pk-field\",\n message: `Composite primary key on \"${model.name}\" references unknown field \"${pkField}\"`,\n model: model.name,\n field: pkField,\n });\n }\n }\n }\n\n // Relations: target exists, FK columns exist both sides, arities match.\n for (const relation of model.relations) {\n const target = modelByName.get(relation.targetModel);\n if (target === undefined) {\n issues.push({\n rule: \"unknown-relation-target\",\n message: `Relation \"${model.name}.${relation.name}\" targets unknown model \"${relation.targetModel}\"`,\n model: model.name,\n field: relation.name,\n });\n }\n\n const hasFields = relation.fields !== undefined && relation.fields.length > 0;\n const hasReferences = relation.references !== undefined && relation.references.length > 0;\n if (hasFields !== hasReferences) {\n issues.push({\n rule: \"relation-fields-mismatch\",\n message: `Relation \"${model.name}.${relation.name}\" must declare fields and references together`,\n model: model.name,\n field: relation.name,\n });\n }\n if (hasFields && hasReferences && relation.fields !== undefined && relation.references !== undefined) {\n if (relation.fields.length !== relation.references.length) {\n issues.push({\n rule: \"relation-fields-mismatch\",\n message: `Relation \"${model.name}.${relation.name}\" has ${relation.fields.length} fields but ${relation.references.length} references`,\n model: model.name,\n field: relation.name,\n });\n }\n for (const fkField of relation.fields) {\n if (!fieldNames.has(fkField)) {\n issues.push({\n rule: \"unknown-relation-field\",\n message: `Relation \"${model.name}.${relation.name}\" uses unknown field \"${fkField}\"`,\n model: model.name,\n field: relation.name,\n });\n }\n }\n if (target !== undefined) {\n const targetFieldNames = new Set(target.fields.map((f) => f.name));\n for (const refField of relation.references) {\n if (!targetFieldNames.has(refField)) {\n issues.push({\n rule: \"unknown-relation-reference\",\n message: `Relation \"${model.name}.${relation.name}\" references unknown field \"${relation.targetModel}.${refField}\"`,\n model: model.name,\n field: relation.name,\n });\n }\n }\n }\n }\n }\n\n // Indexes reference real fields.\n for (const index of model.indexes) {\n for (const indexField of index.fields) {\n if (!fieldNames.has(indexField.name)) {\n issues.push({\n rule: \"unknown-index-field\",\n message: `Index on \"${model.name}\" references unknown field \"${indexField.name}\"`,\n model: model.name,\n field: indexField.name,\n });\n }\n }\n }\n}\n\n// ─── Assertion form ───────────────────────────────────────────────\n\n/** Throw VIBE_SCHEMA_INVALID (with all issues in meta) if the schema is invalid. */\nexport function assertValidSchemaIR(params: { schema: SchemaIR }): void {\n const issues = validateSchemaIR(params);\n if (issues.length > 0) {\n throw new VibeError({\n code: \"VIBE_SCHEMA_INVALID\",\n message: `Schema validation failed with ${issues.length} issue(s): ${issues\n .map((issue) => issue.message)\n .join(\"; \")}`,\n meta: { issues },\n });\n }\n}\n",
10
+ "/**\n * Structural validation of a SchemaIR.\n *\n * Shared by both schema sources (parser + dsl), so a schema that validates here\n * validates everywhere. Source-specific rules (e.g. Prisma AMBIGUOUS_RELATION\n * candidate detection) live in the source packages and land in P1.\n */\n\nimport { isEnumType } from \"./ir.ts\";\nimport type { ModelIR, SchemaIR } from \"./ir.ts\";\nimport { VibeError } from \"./errors.ts\";\nimport { RESERVED_COLUMN_PREFIX } from \"./reserved.ts\";\n\n// ─── Issue shape ──────────────────────────────────────────────────\n\nexport type ValidationIssue = {\n /** Stable rule id, e.g. \"duplicate-model\", \"unknown-relation-target\". */\n readonly rule: string;\n readonly message: string;\n readonly model?: string;\n readonly field?: string;\n};\n\n// ─── Validation ───────────────────────────────────────────────────\n\n/** Validate a SchemaIR structurally; returns all issues found (empty = valid). */\nexport function validateSchemaIR(params: { schema: SchemaIR }): ValidationIssue[] {\n const { schema } = params;\n const issues: ValidationIssue[] = [];\n\n const modelByName = new Map<string, ModelIR>();\n for (const model of schema.models) {\n if (modelByName.has(model.name)) {\n issues.push({\n rule: \"duplicate-model\",\n message: `Duplicate model name \"${model.name}\"`,\n model: model.name,\n });\n } else {\n modelByName.set(model.name, model);\n }\n }\n\n const enumNames = new Set<string>();\n for (const enumDef of schema.enums) {\n if (enumNames.has(enumDef.name)) {\n issues.push({\n rule: \"duplicate-enum\",\n message: `Duplicate enum name \"${enumDef.name}\"`,\n });\n } else {\n enumNames.add(enumDef.name);\n }\n if (enumDef.values.length === 0) {\n issues.push({\n rule: \"empty-enum\",\n message: `Enum \"${enumDef.name}\" has no values`,\n });\n }\n }\n\n for (const model of schema.models) {\n validateModel({ model, modelByName, enumNames, issues });\n }\n\n // Capability-gated index features, refused at validation — the earliest\n // knowable moment — instead of failing later at DDL time:\n // - partial predicates (where): postgres/pglite/sqlite only;\n // - UNIQUE NULLS NOT DISTINCT: postgres/pglite only (pg 15+), unique only.\n const provider = schema.datasource.provider;\n for (const model of schema.models) {\n for (const index of model.indexes) {\n if (index.where !== undefined && provider === \"mysql\") {\n issues.push({\n rule: \"partial-index-unsupported\",\n message: `Partial index (where) on \"${model.name}\" — mysql has no partial indexes; predicates are postgres/pglite/sqlite only`,\n model: model.name,\n });\n }\n if (index.nullsNotDistinct === true) {\n if (index.kind !== \"unique\") {\n issues.push({\n rule: \"nulls-not-distinct-non-unique\",\n message: `nullsNotDistinct on a non-unique index of \"${model.name}\" — the flag changes UNIQUE null semantics and means nothing elsewhere`,\n model: model.name,\n });\n }\n if (provider === \"sqlite\" || provider === \"mysql\") {\n issues.push({\n rule: \"nulls-not-distinct-unsupported\",\n message: `UNIQUE NULLS NOT DISTINCT on \"${model.name}\" — ${provider} treats NULLs as distinct and has no switch; the flag is postgres/pglite (15+) only`,\n model: model.name,\n });\n }\n }\n }\n }\n\n return issues;\n}\n\nfunction validateModel(params: {\n model: ModelIR;\n modelByName: Map<string, ModelIR>;\n enumNames: Set<string>;\n issues: ValidationIssue[];\n}): void {\n const { model, modelByName, enumNames, issues } = params;\n\n // Field + relation names share one namespace on the model.\n const memberNames = new Set<string>();\n for (const field of model.fields) {\n if (memberNames.has(field.name)) {\n issues.push({\n rule: \"duplicate-field\",\n message: `Duplicate field \"${field.name}\" on model \"${model.name}\"`,\n model: model.name,\n field: field.name,\n });\n }\n memberNames.add(field.name);\n\n if (isEnumType(field.type) && !enumNames.has(field.type.enum)) {\n issues.push({\n rule: \"unknown-enum\",\n message: `Field \"${model.name}.${field.name}\" references unknown enum \"${field.type.enum}\"`,\n model: model.name,\n field: field.name,\n });\n }\n\n // The runtime aliases its own projections (M2M stitch key `__vibe_parent`,\n // hidden order fields) under this prefix; a user column there would\n // collide and be silently misgrouped/stripped. `.prisma` field names\n // cannot start with `_`, but `@map` and hand-built IR can.\n const columnName = field.dbName ?? field.name;\n if (columnName.startsWith(RESERVED_COLUMN_PREFIX)) {\n issues.push({\n rule: \"reserved-column-prefix\",\n message:\n `Field \"${model.name}.${field.name}\" maps to column \"${columnName}\" — the \"${RESERVED_COLUMN_PREFIX}\" ` +\n `prefix is reserved for VibeORM's own projection aliases`,\n model: model.name,\n field: field.name,\n });\n }\n }\n\n for (const relation of model.relations) {\n if (memberNames.has(relation.name)) {\n issues.push({\n rule: \"duplicate-field\",\n message: `Relation \"${relation.name}\" collides with another member on model \"${model.name}\"`,\n model: model.name,\n field: relation.name,\n });\n }\n memberNames.add(relation.name);\n }\n\n // Primary key presence (views are exempt).\n const fieldNames = new Set(model.fields.map((f) => f.name));\n const hasIdField = model.fields.some((f) => f.isId);\n if (!model.isView && !hasIdField && model.primaryKey === undefined) {\n issues.push({\n rule: \"missing-id\",\n message: `Model \"${model.name}\" has no @id field and no composite primary key`,\n model: model.name,\n });\n }\n if (model.primaryKey !== undefined) {\n for (const pkField of model.primaryKey.fields) {\n if (!fieldNames.has(pkField)) {\n issues.push({\n rule: \"unknown-pk-field\",\n message: `Composite primary key on \"${model.name}\" references unknown field \"${pkField}\"`,\n model: model.name,\n field: pkField,\n });\n }\n }\n }\n\n // Relations: target exists, FK columns exist both sides, arities match.\n for (const relation of model.relations) {\n const target = modelByName.get(relation.targetModel);\n if (target === undefined) {\n issues.push({\n rule: \"unknown-relation-target\",\n message: `Relation \"${model.name}.${relation.name}\" targets unknown model \"${relation.targetModel}\"`,\n model: model.name,\n field: relation.name,\n });\n }\n\n const hasFields = relation.fields !== undefined && relation.fields.length > 0;\n const hasReferences = relation.references !== undefined && relation.references.length > 0;\n if (hasFields !== hasReferences) {\n issues.push({\n rule: \"relation-fields-mismatch\",\n message: `Relation \"${model.name}.${relation.name}\" must declare fields and references together`,\n model: model.name,\n field: relation.name,\n });\n }\n if (hasFields && hasReferences && relation.fields !== undefined && relation.references !== undefined) {\n if (relation.fields.length !== relation.references.length) {\n issues.push({\n rule: \"relation-fields-mismatch\",\n message: `Relation \"${model.name}.${relation.name}\" has ${relation.fields.length} fields but ${relation.references.length} references`,\n model: model.name,\n field: relation.name,\n });\n }\n for (const fkField of relation.fields) {\n if (!fieldNames.has(fkField)) {\n issues.push({\n rule: \"unknown-relation-field\",\n message: `Relation \"${model.name}.${relation.name}\" uses unknown field \"${fkField}\"`,\n model: model.name,\n field: relation.name,\n });\n }\n }\n if (target !== undefined) {\n const targetFieldNames = new Set(target.fields.map((f) => f.name));\n for (const refField of relation.references) {\n if (!targetFieldNames.has(refField)) {\n issues.push({\n rule: \"unknown-relation-reference\",\n message: `Relation \"${model.name}.${relation.name}\" references unknown field \"${relation.targetModel}.${refField}\"`,\n model: model.name,\n field: relation.name,\n });\n }\n }\n }\n }\n }\n\n // Checks: non-empty, and NAME-unique (names key the migration diff).\n const checkNames = new Set<string>();\n for (const check of model.checks ?? []) {\n if (check.name.trim() === \"\" || check.expression.trim() === \"\") {\n issues.push({\n rule: \"invalid-check\",\n message: `CHECK on \"${model.name}\" needs a non-empty name and expression`,\n model: model.name,\n });\n }\n if (checkNames.has(check.name)) {\n issues.push({\n rule: \"duplicate-check\",\n message: `Duplicate CHECK name \"${check.name}\" on \"${model.name}\" — names key the migration diff`,\n model: model.name,\n });\n }\n checkNames.add(check.name);\n }\n\n // Indexes reference real fields.\n for (const index of model.indexes) {\n for (const indexField of index.fields) {\n if (!fieldNames.has(indexField.name)) {\n issues.push({\n rule: \"unknown-index-field\",\n message: `Index on \"${model.name}\" references unknown field \"${indexField.name}\"`,\n model: model.name,\n field: indexField.name,\n });\n }\n }\n }\n}\n\n// ─── Assertion form ───────────────────────────────────────────────\n\n/** Throw VIBE_SCHEMA_INVALID (with all issues in meta) if the schema is invalid. */\nexport function assertValidSchemaIR(params: { schema: SchemaIR }): void {\n const issues = validateSchemaIR(params);\n if (issues.length > 0) {\n throw new VibeError({\n code: \"VIBE_SCHEMA_INVALID\",\n message: `Schema validation failed with ${issues.length} issue(s): ${issues\n .map((issue) => issue.message)\n .join(\"; \")}`,\n meta: { issues },\n });\n }\n}\n",
11
11
  "/**\n * Implicit many-to-many join-table convention (Prisma-compatible).\n *\n * ONE shared rule for every consumer — runtime query building, migrate DDL,\n * introspection round-trip — per LEARNINGS: implicit-M2M conventions must never\n * be re-implemented per consumer.\n *\n * Convention (matches Prisma and v1):\n * - Relation key: the explicit relation name when both sides declare one,\n * else `${A}To${B}` with A, B the two model names sorted lexicographically.\n * - Table name: `_` + relation key (`_PostToTag`, `_tags`).\n * - Columns: `\"A\"` references the lexicographically-first model's primary key,\n * `\"B\"` the other. Self-relations use the same model on both sides (`_XToX`).\n */\n\nexport type ImplicitJoinTable = {\n /** Join table name, including the leading underscore. */\n readonly tableName: string;\n /** Model whose primary key column `\"A\"` references (sorts first). */\n readonly modelA: string;\n /** Model whose primary key column `\"B\"` references. */\n readonly modelB: string;\n /** Column names, fixed by the convention. */\n readonly columnA: \"A\";\n readonly columnB: \"B\";\n};\n\n/**\n * Resolve the join table for an implicit many-to-many relation between two\n * models. Argument order does not matter; the convention sorts internally.\n */\nexport function implicitJoinTable(params: {\n modelA: string;\n modelB: string;\n /** Explicit @relation name shared by both sides, when present. */\n relationName?: string;\n}): ImplicitJoinTable {\n const sorted = [params.modelA, params.modelB].sort();\n const first = sorted[0] as string;\n const second = sorted[1] as string;\n const key = params.relationName ?? `${first}To${second}`;\n return {\n tableName: `_${key}`,\n modelA: first,\n modelB: second,\n columnA: \"A\",\n columnB: \"B\",\n };\n}\n"
12
12
  ],
13
- "mappings": ";;AAoBO,IAAM,WAA+B,CAAC,YAAY,UAAU,OAAO;AAGnE,SAAS,iBAAiB,CAAC,QAAyC;AAAA,EACzE,QAAQ,aAAa;AAAA,EACrB,QAAQ;AAAA,SACD;AAAA,SACA;AAAA,MACH,OAAO;AAAA,SACJ;AAAA,MACH,OAAO;AAAA,SACJ;AAAA,MACH,OAAO;AAAA;AAAA;AAsBN,SAAS,UAAU,CAAC,WAA8D;AAAA,EACvF,OAAO,OAAO,cAAc,YAAY,UAAU;AAAA;;AC5C7C,IAAM,mBAAmB;AAAA,EAE9B;AAAA,EAEA;AAAA,EAEA;AAAA,EAEA;AAAA,EAEA;AAAA,EAEA;AAAA,EAEA;AAAA,EAEA;AAAA,EAEA;AAAA,EAEA;AAAA,EAEA;AAAA,EAEA;AACF;AAAA;AAeO,MAAM,kBAAkB,MAAM;AAAA,EAC1B;AAAA,EACA;AAAA,EAET,WAAW,CAAC,QAKT;AAAA,IACD,MAAM,OAAO,SAAS,OAAO,UAAU,YAAY,YAAY,EAAE,OAAO,OAAO,MAAM,CAAC;AAAA,IACtF,KAAK,OAAO;AAAA,IACZ,KAAK,OAAO,OAAO;AAAA,IACnB,KAAK,OAAO,OAAO,QAAQ,CAAC;AAAA;AAEhC;AAKO,SAAS,qBAAqB,CAAC,QAIxB;AAAA,EACZ,QAAQ,SAAS,SAAS,SAAS;AAAA,EACnC,OAAO,IAAI,UAAU;AAAA,IACnB,MAAM;AAAA,IACN,SAAS,GAAG,+BAA+B,UAAU,SAAS,YAAY,KAAK,WAAK;AAAA,IACpF,MAAM,EAAE,SAAS,QAAQ;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,QAAQ;AAAA,MACrC,IAAI,CAAC,WAAW,IAAI,WAAW,IAAI,GAAG;AAAA,QACpC,OAAO,KAAK;AAAA,UACV,MAAM;AAAA,UACN,SAAS,aAAa,MAAM,mCAAmC,WAAW;AAAA,UAC1E,OAAO,MAAM;AAAA,UACb,OAAO,WAAW;AAAA,QACpB,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AAAA;AAMK,SAAS,mBAAmB,CAAC,QAAoC;AAAA,EACtE,MAAM,SAAS,iBAAiB,MAAM;AAAA,EACtC,IAAI,OAAO,SAAS,GAAG;AAAA,IACrB,MAAM,IAAI,UAAU;AAAA,MAClB,MAAM;AAAA,MACN,SAAS,iCAAiC,OAAO,oBAAoB,OAClE,IAAI,CAAC,UAAU,MAAM,OAAO,EAC5B,KAAK,IAAI;AAAA,MACZ,MAAM,EAAE,OAAO;AAAA,IACjB,CAAC;AAAA,EACH;AAAA;;ACjQK,SAAS,iBAAiB,CAAC,QAKZ;AAAA,EACpB,MAAM,SAAS,CAAC,OAAO,QAAQ,OAAO,MAAM,EAAE,KAAK;AAAA,EACnD,MAAM,QAAQ,OAAO;AAAA,EACrB,MAAM,SAAS,OAAO;AAAA,EACtB,MAAM,MAAM,OAAO,gBAAgB,GAAG,UAAU;AAAA,EAChD,OAAO;AAAA,IACL,WAAW,IAAI;AAAA,IACf,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,SAAS;AAAA,EACX;AAAA;",
14
+ "debugId": "4CBFDBE2B30F1BCC64756E2164756E21",
15
15
  "names": []
16
16
  }
package/dist/ir.d.ts CHANGED
@@ -114,6 +114,21 @@ export type IndexIR = {
114
114
  readonly fields: readonly IndexFieldIR[];
115
115
  /** Partial index predicate (raw SQL), postgres/sqlite only (capability-gated). */
116
116
  readonly where?: string;
117
+ /**
118
+ * `UNIQUE NULLS NOT DISTINCT` — NULLs collide instead of always passing.
119
+ * Unique indexes only; postgres 15+ (pglite included), capability-gated.
120
+ */
121
+ readonly nullsNotDistinct?: boolean;
122
+ };
123
+ /**
124
+ * A named CHECK constraint on a model. The expression is RAW SQL, rendered
125
+ * verbatim into DDL; the NAME keys the migration diff — engines re-serialize
126
+ * expressions on introspection, so expression text is never compared: change
127
+ * an expression by renaming its check.
128
+ */
129
+ export type CheckIR = {
130
+ readonly name: string;
131
+ readonly expression: string;
117
132
  };
118
133
  export type ModelIR = {
119
134
  readonly name: string;
@@ -122,6 +137,8 @@ export type ModelIR = {
122
137
  readonly fields: readonly FieldIR[];
123
138
  readonly relations: readonly RelationIR[];
124
139
  readonly indexes: readonly IndexIR[];
140
+ /** Named CHECK constraints (@@check) — name-keyed in the migration diff. */
141
+ readonly checks?: readonly CheckIR[];
125
142
  /** Composite primary key (@@id). Single-field PKs use FieldIR.isId. */
126
143
  readonly primaryKey?: {
127
144
  readonly fields: readonly string[];
package/dist/ir.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"ir.d.ts","sourceRoot":"","sources":["../src/ir.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,iDAAiD;AACjD,MAAM,MAAM,QAAQ,GAAG,YAAY,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEpE;;;GAGG;AACH,MAAM,MAAM,OAAO,GAAG,UAAU,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEtD,qEAAqE;AACrE,eAAO,MAAM,QAAQ,EAAE,SAAS,OAAO,EAAoC,CAAC;AAE5E,8DAA8D;AAC9D,wBAAgB,iBAAiB,CAAC,MAAM,EAAE;IAAE,QAAQ,EAAE,QAAQ,CAAA;CAAE,GAAG,OAAO,CAWzE;AAID,mCAAmC;AACnC,MAAM,MAAM,UAAU,GAClB,QAAQ,GACR,SAAS,GACT,KAAK,GACL,QAAQ,GACR,OAAO,GACP,SAAS,GACT,UAAU,GACV,MAAM,GACN,OAAO,CAAC;AAEZ,yEAAyE;AACzE,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG;IAAE,QAAQ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AgB,gBAAgB,CAAC,MAAM,EAAE;IAAE,MAAM,EAAE,QAAQ,CAAA;CAAE,GAAG,eAAe,EAAE,CAwChF;AA8JD,oFAAoF;AACpF,wBAAgB,mBAAmB,CAAC,MAAM,EAAE;IAAE,MAAM,EAAE,QAAQ,CAAA;CAAE,GAAG,IAAI,CAWtE"}
1
+ {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAW,QAAQ,EAAE,MAAM,SAAS,CAAC;AAMjD,MAAM,MAAM,eAAe,GAAG;IAC5B,yEAAyE;IACzE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAIF,kFAAkF;AAClF,wBAAgB,gBAAgB,CAAC,MAAM,EAAE;IAAE,MAAM,EAAE,QAAQ,CAAA;CAAE,GAAG,eAAe,EAAE,CAyEhF;AAkLD,oFAAoF;AACpF,wBAAgB,mBAAmB,CAAC,MAAM,EAAE;IAAE,MAAM,EAAE,QAAQ,CAAA;CAAE,GAAG,IAAI,CAWtE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibeorm/schema",
3
- "version": "2.0.0-alpha.2",
3
+ "version": "2.0.0-alpha.4",
4
4
  "description": "Canonical schema IR, validation, dialect/capability types, and error codes for VibeORM v2",
5
5
  "keywords": [
6
6
  "orm",
@@ -37,6 +37,7 @@
37
37
  "README.md"
38
38
  ],
39
39
  "engines": {
40
+ "node": ">=18",
40
41
  "bun": ">=1.2.0"
41
42
  },
42
43
  "publishConfig": {