@prisma/orm-extension-arktype-json 8.0.0-rc.2-dev.2 → 8.0.0-rc.20

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # @prisma/orm-extension-arktype-json
2
2
 
3
- JSON columns with a validated, typed shape for Prisma Next, built on [arktype](https://arktype.io).
3
+ JSON columns with a validated, typed shape for Prisma 8, built on [arktype](https://arktype.io).
4
4
 
5
5
  ```bash
6
6
  pnpm add @prisma/orm-extension-arktype-json
@@ -21,11 +21,3 @@ pnpm add @prisma/orm-extension-arktype-json
21
21
  Given an arktype `Type`, `arktypeJson(schema)` produces a column that stores `jsonb`, carries the schema's serialized form in `typeParams`, and renders the schema's TypeScript expression as the column's type in `contract.d.ts`. At runtime the framework rehydrates the schema from that serialized form and validates wire payloads on decode; a validation failure raises `RUNTIME.JSON_SCHEMA_VALIDATION_FAILED`. Encoding only checks JSON representability.
22
22
 
23
23
  JSON-with-schema is deliberately a per-library extension — this pack covers arktype; other validators get their own packs once each has a clean serialize-and-rehydrate story. Raw, untyped JSON columns stay in the Postgres target.
24
-
25
- ## Dependencies
26
-
27
- `@prisma/orm-framework` and `@prisma/orm-family-sql` at exact lockstep versions, plus `arktype` and `@standard-schema/spec`.
28
-
29
- `arktype` is an ordinary dependency, not a peer: a column carries its schema as a serialized form and the runtime rehydrates it from that, so this pack never compares schema objects with the copy an application authored against. The application's own `arktype` and this pack's may be separate instances.
30
-
31
- `@prisma/orm-target-postgres` is an exact-pinned **peer** dependency: the application supplies it, directly or through a facade, and everyone shares that one copy. A hard dependency would let an application upgrade the facade without upgrading this pack and end up with two target copies whose codec and operation registries have quietly diverged; as a peer that combination fails to install instead.
@@ -1,8 +1,10 @@
1
1
  import { CodecImpl, column } from "@prisma/orm-framework/components/codec";
2
- import { isRuntimeError, runtimeError } from "@prisma/orm-framework/components/runtime";
2
+ import { runtimeError } from "@prisma/orm-framework/components/runtime";
3
+ import { CastExpr } from "@prisma/orm-family-sql/relational-core/ast";
3
4
  import { PostgresCodecDescriptor, definePostgresCodecs } from "@prisma/orm-target-postgres/target/codec-descriptor";
5
+ import { pgJsonb, pgJsonbEnumRefusal } from "@prisma/orm-target-postgres/target/data-types";
4
6
  import { ArkErrors, ark, type } from "arktype";
5
- //#region ../../../3-extensions/arktype-json/dist/arktype-json-codec-C9r2qvJy.mjs
7
+ //#region ../../../3-extensions/arktype-json/dist/arktype-json-codec-CFt2Su_Z.mjs
6
8
  /** Codec id for arktype-backed JSON columns. Library-bound, not target-bound. */
7
9
  const ARKTYPE_JSON_CODEC_ID = "arktype/json@1";
8
10
  /** Native storage type backing the codec. JSONB on Postgres; binary, indexable. */
@@ -32,23 +34,8 @@ function serializeWire(value) {
32
34
  function serializeJson(value) {
33
35
  return JSON.parse(serializeWire(value));
34
36
  }
35
- function parseJsonText(wire) {
36
- try {
37
- return JSON.parse(wire);
38
- } catch {
39
- return;
40
- }
41
- }
42
37
  function decodeWireValue(schema, wire) {
43
- if (typeof wire !== "string") return validateSchema(schema, wire);
44
- try {
45
- return validateSchema(schema, wire);
46
- } catch (error) {
47
- if (!isRuntimeError(error) || error.code !== "RUNTIME.JSON_SCHEMA_VALIDATION_FAILED") throw error;
48
- const parsed = parseJsonText(wire);
49
- if (parsed === void 0) throw error;
50
- return validateSchema(schema, parsed);
51
- }
38
+ return validateSchema(schema, typeof wire === "string" ? JSON.parse(wire) : wire);
52
39
  }
53
40
  function rehydrateSchema(jsonIr) {
54
41
  let rehydrated;
@@ -80,20 +67,20 @@ function renderArktypeJsonOutputType(params) {
80
67
  var ArktypeJsonCodecClass = class extends CodecImpl {
81
68
  schema;
82
69
  constructor(descriptor, schema) {
83
- super(descriptor);
70
+ super(descriptor, pgJsonb);
84
71
  this.schema = schema;
85
72
  }
86
- async encode(value, _ctx) {
73
+ async toWire(value, _ctx) {
87
74
  return serializeWire(value);
88
75
  }
89
- async decode(wire, _ctx) {
76
+ async fromWire(wire, _ctx) {
90
77
  return decodeWireValue(this.schema, wire);
91
78
  }
92
- encodeJson(value) {
93
- return serializeJson(value);
79
+ fromDataTypeValue(value) {
80
+ return validateSchema(this.schema, value.value);
94
81
  }
95
- decodeJson(json) {
96
- return validateSchema(this.schema, json);
82
+ toDataTypeValue(input) {
83
+ return this.dataTypeValueOf(serializeJson(input));
97
84
  }
98
85
  };
99
86
  const arktypeJsonParamsSchema = type({
@@ -101,15 +88,14 @@ const arktypeJsonParamsSchema = type({
101
88
  jsonIr: "object"
102
89
  });
103
90
  var ArktypeJsonDescriptor = class extends PostgresCodecDescriptor {
104
- nativeType() {
105
- return ARKTYPE_JSON_NATIVE_TYPE;
106
- }
91
+ /** The document's JSON text, which `fromWire` parses as it parses a row; a document that is a string would otherwise reach it unquoted. */
107
92
  jsonProjection(expression) {
108
- return expression;
93
+ return CastExpr.as(expression, "text");
109
94
  }
95
+ dataType = pgJsonb.id;
110
96
  codecId = ARKTYPE_JSON_CODEC_ID;
111
97
  traits = ["equality"];
112
- targetTypes = [ARKTYPE_JSON_NATIVE_TYPE];
98
+ enumRefusal = pgJsonbEnumRefusal;
113
99
  paramsSchema = arktypeJsonParamsSchema;
114
100
  renderOutputType(params) {
115
101
  return renderArktypeJsonOutputType(params);
@@ -149,10 +135,10 @@ function arktypeJsonColumn(schema) {
149
135
  expression: schema.expression,
150
136
  jsonIr
151
137
  };
152
- return column((_ctx) => new ArktypeJsonCodecClass(arktypeJsonDescriptor, schema), arktypeJsonDescriptor.codecId, params, ARKTYPE_JSON_NATIVE_TYPE);
138
+ return column((_ctx) => new ArktypeJsonCodecClass(arktypeJsonDescriptor, schema), arktypeJsonDescriptor.codecId, params);
153
139
  }
154
140
  const codecDescriptors = definePostgresCodecs([arktypeJsonDescriptor]);
155
141
  //#endregion
156
142
  export { codecDescriptors as i, ARKTYPE_JSON_NATIVE_TYPE as n, arktypeJsonColumn as r, ARKTYPE_JSON_CODEC_ID as t };
157
143
 
158
- //# sourceMappingURL=arktype-json-codec-C9r2qvJy-CyWkAduB.mjs.map
144
+ //# sourceMappingURL=arktype-json-codec-CFt2Su_Z-CkZHpgqt.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arktype-json-codec-CFt2Su_Z-CkZHpgqt.mjs","names":[],"sources":["../../../../3-extensions/arktype-json/dist/arktype-json-codec-CFt2Su_Z.mjs"],"sourcesContent":["import { CodecImpl, column } from \"@internal/framework-components/codec\";\nimport { runtimeError } from \"@internal/framework-components/runtime\";\nimport { CastExpr } from \"@internal/sql-relational-core/ast\";\nimport { PostgresCodecDescriptor, definePostgresCodecs } from \"@internal/target-postgres/codec-descriptor\";\nimport { pgJsonb, pgJsonbEnumRefusal } from \"@internal/target-postgres/data-types\";\nimport { ArkErrors, ark, type } from \"arktype\";\n//#region src/core/arktype-json-codec.ts\n/** Codec id for arktype-backed JSON columns. Library-bound, not target-bound. */\nconst ARKTYPE_JSON_CODEC_ID = \"arktype/json@1\";\n/** Native storage type backing the codec. JSONB on Postgres; binary, indexable. */\nconst ARKTYPE_JSON_NATIVE_TYPE = \"jsonb\";\nfunction isArktypeSchemaLike(value) {\n\tif (typeof value !== \"function\") return false;\n\treturn typeof value.expression === \"string\";\n}\nfunction validateSchema(schema, value) {\n\tconst result = schema(value);\n\tif (result instanceof ArkErrors) throw runtimeError(\"RUNTIME.JSON_SCHEMA_VALIDATION_FAILED\", `arktype-json schema validation failed (decode): ${result.summary}`, {\n\t\tcodecId: ARKTYPE_JSON_CODEC_ID,\n\t\tissues: result.summary\n\t});\n\treturn result;\n}\nfunction serializeWire(value) {\n\tlet wire;\n\ttry {\n\t\twire = JSON.stringify(value);\n\t} catch (error) {\n\t\tthrow Object.assign(runtimeError(\"RUNTIME.ENCODE_FAILED\", `arktype-json value could not be serialized to JSON (codecId: ${ARKTYPE_JSON_CODEC_ID})`, { codecId: ARKTYPE_JSON_CODEC_ID }), { cause: error });\n\t}\n\tif (typeof wire !== \"string\") throw runtimeError(\"RUNTIME.ENCODE_FAILED\", `arktype-json value is not representable as JSON (codecId: ${ARKTYPE_JSON_CODEC_ID})`, { codecId: ARKTYPE_JSON_CODEC_ID });\n\treturn wire;\n}\nfunction serializeJson(value) {\n\treturn JSON.parse(serializeWire(value));\n}\nfunction decodeWireValue(schema, wire) {\n\treturn validateSchema(schema, typeof wire === \"string\" ? JSON.parse(wire) : wire);\n}\nfunction rehydrateSchema(jsonIr) {\n\tlet rehydrated;\n\ttry {\n\t\trehydrated = ark.schema(jsonIr);\n\t} catch (error) {\n\t\tthrow runtimeError(\n\t\t\t\"RUNTIME.JSON_SCHEMA_VALIDATION_FAILED\",\n\t\t\t/* c8 ignore next — the `String(error)` fallback covers throws of non-Error values; arktype only throws Error subclasses, so this branch is defensive only. */\n\t\t\t`Failed to rehydrate arktype schema from contract IR: ${error instanceof Error ? error.message : String(error)}`,\n\t\t\t{\n\t\t\t\tcodecId: ARKTYPE_JSON_CODEC_ID,\n\t\t\t\tjsonIr\n\t\t\t}\n\t\t);\n\t}\n\t/* c8 ignore start — defensive: ark.schema either throws (handled above) or returns a callable Type with `expression: string`. The structural guard is kept so a future ark internal change can't silently slip a non-callable past us. */\n\tif (!isArktypeSchemaLike(rehydrated)) throw runtimeError(\"RUNTIME.JSON_SCHEMA_VALIDATION_FAILED\", `Rehydrated arktype schema does not have the expected callable + 'expression: string' shape (codecId: ${ARKTYPE_JSON_CODEC_ID})`, {\n\t\tcodecId: ARKTYPE_JSON_CODEC_ID,\n\t\tjsonIr\n\t});\n\t/* c8 ignore stop */\n\treturn rehydrated;\n}\nfunction renderArktypeJsonOutputType(params) {\n\tconst expression = params.expression.trim();\n\treturn expression.length > 0 ? expression : \"unknown\";\n}\nvar ArktypeJsonCodecClass = class extends CodecImpl {\n\tschema;\n\tconstructor(descriptor, schema) {\n\t\tsuper(descriptor, pgJsonb);\n\t\tthis.schema = schema;\n\t}\n\tasync toWire(value, _ctx) {\n\t\treturn serializeWire(value);\n\t}\n\tasync fromWire(wire, _ctx) {\n\t\treturn decodeWireValue(this.schema, wire);\n\t}\n\tfromDataTypeValue(value) {\n\t\treturn validateSchema(this.schema, value.value);\n\t}\n\ttoDataTypeValue(input) {\n\t\treturn this.dataTypeValueOf(serializeJson(input));\n\t}\n};\nconst arktypeJsonParamsSchema = type({\n\texpression: \"string\",\n\tjsonIr: \"object\"\n});\nvar ArktypeJsonDescriptor = class extends PostgresCodecDescriptor {\n\t/** The document's JSON text, which `fromWire` parses as it parses a row; a document that is a string would otherwise reach it unquoted. */\n\tjsonProjection(expression) {\n\t\treturn CastExpr.as(expression, \"text\");\n\t}\n\tdataType = pgJsonb.id;\n\tcodecId = ARKTYPE_JSON_CODEC_ID;\n\ttraits = [\"equality\"];\n\tenumRefusal = pgJsonbEnumRefusal;\n\tparamsSchema = arktypeJsonParamsSchema;\n\trenderOutputType(params) {\n\t\treturn renderArktypeJsonOutputType(params);\n\t}\n\tfactory(params) {\n\t\tconst schema = rehydrateSchema(params.jsonIr);\n\t\tconst rehydratedExpression = schema.expression;\n\t\tif (typeof rehydratedExpression === \"string\" && rehydratedExpression !== params.expression) throw runtimeError(\"RUNTIME.TYPE_PARAMS_INVALID\", `arktype-json: typeParams.expression (${params.expression}) does not match the rehydrated schema's expression (${rehydratedExpression}). The contract was likely emitted against a different arktype version or hand-edited; re-run \\`pnpm emit\\` to regenerate.`, {\n\t\t\tcodecId: ARKTYPE_JSON_CODEC_ID,\n\t\t\tserializedExpression: params.expression,\n\t\t\trehydratedExpression\n\t\t});\n\t\treturn () => new ArktypeJsonCodecClass(this, schema);\n\t}\n};\nconst arktypeJsonDescriptor = new ArktypeJsonDescriptor();\n/**\n* Per-codec column helper for `arktype/json@1`. Method-level generic over `S extends Type<unknown>` so the column site preserves the schema's inferred TS type in the resolved codec (`ArktypeJsonCodecClass<S['infer']>`). Bypasses `descriptor.factory` because `S` is only available at the column-author site; constructs the typed codec directly with the closure-captured schema.\n*\n* Eager serialization at this call site captures `expression` (for the emit-path renderer) and `jsonIr` (for runtime rehydration via the descriptor's factory).\n*\n* @throws `CONTRACT.ARGUMENT_INVALID` if the schema doesn't expose `expression` and `json` fields (i.e. is not an arktype `Type`). Validates the schema shape at the call site so configuration errors surface during contract authoring, not at runtime.\n*/\nfunction arktypeJsonColumn(schema) {\n\tif (!isArktypeSchemaLike(schema)) throw runtimeError(\"CONTRACT.ARGUMENT_INVALID\", typeof schema !== \"function\" ? \"arktypeJsonColumn(schema) expects a callable arktype Type.\" : \"arktypeJsonColumn(schema) expects an arktype Type (missing `expression: string`).\", {\n\t\thelperPath: \"arktypeJsonColumn\",\n\t\texpected: \"arktype Type\",\n\t\treceived: typeof schema\n\t});\n\tconst jsonIr = schema.json;\n\tif (jsonIr === null || typeof jsonIr !== \"object\") throw runtimeError(\"CONTRACT.ARGUMENT_INVALID\", \"arktypeJsonColumn(schema) expects an arktype Type (missing `json` IR).\", {\n\t\thelperPath: \"arktypeJsonColumn\",\n\t\texpected: \"arktype Type\",\n\t\treceived: typeof jsonIr\n\t});\n\tconst params = {\n\t\texpression: schema.expression,\n\t\tjsonIr\n\t};\n\treturn column((_ctx) => new ArktypeJsonCodecClass(arktypeJsonDescriptor, schema), arktypeJsonDescriptor.codecId, params);\n}\nconst codecDescriptors = definePostgresCodecs([arktypeJsonDescriptor]);\n//#endregion\nexport { codecDescriptors as i, ARKTYPE_JSON_NATIVE_TYPE as n, arktypeJsonColumn as r, ARKTYPE_JSON_CODEC_ID as t };\n\n//# sourceMappingURL=arktype-json-codec-CFt2Su_Z.mjs.map"],"mappings":";;;;;;;;AAQA,MAAM,wBAAwB;;AAE9B,MAAM,2BAA2B;AACjC,SAAS,oBAAoB,OAAO;CACnC,IAAI,OAAO,UAAU,YAAY,OAAO;CACxC,OAAO,OAAO,MAAM,eAAe;AACpC;AACA,SAAS,eAAe,QAAQ,OAAO;CACtC,MAAM,SAAS,OAAO,KAAK;CAC3B,IAAI,kBAAkB,WAAW,MAAM,aAAa,yCAAyC,mDAAmD,OAAO,WAAW;EACjK,SAAS;E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sB,SAAS,MAAM;AACxH;AACA,MAAM,mBAAmB,qBAAqB,CAAC,qBAAqB,CAAC"}
@@ -1,10 +1,10 @@
1
- import { CodecCallContext, CodecImpl, CodecInstanceContext, ColumnSpec } from "@prisma/orm-framework/components/codec";
1
+ import { CodecCallContext, CodecImpl, CodecInstanceContext, ColumnSpec, DataTypeValue } from "@prisma/orm-framework/components/codec";
2
+ import { ProjectionExpr } from "@prisma/orm-family-sql/relational-core/ast";
2
3
  import { PostgresCodecDescriptor } from "@prisma/orm-target-postgres/target/codec-descriptor";
3
4
  import { Type } from "arktype";
4
5
  import { JsonValue } from "@prisma/orm-framework/contract/types";
5
- import { ProjectionExpr } from "@prisma/orm-family-sql/relational-core/ast";
6
6
  import { StandardSchemaV1 } from "@standard-schema/spec";
7
- //#region ../../../3-extensions/arktype-json/dist/arktype-json-codec-DOJVP1RC.d.mts
7
+ //#region ../../../3-extensions/arktype-json/dist/arktype-json-codec-DNqcgzuj.d.mts
8
8
  //#region src/core/arktype-json-codec.d.ts
9
9
  /** Codec id for arktype-backed JSON columns. Library-bound, not target-bound. */
10
10
  declare const ARKTYPE_JSON_CODEC_ID: "arktype/json@1";
@@ -30,17 +30,18 @@ type ArktypeSchemaLike = ((value: unknown) => unknown) & {
30
30
  declare class ArktypeJsonCodecClass<TInferred> extends CodecImpl<typeof ARKTYPE_JSON_CODEC_ID, readonly ['equality'], string | JsonValue, TInferred> {
31
31
  private readonly schema;
32
32
  constructor(descriptor: ArktypeJsonDescriptor, schema: ArktypeSchemaLike);
33
- encode(value: TInferred, _ctx: CodecCallContext): Promise<string>;
34
- decode(wire: string | JsonValue, _ctx: CodecCallContext): Promise<TInferred>;
35
- encodeJson(value: TInferred): JsonValue;
36
- decodeJson(json: JsonValue): TInferred;
33
+ toWire(value: TInferred, _ctx: CodecCallContext): Promise<string>;
34
+ fromWire(wire: string | JsonValue, _ctx: CodecCallContext): Promise<TInferred>;
35
+ fromDataTypeValue(value: DataTypeValue): TInferred;
36
+ toDataTypeValue(input: TInferred): DataTypeValue;
37
37
  }
38
38
  declare class ArktypeJsonDescriptor extends PostgresCodecDescriptor<ArktypeJsonTypeParams> {
39
- protected nativeType(): string;
39
+ /** The document's JSON text, which `fromWire` parses as it parses a row; a document that is a string would otherwise reach it unquoted. */
40
40
  protected jsonProjection(expression: ProjectionExpr): ProjectionExpr;
41
+ readonly dataType: import("@prisma/orm-framework/components/codec").DataTypeId;
41
42
  readonly codecId: "arktype/json@1";
42
43
  readonly traits: readonly ["equality"];
43
- readonly targetTypes: readonly ["jsonb"];
44
+ readonly enumRefusal = "A CHECK lists a string member as SQL text, which PostgreSQL reads as the JSON text of a document rather than as a string, and a number member as a number, which PostgreSQL cannot compare with jsonb, so no CHECK can compare a value with the members. No enum can use a jsonb codec; use a text enum instead.";
44
45
  readonly paramsSchema: StandardSchemaV1<ArktypeJsonTypeParams>;
45
46
  renderOutputType(params: ArktypeJsonTypeParams): string;
46
47
  factory(params: ArktypeJsonTypeParams): (ctx: CodecInstanceContext) => ArktypeJsonCodecClass<unknown>;
@@ -59,4 +60,4 @@ declare function arktypeJsonColumn<S extends Type<unknown>>(schema: S): ColumnSp
59
60
  type ArktypeJsonCodec<TInferred> = ArktypeJsonCodecClass<TInferred>;
60
61
  //#endregion
61
62
  export { ArktypeJsonTypeParams as a, ArktypeJsonDescriptor as i, ARKTYPE_JSON_NATIVE_TYPE as n, arktypeJsonColumn as o, ArktypeJsonCodec as r, ARKTYPE_JSON_CODEC_ID as t };
62
- //# sourceMappingURL=arktype-json-codec-DOJVP1RC-OOrsE-hB.d.mts.map
63
+ //# sourceMappingURL=arktype-json-codec-DNqcgzuj-CyljCapB.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arktype-json-codec-DNqcgzuj-CyljCapB.d.mts","names":[],"sources":["../../../../3-extensions/arktype-json/dist/arktype-json-codec-DNqcgzuj.d.mts"],"mappings":";;;;;;;;;cAQc;;cAEA;;;;KAIT;;;;WAIM;;;;WAIA;;KAEN,sBAAsB;WAChB;WACA;;cAEG,sBAAsB,mBAAmB,iBAAiB,uDAAuD,WAAW;mBACvH;EACjB,YAAY,YAAY,uBAAuB,QAAQ;EACvD,OAAO,OAAO,WAAW,MAAM,mBAAmB;EAClD,SAAS,eAAe,WAAW,MAAM,mBAAmB,QAAQ;EACpE,kBAAkB,OAAO,gBAAgB;EACzC,gBAAgB,OAAO,YAAY;;cAEvB,8BAA8B,wBAAwB;;YAExD,eAAe,YAAY,iBAAiB;WAC7C,yDAAyD;WACzD;WACA;WACA;WACA,cAAc,iBAAiB;EACxC,iBAAiB,QAAQ;EACzB,QAAQ,QAAQ,yBAAyB,KAAK,yBAAyB;;;;;;;;;iBASxD,kBAAkB,UAAU,eAAe,QAAQ,IAAI,WAAW,sBAAsB,aAAa;;;;KAIjH,iBAAiB,aAAa,sBAAsB"}
package/dist/codecs.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as ArktypeJsonTypeParams, i as ArktypeJsonDescriptor, n as ARKTYPE_JSON_NATIVE_TYPE, o as arktypeJsonColumn, r as ArktypeJsonCodec, t as ARKTYPE_JSON_CODEC_ID } from "./arktype-json-codec-DOJVP1RC-OOrsE-hB.mjs";
1
+ import { a as ArktypeJsonTypeParams, i as ArktypeJsonDescriptor, n as ARKTYPE_JSON_NATIVE_TYPE, o as arktypeJsonColumn, r as ArktypeJsonCodec, t as ARKTYPE_JSON_CODEC_ID } from "./arktype-json-codec-DNqcgzuj-CyljCapB.mjs";
2
2
  import { CodecDescriptorRegistry } from "@prisma/orm-family-sql/relational-core/query-lane-context";
3
3
  //#region ../../../3-extensions/arktype-json/dist/codecs.d.mts
4
4
  //#region src/core/registry.d.ts
package/dist/codecs.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { n as ARKTYPE_JSON_NATIVE_TYPE, r as arktypeJsonColumn, t as ARKTYPE_JSON_CODEC_ID } from "./arktype-json-codec-C9r2qvJy-CyWkAduB.mjs";
2
- import { t as arktypeJsonCodecRegistry } from "./registry-Di7rBVdI-sgB_8xDd.mjs";
1
+ import { n as ARKTYPE_JSON_NATIVE_TYPE, r as arktypeJsonColumn, t as ARKTYPE_JSON_CODEC_ID } from "./arktype-json-codec-CFt2Su_Z-CkZHpgqt.mjs";
2
+ import { t as arktypeJsonCodecRegistry } from "./registry-CCrI2MVx-Cr3ZJU3S.mjs";
3
3
  export { ARKTYPE_JSON_CODEC_ID, ARKTYPE_JSON_NATIVE_TYPE, arktypeJsonCodecRegistry, arktypeJsonColumn };
@@ -1,2 +1,2 @@
1
- import { a as ArktypeJsonTypeParams, o as arktypeJsonColumn, r as ArktypeJsonCodec } from "./arktype-json-codec-DOJVP1RC-OOrsE-hB.mjs";
1
+ import { a as ArktypeJsonTypeParams, o as arktypeJsonColumn, r as ArktypeJsonCodec } from "./arktype-json-codec-DNqcgzuj-CyljCapB.mjs";
2
2
  export { type ArktypeJsonCodec, type ArktypeJsonTypeParams, arktypeJsonColumn as arktypeJson };
@@ -1,2 +1,2 @@
1
- import { r as arktypeJsonColumn } from "./arktype-json-codec-C9r2qvJy-CyWkAduB.mjs";
1
+ import { r as arktypeJsonColumn } from "./arktype-json-codec-CFt2Su_Z-CkZHpgqt.mjs";
2
2
  export { arktypeJsonColumn as arktypeJson };
package/dist/control.mjs CHANGED
@@ -1,16 +1,7 @@
1
- import { t as ARKTYPE_JSON_CODEC_ID } from "./arktype-json-codec-C9r2qvJy-CyWkAduB.mjs";
2
- import { t as arktypeJsonPackMeta } from "./pack-meta-sCd-w62R-BJrOMFwR.mjs";
1
+ import { t as arktypeJsonPackMeta } from "./pack-meta-tj2DKZsH-BbaMFasm.mjs";
3
2
  //#region ../../../3-extensions/arktype-json/dist/control.mjs
4
- const arktypeJsonControlPlaneHooks = { expandNativeType: ({ nativeType }) => nativeType };
5
3
  const arktypeJsonExtensionDescriptor = {
6
4
  ...arktypeJsonPackMeta,
7
- types: {
8
- ...arktypeJsonPackMeta.types,
9
- codecTypes: {
10
- ...arktypeJsonPackMeta.types.codecTypes,
11
- controlPlaneHooks: { [ARKTYPE_JSON_CODEC_ID]: arktypeJsonControlPlaneHooks }
12
- }
13
- },
14
5
  create: () => ({
15
6
  familyId: "sql",
16
7
  targetId: "postgres"
@@ -1 +1 @@
1
- {"version":3,"file":"control.mjs","names":[],"sources":["../../../../3-extensions/arktype-json/dist/control.mjs"],"sourcesContent":["import { t as ARKTYPE_JSON_CODEC_ID } from \"./arktype-json-codec-C9r2qvJy.mjs\";\nimport { t as arktypeJsonPackMeta } from \"./pack-meta-sCd-w62R.mjs\";\n//#region src/exports/control.ts\nconst arktypeJsonControlPlaneHooks = { expandNativeType: ({ nativeType }) => nativeType };\nconst arktypeJsonExtensionDescriptor = {\n\t...arktypeJsonPackMeta,\n\ttypes: {\n\t\t...arktypeJsonPackMeta.types,\n\t\tcodecTypes: {\n\t\t\t...arktypeJsonPackMeta.types.codecTypes,\n\t\t\tcontrolPlaneHooks: { [ARKTYPE_JSON_CODEC_ID]: arktypeJsonControlPlaneHooks }\n\t\t}\n\t},\n\tcreate: () => ({\n\t\tfamilyId: \"sql\",\n\t\ttargetId: \"postgres\"\n\t})\n};\n//#endregion\nexport { arktypeJsonExtensionDescriptor, arktypeJsonExtensionDescriptor as default };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;AAGA,MAAM,+BAA+B,EAAE,mBAAmB,EAAE,iBAAiB,WAAW;AACxF,MAAM,iCAAiC;CACtC,GAAG;CACH,OAAO;EACN,GAAG,oBAAoB;EACvB,YAAY;GACX,GAAG,oBAAoB,MAAM;GAC7B,mBAAmB,GAAG,wBAAwB,6BAA6B;EAC5E;CACD;CACA,eAAe;EACd,UAAU;EACV,UAAU;CACX;AACD"}
1
+ {"version":3,"file":"control.mjs","names":[],"sources":["../../../../3-extensions/arktype-json/dist/control.mjs"],"sourcesContent":["import { t as arktypeJsonPackMeta } from \"./pack-meta-tj2DKZsH.mjs\";\n//#region src/exports/control.ts\nconst arktypeJsonExtensionDescriptor = {\n\t...arktypeJsonPackMeta,\n\tcreate: () => ({\n\t\tfamilyId: \"sql\",\n\t\ttargetId: \"postgres\"\n\t})\n};\n//#endregion\nexport { arktypeJsonExtensionDescriptor, arktypeJsonExtensionDescriptor as default };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;AAEA,MAAM,iCAAiC;CACtC,GAAG;CACH,eAAe;EACd,UAAU;EACV,UAAU;CACX;AACD"}
@@ -0,0 +1,25 @@
1
+ import { t as arktypeJsonCodecRegistry } from "./registry-CCrI2MVx-Cr3ZJU3S.mjs";
2
+ //#region ../../../3-extensions/arktype-json/dist/pack-meta-tj2DKZsH.mjs
3
+ /**
4
+ * Public pack metadata. The phantom `__codecTypes` field threads the codec-types map's literal type into the pack ref so contract-builder generics can pick it up; it is never accessed at runtime.
5
+ */
6
+ const arktypeJsonPackMeta = {
7
+ kind: "extension",
8
+ id: "arktype-json",
9
+ familyId: "sql",
10
+ targetId: "postgres",
11
+ version: "0.0.1",
12
+ capabilities: {},
13
+ types: { codecTypes: {
14
+ codecDescriptors: Array.from(arktypeJsonCodecRegistry.values()),
15
+ import: {
16
+ package: "@internal/extension-arktype-json/codec-types",
17
+ named: "CodecTypes",
18
+ alias: "ArktypeJsonTypes"
19
+ }
20
+ } }
21
+ };
22
+ //#endregion
23
+ export { arktypeJsonPackMeta as t };
24
+
25
+ //# sourceMappingURL=pack-meta-tj2DKZsH-BbaMFasm.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pack-meta-tj2DKZsH-BbaMFasm.mjs","names":[],"sources":["../../../../3-extensions/arktype-json/dist/pack-meta-tj2DKZsH.mjs"],"sourcesContent":["import { t as arktypeJsonCodecRegistry } from \"./registry-CCrI2MVx.mjs\";\n/**\n* Public pack metadata. The phantom `__codecTypes` field threads the codec-types map's literal type into the pack ref so contract-builder generics can pick it up; it is never accessed at runtime.\n*/\nconst arktypeJsonPackMeta = {\n\tkind: \"extension\",\n\tid: \"arktype-json\",\n\tfamilyId: \"sql\",\n\ttargetId: \"postgres\",\n\tversion: \"0.0.1\",\n\tcapabilities: {},\n\ttypes: { codecTypes: {\n\t\tcodecDescriptors: Array.from(arktypeJsonCodecRegistry.values()),\n\t\timport: {\n\t\t\tpackage: \"@internal/extension-arktype-json/codec-types\",\n\t\t\tnamed: \"CodecTypes\",\n\t\t\talias: \"ArktypeJsonTypes\"\n\t\t}\n\t} }\n};\n//#endregion\nexport { arktypeJsonPackMeta as t };\n\n//# sourceMappingURL=pack-meta-tj2DKZsH.mjs.map"],"mappings":";;;;;AAIA,MAAM,sBAAsB;CAC3B,MAAM;CACN,IAAI;CACJ,UAAU;CACV,UAAU;CACV,SAAS;CACT,cAAc,CAAC;CACf,OAAO,EAAE,YAAY;EACpB,kBAAkB,MAAM,KAAK,yBAAyB,OAAO,CAAC;EAC9D,QAAQ;GACP,SAAS;GACT,OAAO;GACP,OAAO;EACR;CACD,EAAE;AACH"}
package/dist/pack.d.mts CHANGED
@@ -17,12 +17,6 @@ declare const arktypeJsonPackMetaBase: {
17
17
  readonly alias: "ArktypeJsonTypes";
18
18
  };
19
19
  };
20
- readonly storage: readonly [{
21
- readonly typeId: "arktype/json@1";
22
- readonly familyId: "sql";
23
- readonly targetId: "postgres";
24
- readonly nativeType: "jsonb";
25
- }];
26
20
  };
27
21
  };
28
22
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"pack.d.mts","names":[],"sources":["../../../../3-extensions/arktype-json/dist/pack.d.mts"],"mappings":";;;cAEc;WACH;WACA;WACA;WACA;WACA;WACA;WACA;aACE;eACE,iEAAiE;eACjE;iBACE;iBACA;iBACA;;;aAGJ;eACE;eACA;eACA;eACA;;;;;;;cAOD,4BAA4B;WAC/B,eAAe"}
1
+ {"version":3,"file":"pack.d.mts","names":[],"sources":["../../../../3-extensions/arktype-json/dist/pack.d.mts"],"mappings":";;;cAEc;WACH;WACA;WACA;WACA;WACA;WACA;WACA;aACE;eACE,iEAAiE;eACjE;iBACE;iBACA;iBACA;;;;;;;;cAQH,4BAA4B;WAC/B,eAAe"}
package/dist/pack.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { t as arktypeJsonPackMeta } from "./pack-meta-sCd-w62R-BJrOMFwR.mjs";
1
+ import { t as arktypeJsonPackMeta } from "./pack-meta-tj2DKZsH-BbaMFasm.mjs";
2
2
  export { arktypeJsonPackMeta, arktypeJsonPackMeta as default };
@@ -1,6 +1,6 @@
1
- import { i as codecDescriptors } from "./arktype-json-codec-C9r2qvJy-CyWkAduB.mjs";
1
+ import { i as codecDescriptors } from "./arktype-json-codec-CFt2Su_Z-CkZHpgqt.mjs";
2
2
  import { buildCodecDescriptorRegistry } from "@prisma/orm-family-sql/relational-core/codec-descriptor-registry";
3
- //#region ../../../3-extensions/arktype-json/dist/registry-Di7rBVdI.mjs
3
+ //#region ../../../3-extensions/arktype-json/dist/registry-CCrI2MVx.mjs
4
4
  /**
5
5
  * Registry of every codec descriptor shipped by `@internal/extension-arktype-json`.
6
6
  *
@@ -10,4 +10,4 @@ const arktypeJsonCodecRegistry = buildCodecDescriptorRegistry(codecDescriptors);
10
10
  //#endregion
11
11
  export { arktypeJsonCodecRegistry as t };
12
12
 
13
- //# sourceMappingURL=registry-Di7rBVdI-sgB_8xDd.mjs.map
13
+ //# sourceMappingURL=registry-CCrI2MVx-Cr3ZJU3S.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"registry-Di7rBVdI-sgB_8xDd.mjs","names":[],"sources":["../../../../3-extensions/arktype-json/dist/registry-Di7rBVdI.mjs"],"sourcesContent":["import { i as codecDescriptors } from \"./arktype-json-codec-C9r2qvJy.mjs\";\nimport { buildCodecDescriptorRegistry } from \"@internal/sql-relational-core/codec-descriptor-registry\";\n//#region src/core/registry.ts\n/**\n* Registry of every codec descriptor shipped by `@internal/extension-arktype-json`.\n*\n* Public consumer surface for the arktype-json codec set. Currently a single entry (`arktype/json@1`); the registry shape stays consistent with the other codec-shipping packages so consumers don't need to special-case extensions. See ADR 208.\n*/\nconst arktypeJsonCodecRegistry = buildCodecDescriptorRegistry(codecDescriptors);\n//#endregion\nexport { arktypeJsonCodecRegistry as t };\n\n//# sourceMappingURL=registry-Di7rBVdI.mjs.map"],"mappings":";;;;;;;;AAQA,MAAM,2BAA2B,6BAA6B,gBAAgB"}
1
+ {"version":3,"file":"registry-CCrI2MVx-Cr3ZJU3S.mjs","names":[],"sources":["../../../../3-extensions/arktype-json/dist/registry-CCrI2MVx.mjs"],"sourcesContent":["import { i as codecDescriptors } from \"./arktype-json-codec-CFt2Su_Z.mjs\";\nimport { buildCodecDescriptorRegistry } from \"@internal/sql-relational-core/codec-descriptor-registry\";\n//#region src/core/registry.ts\n/**\n* Registry of every codec descriptor shipped by `@internal/extension-arktype-json`.\n*\n* Public consumer surface for the arktype-json codec set. Currently a single entry (`arktype/json@1`); the registry shape stays consistent with the other codec-shipping packages so consumers don't need to special-case extensions. See ADR 208.\n*/\nconst arktypeJsonCodecRegistry = buildCodecDescriptorRegistry(codecDescriptors);\n//#endregion\nexport { arktypeJsonCodecRegistry as t };\n\n//# sourceMappingURL=registry-CCrI2MVx.mjs.map"],"mappings":";;;;;;;;AAQA,MAAM,2BAA2B,6BAA6B,gBAAgB"}
package/dist/runtime.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { t as arktypeJsonCodecRegistry } from "./registry-Di7rBVdI-sgB_8xDd.mjs";
2
- import { t as arktypeJsonPackMeta } from "./pack-meta-sCd-w62R-BJrOMFwR.mjs";
1
+ import { t as arktypeJsonCodecRegistry } from "./registry-CCrI2MVx-Cr3ZJU3S.mjs";
2
+ import { t as arktypeJsonPackMeta } from "./pack-meta-tj2DKZsH-BbaMFasm.mjs";
3
3
  //#region ../../../3-extensions/arktype-json/dist/runtime.mjs
4
4
  const arktypeJsonRuntimeDescriptor = {
5
5
  kind: "extension",
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.mjs","names":[],"sources":["../../../../3-extensions/arktype-json/dist/runtime.mjs"],"sourcesContent":["import { t as arktypeJsonCodecRegistry } from \"./registry-Di7rBVdI.mjs\";\nimport { t as arktypeJsonPackMeta } from \"./pack-meta-sCd-w62R.mjs\";\n//#region src/exports/runtime.ts\nconst arktypeJsonRuntimeDescriptor = {\n\tkind: \"extension\",\n\tid: arktypeJsonPackMeta.id,\n\tversion: arktypeJsonPackMeta.version,\n\tfamilyId: \"sql\",\n\ttargetId: \"postgres\",\n\ttypes: { codecTypes: { codecDescriptors: Array.from(arktypeJsonCodecRegistry.values()) } },\n\tcodecs: () => Array.from(arktypeJsonCodecRegistry.values()),\n\tcreate() {\n\t\treturn {\n\t\t\tfamilyId: \"sql\",\n\t\t\ttargetId: \"postgres\"\n\t\t};\n\t}\n};\n//#endregion\nexport { arktypeJsonRuntimeDescriptor, arktypeJsonRuntimeDescriptor as default };\n\n//# sourceMappingURL=runtime.mjs.map"],"mappings":";;;AAGA,MAAM,+BAA+B;CACpC,MAAM;CACN,IAAI,oBAAoB;CACxB,SAAS,oBAAoB;CAC7B,UAAU;CACV,UAAU;CACV,OAAO,EAAE,YAAY,EAAE,kBAAkB,MAAM,KAAK,yBAAyB,OAAO,CAAC,EAAE,EAAE;CACzF,cAAc,MAAM,KAAK,yBAAyB,OAAO,CAAC;CAC1D,SAAS;EACR,OAAO;GACN,UAAU;GACV,UAAU;EACX;CACD;AACD"}
1
+ {"version":3,"file":"runtime.mjs","names":[],"sources":["../../../../3-extensions/arktype-json/dist/runtime.mjs"],"sourcesContent":["import { t as arktypeJsonCodecRegistry } from \"./registry-CCrI2MVx.mjs\";\nimport { t as arktypeJsonPackMeta } from \"./pack-meta-tj2DKZsH.mjs\";\n//#region src/exports/runtime.ts\nconst arktypeJsonRuntimeDescriptor = {\n\tkind: \"extension\",\n\tid: arktypeJsonPackMeta.id,\n\tversion: arktypeJsonPackMeta.version,\n\tfamilyId: \"sql\",\n\ttargetId: \"postgres\",\n\ttypes: { codecTypes: { codecDescriptors: Array.from(arktypeJsonCodecRegistry.values()) } },\n\tcodecs: () => Array.from(arktypeJsonCodecRegistry.values()),\n\tcreate() {\n\t\treturn {\n\t\t\tfamilyId: \"sql\",\n\t\t\ttargetId: \"postgres\"\n\t\t};\n\t}\n};\n//#endregion\nexport { arktypeJsonRuntimeDescriptor, arktypeJsonRuntimeDescriptor as default };\n\n//# sourceMappingURL=runtime.mjs.map"],"mappings":";;;AAGA,MAAM,+BAA+B;CACpC,MAAM;CACN,IAAI,oBAAoB;CACxB,SAAS,oBAAoB;CAC7B,UAAU;CACV,UAAU;CACV,OAAO,EAAE,YAAY,EAAE,kBAAkB,MAAM,KAAK,yBAAyB,OAAO,CAAC,EAAE,EAAE;CACzF,cAAc,MAAM,KAAK,yBAAyB,OAAO,CAAC;CAC1D,SAAS;EACR,OAAO;GACN,UAAU;GACV,UAAU;EACX;CACD;AACD"}
package/package.json CHANGED
@@ -1,29 +1,29 @@
1
1
  {
2
2
  "name": "@prisma/orm-extension-arktype-json",
3
- "version": "8.0.0-rc.2-dev.2",
3
+ "version": "8.0.0-rc.20",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
- "description": "Arktype-validated JSON columns for Prisma Next",
7
+ "description": "Arktype-validated JSON columns for Prisma 8",
8
8
  "files": [
9
9
  "dist"
10
10
  ],
11
11
  "dependencies": {
12
- "@prisma/orm-family-sql": "8.0.0-rc.2-dev.2",
13
- "@prisma/orm-framework": "8.0.0-rc.2-dev.2",
12
+ "@prisma/orm-family-sql": "8.0.0-rc.20",
13
+ "@prisma/orm-framework": "8.0.0-rc.20",
14
14
  "@standard-schema/spec": "^1.1.0",
15
15
  "arktype": "~2.2.2"
16
16
  },
17
17
  "devDependencies": {
18
- "@internal/extension-arktype-json": "8.0.0-rc.2-dev.2",
19
- "@repo/tsconfig": "8.0.0-rc.2-dev.2",
20
- "@repo/tsdown": "8.0.0-rc.2-dev.2",
21
- "@prisma/orm-target-postgres": "8.0.0-rc.2-dev.2",
18
+ "@internal/extension-arktype-json": "8.0.0-rc.20",
19
+ "@repo/tsconfig": "8.0.0-rc.20",
20
+ "@repo/tsdown": "8.0.0-rc.20",
21
+ "@prisma/orm-target-postgres": "8.0.0-rc.20",
22
22
  "tsdown": "0.22.14",
23
23
  "typescript": "5.9.3"
24
24
  },
25
25
  "peerDependencies": {
26
- "@prisma/orm-target-postgres": "8.0.0-rc.2-dev.2",
26
+ "@prisma/orm-target-postgres": "8.0.0-rc.20",
27
27
  "typescript": ">=5.9"
28
28
  },
29
29
  "peerDependenciesMeta": {
@@ -42,7 +42,7 @@
42
42
  },
43
43
  "repository": {
44
44
  "type": "git",
45
- "url": "https://github.com/prisma/prisma.git",
45
+ "url": "https://github.com/prisma/orm.git",
46
46
  "directory": "packages/9-public/@prisma/orm-extension-arktype-json"
47
47
  },
48
48
  "scripts": {
@@ -1 +0,0 @@
1
- {"version":3,"file":"arktype-json-codec-C9r2qvJy-CyWkAduB.mjs","names":[],"sources":["../../../../3-extensions/arktype-json/dist/arktype-json-codec-C9r2qvJy.mjs"],"sourcesContent":["import { CodecImpl, column } from \"@internal/framework-components/codec\";\nimport { isRuntimeError, runtimeError } from \"@internal/framework-components/runtime\";\nimport { PostgresCodecDescriptor, definePostgresCodecs } from \"@internal/target-postgres/codec-descriptor\";\nimport { ArkErrors, ark, type } from \"arktype\";\n//#region src/core/arktype-json-codec.ts\n/** Codec id for arktype-backed JSON columns. Library-bound, not target-bound. */\nconst ARKTYPE_JSON_CODEC_ID = \"arktype/json@1\";\n/** Native storage type backing the codec. JSONB on Postgres; binary, indexable. */\nconst ARKTYPE_JSON_NATIVE_TYPE = \"jsonb\";\nfunction isArktypeSchemaLike(value) {\n\tif (typeof value !== \"function\") return false;\n\treturn typeof value.expression === \"string\";\n}\nfunction validateSchema(schema, value) {\n\tconst result = schema(value);\n\tif (result instanceof ArkErrors) throw runtimeError(\"RUNTIME.JSON_SCHEMA_VALIDATION_FAILED\", `arktype-json schema validation failed (decode): ${result.summary}`, {\n\t\tcodecId: ARKTYPE_JSON_CODEC_ID,\n\t\tissues: result.summary\n\t});\n\treturn result;\n}\nfunction serializeWire(value) {\n\tlet wire;\n\ttry {\n\t\twire = JSON.stringify(value);\n\t} catch (error) {\n\t\tthrow Object.assign(runtimeError(\"RUNTIME.ENCODE_FAILED\", `arktype-json value could not be serialized to JSON (codecId: ${ARKTYPE_JSON_CODEC_ID})`, { codecId: ARKTYPE_JSON_CODEC_ID }), { cause: error });\n\t}\n\tif (typeof wire !== \"string\") throw runtimeError(\"RUNTIME.ENCODE_FAILED\", `arktype-json value is not representable as JSON (codecId: ${ARKTYPE_JSON_CODEC_ID})`, { codecId: ARKTYPE_JSON_CODEC_ID });\n\treturn wire;\n}\nfunction serializeJson(value) {\n\treturn JSON.parse(serializeWire(value));\n}\nfunction parseJsonText(wire) {\n\ttry {\n\t\treturn JSON.parse(wire);\n\t} catch {\n\t\treturn;\n\t}\n}\nfunction decodeWireValue(schema, wire) {\n\tif (typeof wire !== \"string\") return validateSchema(schema, wire);\n\ttry {\n\t\treturn validateSchema(schema, wire);\n\t} catch (error) {\n\t\tif (!isRuntimeError(error) || error.code !== \"RUNTIME.JSON_SCHEMA_VALIDATION_FAILED\") throw error;\n\t\tconst parsed = parseJsonText(wire);\n\t\tif (parsed === void 0) throw error;\n\t\treturn validateSchema(schema, parsed);\n\t}\n}\nfunction rehydrateSchema(jsonIr) {\n\tlet rehydrated;\n\ttry {\n\t\trehydrated = ark.schema(jsonIr);\n\t} catch (error) {\n\t\tthrow runtimeError(\n\t\t\t\"RUNTIME.JSON_SCHEMA_VALIDATION_FAILED\",\n\t\t\t/* c8 ignore next — the `String(error)` fallback covers throws of non-Error values; arktype only throws Error subclasses, so this branch is defensive only. */\n\t\t\t`Failed to rehydrate arktype schema from contract IR: ${error instanceof Error ? error.message : String(error)}`,\n\t\t\t{\n\t\t\t\tcodecId: ARKTYPE_JSON_CODEC_ID,\n\t\t\t\tjsonIr\n\t\t\t}\n\t\t);\n\t}\n\t/* c8 ignore start — defensive: ark.schema either throws (handled above) or returns a callable Type with `expression: string`. The structural guard is kept so a future ark internal change can't silently slip a non-callable past us. */\n\tif (!isArktypeSchemaLike(rehydrated)) throw runtimeError(\"RUNTIME.JSON_SCHEMA_VALIDATION_FAILED\", `Rehydrated arktype schema does not have the expected callable + 'expression: string' shape (codecId: ${ARKTYPE_JSON_CODEC_ID})`, {\n\t\tcodecId: ARKTYPE_JSON_CODEC_ID,\n\t\tjsonIr\n\t});\n\t/* c8 ignore stop */\n\treturn rehydrated;\n}\nfunction renderArktypeJsonOutputType(params) {\n\tconst expression = params.expression.trim();\n\treturn expression.length > 0 ? expression : \"unknown\";\n}\nvar ArktypeJsonCodecClass = class extends CodecImpl {\n\tschema;\n\tconstructor(descriptor, schema) {\n\t\tsuper(descriptor);\n\t\tthis.schema = schema;\n\t}\n\tasync encode(value, _ctx) {\n\t\treturn serializeWire(value);\n\t}\n\tasync decode(wire, _ctx) {\n\t\treturn decodeWireValue(this.schema, wire);\n\t}\n\tencodeJson(value) {\n\t\treturn serializeJson(value);\n\t}\n\tdecodeJson(json) {\n\t\treturn validateSchema(this.schema, json);\n\t}\n};\nconst arktypeJsonParamsSchema = type({\n\texpression: \"string\",\n\tjsonIr: \"object\"\n});\nvar ArktypeJsonDescriptor = class extends PostgresCodecDescriptor {\n\tnativeType() {\n\t\treturn ARKTYPE_JSON_NATIVE_TYPE;\n\t}\n\tjsonProjection(expression) {\n\t\treturn expression;\n\t}\n\tcodecId = ARKTYPE_JSON_CODEC_ID;\n\ttraits = [\"equality\"];\n\ttargetTypes = [ARKTYPE_JSON_NATIVE_TYPE];\n\tparamsSchema = arktypeJsonParamsSchema;\n\trenderOutputType(params) {\n\t\treturn renderArktypeJsonOutputType(params);\n\t}\n\tfactory(params) {\n\t\tconst schema = rehydrateSchema(params.jsonIr);\n\t\tconst rehydratedExpression = schema.expression;\n\t\tif (typeof rehydratedExpression === \"string\" && rehydratedExpression !== params.expression) throw runtimeError(\"RUNTIME.TYPE_PARAMS_INVALID\", `arktype-json: typeParams.expression (${params.expression}) does not match the rehydrated schema's expression (${rehydratedExpression}). The contract was likely emitted against a different arktype version or hand-edited; re-run \\`pnpm emit\\` to regenerate.`, {\n\t\t\tcodecId: ARKTYPE_JSON_CODEC_ID,\n\t\t\tserializedExpression: params.expression,\n\t\t\trehydratedExpression\n\t\t});\n\t\treturn () => new ArktypeJsonCodecClass(this, schema);\n\t}\n};\nconst arktypeJsonDescriptor = new ArktypeJsonDescriptor();\n/**\n* Per-codec column helper for `arktype/json@1`. Method-level generic over `S extends Type<unknown>` so the column site preserves the schema's inferred TS type in the resolved codec (`ArktypeJsonCodecClass<S['infer']>`). Bypasses `descriptor.factory` because `S` is only available at the column-author site; constructs the typed codec directly with the closure-captured schema.\n*\n* Eager serialization at this call site captures `expression` (for the emit-path renderer) and `jsonIr` (for runtime rehydration via the descriptor's factory).\n*\n* @throws `CONTRACT.ARGUMENT_INVALID` if the schema doesn't expose `expression` and `json` fields (i.e. is not an arktype `Type`). Validates the schema shape at the call site so configuration errors surface during contract authoring, not at runtime.\n*/\nfunction arktypeJsonColumn(schema) {\n\tif (!isArktypeSchemaLike(schema)) throw runtimeError(\"CONTRACT.ARGUMENT_INVALID\", typeof schema !== \"function\" ? \"arktypeJsonColumn(schema) expects a callable arktype Type.\" : \"arktypeJsonColumn(schema) expects an arktype Type (missing `expression: string`).\", {\n\t\thelperPath: \"arktypeJsonColumn\",\n\t\texpected: \"arktype Type\",\n\t\treceived: typeof schema\n\t});\n\tconst jsonIr = schema.json;\n\tif (jsonIr === null || typeof jsonIr !== \"object\") throw runtimeError(\"CONTRACT.ARGUMENT_INVALID\", \"arktypeJsonColumn(schema) expects an arktype Type (missing `json` IR).\", {\n\t\thelperPath: \"arktypeJsonColumn\",\n\t\texpected: \"arktype Type\",\n\t\treceived: typeof jsonIr\n\t});\n\tconst params = {\n\t\texpression: schema.expression,\n\t\tjsonIr\n\t};\n\treturn column((_ctx) => new ArktypeJsonCodecClass(arktypeJsonDescriptor, schema), arktypeJsonDescriptor.codecId, params, ARKTYPE_JSON_NATIVE_TYPE);\n}\nconst codecDescriptors = definePostgresCodecs([arktypeJsonDescriptor]);\n//#endregion\nexport { codecDescriptors as i, ARKTYPE_JSON_NATIVE_TYPE as n, arktypeJsonColumn as r, ARKTYPE_JSON_CODEC_ID as t };\n\n//# sourceMappingURL=arktype-json-codec-C9r2qvJy.mjs.map"],"mappings":";;;;;;AAMA,MAAM,wBAAwB;;AAE9B,MAAM,2BAA2B;AACjC,SAAS,oBAAoB,OAAO;CACnC,IAAI,OAAO,UAAU,YAAY,OAAO;CACxC,OAAO,OAAO,MAAM,eAAe;AACpC;AACA,SAAS,eAAe,QAAQ,OAAO;CACtC,MAAM,SAAS,OAAO,KAAK;CAC3B,IAAI,kBAAkB,WAAW,MAAM,aAAa,yCAAyC,mDAAmD,OAAO,WAAW;EACjK,SAAS;EACT,QAAQ,OAAO;CAChB,CAAC;CACD,OAAO;AACR;AACA,SAAS,cAAc,OAAO;CAC7B,IAAI;CACJ,IAAI;EACH,OAAO,KAAK,UAAU,KAAK;CAC5B,SAAS,OAAO;EACf,MAAM,OAAO,OAAO,aAAa,yBAAyB,gEAAgE,sBAAsB,IAAI,EAAE,SAAS,sBAAsB,CAAC,GAAG,EAAE,OAAO,MAAM,CAAC;CAC1M;CACA,IAAI,OAAO,SAAS,UAAU,MAAM,aAAa,yBAAyB,6DAA6D,sBAAsB,IAAI,EAAE,SAAS,sBAAsB,CAAC;CACnM,OAAO;AACR;AACA,SAAS,cAAc,OAAO;CAC7B,OAAO,KAAK,MAAM,cAAc,KAAK,CAAC;AACvC;AACA,SAAS,cAAc,MAAM;CAC5B,IAAI;EACH,OAAO,KAAK,MAAM,IAAI;CACvB,QAAQ;EACP;CACD;AACD;AACA,SAAS,gBAAgB,QAAQ,MAAM;CACtC,IAAI,OAAO,SAAS,UAAU,OAAO,eAAe,QAAQ,IAAI;CAChE,IAAI;EACH,OAAO,eAAe,QAAQ,IAAI;CACnC,SAAS,OAAO;EACf,IAAI,CAAC,eAAe,KAAK,KAAK,MAAM,SAAS,y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AW,OAAO,YAAY;EAC9B,WAAW,MAAM,YAAY;;cAEjB,8BAA8B,wBAAwB;YACxD;YACA,eAAe,YAAY,iBAAiB;WAC7C;WACA;WACA;WACA,cAAc,iBAAiB;EACxC,iBAAiB,QAAQ;EACzB,QAAQ,QAAQ,yBAAyB,KAAK,yBAAyB;;;;;;;;;iBASxD,kBAAkB,UAAU,eAAe,QAAQ,IAAI,WAAW,sBAAsB,aAAa;;;;KAIjH,iBAAiB,aAAa,sBAAsB"}
@@ -1,34 +0,0 @@
1
- import { t as ARKTYPE_JSON_CODEC_ID } from "./arktype-json-codec-C9r2qvJy-CyWkAduB.mjs";
2
- import { t as arktypeJsonCodecRegistry } from "./registry-Di7rBVdI-sgB_8xDd.mjs";
3
- //#region ../../../3-extensions/arktype-json/dist/pack-meta-sCd-w62R.mjs
4
- /**
5
- * Public pack metadata. The phantom `__codecTypes` field threads the codec-types map's literal type into the pack ref so contract-builder generics can pick it up; it is never accessed at runtime.
6
- */
7
- const arktypeJsonPackMeta = {
8
- kind: "extension",
9
- id: "arktype-json",
10
- familyId: "sql",
11
- targetId: "postgres",
12
- version: "0.0.1",
13
- capabilities: {},
14
- types: {
15
- codecTypes: {
16
- codecDescriptors: Array.from(arktypeJsonCodecRegistry.values()),
17
- import: {
18
- package: "@internal/extension-arktype-json/codec-types",
19
- named: "CodecTypes",
20
- alias: "ArktypeJsonTypes"
21
- }
22
- },
23
- storage: [{
24
- typeId: ARKTYPE_JSON_CODEC_ID,
25
- familyId: "sql",
26
- targetId: "postgres",
27
- nativeType: "jsonb"
28
- }]
29
- }
30
- };
31
- //#endregion
32
- export { arktypeJsonPackMeta as t };
33
-
34
- //# sourceMappingURL=pack-meta-sCd-w62R-BJrOMFwR.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pack-meta-sCd-w62R-BJrOMFwR.mjs","names":[],"sources":["../../../../3-extensions/arktype-json/dist/pack-meta-sCd-w62R.mjs"],"sourcesContent":["import { t as ARKTYPE_JSON_CODEC_ID } from \"./arktype-json-codec-C9r2qvJy.mjs\";\nimport { t as arktypeJsonCodecRegistry } from \"./registry-Di7rBVdI.mjs\";\n/**\n* Public pack metadata. The phantom `__codecTypes` field threads the codec-types map's literal type into the pack ref so contract-builder generics can pick it up; it is never accessed at runtime.\n*/\nconst arktypeJsonPackMeta = {\n\tkind: \"extension\",\n\tid: \"arktype-json\",\n\tfamilyId: \"sql\",\n\ttargetId: \"postgres\",\n\tversion: \"0.0.1\",\n\tcapabilities: {},\n\ttypes: {\n\t\tcodecTypes: {\n\t\t\tcodecDescriptors: Array.from(arktypeJsonCodecRegistry.values()),\n\t\t\timport: {\n\t\t\t\tpackage: \"@internal/extension-arktype-json/codec-types\",\n\t\t\t\tnamed: \"CodecTypes\",\n\t\t\t\talias: \"ArktypeJsonTypes\"\n\t\t\t}\n\t\t},\n\t\tstorage: [{\n\t\t\ttypeId: ARKTYPE_JSON_CODEC_ID,\n\t\t\tfamilyId: \"sql\",\n\t\t\ttargetId: \"postgres\",\n\t\t\tnativeType: \"jsonb\"\n\t\t}]\n\t}\n};\n//#endregion\nexport { arktypeJsonPackMeta as t };\n\n//# sourceMappingURL=pack-meta-sCd-w62R.mjs.map"],"mappings":";;;;;;AAKA,MAAM,sBAAsB;CAC3B,MAAM;CACN,IAAI;CACJ,UAAU;CACV,UAAU;CACV,SAAS;CACT,cAAc,CAAC;CACf,OAAO;EACN,YAAY;GACX,kBAAkB,MAAM,KAAK,yBAAyB,OAAO,CAAC;GAC9D,QAAQ;IACP,SAAS;IACT,OAAO;IACP,OAAO;GACR;EACD;EACA,SAAS,CAAC;GACT,QAAQ;GACR,UAAU;GACV,UAAU;GACV,YAAY;EACb,CAAC;CACF;AACD"}