@prisma-next/extension-arktype-json 0.0.1

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.
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Runtime-plane extension descriptor for arktype-json.
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.
11
+ *
12
+ * Lives at the runtime-plane entrypoint so `src/core/**` stays free of
13
+ * runtime-plane imports (per `.cursor/rules/multi-plane-entrypoints.mdc`).
14
+ */
15
+
16
+ import { createCodecRegistry } from '@prisma-next/sql-relational-core/ast';
17
+ import type { SqlRuntimeExtensionDescriptor } from '@prisma-next/sql-runtime';
18
+ import { arktypeJsonCodec } from '../core/arktype-json-codec';
19
+ 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
+ }
26
+
27
+ export const arktypeJsonRuntimeDescriptor: SqlRuntimeExtensionDescriptor<'postgres'> = {
28
+ kind: 'extension' as const,
29
+ id: arktypeJsonPackMeta.id,
30
+ version: arktypeJsonPackMeta.version,
31
+ familyId: 'sql' as const,
32
+ targetId: 'postgres' as const,
33
+ codecs: createArktypeJsonCodecRegistry,
34
+ parameterizedCodecs: () => [arktypeJsonCodec],
35
+ create() {
36
+ return {
37
+ familyId: 'sql' as const,
38
+ targetId: 'postgres' as const,
39
+ };
40
+ },
41
+ };
42
+
43
+ export default arktypeJsonRuntimeDescriptor;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Codec type definitions for the arktype-json extension.
3
+ *
4
+ * Type-only export consumed by emitted `contract.d.ts` to power
5
+ * `CodecTypes['arktype/json@1']['output']` lookups. The shape mirrors the
6
+ * codec the curried factory returns at runtime so the emit and no-emit
7
+ * paths stay structurally aligned.
8
+ *
9
+ * The output type is intentionally `unknown` — the precise inference is
10
+ * column-site-local (the no-emit `FieldOutputType` resolver reads the
11
+ * factory's return type from the column descriptor's `type` slot, which
12
+ * carries `(ctx) => Codec<…, S['infer']>`). The emit path renders the
13
+ * descriptor's `expression` as the column's TS type (per the descriptor's
14
+ * `renderOutputType`); the codec-id-keyed `CodecTypes` map is the
15
+ * fallback for sites without a column descriptor in scope.
16
+ */
17
+
18
+ export type CodecTypes = {
19
+ readonly 'arktype/json@1': {
20
+ readonly input: unknown;
21
+ readonly output: unknown;
22
+ readonly traits: 'equality';
23
+ };
24
+ };