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

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
@@ -1,28 +1,14 @@
1
1
  /**
2
2
  * Runtime-plane extension descriptor for arktype-json.
3
3
  *
4
- * Registers `arktypeJsonCodec` (the parameterized codec descriptor)
5
- * through the SQL runtime's `parameterizedCodecs:` slot. Per Phase B of
6
- * codec-registry-unification, the legacy `codecs:` slot returns an empty
7
- * registry — the unified descriptor map subsumes the codec-id-keyed
8
- * metadata reads that the legacy slot used to back, and the runtime
9
- * dispatch (`forColumn`) materializes the per-instance codec from the
10
- * descriptor's factory.
4
+ * 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.
11
5
  *
12
- * Lives at the runtime-plane entrypoint so `src/core/**` stays free of
13
- * runtime-plane imports (per `.cursor/rules/multi-plane-entrypoints.mdc`).
6
+ * Lives at the runtime-plane entrypoint so `src/core/**` stays free of runtime-plane imports (per `.cursor/rules/multi-plane-entrypoints.mdc`).
14
7
  */
15
8
 
16
- import { createCodecRegistry } from '@prisma-next/sql-relational-core/ast';
17
9
  import type { SqlRuntimeExtensionDescriptor } from '@prisma-next/sql-runtime';
18
- import { arktypeJsonCodec } from '../core/arktype-json-codec';
19
10
  import { arktypeJsonPackMeta } from '../core/pack-meta';
20
-
21
- function createArktypeJsonCodecRegistry() {
22
- // arktype-json ships only the parameterized descriptor; the legacy
23
- // `codecs:` slot has nothing to register.
24
- return createCodecRegistry();
25
- }
11
+ import { arktypeJsonCodecRegistry } from '../core/registry';
26
12
 
27
13
  export const arktypeJsonRuntimeDescriptor: SqlRuntimeExtensionDescriptor<'postgres'> = {
28
14
  kind: 'extension' as const,
@@ -30,8 +16,7 @@ export const arktypeJsonRuntimeDescriptor: SqlRuntimeExtensionDescriptor<'postgr
30
16
  version: arktypeJsonPackMeta.version,
31
17
  familyId: 'sql' as const,
32
18
  targetId: 'postgres' as const,
33
- codecs: createArktypeJsonCodecRegistry,
34
- parameterizedCodecs: () => [arktypeJsonCodec],
19
+ codecs: () => Array.from(arktypeJsonCodecRegistry.values()),
35
20
  create() {
36
21
  return {
37
22
  familyId: 'sql' as const,
@@ -1,224 +0,0 @@
1
- import { runtimeError } from "@prisma-next/framework-components/runtime";
2
- import { codec } from "@prisma-next/sql-relational-core/ast";
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
- /**
11
- * Type predicate for `ArktypeSchemaLike`. Lets the column-author
12
- * factory narrow `unknown` schemas to the structural shape the codec
13
- * depends on after the explicit field guards run, so the descriptor
14
- * builder doesn't fall back to a `as unknown as` cast.
15
- */
16
- function isArktypeSchemaLike(value) {
17
- if (typeof value !== "function") return false;
18
- return typeof value.expression === "string";
19
- }
20
- /**
21
- * Build the curried factory for a rehydrated arktype schema. The factory's
22
- * returned codec carries the schema in its closure; `decode` validates
23
- * wire payloads via `schema(parsed)`, throwing
24
- * `RUNTIME.JSON_SCHEMA_VALIDATION_FAILED` on rejection.
25
- *
26
- * Encode is `JSON.stringify` — the schema validates the input shape only
27
- * at the read boundary (decode), matching the JSON-validator philosophy:
28
- * the payload may have been written by any source (this writer, a
29
- * previous version of the schema, a manual SQL `INSERT`); validate when
30
- * reading, not when writing.
31
- *
32
- * Author bodies are sync; main's `codec({...})` factory promise-lifts
33
- * `encode`/`decode` into the framework-required `Promise<…>` boundary
34
- * shape (per ADR 204).
35
- */
36
- function arktypeJsonCodecForSchema(schema) {
37
- function validateSchema(value) {
38
- const result = schema(value);
39
- if (result instanceof ArkErrors) throw runtimeError("RUNTIME.JSON_SCHEMA_VALIDATION_FAILED", `arktype-json schema validation failed (decode): ${result.summary}`, {
40
- codecId: ARKTYPE_JSON_CODEC_ID,
41
- issues: result.summary
42
- });
43
- return result;
44
- }
45
- function serializeToJsonSafe(value) {
46
- const wire = JSON.stringify(value);
47
- 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 });
48
- const json = JSON.parse(wire);
49
- validateSchema(json);
50
- return {
51
- wire,
52
- json
53
- };
54
- }
55
- return (_ctx) => codec({
56
- typeId: ARKTYPE_JSON_CODEC_ID,
57
- targetTypes: [ARKTYPE_JSON_NATIVE_TYPE],
58
- traits: ["equality"],
59
- encode: (value) => serializeToJsonSafe(value).wire,
60
- decode: (wire) => validateSchema(JSON.parse(wire)),
61
- encodeJson: (value) => serializeToJsonSafe(value).json,
62
- decodeJson: (json) => validateSchema(json)
63
- });
64
- }
65
- /**
66
- * Curried column-author factory for arktype-validated JSON columns.
67
- *
68
- * Usage:
69
- *
70
- * ```ts
71
- * import { type } from 'arktype';
72
- * import { arktypeJson } from '@prisma-next/extension-arktype-json/column-types';
73
- *
74
- * const ProductSchema = type({ name: 'string', price: 'number' });
75
- *
76
- * const Product = {
77
- * columns: {
78
- * id: textCodec,
79
- * settings: arktypeJson(ProductSchema),
80
- * // ^? ColumnTypeDescriptor with type :: (ctx) => Codec<…, { name: string; price: number }>
81
- * },
82
- * };
83
- * ```
84
- *
85
- * The schema's inferred output flows through `S['infer']` so the no-emit
86
- * `FieldOutputType` resolver produces the precise TS type at the column
87
- * site. Eager serialization at this call site captures `expression` (for
88
- * the emit-path renderer) and `jsonIr` (for runtime rehydration).
89
- *
90
- * @throws {Error} if the schema doesn't expose `expression` and `json`
91
- * fields (i.e. is not an arktype `Type`). The factory validates the
92
- * schema shape at the call site so configuration errors surface during
93
- * contract authoring, not at runtime.
94
- */
95
- function arktypeJson(schema) {
96
- if (!isArktypeSchemaLike(schema)) throw new Error(typeof schema !== "function" ? "arktypeJson(schema) expects a callable arktype Type." : "arktypeJson(schema) expects an arktype Type (missing `expression: string`).");
97
- const jsonIr = schema.json;
98
- if (jsonIr === null || typeof jsonIr !== "object") throw new Error("arktypeJson(schema) expects an arktype Type (missing `json` IR).");
99
- return {
100
- codecId: ARKTYPE_JSON_CODEC_ID,
101
- nativeType: ARKTYPE_JSON_NATIVE_TYPE,
102
- typeParams: {
103
- expression: schema.expression,
104
- jsonIr
105
- },
106
- type: arktypeJsonCodecForSchema(schema)
107
- };
108
- }
109
- /**
110
- * Standard Schema validator for the descriptor's typeParams. Asserts the
111
- * shape `{ expression: string; jsonIr: object }` at the contract IR
112
- * boundary; deeper IR-shape validation happens implicitly when
113
- * `ark.schema(jsonIr)` reparses (corrupt IR throws there).
114
- *
115
- * Eats its own dog food: the validator is itself an arktype schema.
116
- */
117
- const arktypeJsonParamsSchema = type({
118
- expression: "string",
119
- jsonIr: "object"
120
- });
121
- /**
122
- * Rehydrate an arktype schema from the serialized IR. Throws a clean
123
- * error if the IR is corrupt — the "corruption-of-contract.json" case.
124
- */
125
- function rehydrateSchema(jsonIr) {
126
- try {
127
- return ark.schema(jsonIr);
128
- } catch (error) {
129
- throw runtimeError("RUNTIME.JSON_SCHEMA_VALIDATION_FAILED", `Failed to rehydrate arktype schema from contract IR: ${error instanceof Error ? error.message : String(error)}`, {
130
- codecId: ARKTYPE_JSON_CODEC_ID,
131
- jsonIr
132
- });
133
- }
134
- }
135
- /**
136
- * Render the emit-path TS type for an arktype-json column. Reads the
137
- * eagerly-extracted `expression` directly — the round-trip stability
138
- * guarantee (rehydrated schema's `expression` matches the source's)
139
- * means the rendered output is consistent across serialize/rehydrate.
140
- */
141
- function renderArktypeJsonOutputType(params) {
142
- const expression = params.expression.trim();
143
- return expression.length > 0 ? expression : "unknown";
144
- }
145
- /**
146
- * Build a permissive `renderOutputType` that accepts the framework's
147
- * generic typeParams shape and dispatches to the type-narrow renderer
148
- * once the input is structurally an `ArktypeJsonTypeParams`.
149
- */
150
- function renderArktypeJsonOutputTypeFromUnknownParams(typeParams) {
151
- const expression = typeParams["expression"];
152
- const jsonIr = typeParams["jsonIr"];
153
- if (typeof expression !== "string" || jsonIr === null || typeof jsonIr !== "object") return;
154
- return renderArktypeJsonOutputType({
155
- expression,
156
- jsonIr
157
- });
158
- }
159
- /**
160
- * Emit-only `Codec` instance for `arktype/json@1`. Threaded through the
161
- * pack-meta's `codecInstances` array so the emitter's `CodecLookup` can
162
- * find a `renderOutputType` for the codec id (the emitter consults the
163
- * codec-id-keyed `CodecLookup` at the framework boundary; the unified
164
- * descriptor's `renderOutputType` is the long-term home for the renderer
165
- * but the emit-path glue still routes through `CodecLookup`).
166
- *
167
- * All conversion methods are sentinels that throw if invoked — runtime
168
- * materialization always goes through `arktypeJsonCodec.factory`'s
169
- * curried `(params) => (ctx) => Codec`, never through this instance.
170
- * `encodeJson`/`decodeJson` throw alongside `encode`/`decode` so a
171
- * mistaken contract-load that resolved to this stub fails fast at the
172
- * JSON boundary instead of silently returning unvalidated payloads. A
173
- * future cleanup could route the emit path through the descriptor map
174
- * directly and retire this shim.
175
- */
176
- const ARKTYPE_JSON_RUNTIME_DISPATCH_ERROR = "arktype-json codec instances must be materialized via the descriptor factory; this is an emit-only stub";
177
- const arktypeJsonEmitCodec = {
178
- id: ARKTYPE_JSON_CODEC_ID,
179
- targetTypes: [ARKTYPE_JSON_NATIVE_TYPE],
180
- traits: ["equality"],
181
- encode: () => Promise.reject(new Error(ARKTYPE_JSON_RUNTIME_DISPATCH_ERROR)),
182
- decode: () => Promise.reject(new Error(ARKTYPE_JSON_RUNTIME_DISPATCH_ERROR)),
183
- encodeJson: () => {
184
- throw new Error(ARKTYPE_JSON_RUNTIME_DISPATCH_ERROR);
185
- },
186
- decodeJson: () => {
187
- throw new Error(ARKTYPE_JSON_RUNTIME_DISPATCH_ERROR);
188
- },
189
- renderOutputType: renderArktypeJsonOutputTypeFromUnknownParams
190
- };
191
- /**
192
- * Framework-registration descriptor for the arktype-json codec. Registered
193
- * through the SQL runtime's `parameterizedCodecs:` slot. `sql-runtime`'s
194
- * `initializeTypeHelpers` (and per-column walk in
195
- * `buildContractCodecRegistry`) calls `arktypeJsonCodec.factory(typeParams)
196
- * (ctx)` once per `storage.types` instance (or once per inline-typeParams
197
- * column) to materialize the resolved codec carrying the rehydrated
198
- * schema.
199
- *
200
- * Per Phase B of codec-registry-unification, `descriptorFor('arktype/json@1')`
201
- * returns this descriptor and its `traits`/`targetTypes` are the codec-id-
202
- * keyed source of truth — no parallel placeholder on the legacy `codecs:`
203
- * slot is needed (the runtime descriptor ships `codecs: () => createCodecRegistry()`
204
- * — empty).
205
- */
206
- const arktypeJsonCodec = {
207
- codecId: ARKTYPE_JSON_CODEC_ID,
208
- traits: ["equality"],
209
- targetTypes: [ARKTYPE_JSON_NATIVE_TYPE],
210
- paramsSchema: arktypeJsonParamsSchema,
211
- renderOutputType: renderArktypeJsonOutputType,
212
- factory: (params) => {
213
- const schema = rehydrateSchema(params.jsonIr);
214
- /* c8 ignore start — defensive parity check; not exercised by typical contracts */
215
- const rehydratedExpression = schema.expression;
216
- 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.`);
217
- /* c8 ignore stop */
218
- return arktypeJsonCodecForSchema(schema);
219
- }
220
- };
221
-
222
- //#endregion
223
- export { arktypeJsonEmitCodec as a, arktypeJsonCodec as i, ARKTYPE_JSON_NATIVE_TYPE as n, arktypeJson as r, ARKTYPE_JSON_CODEC_ID as t };
224
- //# sourceMappingURL=arktype-json-codec-BbiBmtTK.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"arktype-json-codec-BbiBmtTK.mjs","names":["wire: string | undefined","jsonIr: unknown","arktypeJsonEmitCodec: Codec<\n typeof ARKTYPE_JSON_CODEC_ID,\n readonly ['equality'],\n string,\n unknown\n>","arktypeJsonCodec: CodecDescriptor<ArktypeJsonTypeParams>"],"sources":["../src/core/arktype-json-codec.ts"],"sourcesContent":["/**\n * Single source of truth for the arktype-json `arktype/json@1` codec.\n *\n * Ships the per-library JSON-with-schema column factory (`arktypeJson`) and\n * the framework-registration descriptor (`arktypeJsonCodec`). The two\n * surfaces share one serialize/rehydrate pipeline keyed on arktype's\n * internal IR.\n *\n * **Serialization** (column-author site, eager):\n *\n * - `expression`: `schema.expression` — arktype's TypeScript-source-like\n * rendering used by the emit-path `renderOutputType` to produce the\n * column's TS type in `contract.d.ts`.\n * - `jsonIr`: `schema.json` — arktype's internal IR. Lossless; the\n * rehydration source consumed by `ark.schema(jsonIr)` at runtime.\n *\n * The pair is sufficient: `expression` round-trips with the rehydrated\n * schema (`ark.schema(jsonIr).expression === expression`) so the emit-path\n * output is stable across serialize/rehydrate.\n *\n * **Rehydration** (runtime, on factory invocation): `ark.schema(typeParams.jsonIr)`\n * returns a callable `Type`-like with `~standard`. The returned codec's\n * `decode` body validates wire payloads through the rehydrated schema and\n * throws `RUNTIME.JSON_SCHEMA_VALIDATION_FAILED` on rejection — no separate\n * validator-registry consultation.\n *\n * See the codec-registry-unification spec § Case J (JSON-with-schema).\n */\n\nimport type { JsonValue } from '@prisma-next/contract/types';\nimport type { ColumnTypeDescriptor } from '@prisma-next/contract-authoring';\nimport type {\n Codec,\n CodecDescriptor,\n CodecInstanceContext,\n} from '@prisma-next/framework-components/codec';\nimport { runtimeError } from '@prisma-next/framework-components/runtime';\nimport { codec } from '@prisma-next/sql-relational-core/ast';\nimport { ArkErrors, ark, type Type, type } from 'arktype';\n\n// ── Constants ────────────────────────────────────────────────────────────\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// ── typeParams shape ─────────────────────────────────────────────────────\n\n/**\n * Eagerly serialized typeParams for the arktype-json column. Carried in\n * the contract IR; the runtime descriptor's factory rehydrates `jsonIr`\n * and the emitter consumes `expression`.\n */\nexport type ArktypeJsonTypeParams = {\n /**\n * Arktype's TypeScript-source-like rendering of the schema. Read by\n * `renderOutputType` to emit the column's TS type into `contract.d.ts`.\n * Stable across the serialize/rehydrate cycle: the rehydrated schema's\n * `expression` matches the source schema's.\n */\n readonly expression: string;\n /**\n * Arktype's internal IR for the schema. Lossless; the rehydration\n * source. Schema-shape — `ark.schema(jsonIr)` reconstructs a callable\n * `Type`-like structurally identical to the original `type(definition)`\n * output.\n */\n readonly jsonIr: object;\n};\n\n// ── Curried higher-order codec factory ───────────────────────────────────\n\n/**\n * Codec instance returned by `arktypeJson(schema)(ctx)` and by\n * `arktypeJsonCodec.factory(typeParams)(ctx)`. The `TInferred` slot\n * carries the arktype schema's inferred output type.\n */\nexport type ArktypeJsonCodec<TInferred> = Codec<\n typeof ARKTYPE_JSON_CODEC_ID,\n readonly ['equality'],\n string,\n TInferred\n>;\n\n/**\n * Structural narrow of arktype's `Type` — the surface our codec depends\n * on: a callable validator that returns `inferOut | ArkErrors`, plus the\n * `expression` string for emit-path rendering.\n *\n * Avoids depending on the precise generics of arktype's `Type<t, $>` so\n * schemas built in any scope (the default `Ark` from `type(...)` AND the\n * minimal scope from `ark.schema(...)`) satisfy the same contract.\n */\ntype ArktypeSchemaLike = ((value: unknown) => unknown) & {\n readonly expression: string;\n};\n\n/**\n * Type predicate for `ArktypeSchemaLike`. Lets the column-author\n * factory narrow `unknown` schemas to the structural shape the codec\n * depends on after the explicit field guards run, so the descriptor\n * builder doesn't fall back to a `as unknown as` cast.\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\n/**\n * Build the curried factory for a rehydrated arktype schema. The factory's\n * returned codec carries the schema in its closure; `decode` validates\n * wire payloads via `schema(parsed)`, throwing\n * `RUNTIME.JSON_SCHEMA_VALIDATION_FAILED` on rejection.\n *\n * Encode is `JSON.stringify` — the schema validates the input shape only\n * at the read boundary (decode), matching the JSON-validator philosophy:\n * the payload may have been written by any source (this writer, a\n * previous version of the schema, a manual SQL `INSERT`); validate when\n * reading, not when writing.\n *\n * Author bodies are sync; main's `codec({...})` factory promise-lifts\n * `encode`/`decode` into the framework-required `Promise<…>` boundary\n * shape (per ADR 204).\n */\nfunction arktypeJsonCodecForSchema<TInferred>(\n schema: ArktypeSchemaLike,\n): (ctx: CodecInstanceContext) => ArktypeJsonCodec<TInferred> {\n // Shared schema check used by both `decode` (wire → JS) and\n // `decodeJson` (JsonValue → JS). Either entry point must reject\n // payloads that don't match the schema; without the shared validator,\n // any caller that hands parsed JSON straight to the codec would bypass\n // schema enforcement and return unchecked data.\n function validateSchema(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 // arktype's call-result is `inferOut | ArkErrors`; the ArkErrors\n // branch is excluded above. The cast threads the caller-supplied\n // generic onto the structurally-typed validation output.\n return result as TInferred;\n }\n\n // Derive both `encode` (wire string) and `encodeJson` (JsonValue)\n // outputs from the same `JSON.stringify` → `JSON.parse` round-trip,\n // then validate the normalized payload through the schema. Without\n // this normalization, a non-JSON-safe runtime value (e.g. a class\n // instance, a function field on a narrowed type) could slip through\n // `encodeJson` unchanged while `encode` silently dropped or\n // transformed it — producing wire payloads the codec's own decode\n // path would later reject. The serialize/parse round-trip also\n // produces the JSON-safe shape required by the contract IR's\n // `JsonValue` surface, so `encodeJson` no longer needs a blind cast.\n function serializeToJsonSafe(value: TInferred): { wire: string; json: JsonValue } {\n // `JSON.stringify` returns `string | undefined` — `undefined`\n // happens when the input is `undefined` itself or contains only\n // unserializable values (functions, symbols). Reject explicitly so\n // the caller sees the schema-failure code rather than a downstream\n // `JSON.parse(undefined)` SyntaxError.\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 // Validate the normalized payload — the round-trip strips\n // class-prototype shape and arktype-narrowed fields, and the\n // schema must still accept the result. Run validation and discard\n // its return value (we keep `json` as the JsonValue, not the\n // schema's `inferOut` which already matches `TInferred`).\n validateSchema(json);\n return { wire, json };\n }\n\n return (_ctx) =>\n codec<typeof ARKTYPE_JSON_CODEC_ID, readonly ['equality'], string, TInferred>({\n typeId: ARKTYPE_JSON_CODEC_ID,\n targetTypes: [ARKTYPE_JSON_NATIVE_TYPE],\n traits: ['equality'] as const,\n encode: (value: TInferred): string => serializeToJsonSafe(value).wire,\n decode: (wire: string): TInferred => validateSchema(JSON.parse(wire)),\n encodeJson: (value: TInferred): JsonValue => serializeToJsonSafe(value).json,\n decodeJson: (json: JsonValue) => validateSchema(json),\n }) as ArktypeJsonCodec<TInferred>;\n}\n\n// ── Column-author surface ────────────────────────────────────────────────\n\n/**\n * Curried column-author factory for arktype-validated JSON columns.\n *\n * Usage:\n *\n * ```ts\n * import { type } from 'arktype';\n * import { arktypeJson } from '@prisma-next/extension-arktype-json/column-types';\n *\n * const ProductSchema = type({ name: 'string', price: 'number' });\n *\n * const Product = {\n * columns: {\n * id: textCodec,\n * settings: arktypeJson(ProductSchema),\n * // ^? ColumnTypeDescriptor with type :: (ctx) => Codec<…, { name: string; price: number }>\n * },\n * };\n * ```\n *\n * The schema's inferred output flows through `S['infer']` so the no-emit\n * `FieldOutputType` resolver produces the precise TS type at the column\n * site. Eager serialization at this call site captures `expression` (for\n * the emit-path renderer) and `jsonIr` (for runtime rehydration).\n *\n * @throws {Error} if the schema doesn't expose `expression` and `json`\n * fields (i.e. is not an arktype `Type`). The factory validates the\n * schema shape at the call site so configuration errors surface during\n * contract authoring, not at runtime.\n */\nexport function arktypeJson<S extends Type<unknown>>(\n schema: S,\n): ColumnTypeDescriptor & {\n readonly codecId: typeof ARKTYPE_JSON_CODEC_ID;\n readonly nativeType: typeof ARKTYPE_JSON_NATIVE_TYPE;\n readonly typeParams: ArktypeJsonTypeParams;\n readonly type: (ctx: CodecInstanceContext) => ArktypeJsonCodec<S['infer']>;\n} {\n // Reject non-callable / non-arktype-shaped lookalikes before any\n // property reads. An object shaped like `{ expression, json }` would\n // otherwise pass the field checks and only explode on the first\n // `decode`/`decodeJson` call, defeating the early authoring-time\n // guard this factory provides. The `isArktypeSchemaLike` predicate\n // narrows `schema` so the descriptor builder hands the typed shape\n // straight to the curried factory — no `as unknown as` cast.\n if (!isArktypeSchemaLike(schema)) {\n throw new Error(\n typeof schema !== 'function'\n ? 'arktypeJson(schema) expects a callable arktype Type.'\n : 'arktypeJson(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('arktypeJson(schema) expects an arktype Type (missing `json` IR).');\n }\n return {\n codecId: ARKTYPE_JSON_CODEC_ID,\n nativeType: ARKTYPE_JSON_NATIVE_TYPE,\n typeParams: { expression: schema.expression, jsonIr },\n type: arktypeJsonCodecForSchema<S['infer']>(schema),\n } as const;\n}\n\n// ── Framework-registration descriptor ────────────────────────────────────\n\n/**\n * Standard Schema validator for the descriptor's typeParams. Asserts the\n * shape `{ expression: string; jsonIr: object }` at the contract IR\n * boundary; deeper IR-shape validation happens implicitly when\n * `ark.schema(jsonIr)` reparses (corrupt IR throws there).\n *\n * Eats its own dog food: the validator is itself an arktype schema.\n */\nconst arktypeJsonParamsSchema = type({\n expression: 'string',\n jsonIr: 'object',\n});\n\n/**\n * Rehydrate an arktype schema from the serialized IR. Throws a clean\n * error if the IR is corrupt — the \"corruption-of-contract.json\" case.\n */\nfunction rehydrateSchema(jsonIr: object): ArktypeSchemaLike {\n try {\n return ark.schema(jsonIr) as unknown as ArktypeSchemaLike;\n } catch (error) {\n throw runtimeError(\n 'RUNTIME.JSON_SCHEMA_VALIDATION_FAILED',\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}\n\n/**\n * Render the emit-path TS type for an arktype-json column. Reads the\n * eagerly-extracted `expression` directly — the round-trip stability\n * guarantee (rehydrated schema's `expression` matches the source's)\n * means the rendered output is consistent across serialize/rehydrate.\n */\nfunction renderArktypeJsonOutputType(params: ArktypeJsonTypeParams): string {\n const expression = params.expression.trim();\n return expression.length > 0 ? expression : 'unknown';\n}\n\n/**\n * Build a permissive `renderOutputType` that accepts the framework's\n * generic typeParams shape and dispatches to the type-narrow renderer\n * once the input is structurally an `ArktypeJsonTypeParams`.\n */\nfunction renderArktypeJsonOutputTypeFromUnknownParams(\n typeParams: Record<string, unknown>,\n): string | undefined {\n const expression = typeParams['expression'];\n const jsonIr = typeParams['jsonIr'];\n if (typeof expression !== 'string' || jsonIr === null || typeof jsonIr !== 'object') {\n return undefined;\n }\n return renderArktypeJsonOutputType({ expression, jsonIr });\n}\n\n/**\n * Emit-only `Codec` instance for `arktype/json@1`. Threaded through the\n * pack-meta's `codecInstances` array so the emitter's `CodecLookup` can\n * find a `renderOutputType` for the codec id (the emitter consults the\n * codec-id-keyed `CodecLookup` at the framework boundary; the unified\n * descriptor's `renderOutputType` is the long-term home for the renderer\n * but the emit-path glue still routes through `CodecLookup`).\n *\n * All conversion methods are sentinels that throw if invoked — runtime\n * materialization always goes through `arktypeJsonCodec.factory`'s\n * curried `(params) => (ctx) => Codec`, never through this instance.\n * `encodeJson`/`decodeJson` throw alongside `encode`/`decode` so a\n * mistaken contract-load that resolved to this stub fails fast at the\n * JSON boundary instead of silently returning unvalidated payloads. A\n * future cleanup could route the emit path through the descriptor map\n * directly and retire this shim.\n */\nconst ARKTYPE_JSON_RUNTIME_DISPATCH_ERROR =\n 'arktype-json codec instances must be materialized via the descriptor factory; this is an emit-only stub';\n\nexport const arktypeJsonEmitCodec: Codec<\n typeof ARKTYPE_JSON_CODEC_ID,\n readonly ['equality'],\n string,\n unknown\n> = {\n id: ARKTYPE_JSON_CODEC_ID,\n targetTypes: [ARKTYPE_JSON_NATIVE_TYPE],\n traits: ['equality'] as const,\n encode: () => Promise.reject(new Error(ARKTYPE_JSON_RUNTIME_DISPATCH_ERROR)),\n decode: () => Promise.reject(new Error(ARKTYPE_JSON_RUNTIME_DISPATCH_ERROR)),\n encodeJson: () => {\n throw new Error(ARKTYPE_JSON_RUNTIME_DISPATCH_ERROR);\n },\n decodeJson: () => {\n throw new Error(ARKTYPE_JSON_RUNTIME_DISPATCH_ERROR);\n },\n renderOutputType: renderArktypeJsonOutputTypeFromUnknownParams,\n};\n\n/**\n * Framework-registration descriptor for the arktype-json codec. Registered\n * through the SQL runtime's `parameterizedCodecs:` slot. `sql-runtime`'s\n * `initializeTypeHelpers` (and per-column walk in\n * `buildContractCodecRegistry`) calls `arktypeJsonCodec.factory(typeParams)\n * (ctx)` once per `storage.types` instance (or once per inline-typeParams\n * column) to materialize the resolved codec carrying the rehydrated\n * schema.\n *\n * Per Phase B of codec-registry-unification, `descriptorFor('arktype/json@1')`\n * returns this descriptor and its `traits`/`targetTypes` are the codec-id-\n * keyed source of truth — no parallel placeholder on the legacy `codecs:`\n * slot is needed (the runtime descriptor ships `codecs: () => createCodecRegistry()`\n * — empty).\n */\nexport const arktypeJsonCodec: CodecDescriptor<ArktypeJsonTypeParams> = {\n codecId: ARKTYPE_JSON_CODEC_ID,\n traits: ['equality'] as const,\n targetTypes: [ARKTYPE_JSON_NATIVE_TYPE] as const,\n paramsSchema: arktypeJsonParamsSchema,\n renderOutputType: renderArktypeJsonOutputType,\n factory: (params) => {\n const schema = rehydrateSchema(params.jsonIr);\n /* c8 ignore start — defensive parity check; not exercised by typical contracts */\n // The rehydrated schema's `expression` should match the serialized\n // one; diverging means contract.json was hand-edited out from under\n // the emit-path renderer. Surface as a soft warning at materialization\n // time so the caller knows their emit output may not match the\n // runtime schema. The runtime keeps using the schema rehydrated from\n // `jsonIr` — that's the lossless source — so the worst case is an\n // emit-vs-runtime divergence at a single column, not a runtime\n // failure.\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 arktypeJsonCodecForSchema<unknown>(schema);\n },\n};\n"],"mappings":"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"}
@@ -1,92 +0,0 @@
1
- import { Type } from "arktype";
2
- import { ColumnTypeDescriptor } from "@prisma-next/contract-authoring";
3
- import { Codec, CodecDescriptor, CodecInstanceContext } from "@prisma-next/framework-components/codec";
4
-
5
- //#region src/core/arktype-json-codec.d.ts
6
-
7
- /** Codec id for arktype-backed JSON columns. Library-bound, not target-bound. */
8
- declare const ARKTYPE_JSON_CODEC_ID: "arktype/json@1";
9
- /** Native storage type backing the codec. JSONB on Postgres; binary, indexable. */
10
- declare const ARKTYPE_JSON_NATIVE_TYPE: "jsonb";
11
- /**
12
- * Eagerly serialized typeParams for the arktype-json column. Carried in
13
- * the contract IR; the runtime descriptor's factory rehydrates `jsonIr`
14
- * and the emitter consumes `expression`.
15
- */
16
- type ArktypeJsonTypeParams = {
17
- /**
18
- * Arktype's TypeScript-source-like rendering of the schema. Read by
19
- * `renderOutputType` to emit the column's TS type into `contract.d.ts`.
20
- * Stable across the serialize/rehydrate cycle: the rehydrated schema's
21
- * `expression` matches the source schema's.
22
- */
23
- readonly expression: string;
24
- /**
25
- * Arktype's internal IR for the schema. Lossless; the rehydration
26
- * source. Schema-shape — `ark.schema(jsonIr)` reconstructs a callable
27
- * `Type`-like structurally identical to the original `type(definition)`
28
- * output.
29
- */
30
- readonly jsonIr: object;
31
- };
32
- /**
33
- * Codec instance returned by `arktypeJson(schema)(ctx)` and by
34
- * `arktypeJsonCodec.factory(typeParams)(ctx)`. The `TInferred` slot
35
- * carries the arktype schema's inferred output type.
36
- */
37
- type ArktypeJsonCodec<TInferred> = Codec<typeof ARKTYPE_JSON_CODEC_ID, readonly ['equality'], string, TInferred>;
38
- /**
39
- * Curried column-author factory for arktype-validated JSON columns.
40
- *
41
- * Usage:
42
- *
43
- * ```ts
44
- * import { type } from 'arktype';
45
- * import { arktypeJson } from '@prisma-next/extension-arktype-json/column-types';
46
- *
47
- * const ProductSchema = type({ name: 'string', price: 'number' });
48
- *
49
- * const Product = {
50
- * columns: {
51
- * id: textCodec,
52
- * settings: arktypeJson(ProductSchema),
53
- * // ^? ColumnTypeDescriptor with type :: (ctx) => Codec<…, { name: string; price: number }>
54
- * },
55
- * };
56
- * ```
57
- *
58
- * The schema's inferred output flows through `S['infer']` so the no-emit
59
- * `FieldOutputType` resolver produces the precise TS type at the column
60
- * site. Eager serialization at this call site captures `expression` (for
61
- * the emit-path renderer) and `jsonIr` (for runtime rehydration).
62
- *
63
- * @throws {Error} if the schema doesn't expose `expression` and `json`
64
- * fields (i.e. is not an arktype `Type`). The factory validates the
65
- * schema shape at the call site so configuration errors surface during
66
- * contract authoring, not at runtime.
67
- */
68
- declare function arktypeJson<S extends Type<unknown>>(schema: S): ColumnTypeDescriptor & {
69
- readonly codecId: typeof ARKTYPE_JSON_CODEC_ID;
70
- readonly nativeType: typeof ARKTYPE_JSON_NATIVE_TYPE;
71
- readonly typeParams: ArktypeJsonTypeParams;
72
- readonly type: (ctx: CodecInstanceContext) => ArktypeJsonCodec<S['infer']>;
73
- };
74
- /**
75
- * Framework-registration descriptor for the arktype-json codec. Registered
76
- * through the SQL runtime's `parameterizedCodecs:` slot. `sql-runtime`'s
77
- * `initializeTypeHelpers` (and per-column walk in
78
- * `buildContractCodecRegistry`) calls `arktypeJsonCodec.factory(typeParams)
79
- * (ctx)` once per `storage.types` instance (or once per inline-typeParams
80
- * column) to materialize the resolved codec carrying the rehydrated
81
- * schema.
82
- *
83
- * Per Phase B of codec-registry-unification, `descriptorFor('arktype/json@1')`
84
- * returns this descriptor and its `traits`/`targetTypes` are the codec-id-
85
- * keyed source of truth — no parallel placeholder on the legacy `codecs:`
86
- * slot is needed (the runtime descriptor ships `codecs: () => createCodecRegistry()`
87
- * — empty).
88
- */
89
- declare const arktypeJsonCodec: CodecDescriptor<ArktypeJsonTypeParams>;
90
- //#endregion
91
- export { arktypeJson as a, ArktypeJsonTypeParams as i, ARKTYPE_JSON_NATIVE_TYPE as n, arktypeJsonCodec as o, ArktypeJsonCodec as r, ARKTYPE_JSON_CODEC_ID as t };
92
- //# sourceMappingURL=arktype-json-codec-yNv1hzBm.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"arktype-json-codec-yNv1hzBm.d.mts","names":[],"sources":["../src/core/arktype-json-codec.ts"],"sourcesContent":[],"mappings":";;;;;;;cA2Ca;;cAGA;;;;;;KASD,qBAAA;;;;;;;;;;;;;;;;;;;;;KAwBA,8BAA8B,aACjC,sDAGP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiJc,sBAAsB,uBAC5B,IACP;2BACwB;8BACG;uBACP;uBACA,yBAAyB,iBAAiB;;;;;;;;;;;;;;;;;cA6IpD,kBAAkB,gBAAgB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"codec-types-CH37Yc0C.d.mts","names":[],"sources":["../src/types/codec-types.ts"],"sourcesContent":[],"mappings":";;AAiBA;;;;;;;;;;;;;;;KAAY,UAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"pack-meta-DycetSQB.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-\n * stack assembly reads `types.codecTypes.import` to thread the type-side\n * imports into emitted `contract.d.ts`, and `types.storage` declares the\n * codec id's storage backing (`jsonb` on Postgres).\n *\n * Per Phase B of codec-registry-unification, runtime materialization\n * flows through the unified descriptor map (`arktypeJsonCodec`\n * parameterized descriptor), not through the legacy runtime codec\n * lookup. This metadata still carries an emit-only `Codec` instance\n * (`arktypeJsonEmitCodec`) under `codecInstances` so the framework\n * emitter's codec-id-keyed `CodecLookup` can resolve `renderOutputType`\n * at emit time — that shim retires when the emit path consults the\n * descriptor map directly (TML-2357). Control-stack consumers read\n * codec metadata from `descriptorFor('arktype/json@1')`.\n */\n\nimport type { CodecTypes } from '../types/codec-types';\nimport { ARKTYPE_JSON_CODEC_ID, arktypeJsonEmitCodec } from './arktype-json-codec';\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 // The emitter's `CodecLookup` is the codec-id-keyed source of\n // truth for `renderOutputType` at the framework emit-path\n // boundary. We thread an emit-only `Codec` instance carrying the\n // `renderOutputType` here so the lookup resolves; runtime\n // materialization goes through the unified descriptor's\n // `factory: (P) => (CodecInstanceContext) => Codec`, never through this shim.\n codecInstances: [arktypeJsonEmitCodec],\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\n * codec-types map's literal type into the pack ref so contract-builder\n * 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":";;;AAsBA,MAAM,0BAA0B;CAC9B,MAAM;CACN,IAAI;CACJ,UAAU;CACV,UAAU;CACV,SAAS;CACT,cAAc,EAAE;CAChB,OAAO;EACL,YAAY;GAOV,gBAAgB,CAAC,qBAAqB;GACtC,QAAQ;IACN,SAAS;IACT,OAAO;IACP,OAAO;IACR;GACF;EACD,SAAS,CACP;GACE,QAAQ;GACR,UAAU;GACV,UAAU;GACV,YAAY;GACb,CACF;EACF;CACF;;;;;;AAOD,MAAaA,sBAET"}