@databricks/appkit-ui 0.22.0 → 0.24.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/CLAUDE.md +11 -0
- package/NOTICE.md +1 -0
- package/dist/cli/commands/docs.js +7 -1
- package/dist/cli/commands/docs.js.map +1 -1
- package/dist/cli/commands/generate-types.js +27 -15
- package/dist/cli/commands/generate-types.js.map +1 -1
- package/dist/cli/commands/lint.js +3 -1
- package/dist/cli/commands/lint.js.map +1 -1
- package/dist/cli/commands/plugin/add-resource/add-resource.js +73 -8
- package/dist/cli/commands/plugin/add-resource/add-resource.js.map +1 -1
- package/dist/cli/commands/plugin/create/create.js +164 -20
- package/dist/cli/commands/plugin/create/create.js.map +1 -1
- package/dist/cli/commands/plugin/create/resource-defaults.js +5 -1
- package/dist/cli/commands/plugin/create/resource-defaults.js.map +1 -1
- package/dist/cli/commands/plugin/index.js +7 -1
- package/dist/cli/commands/plugin/index.js.map +1 -1
- package/dist/cli/commands/plugin/list/list.js +7 -1
- package/dist/cli/commands/plugin/list/list.js.map +1 -1
- package/dist/cli/commands/plugin/sync/sync.js +27 -14
- package/dist/cli/commands/plugin/sync/sync.js.map +1 -1
- package/dist/cli/commands/plugin/validate/validate.js +39 -9
- package/dist/cli/commands/plugin/validate/validate.js.map +1 -1
- package/dist/cli/commands/setup.js +6 -5
- package/dist/cli/commands/setup.js.map +1 -1
- package/dist/react/hooks/index.d.ts +4 -2
- package/dist/react/hooks/index.js +2 -0
- package/dist/react/hooks/types.d.ts +31 -2
- package/dist/react/hooks/types.d.ts.map +1 -1
- package/dist/react/hooks/use-serving-invoke.d.ts +30 -0
- package/dist/react/hooks/use-serving-invoke.d.ts.map +1 -0
- package/dist/react/hooks/use-serving-invoke.js +82 -0
- package/dist/react/hooks/use-serving-invoke.js.map +1 -0
- package/dist/react/hooks/use-serving-stream.d.ts +35 -0
- package/dist/react/hooks/use-serving-stream.d.ts.map +1 -0
- package/dist/react/hooks/use-serving-stream.js +101 -0
- package/dist/react/hooks/use-serving-stream.js.map +1 -0
- package/dist/react/index.d.ts +4 -2
- package/dist/react/index.js +3 -1
- package/docs/api/appkit/Class.Plugin.md +8 -3
- package/docs/api/appkit/Function.appKitServingTypesPlugin.md +24 -0
- package/docs/api/appkit/Function.extractServingEndpoints.md +22 -0
- package/docs/api/appkit/Function.findServerFile.md +20 -0
- package/docs/api/appkit/Interface.EndpointConfig.md +23 -0
- package/docs/api/appkit/Interface.ServingEndpointEntry.md +30 -0
- package/docs/api/appkit/Interface.ServingEndpointRegistry.md +3 -0
- package/docs/api/appkit/TypeAlias.ExecutionResult.md +36 -0
- package/docs/api/appkit/TypeAlias.ServingFactory.md +19 -0
- package/docs/api/appkit.md +39 -31
- package/docs/development/type-generation.md +6 -5
- package/docs/faq.md +66 -0
- package/docs/plugins/analytics.md +1 -1
- package/docs/plugins/custom-plugins.md +4 -0
- package/docs/plugins/plugin-management.md +22 -6
- package/docs/plugins/serving.md +223 -0
- package/docs/plugins/vector-search.md +247 -0
- package/llms.txt +11 -0
- package/package.json +1 -1
- package/sbom.cdx.json +1 -1
|
@@ -47,35 +47,65 @@ function resolveManifestPaths(paths, cwd, allowJsManifest) {
|
|
|
47
47
|
async function runPluginValidate(paths, options) {
|
|
48
48
|
const cwd = process.cwd();
|
|
49
49
|
const allowJsManifest = Boolean(options.allowJsManifest);
|
|
50
|
-
if (allowJsManifest) console.warn("Warning: --allow-js-manifest executes manifest.js/manifest.cjs files. Only use with trusted code.");
|
|
50
|
+
if (allowJsManifest && !options.json) console.warn("Warning: --allow-js-manifest executes manifest.js/manifest.cjs files. Only use with trusted code.");
|
|
51
51
|
const manifestPaths = resolveManifestPaths(paths.length > 0 ? paths : ["."], cwd, allowJsManifest);
|
|
52
52
|
if (manifestPaths.length === 0) {
|
|
53
|
-
console.
|
|
53
|
+
if (options.json) console.log("[]");
|
|
54
|
+
else console.error("No manifest files to validate.");
|
|
54
55
|
process.exit(1);
|
|
55
56
|
}
|
|
56
57
|
let hasFailure = false;
|
|
58
|
+
const jsonResults = [];
|
|
57
59
|
for (const { path: manifestPath, type } of manifestPaths) {
|
|
60
|
+
const relativePath = path.relative(cwd, manifestPath);
|
|
58
61
|
let obj;
|
|
59
62
|
try {
|
|
60
63
|
obj = await loadManifestFromFile(manifestPath, type, { allowJsManifest });
|
|
61
64
|
} catch (err) {
|
|
62
|
-
|
|
63
|
-
|
|
65
|
+
const errMsg = err instanceof Error ? err.message : String(err);
|
|
66
|
+
if (options.json) jsonResults.push({
|
|
67
|
+
path: relativePath,
|
|
68
|
+
valid: false,
|
|
69
|
+
errors: [errMsg]
|
|
70
|
+
});
|
|
71
|
+
else {
|
|
72
|
+
console.error(`✗ ${manifestPath}`);
|
|
73
|
+
console.error(` ${errMsg}`);
|
|
74
|
+
}
|
|
64
75
|
hasFailure = true;
|
|
65
76
|
continue;
|
|
66
77
|
}
|
|
67
78
|
const result = detectSchemaType(obj) === "template-plugins" ? validateTemplateManifest(obj) : validateManifest(obj);
|
|
68
|
-
|
|
69
|
-
|
|
79
|
+
if (result.valid) if (options.json) jsonResults.push({
|
|
80
|
+
path: relativePath,
|
|
81
|
+
valid: true
|
|
82
|
+
});
|
|
83
|
+
else console.log(`✓ ${relativePath}`);
|
|
70
84
|
else {
|
|
71
|
-
|
|
72
|
-
|
|
85
|
+
if (options.json) {
|
|
86
|
+
const errors = result.errors?.length ? formatValidationErrors(result.errors, obj).split("\n").filter(Boolean) : [];
|
|
87
|
+
jsonResults.push({
|
|
88
|
+
path: relativePath,
|
|
89
|
+
valid: false,
|
|
90
|
+
...errors.length > 0 && { errors }
|
|
91
|
+
});
|
|
92
|
+
} else {
|
|
93
|
+
console.error(`✗ ${relativePath}`);
|
|
94
|
+
if (result.errors?.length) console.error(formatValidationErrors(result.errors, obj));
|
|
95
|
+
}
|
|
73
96
|
hasFailure = true;
|
|
74
97
|
}
|
|
75
98
|
}
|
|
99
|
+
if (options.json) console.log(JSON.stringify(jsonResults, null, 2));
|
|
76
100
|
process.exit(hasFailure ? 1 : 0);
|
|
77
101
|
}
|
|
78
|
-
const pluginValidateCommand = new Command("validate").description("Validate plugin manifest(s) or template manifests against their JSON schema").argument("[paths...]", "Paths to manifest.json or appkit.plugins.json (or plugin directories); use --allow-js-manifest to include manifest.js").option("--allow-js-manifest", "Allow reading manifest.js/manifest.cjs (executes code; use only with trusted plugins)").
|
|
102
|
+
const pluginValidateCommand = new Command("validate").description("Validate plugin manifest(s) or template manifests against their JSON schema").argument("[paths...]", "Paths to manifest.json or appkit.plugins.json (or plugin directories); use --allow-js-manifest to include manifest.js").option("--allow-js-manifest", "Allow reading manifest.js/manifest.cjs (executes code; use only with trusted plugins)").option("--json", "Output validation results as JSON").addHelpText("after", `
|
|
103
|
+
Examples:
|
|
104
|
+
$ appkit plugin validate
|
|
105
|
+
$ appkit plugin validate plugins/my-plugin
|
|
106
|
+
$ appkit plugin validate plugins/my-plugin plugins/other
|
|
107
|
+
$ appkit plugin validate appkit.plugins.json
|
|
108
|
+
$ appkit plugin validate --json`).action((paths, opts) => runPluginValidate(paths, opts).catch((err) => {
|
|
79
109
|
console.error(err);
|
|
80
110
|
process.exit(1);
|
|
81
111
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.js","names":[],"sources":["../../../../../src/cli/commands/plugin/validate/validate.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport process from \"node:process\";\nimport { Command } from \"commander\";\nimport {\n loadManifestFromFile,\n type ResolvedManifest,\n resolveManifestInDir,\n} from \"../manifest-resolve\";\nimport {\n detectSchemaType,\n formatValidationErrors,\n validateManifest,\n validateTemplateManifest,\n} from \"./validate-manifest\";\n\nfunction resolveManifestPaths(\n paths: string[],\n cwd: string,\n allowJsManifest: boolean,\n): ResolvedManifest[] {\n const out: ResolvedManifest[] = [];\n for (const p of paths) {\n const resolved = path.resolve(cwd, p);\n if (!fs.existsSync(resolved)) {\n console.error(`Path not found: ${p}`);\n continue;\n }\n const stat = fs.statSync(resolved);\n if (stat.isDirectory()) {\n let found = false;\n const pluginResolved = resolveManifestInDir(resolved, {\n allowJsManifest,\n });\n if (pluginResolved) {\n out.push(pluginResolved);\n found = true;\n }\n const templateManifest = path.join(resolved, \"appkit.plugins.json\");\n if (fs.existsSync(templateManifest)) {\n out.push({ path: templateManifest, type: \"json\" });\n found = true;\n }\n if (!found) {\n console.error(\n `No ${allowJsManifest ? \"manifest.json, manifest.js, or\" : \"manifest.json or\"} appkit.plugins.json in directory: ${p}`,\n );\n }\n } else {\n const ext = path.extname(resolved).toLowerCase();\n if (!allowJsManifest && (ext === \".js\" || ext === \".cjs\")) {\n console.error(\n `JS manifest provided but disabled by default: ${p}. Re-run with --allow-js-manifest to opt in.`,\n );\n continue;\n }\n out.push({\n path: resolved,\n type: ext === \".js\" || ext === \".cjs\" ? \"js\" : \"json\",\n });\n }\n }\n return out;\n}\n\nasync function runPluginValidate(\n paths: string[],\n options:
|
|
1
|
+
{"version":3,"file":"validate.js","names":[],"sources":["../../../../../src/cli/commands/plugin/validate/validate.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport process from \"node:process\";\nimport { Command } from \"commander\";\nimport {\n loadManifestFromFile,\n type ResolvedManifest,\n resolveManifestInDir,\n} from \"../manifest-resolve\";\nimport {\n detectSchemaType,\n formatValidationErrors,\n validateManifest,\n validateTemplateManifest,\n} from \"./validate-manifest\";\n\nfunction resolveManifestPaths(\n paths: string[],\n cwd: string,\n allowJsManifest: boolean,\n): ResolvedManifest[] {\n const out: ResolvedManifest[] = [];\n for (const p of paths) {\n const resolved = path.resolve(cwd, p);\n if (!fs.existsSync(resolved)) {\n console.error(`Path not found: ${p}`);\n continue;\n }\n const stat = fs.statSync(resolved);\n if (stat.isDirectory()) {\n let found = false;\n const pluginResolved = resolveManifestInDir(resolved, {\n allowJsManifest,\n });\n if (pluginResolved) {\n out.push(pluginResolved);\n found = true;\n }\n const templateManifest = path.join(resolved, \"appkit.plugins.json\");\n if (fs.existsSync(templateManifest)) {\n out.push({ path: templateManifest, type: \"json\" });\n found = true;\n }\n if (!found) {\n console.error(\n `No ${allowJsManifest ? \"manifest.json, manifest.js, or\" : \"manifest.json or\"} appkit.plugins.json in directory: ${p}`,\n );\n }\n } else {\n const ext = path.extname(resolved).toLowerCase();\n if (!allowJsManifest && (ext === \".js\" || ext === \".cjs\")) {\n console.error(\n `JS manifest provided but disabled by default: ${p}. Re-run with --allow-js-manifest to opt in.`,\n );\n continue;\n }\n out.push({\n path: resolved,\n type: ext === \".js\" || ext === \".cjs\" ? \"js\" : \"json\",\n });\n }\n }\n return out;\n}\n\ninterface ValidateOptions {\n allowJsManifest?: boolean;\n json?: boolean;\n}\n\nasync function runPluginValidate(\n paths: string[],\n options: ValidateOptions,\n): Promise<void> {\n const cwd = process.cwd();\n const allowJsManifest = Boolean(options.allowJsManifest);\n if (allowJsManifest && !options.json) {\n console.warn(\n \"Warning: --allow-js-manifest executes manifest.js/manifest.cjs files. Only use with trusted code.\",\n );\n }\n const toValidate = paths.length > 0 ? paths : [\".\"];\n const manifestPaths = resolveManifestPaths(toValidate, cwd, allowJsManifest);\n\n if (manifestPaths.length === 0) {\n if (options.json) {\n console.log(\"[]\");\n } else {\n console.error(\"No manifest files to validate.\");\n }\n process.exit(1);\n }\n\n let hasFailure = false;\n const jsonResults: { path: string; valid: boolean; errors?: string[] }[] = [];\n\n for (const { path: manifestPath, type } of manifestPaths) {\n const relativePath = path.relative(cwd, manifestPath);\n let obj: unknown;\n try {\n obj = await loadManifestFromFile(manifestPath, type, { allowJsManifest });\n } catch (err) {\n const errMsg = err instanceof Error ? err.message : String(err);\n if (options.json) {\n jsonResults.push({\n path: relativePath,\n valid: false,\n errors: [errMsg],\n });\n } else {\n console.error(`✗ ${manifestPath}`);\n console.error(` ${errMsg}`);\n }\n hasFailure = true;\n continue;\n }\n\n const schemaType = detectSchemaType(obj);\n const result =\n schemaType === \"template-plugins\"\n ? validateTemplateManifest(obj)\n : validateManifest(obj);\n\n if (result.valid) {\n if (options.json) {\n jsonResults.push({ path: relativePath, valid: true });\n } else {\n console.log(`✓ ${relativePath}`);\n }\n } else {\n if (options.json) {\n const errors = result.errors?.length\n ? formatValidationErrors(result.errors, obj)\n .split(\"\\n\")\n .filter(Boolean)\n : [];\n jsonResults.push({\n path: relativePath,\n valid: false,\n ...(errors.length > 0 && { errors }),\n });\n } else {\n console.error(`✗ ${relativePath}`);\n if (result.errors?.length) {\n console.error(formatValidationErrors(result.errors, obj));\n }\n }\n hasFailure = true;\n }\n }\n\n if (options.json) {\n console.log(JSON.stringify(jsonResults, null, 2));\n }\n\n process.exit(hasFailure ? 1 : 0);\n}\n\nexport const pluginValidateCommand = new Command(\"validate\")\n .description(\n \"Validate plugin manifest(s) or template manifests against their JSON schema\",\n )\n .argument(\n \"[paths...]\",\n \"Paths to manifest.json or appkit.plugins.json (or plugin directories); use --allow-js-manifest to include manifest.js\",\n )\n .option(\n \"--allow-js-manifest\",\n \"Allow reading manifest.js/manifest.cjs (executes code; use only with trusted plugins)\",\n )\n .option(\"--json\", \"Output validation results as JSON\")\n .addHelpText(\n \"after\",\n `\nExamples:\n $ appkit plugin validate\n $ appkit plugin validate plugins/my-plugin\n $ appkit plugin validate plugins/my-plugin plugins/other\n $ appkit plugin validate appkit.plugins.json\n $ appkit plugin validate --json`,\n )\n .action((paths: string[], opts: ValidateOptions) =>\n runPluginValidate(paths, opts).catch((err) => {\n console.error(err);\n process.exit(1);\n }),\n );\n"],"mappings":";;;;;;;;AAgBA,SAAS,qBACP,OACA,KACA,iBACoB;CACpB,MAAM,MAA0B,EAAE;AAClC,MAAK,MAAM,KAAK,OAAO;EACrB,MAAM,WAAW,KAAK,QAAQ,KAAK,EAAE;AACrC,MAAI,CAAC,GAAG,WAAW,SAAS,EAAE;AAC5B,WAAQ,MAAM,mBAAmB,IAAI;AACrC;;AAGF,MADa,GAAG,SAAS,SAAS,CACzB,aAAa,EAAE;GACtB,IAAI,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95
95
|
const installed = findInstalledPackages();
|
|
96
96
|
if (installed.length === 0) {
|
|
97
97
|
console.log("No @databricks/appkit packages found in node_modules.");
|
|
98
|
-
console.log("\
|
|
99
|
-
|
|
100
|
-
console.log(` - ${pkg.name}`);
|
|
101
|
-
});
|
|
98
|
+
console.log("\nInstall at least one of:");
|
|
99
|
+
for (const pkg of PACKAGES) console.log(` npm install ${pkg.name}`);
|
|
102
100
|
process.exit(1);
|
|
103
101
|
}
|
|
104
102
|
console.log("Detected packages:");
|
|
@@ -130,7 +128,10 @@ function runSetup(options) {
|
|
|
130
128
|
console.log("─".repeat(50));
|
|
131
129
|
}
|
|
132
130
|
}
|
|
133
|
-
const setupCommand = new Command("setup").description("Setup CLAUDE.md with AppKit package references").option("-w, --write", "Create or update CLAUDE.md file in current directory").
|
|
131
|
+
const setupCommand = new Command("setup").description("Setup CLAUDE.md with AppKit package references").option("-w, --write", "Create or update CLAUDE.md file in current directory").addHelpText("after", `
|
|
132
|
+
Examples:
|
|
133
|
+
$ appkit setup
|
|
134
|
+
$ appkit setup --write`).action(runSetup);
|
|
134
135
|
|
|
135
136
|
//#endregion
|
|
136
137
|
export { setupCommand };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.js","names":[],"sources":["../../../src/cli/commands/setup.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { Command } from \"commander\";\n\nconst PACKAGES = [\n { name: \"@databricks/appkit\", description: \"Backend SDK\" },\n {\n name: \"@databricks/appkit-ui\",\n description: \"UI Integration, Charts, Tables, SSE, and more.\",\n },\n];\n\nconst SECTION_START = \"<!-- appkit-instructions-start -->\";\nconst SECTION_END = \"<!-- appkit-instructions-end -->\";\n\n/**\n * Find which AppKit packages are installed by checking for package.json\n */\nfunction findInstalledPackages() {\n const cwd = process.cwd();\n const installed = [];\n\n for (const pkg of PACKAGES) {\n const packagePath = path.join(\n cwd,\n \"node_modules\",\n pkg.name,\n \"package.json\",\n );\n if (fs.existsSync(packagePath)) {\n installed.push(pkg);\n }\n }\n\n return installed;\n}\n\n/**\n * Generate the AppKit section content\n */\nfunction generateSection(packages: typeof PACKAGES) {\n const links = packages\n .map((pkg) => {\n const docPath = `./node_modules/${pkg.name}/CLAUDE.md`;\n return `- **${pkg.name}** (${pkg.description}): [${docPath}](${docPath})`;\n })\n .join(\"\\n\");\n\n return `${SECTION_START}\n## Databricks AppKit\n\nThis project uses Databricks AppKit packages. For AI assistant guidance on using these packages, refer to:\n\n${links}\n\n### Databricks Skills\n\nFor enhanced AI assistance with Databricks CLI operations, authentication, data exploration, and app development, install the Databricks skills:\n\n\\`\\`\\`bash\ndatabricks experimental aitools install\n\\`\\`\\`\n${SECTION_END}`;\n}\n\n/**\n * Generate standalone CLAUDE.md content (when no existing file)\n */\nfunction generateStandalone(packages: typeof PACKAGES) {\n const links = packages\n .map((pkg) => {\n const docPath = `./node_modules/${pkg.name}/CLAUDE.md`;\n return `- **${pkg.name}** (${pkg.description}): [${docPath}](${docPath})`;\n })\n .join(\"\\n\");\n\n return `# AI Assistant Instructions\n\n${SECTION_START}\n## Databricks AppKit\n\nThis project uses Databricks AppKit packages. For AI assistant guidance on using these packages, refer to:\n\n${links}\n\n### Databricks Skills\n\nFor enhanced AI assistance with Databricks CLI operations, authentication, data exploration, and app development, install the Databricks skills:\n\n\\`\\`\\`bash\ndatabricks experimental aitools install\n\\`\\`\\`\n${SECTION_END}\n`;\n}\n\n/**\n * Update existing content with AppKit section\n */\nfunction updateContent(existingContent: string, packages: typeof PACKAGES) {\n const newSection = generateSection(packages);\n\n // Check if AppKit section already exists\n const startIndex = existingContent.indexOf(SECTION_START);\n const endIndex = existingContent.indexOf(SECTION_END);\n\n if (startIndex !== -1 && endIndex !== -1) {\n // Replace existing section\n const before = existingContent.substring(0, startIndex);\n const after = existingContent.substring(endIndex + SECTION_END.length);\n return before + newSection + after;\n }\n\n // Append section to end\n return `${existingContent.trimEnd()}\\n\\n${newSection}\\n`;\n}\n\n/**\n * Setup command implementation\n */\nfunction runSetup(options: { write?: boolean }) {\n const shouldWrite = options.write;\n\n // Find installed packages\n const installed = findInstalledPackages();\n\n if (installed.length === 0) {\n console.log(\"No @databricks/appkit packages found in node_modules.\");\n console.log(\"\\
|
|
1
|
+
{"version":3,"file":"setup.js","names":[],"sources":["../../../src/cli/commands/setup.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { Command } from \"commander\";\n\nconst PACKAGES = [\n { name: \"@databricks/appkit\", description: \"Backend SDK\" },\n {\n name: \"@databricks/appkit-ui\",\n description: \"UI Integration, Charts, Tables, SSE, and more.\",\n },\n];\n\nconst SECTION_START = \"<!-- appkit-instructions-start -->\";\nconst SECTION_END = \"<!-- appkit-instructions-end -->\";\n\n/**\n * Find which AppKit packages are installed by checking for package.json\n */\nfunction findInstalledPackages() {\n const cwd = process.cwd();\n const installed = [];\n\n for (const pkg of PACKAGES) {\n const packagePath = path.join(\n cwd,\n \"node_modules\",\n pkg.name,\n \"package.json\",\n );\n if (fs.existsSync(packagePath)) {\n installed.push(pkg);\n }\n }\n\n return installed;\n}\n\n/**\n * Generate the AppKit section content\n */\nfunction generateSection(packages: typeof PACKAGES) {\n const links = packages\n .map((pkg) => {\n const docPath = `./node_modules/${pkg.name}/CLAUDE.md`;\n return `- **${pkg.name}** (${pkg.description}): [${docPath}](${docPath})`;\n })\n .join(\"\\n\");\n\n return `${SECTION_START}\n## Databricks AppKit\n\nThis project uses Databricks AppKit packages. For AI assistant guidance on using these packages, refer to:\n\n${links}\n\n### Databricks Skills\n\nFor enhanced AI assistance with Databricks CLI operations, authentication, data exploration, and app development, install the Databricks skills:\n\n\\`\\`\\`bash\ndatabricks experimental aitools install\n\\`\\`\\`\n${SECTION_END}`;\n}\n\n/**\n * Generate standalone CLAUDE.md content (when no existing file)\n */\nfunction generateStandalone(packages: typeof PACKAGES) {\n const links = packages\n .map((pkg) => {\n const docPath = `./node_modules/${pkg.name}/CLAUDE.md`;\n return `- **${pkg.name}** (${pkg.description}): [${docPath}](${docPath})`;\n })\n .join(\"\\n\");\n\n return `# AI Assistant Instructions\n\n${SECTION_START}\n## Databricks AppKit\n\nThis project uses Databricks AppKit packages. For AI assistant guidance on using these packages, refer to:\n\n${links}\n\n### Databricks Skills\n\nFor enhanced AI assistance with Databricks CLI operations, authentication, data exploration, and app development, install the Databricks skills:\n\n\\`\\`\\`bash\ndatabricks experimental aitools install\n\\`\\`\\`\n${SECTION_END}\n`;\n}\n\n/**\n * Update existing content with AppKit section\n */\nfunction updateContent(existingContent: string, packages: typeof PACKAGES) {\n const newSection = generateSection(packages);\n\n // Check if AppKit section already exists\n const startIndex = existingContent.indexOf(SECTION_START);\n const endIndex = existingContent.indexOf(SECTION_END);\n\n if (startIndex !== -1 && endIndex !== -1) {\n // Replace existing section\n const before = existingContent.substring(0, startIndex);\n const after = existingContent.substring(endIndex + SECTION_END.length);\n return before + newSection + after;\n }\n\n // Append section to end\n return `${existingContent.trimEnd()}\\n\\n${newSection}\\n`;\n}\n\n/**\n * Setup command implementation\n */\nfunction runSetup(options: { write?: boolean }) {\n const shouldWrite = options.write;\n\n // Find installed packages\n const installed = findInstalledPackages();\n\n if (installed.length === 0) {\n console.log(\"No @databricks/appkit packages found in node_modules.\");\n console.log(\"\\nInstall at least one of:\");\n for (const pkg of PACKAGES) {\n console.log(` npm install ${pkg.name}`);\n }\n process.exit(1);\n }\n\n console.log(\"Detected packages:\");\n installed.forEach((pkg) => {\n console.log(` ✓ ${pkg.name}`);\n });\n\n const claudePath = path.join(process.cwd(), \"CLAUDE.md\");\n const existingContent = fs.existsSync(claudePath)\n ? fs.readFileSync(claudePath, \"utf-8\")\n : null;\n\n let finalContent: string;\n let action: string;\n\n if (existingContent) {\n finalContent = updateContent(existingContent, installed);\n action = existingContent.includes(SECTION_START) ? \"Updated\" : \"Added to\";\n } else {\n finalContent = generateStandalone(installed);\n action = \"Created\";\n }\n\n if (shouldWrite) {\n fs.writeFileSync(claudePath, finalContent);\n console.log(`\\n✓ ${action} CLAUDE.md`);\n console.log(` Path: ${claudePath}`);\n } else {\n console.log(\"\\nTo create/update CLAUDE.md, run:\");\n console.log(\" npx appkit setup --write\\n\");\n\n if (existingContent) {\n console.log(\n `This will ${\n existingContent.includes(SECTION_START)\n ? \"update the existing\"\n : \"add a new\"\n } AppKit section.\\n`,\n );\n }\n\n console.log(\"Preview of AppKit section:\\n\");\n console.log(\"─\".repeat(50));\n console.log(generateSection(installed));\n console.log(\"─\".repeat(50));\n }\n}\n\nexport const setupCommand = new Command(\"setup\")\n .description(\"Setup CLAUDE.md with AppKit package references\")\n .option(\"-w, --write\", \"Create or update CLAUDE.md file in current directory\")\n .addHelpText(\n \"after\",\n `\nExamples:\n $ appkit setup\n $ appkit setup --write`,\n )\n .action(runSetup);\n"],"mappings":";;;;;AAIA,MAAM,WAAW,CACf;CAAE,MAAM;CAAsB,aAAa;CAAe,EAC1D;CACE,MAAM;CACN,aAAa;CACd,CACF;AAED,MAAM,gBAAgB;AACtB,MAAM,cAAc;;;;AAKpB,SAAS,wBAAwB;CAC/B,MAAM,MAAM,QAAQ,KAAK;CACzB,MAAM,YAAY,EAAE;AAEpB,MAAK,MAAM,OAAO,UAAU;EAC1B,MAAM,cAAc,KAAK,KACvB,KACA,gBACA,IAAI,MACJ,eACD;AACD,MAAI,GAAG,WAAW,YAAY,CAC5B,WAAU,KAAK,IAAI;;AAIvB,QAAO;;;;;AAMT,SAAS,gBAAgB,UAA2B;AAQlD,QAAO,GAAG,cAAc;;;;;EAPV,SACX,KAAK,QAAQ;EACZ,MAAM,UAAU,kBAAkB,IAAI,KAAK;AAC3C,SAAO,OAAO,IAAI,KAAK,MAAM,IAAI,YAAY,MAAM,QAAQ,IAAI,QAAQ;GACvE,CACD,KAAK,KAAK,CAOP;;;;;;;;;EASN;;;;;AAMF,SAAS,mBAAmB,UAA2B;AAQrD,QAAO;;EAEP,cAAc;;;;;EATA,SACX,KAAK,QAAQ;EACZ,MAAM,UAAU,kBA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I,OAAO,OAAO,YAAY;AACtC,UAAQ,IAAI,WAAW,aAAa;QAC/B;AACL,UAAQ,IAAI,qCAAqC;AACjD,UAAQ,IAAI,+BAA+B;AAE3C,MAAI,gBACF,SAAQ,IACN,aACE,gBAAgB,SAAS,cAAc,GACnC,wBACA,YACL,oBACF;AAGH,UAAQ,IAAI,+BAA+B;AAC3C,UAAQ,IAAI,IAAI,OAAO,GAAG,CAAC;AAC3B,UAAQ,IAAI,gBAAgB,UAAU,CAAC;AACvC,UAAQ,IAAI,IAAI,OAAO,GAAG,CAAC;;;AAI/B,MAAa,eAAe,IAAI,QAAQ,QAAQ,CAC7C,YAAY,iDAAiD,CAC7D,OAAO,eAAe,uDAAuD,CAC7E,YACC,SACA;;;0BAID,CACA,OAAO,SAAS"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { UseChartDataOptions, UseChartDataResult, useChartData } from "./use-chart-data.js";
|
|
2
|
-
import { AnalyticsFormat, InferResultByFormat, InferRowType, PluginRegistry, QueryRegistry, TypedArrowTable, UseAnalyticsQueryOptions, UseAnalyticsQueryResult } from "./types.js";
|
|
2
|
+
import { AnalyticsFormat, InferResultByFormat, InferRowType, InferServingChunk, InferServingRequest, InferServingResponse, PluginRegistry, QueryRegistry, ServingAlias, ServingEndpointRegistry, TypedArrowTable, UseAnalyticsQueryOptions, UseAnalyticsQueryResult } from "./types.js";
|
|
3
3
|
import { useAnalyticsQuery } from "./use-analytics-query.js";
|
|
4
|
-
import { usePluginClientConfig } from "./use-plugin-config.js";
|
|
4
|
+
import { usePluginClientConfig } from "./use-plugin-config.js";
|
|
5
|
+
import { UseServingInvokeOptions, UseServingInvokeResult, useServingInvoke } from "./use-serving-invoke.js";
|
|
6
|
+
import { UseServingStreamOptions, UseServingStreamResult, useServingStream } from "./use-serving-stream.js";
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { useAnalyticsQuery } from "./use-analytics-query.js";
|
|
2
2
|
import { useChartData } from "./use-chart-data.js";
|
|
3
3
|
import { usePluginClientConfig } from "./use-plugin-config.js";
|
|
4
|
+
import { useServingInvoke } from "./use-serving-invoke.js";
|
|
5
|
+
import { useServingStream } from "./use-serving-stream.js";
|
|
@@ -44,7 +44,7 @@ interface UseAnalyticsQueryResult<T> {
|
|
|
44
44
|
*
|
|
45
45
|
* @example
|
|
46
46
|
* ```typescript
|
|
47
|
-
* //
|
|
47
|
+
* // shared/appkit-types/analytics.d.ts
|
|
48
48
|
* declare module "@databricks/appkit-ui/react" {
|
|
49
49
|
* interface QueryRegistry {
|
|
50
50
|
* apps_list: {
|
|
@@ -96,6 +96,35 @@ type InferParams<K> = K extends AugmentedRegistry<QueryRegistry> ? QueryRegistry
|
|
|
96
96
|
interface PluginRegistry {
|
|
97
97
|
[key: string]: Record<string, any>;
|
|
98
98
|
}
|
|
99
|
+
/**
|
|
100
|
+
* Serving endpoint registry for type-safe alias names.
|
|
101
|
+
* Extend this interface via module augmentation to get alias autocomplete:
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```typescript
|
|
105
|
+
* // Auto-generated by appKitServingTypesPlugin()
|
|
106
|
+
* declare module "@databricks/appkit-ui/react" {
|
|
107
|
+
* interface ServingEndpointRegistry {
|
|
108
|
+
* llm: { request: {...}; response: {...}; chunk: {...} };
|
|
109
|
+
* }
|
|
110
|
+
* }
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
interface ServingEndpointRegistry {}
|
|
114
|
+
/** Resolves to registry keys if populated, otherwise string */
|
|
115
|
+
type ServingAlias = AugmentedRegistry<ServingEndpointRegistry> extends never ? string : AugmentedRegistry<ServingEndpointRegistry>;
|
|
116
|
+
/** Infers chunk type from registry when alias is a known key */
|
|
117
|
+
type InferServingChunk<K> = K extends AugmentedRegistry<ServingEndpointRegistry> ? ServingEndpointRegistry[K] extends {
|
|
118
|
+
chunk: infer C;
|
|
119
|
+
} ? C : unknown : unknown;
|
|
120
|
+
/** Infers response type from registry when alias is a known key */
|
|
121
|
+
type InferServingResponse<K> = K extends AugmentedRegistry<ServingEndpointRegistry> ? ServingEndpointRegistry[K] extends {
|
|
122
|
+
response: infer R;
|
|
123
|
+
} ? R : unknown : unknown;
|
|
124
|
+
/** Infers request type from registry when alias is a known key */
|
|
125
|
+
type InferServingRequest<K> = K extends AugmentedRegistry<ServingEndpointRegistry> ? ServingEndpointRegistry[K] extends {
|
|
126
|
+
request: infer Req;
|
|
127
|
+
} ? Req : Record<string, unknown> : Record<string, unknown>;
|
|
99
128
|
//#endregion
|
|
100
|
-
export { AnalyticsFormat, InferParams, InferResultByFormat, InferRowType, PluginRegistry, QueryKey, QueryRegistry, TypedArrowTable, UseAnalyticsQueryOptions, UseAnalyticsQueryResult };
|
|
129
|
+
export { AnalyticsFormat, InferParams, InferResultByFormat, InferRowType, InferServingChunk, InferServingRequest, InferServingResponse, PluginRegistry, QueryKey, QueryRegistry, ServingAlias, ServingEndpointRegistry, TypedArrowTable, UseAnalyticsQueryOptions, UseAnalyticsQueryResult };
|
|
101
130
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../src/react/hooks/types.ts"],"mappings":";;;;KAOY,eAAA;AAAZ;;;;;AAYA;;;;;AAZA,UAYiB,eAAA,cACF,MAAA,oBAA0B,MAAA,2BAC/B,KAAA;EAAA;;;;EAAA,SAKC,SAAA,GAAY,IAAA;AAAA;;UAQN,wBAAA,WAAmC,eAAA;EAR7B;EAUrB,MAAA,GAAS,CAAA;EAVgB;EAazB,iBAAA;EALuC;EAQvC,SAAA;AAAA;;UAIe,uBAAA;EAVf;EAYA,IAAA,EAAM,CAAA;EATN;EAWA,OAAA;EARS;EAUT,KAAA;AAAA;;;;;;;;;;;AAqBF;;;;;;;;UAAiB,aAAA;EAAA,CACd,GAAA;IACC,IAAA;IACA,UAAA,EAAY,MAAA;IACZ,MAAA;EAAA;AAAA;;KAKQ,iBAAA,0BACE,CAAA,m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ACnC,GAAA,GACA,MAAA,oBACF,MAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { InferServingRequest, InferServingResponse, ServingAlias } from "./types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/react/hooks/use-serving-invoke.d.ts
|
|
4
|
+
interface UseServingInvokeOptions<K extends ServingAlias = ServingAlias> {
|
|
5
|
+
/** Endpoint alias for named mode. Omit for default mode. */
|
|
6
|
+
alias?: K;
|
|
7
|
+
/** If false, does not invoke automatically on mount. Default: false */
|
|
8
|
+
autoStart?: boolean;
|
|
9
|
+
}
|
|
10
|
+
interface UseServingInvokeResult<T = unknown, TBody = Record<string, unknown>> {
|
|
11
|
+
/** Trigger the invocation. Pass an optional body override for this invocation. */
|
|
12
|
+
invoke: (overrideBody?: TBody) => Promise<T | null>;
|
|
13
|
+
/** Response data, null until loaded. */
|
|
14
|
+
data: T | null;
|
|
15
|
+
/** Whether a request is in progress. */
|
|
16
|
+
loading: boolean;
|
|
17
|
+
/** Error message, if any. */
|
|
18
|
+
error: string | null;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Hook for non-streaming invocation of a serving endpoint.
|
|
22
|
+
* Calls `POST /api/serving/invoke` (default) or `POST /api/serving/{alias}/invoke` (named).
|
|
23
|
+
*
|
|
24
|
+
* When the type generator has populated `ServingEndpointRegistry`, the response type
|
|
25
|
+
* is automatically inferred from the endpoint's OpenAPI schema.
|
|
26
|
+
*/
|
|
27
|
+
declare function useServingInvoke<K extends ServingAlias = ServingAlias>(body: InferServingRequest<K>, options?: UseServingInvokeOptions<K>): UseServingInvokeResult<InferServingResponse<K>, InferServingRequest<K>>;
|
|
28
|
+
//#endregion
|
|
29
|
+
export { UseServingInvokeOptions, UseServingInvokeResult, useServingInvoke };
|
|
30
|
+
//# sourceMappingURL=use-serving-invoke.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-serving-invoke.d.ts","names":[],"sources":["../../../src/react/hooks/use-serving-invoke.ts"],"mappings":";;;UASiB,uBAAA,WACL,YAAA,GAAe,YAAA;;EAGzB,KAAA,GAAQ,CAAA;EAJ8B;EAMtC,SAAA;AAAA;AAAA,UAGe,sBAAA,sBAEP,MAAA;EAPA;EAUR,MAAA,GAAS,YAAA,GAAe,KAAA,KAAU,OAAA,CAAQ,CAAA;EAVjC;EAYT,IAAA,EAAM,CAAA;EAfI;EAiBV,OAAA;EAdA;EAgBA,KAAA;AAAA;;;AAXF;;;;;iBAqBgB,gBAAA,WAA2B,YAAA,GAAe,YAAA,CAAA,CACxD,IAAA,EAAM,mBAAA,CAAoB,CAAA,GAC1B,OAAA,GAAS,uBAAA,CAAwB,CAAA,IAChC,sBAAA,CAAuB,oBAAA,CAAqB,CAAA,GAAI,mBAAA,CAAoB,CAAA"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { usePluginClientConfig } from "./use-plugin-config.js";
|
|
2
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/react/hooks/use-serving-invoke.ts
|
|
5
|
+
/**
|
|
6
|
+
* Hook for non-streaming invocation of a serving endpoint.
|
|
7
|
+
* Calls `POST /api/serving/invoke` (default) or `POST /api/serving/{alias}/invoke` (named).
|
|
8
|
+
*
|
|
9
|
+
* When the type generator has populated `ServingEndpointRegistry`, the response type
|
|
10
|
+
* is automatically inferred from the endpoint's OpenAPI schema.
|
|
11
|
+
*/
|
|
12
|
+
function useServingInvoke(body, options = {}) {
|
|
13
|
+
const { alias, autoStart = false } = options;
|
|
14
|
+
const config = usePluginClientConfig("serving");
|
|
15
|
+
const aliasError = useMemo(() => {
|
|
16
|
+
if (!alias || !config.aliases) return null;
|
|
17
|
+
const aliasStr = String(alias);
|
|
18
|
+
if (!config.aliases.includes(aliasStr)) return `Unknown serving alias "${aliasStr}". Available: ${config.aliases.join(", ")}`;
|
|
19
|
+
return null;
|
|
20
|
+
}, [alias, config.aliases]);
|
|
21
|
+
const [data, setData] = useState(null);
|
|
22
|
+
const [loading, setLoading] = useState(false);
|
|
23
|
+
const [error, setError] = useState(aliasError);
|
|
24
|
+
const abortControllerRef = useRef(null);
|
|
25
|
+
const urlSuffix = alias ? `/api/serving/${encodeURIComponent(String(alias))}/invoke` : "/api/serving/invoke";
|
|
26
|
+
const bodyJson = JSON.stringify(body);
|
|
27
|
+
const invoke = useCallback((overrideBody) => {
|
|
28
|
+
if (aliasError) {
|
|
29
|
+
setError(aliasError);
|
|
30
|
+
return Promise.resolve(null);
|
|
31
|
+
}
|
|
32
|
+
if (abortControllerRef.current) abortControllerRef.current.abort();
|
|
33
|
+
setLoading(true);
|
|
34
|
+
setError(null);
|
|
35
|
+
setData(null);
|
|
36
|
+
const abortController = new AbortController();
|
|
37
|
+
abortControllerRef.current = abortController;
|
|
38
|
+
const payload = overrideBody ? JSON.stringify(overrideBody) : bodyJson;
|
|
39
|
+
return fetch(urlSuffix, {
|
|
40
|
+
method: "POST",
|
|
41
|
+
headers: { "Content-Type": "application/json" },
|
|
42
|
+
body: payload,
|
|
43
|
+
signal: abortController.signal
|
|
44
|
+
}).then(async (res) => {
|
|
45
|
+
if (!res.ok) {
|
|
46
|
+
const errorBody = await res.json().catch(() => null);
|
|
47
|
+
throw new Error(errorBody?.error || `HTTP ${res.status}`);
|
|
48
|
+
}
|
|
49
|
+
return res.json();
|
|
50
|
+
}).then((result) => {
|
|
51
|
+
if (abortController.signal.aborted) return null;
|
|
52
|
+
setData(result);
|
|
53
|
+
setLoading(false);
|
|
54
|
+
return result;
|
|
55
|
+
}).catch((err) => {
|
|
56
|
+
if (abortController.signal.aborted) return null;
|
|
57
|
+
setError(err.message || "Request failed");
|
|
58
|
+
setLoading(false);
|
|
59
|
+
return null;
|
|
60
|
+
});
|
|
61
|
+
}, [
|
|
62
|
+
urlSuffix,
|
|
63
|
+
bodyJson,
|
|
64
|
+
aliasError
|
|
65
|
+
]);
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
if (autoStart) invoke();
|
|
68
|
+
return () => {
|
|
69
|
+
abortControllerRef.current?.abort();
|
|
70
|
+
};
|
|
71
|
+
}, [invoke, autoStart]);
|
|
72
|
+
return {
|
|
73
|
+
invoke,
|
|
74
|
+
data,
|
|
75
|
+
loading,
|
|
76
|
+
error
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
//#endregion
|
|
81
|
+
export { useServingInvoke };
|
|
82
|
+
//# sourceMappingURL=use-serving-invoke.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-serving-invoke.js","names":[],"sources":["../../../src/react/hooks/use-serving-invoke.ts"],"sourcesContent":["import { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport type {\n InferServingRequest,\n InferServingResponse,\n ServingAlias,\n ServingClientConfig,\n} from \"./types\";\nimport { usePluginClientConfig } from \"./use-plugin-config\";\n\nexport interface UseServingInvokeOptions<\n K extends ServingAlias = ServingAlias,\n> {\n /** Endpoint alias for named mode. Omit for default mode. */\n alias?: K;\n /** If false, does not invoke automatically on mount. Default: false */\n autoStart?: boolean;\n}\n\nexport interface UseServingInvokeResult<\n T = unknown,\n TBody = Record<string, unknown>,\n> {\n /** Trigger the invocation. Pass an optional body override for this invocation. */\n invoke: (overrideBody?: TBody) => Promise<T | null>;\n /** Response data, null until loaded. */\n data: T | null;\n /** Whether a request is in progress. */\n loading: boolean;\n /** Error message, if any. */\n error: string | null;\n}\n\n/**\n * Hook for non-streaming invocation of a serving endpoint.\n * Calls `POST /api/serving/invoke` (default) or `POST /api/serving/{alias}/invoke` (named).\n *\n * When the type generator has populated `ServingEndpointRegistry`, the response type\n * is automatically inferred from the endpoint's OpenAPI schema.\n */\nexport function useServingInvoke<K extends ServingAlias = ServingAlias>(\n body: InferServingRequest<K>,\n options: UseServingInvokeOptions<K> = {} as UseServingInvokeOptions<K>,\n): UseServingInvokeResult<InferServingResponse<K>, InferServingRequest<K>> {\n type TResponse = InferServingResponse<K>;\n const { alias, autoStart = false } = options;\n\n const config = usePluginClientConfig<ServingClientConfig>(\"serving\");\n\n const aliasError = useMemo(() => {\n if (!alias || !config.aliases) return null;\n const aliasStr = String(alias);\n if (!config.aliases.includes(aliasStr)) {\n return `Unknown serving alias \"${aliasStr}\". Available: ${config.aliases.join(\", \")}`;\n }\n return null;\n }, [alias, config.aliases]);\n\n const [data, setData] = useState<TResponse | null>(null);\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<string | null>(aliasError);\n const abortControllerRef = useRef<AbortController | null>(null);\n\n const urlSuffix = alias\n ? `/api/serving/${encodeURIComponent(String(alias))}/invoke`\n : \"/api/serving/invoke\";\n\n const bodyJson = JSON.stringify(body);\n\n const invoke = useCallback(\n (overrideBody?: InferServingRequest<K>): Promise<TResponse | null> => {\n if (aliasError) {\n setError(aliasError);\n return Promise.resolve(null);\n }\n\n if (abortControllerRef.current) {\n abortControllerRef.current.abort();\n }\n\n setLoading(true);\n setError(null);\n setData(null);\n\n const abortController = new AbortController();\n abortControllerRef.current = abortController;\n\n const payload = overrideBody ? JSON.stringify(overrideBody) : bodyJson;\n\n return fetch(urlSuffix, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: payload,\n signal: abortController.signal,\n })\n .then(async (res) => {\n if (!res.ok) {\n const errorBody = await res.json().catch(() => null);\n throw new Error(errorBody?.error || `HTTP ${res.status}`);\n }\n return res.json();\n })\n .then((result: TResponse) => {\n if (abortController.signal.aborted) return null;\n setData(result);\n setLoading(false);\n return result;\n })\n .catch((err: Error) => {\n if (abortController.signal.aborted) return null;\n setError(err.message || \"Request failed\");\n setLoading(false);\n return null;\n });\n },\n [urlSuffix, bodyJson, aliasError],\n );\n\n useEffect(() => {\n if (autoStart) {\n invoke();\n }\n\n return () => {\n abortControllerRef.current?.abort();\n };\n }, [invoke, autoStart]);\n\n return { invoke, data, loading, error };\n}\n"],"mappings":";;;;;;;;;;;AAuCA,SAAgB,iBACd,MACA,UAAsC,EAAE,EACi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,MAAM,WAAsB;AAC3B,OAAI,gBAAgB,OAAO,QAAS,QAAO;AAC3C,WAAQ,OAAO;AACf,cAAW,MAAM;AACjB,UAAO;IACP,CACD,OAAO,QAAe;AACrB,OAAI,gBAAgB,OAAO,QAAS,QAAO;AAC3C,YAAS,IAAI,WAAW,iBAAiB;AACzC,cAAW,MAAM;AACjB,UAAO;IACP;IAEN;EAAC;EAAW;EAAU;EAAW,CAClC;AAED,iBAAgB;AACd,MAAI,UACF,SAAQ;AAGV,eAAa;AACX,sBAAmB,SAAS,OAAO;;IAEpC,CAAC,QAAQ,UAAU,CAAC;AAEvB,QAAO;EAAE;EAAQ;EAAM;EAAS;EAAO"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { InferServingChunk, InferServingRequest, ServingAlias } from "./types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/react/hooks/use-serving-stream.d.ts
|
|
4
|
+
interface UseServingStreamOptions<K extends ServingAlias = ServingAlias, T = InferServingChunk<K>> {
|
|
5
|
+
/** Endpoint alias for named mode. Omit for default mode. */
|
|
6
|
+
alias?: K;
|
|
7
|
+
/** If true, starts streaming automatically on mount. Default: false */
|
|
8
|
+
autoStart?: boolean;
|
|
9
|
+
/** Called with accumulated chunks when the stream completes successfully. */
|
|
10
|
+
onComplete?: (chunks: T[]) => void;
|
|
11
|
+
}
|
|
12
|
+
interface UseServingStreamResult<T = unknown, TBody = Record<string, unknown>> {
|
|
13
|
+
/** Trigger the streaming invocation. Pass an optional body override for this invocation. */
|
|
14
|
+
stream: (overrideBody?: TBody) => void;
|
|
15
|
+
/** Accumulated chunks received so far. */
|
|
16
|
+
chunks: T[];
|
|
17
|
+
/** Whether streaming is in progress. */
|
|
18
|
+
streaming: boolean;
|
|
19
|
+
/** Error message, if any. */
|
|
20
|
+
error: string | null;
|
|
21
|
+
/** Reset chunks and abort any active stream. */
|
|
22
|
+
reset: () => void;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Hook for streaming invocation of a serving endpoint via SSE.
|
|
26
|
+
* Calls `POST /api/serving/stream` (default) or `POST /api/serving/{alias}/stream` (named).
|
|
27
|
+
* Accumulates parsed chunks in state.
|
|
28
|
+
*
|
|
29
|
+
* When the type generator has populated `ServingEndpointRegistry`, the chunk type
|
|
30
|
+
* is automatically inferred from the endpoint's OpenAPI schema.
|
|
31
|
+
*/
|
|
32
|
+
declare function useServingStream<K extends ServingAlias = ServingAlias>(body: InferServingRequest<K>, options?: UseServingStreamOptions<K>): UseServingStreamResult<InferServingChunk<K>, InferServingRequest<K>>;
|
|
33
|
+
//#endregion
|
|
34
|
+
export { UseServingStreamOptions, UseServingStreamResult, useServingStream };
|
|
35
|
+
//# sourceMappingURL=use-serving-stream.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-serving-stream.d.ts","names":[],"sources":["../../../src/react/hooks/use-serving-stream.ts"],"mappings":";;;UAUiB,uBAAA,WACL,YAAA,GAAe,YAAA,MACrB,iBAAA,CAAkB,CAAA;;EAGtB,KAAA,GAAQ,CAAA;EAL8B;EAOtC,SAAA;EANU;EAQV,UAAA,IAAc,MAAA,EAAQ,CAAA;AAAA;AAAA,UAGP,sBAAA,sBAEP,MAAA;EATA;EAYR,MAAA,GAAS,YAAA,GAAe,KAAA;EARD;EAUvB,MAAA,EAAQ,CAAA;EAlBR;EAoBA,SAAA;EApByB;EAsBzB,KAAA;EArBI;EAuBJ,KAAA;AAAA;;;;;;;;AAbF;iBAwBgB,gBAAA,WAA2B,YAAA,GAAe,YAAA,CAAA,CACxD,IAAA,EAAM,mBAAA,CAAoB,CAAA,GAC1B,OAAA,GAAS,uBAAA,CAAwB,CAAA,IAChC,sBAAA,CAAuB,iBAAA,CAAkB,CAAA,GAAI,mBAAA,CAAoB,CAAA"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { connectSSE } from "../../js/sse/connect-sse.js";
|
|
2
|
+
import "../../js/index.js";
|
|
3
|
+
import { usePluginClientConfig } from "./use-plugin-config.js";
|
|
4
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
5
|
+
|
|
6
|
+
//#region src/react/hooks/use-serving-stream.ts
|
|
7
|
+
/**
|
|
8
|
+
* Hook for streaming invocation of a serving endpoint via SSE.
|
|
9
|
+
* Calls `POST /api/serving/stream` (default) or `POST /api/serving/{alias}/stream` (named).
|
|
10
|
+
* Accumulates parsed chunks in state.
|
|
11
|
+
*
|
|
12
|
+
* When the type generator has populated `ServingEndpointRegistry`, the chunk type
|
|
13
|
+
* is automatically inferred from the endpoint's OpenAPI schema.
|
|
14
|
+
*/
|
|
15
|
+
function useServingStream(body, options = {}) {
|
|
16
|
+
const { alias, autoStart = false, onComplete } = options;
|
|
17
|
+
const config = usePluginClientConfig("serving");
|
|
18
|
+
const aliasError = useMemo(() => {
|
|
19
|
+
if (!alias || !config.aliases) return null;
|
|
20
|
+
const aliasStr = String(alias);
|
|
21
|
+
if (!config.aliases.includes(aliasStr)) return `Unknown serving alias "${aliasStr}". Available: ${config.aliases.join(", ")}`;
|
|
22
|
+
return null;
|
|
23
|
+
}, [alias, config.aliases]);
|
|
24
|
+
const [chunks, setChunks] = useState([]);
|
|
25
|
+
const [streaming, setStreaming] = useState(false);
|
|
26
|
+
const [error, setError] = useState(aliasError);
|
|
27
|
+
const abortControllerRef = useRef(null);
|
|
28
|
+
const chunksRef = useRef([]);
|
|
29
|
+
const onCompleteRef = useRef(onComplete);
|
|
30
|
+
onCompleteRef.current = onComplete;
|
|
31
|
+
const urlSuffix = alias ? `/api/serving/${encodeURIComponent(String(alias))}/stream` : "/api/serving/stream";
|
|
32
|
+
const reset = useCallback(() => {
|
|
33
|
+
abortControllerRef.current?.abort();
|
|
34
|
+
abortControllerRef.current = null;
|
|
35
|
+
chunksRef.current = [];
|
|
36
|
+
setChunks([]);
|
|
37
|
+
setStreaming(false);
|
|
38
|
+
setError(null);
|
|
39
|
+
}, []);
|
|
40
|
+
const bodyJson = JSON.stringify(body);
|
|
41
|
+
const stream = useCallback((overrideBody) => {
|
|
42
|
+
if (aliasError) {
|
|
43
|
+
setError(aliasError);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
abortControllerRef.current?.abort();
|
|
47
|
+
setStreaming(true);
|
|
48
|
+
setError(null);
|
|
49
|
+
setChunks([]);
|
|
50
|
+
chunksRef.current = [];
|
|
51
|
+
const abortController = new AbortController();
|
|
52
|
+
abortControllerRef.current = abortController;
|
|
53
|
+
connectSSE({
|
|
54
|
+
url: urlSuffix,
|
|
55
|
+
payload: overrideBody ? JSON.stringify(overrideBody) : bodyJson,
|
|
56
|
+
signal: abortController.signal,
|
|
57
|
+
onMessage: async (message) => {
|
|
58
|
+
if (abortController.signal.aborted) return;
|
|
59
|
+
try {
|
|
60
|
+
const parsed = JSON.parse(message.data);
|
|
61
|
+
chunksRef.current = [...chunksRef.current, parsed];
|
|
62
|
+
setChunks(chunksRef.current);
|
|
63
|
+
} catch {}
|
|
64
|
+
},
|
|
65
|
+
onError: (err) => {
|
|
66
|
+
if (abortController.signal.aborted) return;
|
|
67
|
+
setStreaming(false);
|
|
68
|
+
setError(err instanceof Error ? err.message : "Streaming failed");
|
|
69
|
+
}
|
|
70
|
+
}).then(() => {
|
|
71
|
+
if (abortController.signal.aborted) return;
|
|
72
|
+
setStreaming(false);
|
|
73
|
+
onCompleteRef.current?.(chunksRef.current);
|
|
74
|
+
}).catch(() => {
|
|
75
|
+
if (abortController.signal.aborted) return;
|
|
76
|
+
setStreaming(false);
|
|
77
|
+
setError("Connection error");
|
|
78
|
+
});
|
|
79
|
+
}, [
|
|
80
|
+
urlSuffix,
|
|
81
|
+
bodyJson,
|
|
82
|
+
aliasError
|
|
83
|
+
]);
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
if (autoStart) stream();
|
|
86
|
+
return () => {
|
|
87
|
+
abortControllerRef.current?.abort();
|
|
88
|
+
};
|
|
89
|
+
}, [stream, autoStart]);
|
|
90
|
+
return {
|
|
91
|
+
stream,
|
|
92
|
+
chunks,
|
|
93
|
+
streaming,
|
|
94
|
+
error,
|
|
95
|
+
reset
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
//#endregion
|
|
100
|
+
export { useServingStream };
|
|
101
|
+
//# sourceMappingURL=use-serving-stream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-serving-stream.js","names":[],"sources":["../../../src/react/hooks/use-serving-stream.ts"],"sourcesContent":["import { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { connectSSE } from \"@/js\";\nimport type {\n InferServingChunk,\n InferServingRequest,\n ServingAlias,\n ServingClientConfig,\n} from \"./types\";\nimport { usePluginClientConfig } from \"./use-plugin-config\";\n\nexport interface UseServingStreamOptions<\n K extends ServingAlias = ServingAlias,\n T = InferServingChunk<K>,\n> {\n /** Endpoint alias for named mode. Omit for default mode. */\n alias?: K;\n /** If true, starts streaming automatically on mount. Default: false */\n autoStart?: boolean;\n /** Called with accumulated chunks when the stream completes successfully. */\n onComplete?: (chunks: T[]) => void;\n}\n\nexport interface UseServingStreamResult<\n T = unknown,\n TBody = Record<string, unknown>,\n> {\n /** Trigger the streaming invocation. Pass an optional body override for this invocation. */\n stream: (overrideBody?: TBody) => void;\n /** Accumulated chunks received so far. */\n chunks: T[];\n /** Whether streaming is in progress. */\n streaming: boolean;\n /** Error message, if any. */\n error: string | null;\n /** Reset chunks and abort any active stream. */\n reset: () => void;\n}\n\n/**\n * Hook for streaming invocation of a serving endpoint via SSE.\n * Calls `POST /api/serving/stream` (default) or `POST /api/serving/{alias}/stream` (named).\n * Accumulates parsed chunks in state.\n *\n * When the type generator has populated `ServingEndpointRegistry`, the chunk type\n * is automatically inferred from the endpoint's OpenAPI schema.\n */\nexport function useServingStream<K extends ServingAlias = ServingAlias>(\n body: InferServingRequest<K>,\n options: UseServingStreamOptions<K> = {} as UseServingStreamOptions<K>,\n): UseServingStreamResult<InferServingChunk<K>, InferServingRequest<K>> {\n type TChunk = InferServingChunk<K>;\n const { alias, autoStart = false, onComplete } = options;\n\n const config = usePluginClientConfig<ServingClientConfig>(\"serving\");\n\n const aliasError = useMemo(() => {\n if (!alias || !config.aliases) return null;\n const aliasStr = String(alias);\n if (!config.aliases.includes(aliasStr)) {\n return `Unknown serving alias \"${aliasStr}\". Available: ${config.aliases.join(\", \")}`;\n }\n return null;\n }, [alias, config.aliases]);\n\n const [chunks, setChunks] = useState<TChunk[]>([]);\n const [streaming, setStreaming] = useState(false);\n const [error, setError] = useState<string | null>(aliasError);\n const abortControllerRef = useRef<AbortController | null>(null);\n const chunksRef = useRef<TChunk[]>([]);\n const onCompleteRef = useRef(onComplete);\n onCompleteRef.current = onComplete;\n\n const urlSuffix = alias\n ? `/api/serving/${encodeURIComponent(String(alias))}/stream`\n : \"/api/serving/stream\";\n\n const reset = useCallback(() => {\n abortControllerRef.current?.abort();\n abortControllerRef.current = null;\n chunksRef.current = [];\n setChunks([]);\n setStreaming(false);\n setError(null);\n }, []);\n\n const bodyJson = JSON.stringify(body);\n\n const stream = useCallback(\n (overrideBody?: InferServingRequest<K>) => {\n if (aliasError) {\n setError(aliasError);\n return;\n }\n\n // Abort any existing stream\n abortControllerRef.current?.abort();\n\n setStreaming(true);\n setError(null);\n setChunks([]);\n chunksRef.current = [];\n\n const abortController = new AbortController();\n abortControllerRef.current = abortController;\n\n const payload = overrideBody ? JSON.stringify(overrideBody) : bodyJson;\n\n connectSSE({\n url: urlSuffix,\n payload,\n signal: abortController.signal,\n onMessage: async (message) => {\n if (abortController.signal.aborted) return;\n try {\n const parsed = JSON.parse(message.data);\n\n chunksRef.current = [...chunksRef.current, parsed as TChunk];\n setChunks(chunksRef.current);\n } catch {\n // Skip malformed messages\n }\n },\n onError: (err) => {\n if (abortController.signal.aborted) return;\n setStreaming(false);\n setError(err instanceof Error ? err.message : \"Streaming failed\");\n },\n })\n .then(() => {\n if (abortController.signal.aborted) return;\n // Stream completed\n setStreaming(false);\n onCompleteRef.current?.(chunksRef.current);\n })\n .catch(() => {\n if (abortController.signal.aborted) return;\n setStreaming(false);\n setError(\"Connection error\");\n });\n },\n [urlSuffix, bodyJson, aliasError],\n );\n\n useEffect(() => {\n if (autoStart) {\n stream();\n }\n\n return () => {\n abortControllerRef.current?.abort();\n };\n }, [stream, autoStart]);\n\n return { stream, chunks, streaming, error, reset };\n}\n"],"mappings":";;;;;;;;;;;;;;AA8CA,SAAgB,iBACd,MACA,UAAsC,EAAE,EAC8B;CAEtE,MAAM,EAAE,OAAO,YAAY,OAAO,eAAe;CAEjD,MAAM,SAAS,sBAA2C,UAAU;CAEpE,MAAM,aAAa,cAAc;AAC/B,MAAI,CAAC,SAAS,CAAC,OAAO,QAAS,QAAO;EACtC,MAAM,WAAW,OAAO,MAAM;AAC9B,MAAI,CAAC,OAAO,QAAQ,SAAS,SAAS,CACpC,QAAO,0BAA0B,SAAS,gBAAgB,OAAO,QAAQ,KAAK,KAAK;AAErF,SAAO;IACN,CAAC,OAAO,OAAO,QAAQ,CAAC;CAE3B,MAAM,CAAC,QAAQ,aAAa,SAAmB,EAAE,CAAC;CAClD,MAAM,CAAC,WAAW,gBAAgB,SAAS,MAAM;CACjD,MAAM,CAAC,OAAO,YAAY,SAAwB,WAAW;CAC7D,MAAM,qBAAqB,OAA+B,KAAK;CAC/D,MAAM,YAAY,OAAiB,EAAE,CAAC;CACtC,MAAM,gBAAgB,OAAO,WAAW;AACxC,eAAc,UAAU;CAExB,MAAM,YAAY,QACd,gBAAgB,mBAAmB,OAAO,MAAM,CAAC,CAAC,WAClD;CAEJ,MAAM,QAAQ,kBAAkB;AAC9B,qBAAmB,SAAS,OAAO;AACnC,qBAAmB,UAAU;AAC7B,YAAU,UAAU,EAAE;AACtB,YAAU,EAAE,CAAC;AACb,eAAa,MAAM;AACnB,WAAS,KAAK;IACb,EAAE,CAAC;CAEN,MAAM,WAAW,KAAK,UAAU,KAAK;CAErC,MAAM,SAAS,aACZ,iBAA0C;AACzC,MAAI,YAAY;AACd,YAAS,WAAW;AACpB;;AAIF,qBAAmB,SAAS,OAAO;AAEnC,eAAa,KAAK;AAClB,WAAS,KAAK;AACd,YAAU,EAAE,CAAC;AACb,YAAU,UAAU,EAAE;EAEtB,MAAM,kBAAkB,IAAI,iBAAiB;AAC7C,qBAAmB,UAAU;AAI7B,aAAW;GACT,KAAK;GACL,SAJc,eAAe,KAAK,UAAU,aAAa,GAAG;GAK5D,QAAQ,gBAAgB;GACxB,WAAW,OAAO,YAAY;AAC5B,QAAI,gBAAgB,OAAO,QAAS;AACpC,QAAI;KACF,MAAM,SAAS,KAAK,MAAM,QAAQ,KAAK;AAEvC,eAAU,UAAU,CAAC,GAAG,UAAU,SAAS,OAAiB;AAC5D,eAAU,UAAU,QAAQ;YACtB;;GAIV,UAAU,QAAQ;AAChB,QAAI,gBAAgB,OAAO,QAAS;AACpC,iBAAa,MAAM;AACnB,aAAS,eAAe,QAAQ,IAAI,UAAU,mBAAmB;;GAEpE,CAAC,CACC,WAAW;AACV,OAAI,gBAAgB,OAAO,QAAS;AAEpC,gBAAa,MAAM;AACnB,iBAAc,UAAU,UAAU,QAAQ;IAC1C,CACD,YAAY;AACX,OAAI,gBAAgB,OAAO,QAAS;AACpC,gBAAa,MAAM;AACnB,YAAS,mBAAmB;IAC5B;IAEN;EAAC;EAAW;EAAU;EAAW,CAClC;AAED,iBAAgB;AACd,MAAI,UACF,SAAQ;AAGV,eAAa;AACX,sBAAmB,SAAS,OAAO;;IAEpC,CAAC,QAAQ,UAAU,CAAC;AAEvB,QAAO;EAAE;EAAQ;EAAQ;EAAW;EAAO;EAAO"}
|
package/dist/react/index.d.ts
CHANGED
|
@@ -36,9 +36,11 @@ import { GenieChatMessageList } from "./genie/genie-chat-message-list.js";
|
|
|
36
36
|
import { GenieQueryVisualization } from "./genie/genie-query-visualization.js";
|
|
37
37
|
import { useGenieChat } from "./genie/use-genie-chat.js";
|
|
38
38
|
import "./genie/index.js";
|
|
39
|
-
import { AnalyticsFormat, InferResultByFormat, InferRowType, PluginRegistry, QueryRegistry, TypedArrowTable, UseAnalyticsQueryOptions, UseAnalyticsQueryResult } from "./hooks/types.js";
|
|
39
|
+
import { AnalyticsFormat, InferResultByFormat, InferRowType, InferServingChunk, InferServingRequest, InferServingResponse, PluginRegistry, QueryRegistry, ServingAlias, ServingEndpointRegistry, TypedArrowTable, UseAnalyticsQueryOptions, UseAnalyticsQueryResult } from "./hooks/types.js";
|
|
40
40
|
import { useAnalyticsQuery } from "./hooks/use-analytics-query.js";
|
|
41
41
|
import { usePluginClientConfig } from "./hooks/use-plugin-config.js";
|
|
42
|
+
import { UseServingInvokeOptions, UseServingInvokeResult, useServingInvoke } from "./hooks/use-serving-invoke.js";
|
|
43
|
+
import { UseServingStreamOptions, UseServingStreamResult, useServingStream } from "./hooks/use-serving-stream.js";
|
|
42
44
|
import "./hooks/index.js";
|
|
43
45
|
import { cn } from "./lib/utils.js";
|
|
44
46
|
import { PortalContainerContext, PortalContainerProvider, usePortalContainer, useResolvedPortalContainer } from "./portal-container-context.js";
|
|
@@ -98,4 +100,4 @@ import { Textarea } from "./ui/textarea.js";
|
|
|
98
100
|
import { Toggle, toggleVariants } from "./ui/toggle.js";
|
|
99
101
|
import { ToggleGroup, ToggleGroupItem } from "./ui/toggle-group.js";
|
|
100
102
|
import "./ui/index.js";
|
|
101
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AnalyticsFormat, AreaChart, AreaChartProps, AreaChartSpecificProps, AspectRatio, Avatar, AvatarFallback, AvatarImage, Badge, BarChart, BarChartProps, BarChartSpecificProps, BaseChart, BaseChartProps, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, CHART_COLOR_VARS, CHART_COLOR_VARS_CATEGORICAL, CHART_COLOR_VARS_DIVERGING, CHART_COLOR_VARS_SEQUENTIAL, Calendar, CalendarDayButton, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CarouselApi, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, CartesianContext, ChartBaseProps, ChartColorPalette, ChartConfig, ChartContainer, ChartData, ChartInference, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, ChartType, ChartWrapper, ChartWrapperProps, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, ColumnCategory, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, DATE_FIELD_PATTERNS, DataFormat, DataProps, DataTable, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DirectoryEntry, DirectoryList, DirectoryListProps, DonutChart, DonutChartProps, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, FALLBACK_COLORS_CATEGORICAL, FALLBACK_COLORS_DIVERGING, FALLBACK_COLORS_SEQUENTIAL, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, FileBreadcrumb, FileBreadcrumbProps, FileBrowserLabels, FileEntry, FileEntryProps, FilePreview, FilePreviewPanel, FilePreviewPanelProps, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, GenieAttachmentResponse, GenieChat, GenieChatInput, GenieChatMessage, GenieChatMessageList, GenieChatProps, GenieChatStatus, GenieColumnMeta, GenieMessageItem, GenieMessageResponse, GenieQueryVisualization, GenieStatementResponse, GenieStreamEvent, HeatmapChart, HeatmapChartProps, HeatmapChartSpecificProps, HeatmapContext, HoverCard, HoverCardContent, HoverCardTrigger, InferResultByFormat, InferRowType, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, ItemSeparator, ItemTitle, Kbd, KbdGroup, Label, LineChart, LineChartProps, LineChartSpecificProps, METADATA_DATE_PATTERNS, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, NAME_FIELD_PATTERNS, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, NewFolderInput, NewFolderInputProps, NormalizedChartData, NormalizedChartDataBase, NormalizedHeatmapData, OptionBuilderContext, Orientation, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PieChart, PieChartProps, PieChartSpecificProps, PluginRegistry, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, PortalContainerContext, PortalContainerProvider, Progress, QueryProps, QueryRegistry, RadarChart, RadarChartProps, RadarChartSpecificProps, RadioGroup, RadioGroupItem, ResizableHandle, ResizablePanel, ResizablePanelGroup, ScatterChart, ScatterChartProps, ScatterChartSpecificProps, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, Spinner, Switch, TERMINAL_STATUSES, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TransformedGenieData, TypedArrowTable, UnifiedChartProps, UseAnalyticsQueryOptions, UseAnalyticsQueryResult, UseChartDataOptions, UseChartDataResult, UseGenieChatOptions, UseGenieChatReturn, badgeVariants, buildCartesianOption, buildHeatmapOption, buildHorizontalBarOption, buildPieOption, buildRadarOption, buttonGroupVariants, buttonVariants, cn, createChart, createTimeSeriesData, formatFileSize, formatLabel, getCompatibleChartTypes, inferChartType, isArrowTable, isDataProps, isQueryProps, navigationMenuTriggerStyle, normalizeChartData, normalizeHeatmapData, sortTimeSeriesAscending, toChartArray, toChartValue, toggleVariants, transformGenieData, truncateLabel, useAllThemeColors, useAnalyticsQuery, useChartData, useFormField, useGenieChat, usePluginClientConfig, usePortalContainer, useResolvedPortalContainer, useSidebar, useThemeColors };
|
|
103
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AnalyticsFormat, AreaChart, AreaChartProps, AreaChartSpecificProps, AspectRatio, Avatar, AvatarFallback, AvatarImage, Badge, BarChart, BarChartProps, BarChartSpecificProps, BaseChart, BaseChartProps, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, CHART_COLOR_VARS, CHART_COLOR_VARS_CATEGORICAL, CHART_COLOR_VARS_DIVERGING, CHART_COLOR_VARS_SEQUENTIAL, Calendar, CalendarDayButton, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CarouselApi, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, CartesianContext, ChartBaseProps, ChartColorPalette, ChartConfig, ChartContainer, ChartData, ChartInference, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, ChartType, ChartWrapper, ChartWrapperProps, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, ColumnCategory, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, DATE_FIELD_PATTERNS, DataFormat, DataProps, DataTable, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DirectoryEntry, DirectoryList, DirectoryListProps, DonutChart, DonutChartProps, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, FALLBACK_COLORS_CATEGORICAL, FALLBACK_COLORS_DIVERGING, FALLBACK_COLORS_SEQUENTIAL, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, FileBreadcrumb, FileBreadcrumbProps, FileBrowserLabels, FileEntry, FileEntryProps, FilePreview, FilePreviewPanel, FilePreviewPanelProps, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, GenieAttachmentResponse, GenieChat, GenieChatInput, GenieChatMessage, GenieChatMessageList, GenieChatProps, GenieChatStatus, GenieColumnMeta, GenieMessageItem, GenieMessageResponse, GenieQueryVisualization, GenieStatementResponse, GenieStreamEvent, HeatmapChart, HeatmapChartProps, HeatmapChartSpecificProps, HeatmapContext, HoverCard, HoverCardContent, HoverCardTrigger, InferResultByFormat, InferRowType, InferServingChunk, InferServingRequest, InferServingResponse, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, ItemSeparator, ItemTitle, Kbd, KbdGroup, Label, LineChart, LineChartProps, LineChartSpecificProps, METADATA_DATE_PATTERNS, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, NAME_FIELD_PATTERNS, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, NewFolderInput, NewFolderInputProps, NormalizedChartData, NormalizedChartDataBase, NormalizedHeatmapData, OptionBuilderContext, Orientation, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PieChart, PieChartProps, PieChartSpecificProps, PluginRegistry, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, PortalContainerContext, PortalContainerProvider, Progress, QueryProps, QueryRegistry, RadarChart, RadarChartProps, RadarChartSpecificProps, RadioGroup, RadioGroupItem, ResizableHandle, ResizablePanel, ResizablePanelGroup, ScatterChart, ScatterChartProps, ScatterChartSpecificProps, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, ServingAlias, ServingEndpointRegistry, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, Spinner, Switch, TERMINAL_STATUSES, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TransformedGenieData, TypedArrowTable, UnifiedChartProps, UseAnalyticsQueryOptions, UseAnalyticsQueryResult, UseChartDataOptions, UseChartDataResult, UseGenieChatOptions, UseGenieChatReturn, UseServingInvokeOptions, UseServingInvokeResult, UseServingStreamOptions, UseServingStreamResult, badgeVariants, buildCartesianOption, buildHeatmapOption, buildHorizontalBarOption, buildPieOption, buildRadarOption, buttonGroupVariants, buttonVariants, cn, createChart, createTimeSeriesData, formatFileSize, formatLabel, getCompatibleChartTypes, inferChartType, isArrowTable, isDataProps, isQueryProps, navigationMenuTriggerStyle, normalizeChartData, normalizeHeatmapData, sortTimeSeriesAscending, toChartArray, toChartValue, toggleVariants, transformGenieData, truncateLabel, useAllThemeColors, useAnalyticsQuery, useChartData, useFormField, useGenieChat, usePluginClientConfig, usePortalContainer, useResolvedPortalContainer, useServingInvoke, useServingStream, useSidebar, useThemeColors };
|