@arke-institute/sdk 0.1.3 → 2.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.
Files changed (66) hide show
  1. package/README.md +222 -176
  2. package/dist/crypto-CQnwqWQn.d.ts +459 -0
  3. package/dist/crypto-iYgzUi77.d.cts +459 -0
  4. package/dist/generated/index.cjs +19 -0
  5. package/dist/generated/index.cjs.map +1 -0
  6. package/dist/generated/index.d.cts +6545 -0
  7. package/dist/generated/index.d.ts +6545 -0
  8. package/dist/generated/index.js +1 -0
  9. package/dist/generated/index.js.map +1 -0
  10. package/dist/index.cjs +725 -4248
  11. package/dist/index.cjs.map +1 -1
  12. package/dist/index.d.cts +62 -7
  13. package/dist/index.d.ts +62 -7
  14. package/dist/index.js +706 -4221
  15. package/dist/index.js.map +1 -1
  16. package/dist/operations/index.cjs +806 -0
  17. package/dist/operations/index.cjs.map +1 -0
  18. package/dist/operations/index.d.cts +157 -0
  19. package/dist/operations/index.d.ts +157 -0
  20. package/dist/operations/index.js +759 -0
  21. package/dist/operations/index.js.map +1 -0
  22. package/openapi/spec.json +8648 -0
  23. package/openapi/version.json +7 -0
  24. package/package.json +51 -52
  25. package/dist/client-dAk3E64p.d.cts +0 -183
  26. package/dist/client-dAk3E64p.d.ts +0 -183
  27. package/dist/collections/index.cjs +0 -233
  28. package/dist/collections/index.cjs.map +0 -1
  29. package/dist/collections/index.d.cts +0 -9
  30. package/dist/collections/index.d.ts +0 -9
  31. package/dist/collections/index.js +0 -205
  32. package/dist/collections/index.js.map +0 -1
  33. package/dist/content/index.cjs +0 -591
  34. package/dist/content/index.cjs.map +0 -1
  35. package/dist/content/index.d.cts +0 -516
  36. package/dist/content/index.d.ts +0 -516
  37. package/dist/content/index.js +0 -558
  38. package/dist/content/index.js.map +0 -1
  39. package/dist/edit/index.cjs +0 -1503
  40. package/dist/edit/index.cjs.map +0 -1
  41. package/dist/edit/index.d.cts +0 -78
  42. package/dist/edit/index.d.ts +0 -78
  43. package/dist/edit/index.js +0 -1447
  44. package/dist/edit/index.js.map +0 -1
  45. package/dist/errors-3L7IiHcr.d.cts +0 -480
  46. package/dist/errors-BTe8GKRQ.d.ts +0 -480
  47. package/dist/errors-CT7yzKkU.d.cts +0 -874
  48. package/dist/errors-CT7yzKkU.d.ts +0 -874
  49. package/dist/graph/index.cjs +0 -427
  50. package/dist/graph/index.cjs.map +0 -1
  51. package/dist/graph/index.d.cts +0 -485
  52. package/dist/graph/index.d.ts +0 -485
  53. package/dist/graph/index.js +0 -396
  54. package/dist/graph/index.js.map +0 -1
  55. package/dist/query/index.cjs +0 -356
  56. package/dist/query/index.cjs.map +0 -1
  57. package/dist/query/index.d.cts +0 -636
  58. package/dist/query/index.d.ts +0 -636
  59. package/dist/query/index.js +0 -328
  60. package/dist/query/index.js.map +0 -1
  61. package/dist/upload/index.cjs +0 -1634
  62. package/dist/upload/index.cjs.map +0 -1
  63. package/dist/upload/index.d.cts +0 -150
  64. package/dist/upload/index.d.ts +0 -150
  65. package/dist/upload/index.js +0 -1597
  66. package/dist/upload/index.js.map +0 -1
@@ -1,233 +0,0 @@
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/collections/index.ts
21
- var collections_exports = {};
22
- __export(collections_exports, {
23
- CollectionsClient: () => CollectionsClient,
24
- CollectionsError: () => CollectionsError
25
- });
26
- module.exports = __toCommonJS(collections_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
- const text = await response.text();
96
- try {
97
- body = JSON.parse(text);
98
- } catch {
99
- body = text;
100
- }
101
- const message = body?.error && typeof body.error === "string" ? body.error : `Request failed with status ${response.status}`;
102
- throw new CollectionsError(message, "HTTP_ERROR", {
103
- status: response.status,
104
- body
105
- });
106
- }
107
- // ---------------------------------------------------------------------------
108
- // Collections
109
- // ---------------------------------------------------------------------------
110
- async listCollections(params) {
111
- return this.request("/collections", {
112
- method: "GET",
113
- query: { limit: params?.limit, offset: params?.offset }
114
- });
115
- }
116
- async getCollection(id) {
117
- return this.request(`/collections/${id}`, { method: "GET" });
118
- }
119
- async getCollectionRoot(id) {
120
- return this.request(`/collections/${id}/root`, { method: "GET" });
121
- }
122
- async getMyAccess(id) {
123
- return this.request(`/collections/${id}/my-access`, { method: "GET", authRequired: true });
124
- }
125
- async createCollection(payload) {
126
- return this.request("/collections", {
127
- method: "POST",
128
- authRequired: true,
129
- body: JSON.stringify(payload)
130
- });
131
- }
132
- async registerRoot(payload) {
133
- return this.request("/collections/register-root", {
134
- method: "POST",
135
- authRequired: true,
136
- body: JSON.stringify(payload)
137
- });
138
- }
139
- async updateCollection(id, payload) {
140
- return this.request(`/collections/${id}`, {
141
- method: "PATCH",
142
- authRequired: true,
143
- body: JSON.stringify(payload)
144
- });
145
- }
146
- async changeRoot(id, payload) {
147
- return this.request(`/collections/${id}/change-root`, {
148
- method: "PATCH",
149
- authRequired: true,
150
- body: JSON.stringify(payload)
151
- });
152
- }
153
- async deleteCollection(id) {
154
- return this.request(`/collections/${id}`, {
155
- method: "DELETE",
156
- authRequired: true
157
- });
158
- }
159
- // ---------------------------------------------------------------------------
160
- // Members
161
- // ---------------------------------------------------------------------------
162
- async listMembers(collectionId) {
163
- return this.request(`/collections/${collectionId}/members`, { method: "GET" });
164
- }
165
- async updateMemberRole(collectionId, userId, role) {
166
- return this.request(`/collections/${collectionId}/members/${userId}`, {
167
- method: "PATCH",
168
- authRequired: true,
169
- body: JSON.stringify({ role })
170
- });
171
- }
172
- async removeMember(collectionId, userId) {
173
- return this.request(`/collections/${collectionId}/members/${userId}`, {
174
- method: "DELETE",
175
- authRequired: true
176
- });
177
- }
178
- // ---------------------------------------------------------------------------
179
- // Invitations
180
- // ---------------------------------------------------------------------------
181
- async createInvitation(collectionId, email, role) {
182
- return this.request(`/collections/${collectionId}/invitations`, {
183
- method: "POST",
184
- authRequired: true,
185
- body: JSON.stringify({ email, role })
186
- });
187
- }
188
- async listInvitations(collectionId) {
189
- return this.request(`/collections/${collectionId}/invitations`, {
190
- method: "GET",
191
- authRequired: true
192
- });
193
- }
194
- async acceptInvitation(invitationId) {
195
- return this.request(`/invitations/${invitationId}/accept`, {
196
- method: "POST",
197
- authRequired: true
198
- });
199
- }
200
- async declineInvitation(invitationId) {
201
- return this.request(`/invitations/${invitationId}/decline`, {
202
- method: "POST",
203
- authRequired: true
204
- });
205
- }
206
- async revokeInvitation(invitationId) {
207
- return this.request(`/invitations/${invitationId}`, {
208
- method: "DELETE",
209
- authRequired: true
210
- });
211
- }
212
- // ---------------------------------------------------------------------------
213
- // Current user
214
- // ---------------------------------------------------------------------------
215
- async getMyCollections() {
216
- return this.request("/me/collections", { method: "GET", authRequired: true });
217
- }
218
- async getMyInvitations() {
219
- return this.request("/me/invitations", { method: "GET", authRequired: true });
220
- }
221
- // ---------------------------------------------------------------------------
222
- // PI permissions
223
- // ---------------------------------------------------------------------------
224
- async getPiPermissions(pi) {
225
- return this.request(`/pi/${pi}/permissions`, { method: "GET" });
226
- }
227
- };
228
- // Annotate the CommonJS export names for ESM import in node:
229
- 0 && (module.exports = {
230
- CollectionsClient,
231
- CollectionsError
232
- });
233
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/collections/index.ts","../../src/collections/errors.ts","../../src/collections/client.ts"],"sourcesContent":["export { CollectionsClient, type CollectionsClientConfig } from './client';\nexport { CollectionsError } from './errors';\nexport type {\n ChangeRootPayload,\n ChangeRootResponse,\n Collection,\n CollectionDetails,\n CollectionRole,\n CollectionVisibility,\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","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 const text = await response.text();\n try {\n body = JSON.parse(text);\n } catch {\n body = 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,C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ACxE,WAAO,KAAK,QAAQ,gBAAgB,YAAY,gBAAgB;AAAA,MAC9D,QAAQ;AAAA,MACR,cAAc;AAAA,IAChB,CAAC;AAAA,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":[]}
@@ -1,9 +0,0 @@
1
- export { g as ChangeRootPayload, h as ChangeRootResponse, b as Collection, c as CollectionDetails, d as CollectionRole, e as CollectionVisibility, C as CollectionsClient, a as CollectionsClientConfig, f as CreateCollectionPayload, I as Invitation, l as InvitationsResponse, M as Member, j as MembersResponse, m as MyAccessResponse, n as MyCollectionsResponse, P as PaginatedCollections, o as PiPermissions, R as RegisterRootPayload, p as RootResponse, S as SuccessResponse, U as UpdateCollectionPayload } from '../client-dAk3E64p.cjs';
2
-
3
- declare class CollectionsError extends Error {
4
- code: string;
5
- details?: unknown | undefined;
6
- constructor(message: string, code?: string, details?: unknown | undefined);
7
- }
8
-
9
- export { CollectionsError };
@@ -1,9 +0,0 @@
1
- export { g as ChangeRootPayload, h as ChangeRootResponse, b as Collection, c as CollectionDetails, d as CollectionRole, e as CollectionVisibility, C as CollectionsClient, a as CollectionsClientConfig, f as CreateCollectionPayload, I as Invitation, l as InvitationsResponse, M as Member, j as MembersResponse, m as MyAccessResponse, n as MyCollectionsResponse, P as PaginatedCollections, o as PiPermissions, R as RegisterRootPayload, p as RootResponse, S as SuccessResponse, U as UpdateCollectionPayload } from '../client-dAk3E64p.js';
2
-
3
- declare class CollectionsError extends Error {
4
- code: string;
5
- details?: unknown | undefined;
6
- constructor(message: string, code?: string, details?: unknown | undefined);
7
- }
8
-
9
- export { CollectionsError };
@@ -1,205 +0,0 @@
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
- const text = await response.text();
69
- try {
70
- body = JSON.parse(text);
71
- } catch {
72
- body = text;
73
- }
74
- const message = body?.error && typeof body.error === "string" ? body.error : `Request failed with status ${response.status}`;
75
- throw new CollectionsError(message, "HTTP_ERROR", {
76
- status: response.status,
77
- body
78
- });
79
- }
80
- // ---------------------------------------------------------------------------
81
- // Collections
82
- // ---------------------------------------------------------------------------
83
- async listCollections(params) {
84
- return this.request("/collections", {
85
- method: "GET",
86
- query: { limit: params?.limit, offset: params?.offset }
87
- });
88
- }
89
- async getCollection(id) {
90
- return this.request(`/collections/${id}`, { method: "GET" });
91
- }
92
- async getCollectionRoot(id) {
93
- return this.request(`/collections/${id}/root`, { method: "GET" });
94
- }
95
- async getMyAccess(id) {
96
- return this.request(`/collections/${id}/my-access`, { method: "GET", authRequired: true });
97
- }
98
- async createCollection(payload) {
99
- return this.request("/collections", {
100
- method: "POST",
101
- authRequired: true,
102
- body: JSON.stringify(payload)
103
- });
104
- }
105
- async registerRoot(payload) {
106
- return this.request("/collections/register-root", {
107
- method: "POST",
108
- authRequired: true,
109
- body: JSON.stringify(payload)
110
- });
111
- }
112
- async updateCollection(id, payload) {
113
- return this.request(`/collections/${id}`, {
114
- method: "PATCH",
115
- authRequired: true,
116
- body: JSON.stringify(payload)
117
- });
118
- }
119
- async changeRoot(id, payload) {
120
- return this.request(`/collections/${id}/change-root`, {
121
- method: "PATCH",
122
- authRequired: true,
123
- body: JSON.stringify(payload)
124
- });
125
- }
126
- async deleteCollection(id) {
127
- return this.request(`/collections/${id}`, {
128
- method: "DELETE",
129
- authRequired: true
130
- });
131
- }
132
- // ---------------------------------------------------------------------------
133
- // Members
134
- // ---------------------------------------------------------------------------
135
- async listMembers(collectionId) {
136
- return this.request(`/collections/${collectionId}/members`, { method: "GET" });
137
- }
138
- async updateMemberRole(collectionId, userId, role) {
139
- return this.request(`/collections/${collectionId}/members/${userId}`, {
140
- method: "PATCH",
141
- authRequired: true,
142
- body: JSON.stringify({ role })
143
- });
144
- }
145
- async removeMember(collectionId, userId) {
146
- return this.request(`/collections/${collectionId}/members/${userId}`, {
147
- method: "DELETE",
148
- authRequired: true
149
- });
150
- }
151
- // ---------------------------------------------------------------------------
152
- // Invitations
153
- // ---------------------------------------------------------------------------
154
- async createInvitation(collectionId, email, role) {
155
- return this.request(`/collections/${collectionId}/invitations`, {
156
- method: "POST",
157
- authRequired: true,
158
- body: JSON.stringify({ email, role })
159
- });
160
- }
161
- async listInvitations(collectionId) {
162
- return this.request(`/collections/${collectionId}/invitations`, {
163
- method: "GET",
164
- authRequired: true
165
- });
166
- }
167
- async acceptInvitation(invitationId) {
168
- return this.request(`/invitations/${invitationId}/accept`, {
169
- method: "POST",
170
- authRequired: true
171
- });
172
- }
173
- async declineInvitation(invitationId) {
174
- return this.request(`/invitations/${invitationId}/decline`, {
175
- method: "POST",
176
- authRequired: true
177
- });
178
- }
179
- async revokeInvitation(invitationId) {
180
- return this.request(`/invitations/${invitationId}`, {
181
- method: "DELETE",
182
- authRequired: true
183
- });
184
- }
185
- // ---------------------------------------------------------------------------
186
- // Current user
187
- // ---------------------------------------------------------------------------
188
- async getMyCollections() {
189
- return this.request("/me/collections", { method: "GET", authRequired: true });
190
- }
191
- async getMyInvitations() {
192
- return this.request("/me/invitations", { method: "GET", authRequired: true });
193
- }
194
- // ---------------------------------------------------------------------------
195
- // PI permissions
196
- // ---------------------------------------------------------------------------
197
- async getPiPermissions(pi) {
198
- return this.request(`/pi/${pi}/permissions`, { method: "GET" });
199
- }
200
- };
201
- export {
202
- CollectionsClient,
203
- CollectionsError
204
- };
205
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
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 const text = await response.text();\n try {\n body = JSON.parse(text);\n } catch {\n body = 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":";AAAO,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,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