deepspace 0.29.0 → 0.29.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.
package/dist/cli.js CHANGED
@@ -301,6 +301,49 @@ function apiFetchReadWithRetry(baseUrl, token, path) {
301
301
  function isTransientFailure(error) {
302
302
  return error instanceof ApiError && (error.status === 0 || error.status === 408 || error.status === 429 || error.status >= 500);
303
303
  }
304
+ async function fetchIntegrationCatalog(baseUrl, opts = {}) {
305
+ const path = opts.summary ? "/api/integrations?summary=1" : "/api/integrations";
306
+ let res;
307
+ try {
308
+ res = await fetch(`${baseUrl}${path}`, { signal: AbortSignal.timeout(15e3) });
309
+ } catch (err) {
310
+ throw new ApiError(
311
+ `Could not fetch the integration catalog: ${err instanceof Error ? err.message : String(err)}`,
312
+ 0,
313
+ "catalog_unavailable",
314
+ path
315
+ );
316
+ }
317
+ if (!res.ok) {
318
+ throw new ApiError(
319
+ `Failed to fetch integration catalog (${res.status})`,
320
+ res.status,
321
+ "catalog_unavailable",
322
+ path
323
+ );
324
+ }
325
+ let value;
326
+ try {
327
+ value = await res.json();
328
+ } catch {
329
+ throw new ApiError(
330
+ "The integration catalog returned invalid JSON.",
331
+ res.status,
332
+ "invalid_catalog",
333
+ path
334
+ );
335
+ }
336
+ const integrations = value?.integrations;
337
+ if (!integrations || typeof integrations !== "object" || Array.isArray(integrations)) {
338
+ throw new ApiError(
339
+ "The integration catalog returned an invalid shape.",
340
+ res.status,
341
+ "invalid_catalog",
342
+ path
343
+ );
344
+ }
345
+ return value;
346
+ }
304
347
 
305
348
  // src/cli/lib/cli-errors.ts
306
349
  var InputError = class extends Error {
@@ -664,9 +707,13 @@ function appDomainForEnv(env) {
664
707
  return env === "production" ? "app.space" : env === "staging" ? "spacestest.com" : null;
665
708
  }
666
709
  var PLATFORM_URLS = DEEPSPACE_ENV === "production" ? PROD_URLS : DEEPSPACE_ENV === "staging" ? STAGING_URLS : INVALID_URLS;
710
+ var PLANE_URLS = {
711
+ production: PROD_URLS,
712
+ staging: STAGING_URLS
713
+ };
667
714
  var PLANE_AUTH_URLS = {
668
- production: PROD_URLS.auth,
669
- staging: STAGING_URLS.auth
715
+ production: PLANE_URLS.production.auth,
716
+ staging: PLANE_URLS.staging.auth
670
717
  };
671
718
  function effectivePlatformUrls(env = process.env) {
672
719
  return {
@@ -10704,12 +10751,12 @@ async function resolveBody(opts) {
10704
10751
  return raw;
10705
10752
  }
10706
10753
  async function fetchCatalog(opts = {}) {
10707
- const url = opts.summary ? `${API_URL7}/api/integrations?summary=1` : `${API_URL7}/api/integrations`;
10708
- const res = await fetch(url);
10709
- if (!res.ok) {
10710
- throw new Refusal(`Failed to fetch integration catalog (${res.status})`, "catalog_unavailable");
10754
+ try {
10755
+ return await fetchIntegrationCatalog(API_URL7, { summary: opts.summary });
10756
+ } catch (err) {
10757
+ if (err instanceof ApiError) throw new Refusal(err.message, err.code ?? "catalog_unavailable");
10758
+ throw err;
10711
10759
  }
10712
- return await res.json();
10713
10760
  }
10714
10761
  function findEndpoint(catalog, integration, endpoint) {
10715
10762
  const endpoints = catalog.integrations[integration];
@@ -10793,9 +10840,13 @@ function requireEndpoint(catalog, integration, endpoint) {
10793
10840
  const available = catalog.integrations[integration];
10794
10841
  if (!available) {
10795
10842
  const names = Object.keys(catalog.integrations).sort().join(", ");
10796
- throw new Refusal(`Unknown integration '${integration}'. Available: ${names}`, "unknown_integration", {
10797
- action: cliAction("deepspace", "integrations", "list")
10798
- });
10843
+ throw new Refusal(
10844
+ `Unknown integration '${integration}'. Available: ${names}`,
10845
+ "unknown_integration",
10846
+ {
10847
+ action: cliAction("deepspace", "integrations", "list")
10848
+ }
10849
+ );
10799
10850
  }
10800
10851
  const endpoints = available.map((e) => e.endpoint).join(", ");
10801
10852
  throw new Refusal(
@@ -10811,9 +10862,7 @@ async function runInfo(args) {
10811
10862
  if (!args.json) {
10812
10863
  console.log(`${integration}/${endpoint}`);
10813
10864
  if (info2.description) console.log(` ${info2.description}`);
10814
- console.log(
10815
- ` billing: ${priceLabel(info2.billing)}`
10816
- );
10865
+ console.log(` billing: ${priceLabel(info2.billing)}`);
10817
10866
  if (info2.requiresOAuth) {
10818
10867
  console.log(
10819
10868
  " Requires OAuth: without a connected account, a call succeeds with data { requiresOAuth: true, authUrl } \u2014 open the authUrl, then retry."
@@ -15856,7 +15905,7 @@ import { join as join28, resolve as resolve22 } from "path";
15856
15905
  // package.json
15857
15906
  var package_default = {
15858
15907
  name: "deepspace",
15859
- version: "0.29.0",
15908
+ version: "0.29.1",
15860
15909
  engines: {
15861
15910
  node: ">=22.15.0 <23 || >=24 <25 || >=26 <27"
15862
15911
  },