@arke-institute/sdk 0.1.0

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 ADDED
@@ -0,0 +1,232 @@
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 __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var src_exports = {};
22
+ __export(src_exports, {
23
+ CollectionsClient: () => CollectionsClient,
24
+ CollectionsError: () => CollectionsError
25
+ });
26
+ module.exports = __toCommonJS(src_exports);
27
+
28
+ // src/collections/errors.ts
29
+ var CollectionsError = class extends Error {
30
+ constructor(message, code = "UNKNOWN_ERROR", details) {
31
+ super(message);
32
+ this.code = code;
33
+ this.details = details;
34
+ this.name = "CollectionsError";
35
+ }
36
+ };
37
+
38
+ // src/collections/client.ts
39
+ var CollectionsClient = class {
40
+ constructor(config) {
41
+ this.baseUrl = config.gatewayUrl.replace(/\/$/, "");
42
+ this.authToken = config.authToken;
43
+ this.fetchImpl = config.fetchImpl ?? fetch;
44
+ }
45
+ setAuthToken(token) {
46
+ this.authToken = token;
47
+ }
48
+ // ---------------------------------------------------------------------------
49
+ // Request helpers
50
+ // ---------------------------------------------------------------------------
51
+ buildUrl(path, query) {
52
+ const url = new URL(`${this.baseUrl}${path}`);
53
+ if (query) {
54
+ Object.entries(query).forEach(([key, value]) => {
55
+ if (value !== void 0 && value !== null) {
56
+ url.searchParams.set(key, String(value));
57
+ }
58
+ });
59
+ }
60
+ return url.toString();
61
+ }
62
+ getHeaders(authRequired) {
63
+ const headers = { "Content-Type": "application/json" };
64
+ if (authRequired || this.authToken) {
65
+ if (!this.authToken && authRequired) {
66
+ throw new CollectionsError("Authentication required for this operation", "AUTH_REQUIRED");
67
+ }
68
+ if (this.authToken) {
69
+ headers["Authorization"] = `Bearer ${this.authToken}`;
70
+ }
71
+ }
72
+ return headers;
73
+ }
74
+ async request(path, options = {}) {
75
+ const authRequired = options.authRequired ?? false;
76
+ const url = this.buildUrl(path, options.query);
77
+ const headers = new Headers(this.getHeaders(authRequired));
78
+ if (options.headers) {
79
+ Object.entries(options.headers).forEach(([k, v]) => {
80
+ if (v !== void 0) headers.set(k, v);
81
+ });
82
+ }
83
+ const response = await this.fetchImpl(url, { ...options, headers });
84
+ if (response.ok) {
85
+ if (response.status === 204) {
86
+ return void 0;
87
+ }
88
+ const contentType = response.headers.get("content-type") || "";
89
+ if (contentType.includes("application/json")) {
90
+ return await response.json();
91
+ }
92
+ return await response.text();
93
+ }
94
+ let body;
95
+ try {
96
+ body = await response.json();
97
+ } catch {
98
+ body = await response.text();
99
+ }
100
+ const message = body?.error && typeof body.error === "string" ? body.error : `Request failed with status ${response.status}`;
101
+ throw new CollectionsError(message, "HTTP_ERROR", {
102
+ status: response.status,
103
+ body
104
+ });
105
+ }
106
+ // ---------------------------------------------------------------------------
107
+ // Collections
108
+ // ---------------------------------------------------------------------------
109
+ async listCollections(params) {
110
+ return this.request("/collections", {
111
+ method: "GET",
112
+ query: { limit: params?.limit, offset: params?.offset }
113
+ });
114
+ }
115
+ async getCollection(id) {
116
+ return this.request(`/collections/${id}`, { method: "GET" });
117
+ }
118
+ async getCollectionRoot(id) {
119
+ return this.request(`/collections/${id}/root`, { method: "GET" });
120
+ }
121
+ async getMyAccess(id) {
122
+ return this.request(`/collections/${id}/my-access`, { method: "GET", authRequired: true });
123
+ }
124
+ async createCollection(payload) {
125
+ return this.request("/collections", {
126
+ method: "POST",
127
+ authRequired: true,
128
+ body: JSON.stringify(payload)
129
+ });
130
+ }
131
+ async registerRoot(payload) {
132
+ return this.request("/collections/register-root", {
133
+ method: "POST",
134
+ authRequired: true,
135
+ body: JSON.stringify(payload)
136
+ });
137
+ }
138
+ async updateCollection(id, payload) {
139
+ return this.request(`/collections/${id}`, {
140
+ method: "PATCH",
141
+ authRequired: true,
142
+ body: JSON.stringify(payload)
143
+ });
144
+ }
145
+ async changeRoot(id, payload) {
146
+ return this.request(`/collections/${id}/change-root`, {
147
+ method: "PATCH",
148
+ authRequired: true,
149
+ body: JSON.stringify(payload)
150
+ });
151
+ }
152
+ async deleteCollection(id) {
153
+ return this.request(`/collections/${id}`, {
154
+ method: "DELETE",
155
+ authRequired: true
156
+ });
157
+ }
158
+ // ---------------------------------------------------------------------------
159
+ // Members
160
+ // ---------------------------------------------------------------------------
161
+ async listMembers(collectionId) {
162
+ return this.request(`/collections/${collectionId}/members`, { method: "GET" });
163
+ }
164
+ async updateMemberRole(collectionId, userId, role) {
165
+ return this.request(`/collections/${collectionId}/members/${userId}`, {
166
+ method: "PATCH",
167
+ authRequired: true,
168
+ body: JSON.stringify({ role })
169
+ });
170
+ }
171
+ async removeMember(collectionId, userId) {
172
+ return this.request(`/collections/${collectionId}/members/${userId}`, {
173
+ method: "DELETE",
174
+ authRequired: true
175
+ });
176
+ }
177
+ // ---------------------------------------------------------------------------
178
+ // Invitations
179
+ // ---------------------------------------------------------------------------
180
+ async createInvitation(collectionId, email, role) {
181
+ return this.request(`/collections/${collectionId}/invitations`, {
182
+ method: "POST",
183
+ authRequired: true,
184
+ body: JSON.stringify({ email, role })
185
+ });
186
+ }
187
+ async listInvitations(collectionId) {
188
+ return this.request(`/collections/${collectionId}/invitations`, {
189
+ method: "GET",
190
+ authRequired: true
191
+ });
192
+ }
193
+ async acceptInvitation(invitationId) {
194
+ return this.request(`/invitations/${invitationId}/accept`, {
195
+ method: "POST",
196
+ authRequired: true
197
+ });
198
+ }
199
+ async declineInvitation(invitationId) {
200
+ return this.request(`/invitations/${invitationId}/decline`, {
201
+ method: "POST",
202
+ authRequired: true
203
+ });
204
+ }
205
+ async revokeInvitation(invitationId) {
206
+ return this.request(`/invitations/${invitationId}`, {
207
+ method: "DELETE",
208
+ authRequired: true
209
+ });
210
+ }
211
+ // ---------------------------------------------------------------------------
212
+ // Current user
213
+ // ---------------------------------------------------------------------------
214
+ async getMyCollections() {
215
+ return this.request("/me/collections", { method: "GET", authRequired: true });
216
+ }
217
+ async getMyInvitations() {
218
+ return this.request("/me/invitations", { method: "GET", authRequired: true });
219
+ }
220
+ // ---------------------------------------------------------------------------
221
+ // PI permissions
222
+ // ---------------------------------------------------------------------------
223
+ async getPiPermissions(pi) {
224
+ return this.request(`/pi/${pi}/permissions`, { method: "GET" });
225
+ }
226
+ };
227
+ // Annotate the CommonJS export names for ESM import in node:
228
+ 0 && (module.exports = {
229
+ CollectionsClient,
230
+ CollectionsError
231
+ });
232
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/collections/errors.ts","../src/collections/client.ts"],"sourcesContent":["/**\n * @arke/sdk - TypeScript SDK for building applications on the Arke platform\n *\n * @example\n * ```typescript\n * import { CollectionsClient } from '@arke/sdk';\n *\n * const client = new CollectionsClient({\n * gatewayUrl: 'https://api.arke.institute',\n * authToken: 'your-jwt-token',\n * });\n *\n * const collections = await client.listCollections();\n * ```\n */\n\n// Collections\nexport {\n CollectionsClient,\n type CollectionsClientConfig,\n} from './collections/client';\nexport { CollectionsError } from './collections/errors';\nexport type {\n Collection,\n CollectionDetails,\n CollectionRole,\n CollectionVisibility,\n CreateCollectionPayload,\n UpdateCollectionPayload,\n RegisterRootPayload,\n ChangeRootPayload,\n ChangeRootResponse,\n Member,\n MemberUser,\n MembersResponse,\n Invitation,\n InvitationUser,\n InvitationsResponse,\n MyAccessResponse,\n MyCollectionsResponse,\n PaginatedCollections,\n PiPermissions,\n RootResponse,\n SuccessResponse,\n} from './collections/types';\n","export class CollectionsError extends Error {\n constructor(\n message: string,\n public code: string = 'UNKNOWN_ERROR',\n public details?: unknown\n ) {\n super(message);\n this.name = 'CollectionsError';\n }\n}\n","import { CollectionsError } from './errors';\nimport type {\n ChangeRootPayload,\n ChangeRootResponse,\n Collection,\n CollectionDetails,\n CollectionRole,\n CreateCollectionPayload,\n Invitation,\n InvitationsResponse,\n Member,\n MembersResponse,\n MyAccessResponse,\n MyCollectionsResponse,\n PaginatedCollections,\n PiPermissions,\n RegisterRootPayload,\n RootResponse,\n SuccessResponse,\n UpdateCollectionPayload,\n} from './types';\n\nexport interface CollectionsClientConfig {\n /**\n * Gateway base URL (e.g., https://api.arke.institute).\n * Must already point at the Arke gateway that proxies /collections/*.\n */\n gatewayUrl: string;\n /**\n * Optional bearer token for authenticated routes.\n * Public routes will still include it if provided.\n */\n authToken?: string;\n /**\n * Optional custom fetch (useful for testing).\n */\n fetchImpl?: typeof fetch;\n}\n\ntype JsonBody = Record<string, unknown>;\n\nexport class CollectionsClient {\n private baseUrl: string;\n private authToken?: string;\n private fetchImpl: typeof fetch;\n\n constructor(config: CollectionsClientConfig) {\n this.baseUrl = config.gatewayUrl.replace(/\\/$/, '');\n this.authToken = config.authToken;\n this.fetchImpl = config.fetchImpl ?? fetch;\n }\n\n setAuthToken(token?: string) {\n this.authToken = token;\n }\n\n // ---------------------------------------------------------------------------\n // Request helpers\n // ---------------------------------------------------------------------------\n\n private buildUrl(path: string, query?: Record<string, string | number | undefined>) {\n const url = new URL(`${this.baseUrl}${path}`);\n if (query) {\n Object.entries(query).forEach(([key, value]) => {\n if (value !== undefined && value !== null) {\n url.searchParams.set(key, String(value));\n }\n });\n }\n return url.toString();\n }\n\n private getHeaders(authRequired: boolean): HeadersInit {\n const headers: HeadersInit = { 'Content-Type': 'application/json' };\n if (authRequired || this.authToken) {\n if (!this.authToken && authRequired) {\n throw new CollectionsError('Authentication required for this operation', 'AUTH_REQUIRED');\n }\n if (this.authToken) {\n headers['Authorization'] = `Bearer ${this.authToken}`;\n }\n }\n return headers;\n }\n\n private async request<T>(\n path: string,\n options: RequestInit & {\n authRequired?: boolean;\n query?: Record<string, string | number | undefined>;\n } = {}\n ): Promise<T> {\n const authRequired = options.authRequired ?? false;\n const url = this.buildUrl(path, options.query);\n const headers = new Headers(this.getHeaders(authRequired));\n if (options.headers) {\n Object.entries(options.headers).forEach(([k, v]) => {\n if (v !== undefined) headers.set(k, v as string);\n });\n }\n\n const response = await this.fetchImpl(url, { ...options, headers });\n\n if (response.ok) {\n if (response.status === 204) {\n return undefined as T;\n }\n const contentType = response.headers.get('content-type') || '';\n if (contentType.includes('application/json')) {\n return (await response.json()) as T;\n }\n return (await response.text()) as unknown as T;\n }\n\n let body: unknown;\n try {\n body = await response.json();\n } catch {\n body = await response.text();\n }\n\n const message =\n (body as JsonBody)?.error && typeof (body as JsonBody).error === 'string'\n ? ((body as JsonBody).error as string)\n : `Request failed with status ${response.status}`;\n\n throw new CollectionsError(message, 'HTTP_ERROR', {\n status: response.status,\n body,\n });\n }\n\n // ---------------------------------------------------------------------------\n // Collections\n // ---------------------------------------------------------------------------\n\n async listCollections(params?: { limit?: number; offset?: number }): Promise<PaginatedCollections> {\n return this.request('/collections', {\n method: 'GET',\n query: { limit: params?.limit, offset: params?.offset },\n });\n }\n\n async getCollection(id: string): Promise<CollectionDetails> {\n return this.request(`/collections/${id}`, { method: 'GET' });\n }\n\n async getCollectionRoot(id: string): Promise<RootResponse> {\n return this.request(`/collections/${id}/root`, { method: 'GET' });\n }\n\n async getMyAccess(id: string): Promise<MyAccessResponse> {\n return this.request(`/collections/${id}/my-access`, { method: 'GET', authRequired: true });\n }\n\n async createCollection(payload: CreateCollectionPayload): Promise<Collection> {\n return this.request('/collections', {\n method: 'POST',\n authRequired: true,\n body: JSON.stringify(payload),\n });\n }\n\n async registerRoot(payload: RegisterRootPayload): Promise<Collection & { rootPi: string }> {\n return this.request('/collections/register-root', {\n method: 'POST',\n authRequired: true,\n body: JSON.stringify(payload),\n });\n }\n\n async updateCollection(id: string, payload: UpdateCollectionPayload): Promise<Collection> {\n return this.request(`/collections/${id}`, {\n method: 'PATCH',\n authRequired: true,\n body: JSON.stringify(payload),\n });\n }\n\n async changeRoot(id: string, payload: ChangeRootPayload): Promise<ChangeRootResponse> {\n return this.request(`/collections/${id}/change-root`, {\n method: 'PATCH',\n authRequired: true,\n body: JSON.stringify(payload),\n });\n }\n\n async deleteCollection(id: string): Promise<SuccessResponse> {\n return this.request(`/collections/${id}`, {\n method: 'DELETE',\n authRequired: true,\n });\n }\n\n // ---------------------------------------------------------------------------\n // Members\n // ---------------------------------------------------------------------------\n\n async listMembers(collectionId: string): Promise<MembersResponse> {\n return this.request(`/collections/${collectionId}/members`, { method: 'GET' });\n }\n\n async updateMemberRole(\n collectionId: string,\n userId: string,\n role: CollectionRole\n ): Promise<{ success: true; role: CollectionRole }> {\n return this.request(`/collections/${collectionId}/members/${userId}`, {\n method: 'PATCH',\n authRequired: true,\n body: JSON.stringify({ role }),\n });\n }\n\n async removeMember(collectionId: string, userId: string): Promise<SuccessResponse> {\n return this.request(`/collections/${collectionId}/members/${userId}`, {\n method: 'DELETE',\n authRequired: true,\n });\n }\n\n // ---------------------------------------------------------------------------\n // Invitations\n // ---------------------------------------------------------------------------\n\n async createInvitation(collectionId: string, email: string, role: CollectionRole): Promise<Invitation> {\n return this.request(`/collections/${collectionId}/invitations`, {\n method: 'POST',\n authRequired: true,\n body: JSON.stringify({ email, role }),\n });\n }\n\n async listInvitations(collectionId: string): Promise<InvitationsResponse> {\n return this.request(`/collections/${collectionId}/invitations`, {\n method: 'GET',\n authRequired: true,\n });\n }\n\n async acceptInvitation(invitationId: string): Promise<{ success: true; role: CollectionRole }> {\n return this.request(`/invitations/${invitationId}/accept`, {\n method: 'POST',\n authRequired: true,\n });\n }\n\n async declineInvitation(invitationId: string): Promise<SuccessResponse> {\n return this.request(`/invitations/${invitationId}/decline`, {\n method: 'POST',\n authRequired: true,\n });\n }\n\n async revokeInvitation(invitationId: string): Promise<SuccessResponse> {\n return this.request(`/invitations/${invitationId}`, {\n method: 'DELETE',\n authRequired: true,\n });\n }\n\n // ---------------------------------------------------------------------------\n // Current user\n // ---------------------------------------------------------------------------\n\n async getMyCollections(): Promise<MyCollectionsResponse> {\n return this.request('/me/collections', { method: 'GET', authRequired: true });\n }\n\n async getMyInvitations(): Promise<InvitationsResponse> {\n return this.request('/me/invitations', { method: 'GET', authRequired: true });\n }\n\n // ---------------------------------------------------------------------------\n // PI permissions\n // ---------------------------------------------------------------------------\n\n async getPiPermissions(pi: string): Promise<PiPermissions> {\n return this.request(`/pi/${pi}/permissions`, { method: 'GET' });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,IAAM,mBAAN,cAA+B,MAAM;AAAA,EAC1C,YACE,SACO,OAAe,iBACf,SACP;AACA,UAAM,OAAO;AAHN;AACA;AAGP,SAAK,OAAO;AAAA,EACd;AACF;;;ACgCO,IAAM,oBAAN,MAAwB;AAAA,EAK7B,YAAY,QAAiC;AAC3C,SAAK,UAAU,OAAO,WAAW,QAAQ,OAAO,EAAE;AAClD,SAAK,YAAY,OAAO;AACxB,SAAK,YAAY,OAAO,aAAa;AAAA,EACvC;AAAA,EAEA,aAAa,OAAgB;AAC3B,SAAK,YAAY;AAAA,EACnB;AAAA;AAAA;AAAA;AAAA,EAMQ,SAAS,MAAc,OAAqD;AAClF,UAAM,MAAM,IAAI,IAAI,GAAG,KAAK,OAAO,GAAG,IAAI,EAAE;AAC5C,QAAI,OAAO;AACT,aAAO,QAAQ,KAAK,EAAE,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AAC9C,YAAI,UAAU,UAAa,UAAU,MAAM;AACzC,cAAI,aAAa,IAAI,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AA,EACH;AAAA,EAEA,MAAM,iBAAiB,cAAwE;AAC7F,WAAO,KAAK,QAAQ,gBAAgB,YAAY,WAAW;AAAA,MACzD,QAAQ;AAAA,MACR,cAAc;AAAA,IAChB,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,kBAAkB,cAAgD;AACtE,WAAO,KAAK,QAAQ,gBAAgB,YAAY,YAAY;AAAA,MAC1D,QAAQ;AAAA,MACR,cAAc;AAAA,IAChB,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,iBAAiB,cAAgD;AACrE,WAAO,KAAK,QAAQ,gBAAgB,YAAY,IAAI;AAAA,MAClD,QAAQ;AAAA,MACR,cAAc;AAAA,IAChB,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,mBAAmD;AACvD,WAAO,KAAK,QAAQ,mBAAmB,EAAE,QAAQ,OAAO,cAAc,KAAK,CAAC;AAAA,EAC9E;AAAA,EAEA,MAAM,mBAAiD;AACrD,WAAO,KAAK,QAAQ,mBAAmB,EAAE,QAAQ,OAAO,cAAc,KAAK,CAAC;AAAA,EAC9E;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,iBAAiB,IAAoC;AACzD,WAAO,KAAK,QAAQ,OAAO,EAAE,gBAAgB,EAAE,QAAQ,MAAM,CAAC;AAAA,EAChE;AACF;","names":[]}
package/dist/index.mjs ADDED
@@ -0,0 +1,204 @@
1
+ // src/collections/errors.ts
2
+ var CollectionsError = class extends Error {
3
+ constructor(message, code = "UNKNOWN_ERROR", details) {
4
+ super(message);
5
+ this.code = code;
6
+ this.details = details;
7
+ this.name = "CollectionsError";
8
+ }
9
+ };
10
+
11
+ // src/collections/client.ts
12
+ var CollectionsClient = class {
13
+ constructor(config) {
14
+ this.baseUrl = config.gatewayUrl.replace(/\/$/, "");
15
+ this.authToken = config.authToken;
16
+ this.fetchImpl = config.fetchImpl ?? fetch;
17
+ }
18
+ setAuthToken(token) {
19
+ this.authToken = token;
20
+ }
21
+ // ---------------------------------------------------------------------------
22
+ // Request helpers
23
+ // ---------------------------------------------------------------------------
24
+ buildUrl(path, query) {
25
+ const url = new URL(`${this.baseUrl}${path}`);
26
+ if (query) {
27
+ Object.entries(query).forEach(([key, value]) => {
28
+ if (value !== void 0 && value !== null) {
29
+ url.searchParams.set(key, String(value));
30
+ }
31
+ });
32
+ }
33
+ return url.toString();
34
+ }
35
+ getHeaders(authRequired) {
36
+ const headers = { "Content-Type": "application/json" };
37
+ if (authRequired || this.authToken) {
38
+ if (!this.authToken && authRequired) {
39
+ throw new CollectionsError("Authentication required for this operation", "AUTH_REQUIRED");
40
+ }
41
+ if (this.authToken) {
42
+ headers["Authorization"] = `Bearer ${this.authToken}`;
43
+ }
44
+ }
45
+ return headers;
46
+ }
47
+ async request(path, options = {}) {
48
+ const authRequired = options.authRequired ?? false;
49
+ const url = this.buildUrl(path, options.query);
50
+ const headers = new Headers(this.getHeaders(authRequired));
51
+ if (options.headers) {
52
+ Object.entries(options.headers).forEach(([k, v]) => {
53
+ if (v !== void 0) headers.set(k, v);
54
+ });
55
+ }
56
+ const response = await this.fetchImpl(url, { ...options, headers });
57
+ if (response.ok) {
58
+ if (response.status === 204) {
59
+ return void 0;
60
+ }
61
+ const contentType = response.headers.get("content-type") || "";
62
+ if (contentType.includes("application/json")) {
63
+ return await response.json();
64
+ }
65
+ return await response.text();
66
+ }
67
+ let body;
68
+ try {
69
+ body = await response.json();
70
+ } catch {
71
+ body = await response.text();
72
+ }
73
+ const message = body?.error && typeof body.error === "string" ? body.error : `Request failed with status ${response.status}`;
74
+ throw new CollectionsError(message, "HTTP_ERROR", {
75
+ status: response.status,
76
+ body
77
+ });
78
+ }
79
+ // ---------------------------------------------------------------------------
80
+ // Collections
81
+ // ---------------------------------------------------------------------------
82
+ async listCollections(params) {
83
+ return this.request("/collections", {
84
+ method: "GET",
85
+ query: { limit: params?.limit, offset: params?.offset }
86
+ });
87
+ }
88
+ async getCollection(id) {
89
+ return this.request(`/collections/${id}`, { method: "GET" });
90
+ }
91
+ async getCollectionRoot(id) {
92
+ return this.request(`/collections/${id}/root`, { method: "GET" });
93
+ }
94
+ async getMyAccess(id) {
95
+ return this.request(`/collections/${id}/my-access`, { method: "GET", authRequired: true });
96
+ }
97
+ async createCollection(payload) {
98
+ return this.request("/collections", {
99
+ method: "POST",
100
+ authRequired: true,
101
+ body: JSON.stringify(payload)
102
+ });
103
+ }
104
+ async registerRoot(payload) {
105
+ return this.request("/collections/register-root", {
106
+ method: "POST",
107
+ authRequired: true,
108
+ body: JSON.stringify(payload)
109
+ });
110
+ }
111
+ async updateCollection(id, payload) {
112
+ return this.request(`/collections/${id}`, {
113
+ method: "PATCH",
114
+ authRequired: true,
115
+ body: JSON.stringify(payload)
116
+ });
117
+ }
118
+ async changeRoot(id, payload) {
119
+ return this.request(`/collections/${id}/change-root`, {
120
+ method: "PATCH",
121
+ authRequired: true,
122
+ body: JSON.stringify(payload)
123
+ });
124
+ }
125
+ async deleteCollection(id) {
126
+ return this.request(`/collections/${id}`, {
127
+ method: "DELETE",
128
+ authRequired: true
129
+ });
130
+ }
131
+ // ---------------------------------------------------------------------------
132
+ // Members
133
+ // ---------------------------------------------------------------------------
134
+ async listMembers(collectionId) {
135
+ return this.request(`/collections/${collectionId}/members`, { method: "GET" });
136
+ }
137
+ async updateMemberRole(collectionId, userId, role) {
138
+ return this.request(`/collections/${collectionId}/members/${userId}`, {
139
+ method: "PATCH",
140
+ authRequired: true,
141
+ body: JSON.stringify({ role })
142
+ });
143
+ }
144
+ async removeMember(collectionId, userId) {
145
+ return this.request(`/collections/${collectionId}/members/${userId}`, {
146
+ method: "DELETE",
147
+ authRequired: true
148
+ });
149
+ }
150
+ // ---------------------------------------------------------------------------
151
+ // Invitations
152
+ // ---------------------------------------------------------------------------
153
+ async createInvitation(collectionId, email, role) {
154
+ return this.request(`/collections/${collectionId}/invitations`, {
155
+ method: "POST",
156
+ authRequired: true,
157
+ body: JSON.stringify({ email, role })
158
+ });
159
+ }
160
+ async listInvitations(collectionId) {
161
+ return this.request(`/collections/${collectionId}/invitations`, {
162
+ method: "GET",
163
+ authRequired: true
164
+ });
165
+ }
166
+ async acceptInvitation(invitationId) {
167
+ return this.request(`/invitations/${invitationId}/accept`, {
168
+ method: "POST",
169
+ authRequired: true
170
+ });
171
+ }
172
+ async declineInvitation(invitationId) {
173
+ return this.request(`/invitations/${invitationId}/decline`, {
174
+ method: "POST",
175
+ authRequired: true
176
+ });
177
+ }
178
+ async revokeInvitation(invitationId) {
179
+ return this.request(`/invitations/${invitationId}`, {
180
+ method: "DELETE",
181
+ authRequired: true
182
+ });
183
+ }
184
+ // ---------------------------------------------------------------------------
185
+ // Current user
186
+ // ---------------------------------------------------------------------------
187
+ async getMyCollections() {
188
+ return this.request("/me/collections", { method: "GET", authRequired: true });
189
+ }
190
+ async getMyInvitations() {
191
+ return this.request("/me/invitations", { method: "GET", authRequired: true });
192
+ }
193
+ // ---------------------------------------------------------------------------
194
+ // PI permissions
195
+ // ---------------------------------------------------------------------------
196
+ async getPiPermissions(pi) {
197
+ return this.request(`/pi/${pi}/permissions`, { method: "GET" });
198
+ }
199
+ };
200
+ export {
201
+ CollectionsClient,
202
+ CollectionsError
203
+ };
204
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/collections/errors.ts","../src/collections/client.ts"],"sourcesContent":["export class CollectionsError extends Error {\n constructor(\n message: string,\n public code: string = 'UNKNOWN_ERROR',\n public details?: unknown\n ) {\n super(message);\n this.name = 'CollectionsError';\n }\n}\n","import { CollectionsError } from './errors';\nimport type {\n ChangeRootPayload,\n ChangeRootResponse,\n Collection,\n CollectionDetails,\n CollectionRole,\n CreateCollectionPayload,\n Invitation,\n InvitationsResponse,\n Member,\n MembersResponse,\n MyAccessResponse,\n MyCollectionsResponse,\n PaginatedCollections,\n PiPermissions,\n RegisterRootPayload,\n RootResponse,\n SuccessResponse,\n UpdateCollectionPayload,\n} from './types';\n\nexport interface CollectionsClientConfig {\n /**\n * Gateway base URL (e.g., https://api.arke.institute).\n * Must already point at the Arke gateway that proxies /collections/*.\n */\n gatewayUrl: string;\n /**\n * Optional bearer token for authenticated routes.\n * Public routes will still include it if provided.\n */\n authToken?: string;\n /**\n * Optional custom fetch (useful for testing).\n */\n fetchImpl?: typeof fetch;\n}\n\ntype JsonBody = Record<string, unknown>;\n\nexport class CollectionsClient {\n private baseUrl: string;\n private authToken?: string;\n private fetchImpl: typeof fetch;\n\n constructor(config: CollectionsClientConfig) {\n this.baseUrl = config.gatewayUrl.replace(/\\/$/, '');\n this.authToken = config.authToken;\n this.fetchImpl = config.fetchImpl ?? fetch;\n }\n\n setAuthToken(token?: string) {\n this.authToken = token;\n }\n\n // ---------------------------------------------------------------------------\n // Request helpers\n // ---------------------------------------------------------------------------\n\n private buildUrl(path: string, query?: Record<string, string | number | undefined>) {\n const url = new URL(`${this.baseUrl}${path}`);\n if (query) {\n Object.entries(query).forEach(([key, value]) => {\n if (value !== undefined && value !== null) {\n url.searchParams.set(key, String(value));\n }\n });\n }\n return url.toString();\n }\n\n private getHeaders(authRequired: boolean): HeadersInit {\n const headers: HeadersInit = { 'Content-Type': 'application/json' };\n if (authRequired || this.authToken) {\n if (!this.authToken && authRequired) {\n throw new CollectionsError('Authentication required for this operation', 'AUTH_REQUIRED');\n }\n if (this.authToken) {\n headers['Authorization'] = `Bearer ${this.authToken}`;\n }\n }\n return headers;\n }\n\n private async request<T>(\n path: string,\n options: RequestInit & {\n authRequired?: boolean;\n query?: Record<string, string | number | undefined>;\n } = {}\n ): Promise<T> {\n const authRequired = options.authRequired ?? false;\n const url = this.buildUrl(path, options.query);\n const headers = new Headers(this.getHeaders(authRequired));\n if (options.headers) {\n Object.entries(options.headers).forEach(([k, v]) => {\n if (v !== undefined) headers.set(k, v as string);\n });\n }\n\n const response = await this.fetchImpl(url, { ...options, headers });\n\n if (response.ok) {\n if (response.status === 204) {\n return undefined as T;\n }\n const contentType = response.headers.get('content-type') || '';\n if (contentType.includes('application/json')) {\n return (await response.json()) as T;\n }\n return (await response.text()) as unknown as T;\n }\n\n let body: unknown;\n try {\n body = await response.json();\n } catch {\n body = await response.text();\n }\n\n const message =\n (body as JsonBody)?.error && typeof (body as JsonBody).error === 'string'\n ? ((body as JsonBody).error as string)\n : `Request failed with status ${response.status}`;\n\n throw new CollectionsError(message, 'HTTP_ERROR', {\n status: response.status,\n body,\n });\n }\n\n // ---------------------------------------------------------------------------\n // Collections\n // ---------------------------------------------------------------------------\n\n async listCollections(params?: { limit?: number; offset?: number }): Promise<PaginatedCollections> {\n return this.request('/collections', {\n method: 'GET',\n query: { limit: params?.limit, offset: params?.offset },\n });\n }\n\n async getCollection(id: string): Promise<CollectionDetails> {\n return this.request(`/collections/${id}`, { method: 'GET' });\n }\n\n async getCollectionRoot(id: string): Promise<RootResponse> {\n return this.request(`/collections/${id}/root`, { method: 'GET' });\n }\n\n async getMyAccess(id: string): Promise<MyAccessResponse> {\n return this.request(`/collections/${id}/my-access`, { method: 'GET', authRequired: true });\n }\n\n async createCollection(payload: CreateCollectionPayload): Promise<Collection> {\n return this.request('/collections', {\n method: 'POST',\n authRequired: true,\n body: JSON.stringify(payload),\n });\n }\n\n async registerRoot(payload: RegisterRootPayload): Promise<Collection & { rootPi: string }> {\n return this.request('/collections/register-root', {\n method: 'POST',\n authRequired: true,\n body: JSON.stringify(payload),\n });\n }\n\n async updateCollection(id: string, payload: UpdateCollectionPayload): Promise<Collection> {\n return this.request(`/collections/${id}`, {\n method: 'PATCH',\n authRequired: true,\n body: JSON.stringify(payload),\n });\n }\n\n async changeRoot(id: string, payload: ChangeRootPayload): Promise<ChangeRootResponse> {\n return this.request(`/collections/${id}/change-root`, {\n method: 'PATCH',\n authRequired: true,\n body: JSON.stringify(payload),\n });\n }\n\n async deleteCollection(id: string): Promise<SuccessResponse> {\n return this.request(`/collections/${id}`, {\n method: 'DELETE',\n authRequired: true,\n });\n }\n\n // ---------------------------------------------------------------------------\n // Members\n // ---------------------------------------------------------------------------\n\n async listMembers(collectionId: string): Promise<MembersResponse> {\n return this.request(`/collections/${collectionId}/members`, { method: 'GET' });\n }\n\n async updateMemberRole(\n collectionId: string,\n userId: string,\n role: CollectionRole\n ): Promise<{ success: true; role: CollectionRole }> {\n return this.request(`/collections/${collectionId}/members/${userId}`, {\n method: 'PATCH',\n authRequired: true,\n body: JSON.stringify({ role }),\n });\n }\n\n async removeMember(collectionId: string, userId: string): Promise<SuccessResponse> {\n return this.request(`/collections/${collectionId}/members/${userId}`, {\n method: 'DELETE',\n authRequired: true,\n });\n }\n\n // ---------------------------------------------------------------------------\n // Invitations\n // ---------------------------------------------------------------------------\n\n async createInvitation(collectionId: string, email: string, role: CollectionRole): Promise<Invitation> {\n return this.request(`/collections/${collectionId}/invitations`, {\n method: 'POST',\n authRequired: true,\n body: JSON.stringify({ email, role }),\n });\n }\n\n async listInvitations(collectionId: string): Promise<InvitationsResponse> {\n return this.request(`/collections/${collectionId}/invitations`, {\n method: 'GET',\n authRequired: true,\n });\n }\n\n async acceptInvitation(invitationId: string): Promise<{ success: true; role: CollectionRole }> {\n return this.request(`/invitations/${invitationId}/accept`, {\n method: 'POST',\n authRequired: true,\n });\n }\n\n async declineInvitation(invitationId: string): Promise<SuccessResponse> {\n return this.request(`/invitations/${invitationId}/decline`, {\n method: 'POST',\n authRequired: true,\n });\n }\n\n async revokeInvitation(invitationId: string): Promise<SuccessResponse> {\n return this.request(`/invitations/${invitationId}`, {\n method: 'DELETE',\n authRequired: true,\n });\n }\n\n // ---------------------------------------------------------------------------\n // Current user\n // ---------------------------------------------------------------------------\n\n async getMyCollections(): Promise<MyCollectionsResponse> {\n return this.request('/me/collections', { method: 'GET', authRequired: true });\n }\n\n async getMyInvitations(): Promise<InvitationsResponse> {\n return this.request('/me/invitations', { method: 'GET', authRequired: true });\n }\n\n // ---------------------------------------------------------------------------\n // PI permissions\n // ---------------------------------------------------------------------------\n\n async getPiPermissions(pi: string): Promise<PiPermissions> {\n return this.request(`/pi/${pi}/perm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9E;AAAA,EAEA,MAAM,mBAAiD;AACrD,WAAO,KAAK,QAAQ,mBAAmB,EAAE,QAAQ,OAAO,cAAc,KAAK,CAAC;AAAA,EAC9E;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,iBAAiB,IAAoC;AACzD,WAAO,KAAK,QAAQ,OAAO,EAAE,gBAAgB,EAAE,QAAQ,MAAM,CAAC;AAAA,EAChE;AACF;","names":[]}
package/package.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "@arke-institute/sdk",
3
+ "version": "0.1.0",
4
+ "description": "TypeScript SDK for building applications on the Arke platform",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.mjs",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.mjs",
12
+ "require": "./dist/index.js"
13
+ },
14
+ "./collections": {
15
+ "types": "./dist/collections/index.d.ts",
16
+ "import": "./dist/collections/index.mjs",
17
+ "require": "./dist/collections/index.js"
18
+ }
19
+ },
20
+ "files": [
21
+ "dist"
22
+ ],
23
+ "scripts": {
24
+ "build": "tsup",
25
+ "dev": "tsup --watch",
26
+ "typecheck": "tsc --noEmit",
27
+ "test": "vitest run",
28
+ "clean": "rm -rf dist",
29
+ "prepublishOnly": "npm run build"
30
+ },
31
+ "dependencies": {},
32
+ "devDependencies": {
33
+ "tsup": "^8.0.0",
34
+ "typescript": "^5.3.0",
35
+ "vitest": "^1.0.0"
36
+ },
37
+ "keywords": [
38
+ "arke",
39
+ "sdk",
40
+ "collections",
41
+ "content",
42
+ "typescript"
43
+ ],
44
+ "license": "MIT",
45
+ "repository": {
46
+ "type": "git",
47
+ "url": "https://github.com/Arke-Institute/arke-sdk"
48
+ },
49
+ "author": "Arke Institute",
50
+ "engines": {
51
+ "node": ">=18"
52
+ }
53
+ }