@databricks/appkit 0.79.0 → 0.81.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.
Files changed (36) hide show
  1. package/dist/appkit/package.js +1 -1
  2. package/dist/plugins/database/database.d.ts +2 -0
  3. package/dist/plugins/database/database.d.ts.map +1 -1
  4. package/dist/plugins/database/database.js +34 -0
  5. package/dist/plugins/database/database.js.map +1 -1
  6. package/dist/plugins/server/index.js +2 -2
  7. package/dist/plugins/server/index.js.map +1 -1
  8. package/dist/plugins/server/remote-tunnel/remote-tunnel-manager.js +3 -3
  9. package/dist/plugins/server/remote-tunnel/remote-tunnel-manager.js.map +1 -1
  10. package/dist/plugins/server/static-server.js +3 -3
  11. package/dist/plugins/server/static-server.js.map +1 -1
  12. package/dist/plugins/server/utils.js +88 -8
  13. package/dist/plugins/server/utils.js.map +1 -1
  14. package/dist/plugins/server/vite-dev-server.js +4 -4
  15. package/dist/plugins/server/vite-dev-server.js.map +1 -1
  16. package/dist/shared/src/schemas/manifest.d.ts +33 -33
  17. package/dist/type-generator/database/generate.js +3 -3
  18. package/dist/type-generator/database/generate.js.map +1 -1
  19. package/dist/type-generator/index.d.ts.map +1 -1
  20. package/dist/type-generator/index.js +2 -2
  21. package/dist/type-generator/index.js.map +1 -1
  22. package/dist/type-generator/migration.js +2 -2
  23. package/dist/type-generator/migration.js.map +1 -1
  24. package/dist/type-generator/query-registry.js +2 -2
  25. package/dist/type-generator/query-registry.js.map +1 -1
  26. package/dist/type-generator/serving/generator.d.ts.map +1 -1
  27. package/dist/type-generator/serving/generator.js +2 -2
  28. package/dist/type-generator/serving/generator.js.map +1 -1
  29. package/dist/type-generator/serving/server-file-extractor.js +3 -3
  30. package/dist/type-generator/serving/server-file-extractor.js.map +1 -1
  31. package/dist/type-generator/typegen-client.js +16 -0
  32. package/dist/type-generator/typegen-client.js.map +1 -0
  33. package/dist/type-generator/vite-plugin.js +2 -2
  34. package/dist/type-generator/vite-plugin.js.map +1 -1
  35. package/package.json +1 -1
  36. package/sbom.cdx.json +1 -1
@@ -1,7 +1,7 @@
1
1
  import crypto from "node:crypto";
2
2
  import pc from "picocolors";
3
3
  import path from "node:path";
4
- import fsSync from "node:fs";
4
+ import fs from "node:fs";
5
5
 
6
6
  //#region src/plugins/server/utils.ts
7
7
  function parseCookies(req) {
@@ -53,29 +53,109 @@ const METHOD_COLORS = {
53
53
  HEAD: pc.magenta,
54
54
  OPTIONS: pc.magenta
55
55
  };
56
+ /**
57
+ * Fold lines that share a method and differ in exactly one static segment:
58
+ * `/api/{a,b}/:id` instead of `/api/a/:id` and `/api/b/:id`. The largest fold
59
+ * is taken first, so each route lands on exactly one line.
60
+ */
61
+ function collapseRoutes(lines) {
62
+ const pending = new Map(lines.map((line) => [`${line.method} ${line.path}`, line]));
63
+ const collapsed = [];
64
+ while (pending.size > 0) {
65
+ const folds = /* @__PURE__ */ new Map();
66
+ let best;
67
+ for (const line of pending.values()) {
68
+ const segments = line.path.split("/");
69
+ for (let index = 0; index < segments.length; index++) {
70
+ const segment = segments[index];
71
+ if (segment === "" || /[:*?(){}[\],]/.test(segment)) continue;
72
+ const masked = segments.slice();
73
+ masked[index] = "\0";
74
+ const key = `${line.method} ${masked.join("/")}`;
75
+ let fold = folds.get(key);
76
+ if (!fold) {
77
+ fold = {
78
+ index,
79
+ members: []
80
+ };
81
+ folds.set(key, fold);
82
+ }
83
+ fold.members.push(line);
84
+ if (fold.members.length > (best?.members.length ?? 1)) best = fold;
85
+ }
86
+ }
87
+ if (!best) {
88
+ collapsed.push(...pending.values());
89
+ break;
90
+ }
91
+ const { index, members } = best;
92
+ const segments = members[0].path.split("/");
93
+ segments[index] = `{${members.map((m) => m.path.split("/")[index]).sort().join(",")}}`;
94
+ collapsed.push({
95
+ method: members[0].method,
96
+ path: segments.join("/")
97
+ });
98
+ for (const m of members) pending.delete(`${m.method} ${m.path}`);
99
+ }
100
+ return collapsed.sort((a, b) => a.method.localeCompare(b.method) || a.path.localeCompare(b.path));
101
+ }
56
102
  function printRoutes(routes) {
57
103
  if (routes.length === 0) return;
58
104
  const rows = routes.flatMap((r) => r.methods.map((m) => ({
59
105
  method: m,
60
106
  path: r.path
61
- }))).sort((a, b) => a.method.localeCompare(b.method) || a.path.localeCompare(b.path));
62
- const maxMethodLen = Math.max(...rows.map((r) => r.method.length));
107
+ })));
108
+ const lines = collapseRoutes(rows);
109
+ const maxMethodLen = Math.max(...lines.map((r) => r.method.length));
63
110
  const separator = pc.dim("─".repeat(50));
64
- const colorizeParams = (p) => p.replace(/(:[a-zA-Z_]\w*)/g, (match) => pc.cyan(match));
111
+ const width = process.stdout.columns || 80;
112
+ const pathColumn = 2 + maxMethodLen + 2;
113
+ const foldSegment = /^\{[^{}:,/]+(,[^{}:,/]+)+\}$/;
114
+ const legend = /* @__PURE__ */ new Map();
65
115
  console.log("");
66
116
  console.log(` ${pc.bold("Registered Routes")} ${pc.dim(`(${rows.length})`)}`);
67
117
  console.log(` ${separator}`);
68
- for (const { method, path } of rows) {
118
+ for (const { method, path } of lines) {
69
119
  const methodStr = (METHOD_COLORS[method] || pc.white)(pc.bold(method.padEnd(maxMethodLen)));
70
- console.log(` ${methodStr} ${colorizeParams(path)}`);
120
+ const fits = pathColumn + path.length <= width;
121
+ const painted = path.split("/").map((segment) => {
122
+ if (!foldSegment.test(segment)) return segment.replace(/(:[a-zA-Z_]\w*)/g, (m) => pc.cyan(m));
123
+ if (fits) return segment.replace(/[{},]/g, (c) => pc.dim(c));
124
+ let label = legend.get(segment);
125
+ if (!label) {
126
+ label = `{#${legend.size + 1}}`;
127
+ legend.set(segment, label);
128
+ }
129
+ return pc.magenta(label);
130
+ }).join("/");
131
+ console.log(` ${methodStr} ${painted}`);
132
+ }
133
+ if (legend.size > 0) console.log("");
134
+ const legendWidth = Math.min(width, 80);
135
+ for (const [segment, label] of legend) {
136
+ const indent = " ".repeat(label.length + 2);
137
+ const wrapped = [];
138
+ let current = "";
139
+ for (const name of segment.slice(1, -1).split(",")) {
140
+ const next = current ? `${current}, ${name}` : name;
141
+ if (current && 2 + indent.length + next.length + 1 > legendWidth) {
142
+ wrapped.push(`${current},`);
143
+ current = name;
144
+ } else current = next;
145
+ }
146
+ wrapped.push(current);
147
+ wrapped.forEach((text, i) => {
148
+ const head = i === 0 ? `${pc.magenta(label)} ` : indent;
149
+ console.log(` ${head}${text}`);
150
+ });
71
151
  }
72
152
  console.log(` ${separator}`);
73
153
  console.log("");
74
154
  }
75
155
  function getQueries(configFolder) {
76
156
  const queriesFolder = path.join(configFolder, "queries");
77
- if (!fsSync.existsSync(queriesFolder)) return {};
78
- return Object.fromEntries(fsSync.readdirSync(queriesFolder).filter((f) => path.extname(f) === ".sql").map((f) => [path.basename(f, ".sql"), path.basename(f, ".sql")]));
157
+ if (!fs.existsSync(queriesFolder)) return {};
158
+ return Object.fromEntries(fs.readdirSync(queriesFolder).filter((f) => path.extname(f) === ".sql").map((f) => [path.basename(f, ".sql"), path.basename(f, ".sql")]));
79
159
  }
80
160
  const APPKIT_CONFIG_SCRIPT_ID = "__appkit__";
81
161
  const EMPTY_RUNTIME_CONFIG_JSON = JSON.stringify({
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","names":["fs"],"sources":["../../../src/plugins/server/utils.ts"],"sourcesContent":["import crypto from \"node:crypto\";\nimport fs from \"node:fs\";\nimport type http from \"node:http\";\nimport path from \"node:path\";\n\nimport pc from \"picocolors\";\nimport type { PluginClientConfigs, PluginEndpoints } from \"shared\";\n\nexport function parseCookies(\n req: http.IncomingMessage,\n): Record<string, string> {\n const cookieHeader = req.headers.cookie;\n if (!cookieHeader) return {};\n\n // Fast path: if there's no semicolon, there's only one cookie\n const semicolonIndex = cookieHeader.indexOf(\";\");\n if (semicolonIndex === -1) {\n const eqIndex = cookieHeader.indexOf(\"=\");\n if (eqIndex === -1) return {};\n return {\n [cookieHeader.slice(0, eqIndex).trim()]: cookieHeader.slice(eqIndex + 1),\n };\n }\n\n // Multiple cookies: parse them all\n const cookies: Record<string, string> = {};\n const parts = cookieHeader.split(\";\");\n for (let i = 0; i < parts.length; i++) {\n const eqIndex = parts[i].indexOf(\"=\");\n if (eqIndex !== -1) {\n const key = parts[i].slice(0, eqIndex).trim();\n const value = parts[i].slice(eqIndex + 1);\n cookies[key] = value;\n }\n }\n return cookies;\n}\n\nexport function generateTunnelIdFromEmail(email?: string): string | undefined {\n if (!email) return undefined;\n\n const tunnelId = crypto\n .createHash(\"sha256\")\n .update(email)\n .digest(\"base64url\")\n .slice(0, 8);\n\n return tunnelId;\n}\n\nexport function getRoutes(stack: unknown[], basePath = \"\") {\n const routes: Array<{ path: string; methods: string[] }> = [];\n\n stack.forEach((layer: any) => {\n if (layer.route) {\n // normal route\n const path = basePath + layer.route.path;\n const methods = Object.keys(layer.route.methods).map((m) =>\n m.toUpperCase(),\n );\n routes.push({ path, methods });\n } else if (layer.name === \"router\" && layer.handle.stack) {\n // nested router\n const nestedBase =\n basePath +\n layer.regexp.source\n .replace(\"^\\\\\", \"\")\n .replace(\"\\\\/?(?=\\\\/|$)\", \"\")\n .replace(/\\\\\\//g, \"/\") // convert escaped slashes\n .replace(/\\$$/, \"\") || \"\";\n routes.push(...getRoutes(layer.handle.stack, nestedBase));\n }\n });\n\n return routes;\n}\n\nconst METHOD_COLORS: Record<string, (s: string) => string> = {\n GET: pc.green,\n POST: pc.blue,\n PUT: pc.yellow,\n PATCH: pc.yellow,\n DELETE: pc.red,\n HEAD: pc.magenta,\n OPTIONS: pc.magenta,\n};\n\nexport function printRoutes(\n routes: Array<{ path: string; methods: string[] }>,\n) {\n if (routes.length === 0) return;\n\n const rows = routes\n .flatMap((r) => r.methods.map((m) => ({ method: m, path: r.path })))\n .sort(\n (a, b) =>\n a.method.localeCompare(b.method) || a.path.localeCompare(b.path),\n );\n\n const maxMethodLen = Math.max(...rows.map((r) => r.method.length));\n const separator = pc.dim(\"─\".repeat(50));\n\n const colorizeParams = (p: string) =>\n p.replace(/(:[a-zA-Z_]\\w*)/g, (match) => pc.cyan(match));\n\n console.log(\"\");\n console.log(\n ` ${pc.bold(\"Registered Routes\")} ${pc.dim(`(${rows.length})`)}`,\n );\n console.log(` ${separator}`);\n\n for (const { method, path } of rows) {\n const colorize = METHOD_COLORS[method] || pc.white;\n const methodStr = colorize(pc.bold(method.padEnd(maxMethodLen)));\n console.log(` ${methodStr} ${colorizeParams(path)}`);\n }\n\n console.log(` ${separator}`);\n console.log(\"\");\n}\n\nexport function getQueries(configFolder: string) {\n const queriesFolder = path.join(configFolder, \"queries\");\n\n if (!fs.existsSync(queriesFolder)) {\n return {};\n }\n\n return Object.fromEntries(\n fs\n .readdirSync(queriesFolder)\n .filter((f) => path.extname(f) === \".sql\")\n .map((f) => [path.basename(f, \".sql\"), path.basename(f, \".sql\")]),\n );\n}\n\nexport type { PluginClientConfigs, PluginEndpoints };\n\ninterface RuntimeConfig {\n appName: string;\n queries: Record<string, string>;\n endpoints: PluginEndpoints;\n plugins: PluginClientConfigs;\n}\n\nconst APPKIT_CONFIG_SCRIPT_ID = \"__appkit__\";\nconst EMPTY_RUNTIME_CONFIG: RuntimeConfig = {\n appName: \"\",\n queries: {},\n endpoints: {},\n plugins: {},\n};\nconst EMPTY_RUNTIME_CONFIG_JSON = JSON.stringify(EMPTY_RUNTIME_CONFIG);\nconst JSON_SCRIPT_ESCAPE_MAP: Record<string, string> = {\n \"<\": \"\\\\u003c\",\n \">\": \"\\\\u003e\",\n \"&\": \"\\\\u0026\",\n \"\\u2028\": \"\\\\u2028\",\n \"\\u2029\": \"\\\\u2029\",\n};\n\nexport function getRuntimeConfig(\n endpoints: PluginEndpoints = {},\n pluginConfigs: PluginClientConfigs = {},\n): RuntimeConfig {\n const configFolder = path.join(process.cwd(), \"config\");\n\n return {\n appName: process.env.DATABRICKS_APP_NAME || \"\",\n queries: getQueries(configFolder),\n endpoints,\n plugins: pluginConfigs,\n };\n}\n\nexport function getConfigScript(\n endpoints: PluginEndpoints = {},\n pluginConfigs: PluginClientConfigs = {},\n): string {\n const config = getRuntimeConfig(endpoints, pluginConfigs);\n\n return `\n <script id=\"${APPKIT_CONFIG_SCRIPT_ID}\" type=\"application/json\">\n ${serializeRuntimeConfig(config)}\n </script>\n <script>\n window.__appkit__ = JSON.parse(\n document.getElementById(\"${APPKIT_CONFIG_SCRIPT_ID}\")?.textContent ||\n '${EMPTY_RUNTIME_CONFIG_JSON}',\n );\n </script>\n `;\n}\n\nfunction serializeRuntimeConfig(config: RuntimeConfig): string {\n return JSON.stringify(config).replace(\n /[<>&\\u2028\\u2029]/g,\n (char) => JSON_SCRIPT_ESCAPE_MAP[char] ?? char,\n );\n}\n"],"mappings":";;;;;;AAQA,SAAgB,aACd,KACwB;CACxB,MAAM,eAAe,IAAI,QAAQ;AACjC,KAAI,CAAC,aAAc,QAAO,EAAE;AAI5B,KADuB,aAAa,QAAQ,IAAI,KACzB,IAAI;EACzB,MAAM,UAAU,aAAa,QAAQ,IAAI;AACzC,MAAI,YAAY,GAAI,QAAO,EAAE;AAC7B,SAAO,GACJ,aAAa,MAAM,GAAG,QAAQ,CAAC,MAAM,GAAG,aAAa,MAAM,UAAU,EAAE,EACzE;;CAIH,MAAM,UAAkC,EAAE;CAC1C,MAAM,QAAQ,aAAa,MAAM,IAAI;AACrC,MAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;EACrC,MAAM,UAAU,MAAM,GAAG,QAAQ,IAAI;AACrC,MAAI,YAAY,IAAI;GAClB,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC,MAAM;AAE7C,WAAQ,OADM,MAAM,GAAG,MAAM,UAAU,EAAE;;;AAI7C,QAAO;;AAGT,SAAgB,0BAA0B,OAAoC;AAC5E,KAAI,CAAC,MAAO,QAAO;AAQnB,QANiB,OACd,WAAW,SAAS,CACpB,OAAO,MAAM,CACb,OAAO,YAAY,CACnB,MAAM,GAAG,EAAE;;AAKhB,SAAgB,UAAU,OAAkB,WAAW,IAAI;CACzD,MAAM,SAAqD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U,OAAO,CAAC,QAC5B,uBACC,SAAS,uBAAuB,SAAS,KAC3C"}
1
+ {"version":3,"file":"utils.js","names":[],"sources":["../../../src/plugins/server/utils.ts"],"sourcesContent":["import crypto from \"node:crypto\";\nimport fs from \"node:fs\";\nimport type http from \"node:http\";\nimport path from \"node:path\";\n\nimport pc from \"picocolors\";\nimport type { PluginClientConfigs, PluginEndpoints } from \"shared\";\n\nexport function parseCookies(\n req: http.IncomingMessage,\n): Record<string, string> {\n const cookieHeader = req.headers.cookie;\n if (!cookieHeader) return {};\n\n // Fast path: if there's no semicolon, there's only one cookie\n const semicolonIndex = cookieHeader.indexOf(\";\");\n if (semicolonIndex === -1) {\n const eqIndex = cookieHeader.indexOf(\"=\");\n if (eqIndex === -1) return {};\n return {\n [cookieHeader.slice(0, eqIndex).trim()]: cookieHeader.slice(eqIndex + 1),\n };\n }\n\n // Multiple cookies: parse them all\n const cookies: Record<string, string> = {};\n const parts = cookieHeader.split(\";\");\n for (let i = 0; i < parts.length; i++) {\n const eqIndex = parts[i].indexOf(\"=\");\n if (eqIndex !== -1) {\n const key = parts[i].slice(0, eqIndex).trim();\n const value = parts[i].slice(eqIndex + 1);\n cookies[key] = value;\n }\n }\n return cookies;\n}\n\nexport function generateTunnelIdFromEmail(email?: string): string | undefined {\n if (!email) return undefined;\n\n const tunnelId = crypto\n .createHash(\"sha256\")\n .update(email)\n .digest(\"base64url\")\n .slice(0, 8);\n\n return tunnelId;\n}\n\nexport function getRoutes(stack: unknown[], basePath = \"\") {\n const routes: Array<{ path: string; methods: string[] }> = [];\n\n stack.forEach((layer: any) => {\n if (layer.route) {\n // normal route\n const path = basePath + layer.route.path;\n const methods = Object.keys(layer.route.methods).map((m) =>\n m.toUpperCase(),\n );\n routes.push({ path, methods });\n } else if (layer.name === \"router\" && layer.handle.stack) {\n // nested router\n const nestedBase =\n basePath +\n layer.regexp.source\n .replace(\"^\\\\\", \"\")\n .replace(\"\\\\/?(?=\\\\/|$)\", \"\")\n .replace(/\\\\\\//g, \"/\") // convert escaped slashes\n .replace(/\\$$/, \"\") || \"\";\n routes.push(...getRoutes(layer.handle.stack, nestedBase));\n }\n });\n\n return routes;\n}\n\nconst METHOD_COLORS: Record<string, (s: string) => string> = {\n GET: pc.green,\n POST: pc.blue,\n PUT: pc.yellow,\n PATCH: pc.yellow,\n DELETE: pc.red,\n HEAD: pc.magenta,\n OPTIONS: pc.magenta,\n};\n\ntype RouteLine = { method: string; path: string };\n\n/**\n * Fold lines that share a method and differ in exactly one static segment:\n * `/api/{a,b}/:id` instead of `/api/a/:id` and `/api/b/:id`. The largest fold\n * is taken first, so each route lands on exactly one line.\n */\nexport function collapseRoutes(lines: RouteLine[]): RouteLine[] {\n const pending = new Map(\n lines.map((line) => [`${line.method} ${line.path}`, line]),\n );\n const collapsed: RouteLine[] = [];\n\n while (pending.size > 0) {\n const folds = new Map<string, { index: number; members: RouteLine[] }>();\n let best: { index: number; members: RouteLine[] } | undefined;\n for (const line of pending.values()) {\n const segments = line.path.split(\"/\");\n for (let index = 0; index < segments.length; index++) {\n const segment = segments[index];\n // Only fixed path parts fold; parameters and patterns keep their own line.\n if (segment === \"\" || /[:*?(){}[\\],]/.test(segment)) continue;\n const masked = segments.slice();\n masked[index] = \"\\0\";\n const key = `${line.method} ${masked.join(\"/\")}`;\n let fold = folds.get(key);\n if (!fold) {\n fold = { index, members: [] };\n folds.set(key, fold);\n }\n fold.members.push(line);\n if (fold.members.length > (best?.members.length ?? 1)) best = fold;\n }\n }\n if (!best) {\n collapsed.push(...pending.values());\n break;\n }\n\n const { index, members } = best;\n const segments = members[0].path.split(\"/\");\n const names = members.map((m) => m.path.split(\"/\")[index]).sort();\n segments[index] = `{${names.join(\",\")}}`;\n collapsed.push({ method: members[0].method, path: segments.join(\"/\") });\n for (const m of members) pending.delete(`${m.method} ${m.path}`);\n }\n\n return collapsed.sort(\n (a, b) => a.method.localeCompare(b.method) || a.path.localeCompare(b.path),\n );\n}\n\nexport function printRoutes(\n routes: Array<{ path: string; methods: string[] }>,\n) {\n if (routes.length === 0) return;\n\n const rows = routes.flatMap((r) =>\n r.methods.map((m) => ({ method: m, path: r.path })),\n );\n const lines = collapseRoutes(rows);\n\n const maxMethodLen = Math.max(...lines.map((r) => r.method.length));\n const separator = pc.dim(\"─\".repeat(50));\n const width = process.stdout.columns || 80;\n const pathColumn = 2 + maxMethodLen + 2;\n // A `{a,b}` segment folded by `collapseRoutes`.\n const foldSegment = /^\\{[^{}:,/]+(,[^{}:,/]+)+\\}$/;\n // A fold too wide for its line prints once, in the legend, under a label.\n const legend = new Map<string, string>();\n\n console.log(\"\");\n console.log(\n ` ${pc.bold(\"Registered Routes\")} ${pc.dim(`(${rows.length})`)}`,\n );\n console.log(` ${separator}`);\n\n for (const { method, path } of lines) {\n const colorize = METHOD_COLORS[method] || pc.white;\n const methodStr = colorize(pc.bold(method.padEnd(maxMethodLen)));\n const fits = pathColumn + path.length <= width;\n const painted = path\n .split(\"/\")\n .map((segment) => {\n if (!foldSegment.test(segment)) {\n return segment.replace(/(:[a-zA-Z_]\\w*)/g, (m) => pc.cyan(m));\n }\n if (fits) return segment.replace(/[{},]/g, (c) => pc.dim(c));\n let label = legend.get(segment);\n if (!label) {\n label = `{#${legend.size + 1}}`;\n legend.set(segment, label);\n }\n return pc.magenta(label);\n })\n .join(\"/\");\n console.log(` ${methodStr} ${painted}`);\n }\n\n if (legend.size > 0) console.log(\"\");\n // Long name lists read better as a narrow block than as one screen-wide line.\n const legendWidth = Math.min(width, 80);\n for (const [segment, label] of legend) {\n const indent = \" \".repeat(label.length + 2);\n const wrapped: string[] = [];\n let current = \"\";\n for (const name of segment.slice(1, -1).split(\",\")) {\n const next = current ? `${current}, ${name}` : name;\n // +1 leaves room for the trailing comma of a wrapped line.\n if (current && 2 + indent.length + next.length + 1 > legendWidth) {\n wrapped.push(`${current},`);\n current = name;\n } else {\n current = next;\n }\n }\n wrapped.push(current);\n wrapped.forEach((text, i) => {\n const head = i === 0 ? `${pc.magenta(label)} ` : indent;\n console.log(` ${head}${text}`);\n });\n }\n\n console.log(` ${separator}`);\n console.log(\"\");\n}\n\nexport function getQueries(configFolder: string) {\n const queriesFolder = path.join(configFolder, \"queries\");\n\n if (!fs.existsSync(queriesFolder)) {\n return {};\n }\n\n return Object.fromEntries(\n fs\n .readdirSync(queriesFolder)\n .filter((f) => path.extname(f) === \".sql\")\n .map((f) => [path.basename(f, \".sql\"), path.basename(f, \".sql\")]),\n );\n}\n\nexport type { PluginClientConfigs, PluginEndpoints };\n\ninterface RuntimeConfig {\n appName: string;\n queries: Record<string, string>;\n endpoints: PluginEndpoints;\n plugins: PluginClientConfigs;\n}\n\nconst APPKIT_CONFIG_SCRIPT_ID = \"__appkit__\";\nconst EMPTY_RUNTIME_CONFIG: RuntimeConfig = {\n appName: \"\",\n queries: {},\n endpoints: {},\n plugins: {},\n};\nconst EMPTY_RUNTIME_CONFIG_JSON = JSON.stringify(EMPTY_RUNTIME_CONFIG);\nconst JSON_SCRIPT_ESCAPE_MAP: Record<string, string> = {\n \"<\": \"\\\\u003c\",\n \">\": \"\\\\u003e\",\n \"&\": \"\\\\u0026\",\n \"\\u2028\": \"\\\\u2028\",\n \"\\u2029\": \"\\\\u2029\",\n};\n\nexport function getRuntimeConfig(\n endpoints: PluginEndpoints = {},\n pluginConfigs: PluginClientConfigs = {},\n): RuntimeConfig {\n const configFolder = path.join(process.cwd(), \"config\");\n\n return {\n appName: process.env.DATABRICKS_APP_NAME || \"\",\n queries: getQueries(configFolder),\n endpoints,\n plugins: pluginConfigs,\n };\n}\n\nexport function getConfigScript(\n endpoints: PluginEndpoints = {},\n pluginConfigs: PluginClientConfigs = {},\n): string {\n const config = getRuntimeConfig(endpoints, pluginConfigs);\n\n return `\n <script id=\"${APPKIT_CONFIG_SCRIPT_ID}\" type=\"application/json\">\n ${serializeRuntimeConfig(config)}\n </script>\n <script>\n window.__appkit__ = JSON.parse(\n document.getElementById(\"${APPKIT_CONFIG_SCRIPT_ID}\")?.textContent ||\n '${EMPTY_RUNTIME_CONFIG_JSON}',\n );\n </script>\n `;\n}\n\nfunction serializeRuntimeConfig(config: RuntimeConfig): string {\n return JSON.stringify(config).replace(\n /[<>&\\u2028\\u2029]/g,\n (char) => JSON_SCRIPT_ESCAPE_MAP[char] ?? char,\n );\n}\n"],"mappings":";;;;;;AAQA,SAAgB,aACd,KACwB;CACxB,MAAM,eAAe,IAAI,QAAQ;AACjC,KAAI,CAAC,aAAc,QAAO,EAAE;AAI5B,KADuB,aAAa,QAAQ,IAAI,KACzB,IAAI;EACzB,MAAM,UAAU,aAAa,QAAQ,IAAI;AACzC,MAAI,YAAY,GAAI,QAAO,EAAE;AAC7B,SAAO,GACJ,aAAa,MAAM,GAAG,QAAQ,CAAC,MAAM,GAAG,aAAa,MAAM,UAAU,EAAE,EACzE;;CAIH,MAAM,UAAkC,EAAE;CAC1C,MAAM,QAAQ,aAAa,MAAM,IAAI;AACrC,MAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;EACrC,MAAM,UAAU,MAAM,GAAG,QAAQ,IAAI;AACrC,MAAI,YAAY,IAAI;GAClB,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC,MAAM;AAE7C,WAAQ,OADM,MAAM,GAAG,MAAM,UAAU,EAAE;;;AAI7C,QAAO;;AAGT,SAAgB,0BAA0B,OAAoC;AAC5E,KAAI,CAAC,MAAO,QAAO;AAQnB,QANiB,OACd,WAAW,SAAS,CACpB,OAAO,MAAM,CACb,OAAO,YAAY,CACnB,MAAM,GAAG,EAAE;;AAKhB,SAAgB,UAAU,OAAkB,WAAW,IAAI;CACzD,MAAM,SAAqD,EAAE;AAE7D,OAAM,SAAS,UAAe;AAC5B,MAAI,MAAM,OAAO;GAEf,MAAM,OAAO,WAAW,MAAM,MAAM;GACpC,MAAM,UAAU,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC,KAAK,MACpD,EAAE,aAAa,CAChB;AACD,UAAO,KAAK;IAAE;IA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,KAAK,YAAY;AAC7B,SAAQ,IAAI,GAAG;;AAGjB,SAAgB,WAAW,cAAsB;CAC/C,MAAM,gBAAgB,KAAK,KAAK,cAAc,UAAU;AAExD,KAAI,CAAC,GAAG,WAAW,cAAc,CAC/B,QAAO,EAAE;AAGX,QAAO,OAAO,YACZ,GACG,YAAY,cAAc,CAC1B,QAAQ,MAAM,KAAK,QAAQ,EAAE,KAAK,OAAO,CACzC,KAAK,MAAM,CAAC,KAAK,SAAS,GAAG,OAAO,EAAE,KAAK,SAAS,GAAG,OAAO,CAAC,CAAC,CACpE;;AAYH,MAAM,0BAA0B;AAOhC,MAAM,4BAA4B,KAAK,UANK;CAC1C,SAAS;CACT,SAAS,EAAE;CACX,WAAW,EAAE;CACb,SAAS,EAAE;CACZ,CACqE;AACtE,MAAM,yBAAiD;CACrD,KAAK;CACL,KAAK;CACL,KAAK;CACL,UAAU;CACV,UAAU;CACX;AAED,SAAgB,iBACd,YAA6B,EAAE,EAC/B,gBAAqC,EAAE,EACxB;CACf,MAAM,eAAe,KAAK,KAAK,QAAQ,KAAK,EAAE,SAAS;AAEvD,QAAO;EACL,SAAS,QAAQ,IAAI,uBAAuB;EAC5C,SAAS,WAAW,aAAa;EACjC;EACA,SAAS;EACV;;AAGH,SAAgB,gBACd,YAA6B,EAAE,EAC/B,gBAAqC,EAAE,EAC/B;AAGR,QAAO;kBACS,wBAAwB;QAClC,uBAJS,iBAAiB,WAAW,cAAc,CAIrB,CAAC;;;;mCAIJ,wBAAwB;aAC9C,0BAA0B;;;;;AAMvC,SAAS,uBAAuB,QAA+B;AAC7D,QAAO,KAAK,UAAU,OAAO,CAAC,QAC5B,uBACC,SAAS,uBAAuB,SAAS,KAC3C"}
@@ -7,7 +7,7 @@ import { appKitServingTypesPlugin } from "../../type-generator/serving/vite-plug
7
7
  import { appKitTypesPlugin } from "../../type-generator/vite-plugin.js";
8
8
  import { reactSourceLocPlugin } from "./react-source-loc-vite-plugin.js";
9
9
  import path from "node:path";
10
- import fsSync from "node:fs";
10
+ import fs from "node:fs";
11
11
 
12
12
  //#region src/plugins/server/vite-dev-server.ts
13
13
  const logger = createLogger("server:vite");
@@ -72,7 +72,7 @@ var ViteDevServer = class extends BaseServer {
72
72
  this.validateVite(vite);
73
73
  try {
74
74
  const indexPath = path.resolve(clientRoot, "index.html");
75
- let html = fsSync.readFileSync(indexPath, "utf-8");
75
+ let html = fs.readFileSync(indexPath, "utf-8");
76
76
  html = html.replace("<body>", `<body>${this.getConfigScript()}`);
77
77
  html = await vite.transformIndexHtml(req.originalUrl, html);
78
78
  res.status(200).set({ "Content-Type": "text/html" }).end(html);
@@ -98,8 +98,8 @@ var ViteDevServer = class extends BaseServer {
98
98
  ];
99
99
  for (const dir of candidates) {
100
100
  const fullPath = path.resolve(cwd, dir);
101
- const hasViteConfig = fsSync.existsSync(path.join(fullPath, "vite.config.ts")) || fsSync.existsSync(path.join(fullPath, "vite.config.js"));
102
- const hasIndexHtml = fsSync.existsSync(path.join(fullPath, "index.html"));
101
+ const hasViteConfig = fs.existsSync(path.join(fullPath, "vite.config.ts")) || fs.existsSync(path.join(fullPath, "vite.config.js"));
102
+ const hasIndexHtml = fs.existsSync(path.join(fullPath, "index.html"));
103
103
  if (hasViteConfig && hasIndexHtml) {
104
104
  logger.debug("Vite dev server: using client root %s", fullPath);
105
105
  return fullPath;
@@ -1 +1 @@
1
- {"version":3,"file":"vite-dev-server.js","names":["fs"],"sources":["../../../src/plugins/server/vite-dev-server.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport type express from \"express\";\nimport type { ViteDevServer as ViteDevServerType } from \"vite\";\n\nimport { ServerError } from \"../../errors\";\nimport { createLogger } from \"../../logging/logger\";\nimport { appKitServingTypesPlugin } from \"../../type-generator/serving/vite-plugin\";\nimport { appKitTypesPlugin } from \"../../type-generator/vite-plugin\";\nimport { mergeConfigDedup } from \"../../utils\";\nimport { BaseServer } from \"./base-server\";\nimport { reactSourceLocPlugin } from \"./react-source-loc-vite-plugin\";\nimport type { PluginClientConfigs, PluginEndpoints } from \"./utils\";\n\nconst logger = createLogger(\"server:vite\");\n\n/**\n * Vite dev server for the AppKit.\n *\n * This class is responsible for serving the Vite dev server for the development server.\n * It also handles the index.html file for the development server.\n *\n * @example\n * ```ts\n * const viteDevServer = new ViteDevServer(app, endpoints);\n * await viteDevServer.setup();\n * ```\n */\nexport class ViteDevServer extends BaseServer {\n private vite: ViteDevServerType | null;\n\n constructor(\n app: express.Application,\n endpoints: PluginEndpoints = {},\n pluginConfigs: PluginClientConfigs = {},\n ) {\n super(app, endpoints, pluginConfigs);\n this.vite = null;\n }\n\n /**\n * Setup the Vite dev server.\n *\n * This method sets up the Vite dev server and the index.html file for the development server.\n *\n * @returns\n */\n async setup() {\n const {\n createServer: createViteServer,\n loadConfigFromFile,\n mergeConfig,\n } = await import(\"vite\");\n const react = await import(\"@vitejs/plugin-react\");\n\n const clientRoot = this.findClientRoot();\n const projectRoot = process.cwd();\n\n const loadedConfig = await loadConfigFromFile(\n {\n mode: \"development\",\n command: \"serve\",\n },\n undefined,\n clientRoot,\n );\n\n const userConfig = loadedConfig?.config ?? {};\n const viteClientPort = process.env.VITE_CLIENT_PORT;\n const serverHmr = viteClientPort\n ? { hmr: { clientPort: viteClientPort } }\n : {};\n\n const coreConfig = {\n configFile: false,\n root: clientRoot,\n server: {\n middlewareMode: true,\n ...serverHmr,\n watch: {\n useFsEvents: true,\n ignored: [\"**/node_modules/**\", \"!**/node_modules/@databricks/**\"],\n },\n },\n plugins: [\n react.default(),\n reactSourceLocPlugin({ projectRoot }),\n appKitTypesPlugin(),\n appKitServingTypesPlugin(),\n ],\n appType: \"custom\",\n };\n\n const mergedConfigs = mergeConfigDedup(userConfig, coreConfig, mergeConfig);\n this.vite = await createViteServer(mergedConfigs);\n\n this.app.use(this.vite.middlewares);\n\n this.app.use(\"*\", async (req, res, next) => {\n if (\n req.originalUrl.startsWith(\"/api\") ||\n req.originalUrl.startsWith(\"/query\")\n ) {\n return next();\n }\n const vite = this.vite;\n this.validateVite(vite);\n\n try {\n const indexPath = path.resolve(clientRoot, \"index.html\");\n let html = fs.readFileSync(indexPath, \"utf-8\");\n html = html.replace(\"<body>\", `<body>${this.getConfigScript()}`);\n html = await vite.transformIndexHtml(req.originalUrl, html);\n res.status(200).set({ \"Content-Type\": \"text/html\" }).end(html);\n } catch (e) {\n vite.ssrFixStacktrace(e as Error);\n next(e);\n }\n });\n }\n\n /** Close the Vite dev server. */\n async close() {\n await this.vite?.close();\n }\n\n /** Find the client root. */\n private findClientRoot(): string {\n const cwd = process.cwd();\n const candidates = [\"client\", \"src\", \"app\", \"frontend\", \".\"];\n\n for (const dir of candidates) {\n const fullPath = path.resolve(cwd, dir);\n const hasViteConfig =\n fs.existsSync(path.join(fullPath, \"vite.config.ts\")) ||\n fs.existsSync(path.join(fullPath, \"vite.config.js\"));\n const hasIndexHtml = fs.existsSync(path.join(fullPath, \"index.html\"));\n\n if (hasViteConfig && hasIndexHtml) {\n logger.debug(\"Vite dev server: using client root %s\", fullPath);\n return fullPath;\n }\n }\n\n throw ServerError.clientDirectoryNotFound(candidates);\n }\n\n // type assertion to ensure vite is not null\n private validateVite(\n vite: ViteDevServerType | null,\n ): asserts vite is ViteDevServerType {\n if (!vite) {\n throw ServerError.viteNotInitialized();\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;AAeA,MAAM,SAAS,aAAa,cAAc;;;;;;;;;;;;;AAc1C,IAAa,gBAAb,cAAmC,WAAW;CAC5C,AAAQ;CAER,YACE,KACA,YAA6B,EAAE,EAC/B,gBAAqC,EAAE,EACvC;AACA,QAAM,KAAK,WAAW,cAAc;AACpC,OAAK,OAAO;;;;;;;;;CAUd,MAAM,QAAQ;EACZ,MAAM,EACJ,cAAc,kBACd,oBACA,gBACE,MAAM,OAAO;EACjB,MAAM,QAAQ,MAAM,OAAO;EAE3B,MAAM,aAAa,KAAK,gBAAgB;EACxC,MAAM,cAAc,QAAQ,KAAK;EAWjC,MA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E5D,OAAK,MAAM,OAAO,YAAY;GAC5B,MAAM,WAAW,KAAK,QAAQ,KAAK,IAAI;GACvC,MAAM,gBACJA,OAAG,WAAW,KAAK,KAAK,UAAU,iBAAiB,CAAC,IACpDA,OAAG,WAAW,KAAK,KAAK,UAAU,iBAAiB,CAAC;GACtD,MAAM,eAAeA,OAAG,WAAW,KAAK,KAAK,UAAU,aAAa,CAAC;AAErE,OAAI,iBAAiB,cAAc;AACjC,WAAO,MAAM,yCAAyC,SAAS;AAC/D,WAAO;;;AAIX,QAAM,YAAY,wBAAwB,WAAW;;CAIvD,AAAQ,aACN,MACmC;AACnC,MAAI,CAAC,KACH,OAAM,YAAY,oBAAoB"}
1
+ {"version":3,"file":"vite-dev-server.js","names":[],"sources":["../../../src/plugins/server/vite-dev-server.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport type express from \"express\";\nimport type { ViteDevServer as ViteDevServerType } from \"vite\";\n\nimport { ServerError } from \"../../errors\";\nimport { createLogger } from \"../../logging/logger\";\nimport { appKitServingTypesPlugin } from \"../../type-generator/serving/vite-plugin\";\nimport { appKitTypesPlugin } from \"../../type-generator/vite-plugin\";\nimport { mergeConfigDedup } from \"../../utils\";\nimport { BaseServer } from \"./base-server\";\nimport { reactSourceLocPlugin } from \"./react-source-loc-vite-plugin\";\nimport type { PluginClientConfigs, PluginEndpoints } from \"./utils\";\n\nconst logger = createLogger(\"server:vite\");\n\n/**\n * Vite dev server for the AppKit.\n *\n * This class is responsible for serving the Vite dev server for the development server.\n * It also handles the index.html file for the development server.\n *\n * @example\n * ```ts\n * const viteDevServer = new ViteDevServer(app, endpoints);\n * await viteDevServer.setup();\n * ```\n */\nexport class ViteDevServer extends BaseServer {\n private vite: ViteDevServerType | null;\n\n constructor(\n app: express.Application,\n endpoints: PluginEndpoints = {},\n pluginConfigs: PluginClientConfigs = {},\n ) {\n super(app, endpoints, pluginConfigs);\n this.vite = null;\n }\n\n /**\n * Setup the Vite dev server.\n *\n * This method sets up the Vite dev server and the index.html file for the development server.\n *\n * @returns\n */\n async setup() {\n const {\n createServer: createViteServer,\n loadConfigFromFile,\n mergeConfig,\n } = await import(\"vite\");\n const react = await import(\"@vitejs/plugin-react\");\n\n const clientRoot = this.findClientRoot();\n const projectRoot = process.cwd();\n\n const loadedConfig = await loadConfigFromFile(\n {\n mode: \"development\",\n command: \"serve\",\n },\n undefined,\n clientRoot,\n );\n\n const userConfig = loadedConfig?.config ?? {};\n const viteClientPort = process.env.VITE_CLIENT_PORT;\n const serverHmr = viteClientPort\n ? { hmr: { clientPort: viteClientPort } }\n : {};\n\n const coreConfig = {\n configFile: false,\n root: clientRoot,\n server: {\n middlewareMode: true,\n ...serverHmr,\n watch: {\n useFsEvents: true,\n ignored: [\"**/node_modules/**\", \"!**/node_modules/@databricks/**\"],\n },\n },\n plugins: [\n react.default(),\n reactSourceLocPlugin({ projectRoot }),\n appKitTypesPlugin(),\n appKitServingTypesPlugin(),\n ],\n appType: \"custom\",\n };\n\n const mergedConfigs = mergeConfigDedup(userConfig, coreConfig, mergeConfig);\n this.vite = await createViteServer(mergedConfigs);\n\n this.app.use(this.vite.middlewares);\n\n this.app.use(\"*\", async (req, res, next) => {\n if (\n req.originalUrl.startsWith(\"/api\") ||\n req.originalUrl.startsWith(\"/query\")\n ) {\n return next();\n }\n const vite = this.vite;\n this.validateVite(vite);\n\n try {\n const indexPath = path.resolve(clientRoot, \"index.html\");\n let html = fs.readFileSync(indexPath, \"utf-8\");\n html = html.replace(\"<body>\", `<body>${this.getConfigScript()}`);\n html = await vite.transformIndexHtml(req.originalUrl, html);\n res.status(200).set({ \"Content-Type\": \"text/html\" }).end(html);\n } catch (e) {\n vite.ssrFixStacktrace(e as Error);\n next(e);\n }\n });\n }\n\n /** Close the Vite dev server. */\n async close() {\n await this.vite?.close();\n }\n\n /** Find the client root. */\n private findClientRoot(): string {\n const cwd = process.cwd();\n const candidates = [\"client\", \"src\", \"app\", \"frontend\", \".\"];\n\n for (const dir of candidates) {\n const fullPath = path.resolve(cwd, dir);\n const hasViteConfig =\n fs.existsSync(path.join(fullPath, \"vite.config.ts\")) ||\n fs.existsSync(path.join(fullPath, \"vite.config.js\"));\n const hasIndexHtml = fs.existsSync(path.join(fullPath, \"index.html\"));\n\n if (hasViteConfig && hasIndexHtml) {\n logger.debug(\"Vite dev server: using client root %s\", fullPath);\n return fullPath;\n }\n }\n\n throw ServerError.clientDirectoryNotFound(candidates);\n }\n\n // type assertion to ensure vite is not null\n private validateVite(\n vite: ViteDevServerType | null,\n ): asserts vite is ViteDevServerType {\n if (!vite) {\n throw ServerError.viteNotInitialized();\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;AAeA,MAAM,SAAS,aAAa,cAAc;;;;;;;;;;;;;AAc1C,IAAa,gBAAb,cAAmC,WAAW;CAC5C,AAAQ;CAER,YACE,KACA,YAA6B,EAAE,EAC/B,gBAAqC,EAAE,EACvC;AACA,QAAM,KAAK,WAAW,cAAc;AACpC,OAAK,OAAO;;;;;;;;;CAUd,MAAM,QAAQ;EACZ,MAAM,EACJ,cAAc,kBACd,oBACA,gBACE,MAAM,OAAO;EACjB,MAAM,QAAQ,MAAM,OAAO;EAE3B,MAAM,aAAa,KAAK,gBAAgB;EACxC,MAAM,cAAc,QAAQ,KAAK;EAWjC,MAAM,cATe,MAAM,mBACzB;GACE,MAAM;GACN,SAAS;GACV,EACD,QACA,WACD,GAEgC,UAAU,EAAE;EAC7C,MAAM,iBAAiB,QAAQ,IAAI;AA0BnC,OAAK,OAAO,MAAM,iBADI,iBAAiB,YApBpB;GACjB,YAAY;GACZ,MAAM;GACN,QAAQ;IACN,gBAAgB;IAChB,GATc,iBACd,EAAE,KAAK,EAAE,YAAY,gBAAgB,EAAE,GACvC,EAAE;IAQF,OAAO;KACL,aAAa;KACb,SAAS,CAAC,sBAAsB,kCAAkC;KACnE;IACF;GACD,SAAS;IACP,MAAM,SAAS;IACf,qBAAqB,EAAE,aAAa,CAAC;IACrC,mBAAmB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B"}
@@ -13,8 +13,8 @@ declare const resourceFieldEntrySchema: z.ZodObject<{
13
13
  type: z.ZodLiteral<"kind">;
14
14
  resourceKind: z.ZodEnum<{
15
15
  volume: "volume";
16
- genie_space: "genie_space";
17
16
  warehouse: "warehouse";
17
+ genie_space: "genie_space";
18
18
  postgres_project: "postgres_project";
19
19
  postgres_branch: "postgres_branch";
20
20
  postgres_database: "postgres_database";
@@ -59,8 +59,8 @@ declare const pluginManifestSchema: z.ZodObject<{
59
59
  type: z.ZodLiteral<"kind">;
60
60
  resourceKind: z.ZodEnum<{
61
61
  volume: "volume";
62
- genie_space: "genie_space";
63
62
  warehouse: "warehouse";
63
+ genie_space: "genie_space";
64
64
  postgres_project: "postgres_project";
65
65
  postgres_branch: "postgres_branch";
66
66
  postgres_database: "postgres_database";
@@ -100,8 +100,8 @@ declare const pluginManifestSchema: z.ZodObject<{
100
100
  type: z.ZodLiteral<"kind">;
101
101
  resourceKind: z.ZodEnum<{
102
102
  volume: "volume";
103
- genie_space: "genie_space";
104
103
  warehouse: "warehouse";
104
+ genie_space: "genie_space";
105
105
  postgres_project: "postgres_project";
106
106
  postgres_branch: "postgres_branch";
107
107
  postgres_database: "postgres_database";
@@ -140,8 +140,8 @@ declare const pluginManifestSchema: z.ZodObject<{
140
140
  type: z.ZodLiteral<"kind">;
141
141
  resourceKind: z.ZodEnum<{
142
142
  volume: "volume";
143
- genie_space: "genie_space";
144
143
  warehouse: "warehouse";
144
+ genie_space: "genie_space";
145
145
  postgres_project: "postgres_project";
146
146
  postgres_branch: "postgres_branch";
147
147
  postgres_database: "postgres_database";
@@ -162,9 +162,9 @@ declare const pluginManifestSchema: z.ZodObject<{
162
162
  type: z.ZodLiteral<"sql_warehouse">;
163
163
  }, z.core.$strict>, z.ZodObject<{
164
164
  permission: z.ZodEnum<{
165
+ CAN_QUERY: "CAN_QUERY";
165
166
  CAN_VIEW: "CAN_VIEW";
166
167
  CAN_MANAGE: "CAN_MANAGE";
167
- CAN_QUERY: "CAN_QUERY";
168
168
  }>;
169
169
  alias: z.ZodString;
170
170
  resourceKey: z.ZodString;
@@ -181,8 +181,8 @@ declare const pluginManifestSchema: z.ZodObject<{
181
181
  type: z.ZodLiteral<"kind">;
182
182
  resourceKind: z.ZodEnum<{
183
183
  volume: "volume";
184
- genie_space: "genie_space";
185
184
  warehouse: "warehouse";
185
+ genie_space: "genie_space";
186
186
  postgres_project: "postgres_project";
187
187
  postgres_branch: "postgres_branch";
188
188
  postgres_database: "postgres_database";
@@ -221,8 +221,8 @@ declare const pluginManifestSchema: z.ZodObject<{
221
221
  type: z.ZodLiteral<"kind">;
222
222
  resourceKind: z.ZodEnum<{
223
223
  volume: "volume";
224
- genie_space: "genie_space";
225
224
  warehouse: "warehouse";
225
+ genie_space: "genie_space";
226
226
  postgres_project: "postgres_project";
227
227
  postgres_branch: "postgres_branch";
228
228
  postgres_database: "postgres_database";
@@ -260,8 +260,8 @@ declare const pluginManifestSchema: z.ZodObject<{
260
260
  type: z.ZodLiteral<"kind">;
261
261
  resourceKind: z.ZodEnum<{
262
262
  volume: "volume";
263
- genie_space: "genie_space";
264
263
  warehouse: "warehouse";
264
+ genie_space: "genie_space";
265
265
  postgres_project: "postgres_project";
266
266
  postgres_branch: "postgres_branch";
267
267
  postgres_database: "postgres_database";
@@ -299,8 +299,8 @@ declare const pluginManifestSchema: z.ZodObject<{
299
299
  type: z.ZodLiteral<"kind">;
300
300
  resourceKind: z.ZodEnum<{
301
301
  volume: "volume";
302
- genie_space: "genie_space";
303
302
  warehouse: "warehouse";
303
+ genie_space: "genie_space";
304
304
  postgres_project: "postgres_project";
305
305
  postgres_branch: "postgres_branch";
306
306
  postgres_database: "postgres_database";
@@ -338,8 +338,8 @@ declare const pluginManifestSchema: z.ZodObject<{
338
338
  type: z.ZodLiteral<"kind">;
339
339
  resourceKind: z.ZodEnum<{
340
340
  volume: "volume";
341
- genie_space: "genie_space";
342
341
  warehouse: "warehouse";
342
+ genie_space: "genie_space";
343
343
  postgres_project: "postgres_project";
344
344
  postgres_branch: "postgres_branch";
345
345
  postgres_database: "postgres_database";
@@ -377,8 +377,8 @@ declare const pluginManifestSchema: z.ZodObject<{
377
377
  type: z.ZodLiteral<"kind">;
378
378
  resourceKind: z.ZodEnum<{
379
379
  volume: "volume";
380
- genie_space: "genie_space";
381
380
  warehouse: "warehouse";
381
+ genie_space: "genie_space";
382
382
  postgres_project: "postgres_project";
383
383
  postgres_branch: "postgres_branch";
384
384
  postgres_database: "postgres_database";
@@ -416,8 +416,8 @@ declare const pluginManifestSchema: z.ZodObject<{
416
416
  type: z.ZodLiteral<"kind">;
417
417
  resourceKind: z.ZodEnum<{
418
418
  volume: "volume";
419
- genie_space: "genie_space";
420
419
  warehouse: "warehouse";
420
+ genie_space: "genie_space";
421
421
  postgres_project: "postgres_project";
422
422
  postgres_branch: "postgres_branch";
423
423
  postgres_database: "postgres_database";
@@ -438,10 +438,10 @@ declare const pluginManifestSchema: z.ZodObject<{
438
438
  type: z.ZodLiteral<"postgres">;
439
439
  }, z.core.$strict>, z.ZodObject<{
440
440
  permission: z.ZodEnum<{
441
+ CAN_EDIT: "CAN_EDIT";
441
442
  CAN_VIEW: "CAN_VIEW";
442
443
  CAN_MANAGE: "CAN_MANAGE";
443
444
  CAN_RUN: "CAN_RUN";
444
- CAN_EDIT: "CAN_EDIT";
445
445
  }>;
446
446
  alias: z.ZodString;
447
447
  resourceKey: z.ZodString;
@@ -458,8 +458,8 @@ declare const pluginManifestSchema: z.ZodObject<{
458
458
  type: z.ZodLiteral<"kind">;
459
459
  resourceKind: z.ZodEnum<{
460
460
  volume: "volume";
461
- genie_space: "genie_space";
462
461
  warehouse: "warehouse";
462
+ genie_space: "genie_space";
463
463
  postgres_project: "postgres_project";
464
464
  postgres_branch: "postgres_branch";
465
465
  postgres_database: "postgres_database";
@@ -480,8 +480,8 @@ declare const pluginManifestSchema: z.ZodObject<{
480
480
  type: z.ZodLiteral<"genie_space">;
481
481
  }, z.core.$strict>, z.ZodObject<{
482
482
  permission: z.ZodEnum<{
483
- CAN_MANAGE: "CAN_MANAGE";
484
483
  CAN_EDIT: "CAN_EDIT";
484
+ CAN_MANAGE: "CAN_MANAGE";
485
485
  CAN_READ: "CAN_READ";
486
486
  }>;
487
487
  alias: z.ZodString;
@@ -499,8 +499,8 @@ declare const pluginManifestSchema: z.ZodObject<{
499
499
  type: z.ZodLiteral<"kind">;
500
500
  resourceKind: z.ZodEnum<{
501
501
  volume: "volume";
502
- genie_space: "genie_space";
503
502
  warehouse: "warehouse";
503
+ genie_space: "genie_space";
504
504
  postgres_project: "postgres_project";
505
505
  postgres_branch: "postgres_branch";
506
506
  postgres_database: "postgres_database";
@@ -538,8 +538,8 @@ declare const pluginManifestSchema: z.ZodObject<{
538
538
  type: z.ZodLiteral<"kind">;
539
539
  resourceKind: z.ZodEnum<{
540
540
  volume: "volume";
541
- genie_space: "genie_space";
542
541
  warehouse: "warehouse";
542
+ genie_space: "genie_space";
543
543
  postgres_project: "postgres_project";
544
544
  postgres_branch: "postgres_branch";
545
545
  postgres_database: "postgres_database";
@@ -580,8 +580,8 @@ declare const pluginManifestSchema: z.ZodObject<{
580
580
  type: z.ZodLiteral<"kind">;
581
581
  resourceKind: z.ZodEnum<{
582
582
  volume: "volume";
583
- genie_space: "genie_space";
584
583
  warehouse: "warehouse";
584
+ genie_space: "genie_space";
585
585
  postgres_project: "postgres_project";
586
586
  postgres_branch: "postgres_branch";
587
587
  postgres_database: "postgres_database";
@@ -621,8 +621,8 @@ declare const pluginManifestSchema: z.ZodObject<{
621
621
  type: z.ZodLiteral<"kind">;
622
622
  resourceKind: z.ZodEnum<{
623
623
  volume: "volume";
624
- genie_space: "genie_space";
625
624
  warehouse: "warehouse";
625
+ genie_space: "genie_space";
626
626
  postgres_project: "postgres_project";
627
627
  postgres_branch: "postgres_branch";
628
628
  postgres_database: "postgres_database";
@@ -661,8 +661,8 @@ declare const pluginManifestSchema: z.ZodObject<{
661
661
  type: z.ZodLiteral<"kind">;
662
662
  resourceKind: z.ZodEnum<{
663
663
  volume: "volume";
664
- genie_space: "genie_space";
665
664
  warehouse: "warehouse";
665
+ genie_space: "genie_space";
666
666
  postgres_project: "postgres_project";
667
667
  postgres_branch: "postgres_branch";
668
668
  postgres_database: "postgres_database";
@@ -683,9 +683,9 @@ declare const pluginManifestSchema: z.ZodObject<{
683
683
  type: z.ZodLiteral<"sql_warehouse">;
684
684
  }, z.core.$strict>, z.ZodObject<{
685
685
  permission: z.ZodEnum<{
686
+ CAN_QUERY: "CAN_QUERY";
686
687
  CAN_VIEW: "CAN_VIEW";
687
688
  CAN_MANAGE: "CAN_MANAGE";
688
- CAN_QUERY: "CAN_QUERY";
689
689
  }>;
690
690
  alias: z.ZodString;
691
691
  resourceKey: z.ZodString;
@@ -702,8 +702,8 @@ declare const pluginManifestSchema: z.ZodObject<{
702
702
  type: z.ZodLiteral<"kind">;
703
703
  resourceKind: z.ZodEnum<{
704
704
  volume: "volume";
705
- genie_space: "genie_space";
706
705
  warehouse: "warehouse";
706
+ genie_space: "genie_space";
707
707
  postgres_project: "postgres_project";
708
708
  postgres_branch: "postgres_branch";
709
709
  postgres_database: "postgres_database";
@@ -742,8 +742,8 @@ declare const pluginManifestSchema: z.ZodObject<{
742
742
  type: z.ZodLiteral<"kind">;
743
743
  resourceKind: z.ZodEnum<{
744
744
  volume: "volume";
745
- genie_space: "genie_space";
746
745
  warehouse: "warehouse";
746
+ genie_space: "genie_space";
747
747
  postgres_project: "postgres_project";
748
748
  postgres_branch: "postgres_branch";
749
749
  postgres_database: "postgres_database";
@@ -781,8 +781,8 @@ declare const pluginManifestSchema: z.ZodObject<{
781
781
  type: z.ZodLiteral<"kind">;
782
782
  resourceKind: z.ZodEnum<{
783
783
  volume: "volume";
784
- genie_space: "genie_space";
785
784
  warehouse: "warehouse";
785
+ genie_space: "genie_space";
786
786
  postgres_project: "postgres_project";
787
787
  postgres_branch: "postgres_branch";
788
788
  postgres_database: "postgres_database";
@@ -820,8 +820,8 @@ declare const pluginManifestSchema: z.ZodObject<{
820
820
  type: z.ZodLiteral<"kind">;
821
821
  resourceKind: z.ZodEnum<{
822
822
  volume: "volume";
823
- genie_space: "genie_space";
824
823
  warehouse: "warehouse";
824
+ genie_space: "genie_space";
825
825
  postgres_project: "postgres_project";
826
826
  postgres_branch: "postgres_branch";
827
827
  postgres_database: "postgres_database";
@@ -859,8 +859,8 @@ declare const pluginManifestSchema: z.ZodObject<{
859
859
  type: z.ZodLiteral<"kind">;
860
860
  resourceKind: z.ZodEnum<{
861
861
  volume: "volume";
862
- genie_space: "genie_space";
863
862
  warehouse: "warehouse";
863
+ genie_space: "genie_space";
864
864
  postgres_project: "postgres_project";
865
865
  postgres_branch: "postgres_branch";
866
866
  postgres_database: "postgres_database";
@@ -898,8 +898,8 @@ declare const pluginManifestSchema: z.ZodObject<{
898
898
  type: z.ZodLiteral<"kind">;
899
899
  resourceKind: z.ZodEnum<{
900
900
  volume: "volume";
901
- genie_space: "genie_space";
902
901
  warehouse: "warehouse";
902
+ genie_space: "genie_space";
903
903
  postgres_project: "postgres_project";
904
904
  postgres_branch: "postgres_branch";
905
905
  postgres_database: "postgres_database";
@@ -937,8 +937,8 @@ declare const pluginManifestSchema: z.ZodObject<{
937
937
  type: z.ZodLiteral<"kind">;
938
938
  resourceKind: z.ZodEnum<{
939
939
  volume: "volume";
940
- genie_space: "genie_space";
941
940
  warehouse: "warehouse";
941
+ genie_space: "genie_space";
942
942
  postgres_project: "postgres_project";
943
943
  postgres_branch: "postgres_branch";
944
944
  postgres_database: "postgres_database";
@@ -959,10 +959,10 @@ declare const pluginManifestSchema: z.ZodObject<{
959
959
  type: z.ZodLiteral<"postgres">;
960
960
  }, z.core.$strict>, z.ZodObject<{
961
961
  permission: z.ZodEnum<{
962
+ CAN_EDIT: "CAN_EDIT";
962
963
  CAN_VIEW: "CAN_VIEW";
963
964
  CAN_MANAGE: "CAN_MANAGE";
964
965
  CAN_RUN: "CAN_RUN";
965
- CAN_EDIT: "CAN_EDIT";
966
966
  }>;
967
967
  alias: z.ZodString;
968
968
  resourceKey: z.ZodString;
@@ -979,8 +979,8 @@ declare const pluginManifestSchema: z.ZodObject<{
979
979
  type: z.ZodLiteral<"kind">;
980
980
  resourceKind: z.ZodEnum<{
981
981
  volume: "volume";
982
- genie_space: "genie_space";
983
982
  warehouse: "warehouse";
983
+ genie_space: "genie_space";
984
984
  postgres_project: "postgres_project";
985
985
  postgres_branch: "postgres_branch";
986
986
  postgres_database: "postgres_database";
@@ -1001,8 +1001,8 @@ declare const pluginManifestSchema: z.ZodObject<{
1001
1001
  type: z.ZodLiteral<"genie_space">;
1002
1002
  }, z.core.$strict>, z.ZodObject<{
1003
1003
  permission: z.ZodEnum<{
1004
- CAN_MANAGE: "CAN_MANAGE";
1005
1004
  CAN_EDIT: "CAN_EDIT";
1005
+ CAN_MANAGE: "CAN_MANAGE";
1006
1006
  CAN_READ: "CAN_READ";
1007
1007
  }>;
1008
1008
  alias: z.ZodString;
@@ -1020,8 +1020,8 @@ declare const pluginManifestSchema: z.ZodObject<{
1020
1020
  type: z.ZodLiteral<"kind">;
1021
1021
  resourceKind: z.ZodEnum<{
1022
1022
  volume: "volume";
1023
- genie_space: "genie_space";
1024
1023
  warehouse: "warehouse";
1024
+ genie_space: "genie_space";
1025
1025
  postgres_project: "postgres_project";
1026
1026
  postgres_branch: "postgres_branch";
1027
1027
  postgres_database: "postgres_database";
@@ -1059,8 +1059,8 @@ declare const pluginManifestSchema: z.ZodObject<{
1059
1059
  type: z.ZodLiteral<"kind">;
1060
1060
  resourceKind: z.ZodEnum<{
1061
1061
  volume: "volume";
1062
- genie_space: "genie_space";
1063
1062
  warehouse: "warehouse";
1063
+ genie_space: "genie_space";
1064
1064
  postgres_project: "postgres_project";
1065
1065
  postgres_branch: "postgres_branch";
1066
1066
  postgres_database: "postgres_database";
@@ -3,7 +3,7 @@ import { walkSchema } from "./walk-schema.js";
3
3
  import { randomUUID } from "node:crypto";
4
4
  import fs from "node:fs/promises";
5
5
  import path from "node:path";
6
- import fsSync from "node:fs";
6
+ import fs$1 from "node:fs";
7
7
 
8
8
  //#region src/type-generator/database/generate.ts
9
9
  /** Safe diagnostic raised when database declarations cannot be generated. */
@@ -63,7 +63,7 @@ ${walkSchema(schema).map((entry) => ` ${JSON.stringify(entry.name)}: {
63
63
  }
64
64
  /** Atomically replace generated output only when its content changes. */
65
65
  async function writeIfChanged(outFile, content) {
66
- if (fsSync.existsSync(outFile) && await fs.readFile(outFile, "utf8") === content) return;
66
+ if (fs$1.existsSync(outFile) && await fs.readFile(outFile, "utf8") === content) return;
67
67
  await fs.mkdir(path.dirname(outFile), { recursive: true });
68
68
  const temporary = path.join(path.dirname(outFile), `.${path.basename(outFile)}.${randomUUID()}.tmp`);
69
69
  try {
@@ -80,7 +80,7 @@ async function importSchema(schemaFile) {
80
80
  }
81
81
  /** Generate current registry types or neutralize them when loading fails. */
82
82
  async function generateDatabaseTypes(options) {
83
- if (!fsSync.existsSync(options.schemaFile)) {
83
+ if (!fs$1.existsSync(options.schemaFile)) {
84
84
  await writeIfChanged(options.outFile, NEUTRAL_DATABASE_TYPES);
85
85
  return;
86
86
  }
@@ -1 +1 @@
1
- {"version":3,"file":"generate.js","names":[],"sources":["../../../src/type-generator/database/generate.ts"],"sourcesContent":["import { randomUUID } from \"node:crypto\";\nimport fsSync from \"node:fs\";\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\n\nimport type { Schema } from \"../../database/schema-builder\";\nimport { assertFinalizedSchema } from \"../../database/schema-builder/define-schema\";\nimport { walkSchema } from \"./walk-schema\";\n\n/** Safe diagnostic raised when database declarations cannot be generated. */\nexport class DatabaseTypegenError extends Error {\n constructor(message = \"Database schema generation failed\") {\n super(message);\n this.name = \"DatabaseTypegenError\";\n }\n}\n\ninterface GenerateDatabaseTypesOptions {\n readonly schemaFile: string;\n readonly outFile: string;\n}\n\nexport const DATABASE_TYPES_FILE = \"database.d.ts\";\n\nfunction schemaLabel(schemaFile: string): string {\n return path.relative(process.cwd(), schemaFile) || schemaFile;\n}\n\nfunction importFailureReason(error: unknown): string {\n if (error instanceof SyntaxError) return \"could not be parsed\";\n let code: unknown;\n try {\n code =\n error && typeof error === \"object\"\n ? Reflect.get(error, \"code\")\n : undefined;\n } catch {\n code = undefined;\n }\n if (code === \"MODULE_NOT_FOUND\" || code === \"ERR_MODULE_NOT_FOUND\") {\n return \"contains an unresolved import\";\n }\n return \"threw while loading\";\n}\n\n/** Empty augmentation used when no valid database schema is available. */\nexport const NEUTRAL_DATABASE_TYPES = `// Auto-generated by AppKit - DO NOT EDIT\nimport \"@databricks/appkit\";\n\ndeclare module \"@databricks/appkit\" {\n interface DatabaseRegistry {}\n}\n`;\n\n/** Render one `DatabaseRegistry` augmentation from a finalized schema. */\nfunction render(schema: Schema): string {\n const entries = walkSchema(schema)\n .map(\n (entry) => ` ${JSON.stringify(entry.name)}: {\n row: ${entry.row};\n publicRow: ${entry.publicRow};\n insert: ${entry.insert};\n update: ${entry.update};\n filters: ${entry.filters};\n includes: ${entry.includes};\n hasPrimaryKey: ${entry.hasPrimaryKey};\n };`,\n )\n .join(\"\\n\");\n return `// Auto-generated by AppKit - DO NOT EDIT\nimport \"@databricks/appkit\";\n\ndeclare module \"@databricks/appkit\" {\n type DatabaseLogicalFilter<T> = T & {\n and?: readonly DatabaseLogicalFilter<T>[];\n or?: readonly DatabaseLogicalFilter<T>[];\n };\n\n interface DatabaseRegistry {\n${entries}\n }\n}\n`;\n}\n\n/** Atomically replace generated output only when its content changes. */\nasync function writeIfChanged(outFile: string, content: string): Promise<void> {\n if (\n fsSync.existsSync(outFile) &&\n (await fs.readFile(outFile, \"utf8\")) === content\n )\n return;\n await fs.mkdir(path.dirname(outFile), { recursive: true });\n const temporary = path.join(\n path.dirname(outFile),\n `.${path.basename(outFile)}.${randomUUID()}.tmp`,\n );\n try {\n await fs.writeFile(temporary, content, \"utf8\");\n await fs.rename(temporary, outFile);\n } finally {\n await fs.rm(temporary, { force: true });\n }\n}\n\n/** Disable Jiti's module cache so watch-mode runs observe schema edits. */\nasync function importSchema(schemaFile: string): Promise<unknown> {\n const { createJiti } = await import(\"jiti\");\n return createJiti(import.meta.url, { moduleCache: false }).import(schemaFile);\n}\n\n/** Generate current registry types or neutralize them when loading fails. */\nexport async function generateDatabaseTypes(\n options: GenerateDatabaseTypesOptions,\n): Promise<void> {\n if (!fsSync.existsSync(options.schemaFile)) {\n await writeIfChanged(options.outFile, NEUTRAL_DATABASE_TYPES);\n return;\n }\n try {\n const module = (await importSchema(options.schemaFile)) as {\n schema?: Schema;\n };\n if (!(\"schema\" in module)) {\n throw new DatabaseTypegenError(\n `Database schema module \"${schemaLabel(options.schemaFile)}\" must export a named \"schema\"`,\n );\n }\n try {\n assertFinalizedSchema(module.schema);\n } catch {\n throw new DatabaseTypegenError(\n `Database schema \"${schemaLabel(options.schemaFile)}\" is not a finalized AppKit schema`,\n );\n }\n await writeIfChanged(options.outFile, render(module.schema));\n } catch (error) {\n // A failed run must not leave stale entities visible to TypeScript.\n await writeIfChanged(options.outFile, NEUTRAL_DATABASE_TYPES);\n throw error instanceof DatabaseTypegenError\n ? error\n : new DatabaseTypegenError(\n `Database schema \"${schemaLabel(options.schemaFile)}\" ${importFailureReason(error)}`,\n );\n }\n}\n"],"mappings":";;;;;;;;;AAUA,IAAa,uBAAb,cAA0C,MAAM;CAC9C,YAAY,UAAU,qCAAqC;AACzD,QAAM,QAAQ;AACd,OAAK,OAAO;;;AAShB,MAAa,sBAAsB;AAEnC,SAAS,YAAY,YAA4B;AAC/C,QAAO,KAAK,SAAS,QAAQ,KAAK,EAAE,WAAW,IAAI;;AAGrD,SAAS,oBAAoB,OAAwB;AACnD,KAAI,iBAAiB,YAAa,QAAO;CACzC,IAAI;AACJ,KAAI;AACF,SACE,SAAS,OAAO,UAAU,WACtB,QAAQ,IAAI,OAAO,OAAO,GAC1B;SACA;AACN,SAAO;;AAET,KAAI,SAAS,sBAAsB,SAAS,uBAC1C,QAAO;AAET,QAAO;;;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SAAM,IAAI,qBACR,oBAAoB,YAAY,QAAQ,WAAW,CAAC,oCACrD;;AAEH,QAAM,eAAe,QAAQ,SAAS,OAAO,OAAO,OAAO,CAAC;UACrD,OAAO;AAEd,QAAM,eAAe,QAAQ,SAAS,uBAAuB;AAC7D,QAAM,iBAAiB,uBACnB,QACA,IAAI,qBACF,oBAAoB,YAAY,QAAQ,WAAW,CAAC,IAAI,oBAAoB,MAAM,GACnF"}
1
+ {"version":3,"file":"generate.js","names":["fsSync"],"sources":["../../../src/type-generator/database/generate.ts"],"sourcesContent":["import { randomUUID } from \"node:crypto\";\nimport fsSync from \"node:fs\";\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\n\nimport type { Schema } from \"../../database/schema-builder\";\nimport { assertFinalizedSchema } from \"../../database/schema-builder/define-schema\";\nimport { walkSchema } from \"./walk-schema\";\n\n/** Safe diagnostic raised when database declarations cannot be generated. */\nexport class DatabaseTypegenError extends Error {\n constructor(message = \"Database schema generation failed\") {\n super(message);\n this.name = \"DatabaseTypegenError\";\n }\n}\n\ninterface GenerateDatabaseTypesOptions {\n readonly schemaFile: string;\n readonly outFile: string;\n}\n\nexport const DATABASE_TYPES_FILE = \"database.d.ts\";\n\nfunction schemaLabel(schemaFile: string): string {\n return path.relative(process.cwd(), schemaFile) || schemaFile;\n}\n\nfunction importFailureReason(error: unknown): string {\n if (error instanceof SyntaxError) return \"could not be parsed\";\n let code: unknown;\n try {\n code =\n error && typeof error === \"object\"\n ? Reflect.get(error, \"code\")\n : undefined;\n } catch {\n code = undefined;\n }\n if (code === \"MODULE_NOT_FOUND\" || code === \"ERR_MODULE_NOT_FOUND\") {\n return \"contains an unresolved import\";\n }\n return \"threw while loading\";\n}\n\n/** Empty augmentation used when no valid database schema is available. */\nexport const NEUTRAL_DATABASE_TYPES = `// Auto-generated by AppKit - DO NOT EDIT\nimport \"@databricks/appkit\";\n\ndeclare module \"@databricks/appkit\" {\n interface DatabaseRegistry {}\n}\n`;\n\n/** Render one `DatabaseRegistry` augmentation from a finalized schema. */\nfunction render(schema: Schema): string {\n const entries = walkSchema(schema)\n .map(\n (entry) => ` ${JSON.stringify(entry.name)}: {\n row: ${entry.row};\n publicRow: ${entry.publicRow};\n insert: ${entry.insert};\n update: ${entry.update};\n filters: ${entry.filters};\n includes: ${entry.includes};\n hasPrimaryKey: ${entry.hasPrimaryKey};\n };`,\n )\n .join(\"\\n\");\n return `// Auto-generated by AppKit - DO NOT EDIT\nimport \"@databricks/appkit\";\n\ndeclare module \"@databricks/appkit\" {\n type DatabaseLogicalFilter<T> = T & {\n and?: readonly DatabaseLogicalFilter<T>[];\n or?: readonly DatabaseLogicalFilter<T>[];\n };\n\n interface DatabaseRegistry {\n${entries}\n }\n}\n`;\n}\n\n/** Atomically replace generated output only when its content changes. */\nasync function writeIfChanged(outFile: string, content: string): Promise<void> {\n if (\n fsSync.existsSync(outFile) &&\n (await fs.readFile(outFile, \"utf8\")) === content\n )\n return;\n await fs.mkdir(path.dirname(outFile), { recursive: true });\n const temporary = path.join(\n path.dirname(outFile),\n `.${path.basename(outFile)}.${randomUUID()}.tmp`,\n );\n try {\n await fs.writeFile(temporary, content, \"utf8\");\n await fs.rename(temporary, outFile);\n } finally {\n await fs.rm(temporary, { force: true });\n }\n}\n\n/** Disable Jiti's module cache so watch-mode runs observe schema edits. */\nasync function importSchema(schemaFile: string): Promise<unknown> {\n const { createJiti } = await import(\"jiti\");\n return createJiti(import.meta.url, { moduleCache: false }).import(schemaFile);\n}\n\n/** Generate current registry types or neutralize them when loading fails. */\nexport async function generateDatabaseTypes(\n options: GenerateDatabaseTypesOptions,\n): Promise<void> {\n if (!fsSync.existsSync(options.schemaFile)) {\n await writeIfChanged(options.outFile, NEUTRAL_DATABASE_TYPES);\n return;\n }\n try {\n const module = (await importSchema(options.schemaFile)) as {\n schema?: Schema;\n };\n if (!(\"schema\" in module)) {\n throw new DatabaseTypegenError(\n `Database schema module \"${schemaLabel(options.schemaFile)}\" must export a named \"schema\"`,\n );\n }\n try {\n assertFinalizedSchema(module.schema);\n } catch {\n throw new DatabaseTypegenError(\n `Database schema \"${schemaLabel(options.schemaFile)}\" is not a finalized AppKit schema`,\n );\n }\n await writeIfChanged(options.outFile, render(module.schema));\n } catch (error) {\n // A failed run must not leave stale entities visible to TypeScript.\n await writeIfChanged(options.outFile, NEUTRAL_DATABASE_TYPES);\n throw error instanceof DatabaseTypegenError\n ? error\n : new DatabaseTypegenError(\n `Database schema \"${schemaLabel(options.schemaFile)}\" ${importFailureReason(error)}`,\n );\n }\n}\n"],"mappings":";;;;;;;;;AAUA,IAAa,uBAAb,cAA0C,MAAM;CAC9C,YAAY,UAAU,qCAAqC;AACzD,QAAM,QAAQ;AACd,OAAK,OAAO;;;AAShB,MAAa,sBAAsB;AAEnC,SAAS,YAAY,YAA4B;AAC/C,QAAO,KAAK,SAAS,QAAQ,KAAK,EAAE,WAAW,IAAI;;AAGrD,SAAS,oBAAoB,OAAwB;AACnD,KAAI,iBAAiB,YAAa,QAAO;CACzC,IAAI;AACJ,KAAI;AACF,SACE,SAAS,OAAO,UAAU,WACtB,QAAQ,IAAI,OAAO,OAAO,GAC1B;SACA;AACN,SAAO;;AAET,KAAI,SAAS,sBAAsB,SAAS,uBAC1C,QAAO;AAET,QAAO;;;AAIT,MAAa,yBAAyB;;;;;;;;AAStC,SAAS,OAAO,QAAwB;AActC,QAAO;;;;;;;;;;EAbS,WAAW,OAAO,CAC/B,KACE,UAAU,OAAO,KAAK,UAAU,MAAM,KAAK,CAAC;aACtC,MAAM,IAAI;mBACJ,MAAM,UAAU;gBACnB,MAAM,OAAO;gBACb,MAAM,OAAO;iBACZ,MAAM,QAAQ;kBACb,MAAM,SAAS;uBACV,MAAM,cAAc;QAEtC,CACA,KAAK,KAAK,CAWL;;;;;;AAOV,eAAe,eAAe,SAAiB,SAAgC;AAC7E,KACEA,KAAO,WAAW,QAAQ,IACzB,MAAM,GAAG,SAAS,SAAS,OAAO,KAAM,QAEzC;AACF,OAAM,GAAG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