@prisma-next/target-postgres 0.4.0-dev.7 → 0.4.0-dev.8
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/control.mjs +1 -1
- package/dist/descriptor-meta-DkvCmY98.mjs +120 -0
- package/dist/descriptor-meta-DkvCmY98.mjs.map +1 -0
- package/dist/pack.d.mts +79 -6
- package/dist/pack.d.mts.map +1 -1
- package/dist/pack.mjs +2 -8
- package/dist/runtime.mjs +1 -1
- package/package.json +18 -18
- package/src/core/authoring.ts +89 -1
- package/src/core/descriptor-meta.ts +8 -2
- package/src/exports/pack.ts +1 -10
- package/dist/descriptor-meta-CAf16lsJ.mjs +0 -32
- package/dist/descriptor-meta-CAf16lsJ.mjs.map +0 -1
- package/dist/pack.mjs.map +0 -1
package/dist/control.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as postgresTargetDescriptorMeta } from "./descriptor-meta-
|
|
1
|
+
import { t as postgresTargetDescriptorMeta } from "./descriptor-meta-DkvCmY98.mjs";
|
|
2
2
|
import { C as setDefault, S as renameType, _ as dropDefault, a as addPrimaryKey, b as dropNotNull, d as createEnumType, f as createIndex, g as dropConstraint, h as dropColumn, i as addForeignKey, m as dataTransform, n as addColumn, o as addUnique, p as createTable, r as addEnumValues, s as alterColumnType, t as TODO$1, u as createDependency, v as dropEnumType, w as setNotNull, x as dropTable, y as dropIndex } from "./operation-descriptors-CxymFSgK.mjs";
|
|
3
3
|
import { LiteralExpr, SQL_CHAR_CODEC_ID, SQL_FLOAT_CODEC_ID, SQL_INT_CODEC_ID, SQL_TEXT_CODEC_ID, SQL_TIMESTAMP_CODEC_ID, SQL_VARCHAR_CODEC_ID, codec, createCodecRegistry, defineCodecs, sqlCodecDefinitions } from "@prisma-next/sql-relational-core/ast";
|
|
4
4
|
import { ifDefined } from "@prisma-next/utils/defined";
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
//#region src/core/authoring.ts
|
|
2
|
+
const postgresAuthoringTypes = { enum: {
|
|
3
|
+
kind: "typeConstructor",
|
|
4
|
+
args: [{ kind: "string" }, { kind: "stringArray" }],
|
|
5
|
+
output: {
|
|
6
|
+
codecId: "pg/enum@1",
|
|
7
|
+
nativeType: {
|
|
8
|
+
kind: "arg",
|
|
9
|
+
index: 0
|
|
10
|
+
},
|
|
11
|
+
typeParams: { values: {
|
|
12
|
+
kind: "arg",
|
|
13
|
+
index: 1
|
|
14
|
+
} }
|
|
15
|
+
}
|
|
16
|
+
} };
|
|
17
|
+
/**
|
|
18
|
+
* Field presets contributed by the Postgres target pack.
|
|
19
|
+
*
|
|
20
|
+
* These mirror the PSL scalar-to-codec mapping used by the Postgres adapter
|
|
21
|
+
* (see `createPostgresPslScalarTypeDescriptors`), so that authoring a field
|
|
22
|
+
* via the TS callback surface (e.g. `field.int()`) and via the PSL scalar
|
|
23
|
+
* surface (e.g. `Int`) lowers to byte-identical contracts.
|
|
24
|
+
*/
|
|
25
|
+
const postgresAuthoringFieldPresets = {
|
|
26
|
+
text: {
|
|
27
|
+
kind: "fieldPreset",
|
|
28
|
+
output: {
|
|
29
|
+
codecId: "pg/text@1",
|
|
30
|
+
nativeType: "text"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
int: {
|
|
34
|
+
kind: "fieldPreset",
|
|
35
|
+
output: {
|
|
36
|
+
codecId: "pg/int4@1",
|
|
37
|
+
nativeType: "int4"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
bigint: {
|
|
41
|
+
kind: "fieldPreset",
|
|
42
|
+
output: {
|
|
43
|
+
codecId: "pg/int8@1",
|
|
44
|
+
nativeType: "int8"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
float: {
|
|
48
|
+
kind: "fieldPreset",
|
|
49
|
+
output: {
|
|
50
|
+
codecId: "pg/float8@1",
|
|
51
|
+
nativeType: "float8"
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
decimal: {
|
|
55
|
+
kind: "fieldPreset",
|
|
56
|
+
output: {
|
|
57
|
+
codecId: "pg/numeric@1",
|
|
58
|
+
nativeType: "numeric"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
boolean: {
|
|
62
|
+
kind: "fieldPreset",
|
|
63
|
+
output: {
|
|
64
|
+
codecId: "pg/bool@1",
|
|
65
|
+
nativeType: "bool"
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
json: {
|
|
69
|
+
kind: "fieldPreset",
|
|
70
|
+
output: {
|
|
71
|
+
codecId: "pg/jsonb@1",
|
|
72
|
+
nativeType: "jsonb"
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
bytes: {
|
|
76
|
+
kind: "fieldPreset",
|
|
77
|
+
output: {
|
|
78
|
+
codecId: "pg/bytea@1",
|
|
79
|
+
nativeType: "bytea"
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
dateTime: {
|
|
83
|
+
kind: "fieldPreset",
|
|
84
|
+
output: {
|
|
85
|
+
codecId: "pg/timestamptz@1",
|
|
86
|
+
nativeType: "timestamptz"
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
createdAt: {
|
|
90
|
+
kind: "fieldPreset",
|
|
91
|
+
output: {
|
|
92
|
+
codecId: "pg/timestamptz@1",
|
|
93
|
+
nativeType: "timestamptz",
|
|
94
|
+
default: {
|
|
95
|
+
kind: "function",
|
|
96
|
+
expression: "now()"
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
//#endregion
|
|
103
|
+
//#region src/core/descriptor-meta.ts
|
|
104
|
+
const postgresTargetDescriptorMetaBase = {
|
|
105
|
+
kind: "target",
|
|
106
|
+
familyId: "sql",
|
|
107
|
+
targetId: "postgres",
|
|
108
|
+
id: "postgres",
|
|
109
|
+
version: "0.0.1",
|
|
110
|
+
capabilities: {},
|
|
111
|
+
authoring: {
|
|
112
|
+
type: postgresAuthoringTypes,
|
|
113
|
+
field: postgresAuthoringFieldPresets
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
const postgresTargetDescriptorMeta = postgresTargetDescriptorMetaBase;
|
|
117
|
+
|
|
118
|
+
//#endregion
|
|
119
|
+
export { postgresTargetDescriptorMeta as t };
|
|
120
|
+
//# sourceMappingURL=descriptor-meta-DkvCmY98.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"descriptor-meta-DkvCmY98.mjs","names":["postgresTargetDescriptorMeta: typeof postgresTargetDescriptorMetaBase & {\n readonly __codecTypes?: CodecTypes;\n}"],"sources":["../src/core/authoring.ts","../src/core/descriptor-meta.ts"],"sourcesContent":["import type {\n AuthoringFieldNamespace,\n AuthoringTypeNamespace,\n} from '@prisma-next/framework-components/authoring';\n\nexport const postgresAuthoringTypes = {\n enum: {\n kind: 'typeConstructor',\n args: [{ kind: 'string' }, { kind: 'stringArray' }],\n output: {\n codecId: 'pg/enum@1',\n nativeType: { kind: 'arg', index: 0 },\n typeParams: {\n values: { kind: 'arg', index: 1 },\n },\n },\n },\n} as const satisfies AuthoringTypeNamespace;\n\n/**\n * Field presets contributed by the Postgres target pack.\n *\n * These mirror the PSL scalar-to-codec mapping used by the Postgres adapter\n * (see `createPostgresPslScalarTypeDescriptors`), so that authoring a field\n * via the TS callback surface (e.g. `field.int()`) and via the PSL scalar\n * surface (e.g. `Int`) lowers to byte-identical contracts.\n */\nexport const postgresAuthoringFieldPresets = {\n text: {\n kind: 'fieldPreset',\n output: {\n codecId: 'pg/text@1',\n nativeType: 'text',\n },\n },\n int: {\n kind: 'fieldPreset',\n output: {\n codecId: 'pg/int4@1',\n nativeType: 'int4',\n },\n },\n bigint: {\n kind: 'fieldPreset',\n output: {\n codecId: 'pg/int8@1',\n nativeType: 'int8',\n },\n },\n float: {\n kind: 'fieldPreset',\n output: {\n codecId: 'pg/float8@1',\n nativeType: 'float8',\n },\n },\n decimal: {\n kind: 'fieldPreset',\n output: {\n codecId: 'pg/numeric@1',\n nativeType: 'numeric',\n },\n },\n boolean: {\n kind: 'fieldPreset',\n output: {\n codecId: 'pg/bool@1',\n nativeType: 'bool',\n },\n },\n json: {\n kind: 'fieldPreset',\n output: {\n codecId: 'pg/jsonb@1',\n nativeType: 'jsonb',\n },\n },\n bytes: {\n kind: 'fieldPreset',\n output: {\n codecId: 'pg/bytea@1',\n nativeType: 'bytea',\n },\n },\n dateTime: {\n kind: 'fieldPreset',\n output: {\n codecId: 'pg/timestamptz@1',\n nativeType: 'timestamptz',\n },\n },\n createdAt: {\n kind: 'fieldPreset',\n output: {\n codecId: 'pg/timestamptz@1',\n nativeType: 'timestamptz',\n default: {\n kind: 'function',\n expression: 'now()',\n },\n },\n },\n} as const satisfies AuthoringFieldNamespace;\n","import type { CodecTypes } from '@prisma-next/adapter-postgres/codec-types';\nimport { postgresAuthoringFieldPresets, postgresAuthoringTypes } from './authoring';\n\nconst postgresTargetDescriptorMetaBase = {\n kind: 'target',\n familyId: 'sql',\n targetId: 'postgres',\n id: 'postgres',\n version: '0.0.1',\n capabilities: {},\n authoring: {\n type: postgresAuthoringTypes,\n field: postgresAuthoringFieldPresets,\n },\n} as const;\n\nexport const postgresTargetDescriptorMeta: typeof postgresTargetDescriptorMetaBase & {\n readonly __codecTypes?: CodecTypes;\n} = postgresTargetDescriptorMetaBase;\n"],"mappings":";AAKA,MAAa,yBAAyB,EACpC,MAAM;CACJ,MAAM;CACN,MAAM,CAAC,EAAE,MAAM,UAAU,EAAE,EAAE,MAAM,eAAe,CAAC;CACnD,QAAQ;EACN,SAAS;EACT,YAAY;GAAE,MAAM;GAAO,OAAO;GAAG;EACrC,YAAY,EACV,QAAQ;GAAE,MAAM;GAAO,OAAO;GAAG,EAClC;EACF;CACF,EACF;;;;;;;;;AAUD,MAAa,gCAAgC;CAC3C,MAAM;EACJ,MAAM;EACN,QAAQ;GACN,SAAS;GACT,YAAY;GACb;EACF;CACD,KAAK;EACH,MAAM;EACN,QAAQ;GACN,SAAS;GACT,YAAY;GACb;EACF;CACD,QAAQ;EACN,MAAM;EACN,QAAQ;GACN,SAAS;GACT,YAAY;GACb;EACF;CACD,OAAO;EACL,MAAM;EACN,QAAQ;GACN,SAAS;GACT,YAAY;GACb;EACF;CACD,SAAS;EACP,MAAM;EACN,QAAQ;GACN,SAAS;GACT,YAAY;GACb;EACF;CACD,SAAS;EACP,MAAM;EACN,QAAQ;GACN,SAAS;GACT,YAAY;GACb;EACF;CACD,MAAM;EACJ,MAAM;EACN,QAAQ;GACN,SAAS;GACT,YAAY;GACb;EACF;CACD,OAAO;EACL,MAAM;EACN,QAAQ;GACN,SAAS;GACT,YAAY;GACb;EACF;CACD,UAAU;EACR,MAAM;EACN,QAAQ;GACN,SAAS;GACT,YAAY;GACb;EACF;CACD,WAAW;EACT,MAAM;EACN,QAAQ;GACN,SAAS;GACT,YAAY;GACZ,SAAS;IACP,MAAM;IACN,YAAY;IACb;GACF;EACF;CACF;;;;ACnGD,MAAM,mCAAmC;CACvC,MAAM;CACN,UAAU;CACV,UAAU;CACV,IAAI;CACJ,SAAS;CACT,cAAc,EAAE;CAChB,WAAW;EACT,MAAM;EACN,OAAO;EACR;CACF;AAED,MAAaA,+BAET"}
|
package/dist/pack.d.mts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { CodecTypes } from "@prisma-next/adapter-postgres/codec-types";
|
|
2
|
-
import { TargetPackRef } from "@prisma-next/framework-components/components";
|
|
3
2
|
|
|
4
3
|
//#region src/core/descriptor-meta.d.ts
|
|
5
|
-
declare const
|
|
4
|
+
declare const postgresTargetDescriptorMetaBase: {
|
|
6
5
|
readonly kind: "target";
|
|
7
6
|
readonly familyId: "sql";
|
|
8
7
|
readonly targetId: "postgres";
|
|
@@ -33,13 +32,87 @@ declare const postgresTargetDescriptorMeta: {
|
|
|
33
32
|
};
|
|
34
33
|
};
|
|
35
34
|
};
|
|
35
|
+
readonly field: {
|
|
36
|
+
readonly text: {
|
|
37
|
+
readonly kind: "fieldPreset";
|
|
38
|
+
readonly output: {
|
|
39
|
+
readonly codecId: "pg/text@1";
|
|
40
|
+
readonly nativeType: "text";
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
readonly int: {
|
|
44
|
+
readonly kind: "fieldPreset";
|
|
45
|
+
readonly output: {
|
|
46
|
+
readonly codecId: "pg/int4@1";
|
|
47
|
+
readonly nativeType: "int4";
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
readonly bigint: {
|
|
51
|
+
readonly kind: "fieldPreset";
|
|
52
|
+
readonly output: {
|
|
53
|
+
readonly codecId: "pg/int8@1";
|
|
54
|
+
readonly nativeType: "int8";
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
readonly float: {
|
|
58
|
+
readonly kind: "fieldPreset";
|
|
59
|
+
readonly output: {
|
|
60
|
+
readonly codecId: "pg/float8@1";
|
|
61
|
+
readonly nativeType: "float8";
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
readonly decimal: {
|
|
65
|
+
readonly kind: "fieldPreset";
|
|
66
|
+
readonly output: {
|
|
67
|
+
readonly codecId: "pg/numeric@1";
|
|
68
|
+
readonly nativeType: "numeric";
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
readonly boolean: {
|
|
72
|
+
readonly kind: "fieldPreset";
|
|
73
|
+
readonly output: {
|
|
74
|
+
readonly codecId: "pg/bool@1";
|
|
75
|
+
readonly nativeType: "bool";
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
readonly json: {
|
|
79
|
+
readonly kind: "fieldPreset";
|
|
80
|
+
readonly output: {
|
|
81
|
+
readonly codecId: "pg/jsonb@1";
|
|
82
|
+
readonly nativeType: "jsonb";
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
readonly bytes: {
|
|
86
|
+
readonly kind: "fieldPreset";
|
|
87
|
+
readonly output: {
|
|
88
|
+
readonly codecId: "pg/bytea@1";
|
|
89
|
+
readonly nativeType: "bytea";
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
readonly dateTime: {
|
|
93
|
+
readonly kind: "fieldPreset";
|
|
94
|
+
readonly output: {
|
|
95
|
+
readonly codecId: "pg/timestamptz@1";
|
|
96
|
+
readonly nativeType: "timestamptz";
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
readonly createdAt: {
|
|
100
|
+
readonly kind: "fieldPreset";
|
|
101
|
+
readonly output: {
|
|
102
|
+
readonly codecId: "pg/timestamptz@1";
|
|
103
|
+
readonly nativeType: "timestamptz";
|
|
104
|
+
readonly default: {
|
|
105
|
+
readonly kind: "function";
|
|
106
|
+
readonly expression: "now()";
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
};
|
|
36
111
|
};
|
|
37
112
|
};
|
|
38
|
-
|
|
39
|
-
//#region src/exports/pack.d.ts
|
|
40
|
-
declare const _default: typeof postgresTargetDescriptorMeta & TargetPackRef<"sql", "postgres"> & {
|
|
113
|
+
declare const postgresTargetDescriptorMeta: typeof postgresTargetDescriptorMetaBase & {
|
|
41
114
|
readonly __codecTypes?: CodecTypes;
|
|
42
115
|
};
|
|
43
116
|
//#endregion
|
|
44
|
-
export {
|
|
117
|
+
export { postgresTargetDescriptorMeta as default };
|
|
45
118
|
//# sourceMappingURL=pack.d.mts.map
|
package/dist/pack.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pack.d.mts","names":[],"sources":["../src/core/descriptor-meta.ts"
|
|
1
|
+
{"version":3,"file":"pack.d.mts","names":[],"sources":["../src/core/descriptor-meta.ts"],"sourcesContent":[],"mappings":";;;cAGM;;EAAA,SAAA,QAAA,EAAA,KAAA;EAaO,SAAA,QAAA,EAAA,UAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAAA,qCAAqC;0BACxB"}
|
package/dist/pack.mjs
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import { t as postgresTargetDescriptorMeta } from "./descriptor-meta-
|
|
1
|
+
import { t as postgresTargetDescriptorMeta } from "./descriptor-meta-DkvCmY98.mjs";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
const postgresPack = postgresTargetDescriptorMeta;
|
|
5
|
-
var pack_default = postgresPack;
|
|
6
|
-
|
|
7
|
-
//#endregion
|
|
8
|
-
export { pack_default as default };
|
|
9
|
-
//# sourceMappingURL=pack.mjs.map
|
|
3
|
+
export { postgresTargetDescriptorMeta as default };
|
package/dist/runtime.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as postgresTargetDescriptorMeta } from "./descriptor-meta-
|
|
1
|
+
import { t as postgresTargetDescriptorMeta } from "./descriptor-meta-DkvCmY98.mjs";
|
|
2
2
|
import { createCodecRegistry } from "@prisma-next/sql-relational-core/ast";
|
|
3
3
|
|
|
4
4
|
//#region src/exports/runtime.ts
|
package/package.json
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma-next/target-postgres",
|
|
3
|
-
"version": "0.4.0-dev.
|
|
3
|
+
"version": "0.4.0-dev.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"description": "Postgres target pack for Prisma Next",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"arktype": "^2.0.0",
|
|
9
9
|
"pathe": "^2.0.3",
|
|
10
|
-
"@prisma-next/contract": "0.4.0-dev.
|
|
11
|
-
"@prisma-next/
|
|
12
|
-
"@prisma-next/
|
|
13
|
-
"@prisma-next/
|
|
14
|
-
"@prisma-next/sql-
|
|
15
|
-
"@prisma-next/sql-
|
|
16
|
-
"@prisma-next/
|
|
17
|
-
"@prisma-next/sql-
|
|
18
|
-
"@prisma-next/sql-
|
|
19
|
-
"@prisma-next/sql-
|
|
20
|
-
"@prisma-next/sql-schema-ir": "0.4.0-dev.
|
|
21
|
-
"@prisma-next/utils": "0.4.0-dev.
|
|
10
|
+
"@prisma-next/contract": "0.4.0-dev.8",
|
|
11
|
+
"@prisma-next/errors": "0.4.0-dev.8",
|
|
12
|
+
"@prisma-next/family-sql": "0.4.0-dev.8",
|
|
13
|
+
"@prisma-next/framework-components": "0.4.0-dev.8",
|
|
14
|
+
"@prisma-next/sql-builder": "0.4.0-dev.8",
|
|
15
|
+
"@prisma-next/sql-errors": "0.4.0-dev.8",
|
|
16
|
+
"@prisma-next/sql-relational-core": "0.4.0-dev.8",
|
|
17
|
+
"@prisma-next/sql-runtime": "0.4.0-dev.8",
|
|
18
|
+
"@prisma-next/sql-operations": "0.4.0-dev.8",
|
|
19
|
+
"@prisma-next/sql-contract": "0.4.0-dev.8",
|
|
20
|
+
"@prisma-next/sql-schema-ir": "0.4.0-dev.8",
|
|
21
|
+
"@prisma-next/utils": "0.4.0-dev.8"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"tsdown": "0.18.4",
|
|
25
25
|
"typescript": "5.9.3",
|
|
26
26
|
"vitest": "4.0.17",
|
|
27
|
-
"@prisma-next/adapter-postgres": "0.4.0-dev.
|
|
28
|
-
"@prisma-next/driver-postgres": "0.4.0-dev.
|
|
29
|
-
"@prisma-next/
|
|
30
|
-
"@prisma-next/
|
|
27
|
+
"@prisma-next/adapter-postgres": "0.4.0-dev.8",
|
|
28
|
+
"@prisma-next/driver-postgres": "0.4.0-dev.8",
|
|
29
|
+
"@prisma-next/extension-pgvector": "0.4.0-dev.8",
|
|
30
|
+
"@prisma-next/tsconfig": "0.0.0",
|
|
31
31
|
"@prisma-next/tsdown": "0.0.0",
|
|
32
|
-
"@prisma-next/
|
|
32
|
+
"@prisma-next/test-utils": "0.0.1"
|
|
33
33
|
},
|
|
34
34
|
"files": [
|
|
35
35
|
"dist",
|
package/src/core/authoring.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
AuthoringFieldNamespace,
|
|
3
|
+
AuthoringTypeNamespace,
|
|
4
|
+
} from '@prisma-next/framework-components/authoring';
|
|
2
5
|
|
|
3
6
|
export const postgresAuthoringTypes = {
|
|
4
7
|
enum: {
|
|
@@ -13,3 +16,88 @@ export const postgresAuthoringTypes = {
|
|
|
13
16
|
},
|
|
14
17
|
},
|
|
15
18
|
} as const satisfies AuthoringTypeNamespace;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Field presets contributed by the Postgres target pack.
|
|
22
|
+
*
|
|
23
|
+
* These mirror the PSL scalar-to-codec mapping used by the Postgres adapter
|
|
24
|
+
* (see `createPostgresPslScalarTypeDescriptors`), so that authoring a field
|
|
25
|
+
* via the TS callback surface (e.g. `field.int()`) and via the PSL scalar
|
|
26
|
+
* surface (e.g. `Int`) lowers to byte-identical contracts.
|
|
27
|
+
*/
|
|
28
|
+
export const postgresAuthoringFieldPresets = {
|
|
29
|
+
text: {
|
|
30
|
+
kind: 'fieldPreset',
|
|
31
|
+
output: {
|
|
32
|
+
codecId: 'pg/text@1',
|
|
33
|
+
nativeType: 'text',
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
int: {
|
|
37
|
+
kind: 'fieldPreset',
|
|
38
|
+
output: {
|
|
39
|
+
codecId: 'pg/int4@1',
|
|
40
|
+
nativeType: 'int4',
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
bigint: {
|
|
44
|
+
kind: 'fieldPreset',
|
|
45
|
+
output: {
|
|
46
|
+
codecId: 'pg/int8@1',
|
|
47
|
+
nativeType: 'int8',
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
float: {
|
|
51
|
+
kind: 'fieldPreset',
|
|
52
|
+
output: {
|
|
53
|
+
codecId: 'pg/float8@1',
|
|
54
|
+
nativeType: 'float8',
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
decimal: {
|
|
58
|
+
kind: 'fieldPreset',
|
|
59
|
+
output: {
|
|
60
|
+
codecId: 'pg/numeric@1',
|
|
61
|
+
nativeType: 'numeric',
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
boolean: {
|
|
65
|
+
kind: 'fieldPreset',
|
|
66
|
+
output: {
|
|
67
|
+
codecId: 'pg/bool@1',
|
|
68
|
+
nativeType: 'bool',
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
json: {
|
|
72
|
+
kind: 'fieldPreset',
|
|
73
|
+
output: {
|
|
74
|
+
codecId: 'pg/jsonb@1',
|
|
75
|
+
nativeType: 'jsonb',
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
bytes: {
|
|
79
|
+
kind: 'fieldPreset',
|
|
80
|
+
output: {
|
|
81
|
+
codecId: 'pg/bytea@1',
|
|
82
|
+
nativeType: 'bytea',
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
dateTime: {
|
|
86
|
+
kind: 'fieldPreset',
|
|
87
|
+
output: {
|
|
88
|
+
codecId: 'pg/timestamptz@1',
|
|
89
|
+
nativeType: 'timestamptz',
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
createdAt: {
|
|
93
|
+
kind: 'fieldPreset',
|
|
94
|
+
output: {
|
|
95
|
+
codecId: 'pg/timestamptz@1',
|
|
96
|
+
nativeType: 'timestamptz',
|
|
97
|
+
default: {
|
|
98
|
+
kind: 'function',
|
|
99
|
+
expression: 'now()',
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
} as const satisfies AuthoringFieldNamespace;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { CodecTypes } from '@prisma-next/adapter-postgres/codec-types';
|
|
2
|
+
import { postgresAuthoringFieldPresets, postgresAuthoringTypes } from './authoring';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
const postgresTargetDescriptorMetaBase = {
|
|
4
5
|
kind: 'target',
|
|
5
6
|
familyId: 'sql',
|
|
6
7
|
targetId: 'postgres',
|
|
@@ -9,5 +10,10 @@ export const postgresTargetDescriptorMeta = {
|
|
|
9
10
|
capabilities: {},
|
|
10
11
|
authoring: {
|
|
11
12
|
type: postgresAuthoringTypes,
|
|
13
|
+
field: postgresAuthoringFieldPresets,
|
|
12
14
|
},
|
|
13
15
|
} as const;
|
|
16
|
+
|
|
17
|
+
export const postgresTargetDescriptorMeta: typeof postgresTargetDescriptorMetaBase & {
|
|
18
|
+
readonly __codecTypes?: CodecTypes;
|
|
19
|
+
} = postgresTargetDescriptorMetaBase;
|
package/src/exports/pack.ts
CHANGED
|
@@ -1,10 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import type { TargetPackRef } from '@prisma-next/framework-components/components';
|
|
3
|
-
import { postgresTargetDescriptorMeta } from '../core/descriptor-meta';
|
|
4
|
-
|
|
5
|
-
const postgresPack = postgresTargetDescriptorMeta;
|
|
6
|
-
|
|
7
|
-
export default postgresPack as typeof postgresTargetDescriptorMeta &
|
|
8
|
-
TargetPackRef<'sql', 'postgres'> & {
|
|
9
|
-
readonly __codecTypes?: CodecTypes;
|
|
10
|
-
};
|
|
1
|
+
export { postgresTargetDescriptorMeta as default } from '../core/descriptor-meta';
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
//#region src/core/authoring.ts
|
|
2
|
-
const postgresAuthoringTypes = { enum: {
|
|
3
|
-
kind: "typeConstructor",
|
|
4
|
-
args: [{ kind: "string" }, { kind: "stringArray" }],
|
|
5
|
-
output: {
|
|
6
|
-
codecId: "pg/enum@1",
|
|
7
|
-
nativeType: {
|
|
8
|
-
kind: "arg",
|
|
9
|
-
index: 0
|
|
10
|
-
},
|
|
11
|
-
typeParams: { values: {
|
|
12
|
-
kind: "arg",
|
|
13
|
-
index: 1
|
|
14
|
-
} }
|
|
15
|
-
}
|
|
16
|
-
} };
|
|
17
|
-
|
|
18
|
-
//#endregion
|
|
19
|
-
//#region src/core/descriptor-meta.ts
|
|
20
|
-
const postgresTargetDescriptorMeta = {
|
|
21
|
-
kind: "target",
|
|
22
|
-
familyId: "sql",
|
|
23
|
-
targetId: "postgres",
|
|
24
|
-
id: "postgres",
|
|
25
|
-
version: "0.0.1",
|
|
26
|
-
capabilities: {},
|
|
27
|
-
authoring: { type: postgresAuthoringTypes }
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
//#endregion
|
|
31
|
-
export { postgresTargetDescriptorMeta as t };
|
|
32
|
-
//# sourceMappingURL=descriptor-meta-CAf16lsJ.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"descriptor-meta-CAf16lsJ.mjs","names":[],"sources":["../src/core/authoring.ts","../src/core/descriptor-meta.ts"],"sourcesContent":["import type { AuthoringTypeNamespace } from '@prisma-next/framework-components/authoring';\n\nexport const postgresAuthoringTypes = {\n enum: {\n kind: 'typeConstructor',\n args: [{ kind: 'string' }, { kind: 'stringArray' }],\n output: {\n codecId: 'pg/enum@1',\n nativeType: { kind: 'arg', index: 0 },\n typeParams: {\n values: { kind: 'arg', index: 1 },\n },\n },\n },\n} as const satisfies AuthoringTypeNamespace;\n","import { postgresAuthoringTypes } from './authoring';\n\nexport const postgresTargetDescriptorMeta = {\n kind: 'target',\n familyId: 'sql',\n targetId: 'postgres',\n id: 'postgres',\n version: '0.0.1',\n capabilities: {},\n authoring: {\n type: postgresAuthoringTypes,\n },\n} as const;\n"],"mappings":";AAEA,MAAa,yBAAyB,EACpC,MAAM;CACJ,MAAM;CACN,MAAM,CAAC,EAAE,MAAM,UAAU,EAAE,EAAE,MAAM,eAAe,CAAC;CACnD,QAAQ;EACN,SAAS;EACT,YAAY;GAAE,MAAM;GAAO,OAAO;GAAG;EACrC,YAAY,EACV,QAAQ;GAAE,MAAM;GAAO,OAAO;GAAG,EAClC;EACF;CACF,EACF;;;;ACZD,MAAa,+BAA+B;CAC1C,MAAM;CACN,UAAU;CACV,UAAU;CACV,IAAI;CACJ,SAAS;CACT,cAAc,EAAE;CAChB,WAAW,EACT,MAAM,wBACP;CACF"}
|
package/dist/pack.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pack.mjs","names":[],"sources":["../src/exports/pack.ts"],"sourcesContent":["import type { CodecTypes } from '@prisma-next/adapter-postgres/codec-types';\nimport type { TargetPackRef } from '@prisma-next/framework-components/components';\nimport { postgresTargetDescriptorMeta } from '../core/descriptor-meta';\n\nconst postgresPack = postgresTargetDescriptorMeta;\n\nexport default postgresPack as typeof postgresTargetDescriptorMeta &\n TargetPackRef<'sql', 'postgres'> & {\n readonly __codecTypes?: CodecTypes;\n };\n"],"mappings":";;;AAIA,MAAM,eAAe;AAErB,mBAAe"}
|