@nullix/zod-mongoose-studio 3.3.1 → 3.3.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/.output/nitro.json +1 -1
- package/.output/public/_nuxt/{DA0pQuyP.js → B6lqezyA.js} +3 -3
- package/.output/public/_nuxt/{BCIlnd0g.js → B7ScFmDB.js} +1 -1
- package/.output/public/_nuxt/{DsnIpnT9.js → B8gqXD2U.js} +1 -1
- package/.output/public/_nuxt/{BNDnV2op.js → BC9tFNFa.js} +3 -3
- package/.output/public/_nuxt/{sKEJiAHO.js → Bbi9UBvi.js} +1 -1
- package/.output/public/_nuxt/{I3Ucam2s.js → BcYnCaqL.js} +1 -1
- package/.output/public/_nuxt/{C2BHp-MG.js → BlZ0x31M.js} +1 -1
- package/.output/public/_nuxt/{ypRHVLFO.js → Bw82IGM8.js} +1 -1
- package/.output/public/_nuxt/{5Tu2WUJz.js → C8xmwXC2.js} +1 -1
- package/.output/public/_nuxt/{BO4hqv6q.js → C919AVYR.js} +1 -1
- package/.output/public/_nuxt/{o-NCh2rp.js → CsQL5F-l.js} +1 -1
- package/.output/public/_nuxt/{B9paGgN0.js → Czp4_2o-.js} +3 -3
- package/.output/public/_nuxt/{D87QMS6j.js → DJa7_7Hz.js} +1 -1
- package/.output/public/_nuxt/{B0N6xv5E.js → DKK0Mrrg.js} +1 -1
- package/.output/public/_nuxt/{CMH9iX_E.js → DbUZZZZu.js} +2 -2
- package/.output/public/_nuxt/{DcJ7oPvZ.js → DbqvVYbv.js} +1 -1
- package/.output/public/_nuxt/{Dce9SnGa.js → JkiDMdYG.js} +1 -1
- package/.output/public/_nuxt/{tqQNlhT9.js → OVQ3C2Ge.js} +1 -1
- package/.output/public/_nuxt/{CKULsFUz.js → PXBhK7S_.js} +1 -1
- package/.output/public/_nuxt/{DpKrXpkK.js → YC-RLggm.js} +1 -1
- package/.output/public/_nuxt/builds/latest.json +1 -1
- package/.output/public/_nuxt/builds/meta/46174b5e-cab6-4a73-95f8-66a1c9b1be2b.json +1 -0
- package/.output/public/_nuxt/{CzbCpNnc.js → d1NBz903.js} +1 -1
- package/.output/public/_nuxt/{entry.B-vs1tRH.css → entry.DaqrxXuH.css} +1 -1
- package/.output/public/_nuxt/{BOsJJ_ZU.js → iGzUozbF.js} +1 -1
- package/.output/public/_nuxt/{B0cUlOSM.js → iKW_mt0p.js} +1 -1
- package/.output/server/chunks/build/client.precomputed.mjs +1 -1
- package/.output/server/chunks/nitro/nitro.mjs +348 -348
- package/.output/server/chunks/routes/api/editor-types.get.mjs +91 -22
- package/.output/server/chunks/routes/api/editor-types.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/studio/run.post.mjs +9 -4
- package/.output/server/chunks/routes/api/studio/run.post.mjs.map +1 -1
- package/.output/server/package.json +1 -1
- package/README.md +3 -1
- package/package.json +4 -3
- package/server/api/editor-types.get.ts +2 -23
- package/server/api/studio/run.post.ts +18 -6
- package/server/utils/editor-types.json +1 -0
- package/.output/public/_nuxt/builds/meta/51f1351c-0667-4235-9ddc-16582a51ce03.json +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor-types.get.mjs","sources":["../../../../../server/api/editor-types.get.ts"],"names":[
|
|
1
|
+
{"version":3,"file":"editor-types.get.mjs","sources":["../../../../../server/api/editor-types.get.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,wBAAA,kBAAA,CAAA,CAAA,KAAA,KAAA;AACA,EAAA,SAAA,CAAA,KAAA,EAAA,iBAAA,sBAAA,CAAA;AACA,EAAA,OAAA,WAAA;AACA,CAAA,CAAA;;;;"}
|
|
@@ -18,16 +18,21 @@ import 'consola';
|
|
|
18
18
|
|
|
19
19
|
const run_post = defineEventHandler(async (event) => {
|
|
20
20
|
if (!useRuntimeConfig(event).public.isDocsMode) {
|
|
21
|
-
throw createError({
|
|
21
|
+
throw createError({
|
|
22
|
+
statusCode: 403,
|
|
23
|
+
message: "Use the local Studio endpoint in CLI mode."
|
|
24
|
+
});
|
|
22
25
|
}
|
|
23
|
-
const socketPath = process.env.STUDIO_RUNNER_SOCKET;
|
|
24
|
-
if (!socketPath) throw createError({ statusCode: 503, message: "Studio runner is not configured." });
|
|
26
|
+
const socketPath = process.env.STUDIO_RUNNER_SOCKET || "/run/zod-studio/runner.sock";
|
|
25
27
|
const body = await readStudioRequest(event);
|
|
26
28
|
try {
|
|
27
29
|
return await runInContainer(body, socketPath);
|
|
28
30
|
} catch (error) {
|
|
29
31
|
if (error == null ? void 0 : error.statusCode) throw error;
|
|
30
|
-
throw createError({
|
|
32
|
+
throw createError({
|
|
33
|
+
statusCode: 503,
|
|
34
|
+
message: "Studio runner is unavailable. Try again shortly."
|
|
35
|
+
});
|
|
31
36
|
}
|
|
32
37
|
});
|
|
33
38
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.post.mjs","sources":["../../../../../../server/api/studio/run.post.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAIA,iBAAA,kBAAA,CAAA,OAAA,KAAA,KAAA;AACA,EAAA,IAAA,CAAA,gBAAA,CAAA,KAAA,CAAA,CAAA,OAAA,UAAA,EAAA;AACA,IAAA,MAAA,
|
|
1
|
+
{"version":3,"file":"run.post.mjs","sources":["../../../../../../server/api/studio/run.post.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAIA,iBAAA,kBAAA,CAAA,OAAA,KAAA,KAAA;AACA,EAAA,IAAA,CAAA,gBAAA,CAAA,KAAA,CAAA,CAAA,OAAA,UAAA,EAAA;AACA,IAAA,MAAA,WAAA,CAAA;AAAA,MACA,UAAA,EAAA,GAAA;AAAA,MACA,OAAA,EAAA;AAAA,KACA,CAAA;AAAA,EACA;AACA,EAAA,MAAA,UAAA,GACA,OAAA,CAAA,GAAA,CAAA,oBAAA,IAAA,6BAAA;AAMA,EAAA,MAAA,IAAA,GAAA,MAAA,iBAAA,CAAA,KAAA,CAAA;AACA,EAAA,IAAA;AACA,IAAA,OAAA,MAAA,cAAA,CAAA,IAAA,EAAA,UAAA,CAAA;AAAA,EACA,SAAA,KAAA,EAAA;AACA,IAAA,IAAA,KAAA,IAAA,IAAA,GAAA,MAAA,GAAA,KAAA,CAAA,YAAA,MAAA,KAAA;AACA,IAAA,MAAA,WAAA,CAAA;AAAA,MACA,UAAA,EAAA,GAAA;AAAA,MACA,OAAA,EAAA;AAAA,KACA,CAAA;AAAA,EACA;AACA,CAAA,CAAA;;;;"}
|
package/README.md
CHANGED
|
@@ -153,6 +153,8 @@ Local CLI mode continues to run directly, binds to `127.0.0.1`, and checks API h
|
|
|
153
153
|
|
|
154
154
|
Running `pnpm --filter @nullix/zod-mongoose-studio dev` also uses the local parse endpoint, without Docker. In docs mode the editors remain usable without a runner, but Run reports that the runner is unavailable until the container and `STUDIO_RUNNER_SOCKET` are configured.
|
|
155
155
|
|
|
156
|
+
The Monaco Zod declarations are bundled from `server/utils/editor-types.json`; production does not read declaration files from `node_modules`. After updating Zod, regenerate that file with `pnpm --filter @nullix/zod-mongoose-studio generate:editor-types` and commit it with the dependency update.
|
|
157
|
+
|
|
156
158
|
## Project Structure
|
|
157
159
|
|
|
158
160
|
```text
|
|
@@ -178,4 +180,4 @@ Please refer to the monorepo root for development and contribution guidelines.
|
|
|
178
180
|
|
|
179
181
|
## License
|
|
180
182
|
|
|
181
|
-
MIT
|
|
183
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nullix/zod-mongoose-studio",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.2",
|
|
4
4
|
"description": "Monaco-powered TypeScript playground for @nullix/zod-mongoose",
|
|
5
5
|
"main": "./nuxt.config.ts",
|
|
6
6
|
"bin": {
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"mongoose": "9.6.3",
|
|
46
46
|
"open": "11.0.0",
|
|
47
47
|
"zod": "4.3.6",
|
|
48
|
-
"@nullix/zod-mongoose": "3.3.
|
|
48
|
+
"@nullix/zod-mongoose": "3.3.2"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@nuxt/ui": "4.6.0",
|
|
@@ -58,7 +58,8 @@
|
|
|
58
58
|
"vue-tsc": "3.2.6"
|
|
59
59
|
},
|
|
60
60
|
"scripts": {
|
|
61
|
-
"
|
|
61
|
+
"generate:editor-types": "node scripts/generate-editor-types.mjs",
|
|
62
|
+
"build": "nuxt build",
|
|
62
63
|
"dev": "nuxt dev -p 34003",
|
|
63
64
|
"generate": "nuxt generate",
|
|
64
65
|
"preview": "nuxt preview",
|
|
@@ -1,28 +1,7 @@
|
|
|
1
|
-
import { readdir, readFile } from "node:fs/promises";
|
|
2
|
-
import { dirname, join, relative } from "node:path";
|
|
3
|
-
import { createRequire } from "node:module";
|
|
4
1
|
import { setHeader } from "h3";
|
|
5
|
-
|
|
6
|
-
const require = createRequire(import.meta.url);
|
|
7
|
-
const zodRoot = dirname(dirname(require.resolve("zod/v4")));
|
|
8
|
-
let cachedTypes: Promise<Record<string, string>> | undefined;
|
|
9
|
-
|
|
10
|
-
async function collect(directory: string, files: Record<string, string>) {
|
|
11
|
-
for (const entry of await readdir(directory, { withFileTypes: true })) {
|
|
12
|
-
const path = join(directory, entry.name);
|
|
13
|
-
if (entry.isDirectory()) await collect(path, files);
|
|
14
|
-
else if (entry.name.endsWith(".d.ts")) {
|
|
15
|
-
files[`file:///node_modules/zod/${relative(zodRoot, path).replaceAll("\\", "/")}`] = await readFile(path, "utf8");
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
2
|
+
import editorTypes from "../utils/editor-types.json";
|
|
19
3
|
|
|
20
4
|
export default defineEventHandler((event) => {
|
|
21
5
|
setHeader(event, "Cache-Control", "public, max-age=3600");
|
|
22
|
-
|
|
23
|
-
const files: Record<string, string> = {};
|
|
24
|
-
await collect(join(zodRoot, "v4"), files);
|
|
25
|
-
return files;
|
|
26
|
-
})();
|
|
27
|
-
return cachedTypes;
|
|
6
|
+
return editorTypes;
|
|
28
7
|
});
|
|
@@ -4,14 +4,26 @@ import { runInContainer } from "../../utils/runner-client";
|
|
|
4
4
|
|
|
5
5
|
export default defineEventHandler(async (event) => {
|
|
6
6
|
if (!useRuntimeConfig(event).public.isDocsMode) {
|
|
7
|
-
throw createError({
|
|
7
|
+
throw createError({
|
|
8
|
+
statusCode: 403,
|
|
9
|
+
message: "Use the local Studio endpoint in CLI mode.",
|
|
10
|
+
});
|
|
8
11
|
}
|
|
9
|
-
const socketPath =
|
|
10
|
-
|
|
12
|
+
const socketPath =
|
|
13
|
+
process.env.STUDIO_RUNNER_SOCKET || "/run/zod-studio/runner.sock";
|
|
14
|
+
if (!socketPath)
|
|
15
|
+
throw createError({
|
|
16
|
+
statusCode: 503,
|
|
17
|
+
message: "Studio runner is not configured.",
|
|
18
|
+
});
|
|
11
19
|
const body = await readStudioRequest(event);
|
|
12
|
-
try {
|
|
13
|
-
|
|
20
|
+
try {
|
|
21
|
+
return await runInContainer(body, socketPath);
|
|
22
|
+
} catch (error: any) {
|
|
14
23
|
if (error?.statusCode) throw error;
|
|
15
|
-
throw createError({
|
|
24
|
+
throw createError({
|
|
25
|
+
statusCode: 503,
|
|
26
|
+
message: "Studio runner is unavailable. Try again shortly.",
|
|
27
|
+
});
|
|
16
28
|
}
|
|
17
29
|
});
|