@specverse/engines 6.37.0 → 6.38.0
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/libs/instance-factories/services/templates/prisma/controller-generator.js +7 -1
- package/dist/libs/instance-factories/services/templates/prisma/service-generator.js +6 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/form-body-composer.test.ts +16 -0
- package/libs/instance-factories/services/templates/prisma/controller-generator.ts +4 -1
- package/libs/instance-factories/services/templates/prisma/service-generator.ts +4 -1
- package/package.json +2 -2
|
@@ -345,7 +345,13 @@ function mapTypeToTypeScript(type) {
|
|
|
345
345
|
Date: "Date",
|
|
346
346
|
DateTime: "Date",
|
|
347
347
|
UUID: "string",
|
|
348
|
-
|
|
348
|
+
Json: "any",
|
|
349
|
+
// #43C: SpecVerse canonical casing → Prisma's Json
|
|
350
|
+
JSON: "any",
|
|
351
|
+
// legacy/alt casing
|
|
352
|
+
Jsonb: "any",
|
|
353
|
+
// Postgres-native variant
|
|
354
|
+
JSONB: "any"
|
|
349
355
|
};
|
|
350
356
|
return typeMap[type] || "any";
|
|
351
357
|
}
|
|
@@ -253,7 +253,13 @@ function mapTypeToTypeScript(type) {
|
|
|
253
253
|
Date: "Date",
|
|
254
254
|
DateTime: "Date",
|
|
255
255
|
UUID: "string",
|
|
256
|
+
Json: "any",
|
|
257
|
+
// #43C: SpecVerse canonical casing → Prisma's Json
|
|
256
258
|
JSON: "any",
|
|
259
|
+
// legacy/alt casing
|
|
260
|
+
Jsonb: "any",
|
|
261
|
+
// Postgres-native variant — same TS shape
|
|
262
|
+
JSONB: "any",
|
|
257
263
|
Array: "any[]",
|
|
258
264
|
Object: "Record<string, any>"
|
|
259
265
|
};
|
|
@@ -17,6 +17,7 @@ function makeContext(overrides: Partial<EmitContext> = {}): EmitContext {
|
|
|
17
17
|
authorId: { type: 'UUID', required: true }, // belongsTo FK
|
|
18
18
|
externalId: { type: 'UUID', required: false }, // non-FK UUID
|
|
19
19
|
createdAt: { type: 'DateTime', required: false }, // metadata
|
|
20
|
+
metadata: { type: 'Json', required: false }, // #43C — Json type
|
|
20
21
|
},
|
|
21
22
|
relationships: {
|
|
22
23
|
author: { type: 'belongsTo', targetModel: 'Author' },
|
|
@@ -128,6 +129,21 @@ describe('composeFormBody — input type per attribute', () => {
|
|
|
128
129
|
const body = composeFormBody(makeContext());
|
|
129
130
|
expect(body).toMatch(/id="externalId"[\s\S]*type="text"/);
|
|
130
131
|
});
|
|
132
|
+
|
|
133
|
+
it('Json → textarea using formatJsonForInput + parseJsonInput helpers (#43C)', () => {
|
|
134
|
+
// Pre-#43C, a Json field fell through to the default <input type="text">
|
|
135
|
+
// branch — single-line, no parse handling, mangled nested structure
|
|
136
|
+
// on round-trip. The new branch renders <textarea> and delegates
|
|
137
|
+
// read/write formatting to runtime helpers (formatJsonForInput,
|
|
138
|
+
// parseJsonInput from @specverse/runtime/views/core/entity-display)
|
|
139
|
+
// so the emitted JSX stays clean (no inline IIFE that confuses the
|
|
140
|
+
// parser) and the parsing rules live in one tested place.
|
|
141
|
+
const body = composeFormBody(makeContext());
|
|
142
|
+
expect(body).toMatch(/<textarea\s[^>]*id="metadata"/);
|
|
143
|
+
expect(body).not.toMatch(/id="metadata"[\s\S]{0,80}?type="text"/);
|
|
144
|
+
expect(body).toContain('formatJsonForInput((formData as any).metadata)');
|
|
145
|
+
expect(body).toContain("handleChange('metadata', parseJsonInput(e.target.value))");
|
|
146
|
+
});
|
|
131
147
|
});
|
|
132
148
|
|
|
133
149
|
describe('composeFormBody — required markers', () => {
|
|
@@ -445,7 +445,10 @@ function mapTypeToTypeScript(type: string): string {
|
|
|
445
445
|
Date: 'Date',
|
|
446
446
|
DateTime: 'Date',
|
|
447
447
|
UUID: 'string',
|
|
448
|
-
|
|
448
|
+
Json: 'any', // #43C: SpecVerse canonical casing → Prisma's Json
|
|
449
|
+
JSON: 'any', // legacy/alt casing
|
|
450
|
+
Jsonb: 'any', // Postgres-native variant
|
|
451
|
+
JSONB: 'any'
|
|
449
452
|
};
|
|
450
453
|
|
|
451
454
|
return typeMap[type] || 'any';
|
|
@@ -355,7 +355,10 @@ function mapTypeToTypeScript(type: string): string {
|
|
|
355
355
|
Date: 'Date',
|
|
356
356
|
DateTime: 'Date',
|
|
357
357
|
UUID: 'string',
|
|
358
|
-
|
|
358
|
+
Json: 'any', // #43C: SpecVerse canonical casing → Prisma's Json
|
|
359
|
+
JSON: 'any', // legacy/alt casing
|
|
360
|
+
Jsonb: 'any', // Postgres-native variant — same TS shape
|
|
361
|
+
JSONB: 'any',
|
|
359
362
|
Array: 'any[]',
|
|
360
363
|
Object: 'Record<string, any>'
|
|
361
364
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@specverse/engines",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.38.0",
|
|
4
4
|
"description": "SpecVerse toolchain — parser, inference, realize, generators, AI, registry, bundles",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"@specverse/assets": "^1.17.0",
|
|
65
65
|
"@specverse/engines": "^6.29.3",
|
|
66
66
|
"@specverse/entities": "^5.4.0",
|
|
67
|
-
"@specverse/runtime": "^5.0
|
|
67
|
+
"@specverse/runtime": "^5.1.0",
|
|
68
68
|
"@specverse/types": "^5.2.0",
|
|
69
69
|
"ai": "^6.0.168",
|
|
70
70
|
"ajv": "^8.17.0",
|