@onyx.dev/onyx-database 2.1.0 → 2.1.1

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.
@@ -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) {
@@ -2353,7 +2352,7 @@ function normalizeIntrospection(raw) {
2353
2352
  async function fetchSchemaFromApi(config) {
2354
2353
  const db = onyx.init({
2355
2354
  baseUrl: config.baseUrl,
2356
- databaseId: config.databaseId,
2355
+ ...config.databaseId ? { databaseId: config.databaseId } : {},
2357
2356
  apiKey: config.apiKey,
2358
2357
  apiSecret: config.apiSecret,
2359
2358
  fetch: config.fetch
@@ -2376,12 +2375,11 @@ async function generateTypes(options) {
2376
2375
  if (!schemaInput) {
2377
2376
  if (opts.source === "file") throw new Error("Failed to read schema from file");
2378
2377
  const cfg = await resolveConfig({});
2379
- if (!cfg.databaseId) {
2380
- throw new Error("Missing databaseId. Set ONYX_DATABASE_ID or pass to onyx.init().");
2381
- }
2382
- if (!opts.quiet)
2383
- process__default.default.stderr.write(`[onyx-gen] fetching schema from API for db ${cfg.databaseId}
2378
+ if (!opts.quiet) {
2379
+ const target = cfg.databaseId ? `db ${cfg.databaseId}` : "default database context";
2380
+ process__default.default.stderr.write(`[onyx-gen] fetching schema from API for ${target}
2384
2381
  `);
2382
+ }
2385
2383
  schemaInput = await fetchSchemaFromApi(cfg);
2386
2384
  }
2387
2385
  const schema = normalizeIntrospection(schemaInput);