@onyx.dev/onyx-database 2.1.0 → 2.3.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/README.md +27 -1
- package/dist/{aggregates-DREvey7b.d.cts → aggregates-BpGa31jk.d.cts} +46 -2
- package/dist/{aggregates-DREvey7b.d.ts → aggregates-BpGa31jk.d.ts} +46 -2
- package/dist/edge.cjs +22 -2
- package/dist/edge.cjs.map +1 -1
- package/dist/edge.d.cts +2 -2
- package/dist/edge.d.ts +2 -2
- package/dist/edge.js +22 -2
- package/dist/edge.js.map +1 -1
- package/dist/gen/cli/generate.cjs +26 -7
- package/dist/gen/cli/generate.cjs.map +1 -1
- package/dist/index.cjs +22 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +22 -2
- package/dist/index.js.map +1 -1
- package/dist/schema/cli/schema.cjs +21 -1
- package/dist/schema/cli/schema.cjs.map +1 -1
- package/package.json +5 -2
|
@@ -231,7 +231,6 @@ async function resolveConfig(input) {
|
|
|
231
231
|
const maxRetries = retryConfig.maxRetries ?? 3;
|
|
232
232
|
const retryInitialDelayMs = retryConfig.initialDelayMs ?? 300;
|
|
233
233
|
const missing = [];
|
|
234
|
-
if (!databaseId) missing.push("databaseId");
|
|
235
234
|
if (!apiKey) missing.push("apiKey");
|
|
236
235
|
if (!apiSecret) missing.push("apiSecret");
|
|
237
236
|
if (missing.length) {
|
|
@@ -1521,6 +1520,27 @@ var OnyxDatabaseImpl = class {
|
|
|
1521
1520
|
const { http } = await this.ensureAiClient();
|
|
1522
1521
|
return http.request("POST", "/api/script-approvals", input);
|
|
1523
1522
|
}
|
|
1523
|
+
async predict(publishedModelId, inputs) {
|
|
1524
|
+
const { http, databaseId } = await this.ensureClient();
|
|
1525
|
+
const path = `/data/${encodeURIComponent(
|
|
1526
|
+
databaseId
|
|
1527
|
+
)}/model-builder/published-model/${encodeURIComponent(publishedModelId)}/predict`;
|
|
1528
|
+
return http.request(
|
|
1529
|
+
"POST",
|
|
1530
|
+
path,
|
|
1531
|
+
serializeDates({ inputs })
|
|
1532
|
+
);
|
|
1533
|
+
}
|
|
1534
|
+
async predictFromScript(publishedModelId, scriptId, scriptParameters = {}) {
|
|
1535
|
+
const { http, databaseId } = await this.ensureClient();
|
|
1536
|
+
const path = `/data/${encodeURIComponent(
|
|
1537
|
+
databaseId
|
|
1538
|
+
)}/model-builder/published-model/${encodeURIComponent(publishedModelId)}/predict/script`;
|
|
1539
|
+
return http.request("POST", path, {
|
|
1540
|
+
scriptId,
|
|
1541
|
+
scriptParameters
|
|
1542
|
+
});
|
|
1543
|
+
}
|
|
1524
1544
|
from(table) {
|
|
1525
1545
|
return new QueryBuilderImpl(this, String(table), this.defaultPartition);
|
|
1526
1546
|
}
|
|
@@ -2353,7 +2373,7 @@ function normalizeIntrospection(raw) {
|
|
|
2353
2373
|
async function fetchSchemaFromApi(config) {
|
|
2354
2374
|
const db = onyx.init({
|
|
2355
2375
|
baseUrl: config.baseUrl,
|
|
2356
|
-
databaseId: config.databaseId,
|
|
2376
|
+
...config.databaseId ? { databaseId: config.databaseId } : {},
|
|
2357
2377
|
apiKey: config.apiKey,
|
|
2358
2378
|
apiSecret: config.apiSecret,
|
|
2359
2379
|
fetch: config.fetch
|
|
@@ -2376,12 +2396,11 @@ async function generateTypes(options) {
|
|
|
2376
2396
|
if (!schemaInput) {
|
|
2377
2397
|
if (opts.source === "file") throw new Error("Failed to read schema from file");
|
|
2378
2398
|
const cfg = await resolveConfig({});
|
|
2379
|
-
if (!
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
if (!opts.quiet)
|
|
2383
|
-
process__default.default.stderr.write(`[onyx-gen] fetching schema from API for db ${cfg.databaseId}
|
|
2399
|
+
if (!opts.quiet) {
|
|
2400
|
+
const target = cfg.databaseId ? `db ${cfg.databaseId}` : "default database context";
|
|
2401
|
+
process__default.default.stderr.write(`[onyx-gen] fetching schema from API for ${target}
|
|
2384
2402
|
`);
|
|
2403
|
+
}
|
|
2385
2404
|
schemaInput = await fetchSchemaFromApi(cfg);
|
|
2386
2405
|
}
|
|
2387
2406
|
const schema = normalizeIntrospection(schemaInput);
|