desen-cli 1.0.0-draft → 1.0.0-draft.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/.turbo/turbo-build.log +1 -1
- package/dist/index.js +16 -3
- package/package.json +2 -5
- package/src/index.ts +15 -4
package/.turbo/turbo-build.log
CHANGED
package/dist/index.js
CHANGED
|
@@ -191,9 +191,22 @@ program
|
|
|
191
191
|
for (const item of payloads) {
|
|
192
192
|
if (!item.path || !item.ast)
|
|
193
193
|
continue;
|
|
194
|
-
|
|
194
|
+
let result;
|
|
195
|
+
if (item.path.startsWith('surface/')) {
|
|
196
|
+
result = desen_core_1.surfaceSpec.safeParse(item.ast);
|
|
197
|
+
}
|
|
198
|
+
else if (item.path.startsWith('element/') || item.path.startsWith('composition/')) {
|
|
199
|
+
result = desen_core_1.nodeSpec.safeParse(item.ast);
|
|
200
|
+
}
|
|
201
|
+
else if (item.path.startsWith('themes/')) {
|
|
202
|
+
result = { success: true }; // Token bypass for now
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
result = desen_core_1.nodeSpec.safeParse(item.ast);
|
|
206
|
+
}
|
|
195
207
|
if (!result.success) {
|
|
196
208
|
console.error(chalk_1.default.red(`❌ [Fail-Closed] Payload validation failed for ${item.path}`));
|
|
209
|
+
console.error(chalk_1.default.yellow(JSON.stringify(result.error.format(), null, 2)));
|
|
197
210
|
return res.status(400).json({
|
|
198
211
|
error: "Validation failed against desen-core schemas",
|
|
199
212
|
path: item.path,
|
|
@@ -235,8 +248,8 @@ program
|
|
|
235
248
|
"start": "next start"
|
|
236
249
|
},
|
|
237
250
|
dependencies: {
|
|
238
|
-
"desen-core": "1.0.0-draft",
|
|
239
|
-
"desen": "1.0.0-draft",
|
|
251
|
+
"desen-core": "1.0.0-draft.2",
|
|
252
|
+
"desen": "1.0.0-draft.2",
|
|
240
253
|
"next": "14.2.3",
|
|
241
254
|
"react": "18.3.1",
|
|
242
255
|
"react-dom": "18.3.1"
|
package/package.json
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "desen-cli",
|
|
3
|
-
"version": "1.0.0-draft",
|
|
3
|
+
"version": "1.0.0-draft.2",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
|
-
"bin": {
|
|
6
|
-
"desen": "./dist/index.js"
|
|
7
|
-
},
|
|
8
5
|
"dependencies": {
|
|
9
6
|
"chalk": "^5.6.2",
|
|
10
7
|
"commander": "^14.0.3",
|
|
11
8
|
"express": "^4.19.2",
|
|
12
9
|
"cors": "^2.8.5",
|
|
13
|
-
"desen-core": "1.0.0-draft"
|
|
10
|
+
"desen-core": "1.0.0-draft.2"
|
|
14
11
|
},
|
|
15
12
|
"devDependencies": {
|
|
16
13
|
"@types/cors": "^2.8.19",
|
package/src/index.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { Command } from "commander";
|
|
|
4
4
|
import chalk from "chalk";
|
|
5
5
|
import fs from "fs";
|
|
6
6
|
import path from "path";
|
|
7
|
-
import { surfaceSpec } from "desen-core";
|
|
7
|
+
import { surfaceSpec, nodeSpec } from "desen-core";
|
|
8
8
|
import express from "express";
|
|
9
9
|
import cors from "cors";
|
|
10
10
|
|
|
@@ -212,9 +212,20 @@ program
|
|
|
212
212
|
for (const item of payloads) {
|
|
213
213
|
if (!item.path || !item.ast) continue;
|
|
214
214
|
|
|
215
|
-
|
|
215
|
+
let result: any;
|
|
216
|
+
if (item.path.startsWith('surface/')) {
|
|
217
|
+
result = surfaceSpec.safeParse(item.ast);
|
|
218
|
+
} else if (item.path.startsWith('element/') || item.path.startsWith('composition/')) {
|
|
219
|
+
result = nodeSpec.safeParse(item.ast);
|
|
220
|
+
} else if (item.path.startsWith('themes/')) {
|
|
221
|
+
result = { success: true }; // Token bypass for now
|
|
222
|
+
} else {
|
|
223
|
+
result = nodeSpec.safeParse(item.ast);
|
|
224
|
+
}
|
|
225
|
+
|
|
216
226
|
if (!result.success) {
|
|
217
227
|
console.error(chalk.red(`❌ [Fail-Closed] Payload validation failed for ${item.path}`));
|
|
228
|
+
console.error(chalk.yellow(JSON.stringify(result.error.format(), null, 2)));
|
|
218
229
|
return res.status(400).json({
|
|
219
230
|
error: "Validation failed against desen-core schemas",
|
|
220
231
|
path: item.path,
|
|
@@ -263,8 +274,8 @@ program
|
|
|
263
274
|
"start": "next start"
|
|
264
275
|
},
|
|
265
276
|
dependencies: {
|
|
266
|
-
"desen-core": "1.0.0-draft",
|
|
267
|
-
"desen": "1.0.0-draft",
|
|
277
|
+
"desen-core": "1.0.0-draft.2",
|
|
278
|
+
"desen": "1.0.0-draft.2",
|
|
268
279
|
"next": "14.2.3",
|
|
269
280
|
"react": "18.3.1",
|
|
270
281
|
"react-dom": "18.3.1"
|