@mutagent/cli 0.1.2 → 0.1.4

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/index.js CHANGED
@@ -185,9 +185,9 @@ function serverURLFromOptions(options) {
185
185
  var SDK_METADATA = {
186
186
  language: "typescript",
187
187
  openapiDocVersion: "2.0.0",
188
- sdkVersion: "0.2.21",
188
+ sdkVersion: "0.2.23",
189
189
  genVersion: "2.812.2",
190
- userAgent: "speakeasy-sdk/typescript 0.2.21 2.812.2 2.0.0 @mutagent/sdk"
190
+ userAgent: "speakeasy-sdk/typescript 0.2.23 2.812.2 2.0.0 @mutagent/sdk"
191
191
  };
192
192
  // ../mutagent-sdk/dist/esm/lib/http.js
193
193
  var DEFAULT_FETCHER = (input, init) => {
@@ -13797,15 +13797,41 @@ function getSDKClient() {
13797
13797
  }
13798
13798
  return sdkClient;
13799
13799
  }
13800
- function validateApiKey(apiKey, endpoint) {
13801
- const config2 = loadConfig();
13802
- const client = new SDKClientWrapper({
13803
- bearerAuth: apiKey,
13804
- serverURL: endpoint,
13805
- workspaceId: config2.defaultWorkspace,
13806
- organizationId: config2.defaultOrganization
13807
- });
13808
- return client.listWorkspaces().then(() => true).catch(() => false);
13800
+ async function validateApiKey(apiKey, endpoint) {
13801
+ try {
13802
+ const response = await fetch(`${endpoint}/api/organizations`, {
13803
+ headers: { "x-api-key": apiKey }
13804
+ });
13805
+ return response.ok;
13806
+ } catch {
13807
+ return false;
13808
+ }
13809
+ }
13810
+ async function fetchOrganizations(apiKey, endpoint) {
13811
+ try {
13812
+ const response = await fetch(`${endpoint}/api/organizations`, {
13813
+ headers: { "x-api-key": apiKey }
13814
+ });
13815
+ if (!response.ok)
13816
+ return [];
13817
+ const data = await response.json();
13818
+ return data.data ?? [];
13819
+ } catch {
13820
+ return [];
13821
+ }
13822
+ }
13823
+ async function fetchWorkspaces(apiKey, endpoint, orgId) {
13824
+ try {
13825
+ const response = await fetch(`${endpoint}/api/workspaces`, {
13826
+ headers: { "x-api-key": apiKey, "x-organization-id": orgId }
13827
+ });
13828
+ if (!response.ok)
13829
+ return [];
13830
+ const data = await response.json();
13831
+ return data.workspaces ?? [];
13832
+ } catch {
13833
+ return [];
13834
+ }
13809
13835
  }
13810
13836
  // src/lib/output.ts
13811
13837
  import chalk from "chalk";
@@ -13943,5 +13969,5 @@ export {
13943
13969
  ApiError
13944
13970
  };
13945
13971
 
13946
- //# debugId=067FB447BB6D87B164756E2164756E21
13972
+ //# debugId=D9DBD2ED1B8C7B3864756E2164756E21
13947
13973
  //# sourceMappingURL=index.js.map