@prisma-next/extension-arktype-json 0.5.0-dev.60 → 0.5.0-dev.61

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.
Files changed (38) hide show
  1. package/README.md +11 -34
  2. package/dist/arktype-json-codec-Cykol-li.mjs +120 -0
  3. package/dist/arktype-json-codec-Cykol-li.mjs.map +1 -0
  4. package/dist/arktype-json-codec-DBfCWQkt.d.mts +58 -0
  5. package/dist/arktype-json-codec-DBfCWQkt.d.mts.map +1 -0
  6. package/dist/{codec-types-CH37Yc0C.d.mts → codec-types-5Jy4t54u.d.mts} +1 -1
  7. package/dist/codec-types-5Jy4t54u.d.mts.map +1 -0
  8. package/dist/codec-types.d.mts +1 -1
  9. package/dist/codecs.d.mts +14 -2
  10. package/dist/codecs.d.mts.map +1 -0
  11. package/dist/codecs.mjs +3 -2
  12. package/dist/column-types.d.mts +2 -2
  13. package/dist/column-types.mjs +2 -2
  14. package/dist/control.mjs +3 -2
  15. package/dist/control.mjs.map +1 -1
  16. package/dist/{pack-meta-DycetSQB.mjs → pack-meta-BaJhoZfD.mjs} +5 -6
  17. package/dist/pack-meta-BaJhoZfD.mjs.map +1 -0
  18. package/dist/pack.d.mts +3 -5
  19. package/dist/pack.d.mts.map +1 -1
  20. package/dist/pack.mjs +3 -1
  21. package/dist/registry-DN6MqSGJ.mjs +14 -0
  22. package/dist/registry-DN6MqSGJ.mjs.map +1 -0
  23. package/dist/runtime.d.mts.map +1 -1
  24. package/dist/runtime.mjs +4 -22
  25. package/dist/runtime.mjs.map +1 -1
  26. package/package.json +9 -8
  27. package/src/core/arktype-json-codec.ts +143 -328
  28. package/src/core/pack-meta.ts +6 -24
  29. package/src/core/registry.ts +11 -0
  30. package/src/exports/codecs.ts +7 -2
  31. package/src/exports/column-types.ts +1 -1
  32. package/src/exports/runtime.ts +4 -19
  33. package/dist/arktype-json-codec-BbiBmtTK.mjs +0 -224
  34. package/dist/arktype-json-codec-BbiBmtTK.mjs.map +0 -1
  35. package/dist/arktype-json-codec-yNv1hzBm.d.mts +0 -92
  36. package/dist/arktype-json-codec-yNv1hzBm.d.mts.map +0 -1
  37. package/dist/codec-types-CH37Yc0C.d.mts.map +0 -1
  38. package/dist/pack-meta-DycetSQB.mjs.map +0 -1
package/README.md CHANGED
@@ -1,33 +1,19 @@
1
1
  # `@prisma-next/extension-arktype-json`
2
2
 
3
- Per-library JSON-with-schema column factory for Prisma Next, built on
4
- [arktype](https://arktype.io). Ships the `arktypeJson(schema)` column-author
5
- helper and the `arktype/json@1` codec descriptor.
3
+ Per-library JSON-with-schema column factory for Prisma Next, built on [arktype](https://arktype.io). Ships the `arktypeJson(schema)` column-author helper and the `arktype/json@1` codec descriptor.
6
4
 
7
5
  ## What it does
8
6
 
9
- Given an arktype `Type`, `arktypeJson(schema)` produces a column descriptor
10
- that:
7
+ Given an arktype `Type`, `arktypeJson(schema)` produces a column descriptor that:
11
8
 
12
9
  - Stores values as `jsonb` on Postgres.
13
- - Eagerly serializes `schema.expression` (TypeScript-source-like rendering)
14
- and `schema.json` (arktype's internal IR) into `typeParams`. The IR is the
15
- lossless rehydration source; the expression is the emit-path renderer's
16
- input.
17
- - At runtime, the framework's unified codec descriptor map rehydrates the
18
- schema via `ark.schema(typeParams.jsonIr)` and returns a `Codec` whose
19
- `decode` validates wire payloads via the rehydrated schema. Validation
20
- failures throw `RUNTIME.JSON_SCHEMA_VALIDATION_FAILED`.
21
- - The emitter renders the column's TS type as the schema's `expression`
22
- (e.g. `{ name: string; price: number }`).
10
+ - Eagerly serializes `schema.expression` (TypeScript-source-like rendering) and `schema.json` (arktype's internal IR) into `typeParams`. The IR is the lossless rehydration source; the expression is the emit-path renderer's input.
11
+ - At runtime, the framework's unified codec descriptor map rehydrates the schema via `ark.schema(typeParams.jsonIr)` and returns a `Codec` whose `decode` validates wire payloads via the rehydrated schema. Validation failures throw `RUNTIME.JSON_SCHEMA_VALIDATION_FAILED`.
12
+ - The emitter renders the column's TS type as the schema's `expression` (e.g. `{ name: string; price: number }`).
23
13
 
24
14
  ## Why a per-library extension
25
15
 
26
- The unified `CodecDescriptor` model routes JSON-with-schema through per-
27
- library extension packages: arktype-json now, future zod / valibot
28
- extensions when each has a clean serialize / rehydrate story. The Postgres
29
- adapter retains only the storage-level `jsonColumn` / `jsonbColumn`
30
- descriptors (untyped raw JSON). See [ADR 208 — Higher-order codecs for parameterized types](../../../docs/architecture%20docs/adrs/ADR%20208%20-%20Higher-order%20codecs%20for%20parameterized%20types.md).
16
+ The unified `CodecDescriptor` model routes JSON-with-schema through per-library extension packages: arktype-json now, future zod / valibot extensions when each has a clean serialize / rehydrate story. The Postgres adapter retains only the storage-level `jsonColumn` / `jsonbColumn` descriptors (untyped raw JSON). See [ADR 208 — Higher-order codecs for parameterized types](../../../docs/architecture%20docs/adrs/ADR%20208%20-%20Higher-order%20codecs%20for%20parameterized%20types.md).
31
17
 
32
18
  ## Usage
33
19
 
@@ -51,14 +37,11 @@ const contract = defineContract({ /* ... */ }, ({ field, model }) => ({
51
37
  }));
52
38
  ```
53
39
 
54
- In the emitted `contract.d.ts`, `Product.spec` resolves to
55
- `{ name: string; price: number; description?: string }` — the schema's
56
- expression renders directly into the field type.
40
+ In the emitted `contract.d.ts`, `Product.spec` resolves to `{ name: string; price: number; description?: string }` — the schema's expression renders directly into the field type.
57
41
 
58
42
  ## Pack registration
59
43
 
60
- Add the runtime descriptor to your runtime stack and the control descriptor
61
- to your `prisma-next.config.ts` `extensionPacks`:
44
+ Add the runtime descriptor to your runtime stack and the control descriptor to your `prisma-next.config.ts` `extensionPacks`:
62
45
 
63
46
  ```ts
64
47
  import arktypeJsonPack from '@prisma-next/extension-arktype-json/pack';
@@ -80,12 +63,6 @@ const stack = createSqlExecutionStack({
80
63
 
81
64
  ## Notes
82
65
 
83
- - The codec is library-bound (`arktype/json@1`), not target-bound. Other
84
- schema libraries ship as parallel extensions (`zod/json@1`,
85
- `valibot/json@1`) when their serialize/rehydrate stories materialize.
86
- - `decode` validates internally and throws on rejection; the framework's
87
- `JsonSchemaValidatorRegistry` is not consulted for arktype-json columns
88
- (no `'json-validator'` trait + per-instance `validate` extraction). The
89
- one-path "validate inside `decode`" matches the spec's Case J pinning.
90
- - For untyped raw JSON columns, use `jsonColumn` / `jsonbColumn` from
91
- `@prisma-next/adapter-postgres/column-types` instead.
66
+ - The codec is library-bound (`arktype/json@1`), not target-bound. Other schema libraries ship as parallel extensions (`zod/json@1`, `valibot/json@1`) when their serialize/rehydrate stories materialize.
67
+ - `decode` validates internally and throws on rejection. JSON-Schema validation lives uniformly inside the resolved codec's `decode` body; the framework no longer maintains a parallel validator registry. Validation rejections surface as `RUNTIME.DECODE_FAILED` envelopes with the original `RUNTIME.JSON_SCHEMA_VALIDATION_FAILED` attached on `cause`.
68
+ - For untyped raw JSON columns, use `jsonColumn` / `jsonbColumn` from `@prisma-next/adapter-postgres/column-types` instead.
@@ -0,0 +1,120 @@
1
+ import { CodecDescriptorImpl, CodecImpl, column } from "@prisma-next/framework-components/codec";
2
+ import { runtimeError } from "@prisma-next/framework-components/runtime";
3
+ import { ArkErrors, ark, type } from "arktype";
4
+
5
+ //#region src/core/arktype-json-codec.ts
6
+ /** Codec id for arktype-backed JSON columns. Library-bound, not target-bound. */
7
+ const ARKTYPE_JSON_CODEC_ID = "arktype/json@1";
8
+ /** Native storage type backing the codec. JSONB on Postgres; binary, indexable. */
9
+ const ARKTYPE_JSON_NATIVE_TYPE = "jsonb";
10
+ function isArktypeSchemaLike(value) {
11
+ if (typeof value !== "function") return false;
12
+ return typeof value.expression === "string";
13
+ }
14
+ function validateSchema(schema, value) {
15
+ const result = schema(value);
16
+ if (result instanceof ArkErrors) throw runtimeError("RUNTIME.JSON_SCHEMA_VALIDATION_FAILED", `arktype-json schema validation failed (decode): ${result.summary}`, {
17
+ codecId: ARKTYPE_JSON_CODEC_ID,
18
+ issues: result.summary
19
+ });
20
+ return result;
21
+ }
22
+ function serializeToJsonSafe(schema, value) {
23
+ const wire = JSON.stringify(value);
24
+ if (typeof wire !== "string") throw runtimeError("RUNTIME.JSON_SCHEMA_VALIDATION_FAILED", `arktype-json value is not representable as JSON (codecId: ${ARKTYPE_JSON_CODEC_ID})`, { codecId: ARKTYPE_JSON_CODEC_ID });
25
+ const json = JSON.parse(wire);
26
+ validateSchema(schema, json);
27
+ return {
28
+ wire,
29
+ json
30
+ };
31
+ }
32
+ function rehydrateSchema(jsonIr) {
33
+ let rehydrated;
34
+ try {
35
+ rehydrated = ark.schema(jsonIr);
36
+ } catch (error) {
37
+ throw runtimeError(
38
+ "RUNTIME.JSON_SCHEMA_VALIDATION_FAILED",
39
+ /* c8 ignore next — the `String(error)` fallback covers throws of non-Error values; arktype only throws Error subclasses, so this branch is defensive only. */
40
+ `Failed to rehydrate arktype schema from contract IR: ${error instanceof Error ? error.message : String(error)}`,
41
+ {
42
+ codecId: ARKTYPE_JSON_CODEC_ID,
43
+ jsonIr
44
+ }
45
+ );
46
+ }
47
+ /* 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. */
48
+ if (!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})`, {
49
+ codecId: ARKTYPE_JSON_CODEC_ID,
50
+ jsonIr
51
+ });
52
+ /* c8 ignore stop */
53
+ return rehydrated;
54
+ }
55
+ function renderArktypeJsonOutputType(params) {
56
+ const expression = params.expression.trim();
57
+ return expression.length > 0 ? expression : "unknown";
58
+ }
59
+ var ArktypeJsonCodecClass = class extends CodecImpl {
60
+ constructor(descriptor, schema) {
61
+ super(descriptor);
62
+ this.schema = schema;
63
+ }
64
+ async encode(value, _ctx) {
65
+ return serializeToJsonSafe(this.schema, value).wire;
66
+ }
67
+ async decode(wire, _ctx) {
68
+ return validateSchema(this.schema, JSON.parse(wire));
69
+ }
70
+ encodeJson(value) {
71
+ return serializeToJsonSafe(this.schema, value).json;
72
+ }
73
+ decodeJson(json) {
74
+ return validateSchema(this.schema, json);
75
+ }
76
+ };
77
+ const arktypeJsonParamsSchema = type({
78
+ expression: "string",
79
+ jsonIr: "object"
80
+ });
81
+ var ArktypeJsonDescriptor = class extends CodecDescriptorImpl {
82
+ codecId = ARKTYPE_JSON_CODEC_ID;
83
+ traits = ["equality"];
84
+ targetTypes = [ARKTYPE_JSON_NATIVE_TYPE];
85
+ paramsSchema = arktypeJsonParamsSchema;
86
+ renderOutputType(params) {
87
+ return renderArktypeJsonOutputType(params);
88
+ }
89
+ factory(params) {
90
+ const schema = rehydrateSchema(params.jsonIr);
91
+ /* c8 ignore start — defensive parity check; not exercised by typical contracts */
92
+ const rehydratedExpression = schema.expression;
93
+ if (typeof rehydratedExpression === "string" && rehydratedExpression !== params.expression) console.warn(`[arktype-json] typeParams.expression (${params.expression}) does not match rehydrated schema expression (${rehydratedExpression}); contract.json may be stale relative to the runtime schema.`);
94
+ /* c8 ignore stop */
95
+ return () => new ArktypeJsonCodecClass(this, schema);
96
+ }
97
+ };
98
+ const arktypeJsonDescriptor = new ArktypeJsonDescriptor();
99
+ /**
100
+ * 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.
101
+ *
102
+ * Eager serialization at this call site captures `expression` (for the emit-path renderer) and `jsonIr` (for runtime rehydration via the descriptor's factory).
103
+ *
104
+ * @throws {Error} 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.
105
+ */
106
+ function arktypeJsonColumn(schema) {
107
+ if (!isArktypeSchemaLike(schema)) throw new Error(typeof schema !== "function" ? "arktypeJsonColumn(schema) expects a callable arktype Type." : "arktypeJsonColumn(schema) expects an arktype Type (missing `expression: string`).");
108
+ const jsonIr = schema.json;
109
+ if (jsonIr === null || typeof jsonIr !== "object") throw new Error("arktypeJsonColumn(schema) expects an arktype Type (missing `json` IR).");
110
+ const params = {
111
+ expression: schema.expression,
112
+ jsonIr
113
+ };
114
+ return column((_ctx) => new ArktypeJsonCodecClass(arktypeJsonDescriptor, schema), arktypeJsonDescriptor.codecId, params, ARKTYPE_JSON_NATIVE_TYPE);
115
+ }
116
+ const codecDescriptors = [arktypeJsonDescriptor];
117
+
118
+ //#endregion
119
+ export { codecDescriptors as i, ARKTYPE_JSON_NATIVE_TYPE as n, arktypeJsonColumn as r, ARKTYPE_JSON_CODEC_ID as t };
120
+ //# sourceMappingURL=arktype-json-codec-Cykol-li.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arktype-json-codec-Cykol-li.mjs","names":["wire: string | undefined","rehydrated: unknown","schema: ArktypeSchemaLike","jsonIr: unknown","params: ArktypeJsonTypeParams","codecDescriptors: readonly AnyCodecDescriptor[]"],"sources":["../src/core/arktype-json-codec.ts"],"sourcesContent":["/**\n * Arktype-json codec (TML-2357).\n *\n * Spec § Case 3: method-level generic over `S extends Type<unknown>`. The schema's TypeScript-level inferred type `S['infer']` is only available at the column-author site (where the user passes their typed schema), not at the descriptor's factory site (where only the serialized IR is available). This drives the shape:\n *\n * 1. {@link ArktypeJsonCodecClass} extends {@link CodecImpl} and is generic over `TInferred` — the application-level JS type the schema validates to. The constructor takes both the descriptor (for `id` proxy) and the rehydrated arktype `Type` (closure-captured so encode/decode/encodeJson/decodeJson can validate through it). 2. {@link ArktypeJsonDescriptor} extends {@link CodecDescriptorImpl} over {@link\n * ArktypeJsonTypeParams}. Factory rehydrates the schema from `params.jsonIr` and returns `(ctx) => new ArktypeJsonCodecClass<unknown>(this, schema)` — `S` is erased to `unknown` because the descriptor only sees IR. The runtime path through `descriptor.factory(params)` always exists (e.g. for `validateContract` re-materialization); it just loses the typed inferred shape. 3. {@link arktypeJsonColumn} is the column-author\n * surface with the method-level generic over `S extends Type<unknown>`. It bypasses `descriptor.factory` because `S` is only available here, instead constructing the typed codec directly so `S['infer']` flows through `codecFactory`'s return into the column site's resolved output type. Eager serialization at this call site captures `expression` (for the emit-path renderer) and `jsonIr` (for runtime rehydration).\n *\n * `satisfies ColumnHelperFor<ArktypeJsonDescriptor>` (coarse) is applied — the typeParams shape is verified. `ColumnHelperForStrict` is intentionally skipped: the descriptor's factory return is `ArktypeJsonCodecClass<unknown>` while the helper produces `ArktypeJsonCodecClass<S['infer']>`, and `Codec`'s `TInput` is invariant (used contravariantly in `encode`, covariantly in `decode`/`encodeJson`/`decodeJson`). Strict\n * assignment fails by design; the explicit `expectTypeOf` tests in `test/arktype-json-codec.types.test-d.ts` cover the literal-preservation property the strict variant would otherwise enforce.\n */\n\nimport type { JsonValue } from '@prisma-next/contract/types';\nimport {\n type AnyCodecDescriptor,\n type CodecCallContext,\n CodecDescriptorImpl,\n CodecImpl,\n type CodecInstanceContext,\n type ColumnHelperFor,\n type ColumnSpec,\n column,\n} from '@prisma-next/framework-components/codec';\nimport { runtimeError } from '@prisma-next/framework-components/runtime';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport { ArkErrors, ark, type Type, type } from 'arktype';\n\n/** Codec id for arktype-backed JSON columns. Library-bound, not target-bound. */\nexport const ARKTYPE_JSON_CODEC_ID = 'arktype/json@1' as const;\n\n/** Native storage type backing the codec. JSONB on Postgres; binary, indexable. */\nexport const ARKTYPE_JSON_NATIVE_TYPE = 'jsonb' as const;\n\n/**\n * Eagerly serialized typeParams for the arktype-json column. Carried in the contract IR; the runtime descriptor's factory rehydrates `jsonIr` and the emitter consumes `expression`.\n */\nexport type ArktypeJsonTypeParams = {\n /**\n * Arktype's TypeScript-source-like rendering of the schema. Read by `renderOutputType` to emit the column's TS type into `contract.d.ts`. Stable across the serialize/rehydrate cycle: the rehydrated schema's `expression` matches the source schema's.\n */\n readonly expression: string;\n /**\n * Arktype's internal IR for the schema. Lossless; the rehydration source. Schema-shape — `ark.schema(jsonIr)` reconstructs a callable `Type`-like structurally identical to the original `type(definition)` output.\n */\n readonly jsonIr: object;\n};\n\ntype ArktypeSchemaLike = ((value: unknown) => unknown) & {\n readonly expression: string;\n};\n\nfunction isArktypeSchemaLike(value: unknown): value is ArktypeSchemaLike {\n if (typeof value !== 'function') return false;\n const expression = (value as { readonly expression?: unknown }).expression;\n return typeof expression === 'string';\n}\n\nfunction validateSchema<TInferred>(schema: ArktypeSchemaLike, value: unknown): TInferred {\n const result = schema(value);\n if (result instanceof ArkErrors) {\n throw runtimeError(\n 'RUNTIME.JSON_SCHEMA_VALIDATION_FAILED',\n `arktype-json schema validation failed (decode): ${result.summary}`,\n { codecId: ARKTYPE_JSON_CODEC_ID, issues: result.summary },\n );\n }\n return result as TInferred;\n}\n\nfunction serializeToJsonSafe<TInferred>(\n schema: ArktypeSchemaLike,\n value: TInferred,\n): { wire: string; json: JsonValue } {\n const wire: string | undefined = JSON.stringify(value);\n if (typeof wire !== 'string') {\n throw runtimeError(\n 'RUNTIME.JSON_SCHEMA_VALIDATION_FAILED',\n `arktype-json value is not representable as JSON (codecId: ${ARKTYPE_JSON_CODEC_ID})`,\n { codecId: ARKTYPE_JSON_CODEC_ID },\n );\n }\n const json = JSON.parse(wire) as JsonValue;\n validateSchema(schema, json);\n return { wire, json };\n}\n\nfunction rehydrateSchema(jsonIr: object): ArktypeSchemaLike {\n let rehydrated: unknown;\n try {\n rehydrated = ark.schema(jsonIr);\n } catch (error) {\n throw runtimeError(\n 'RUNTIME.JSON_SCHEMA_VALIDATION_FAILED',\n /* 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 `Failed to rehydrate arktype schema from contract IR: ${error instanceof Error ? error.message : String(error)}`,\n { codecId: ARKTYPE_JSON_CODEC_ID, jsonIr },\n );\n }\n /* 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 if (!isArktypeSchemaLike(rehydrated)) {\n throw runtimeError(\n 'RUNTIME.JSON_SCHEMA_VALIDATION_FAILED',\n `Rehydrated arktype schema does not have the expected callable + 'expression: string' shape (codecId: ${ARKTYPE_JSON_CODEC_ID})`,\n { codecId: ARKTYPE_JSON_CODEC_ID, jsonIr },\n );\n }\n /* c8 ignore stop */\n return rehydrated;\n}\n\nfunction renderArktypeJsonOutputType(params: ArktypeJsonTypeParams): string {\n const expression = params.expression.trim();\n return expression.length > 0 ? expression : 'unknown';\n}\n\nexport class ArktypeJsonCodecClass<TInferred> extends CodecImpl<\n typeof ARKTYPE_JSON_CODEC_ID,\n readonly ['equality'],\n string,\n TInferred\n> {\n constructor(\n descriptor: ArktypeJsonDescriptor,\n private readonly schema: ArktypeSchemaLike,\n ) {\n super(descriptor);\n }\n\n async encode(value: TInferred, _ctx: CodecCallContext): Promise<string> {\n return serializeToJsonSafe(this.schema, value).wire;\n }\n\n async decode(wire: string, _ctx: CodecCallContext): Promise<TInferred> {\n return validateSchema<TInferred>(this.schema, JSON.parse(wire));\n }\n\n encodeJson(value: TInferred): JsonValue {\n return serializeToJsonSafe(this.schema, value).json;\n }\n\n decodeJson(json: JsonValue): TInferred {\n return validateSchema<TInferred>(this.schema, json);\n }\n}\n\nconst arktypeJsonParamsSchema = type({\n expression: 'string',\n jsonIr: 'object',\n}) satisfies StandardSchemaV1<ArktypeJsonTypeParams>;\n\nexport class ArktypeJsonDescriptor extends CodecDescriptorImpl<ArktypeJsonTypeParams> {\n override readonly codecId = ARKTYPE_JSON_CODEC_ID;\n override readonly traits = ['equality'] as const;\n override readonly targetTypes = [ARKTYPE_JSON_NATIVE_TYPE] as const;\n override readonly paramsSchema: StandardSchemaV1<ArktypeJsonTypeParams> = arktypeJsonParamsSchema;\n override renderOutputType(params: ArktypeJsonTypeParams): string {\n return renderArktypeJsonOutputType(params);\n }\n override factory(\n params: ArktypeJsonTypeParams,\n ): (ctx: CodecInstanceContext) => ArktypeJsonCodecClass<unknown> {\n const schema = rehydrateSchema(params.jsonIr);\n /* c8 ignore start — defensive parity check; not exercised by typical contracts */\n const rehydratedExpression = (schema as { readonly expression?: unknown }).expression;\n if (typeof rehydratedExpression === 'string' && rehydratedExpression !== params.expression) {\n console.warn(\n `[arktype-json] typeParams.expression (${params.expression}) does not match rehydrated schema expression (${rehydratedExpression}); contract.json may be stale relative to the runtime schema.`,\n );\n }\n /* c8 ignore stop */\n return () => new ArktypeJsonCodecClass<unknown>(this, schema);\n }\n}\n\nexport const arktypeJsonDescriptor = new ArktypeJsonDescriptor();\n\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 {Error} 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 */\nexport function arktypeJsonColumn<S extends Type<unknown>>(\n schema: S,\n): ColumnSpec<ArktypeJsonCodecClass<S['infer']>, ArktypeJsonTypeParams> {\n if (!isArktypeSchemaLike(schema)) {\n throw new Error(\n typeof schema !== 'function'\n ? 'arktypeJsonColumn(schema) expects a callable arktype Type.'\n : 'arktypeJsonColumn(schema) expects an arktype Type (missing `expression: string`).',\n );\n }\n const jsonIr: unknown = (schema as { readonly json?: unknown }).json;\n if (jsonIr === null || typeof jsonIr !== 'object') {\n throw new Error('arktypeJsonColumn(schema) expects an arktype Type (missing `json` IR).');\n }\n const params: ArktypeJsonTypeParams = { expression: schema.expression, jsonIr };\n return column(\n (_ctx: CodecInstanceContext) =>\n new ArktypeJsonCodecClass<S['infer']>(arktypeJsonDescriptor, schema),\n arktypeJsonDescriptor.codecId,\n params,\n ARKTYPE_JSON_NATIVE_TYPE,\n );\n}\n\narktypeJsonColumn satisfies ColumnHelperFor<ArktypeJsonDescriptor>;\n// Note: `ColumnHelperForStrict` is intentionally not applied — `Codec` is invariant in `TInput` (encode contravariant, decode covariant), so `ArktypeJsonCodecClass<S['infer']>` is not assignable to `ArktypeJsonCodecClass<unknown>` (the descriptor.factory return). `expectTypeOf` tests cover the literal-preservation property strict satisfies would otherwise enforce.\n\n/**\n * Codec instance returned by `arktypeJsonColumn(schema).codecFactory(ctx)` and by `arktypeJsonDescriptor.factory(typeParams)(ctx)`. The `TInferred` slot carries the arktype schema's inferred output type at the column-author site; descriptor-side factories erase to `unknown`.\n */\nexport type ArktypeJsonCodec<TInferred> = ArktypeJsonCodecClass<TInferred>;\n\nexport const codecDescriptors: readonly AnyCodecDescriptor[] = [arktypeJsonDescriptor];\n"],"mappings":";;;;;;AA6BA,MAAa,wBAAwB;;AAGrC,MAAa,2BAA2B;AAoBxC,SAAS,oBAAoB,OAA4C;AACvE,KAAI,OAAO,UAAU,WAAY,QAAO;AAExC,QAAO,OADa,MAA4C,eACnC;;AAG/B,SAAS,eAA0B,QAA2B,OAA2B;CACvF,MAAM,SAAS,OAAO,MAAM;AAC5B,KAAI,kBAAkB,UACpB,OAAM,aACJ,yCACA,mDAAmD,OAAO,WAC1D;EAAE,SAAS;EAAuB,QAAQ,OAAO;EAAS,CAC3D;AAEH,QAAO;;AAGT,SAAS,oBACP,QACA,OACmC;CACnC,MAAMA,OAA2B,KAAK,UAAU,MAAM;AACtD,KAAI,OAAO,SAAS,SAClB,OAAM,aACJ,yCACA,6DAA6D,sBAAsB,IACnF,EAAE,SAAS,uBAAuB,CACnC;CAEH,MAAM,OAAO,KAAK,MAAM,KAAK;AAC7B,gBAAe,QAAQ,KAAK;AAC5B,QAAO;EAAE;EAAM;EAAM;;AAGvB,SAAS,gBAAgB,QAAmC;CAC1D,IAAIC;AACJ,KAAI;AACF,eAAa,IAAI,OAAO,OAAO;UACxB,OAAO;AACd,QAAM;GACJ;;GAEA,wDAAwD,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM;GAC9G;IAAE,SAAS;IAAuB;IAAQ;GAC3C;;;AAGH,KAAI,CAAC,oBAAoB,WAAW,CAClC,OAAM,aACJ,yCACA,wGAAwG,sBAAsB,IAC9H;EAAE,SAAS;EAAuB;EAAQ,CAC3C;;AAGH,QAAO;;AAGT,SAAS,4BAA4B,QAAuC;CAC1E,MAAM,aAAa,OAAO,WAAW,MAAM;AAC3C,QAAO,WAAW,SAAS,IAAI,aAAa;;AAG9C,IAAa,wBAAb,cAAsD,UAKpD;CACA,YACE,YACA,AAAiBC,QACjB;AACA,QAAM,WAAW;EAFA;;CAKnB,MAAM,OAAO,OAAkB,MAAyC;AACtE,SAAO,oBAAoB,KAAK,QAAQ,MAAM,CAAC;;CAGjD,MAAM,OAAO,MAAc,MAA4C;AACrE,SAAO,eAA0B,KAAK,QAAQ,KAAK,MAAM,KAAK,CAAC;;CAGjE,WAAW,OAA6B;AACtC,SAAO,oBAAoB,KAAK,QAAQ,MAAM,CAAC;;CAGjD,WAAW,MAA4B;AACrC,SAAO,eAA0B,KAAK,QAAQ,KAAK;;;AAIvD,MAAM,0BAA0B,KAAK;CACnC,YAAY;CACZ,QAAQ;CACT,CAAC;AAEF,IAAa,wBAAb,cAA2C,oBAA2C;CACpF,AAAkB,UAAU;CAC5B,AAAkB,SAAS,CAAC,WAAW;CACvC,AAAkB,cAAc,CAAC,yBAAyB;CAC1D,AAAkB,eAAwD;CAC1E,AAAS,iBAAiB,QAAuC;AAC/D,SAAO,4BAA4B,OAAO;;CAE5C,AAAS,QACP,QAC+D;EAC/D,MAAM,SAAS,gBAAgB,OAAO,OAAO;;EAE7C,MAAM,uBAAwB,OAA6C;AAC3E,MAAI,OAAO,yBAAyB,YAAY,yBAAyB,OAAO,WAC9E,SAAQ,KACN,yCAAyC,OAAO,WAAW,iDAAiD,qBAAqB,+DAClI;;AAGH,eAAa,IAAI,sBAA+B,MAAM,OAAO;;;AAIjE,MAAa,wBAAwB,IAAI,uBAAuB;;;;;;;;AAShE,SAAgB,kBACd,QACsE;AACtE,KAAI,CAAC,oBAAoB,OAAO,CAC9B,OAAM,IAAI,MACR,OAAO,WAAW,aACd,+DACA,oFACL;CAEH,MAAMC,SAAmB,OAAuC;AAChE,KAAI,WAAW,QAAQ,OAAO,WAAW,SACvC,OAAM,IAAI,MAAM,yEAAyE;CAE3F,MAAMC,SAAgC;EAAE,YAAY,OAAO;EAAY;EAAQ;AAC/E,QAAO,QACJ,SACC,IAAI,sBAAkC,uBAAuB,OAAO,EACtE,sBAAsB,SACtB,QACA,yBACD;;AAWH,MAAaC,mBAAkD,CAAC,sBAAsB"}
@@ -0,0 +1,58 @@
1
+ import { CodecCallContext, CodecDescriptorImpl, CodecImpl, CodecInstanceContext, ColumnSpec } from "@prisma-next/framework-components/codec";
2
+ import { Type } from "arktype";
3
+ import { JsonValue } from "@prisma-next/contract/types";
4
+ import { StandardSchemaV1 } from "@standard-schema/spec";
5
+
6
+ //#region src/core/arktype-json-codec.d.ts
7
+
8
+ /** Codec id for arktype-backed JSON columns. Library-bound, not target-bound. */
9
+ declare const ARKTYPE_JSON_CODEC_ID: "arktype/json@1";
10
+ /** Native storage type backing the codec. JSONB on Postgres; binary, indexable. */
11
+ declare const ARKTYPE_JSON_NATIVE_TYPE: "jsonb";
12
+ /**
13
+ * Eagerly serialized typeParams for the arktype-json column. Carried in the contract IR; the runtime descriptor's factory rehydrates `jsonIr` and the emitter consumes `expression`.
14
+ */
15
+ type ArktypeJsonTypeParams = {
16
+ /**
17
+ * Arktype's TypeScript-source-like rendering of the schema. Read by `renderOutputType` to emit the column's TS type into `contract.d.ts`. Stable across the serialize/rehydrate cycle: the rehydrated schema's `expression` matches the source schema's.
18
+ */
19
+ readonly expression: string;
20
+ /**
21
+ * Arktype's internal IR for the schema. Lossless; the rehydration source. Schema-shape — `ark.schema(jsonIr)` reconstructs a callable `Type`-like structurally identical to the original `type(definition)` output.
22
+ */
23
+ readonly jsonIr: object;
24
+ };
25
+ type ArktypeSchemaLike = ((value: unknown) => unknown) & {
26
+ readonly expression: string;
27
+ };
28
+ declare class ArktypeJsonCodecClass<TInferred> extends CodecImpl<typeof ARKTYPE_JSON_CODEC_ID, readonly ['equality'], string, TInferred> {
29
+ private readonly schema;
30
+ constructor(descriptor: ArktypeJsonDescriptor, schema: ArktypeSchemaLike);
31
+ encode(value: TInferred, _ctx: CodecCallContext): Promise<string>;
32
+ decode(wire: string, _ctx: CodecCallContext): Promise<TInferred>;
33
+ encodeJson(value: TInferred): JsonValue;
34
+ decodeJson(json: JsonValue): TInferred;
35
+ }
36
+ declare class ArktypeJsonDescriptor extends CodecDescriptorImpl<ArktypeJsonTypeParams> {
37
+ readonly codecId: "arktype/json@1";
38
+ readonly traits: readonly ["equality"];
39
+ readonly targetTypes: readonly ["jsonb"];
40
+ readonly paramsSchema: StandardSchemaV1<ArktypeJsonTypeParams>;
41
+ renderOutputType(params: ArktypeJsonTypeParams): string;
42
+ factory(params: ArktypeJsonTypeParams): (ctx: CodecInstanceContext) => ArktypeJsonCodecClass<unknown>;
43
+ }
44
+ /**
45
+ * 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.
46
+ *
47
+ * Eager serialization at this call site captures `expression` (for the emit-path renderer) and `jsonIr` (for runtime rehydration via the descriptor's factory).
48
+ *
49
+ * @throws {Error} 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.
50
+ */
51
+ declare function arktypeJsonColumn<S extends Type<unknown>>(schema: S): ColumnSpec<ArktypeJsonCodecClass<S['infer']>, ArktypeJsonTypeParams>;
52
+ /**
53
+ * Codec instance returned by `arktypeJsonColumn(schema).codecFactory(ctx)` and by `arktypeJsonDescriptor.factory(typeParams)(ctx)`. The `TInferred` slot carries the arktype schema's inferred output type at the column-author site; descriptor-side factories erase to `unknown`.
54
+ */
55
+ type ArktypeJsonCodec<TInferred> = ArktypeJsonCodecClass<TInferred>;
56
+ //#endregion
57
+ 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 };
58
+ //# sourceMappingURL=arktype-json-codec-DBfCWQkt.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arktype-json-codec-DBfCWQkt.d.mts","names":[],"sources":["../src/core/arktype-json-codec.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAiI0D,cApG7C,qBAoG6C,EAAA,gBAAA;;AAII,cArGjD,wBAqGiD,EAAA,OAAA;;;;AAQ3C,KAxGP,qBAAA,GAwGO;EAAY;;;EAUlB,SAAA,UAAA,EAAA,MAAsB;EAA4B;;;EAK3B,SAAA,MAAA,EAAA,MAAA;CAIxB;KAhHP,iBAAA,GAiHM,CAAA,CAAA,KAAA,EAAA,OAAA,EAAA,GAAA,OAAA,CAAA,GAAA;EAAyB,SAAA,UAAA,EAAA,MAAA;CAVO;AAAmB,cAnCjD,qBAmCiD,CAAA,SAAA,CAAA,SAnCR,SAmCQ,CAAA,OAlCrD,qBAkCqD,EAAA,SAAA,CAAA,UAAA,CAAA,EAAA,MAAA,EA/B5D,SA+B4D,CAAA,CAAA;EAiC9C,iBAAA,MAAiB;EAAW,WAAA,CAAA,UAAA,EA7D5B,qBA6D4B,EAAA,MAAA,EA5Df,iBA4De;EAClC,MAAA,CAAA,KAAA,EAxDY,SAwDZ,EAAA,IAAA,EAxD6B,gBAwD7B,CAAA,EAxDgD,OAwDhD,CAAA,MAAA,CAAA;EAC0B,MAAA,CAAA,IAAA,EAAA,MAAA,EAAA,IAAA,EArDD,gBAqDC,CAAA,EArDkB,OAqDlB,CArD0B,SAqD1B,CAAA;EAAtB,UAAA,CAAA,KAAA,EAjDM,SAiDN,CAAA,EAjDkB,SAiDlB;EAAmC,UAAA,CAAA,IAAA,EA7C9B,SA6C8B,CAAA,EA7ClB,SA6CkB;;AAApC,cAnCA,qBAAA,SAA8B,mBAmC9B,CAnCkD,qBAmClD,CAAA,CAAA;EA4BD,SAAA,OAAA,EAAA,gBAAgB;;;yBA3DM,iBAAiB;2BACf;kBAIxB,8BACD,yBAAyB;;;;;;;;;iBAuBpB,4BAA4B,uBAClC,IACP,WAAW,sBAAsB,aAAa;;;;KA4BrC,8BAA8B,sBAAsB"}
@@ -24,4 +24,4 @@ type CodecTypes = {
24
24
  };
25
25
  //#endregion
26
26
  export { CodecTypes as t };
27
- //# sourceMappingURL=codec-types-CH37Yc0C.d.mts.map
27
+ //# sourceMappingURL=codec-types-5Jy4t54u.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codec-types-5Jy4t54u.d.mts","names":[],"sources":["../src/types/codec-types.ts"],"sourcesContent":[],"mappings":";;AAiBA;;;;;;;;;;;;;;;KAAY,UAAA"}
@@ -1,2 +1,2 @@
1
- import { t as CodecTypes } from "./codec-types-CH37Yc0C.mjs";
1
+ import { t as CodecTypes } from "./codec-types-5Jy4t54u.mjs";
2
2
  export { type CodecTypes };
package/dist/codecs.d.mts CHANGED
@@ -1,2 +1,14 @@
1
- import { i as ArktypeJsonTypeParams, n as ARKTYPE_JSON_NATIVE_TYPE, o as arktypeJsonCodec, r as ArktypeJsonCodec, t as ARKTYPE_JSON_CODEC_ID } from "./arktype-json-codec-yNv1hzBm.mjs";
2
- export { ARKTYPE_JSON_CODEC_ID, ARKTYPE_JSON_NATIVE_TYPE, type ArktypeJsonCodec, type ArktypeJsonTypeParams, arktypeJsonCodec };
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-DBfCWQkt.mjs";
2
+ import { CodecDescriptorRegistry } from "@prisma-next/sql-relational-core/query-lane-context";
3
+
4
+ //#region src/core/registry.d.ts
5
+
6
+ /**
7
+ * Registry of every codec descriptor shipped by `@prisma-next/extension-arktype-json`.
8
+ *
9
+ * 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.
10
+ */
11
+ declare const arktypeJsonCodecRegistry: CodecDescriptorRegistry;
12
+ //#endregion
13
+ export { ARKTYPE_JSON_CODEC_ID, ARKTYPE_JSON_NATIVE_TYPE, type ArktypeJsonCodec, type ArktypeJsonDescriptor, type ArktypeJsonTypeParams, arktypeJsonCodecRegistry, arktypeJsonColumn };
14
+ //# sourceMappingURL=codecs.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codecs.d.mts","names":[],"sources":["../src/core/registry.ts"],"sourcesContent":[],"mappings":";;;;;;;;AASA;;cAAa,0BAA0B"}
package/dist/codecs.mjs CHANGED
@@ -1,3 +1,4 @@
1
- import { i as arktypeJsonCodec, n as ARKTYPE_JSON_NATIVE_TYPE, t as ARKTYPE_JSON_CODEC_ID } from "./arktype-json-codec-BbiBmtTK.mjs";
1
+ import { n as ARKTYPE_JSON_NATIVE_TYPE, r as arktypeJsonColumn, t as ARKTYPE_JSON_CODEC_ID } from "./arktype-json-codec-Cykol-li.mjs";
2
+ import { t as arktypeJsonCodecRegistry } from "./registry-DN6MqSGJ.mjs";
2
3
 
3
- export { ARKTYPE_JSON_CODEC_ID, ARKTYPE_JSON_NATIVE_TYPE, arktypeJsonCodec };
4
+ export { ARKTYPE_JSON_CODEC_ID, ARKTYPE_JSON_NATIVE_TYPE, arktypeJsonCodecRegistry, arktypeJsonColumn };
@@ -1,2 +1,2 @@
1
- import { a as arktypeJson, i as ArktypeJsonTypeParams, r as ArktypeJsonCodec } from "./arktype-json-codec-yNv1hzBm.mjs";
2
- export { type ArktypeJsonCodec, type ArktypeJsonTypeParams, arktypeJson };
1
+ import { a as ArktypeJsonTypeParams, o as arktypeJsonColumn, r as ArktypeJsonCodec } from "./arktype-json-codec-DBfCWQkt.mjs";
2
+ export { type ArktypeJsonCodec, type ArktypeJsonTypeParams, arktypeJsonColumn as arktypeJson };
@@ -1,3 +1,3 @@
1
- import { r as arktypeJson } from "./arktype-json-codec-BbiBmtTK.mjs";
1
+ import { r as arktypeJsonColumn } from "./arktype-json-codec-Cykol-li.mjs";
2
2
 
3
- export { arktypeJson };
3
+ export { arktypeJsonColumn as arktypeJson };
package/dist/control.mjs CHANGED
@@ -1,5 +1,6 @@
1
- import { t as ARKTYPE_JSON_CODEC_ID } from "./arktype-json-codec-BbiBmtTK.mjs";
2
- import { t as arktypeJsonPackMeta } from "./pack-meta-DycetSQB.mjs";
1
+ import { t as ARKTYPE_JSON_CODEC_ID } from "./arktype-json-codec-Cykol-li.mjs";
2
+ import "./registry-DN6MqSGJ.mjs";
3
+ import { t as arktypeJsonPackMeta } from "./pack-meta-BaJhoZfD.mjs";
3
4
 
4
5
  //#region src/exports/control.ts
5
6
  const arktypeJsonControlPlaneHooks = { expandNativeType: ({ nativeType }) => nativeType };
@@ -1 +1 @@
1
- {"version":3,"file":"control.mjs","names":["arktypeJsonControlPlaneHooks: CodecControlHooks","arktypeJsonExtensionDescriptor: SqlControlExtensionDescriptor<'postgres'>"],"sources":["../src/exports/control.ts"],"sourcesContent":["/**\n * Control-plane extension descriptor for arktype-json.\n *\n * Composes pack metadata and the control-plane hooks into the migration-\n * plane shape the framework's control stack consumes. Lives at the\n * control-plane entrypoint so `src/core/**` stays free of migration-plane\n * imports (per `.cursor/rules/multi-plane-entrypoints.mdc`).\n *\n * Unlike pgvector, arktype-json has no database extension to install\n * (`jsonb` is a built-in Postgres type), no `databaseDependencies`, no\n * query operations, and the only control-plane hook is the identity\n * `expandNativeType` (jsonb is dimension-free; the schema in typeParams\n * affects runtime validation only, never DDL).\n */\n\nimport type {\n CodecControlHooks,\n SqlControlExtensionDescriptor,\n} from '@prisma-next/family-sql/control';\nimport { ARKTYPE_JSON_CODEC_ID } from '../core/arktype-json-codec';\nimport { arktypeJsonPackMeta } from '../core/pack-meta';\n\nconst arktypeJsonControlPlaneHooks: CodecControlHooks = {\n expandNativeType: ({ nativeType }) => nativeType,\n};\n\nexport const arktypeJsonExtensionDescriptor: SqlControlExtensionDescriptor<'postgres'> = {\n ...arktypeJsonPackMeta,\n types: {\n ...arktypeJsonPackMeta.types,\n codecTypes: {\n ...arktypeJsonPackMeta.types.codecTypes,\n controlPlaneHooks: {\n [ARKTYPE_JSON_CODEC_ID]: arktypeJsonControlPlaneHooks,\n },\n },\n },\n create: () => ({\n familyId: 'sql' as const,\n targetId: 'postgres' as const,\n }),\n};\n\nexport default arktypeJsonExtensionDescriptor;\n"],"mappings":";;;;AAsBA,MAAMA,+BAAkD,EACtD,mBAAmB,EAAE,iBAAiB,YACvC;AAED,MAAaC,iCAA4E;CACvF,GAAG;CACH,OAAO;EACL,GAAG,oBAAoB;EACvB,YAAY;GACV,GAAG,oBAAoB,MAAM;GAC7B,mBAAmB,GAChB,wBAAwB,8BAC1B;GACF;EACF;CACD,eAAe;EACb,UAAU;EACV,UAAU;EACX;CACF;AAED,sBAAe"}
1
+ {"version":3,"file":"control.mjs","names":["arktypeJsonControlPlaneHooks: CodecControlHooks","arktypeJsonExtensionDescriptor: SqlControlExtensionDescriptor<'postgres'>"],"sources":["../src/exports/control.ts"],"sourcesContent":["/**\n * Control-plane extension descriptor for arktype-json.\n *\n * Composes pack metadata and the control-plane hooks into the migration-\n * plane shape the framework's control stack consumes. Lives at the\n * control-plane entrypoint so `src/core/**` stays free of migration-plane\n * imports (per `.cursor/rules/multi-plane-entrypoints.mdc`).\n *\n * Unlike pgvector, arktype-json has no database extension to install\n * (`jsonb` is a built-in Postgres type), no `databaseDependencies`, no\n * query operations, and the only control-plane hook is the identity\n * `expandNativeType` (jsonb is dimension-free; the schema in typeParams\n * affects runtime validation only, never DDL).\n */\n\nimport type {\n CodecControlHooks,\n SqlControlExtensionDescriptor,\n} from '@prisma-next/family-sql/control';\nimport { ARKTYPE_JSON_CODEC_ID } from '../core/arktype-json-codec';\nimport { arktypeJsonPackMeta } from '../core/pack-meta';\n\nconst arktypeJsonControlPlaneHooks: CodecControlHooks = {\n expandNativeType: ({ nativeType }) => nativeType,\n};\n\nexport const arktypeJsonExtensionDescriptor: SqlControlExtensionDescriptor<'postgres'> = {\n ...arktypeJsonPackMeta,\n types: {\n ...arktypeJsonPackMeta.types,\n codecTypes: {\n ...arktypeJsonPackMeta.types.codecTypes,\n controlPlaneHooks: {\n [ARKTYPE_JSON_CODEC_ID]: arktypeJsonControlPlaneHooks,\n },\n },\n },\n create: () => ({\n familyId: 'sql' as const,\n targetId: 'postgres' as const,\n }),\n};\n\nexport default arktypeJsonExtensionDescriptor;\n"],"mappings":";;;;;AAsBA,MAAMA,+BAAkD,EACtD,mBAAmB,EAAE,iBAAiB,YACvC;AAED,MAAaC,iCAA4E;CACvF,GAAG;CACH,OAAO;EACL,GAAG,oBAAoB;EACvB,YAAY;GACV,GAAG,oBAAoB,MAAM;GAC7B,mBAAmB,GAChB,wBAAwB,8BAC1B;GACF;EACF;CACD,eAAe;EACb,UAAU;EACV,UAAU;EACX;CACF;AAED,sBAAe"}
@@ -1,4 +1,5 @@
1
- import { a as arktypeJsonEmitCodec, t as ARKTYPE_JSON_CODEC_ID } from "./arktype-json-codec-BbiBmtTK.mjs";
1
+ import { t as ARKTYPE_JSON_CODEC_ID } from "./arktype-json-codec-Cykol-li.mjs";
2
+ import { t as arktypeJsonCodecRegistry } from "./registry-DN6MqSGJ.mjs";
2
3
 
3
4
  //#region src/core/pack-meta.ts
4
5
  const arktypeJsonPackMetaBase = {
@@ -10,7 +11,7 @@ const arktypeJsonPackMetaBase = {
10
11
  capabilities: {},
11
12
  types: {
12
13
  codecTypes: {
13
- codecInstances: [arktypeJsonEmitCodec],
14
+ codecDescriptors: Array.from(arktypeJsonCodecRegistry.values()),
14
15
  import: {
15
16
  package: "@prisma-next/extension-arktype-json/codec-types",
16
17
  named: "CodecTypes",
@@ -26,12 +27,10 @@ const arktypeJsonPackMetaBase = {
26
27
  }
27
28
  };
28
29
  /**
29
- * Public pack metadata. The phantom `__codecTypes` field threads the
30
- * codec-types map's literal type into the pack ref so contract-builder
31
- * generics can pick it up; it is never accessed at runtime.
30
+ * 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.
32
31
  */
33
32
  const arktypeJsonPackMeta = arktypeJsonPackMetaBase;
34
33
 
35
34
  //#endregion
36
35
  export { arktypeJsonPackMeta as t };
37
- //# sourceMappingURL=pack-meta-DycetSQB.mjs.map
36
+ //# sourceMappingURL=pack-meta-BaJhoZfD.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pack-meta-BaJhoZfD.mjs","names":["arktypeJsonPackMeta: typeof arktypeJsonPackMetaBase & {\n readonly __codecTypes?: CodecTypes;\n}"],"sources":["../src/core/pack-meta.ts"],"sourcesContent":["/**\n * arktype-json pack metadata.\n *\n * The pack metadata is the framework-composition entry point: control-stack assembly reads `types.codecTypes.import` to thread the type-side imports into emitted `contract.d.ts`, and `types.storage` declares the codec id's storage backing (`jsonb` on Postgres).\n *\n * Per TML-2357 runtime materialization flows through the unified descriptor map (`arktypeJsonDescriptor`) and the emit path consults `descriptorFor('arktype/json@1').renderOutputType` directly — no per-library \"emit-only Codec\" stub.\n */\n\nimport type { CodecTypes } from '../types/codec-types';\nimport { ARKTYPE_JSON_CODEC_ID } from './arktype-json-codec';\nimport { arktypeJsonCodecRegistry } from './registry';\n\nconst arktypeJsonPackMetaBase = {\n kind: 'extension',\n id: 'arktype-json',\n familyId: 'sql',\n targetId: 'postgres',\n version: '0.0.1',\n capabilities: {},\n types: {\n codecTypes: {\n codecDescriptors: Array.from(arktypeJsonCodecRegistry.values()),\n import: {\n package: '@prisma-next/extension-arktype-json/codec-types',\n named: 'CodecTypes',\n alias: 'ArktypeJsonTypes',\n },\n },\n storage: [\n {\n typeId: ARKTYPE_JSON_CODEC_ID,\n familyId: 'sql' as const,\n targetId: 'postgres' as const,\n nativeType: 'jsonb',\n },\n ],\n },\n} as const;\n\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 */\nexport const arktypeJsonPackMeta: typeof arktypeJsonPackMetaBase & {\n readonly __codecTypes?: CodecTypes;\n} = arktypeJsonPackMetaBase;\n"],"mappings":";;;;AAYA,MAAM,0BAA0B;CAC9B,MAAM;CACN,IAAI;CACJ,UAAU;CACV,UAAU;CACV,SAAS;CACT,cAAc,EAAE;CAChB,OAAO;EACL,YAAY;GACV,kBAAkB,MAAM,KAAK,yBAAyB,QAAQ,CAAC;GAC/D,QAAQ;IACN,SAAS;IACT,OAAO;IACP,OAAO;IACR;GACF;EACD,SAAS,CACP;GACE,QAAQ;GACR,UAAU;GACV,UAAU;GACV,YAAY;GACb,CACF;EACF;CACF;;;;AAKD,MAAaA,sBAET"}
package/dist/pack.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as CodecTypes } from "./codec-types-CH37Yc0C.mjs";
1
+ import { t as CodecTypes } from "./codec-types-5Jy4t54u.mjs";
2
2
  import * as _prisma_next_framework_components_codec0 from "@prisma-next/framework-components/codec";
3
3
 
4
4
  //#region src/core/pack-meta.d.ts
@@ -12,7 +12,7 @@ declare const arktypeJsonPackMetaBase: {
12
12
  readonly capabilities: {};
13
13
  readonly types: {
14
14
  readonly codecTypes: {
15
- readonly codecInstances: readonly [_prisma_next_framework_components_codec0.Codec<"arktype/json@1", readonly ["equality"], string, unknown>];
15
+ readonly codecDescriptors: _prisma_next_framework_components_codec0.CodecDescriptor<unknown>[];
16
16
  readonly import: {
17
17
  readonly package: "@prisma-next/extension-arktype-json/codec-types";
18
18
  readonly named: "CodecTypes";
@@ -28,9 +28,7 @@ declare const arktypeJsonPackMetaBase: {
28
28
  };
29
29
  };
30
30
  /**
31
- * Public pack metadata. The phantom `__codecTypes` field threads the
32
- * codec-types map's literal type into the pack ref so contract-builder
33
- * generics can pick it up; it is never accessed at runtime.
31
+ * 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.
34
32
  */
35
33
  declare const arktypeJsonPackMeta: typeof arktypeJsonPackMetaBase & {
36
34
  readonly __codecTypes?: CodecTypes;
@@ -1 +1 @@
1
- {"version":3,"file":"pack.d.mts","names":[],"sources":["../src/core/pack-meta.ts"],"sourcesContent":[],"mappings":";;;;;cAsBM;;;;;;;;;yCA+BI,wCAAA,CAAA;;;;;;;;;;;;;;;;;;;;cAOG,4BAA4B;0BACf"}
1
+ {"version":3,"file":"pack.d.mts","names":[],"sources":["../src/core/pack-meta.ts"],"sourcesContent":[],"mappings":";;;;;cAYM;;;;;;;;;iCAyBI,wCAAA,CAAA;;;;;;;;;;;;;;;;;;cAKG,4BAA4B;0BACf"}
package/dist/pack.mjs CHANGED
@@ -1,3 +1,5 @@
1
- import { t as arktypeJsonPackMeta } from "./pack-meta-DycetSQB.mjs";
1
+ import "./arktype-json-codec-Cykol-li.mjs";
2
+ import "./registry-DN6MqSGJ.mjs";
3
+ import { t as arktypeJsonPackMeta } from "./pack-meta-BaJhoZfD.mjs";
2
4
 
3
5
  export { arktypeJsonPackMeta, arktypeJsonPackMeta as default };
@@ -0,0 +1,14 @@
1
+ import { i as codecDescriptors } from "./arktype-json-codec-Cykol-li.mjs";
2
+ import { buildCodecDescriptorRegistry } from "@prisma-next/sql-relational-core/codec-descriptor-registry";
3
+
4
+ //#region src/core/registry.ts
5
+ /**
6
+ * Registry of every codec descriptor shipped by `@prisma-next/extension-arktype-json`.
7
+ *
8
+ * 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.
9
+ */
10
+ const arktypeJsonCodecRegistry = buildCodecDescriptorRegistry(codecDescriptors);
11
+
12
+ //#endregion
13
+ export { arktypeJsonCodecRegistry as t };
14
+ //# sourceMappingURL=registry-DN6MqSGJ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry-DN6MqSGJ.mjs","names":["arktypeJsonCodecRegistry: CodecDescriptorRegistry"],"sources":["../src/core/registry.ts"],"sourcesContent":["import { buildCodecDescriptorRegistry } from '@prisma-next/sql-relational-core/codec-descriptor-registry';\nimport type { CodecDescriptorRegistry } from '@prisma-next/sql-relational-core/query-lane-context';\nimport { codecDescriptors } from './arktype-json-codec';\n\n/**\n * Registry of every codec descriptor shipped by `@prisma-next/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 */\nexport const arktypeJsonCodecRegistry: CodecDescriptorRegistry =\n buildCodecDescriptorRegistry(codecDescriptors);\n"],"mappings":";;;;;;;;;AASA,MAAaA,2BACX,6BAA6B,iBAAiB"}
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.d.mts","names":[],"sources":["../src/exports/runtime.ts"],"sourcesContent":[],"mappings":";;;;cA0Ba,8BAA8B"}
1
+ {"version":3,"file":"runtime.d.mts","names":[],"sources":["../src/exports/runtime.ts"],"sourcesContent":[],"mappings":";;;;cAYa,8BAA8B"}
package/dist/runtime.mjs CHANGED
@@ -1,33 +1,15 @@
1
- import { i as arktypeJsonCodec } from "./arktype-json-codec-BbiBmtTK.mjs";
2
- import { t as arktypeJsonPackMeta } from "./pack-meta-DycetSQB.mjs";
3
- import { createCodecRegistry } from "@prisma-next/sql-relational-core/ast";
1
+ import "./arktype-json-codec-Cykol-li.mjs";
2
+ import { t as arktypeJsonCodecRegistry } from "./registry-DN6MqSGJ.mjs";
3
+ import { t as arktypeJsonPackMeta } from "./pack-meta-BaJhoZfD.mjs";
4
4
 
5
5
  //#region src/exports/runtime.ts
6
- /**
7
- * Runtime-plane extension descriptor for arktype-json.
8
- *
9
- * Registers `arktypeJsonCodec` (the parameterized codec descriptor)
10
- * through the SQL runtime's `parameterizedCodecs:` slot. Per Phase B of
11
- * codec-registry-unification, the legacy `codecs:` slot returns an empty
12
- * registry — the unified descriptor map subsumes the codec-id-keyed
13
- * metadata reads that the legacy slot used to back, and the runtime
14
- * dispatch (`forColumn`) materializes the per-instance codec from the
15
- * descriptor's factory.
16
- *
17
- * Lives at the runtime-plane entrypoint so `src/core/**` stays free of
18
- * runtime-plane imports (per `.cursor/rules/multi-plane-entrypoints.mdc`).
19
- */
20
- function createArktypeJsonCodecRegistry() {
21
- return createCodecRegistry();
22
- }
23
6
  const arktypeJsonRuntimeDescriptor = {
24
7
  kind: "extension",
25
8
  id: arktypeJsonPackMeta.id,
26
9
  version: arktypeJsonPackMeta.version,
27
10
  familyId: "sql",
28
11
  targetId: "postgres",
29
- codecs: createArktypeJsonCodecRegistry,
30
- parameterizedCodecs: () => [arktypeJsonCodec],
12
+ codecs: () => Array.from(arktypeJsonCodecRegistry.values()),
31
13
  create() {
32
14
  return {
33
15
  familyId: "sql",
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.mjs","names":["arktypeJsonRuntimeDescriptor: SqlRuntimeExtensionDescriptor<'postgres'>"],"sources":["../src/exports/runtime.ts"],"sourcesContent":["/**\n * Runtime-plane extension descriptor for arktype-json.\n *\n * Registers `arktypeJsonCodec` (the parameterized codec descriptor)\n * through the SQL runtime's `parameterizedCodecs:` slot. Per Phase B of\n * codec-registry-unification, the legacy `codecs:` slot returns an empty\n * registry — the unified descriptor map subsumes the codec-id-keyed\n * metadata reads that the legacy slot used to back, and the runtime\n * dispatch (`forColumn`) materializes the per-instance codec from the\n * descriptor's factory.\n *\n * Lives at the runtime-plane entrypoint so `src/core/**` stays free of\n * runtime-plane imports (per `.cursor/rules/multi-plane-entrypoints.mdc`).\n */\n\nimport { createCodecRegistry } from '@prisma-next/sql-relational-core/ast';\nimport type { SqlRuntimeExtensionDescriptor } from '@prisma-next/sql-runtime';\nimport { arktypeJsonCodec } from '../core/arktype-json-codec';\nimport { arktypeJsonPackMeta } from '../core/pack-meta';\n\nfunction createArktypeJsonCodecRegistry() {\n // arktype-json ships only the parameterized descriptor; the legacy\n // `codecs:` slot has nothing to register.\n return createCodecRegistry();\n}\n\nexport const arktypeJsonRuntimeDescriptor: SqlRuntimeExtensionDescriptor<'postgres'> = {\n kind: 'extension' as const,\n id: arktypeJsonPackMeta.id,\n version: arktypeJsonPackMeta.version,\n familyId: 'sql' as const,\n targetId: 'postgres' as const,\n codecs: createArktypeJsonCodecRegistry,\n parameterizedCodecs: () => [arktypeJsonCodec],\n create() {\n return {\n familyId: 'sql' as const,\n targetId: 'postgres' as const,\n };\n },\n};\n\nexport default arktypeJsonRuntimeDescriptor;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAoBA,SAAS,iCAAiC;AAGxC,QAAO,qBAAqB;;AAG9B,MAAaA,+BAA0E;CACrF,MAAM;CACN,IAAI,oBAAoB;CACxB,SAAS,oBAAoB;CAC7B,UAAU;CACV,UAAU;CACV,QAAQ;CACR,2BAA2B,CAAC,iBAAiB;CAC7C,SAAS;AACP,SAAO;GACL,UAAU;GACV,UAAU;GACX;;CAEJ;AAED,sBAAe"}
1
+ {"version":3,"file":"runtime.mjs","names":["arktypeJsonRuntimeDescriptor: SqlRuntimeExtensionDescriptor<'postgres'>"],"sources":["../src/exports/runtime.ts"],"sourcesContent":["/**\n * Runtime-plane extension descriptor for arktype-json.\n *\n * Registers `arktypeJsonCodec` (the unified `CodecDescriptor`) through the SQL runtime's `codecs:` slot. Per TML-2357 the dedicated parameterized-codec slot retired — the unified descriptor map dispatches every codec id, parameterized or not.\n *\n * Lives at the runtime-plane entrypoint so `src/core/**` stays free of runtime-plane imports (per `.cursor/rules/multi-plane-entrypoints.mdc`).\n */\n\nimport type { SqlRuntimeExtensionDescriptor } from '@prisma-next/sql-runtime';\nimport { arktypeJsonPackMeta } from '../core/pack-meta';\nimport { arktypeJsonCodecRegistry } from '../core/registry';\n\nexport const arktypeJsonRuntimeDescriptor: SqlRuntimeExtensionDescriptor<'postgres'> = {\n kind: 'extension' as const,\n id: arktypeJsonPackMeta.id,\n version: arktypeJsonPackMeta.version,\n familyId: 'sql' as const,\n targetId: 'postgres' as const,\n codecs: () => Array.from(arktypeJsonCodecRegistry.values()),\n create() {\n return {\n familyId: 'sql' as const,\n targetId: 'postgres' as const,\n };\n },\n};\n\nexport default arktypeJsonRuntimeDescriptor;\n"],"mappings":";;;;;AAYA,MAAaA,+BAA0E;CACrF,MAAM;CACN,IAAI,oBAAoB;CACxB,SAAS,oBAAoB;CAC7B,UAAU;CACV,UAAU;CACV,cAAc,MAAM,KAAK,yBAAyB,QAAQ,CAAC;CAC3D,SAAS;AACP,SAAO;GACL,UAAU;GACV,UAAU;GACX;;CAEJ;AAED,sBAAe"}
package/package.json CHANGED
@@ -1,23 +1,24 @@
1
1
  {
2
2
  "name": "@prisma-next/extension-arktype-json",
3
- "version": "0.5.0-dev.60",
3
+ "version": "0.5.0-dev.61",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "dependencies": {
8
+ "@standard-schema/spec": "^1.1.0",
8
9
  "arktype": "^2.1.29",
9
- "@prisma-next/contract": "0.5.0-dev.60",
10
- "@prisma-next/contract-authoring": "0.5.0-dev.60",
11
- "@prisma-next/family-sql": "0.5.0-dev.60",
12
- "@prisma-next/sql-relational-core": "0.5.0-dev.60",
13
- "@prisma-next/framework-components": "0.5.0-dev.60",
14
- "@prisma-next/sql-runtime": "0.5.0-dev.60"
10
+ "@prisma-next/contract": "0.5.0-dev.61",
11
+ "@prisma-next/contract-authoring": "0.5.0-dev.61",
12
+ "@prisma-next/family-sql": "0.5.0-dev.61",
13
+ "@prisma-next/framework-components": "0.5.0-dev.61",
14
+ "@prisma-next/sql-runtime": "0.5.0-dev.61",
15
+ "@prisma-next/sql-relational-core": "0.5.0-dev.61"
15
16
  },
16
17
  "devDependencies": {
17
18
  "tsdown": "0.18.4",
18
19
  "typescript": "5.9.3",
19
20
  "vitest": "4.0.17",
20
- "@prisma-next/sql-contract": "0.5.0-dev.60",
21
+ "@prisma-next/sql-contract": "0.5.0-dev.61",
21
22
  "@prisma-next/test-utils": "0.0.1",
22
23
  "@prisma-next/tsconfig": "0.0.0",
23
24
  "@prisma-next/tsdown": "0.0.0"