@prisma-next/sql-contract 0.4.0-dev.9 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/factories.d.mts +1 -1
- package/dist/types-DRR5stkj.mjs.map +1 -1
- package/dist/{types-BYQMEXGG.d.mts → types-DdNz1nUf.d.mts} +9 -6
- package/dist/types-DdNz1nUf.d.mts.map +1 -0
- package/dist/types.d.mts +2 -2
- package/dist/validate.d.mts +1 -1
- package/dist/validators.d.mts +1 -1
- package/package.json +5 -5
- package/src/exports/types.ts +1 -0
- package/src/types.ts +8 -1
- package/dist/types-BYQMEXGG.d.mts.map +0 -1
package/dist/factories.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as StorageTable, E as SqlModelStorage, P as UniqueConstraint, T as SqlModelFieldStorage, _ as PrimaryKey, f as ForeignKey, h as Index, k as StorageColumn, p as ForeignKeyOptions } from "./types-DdNz1nUf.mjs";
|
|
2
2
|
import { ScalarFieldType } from "@prisma-next/contract/types";
|
|
3
3
|
|
|
4
4
|
//#region src/factories.d.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types-DRR5stkj.mjs","names":[],"sources":["../src/types.ts"],"sourcesContent":["import type { ColumnDefault, StorageBase } from '@prisma-next/contract/types';\n\n/**\n * A column definition in storage.\n *\n * `typeParams` is optional because most columns use non-parameterized types.\n * Columns with parameterized types can either inline `typeParams` or reference\n * a named {@link StorageTypeInstance} via `typeRef`.\n */\nexport type StorageColumn = {\n readonly nativeType: string;\n readonly codecId: string;\n readonly nullable: boolean;\n /**\n * Opaque, codec-owned JS/type parameters.\n * The codec that owns `codecId` defines the shape and semantics.\n * Mutually exclusive with `typeRef`.\n */\n readonly typeParams?: Record<string, unknown>;\n /**\n * Reference to a named type instance in `storage.types`.\n * Mutually exclusive with `typeParams`.\n */\n readonly typeRef?: string;\n /**\n * Default value for the column.\n * Can be a literal value or database function.\n */\n readonly default?: ColumnDefault;\n};\n\nexport type PrimaryKey = {\n readonly columns: readonly string[];\n readonly name?: string;\n};\n\nexport type UniqueConstraint = {\n readonly columns: readonly string[];\n readonly name?: string;\n};\n\nexport type Index = {\n readonly columns: readonly string[];\n readonly name?: string;\n /**\n * Optional access method identifier.\n * Extension-specific methods are represented as strings and interpreted\n * by the owning extension package.\n */\n readonly using?: string;\n /**\n * Optional extension-owned index configuration payload.\n */\n readonly config?: Record<string, unknown>;\n};\n\nexport type ForeignKeyReferences = {\n readonly table: string;\n readonly columns: readonly string[];\n};\n\nexport type ReferentialAction = 'noAction' | 'restrict' | 'cascade' | 'setNull' | 'setDefault';\n\nexport type ForeignKeyOptions = {\n readonly name?: string;\n readonly onDelete?: ReferentialAction;\n readonly onUpdate?: ReferentialAction;\n};\n\nexport type ForeignKey = {\n readonly columns: readonly string[];\n readonly references: ForeignKeyReferences;\n readonly name?: string;\n readonly onDelete?: ReferentialAction;\n readonly onUpdate?: ReferentialAction;\n /** Whether to emit FK constraint DDL (ALTER TABLE … ADD CONSTRAINT … FOREIGN KEY). */\n readonly constraint: boolean;\n /** Whether to emit a backing index for the FK columns. */\n readonly index: boolean;\n};\n\nexport type StorageTable = {\n readonly columns: Record<string, StorageColumn>;\n readonly primaryKey?: PrimaryKey;\n readonly uniques: ReadonlyArray<UniqueConstraint>;\n readonly indexes: ReadonlyArray<Index>;\n readonly foreignKeys: ReadonlyArray<ForeignKey>;\n};\n\n/**\n * A named, parameterized type instance.\n * These are registered in `storage.types` for reuse across columns\n * and to enable ergonomic schema surfaces like `schema.types.MyType`.\n *\n * Unlike {@link StorageColumn}, `typeParams` is required here because\n * `StorageTypeInstance` exists specifically to define reusable parameterized types.\n * A type instance without parameters would be redundant—columns can reference\n * the codec directly via `codecId`.\n */\nexport type StorageTypeInstance = {\n readonly codecId: string;\n readonly nativeType: string;\n readonly typeParams: Record<string, unknown>;\n};\n\nexport type SqlStorage<THash extends string = string> = StorageBase<THash> & {\n readonly tables: Record<string, StorageTable>;\n /**\n * Named type instances for parameterized/custom types.\n * Columns can reference these via `typeRef`.\n */\n readonly types?: Record<string, StorageTypeInstance>;\n};\n\nexport type SqlModelFieldStorage = {\n readonly column: string;\n readonly codecId?: string;\n readonly nullable?: boolean;\n};\n\nexport type SqlModelStorage = {\n readonly table: string;\n readonly fields: Record<string, SqlModelFieldStorage>;\n};\n\nexport const DEFAULT_FK_CONSTRAINT = true;\nexport const DEFAULT_FK_INDEX = true;\n\nexport function applyFkDefaults(\n fk: { constraint?: boolean | undefined; index?: boolean | undefined },\n overrideDefaults?: { constraint?: boolean | undefined; index?: boolean | undefined },\n): { constraint: boolean; index: boolean } {\n return {\n constraint: fk.constraint ?? overrideDefaults?.constraint ?? DEFAULT_FK_CONSTRAINT,\n index: fk.index ?? overrideDefaults?.index ?? DEFAULT_FK_INDEX,\n };\n}\n\nexport type TypeMaps<\n TCodecTypes extends Record<string, { output: unknown }> = Record<string, never>,\n TOperationTypes extends Record<string, unknown> = Record<string, never>,\n TQueryOperationTypes extends Record<string, unknown> = Record<string, never>,\n TFieldOutputTypes extends Record<string, Record<string, unknown>> = Record<string, never>,\n TFieldInputTypes extends Record<string, Record<string, unknown>> = Record<string, never>,\n> = {\n readonly codecTypes: TCodecTypes;\n readonly operationTypes: TOperationTypes;\n readonly queryOperationTypes: TQueryOperationTypes;\n readonly fieldOutputTypes: TFieldOutputTypes;\n readonly fieldInputTypes: TFieldInputTypes;\n};\n\nexport type CodecTypesOf<T> = [T] extends [never]\n ? Record<string, never>\n : T extends { readonly codecTypes: infer C }\n ? C extends Record<string, { output: unknown }>\n ? C\n : Record<string, never>\n : Record<string, never>;\n\nexport type OperationTypesOf<T> = [T] extends [never]\n ? Record<string, never>\n : T extends { readonly operationTypes: infer O }\n ? O extends Record<string, unknown>\n ? O\n : Record<string, never>\n : Record<string, never>;\n\nexport type
|
|
1
|
+
{"version":3,"file":"types-DRR5stkj.mjs","names":[],"sources":["../src/types.ts"],"sourcesContent":["import type { ColumnDefault, StorageBase } from '@prisma-next/contract/types';\nimport type { CodecTrait } from '@prisma-next/framework-components/codec';\n\n/**\n * A column definition in storage.\n *\n * `typeParams` is optional because most columns use non-parameterized types.\n * Columns with parameterized types can either inline `typeParams` or reference\n * a named {@link StorageTypeInstance} via `typeRef`.\n */\nexport type StorageColumn = {\n readonly nativeType: string;\n readonly codecId: string;\n readonly nullable: boolean;\n /**\n * Opaque, codec-owned JS/type parameters.\n * The codec that owns `codecId` defines the shape and semantics.\n * Mutually exclusive with `typeRef`.\n */\n readonly typeParams?: Record<string, unknown>;\n /**\n * Reference to a named type instance in `storage.types`.\n * Mutually exclusive with `typeParams`.\n */\n readonly typeRef?: string;\n /**\n * Default value for the column.\n * Can be a literal value or database function.\n */\n readonly default?: ColumnDefault;\n};\n\nexport type PrimaryKey = {\n readonly columns: readonly string[];\n readonly name?: string;\n};\n\nexport type UniqueConstraint = {\n readonly columns: readonly string[];\n readonly name?: string;\n};\n\nexport type Index = {\n readonly columns: readonly string[];\n readonly name?: string;\n /**\n * Optional access method identifier.\n * Extension-specific methods are represented as strings and interpreted\n * by the owning extension package.\n */\n readonly using?: string;\n /**\n * Optional extension-owned index configuration payload.\n */\n readonly config?: Record<string, unknown>;\n};\n\nexport type ForeignKeyReferences = {\n readonly table: string;\n readonly columns: readonly string[];\n};\n\nexport type ReferentialAction = 'noAction' | 'restrict' | 'cascade' | 'setNull' | 'setDefault';\n\nexport type ForeignKeyOptions = {\n readonly name?: string;\n readonly onDelete?: ReferentialAction;\n readonly onUpdate?: ReferentialAction;\n};\n\nexport type ForeignKey = {\n readonly columns: readonly string[];\n readonly references: ForeignKeyReferences;\n readonly name?: string;\n readonly onDelete?: ReferentialAction;\n readonly onUpdate?: ReferentialAction;\n /** Whether to emit FK constraint DDL (ALTER TABLE … ADD CONSTRAINT … FOREIGN KEY). */\n readonly constraint: boolean;\n /** Whether to emit a backing index for the FK columns. */\n readonly index: boolean;\n};\n\nexport type StorageTable = {\n readonly columns: Record<string, StorageColumn>;\n readonly primaryKey?: PrimaryKey;\n readonly uniques: ReadonlyArray<UniqueConstraint>;\n readonly indexes: ReadonlyArray<Index>;\n readonly foreignKeys: ReadonlyArray<ForeignKey>;\n};\n\n/**\n * A named, parameterized type instance.\n * These are registered in `storage.types` for reuse across columns\n * and to enable ergonomic schema surfaces like `schema.types.MyType`.\n *\n * Unlike {@link StorageColumn}, `typeParams` is required here because\n * `StorageTypeInstance` exists specifically to define reusable parameterized types.\n * A type instance without parameters would be redundant—columns can reference\n * the codec directly via `codecId`.\n */\nexport type StorageTypeInstance = {\n readonly codecId: string;\n readonly nativeType: string;\n readonly typeParams: Record<string, unknown>;\n};\n\nexport type SqlStorage<THash extends string = string> = StorageBase<THash> & {\n readonly tables: Record<string, StorageTable>;\n /**\n * Named type instances for parameterized/custom types.\n * Columns can reference these via `typeRef`.\n */\n readonly types?: Record<string, StorageTypeInstance>;\n};\n\nexport type SqlModelFieldStorage = {\n readonly column: string;\n readonly codecId?: string;\n readonly nullable?: boolean;\n};\n\nexport type SqlModelStorage = {\n readonly table: string;\n readonly fields: Record<string, SqlModelFieldStorage>;\n};\n\nexport const DEFAULT_FK_CONSTRAINT = true;\nexport const DEFAULT_FK_INDEX = true;\n\nexport function applyFkDefaults(\n fk: { constraint?: boolean | undefined; index?: boolean | undefined },\n overrideDefaults?: { constraint?: boolean | undefined; index?: boolean | undefined },\n): { constraint: boolean; index: boolean } {\n return {\n constraint: fk.constraint ?? overrideDefaults?.constraint ?? DEFAULT_FK_CONSTRAINT,\n index: fk.index ?? overrideDefaults?.index ?? DEFAULT_FK_INDEX,\n };\n}\n\nexport type TypeMaps<\n TCodecTypes extends Record<string, { output: unknown }> = Record<string, never>,\n TOperationTypes extends Record<string, unknown> = Record<string, never>,\n TQueryOperationTypes extends Record<string, unknown> = Record<string, never>,\n TFieldOutputTypes extends Record<string, Record<string, unknown>> = Record<string, never>,\n TFieldInputTypes extends Record<string, Record<string, unknown>> = Record<string, never>,\n> = {\n readonly codecTypes: TCodecTypes;\n readonly operationTypes: TOperationTypes;\n readonly queryOperationTypes: TQueryOperationTypes;\n readonly fieldOutputTypes: TFieldOutputTypes;\n readonly fieldInputTypes: TFieldInputTypes;\n};\n\nexport type CodecTypesOf<T> = [T] extends [never]\n ? Record<string, never>\n : T extends { readonly codecTypes: infer C }\n ? C extends Record<string, { output: unknown }>\n ? C\n : Record<string, never>\n : Record<string, never>;\n\nexport type OperationTypesOf<T> = [T] extends [never]\n ? Record<string, never>\n : T extends { readonly operationTypes: infer O }\n ? O extends Record<string, unknown>\n ? O\n : Record<string, never>\n : Record<string, never>;\n\nexport type QueryOperationArgSpec = {\n readonly codecId?: string;\n readonly traits?: readonly CodecTrait[];\n readonly nullable: boolean;\n};\n\nexport type QueryOperationTypeEntry = {\n readonly args: readonly QueryOperationArgSpec[];\n readonly returns: { readonly codecId: string; readonly nullable: boolean };\n};\n\nexport type SqlQueryOperationTypes<T extends Record<string, QueryOperationTypeEntry>> = T;\n\nexport type QueryOperationTypesBase = Record<string, QueryOperationTypeEntry>;\n\nexport type QueryOperationTypesOf<T> = [T] extends [never]\n ? Record<string, never>\n : T extends { readonly queryOperationTypes: infer Q }\n ? Q extends Record<string, unknown>\n ? Q\n : Record<string, never>\n : Record<string, never>;\n\nexport type TypeMapsPhantomKey = '__@prisma-next/sql-contract/typeMaps@__';\n\nexport type ContractWithTypeMaps<TContract, TTypeMaps> = TContract & {\n readonly [K in TypeMapsPhantomKey]?: TTypeMaps;\n};\n\nexport type ExtractTypeMapsFromContract<T> = TypeMapsPhantomKey extends keyof T\n ? NonNullable<T[TypeMapsPhantomKey & keyof T]>\n : never;\n\nexport type FieldOutputTypesOf<T> = [T] extends [never]\n ? Record<string, never>\n : T extends { readonly fieldOutputTypes: infer F }\n ? F extends Record<string, Record<string, unknown>>\n ? F\n : Record<string, never>\n : Record<string, never>;\n\nexport type FieldInputTypesOf<T> = [T] extends [never]\n ? Record<string, never>\n : T extends { readonly fieldInputTypes: infer F }\n ? F extends Record<string, Record<string, unknown>>\n ? F\n : Record<string, never>\n : Record<string, never>;\n\nexport type ExtractCodecTypes<T> = CodecTypesOf<ExtractTypeMapsFromContract<T>>;\nexport type ExtractQueryOperationTypes<T> = QueryOperationTypesOf<ExtractTypeMapsFromContract<T>>;\nexport type ExtractFieldOutputTypes<T> = FieldOutputTypesOf<ExtractTypeMapsFromContract<T>>;\nexport type ExtractFieldInputTypes<T> = FieldInputTypesOf<ExtractTypeMapsFromContract<T>>;\n\nexport type ResolveCodecTypes<TContract, TTypeMaps> = [TTypeMaps] extends [never]\n ? ExtractCodecTypes<TContract>\n : CodecTypesOf<TTypeMaps>;\n\nexport type ResolveOperationTypes<_TContract, TTypeMaps> = OperationTypesOf<TTypeMaps>;\n"],"mappings":";AA8HA,MAAa,wBAAwB;AACrC,MAAa,mBAAmB;AAEhC,SAAgB,gBACd,IACA,kBACyC;AACzC,QAAO;EACL,YAAY,GAAG,cAAc,kBAAkB,cAAc;EAC7D,OAAO,GAAG,SAAS,kBAAkB,SAAS;EAC/C"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ColumnDefault, StorageBase } from "@prisma-next/contract/types";
|
|
2
|
+
import { CodecTrait } from "@prisma-next/framework-components/codec";
|
|
2
3
|
|
|
3
4
|
//#region src/types.d.ts
|
|
4
5
|
|
|
@@ -141,11 +142,13 @@ type CodecTypesOf<T> = [T] extends [never] ? Record<string, never> : T extends {
|
|
|
141
142
|
type OperationTypesOf<T> = [T] extends [never] ? Record<string, never> : T extends {
|
|
142
143
|
readonly operationTypes: infer O;
|
|
143
144
|
} ? O extends Record<string, unknown> ? O : Record<string, never> : Record<string, never>;
|
|
145
|
+
type QueryOperationArgSpec = {
|
|
146
|
+
readonly codecId?: string;
|
|
147
|
+
readonly traits?: readonly CodecTrait[];
|
|
148
|
+
readonly nullable: boolean;
|
|
149
|
+
};
|
|
144
150
|
type QueryOperationTypeEntry = {
|
|
145
|
-
readonly args: readonly
|
|
146
|
-
readonly codecId: string;
|
|
147
|
-
readonly nullable: boolean;
|
|
148
|
-
}[];
|
|
151
|
+
readonly args: readonly QueryOperationArgSpec[];
|
|
149
152
|
readonly returns: {
|
|
150
153
|
readonly codecId: string;
|
|
151
154
|
readonly nullable: boolean;
|
|
@@ -172,5 +175,5 @@ type ExtractFieldInputTypes<T> = FieldInputTypesOf<ExtractTypeMapsFromContract<T
|
|
|
172
175
|
type ResolveCodecTypes<TContract, TTypeMaps> = [TTypeMaps] extends [never] ? ExtractCodecTypes<TContract> : CodecTypesOf<TTypeMaps>;
|
|
173
176
|
type ResolveOperationTypes<_TContract, TTypeMaps> = OperationTypesOf<TTypeMaps>;
|
|
174
177
|
//#endregion
|
|
175
|
-
export {
|
|
176
|
-
//# sourceMappingURL=types-
|
|
178
|
+
export { StorageTable as A, ResolveCodecTypes as C, SqlQueryOperationTypes as D, SqlModelStorage as E, applyFkDefaults as F, TypeMaps as M, TypeMapsPhantomKey as N, SqlStorage as O, UniqueConstraint as P, ReferentialAction as S, SqlModelFieldStorage as T, PrimaryKey as _, ExtractCodecTypes as a, QueryOperationTypesBase as b, ExtractQueryOperationTypes as c, FieldOutputTypesOf as d, ForeignKey as f, OperationTypesOf as g, Index as h, DEFAULT_FK_INDEX as i, StorageTypeInstance as j, StorageColumn as k, ExtractTypeMapsFromContract as l, ForeignKeyReferences as m, ContractWithTypeMaps as n, ExtractFieldInputTypes as o, ForeignKeyOptions as p, DEFAULT_FK_CONSTRAINT as r, ExtractFieldOutputTypes as s, CodecTypesOf as t, FieldInputTypesOf as u, QueryOperationArgSpec as v, ResolveOperationTypes as w, QueryOperationTypesOf as x, QueryOperationTypeEntry as y };
|
|
179
|
+
//# sourceMappingURL=types-DdNz1nUf.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-DdNz1nUf.d.mts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";;;;;;;AAUA;AAsBA;AAKA;AAKA;AAeA;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;KAGjC,yBAAyB,qBACjC,wBACA;;cACY,eAAe,+BAEvB,wBACF;KAEM,wBAAwB,qBAChC,wBACA;;cACY,eAAe,+BAEvB,wBACF;KAEM,uBAAuB,aAAa,4BAA4B;KAChE,gCAAgC,sBAAsB,4BAA4B;KAClF,6BAA6B,mBAAmB,4BAA4B;KAC5E,4BAA4B,kBAAkB,4BAA4B;KAE1E,2CAA2C,6BACnD,kBAAkB,aAClB,aAAa;KAEL,+CAA+C,iBAAiB"}
|
package/dist/types.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
export { type CodecTypesOf, type ContractWithTypeMaps, DEFAULT_FK_CONSTRAINT, DEFAULT_FK_INDEX, type ExtractCodecTypes, type ExtractFieldInputTypes, type ExtractFieldOutputTypes, type ExtractQueryOperationTypes, type ExtractTypeMapsFromContract, type FieldInputTypesOf, type FieldOutputTypesOf, type ForeignKey, type ForeignKeyOptions, type ForeignKeyReferences, type Index, type OperationTypesOf, type PrimaryKey, type QueryOperationTypeEntry, type QueryOperationTypesBase, type QueryOperationTypesOf, type ReferentialAction, type ResolveCodecTypes, type ResolveOperationTypes, type SqlModelFieldStorage, type SqlModelStorage, type SqlQueryOperationTypes, type SqlStorage, type StorageColumn, type StorageTable, type StorageTypeInstance, type TypeMaps, type TypeMapsPhantomKey, type UniqueConstraint, applyFkDefaults };
|
|
1
|
+
import { A as StorageTable, C as ResolveCodecTypes, D as SqlQueryOperationTypes, E as SqlModelStorage, F as applyFkDefaults, M as TypeMaps, N as TypeMapsPhantomKey, O as SqlStorage, P as UniqueConstraint, S as ReferentialAction, T as SqlModelFieldStorage, _ as PrimaryKey, a as ExtractCodecTypes, b as QueryOperationTypesBase, c as ExtractQueryOperationTypes, d as FieldOutputTypesOf, f as ForeignKey, g as OperationTypesOf, h as Index, i as DEFAULT_FK_INDEX, j as StorageTypeInstance, k as StorageColumn, l as ExtractTypeMapsFromContract, m as ForeignKeyReferences, n as ContractWithTypeMaps, o as ExtractFieldInputTypes, p as ForeignKeyOptions, r as DEFAULT_FK_CONSTRAINT, s as ExtractFieldOutputTypes, t as CodecTypesOf, u as FieldInputTypesOf, v as QueryOperationArgSpec, w as ResolveOperationTypes, x as QueryOperationTypesOf, y as QueryOperationTypeEntry } from "./types-DdNz1nUf.mjs";
|
|
2
|
+
export { type CodecTypesOf, type ContractWithTypeMaps, DEFAULT_FK_CONSTRAINT, DEFAULT_FK_INDEX, type ExtractCodecTypes, type ExtractFieldInputTypes, type ExtractFieldOutputTypes, type ExtractQueryOperationTypes, type ExtractTypeMapsFromContract, type FieldInputTypesOf, type FieldOutputTypesOf, type ForeignKey, type ForeignKeyOptions, type ForeignKeyReferences, type Index, type OperationTypesOf, type PrimaryKey, type QueryOperationArgSpec, type QueryOperationTypeEntry, type QueryOperationTypesBase, type QueryOperationTypesOf, type ReferentialAction, type ResolveCodecTypes, type ResolveOperationTypes, type SqlModelFieldStorage, type SqlModelStorage, type SqlQueryOperationTypes, type SqlStorage, type StorageColumn, type StorageTable, type StorageTypeInstance, type TypeMaps, type TypeMapsPhantomKey, type UniqueConstraint, applyFkDefaults };
|
package/dist/validate.d.mts
CHANGED
package/dist/validators.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { O as SqlStorage, S as ReferentialAction, f as ForeignKey, m as ForeignKeyReferences } from "./types-DdNz1nUf.mjs";
|
|
2
2
|
import { Contract } from "@prisma-next/contract/types";
|
|
3
3
|
import * as arktype_internal_variants_object_ts0 from "arktype/internal/variants/object.ts";
|
|
4
4
|
import * as arktype_internal_variants_string_ts0 from "arktype/internal/variants/string.ts";
|
package/package.json
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma-next/sql-contract",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"description": "SQL contract types, validators, and IR factories for Prisma Next",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"arktype": "^2.1.25",
|
|
9
|
-
"@prisma-next/
|
|
10
|
-
"@prisma-next/
|
|
9
|
+
"@prisma-next/contract": "0.4.2",
|
|
10
|
+
"@prisma-next/framework-components": "0.4.2"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
13
|
"tsdown": "0.18.4",
|
|
14
14
|
"typescript": "5.9.3",
|
|
15
15
|
"vitest": "4.0.17",
|
|
16
|
-
"@prisma-next/
|
|
16
|
+
"@prisma-next/test-utils": "0.0.1",
|
|
17
17
|
"@prisma-next/tsdown": "0.0.0",
|
|
18
|
-
"@prisma-next/
|
|
18
|
+
"@prisma-next/tsconfig": "0.0.0"
|
|
19
19
|
},
|
|
20
20
|
"files": [
|
|
21
21
|
"dist",
|
package/src/exports/types.ts
CHANGED
package/src/types.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ColumnDefault, StorageBase } from '@prisma-next/contract/types';
|
|
2
|
+
import type { CodecTrait } from '@prisma-next/framework-components/codec';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* A column definition in storage.
|
|
@@ -166,8 +167,14 @@ export type OperationTypesOf<T> = [T] extends [never]
|
|
|
166
167
|
: Record<string, never>
|
|
167
168
|
: Record<string, never>;
|
|
168
169
|
|
|
170
|
+
export type QueryOperationArgSpec = {
|
|
171
|
+
readonly codecId?: string;
|
|
172
|
+
readonly traits?: readonly CodecTrait[];
|
|
173
|
+
readonly nullable: boolean;
|
|
174
|
+
};
|
|
175
|
+
|
|
169
176
|
export type QueryOperationTypeEntry = {
|
|
170
|
-
readonly args: readonly
|
|
177
|
+
readonly args: readonly QueryOperationArgSpec[];
|
|
171
178
|
readonly returns: { readonly codecId: string; readonly nullable: boolean };
|
|
172
179
|
};
|
|
173
180
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types-BYQMEXGG.d.mts","names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