@granular-software/sdk 0.4.2 → 0.4.3

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 CHANGED
@@ -32,7 +32,7 @@ npm install @granular-software/sdk
32
32
  By default, the SDK resolves endpoints like this:
33
33
 
34
34
  - Local mode (`NODE_ENV=development`): `ws://localhost:8787/granular`
35
- - Production mode (default): `wss://api.granular.dev/v2/ws`
35
+ - Production mode (default): `wss://cf-api-gateway.arthur6084.workers.dev/granular`
36
36
 
37
37
  Overrides:
38
38
 
package/dist/cli/index.js CHANGED
@@ -5387,7 +5387,7 @@ var import_dotenv = __toESM(require_main());
5387
5387
 
5388
5388
  // src/endpoints.ts
5389
5389
  var LOCAL_API_URL = "ws://localhost:8787/granular";
5390
- var PRODUCTION_API_URL = "wss://api.granular.dev/v2/ws";
5390
+ var PRODUCTION_API_URL = "wss://cf-api-gateway.arthur6084.workers.dev/granular";
5391
5391
  var LOCAL_AUTH_URL = "http://localhost:3000";
5392
5392
  var PRODUCTION_AUTH_URL = "https://app.granular.software";
5393
5393
  function readEnv(name) {
@@ -5775,6 +5775,9 @@ var ApiClient = class {
5775
5775
  return false;
5776
5776
  }
5777
5777
  }
5778
+ async validateKeyOrThrow() {
5779
+ await this.request("/control/sandboxes");
5780
+ }
5778
5781
  // ── Sandboxes ──
5779
5782
  async listSandboxes() {
5780
5783
  const result = await this.request("/control/sandboxes");
@@ -7847,9 +7850,11 @@ async function initCommand(projectName, options) {
7847
7850
  const apiUrl = loadApiUrl();
7848
7851
  const api = new ApiClient(apiKey, apiUrl);
7849
7852
  const validating = spinner("Validating API key...");
7850
- const isValid = await api.validateKey();
7851
- if (!isValid) {
7852
- validating.fail(" Invalid API key. Please check your key and try again.");
7853
+ try {
7854
+ await api.validateKeyOrThrow();
7855
+ } catch (err) {
7856
+ const detail = err?.message ? ` (${err.message})` : "";
7857
+ validating.fail(` API key validation failed${detail}.`);
7853
7858
  process.exit(1);
7854
7859
  }
7855
7860
  validating.succeed(" API key validated.");
@@ -8015,9 +8020,11 @@ async function loginCommand(options = {}) {
8015
8020
  }
8016
8021
  const spinner2 = spinner("Validating...");
8017
8022
  const api = new ApiClient(apiKey, apiUrl);
8018
- const valid = await api.validateKey();
8019
- if (!valid) {
8020
- spinner2.fail(" Invalid API key.");
8023
+ try {
8024
+ await api.validateKeyOrThrow();
8025
+ } catch (err) {
8026
+ const detail = err?.message ? ` (${err.message})` : "";
8027
+ spinner2.fail(` API key validation failed${detail}.`);
8021
8028
  process.exit(1);
8022
8029
  }
8023
8030
  saveApiKey(apiKey);
package/dist/index.js CHANGED
@@ -5081,7 +5081,7 @@ var JobImplementation = class {
5081
5081
 
5082
5082
  // src/endpoints.ts
5083
5083
  var LOCAL_API_URL = "ws://localhost:8787/granular";
5084
- var PRODUCTION_API_URL = "wss://api.granular.dev/v2/ws";
5084
+ var PRODUCTION_API_URL = "wss://cf-api-gateway.arthur6084.workers.dev/granular";
5085
5085
  function readEnv(name) {
5086
5086
  if (typeof process === "undefined" || !process.env) return void 0;
5087
5087
  return process.env[name];