@zodiac-os/sdk 1.0.1 → 1.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.
package/README.md CHANGED
@@ -7,3 +7,12 @@ Programmatically manage Safe + Zodiac account constellations with [Zodiac OS](ht
7
7
  ### Generate a Zodiac OS API key
8
8
 
9
9
  Sign in to https://app.pilot.gnosisguild.org and create an API key at https://app.pilot.gnosisguild.org/admin/api-keys
10
+
11
+ ## API Client options
12
+
13
+ | Option | Default | Description |
14
+ | ----------- | ------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
15
+ | `apiKey` | `ZODIAC_OS_API_KEY` | Api key you created to access your Zodiac OS workspace. Can either be specified directly in code or through the `ZODIAC_OS_API_KEY` environment variable |
16
+ | `workspace` | `ZODIAC_OS_WORKSPACE` | The Zodiac OS workspace you want to access with the client. Can also be specified via the `ZODIAC_OS_WORKSPACE` environment variable. |
17
+ | `baseUrl` | `https://app.pilor.gnosisguild.org/api/v1` | The URL the API client will be pointed at. This can also be specified via the `ZODIAC_OS_API_URL` environment variable. You probably do not need to specify this. |
18
+ | `fetch` | `global.fetch` | The `fetch` client that is used by the API client. You probably do not need to specify this. However, this can be useful for testing. |
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { ApplyConstellationPayload, ApplyConstellationResult, ResolveConstellationPayload, ResolveConstellationResult } from '@zodiac-os/api-types';
2
2
 
3
3
  type Options = {
4
- workspace: string;
5
- apiKey: string;
4
+ workspace?: string;
5
+ apiKey?: string;
6
6
  baseUrl?: string;
7
7
  fetch?: typeof globalThis.fetch;
8
8
  headers?: Record<string, string>;
@@ -12,8 +12,9 @@ declare class ApiClient {
12
12
  private baseUrl;
13
13
  private _fetch;
14
14
  private headers;
15
- constructor(opts: Options);
16
- private postJson;
15
+ constructor({ baseUrl, workspace, fetch: customFetch, headers, apiKey, }?: Options);
16
+ protected postJson(endpoint: string, payload: unknown): Promise<any>;
17
+ protected get(endpoint: string): Promise<any>;
17
18
  /**
18
19
  * Applies an accounts specification to Zodiac OS.
19
20
  */
package/dist/index.js CHANGED
@@ -1,43 +1,34 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
21
-
22
- // src/index.ts
23
- var index_exports = {};
24
- __export(index_exports, {
25
- ApiClient: () => ApiClient
26
- });
27
- module.exports = __toCommonJS(index_exports);
28
-
29
1
  // src/api.ts
30
- var DEFAULT_BASE_URL = "https://app.pilot.gnosisguild.org/api/v1";
2
+ import assert from "assert";
3
+ var {
4
+ ZODIAC_OS_API_KEY,
5
+ ZODIAC_OS_WORKSPACE,
6
+ ZODIAC_OS_API_URL = "https://app.pilot.gnosisguild.org/api/v1"
7
+ } = process.env;
31
8
  var ApiClient = class {
32
- constructor(opts) {
33
- __publicField(this, "apiKey");
34
- __publicField(this, "baseUrl");
35
- __publicField(this, "_fetch");
36
- __publicField(this, "headers");
37
- this.baseUrl = (opts.baseUrl ?? DEFAULT_BASE_URL).replace(/\/$/, "") + "/workspace/" + opts.workspace;
38
- this._fetch = opts.fetch ?? fetch;
39
- this.headers = opts.headers ?? {};
40
- this.apiKey = opts.apiKey;
9
+ apiKey;
10
+ baseUrl;
11
+ _fetch;
12
+ headers;
13
+ constructor({
14
+ baseUrl = ZODIAC_OS_API_URL,
15
+ workspace = ZODIAC_OS_WORKSPACE,
16
+ fetch: customFetch = fetch,
17
+ headers = {},
18
+ apiKey = ZODIAC_OS_API_KEY
19
+ } = {}) {
20
+ assert(
21
+ workspace,
22
+ 'No workspace provided to the API client. Either pass it as the "workspace" option or set the ZODIAC_OS_WORKSPACE environment variable.'
23
+ );
24
+ this.baseUrl = baseUrl.replace(/\/$/, "") + "/workspace/" + workspace;
25
+ this._fetch = customFetch;
26
+ this.headers = headers;
27
+ assert(
28
+ apiKey,
29
+ 'No API key provided to the API client. Either pass it as the "apiKey" option or set the ZODIAC_OS_API_KEY environment variable.'
30
+ );
31
+ this.apiKey = apiKey;
41
32
  }
42
33
  async postJson(endpoint, payload) {
43
34
  const res = await this._fetch(`${this.baseUrl}/${endpoint}`, {
@@ -52,27 +43,36 @@ var ApiClient = class {
52
43
  if (!res.ok) {
53
44
  await handleApiError(res);
54
45
  }
55
- return await res.json();
46
+ return res.json();
47
+ }
48
+ async get(endpoint) {
49
+ const res = await this._fetch(`${this.baseUrl}/${endpoint}`, {
50
+ headers: { ...this.headers, authorization: `Bearer ${this.apiKey}` }
51
+ });
52
+ if (!res.ok) {
53
+ await handleApiError(res);
54
+ }
55
+ return res.json();
56
56
  }
57
57
  /**
58
58
  * Applies an accounts specification to Zodiac OS.
59
59
  */
60
- async applyConstellation(payload) {
61
- return await this.postJson("constellation/apply", payload);
60
+ applyConstellation(payload) {
61
+ return this.postJson("constellation/apply", payload);
62
62
  }
63
63
  /**
64
64
  * Resolves an accounts specification to Zodiac OS.
65
65
  */
66
- async resolveConstellation(payload) {
67
- return await this.postJson("constellation/resolve", payload);
66
+ resolveConstellation(payload) {
67
+ return this.postJson("constellation/resolve", payload);
68
68
  }
69
69
  };
70
70
  var ApiRequestError = class _ApiRequestError extends Error {
71
+ status;
72
+ statusText;
73
+ details;
71
74
  constructor(message, opts) {
72
75
  super(_ApiRequestError.composeMessage(message, opts.details));
73
- __publicField(this, "status");
74
- __publicField(this, "statusText");
75
- __publicField(this, "details");
76
76
  this.name = "ApiRequestError";
77
77
  this.status = opts.status;
78
78
  this.statusText = opts.statusText;
@@ -137,8 +137,7 @@ var jsonStringify = (value, indent) => JSON.stringify(
137
137
  },
138
138
  indent
139
139
  );
140
- // Annotate the CommonJS export names for ESM import in node:
141
- 0 && (module.exports = {
140
+ export {
142
141
  ApiClient
143
- });
142
+ };
144
143
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/api.ts"],"sourcesContent":["export { ApiClient } from './api'\n","import type {\n ApplyConstellationPayload,\n ApplyConstellationResult,\n ResolveConstellationPayload,\n ResolveConstellationResult,\n ApiError as ApiErrorResponse,\n} from '@zodiac-os/api-types'\n\nexport type Options = {\n workspace: string\n apiKey: string\n baseUrl?: string\n fetch?: typeof globalThis.fetch\n headers?: Record<string, string>\n}\n\nconst DEFAULT_BASE_URL = 'https://app.pilot.gnosisguild.org/api/v1'\n\nexport class ApiClient {\n private apiKey: string\n private baseUrl: string\n private _fetch: typeof fetch\n private headers: Record<string, string>\n\n constructor(opts: Options) {\n this.baseUrl =\n (opts.baseUrl ?? DEFAULT_BASE_URL).replace(/\\/$/, '') +\n '/workspace/' +\n opts.workspace\n\n this._fetch = opts.fetch ?? fetch\n this.headers = opts.headers ?? {}\n this.apiKey = opts.apiKey\n }\n\n private async postJson(endpoint: string, payload: unknown) {\n const res = await this._fetch(`${this.baseUrl}/${endpoint}`, {\n method: 'POST',\n headers: {\n ...this.headers,\n 'content-type': 'application/json',\n authorization: `Bearer ${this.apiKey}`,\n },\n body: jsonStringify(payload),\n })\n if (!res.ok) {\n await handleApiError(res)\n }\n\n return await res.json()\n }\n\n /**\n * Applies an accounts specification to Zodiac OS.\n */\n async applyConstellation(\n payload: ApplyConstellationPayload\n ): Promise<ApplyConstellationResult> {\n return await this.postJson('constellation/apply', payload)\n }\n\n /**\n * Resolves an accounts specification to Zodiac OS.\n */\n async resolveConstellation(\n payload: ResolveConstellationPayload\n ): Promise<ResolveConstellationResult> {\n return await this.postJson('constellation/resolve', payload)\n }\n}\n\nexport class ApiRequestError extends Error {\n public readonly status: number\n public readonly statusText: string\n public readonly details?: unknown\n\n constructor(\n message: string,\n opts: {\n status: number\n statusText: string\n details?: unknown\n cause?: unknown\n }\n ) {\n super(ApiRequestError.composeMessage(message, opts.details))\n this.name = 'ApiRequestError'\n this.status = opts.status\n this.statusText = opts.statusText\n this.details = opts.details\n if (opts.cause !== undefined) {\n ;(this as any).cause = opts.cause\n }\n }\n\n private static composeMessage(message: string, details?: unknown) {\n if (details == null) return message\n let detailsString: string\n try {\n detailsString =\n typeof details === 'string' ? details : jsonStringify(details, 2)\n } catch (_err) {\n detailsString = String(details)\n }\n return `${message}\\nDetails: ${detailsString}`\n }\n\n toString() {\n return `${this.name}: ${this.message}`\n }\n}\n\nasync function handleApiError(response: Response): Promise<never> {\n const contentType = response.headers.get('content-type')\n if (contentType?.includes('application/json')) {\n const errorData = (await response.json()) as ApiErrorResponse\n let error: ApiRequestError\n try {\n error = new ApiRequestError(errorData.error.message, {\n status: response.status,\n statusText: response.statusText,\n details: errorData.error.details,\n })\n } catch (jsonShapeError) {\n error = new ApiRequestError(\n `Failed parsing error response: ${jsonShapeError}`,\n {\n status: response.status,\n statusText: response.statusText,\n details: errorData,\n }\n )\n }\n throw error\n } else {\n // Not JSON, read as text directly\n const text = await response.text()\n throw new ApiRequestError(`Unexpected error: ${text}`, {\n status: response.status,\n statusText: response.statusText,\n })\n }\n}\n\n/** JSON.stringify with bigint support */\nconst jsonStringify = (value: unknown, indent?: number) =>\n JSON.stringify(\n value,\n (_, value) => {\n if (typeof value === 'bigint') {\n return value.toString()\n }\n\n return value\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Z,QAAI,OAAOA,WAAU,UAAU;AAC7B,aAAOA,OAAM,SAAS;AAAA,IACxB;AAEA,WAAOA;AAAA,EACT;AAAA,EACA;AACF;","names":["value"]}
1
+ {"version":3,"sources":["../src/api.ts"],"sourcesContent":["import type {\n ApplyConstellationPayload,\n ApplyConstellationResult,\n ResolveConstellationPayload,\n ResolveConstellationResult,\n ApiError as ApiErrorResponse,\n} from '@zodiac-os/api-types'\nimport assert from 'assert'\n\nexport type Options = {\n workspace?: string\n apiKey?: string\n baseUrl?: string\n fetch?: typeof globalThis.fetch\n headers?: Record<string, string>\n}\n\nconst {\n ZODIAC_OS_API_KEY,\n ZODIAC_OS_WORKSPACE,\n ZODIAC_OS_API_URL = 'https://app.pilot.gnosisguild.org/api/v1',\n} = process.env\n\nexport class ApiClient {\n private apiKey: string\n private baseUrl: string\n private _fetch: typeof fetch\n private headers: Record<string, string>\n\n constructor({\n baseUrl = ZODIAC_OS_API_URL,\n workspace = ZODIAC_OS_WORKSPACE,\n fetch: customFetch = fetch,\n headers = {},\n apiKey = ZODIAC_OS_API_KEY,\n }: Options = {}) {\n assert(\n workspace,\n 'No workspace provided to the API client. Either pass it as the \"workspace\" option or set the ZODIAC_OS_WORKSPACE environment variable.'\n )\n\n this.baseUrl = baseUrl.replace(/\\/$/, '') + '/workspace/' + workspace\n\n this._fetch = customFetch\n this.headers = headers\n\n assert(\n apiKey,\n 'No API key provided to the API client. Either pass it as the \"apiKey\" option or set the ZODIAC_OS_API_KEY environment variable.'\n )\n\n this.apiKey = apiKey\n }\n\n protected async postJson(endpoint: string, payload: unknown) {\n const res = await this._fetch(`${this.baseUrl}/${endpoint}`, {\n method: 'POST',\n headers: {\n ...this.headers,\n 'content-type': 'application/json',\n authorization: `Bearer ${this.apiKey}`,\n },\n body: jsonStringify(payload),\n })\n if (!res.ok) {\n await handleApiError(res)\n }\n\n return res.json()\n }\n\n protected async get(endpoint: string) {\n const res = await this._fetch(`${this.baseUrl}/${endpoint}`, {\n headers: { ...this.headers, authorization: `Bearer ${this.apiKey}` },\n })\n\n if (!res.ok) {\n await handleApiError(res)\n }\n\n return res.json()\n }\n\n /**\n * Applies an accounts specification to Zodiac OS.\n */\n applyConstellation(\n payload: ApplyConstellationPayload\n ): Promise<ApplyConstellationResult> {\n return this.postJson('constellation/apply', payload)\n }\n\n /**\n * Resolves an accounts specification to Zodiac OS.\n */\n resolveConstellation(\n payload: ResolveConstellationPayload\n ): Promise<ResolveConstellationResult> {\n return this.postJson('constellation/resolve', payload)\n }\n}\n\nexport class ApiRequestError extends Error {\n public readonly status: number\n public readonly statusText: string\n public readonly details?: unknown\n\n constructor(\n message: string,\n opts: {\n status: number\n statusText: string\n details?: unknown\n cause?: unknown\n }\n ) {\n super(ApiRequestError.composeMessage(message, opts.details))\n this.name = 'ApiRequestError'\n this.status = opts.status\n this.statusText = opts.statusText\n this.details = opts.details\n if (opts.cause !== undefined) {\n ;(this as any).cause = opts.cause\n }\n }\n\n private static composeMessage(message: string, details?: unknown) {\n if (details == null) return message\n let detailsString: string\n try {\n detailsString =\n typeof details === 'string' ? details : jsonStringify(details, 2)\n } catch (_err) {\n detailsString = String(details)\n }\n return `${message}\\nDetails: ${detailsString}`\n }\n\n toString() {\n return `${this.name}: ${this.message}`\n }\n}\n\nasync function handleApiError(response: Response): Promise<never> {\n const contentType = response.headers.get('content-type')\n if (contentType?.includes('application/json')) {\n const errorData = (await response.json()) as ApiErrorResponse\n let error: ApiRequestError\n try {\n error = new ApiRequestError(errorData.error.message, {\n status: response.status,\n statusText: response.statusText,\n details: errorData.error.details,\n })\n } catch (jsonShapeError) {\n error = new ApiRequestError(\n `Failed parsing error response: ${jsonShapeError}`,\n {\n status: response.status,\n statusText: response.statusText,\n details: errorData,\n }\n )\n }\n throw error\n } else {\n // Not JSON, read as text directly\n const text = await response.text()\n throw new ApiRequestError(`Unexpected error: ${text}`, {\n status: response.status,\n statusText: response.statusText,\n })\n }\n}\n\n/** JSON.stringify with bigint support */\nconst jsonStringify = (value: unknown, indent?: number) =>\n JSON.stringify(\n value,\n (_, value) => {\n if (typeof value === 'bigint') {\n return value.toString()\n }\n\n return value\n },\n indent\n )\n"],"mappings":";AAOA,OAAO,YAAY;AAUnB,IAAM;AAAA,EACJ;AAAA,EACA;AAAA,EACA,oBAAoB;AACtB,IAAI,QAAQ;AAEL,IAAM,YAAN,MAAgB;AAAA,EACb;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAER,YAAY;AAAA,IACV,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,OAAO,cAAc;AAAA,IACrB,UAAU,CAAC;AAAA,IACX,SAAS;AAAA,EACX,IAAa,CAAC,GAAG;AACf;AAAA,MACE;AAAA,MACA;AAAA,IACF;AAEA,SAAK,UAAU,QAAQ,QAAQ,OAAO,EAAE,IAAI,gBAAgB;AAE5D,SAAK,SAAS;AACd,SAAK,UAAU;AAEf;AAAA,MACE;AAAA,MACA;AAAA,IACF;AAEA,SAAK,SAAS;AAAA,EAChB;AAAA,EAEA,MAAgB,SAAS,UAAkB,SAAkB;AAC3D,UAAM,MAAM,MAAM,KAAK,OAAO,GAAG,KAAK,OAAO,IAAI,QAAQ,IAAI;AAAA,MAC3D,QAAQ;AAAA,MACR,SAAS;AAAA,QACP,GAAG,KAAK;AAAA,QACR,gBAAgB;AAAA,QAChB,eAAe,UAAU,KAAK,MAAM;AAAA,MACtC;AAAA,MACA,MAAM,cAAc,OAAO;AAAA,IAC7B,CAAC;AACD,QAAI,CAAC,IAAI,IAAI;AACX,YAAM,eAAe,GAAG;AAAA,IAC1B;AAEA,WAAO,IAAI,KAAK;AAAA,EAClB;AAAA,EAEA,MAAgB,IAAI,UAAkB;AACpC,UAAM,MAAM,MAAM,KAAK,OAAO,GAAG,KAAK,OAAO,IAAI,QAAQ,IAAI;AAAA,MAC3D,SAAS,EAAE,GAAG,KAAK,SAAS,eAAe,UAAU,KAAK,MAAM,GAAG;AAAA,IACrE,CAAC;AAED,QAAI,CAAC,IAAI,IAAI;A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;AAAA,MAC3B,CAAC;AAAA,IACH,SAAS,gBAAgB;AACvB,cAAQ,IAAI;AAAA,QACV,kCAAkC,cAAc;AAAA,QAChD;AAAA,UACE,QAAQ,SAAS;AAAA,UACjB,YAAY,SAAS;AAAA,UACrB,SAAS;AAAA,QACX;AAAA,MACF;AAAA,IACF;AACA,UAAM;AAAA,EACR,OAAO;AAEL,UAAM,OAAO,MAAM,SAAS,KAAK;AACjC,UAAM,IAAI,gBAAgB,qBAAqB,IAAI,IAAI;AAAA,MACrD,QAAQ,SAAS;AAAA,MACjB,YAAY,SAAS;AAAA,IACvB,CAAC;AAAA,EACH;AACF;AAGA,IAAM,gBAAgB,CAAC,OAAgB,WACrC,KAAK;AAAA,EACH;AAAA,EACA,CAAC,GAAGA,WAAU;AACZ,QAAI,OAAOA,WAAU,UAAU;AAC7B,aAAOA,OAAM,SAAS;AAAA,IACxB;AAEA,WAAOA;AAAA,EACT;AAAA,EACA;AACF;","names":["value"]}
package/lib/index.cjs ADDED
@@ -0,0 +1,228 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
18
+ // If the importer is in node compatibility mode or this is not an ESM
19
+ // file that has been converted to a CommonJS file using a Babel-
20
+ // compatible transform (i.e. "__esModule" has not been set), then set
21
+ // "default" to the CommonJS "module.exports" for node compatibility.
22
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
23
+ mod
24
+ ));
25
+
26
+ // cli/run.ts
27
+ var import_arg = __toESM(require("arg"), 1);
28
+
29
+ // src/api.ts
30
+ var import_assert = __toESM(require("assert"), 1);
31
+ var {
32
+ ZODIAC_OS_API_KEY,
33
+ ZODIAC_OS_WORKSPACE,
34
+ ZODIAC_OS_API_URL = "https://app.pilot.gnosisguild.org/api/v1"
35
+ } = process.env;
36
+ var ApiClient = class {
37
+ apiKey;
38
+ baseUrl;
39
+ _fetch;
40
+ headers;
41
+ constructor({
42
+ baseUrl = ZODIAC_OS_API_URL,
43
+ workspace = ZODIAC_OS_WORKSPACE,
44
+ fetch: customFetch = fetch,
45
+ headers = {},
46
+ apiKey = ZODIAC_OS_API_KEY
47
+ } = {}) {
48
+ (0, import_assert.default)(
49
+ workspace,
50
+ 'No workspace provided to the API client. Either pass it as the "workspace" option or set the ZODIAC_OS_WORKSPACE environment variable.'
51
+ );
52
+ this.baseUrl = baseUrl.replace(/\/$/, "") + "/workspace/" + workspace;
53
+ this._fetch = customFetch;
54
+ this.headers = headers;
55
+ (0, import_assert.default)(
56
+ apiKey,
57
+ 'No API key provided to the API client. Either pass it as the "apiKey" option or set the ZODIAC_OS_API_KEY environment variable.'
58
+ );
59
+ this.apiKey = apiKey;
60
+ }
61
+ async postJson(endpoint, payload) {
62
+ const res = await this._fetch(`${this.baseUrl}/${endpoint}`, {
63
+ method: "POST",
64
+ headers: {
65
+ ...this.headers,
66
+ "content-type": "application/json",
67
+ authorization: `Bearer ${this.apiKey}`
68
+ },
69
+ body: jsonStringify(payload)
70
+ });
71
+ if (!res.ok) {
72
+ await handleApiError(res);
73
+ }
74
+ return res.json();
75
+ }
76
+ async get(endpoint) {
77
+ const res = await this._fetch(`${this.baseUrl}/${endpoint}`, {
78
+ headers: { ...this.headers, authorization: `Bearer ${this.apiKey}` }
79
+ });
80
+ if (!res.ok) {
81
+ await handleApiError(res);
82
+ }
83
+ return res.json();
84
+ }
85
+ /**
86
+ * Applies an accounts specification to Zodiac OS.
87
+ */
88
+ applyConstellation(payload) {
89
+ return this.postJson("constellation/apply", payload);
90
+ }
91
+ /**
92
+ * Resolves an accounts specification to Zodiac OS.
93
+ */
94
+ resolveConstellation(payload) {
95
+ return this.postJson("constellation/resolve", payload);
96
+ }
97
+ };
98
+ var ApiRequestError = class _ApiRequestError extends Error {
99
+ status;
100
+ statusText;
101
+ details;
102
+ constructor(message, opts) {
103
+ super(_ApiRequestError.composeMessage(message, opts.details));
104
+ this.name = "ApiRequestError";
105
+ this.status = opts.status;
106
+ this.statusText = opts.statusText;
107
+ this.details = opts.details;
108
+ if (opts.cause !== void 0) {
109
+ ;
110
+ this.cause = opts.cause;
111
+ }
112
+ }
113
+ static composeMessage(message, details) {
114
+ if (details == null) return message;
115
+ let detailsString;
116
+ try {
117
+ detailsString = typeof details === "string" ? details : jsonStringify(details, 2);
118
+ } catch (_err) {
119
+ detailsString = String(details);
120
+ }
121
+ return `${message}
122
+ Details: ${detailsString}`;
123
+ }
124
+ toString() {
125
+ return `${this.name}: ${this.message}`;
126
+ }
127
+ };
128
+ async function handleApiError(response) {
129
+ const contentType = response.headers.get("content-type");
130
+ if (contentType?.includes("application/json")) {
131
+ const errorData = await response.json();
132
+ let error;
133
+ try {
134
+ error = new ApiRequestError(errorData.error.message, {
135
+ status: response.status,
136
+ statusText: response.statusText,
137
+ details: errorData.error.details
138
+ });
139
+ } catch (jsonShapeError) {
140
+ error = new ApiRequestError(
141
+ `Failed parsing error response: ${jsonShapeError}`,
142
+ {
143
+ status: response.status,
144
+ statusText: response.statusText,
145
+ details: errorData
146
+ }
147
+ );
148
+ }
149
+ throw error;
150
+ } else {
151
+ const text = await response.text();
152
+ throw new ApiRequestError(`Unexpected error: ${text}`, {
153
+ status: response.status,
154
+ statusText: response.statusText
155
+ });
156
+ }
157
+ }
158
+ var jsonStringify = (value, indent) => JSON.stringify(
159
+ value,
160
+ (_, value2) => {
161
+ if (typeof value2 === "bigint") {
162
+ return value2.toString();
163
+ }
164
+ return value2;
165
+ },
166
+ indent
167
+ );
168
+
169
+ // cli/internalApi.ts
170
+ var InternalApiClient = class extends ApiClient {
171
+ listVaults() {
172
+ return this.get("vaults");
173
+ }
174
+ };
175
+
176
+ // cli/commands/typegen.ts
177
+ var t = __toESM(require("@babel/types"), 1);
178
+ var import_generator = require("@babel/generator");
179
+ var import_fs = require("fs");
180
+ var typegen = async () => {
181
+ const client = new InternalApiClient();
182
+ const vaults = await client.listVaults();
183
+ const vaultsEnum = (0, import_generator.generate)(
184
+ t.exportNamedDeclaration(
185
+ t.enumDeclaration(
186
+ t.identifier("Vault"),
187
+ t.enumStringBody(
188
+ vaults.map(
189
+ (vault) => t.enumStringMember(
190
+ t.identifier(vault.label.replaceAll(/ /g, "_")),
191
+ t.stringLiteral(vault.id)
192
+ )
193
+ )
194
+ )
195
+ )
196
+ )
197
+ );
198
+ const cwd = process.cwd();
199
+ (0, import_fs.mkdirSync)(`${cwd}/.zodiac-os/types`, { recursive: true });
200
+ (0, import_fs.writeFileSync)(`${cwd}/.zodiac-os/types/index.ts`, vaultsEnum.code);
201
+ };
202
+
203
+ // cli/run.ts
204
+ var run = async (argv = process.argv.slice(2)) => {
205
+ const args = (0, import_arg.default)({}, { argv });
206
+ const input = args._;
207
+ const [command] = input;
208
+ switch (command) {
209
+ case "typegen": {
210
+ await typegen();
211
+ break;
212
+ }
213
+ default: {
214
+ throw new Error(`Unknown command "${command}"`);
215
+ }
216
+ }
217
+ };
218
+
219
+ // cli/index.ts
220
+ run().then(
221
+ () => {
222
+ process.exit(0);
223
+ },
224
+ (error) => {
225
+ if (error) console.error(error);
226
+ process.exit(1);
227
+ }
228
+ );
package/package.json CHANGED
@@ -1,25 +1,33 @@
1
1
  {
2
2
  "name": "@zodiac-os/sdk",
3
- "version": "1.0.1",
3
+ "version": "1.1.1",
4
4
  "author": "Gnosis Guild",
5
5
  "license": "LGPL-3.0-only",
6
6
  "homepage": "https://github.com/gnosisguild/zodiac-os-sdk",
7
7
  "packageManager": "bun@1.1.12",
8
- "main": "dist/index.js",
8
+ "repository": {
9
+ "url": "https://github.com/gnosisguild/zodiac-os-sdk"
10
+ },
11
+ "type": "module",
9
12
  "module": "dist/index.mjs",
10
13
  "types": "dist/index.d.ts",
11
14
  "exports": {
12
15
  "types": "./dist/index.d.ts",
13
- "import": "./dist/index.mjs",
14
- "require": "./dist/index.js"
16
+ "import": "./dist/index.mjs"
15
17
  },
16
18
  "files": [
17
19
  "dist",
20
+ "lib",
18
21
  "README.md",
19
22
  "LICENSE"
20
23
  ],
24
+ "bin": {
25
+ "zodiac-os": "./lib/index.js"
26
+ },
21
27
  "scripts": {
22
- "build": "tsup --format esm,cjs",
28
+ "clean": "rimraf dist lib",
29
+ "prebuild": "bun clean",
30
+ "build": "tsup",
23
31
  "prepublishOnly": "bun run build",
24
32
  "check:format": "prettier --list-different .",
25
33
  "check:types": "tsc -p tsconfig.json",
@@ -27,14 +35,19 @@
27
35
  "test": "bun test"
28
36
  },
29
37
  "devDependencies": {
38
+ "@types/babel__generator": "^7.27.0",
30
39
  "@types/bun": "^1.2.21",
31
40
  "prettier": "^3.6.2",
41
+ "rimraf": "^6.1.0",
32
42
  "tsup": "^8.5.0",
33
43
  "typescript": "^5.9.2"
34
44
  },
35
45
  "dependencies": {
46
+ "@babel/generator": "^7.28.5",
47
+ "@babel/types": "^7.28.5",
36
48
  "@epic-web/invariant": "1.0.0",
37
- "@zodiac-os/api-types": "^1.3.0",
49
+ "@zodiac-os/api-types": "1.4.0",
50
+ "arg": "^5.0.2",
38
51
  "zodiac-roles-sdk": "^3.3.2"
39
52
  }
40
53
  }
package/dist/index.d.mts DELETED
@@ -1,27 +0,0 @@
1
- import { ApplyConstellationPayload, ApplyConstellationResult, ResolveConstellationPayload, ResolveConstellationResult } from '@zodiac-os/api-types';
2
-
3
- type Options = {
4
- workspace: string;
5
- apiKey: string;
6
- baseUrl?: string;
7
- fetch?: typeof globalThis.fetch;
8
- headers?: Record<string, string>;
9
- };
10
- declare class ApiClient {
11
- private apiKey;
12
- private baseUrl;
13
- private _fetch;
14
- private headers;
15
- constructor(opts: Options);
16
- private postJson;
17
- /**
18
- * Applies an accounts specification to Zodiac OS.
19
- */
20
- applyConstellation(payload: ApplyConstellationPayload): Promise<ApplyConstellationResult>;
21
- /**
22
- * Resolves an accounts specification to Zodiac OS.
23
- */
24
- resolveConstellation(payload: ResolveConstellationPayload): Promise<ResolveConstellationResult>;
25
- }
26
-
27
- export { ApiClient };
package/dist/index.mjs DELETED
@@ -1,119 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
-
5
- // src/api.ts
6
- var DEFAULT_BASE_URL = "https://app.pilot.gnosisguild.org/api/v1";
7
- var ApiClient = class {
8
- constructor(opts) {
9
- __publicField(this, "apiKey");
10
- __publicField(this, "baseUrl");
11
- __publicField(this, "_fetch");
12
- __publicField(this, "headers");
13
- this.baseUrl = (opts.baseUrl ?? DEFAULT_BASE_URL).replace(/\/$/, "") + "/workspace/" + opts.workspace;
14
- this._fetch = opts.fetch ?? fetch;
15
- this.headers = opts.headers ?? {};
16
- this.apiKey = opts.apiKey;
17
- }
18
- async postJson(endpoint, payload) {
19
- const res = await this._fetch(`${this.baseUrl}/${endpoint}`, {
20
- method: "POST",
21
- headers: {
22
- ...this.headers,
23
- "content-type": "application/json",
24
- authorization: `Bearer ${this.apiKey}`
25
- },
26
- body: jsonStringify(payload)
27
- });
28
- if (!res.ok) {
29
- await handleApiError(res);
30
- }
31
- return await res.json();
32
- }
33
- /**
34
- * Applies an accounts specification to Zodiac OS.
35
- */
36
- async applyConstellation(payload) {
37
- return await this.postJson("constellation/apply", payload);
38
- }
39
- /**
40
- * Resolves an accounts specification to Zodiac OS.
41
- */
42
- async resolveConstellation(payload) {
43
- return await this.postJson("constellation/resolve", payload);
44
- }
45
- };
46
- var ApiRequestError = class _ApiRequestError extends Error {
47
- constructor(message, opts) {
48
- super(_ApiRequestError.composeMessage(message, opts.details));
49
- __publicField(this, "status");
50
- __publicField(this, "statusText");
51
- __publicField(this, "details");
52
- this.name = "ApiRequestError";
53
- this.status = opts.status;
54
- this.statusText = opts.statusText;
55
- this.details = opts.details;
56
- if (opts.cause !== void 0) {
57
- ;
58
- this.cause = opts.cause;
59
- }
60
- }
61
- static composeMessage(message, details) {
62
- if (details == null) return message;
63
- let detailsString;
64
- try {
65
- detailsString = typeof details === "string" ? details : jsonStringify(details, 2);
66
- } catch (_err) {
67
- detailsString = String(details);
68
- }
69
- return `${message}
70
- Details: ${detailsString}`;
71
- }
72
- toString() {
73
- return `${this.name}: ${this.message}`;
74
- }
75
- };
76
- async function handleApiError(response) {
77
- const contentType = response.headers.get("content-type");
78
- if (contentType?.includes("application/json")) {
79
- const errorData = await response.json();
80
- let error;
81
- try {
82
- error = new ApiRequestError(errorData.error.message, {
83
- status: response.status,
84
- statusText: response.statusText,
85
- details: errorData.error.details
86
- });
87
- } catch (jsonShapeError) {
88
- error = new ApiRequestError(
89
- `Failed parsing error response: ${jsonShapeError}`,
90
- {
91
- status: response.status,
92
- statusText: response.statusText,
93
- details: errorData
94
- }
95
- );
96
- }
97
- throw error;
98
- } else {
99
- const text = await response.text();
100
- throw new ApiRequestError(`Unexpected error: ${text}`, {
101
- status: response.status,
102
- statusText: response.statusText
103
- });
104
- }
105
- }
106
- var jsonStringify = (value, indent) => JSON.stringify(
107
- value,
108
- (_, value2) => {
109
- if (typeof value2 === "bigint") {
110
- return value2.toString();
111
- }
112
- return value2;
113
- },
114
- indent
115
- );
116
- export {
117
- ApiClient
118
- };
119
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/api.ts"],"sourcesContent":["import type {\n ApplyConstellationPayload,\n ApplyConstellationResult,\n ResolveConstellationPayload,\n ResolveConstellationResult,\n ApiError as ApiErrorResponse,\n} from '@zodiac-os/api-types'\n\nexport type Options = {\n workspace: string\n apiKey: string\n baseUrl?: string\n fetch?: typeof globalThis.fetch\n headers?: Record<string, string>\n}\n\nconst DEFAULT_BASE_URL = 'https://app.pilot.gnosisguild.org/api/v1'\n\nexport class ApiClient {\n private apiKey: string\n private baseUrl: string\n private _fetch: typeof fetch\n private headers: Record<string, string>\n\n constructor(opts: Options) {\n this.baseUrl =\n (opts.baseUrl ?? DEFAULT_BASE_URL).replace(/\\/$/, '') +\n '/workspace/' +\n opts.workspace\n\n this._fetch = opts.fetch ?? fetch\n this.headers = opts.headers ?? {}\n this.apiKey = opts.apiKey\n }\n\n private async postJson(endpoint: string, payload: unknown) {\n const res = await this._fetch(`${this.baseUrl}/${endpoint}`, {\n method: 'POST',\n headers: {\n ...this.headers,\n 'content-type': 'application/json',\n authorization: `Bearer ${this.apiKey}`,\n },\n body: jsonStringify(payload),\n })\n if (!res.ok) {\n await handleApiError(res)\n }\n\n return await res.json()\n }\n\n /**\n * Applies an accounts specification to Zodiac OS.\n */\n async applyConstellation(\n payload: ApplyConstellationPayload\n ): Promise<ApplyConstellationResult> {\n return await this.postJson('constellation/apply', payload)\n }\n\n /**\n * Resolves an accounts specification to Zodiac OS.\n */\n async resolveConstellation(\n payload: ResolveConstellationPayload\n ): Promise<ResolveConstellationResult> {\n return await this.postJson('constellation/resolve', payload)\n }\n}\n\nexport class ApiRequestError extends Error {\n public readonly status: number\n public readonly statusText: string\n public readonly details?: unknown\n\n constructor(\n message: string,\n opts: {\n status: number\n statusText: string\n details?: unknown\n cause?: unknown\n }\n ) {\n super(ApiRequestError.composeMessage(message, opts.details))\n this.name = 'ApiRequestError'\n this.status = opts.status\n this.statusText = opts.statusText\n this.details = opts.details\n if (opts.cause !== undefined) {\n ;(this as any).cause = opts.cause\n }\n }\n\n private static composeMessage(message: string, details?: unknown) {\n if (details == null) return message\n let detailsString: string\n try {\n detailsString =\n typeof details === 'string' ? details : jsonStringify(details, 2)\n } catch (_err) {\n detailsString = String(details)\n }\n return `${message}\\nDetails: ${detailsString}`\n }\n\n toString() {\n return `${this.name}: ${this.message}`\n }\n}\n\nasync function handleApiError(response: Response): Promise<never> {\n const contentType = response.headers.get('content-type')\n if (contentType?.includes('application/json')) {\n const errorData = (await response.json()) as ApiErrorResponse\n let error: ApiRequestError\n try {\n error = new ApiRequestError(errorData.error.message, {\n status: response.status,\n statusText: response.statusText,\n details: errorData.error.details,\n })\n } catch (jsonShapeError) {\n error = new ApiRequestError(\n `Failed parsing error response: ${jsonShapeError}`,\n {\n status: response.status,\n statusText: response.statusText,\n details: errorData,\n }\n )\n }\n throw error\n } else {\n // Not JSON, read as text directly\n const text = await response.text()\n throw new ApiRequestError(`Unexpected error: ${text}`, {\n status: response.status,\n statusText: response.statusText,\n })\n }\n}\n\n/** JSON.stringify with bigint support */\nconst jsonStringify = (value: unknown, indent?: number) =>\n JSON.stringify(\n value,\n (_, value) => {\n if (typeof value === 'bigint') {\n return value.toString()\n }\n\n return value\n },\n indent\n )\n"],"mappings":";;;;;AAgBA,IAAM,mBAAmB;AAElB,IAAM,YAAN,MAAgB;AAAA,EAMrB,YAAY,MAAe;AAL3B,wBAAQ;AACR,wBAAQ;AACR,wBAAQ;AACR,wBAAQ;AAGN,SAAK,WACF,KAAK,WAAW,kBAAkB,QAAQ,OAAO,EAAE,IACpD,gBACA,KAAK;AAEP,SAAK,SAAS,KAAK,SAAS;AAC5B,SAAK,UAAU,KAAK,WAAW,CAAC;AAChC,SAAK,SAAS,KAAK;AAAA,EACrB;AAAA,EAEA,MAAc,SAAS,UAAkB,SAAkB;AACzD,UAAM,MAAM,MAAM,KAAK,OAAO,GAAG,KAAK,OAAO,IAAI,QAAQ,IAAI;AAAA,MAC3D,QAAQ;AAAA,MACR,SAAS;AAAA,QACP,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