@prisma-next/emitter 0.3.0-dev.40 → 0.3.0-dev.43
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma-next/emitter",
|
|
3
|
-
"version": "0.3.0-dev.
|
|
3
|
+
"version": "0.3.0-dev.43",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"files": [
|
|
@@ -10,18 +10,18 @@
|
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"arktype": "^2.0.0",
|
|
13
|
-
"@prisma-next/contract": "0.3.0-dev.
|
|
14
|
-
"@prisma-next/core-control-plane": "0.3.0-dev.
|
|
13
|
+
"@prisma-next/contract": "0.3.0-dev.43",
|
|
14
|
+
"@prisma-next/core-control-plane": "0.3.0-dev.43"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"@types/node": "24.10.4",
|
|
18
18
|
"tsdown": "0.18.4",
|
|
19
19
|
"typescript": "5.9.3",
|
|
20
20
|
"vitest": "4.0.17",
|
|
21
|
-
"@prisma-next/operations": "0.3.0-dev.
|
|
21
|
+
"@prisma-next/operations": "0.3.0-dev.43",
|
|
22
22
|
"@prisma-next/test-utils": "0.0.1",
|
|
23
|
-
"@prisma-next/
|
|
24
|
-
"@prisma-next/
|
|
23
|
+
"@prisma-next/tsdown": "0.0.0",
|
|
24
|
+
"@prisma-next/tsconfig": "0.0.0"
|
|
25
25
|
},
|
|
26
26
|
"exports": {
|
|
27
27
|
".": {
|
|
@@ -58,7 +58,7 @@ describe('canonicalization', () => {
|
|
|
58
58
|
it.each([
|
|
59
59
|
{ nullable: false },
|
|
60
60
|
{ nullable: undefined },
|
|
61
|
-
])('
|
|
61
|
+
])('omits nullable:false for columns with defaults (nullable=$nullable)', ({ nullable }) => {
|
|
62
62
|
const ir = createContractIR({
|
|
63
63
|
storage: {
|
|
64
64
|
tables: {
|
|
@@ -89,10 +89,39 @@ describe('canonicalization', () => {
|
|
|
89
89
|
const columns = user['columns'] as Record<string, unknown>;
|
|
90
90
|
const createdAt = columns['created_at'] as Record<string, unknown>;
|
|
91
91
|
const updatedAt = columns['updated_at'] as Record<string, unknown>;
|
|
92
|
-
expect(createdAt['nullable']).
|
|
92
|
+
expect(createdAt['nullable']).toBeUndefined();
|
|
93
93
|
expect(updatedAt['nullable']).toBe(true);
|
|
94
94
|
});
|
|
95
95
|
|
|
96
|
+
it('preserves nullable:true for columns with defaults', () => {
|
|
97
|
+
const ir = createContractIR({
|
|
98
|
+
storage: {
|
|
99
|
+
tables: {
|
|
100
|
+
user: {
|
|
101
|
+
columns: {
|
|
102
|
+
bio: {
|
|
103
|
+
codecId: 'pg/text@1',
|
|
104
|
+
nativeType: 'text',
|
|
105
|
+
nullable: true,
|
|
106
|
+
default: { kind: 'literal', value: '' },
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
const result = canonicalizeContract(ir);
|
|
115
|
+
const parsed = JSON.parse(result) as Record<string, unknown>;
|
|
116
|
+
const storage = parsed['storage'] as Record<string, unknown>;
|
|
117
|
+
const tables = storage['tables'] as Record<string, unknown>;
|
|
118
|
+
const user = tables['user'] as Record<string, unknown>;
|
|
119
|
+
const columns = user['columns'] as Record<string, unknown>;
|
|
120
|
+
const bio = columns['bio'] as Record<string, unknown>;
|
|
121
|
+
expect(bio['nullable']).toBe(true);
|
|
122
|
+
expect(bio['default']).toEqual({ kind: 'literal', value: '' });
|
|
123
|
+
});
|
|
124
|
+
|
|
96
125
|
it('omits empty arrays and objects except required ones', () => {
|
|
97
126
|
const ir = createContractIR();
|
|
98
127
|
|