@prisma-next/adapter-postgres 0.5.0-dev.6 → 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.
- package/README.md +14 -16
- package/dist/adapter-D0MBaNqv.mjs +47 -0
- package/dist/adapter-D0MBaNqv.mjs.map +1 -0
- package/dist/adapter.d.mts +3 -4
- package/dist/adapter.d.mts.map +1 -1
- package/dist/adapter.mjs +1 -1
- package/dist/column-types.d.mts +20 -24
- package/dist/column-types.d.mts.map +1 -1
- package/dist/column-types.mjs +19 -58
- package/dist/column-types.mjs.map +1 -1
- package/dist/control.d.mts +76 -3
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +48 -9
- package/dist/control.mjs.map +1 -1
- package/dist/{descriptor-meta-RTDzyrae.mjs → descriptor-meta-D8znZhXl.mjs} +35 -24
- package/dist/descriptor-meta-D8znZhXl.mjs.map +1 -0
- package/dist/operation-types.d.mts +11 -10
- package/dist/operation-types.d.mts.map +1 -1
- package/dist/runtime.d.mts +3 -11
- package/dist/runtime.d.mts.map +1 -1
- package/dist/runtime.mjs +17 -77
- package/dist/runtime.mjs.map +1 -1
- package/dist/{sql-renderer-pEaSP82_.mjs → sql-renderer-Qt6yk5Qj.mjs} +89 -46
- package/dist/sql-renderer-Qt6yk5Qj.mjs.map +1 -0
- package/dist/{types-CfRPdAk8.d.mts → types-tLtmYqCO.d.mts} +12 -1
- package/dist/types-tLtmYqCO.d.mts.map +1 -0
- package/dist/types.d.mts +1 -1
- package/package.json +21 -21
- package/src/core/adapter.ts +15 -41
- package/src/core/codec-lookup.ts +19 -0
- package/src/core/control-adapter.ts +68 -1
- package/src/core/control-mutation-defaults.ts +24 -18
- package/src/core/descriptor-meta.ts +39 -19
- package/src/core/sql-renderer.ts +111 -66
- package/src/core/types.ts +11 -0
- package/src/exports/column-types.ts +21 -61
- package/src/exports/control.ts +3 -2
- package/src/exports/runtime.ts +27 -66
- package/src/types/operation-types.ts +19 -9
- package/dist/adapter-hNElNHo4.mjs +0 -60
- package/dist/adapter-hNElNHo4.mjs.map +0 -1
- package/dist/descriptor-meta-RTDzyrae.mjs.map +0 -1
- package/dist/sql-renderer-pEaSP82_.mjs.map +0 -1
- package/dist/types-CfRPdAk8.d.mts.map +0 -1
- package/src/core/json-schema-validator.ts +0 -54
- package/src/core/standard-schema.ts +0 -71
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
type UnknownRecord = Record<string, unknown>;
|
|
2
|
-
|
|
3
|
-
type StandardSchemaJsonSchemaField = {
|
|
4
|
-
readonly output?: unknown;
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Runtime view of the Standard Schema protocol.
|
|
9
|
-
* Reads `~standard.jsonSchema.output` for the serializable JSON Schema representation,
|
|
10
|
-
* and `.expression` for an optional TypeScript type expression string (Arktype-specific).
|
|
11
|
-
*
|
|
12
|
-
* This differs from the compile-time `StandardSchemaLike` in `codec-types.ts`, which reads
|
|
13
|
-
* `~standard.types.output` for TypeScript type narrowing in contract.d.ts.
|
|
14
|
-
*/
|
|
15
|
-
export type StandardSchemaLike = {
|
|
16
|
-
readonly '~standard'?: {
|
|
17
|
-
readonly version?: number;
|
|
18
|
-
readonly jsonSchema?: StandardSchemaJsonSchemaField;
|
|
19
|
-
};
|
|
20
|
-
readonly expression?: unknown;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
function isObjectLike(value: unknown): value is UnknownRecord {
|
|
24
|
-
return (typeof value === 'object' || typeof value === 'function') && value !== null;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function resolveOutputJsonSchemaField(schema: StandardSchemaLike): unknown {
|
|
28
|
-
const jsonSchema = schema['~standard']?.jsonSchema;
|
|
29
|
-
if (!jsonSchema) {
|
|
30
|
-
return undefined;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
if (typeof jsonSchema.output === 'function') {
|
|
34
|
-
return jsonSchema.output({
|
|
35
|
-
target: 'draft-07',
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return jsonSchema.output;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export function extractStandardSchemaOutputJsonSchema(
|
|
43
|
-
schema: StandardSchemaLike,
|
|
44
|
-
): UnknownRecord | undefined {
|
|
45
|
-
const outputSchema = resolveOutputJsonSchemaField(schema);
|
|
46
|
-
if (!isObjectLike(outputSchema)) {
|
|
47
|
-
return undefined;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return outputSchema;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export function extractStandardSchemaTypeExpression(
|
|
54
|
-
schema: StandardSchemaLike,
|
|
55
|
-
): string | undefined {
|
|
56
|
-
const expression = schema.expression;
|
|
57
|
-
if (typeof expression !== 'string') {
|
|
58
|
-
return undefined;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const trimmedExpression = expression.trim();
|
|
62
|
-
if (trimmedExpression.length === 0) {
|
|
63
|
-
return undefined;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return trimmedExpression;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export function isStandardSchemaLike(value: unknown): value is StandardSchemaLike {
|
|
70
|
-
return isObjectLike(value) && isObjectLike((value as StandardSchemaLike)['~standard']);
|
|
71
|
-
}
|