@arke-institute/sdk 0.1.0 → 0.1.2
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.d.mts → client-dAk3E64p.d.cts} +1 -7
- package/dist/client-dAk3E64p.d.ts +183 -0
- package/dist/{index.mjs → collections/index.cjs} +34 -5
- package/dist/collections/index.cjs.map +1 -0
- package/dist/collections/index.d.cts +9 -0
- package/dist/collections/index.d.ts +9 -1
- package/dist/collections/index.js +5 -32
- package/dist/collections/index.js.map +1 -1
- package/dist/content/index.cjs +506 -0
- package/dist/content/index.cjs.map +1 -0
- package/dist/content/index.d.cts +403 -0
- package/dist/content/index.d.ts +403 -0
- package/dist/content/index.js +473 -0
- package/dist/content/index.js.map +1 -0
- package/dist/edit/index.cjs +1029 -0
- package/dist/edit/index.cjs.map +1 -0
- package/dist/edit/index.d.cts +78 -0
- package/dist/edit/index.d.ts +78 -0
- package/dist/edit/index.js +983 -0
- package/dist/edit/index.js.map +1 -0
- package/dist/errors-3L7IiHcr.d.cts +480 -0
- package/dist/errors-B82BMmRP.d.cts +343 -0
- package/dist/errors-B82BMmRP.d.ts +343 -0
- package/dist/errors-BTe8GKRQ.d.ts +480 -0
- package/dist/graph/index.cjs +433 -0
- package/dist/graph/index.cjs.map +1 -0
- package/dist/graph/index.d.cts +456 -0
- package/dist/graph/index.d.ts +456 -0
- package/dist/graph/index.js +402 -0
- package/dist/graph/index.js.map +1 -0
- package/dist/index.cjs +3761 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +7 -0
- package/dist/index.d.ts +7 -189
- package/dist/index.js +3502 -30
- package/dist/index.js.map +1 -1
- package/dist/query/index.cjs +289 -0
- package/dist/query/index.cjs.map +1 -0
- package/dist/query/index.d.cts +541 -0
- package/dist/query/index.d.ts +541 -0
- package/dist/query/index.js +261 -0
- package/dist/query/index.js.map +1 -0
- package/dist/upload/index.cjs +1634 -0
- package/dist/upload/index.cjs.map +1 -0
- package/dist/upload/index.d.cts +150 -0
- package/dist/upload/index.d.ts +150 -0
- package/dist/upload/index.js +1597 -0
- package/dist/upload/index.js.map +1 -0
- package/package.json +43 -8
- package/dist/collections/index.d.mts +0 -1
- package/dist/collections/index.mjs +0 -204
- package/dist/collections/index.mjs.map +0 -1
- package/dist/index.mjs.map +0 -1
|
@@ -180,10 +180,4 @@ declare class CollectionsClient {
|
|
|
180
180
|
getPiPermissions(pi: string): Promise<PiPermissions>;
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
-
|
|
184
|
-
code: string;
|
|
185
|
-
details?: unknown | undefined;
|
|
186
|
-
constructor(message: string, code?: string, details?: unknown | undefined);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
export { type ChangeRootPayload, type ChangeRootResponse, type Collection, type CollectionDetails, type CollectionRole, type CollectionVisibility, CollectionsClient, type CollectionsClientConfig, CollectionsError, type CreateCollectionPayload, type Invitation, type InvitationUser, type InvitationsResponse, type Member, type MemberUser, type MembersResponse, type MyAccessResponse, type MyCollectionsResponse, type PaginatedCollections, type PiPermissions, type RegisterRootPayload, type RootResponse, type SuccessResponse, type UpdateCollectionPayload };
|
|
183
|
+
export { CollectionsClient as C, type Invitation as I, type Member as M, type PaginatedCollections as P, type RegisterRootPayload as R, type SuccessResponse as S, type UpdateCollectionPayload as U, type CollectionsClientConfig as a, type Collection as b, type CollectionDetails as c, type CollectionRole as d, type CollectionVisibility as e, type CreateCollectionPayload as f, type ChangeRootPayload as g, type ChangeRootResponse as h, type MemberUser as i, type MembersResponse as j, type InvitationUser as k, type InvitationsResponse as l, type MyAccessResponse as m, type MyCollectionsResponse as n, type PiPermissions as o, type RootResponse as p };
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
type CollectionVisibility = 'public' | 'private';
|
|
2
|
+
type CollectionRole = 'owner' | 'editor';
|
|
3
|
+
interface Collection {
|
|
4
|
+
id: string;
|
|
5
|
+
title: string;
|
|
6
|
+
slug: string;
|
|
7
|
+
description?: string | null;
|
|
8
|
+
visibility: CollectionVisibility;
|
|
9
|
+
creator_user_id?: string;
|
|
10
|
+
created_at?: string;
|
|
11
|
+
updated_at?: string;
|
|
12
|
+
}
|
|
13
|
+
interface CollectionDetails extends Collection {
|
|
14
|
+
member_count: number;
|
|
15
|
+
root_pi: string | null;
|
|
16
|
+
users?: {
|
|
17
|
+
email?: string;
|
|
18
|
+
name?: string | null;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
interface PaginatedCollections {
|
|
22
|
+
collections: CollectionDetails[];
|
|
23
|
+
pagination: {
|
|
24
|
+
total: number | null;
|
|
25
|
+
limit: number;
|
|
26
|
+
offset: number;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
interface MemberUser {
|
|
30
|
+
id: string;
|
|
31
|
+
email: string;
|
|
32
|
+
name?: string | null;
|
|
33
|
+
}
|
|
34
|
+
interface Member {
|
|
35
|
+
role: CollectionRole;
|
|
36
|
+
created_at?: string;
|
|
37
|
+
user: MemberUser;
|
|
38
|
+
}
|
|
39
|
+
interface MembersResponse {
|
|
40
|
+
members: Member[];
|
|
41
|
+
}
|
|
42
|
+
interface InvitationUser {
|
|
43
|
+
email: string;
|
|
44
|
+
name?: string | null;
|
|
45
|
+
}
|
|
46
|
+
interface Invitation {
|
|
47
|
+
id: string;
|
|
48
|
+
role: CollectionRole;
|
|
49
|
+
status: 'pending' | 'accepted' | 'declined' | 'expired';
|
|
50
|
+
expires_at: string;
|
|
51
|
+
created_at: string;
|
|
52
|
+
responded_at?: string | null;
|
|
53
|
+
invitee?: InvitationUser;
|
|
54
|
+
inviter?: InvitationUser;
|
|
55
|
+
collection?: {
|
|
56
|
+
id: string;
|
|
57
|
+
title: string;
|
|
58
|
+
slug: string;
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
interface InvitationsResponse {
|
|
62
|
+
invitations: Invitation[];
|
|
63
|
+
}
|
|
64
|
+
interface CreateCollectionPayload {
|
|
65
|
+
title: string;
|
|
66
|
+
slug: string;
|
|
67
|
+
description?: string;
|
|
68
|
+
visibility?: CollectionVisibility;
|
|
69
|
+
}
|
|
70
|
+
interface RegisterRootPayload extends CreateCollectionPayload {
|
|
71
|
+
rootPi: string;
|
|
72
|
+
}
|
|
73
|
+
interface UpdateCollectionPayload {
|
|
74
|
+
title?: string;
|
|
75
|
+
description?: string;
|
|
76
|
+
visibility?: CollectionVisibility;
|
|
77
|
+
}
|
|
78
|
+
interface ChangeRootPayload {
|
|
79
|
+
newRootPi: string;
|
|
80
|
+
}
|
|
81
|
+
interface MyCollectionsResponse {
|
|
82
|
+
owned: Array<Collection & {
|
|
83
|
+
role: CollectionRole;
|
|
84
|
+
}>;
|
|
85
|
+
editing: Array<Collection & {
|
|
86
|
+
role: CollectionRole;
|
|
87
|
+
}>;
|
|
88
|
+
total: number;
|
|
89
|
+
}
|
|
90
|
+
interface MyAccessResponse {
|
|
91
|
+
isMember: boolean;
|
|
92
|
+
role: CollectionRole | null;
|
|
93
|
+
canView: boolean;
|
|
94
|
+
canEdit: boolean;
|
|
95
|
+
canInvite: boolean;
|
|
96
|
+
canManageMembers: boolean;
|
|
97
|
+
canDelete: boolean;
|
|
98
|
+
}
|
|
99
|
+
interface RootResponse {
|
|
100
|
+
rootPi: string;
|
|
101
|
+
}
|
|
102
|
+
interface ChangeRootResponse {
|
|
103
|
+
previousRoot: string | null;
|
|
104
|
+
newRoot: string;
|
|
105
|
+
}
|
|
106
|
+
interface SuccessResponse {
|
|
107
|
+
success: boolean;
|
|
108
|
+
}
|
|
109
|
+
interface PiPermissions {
|
|
110
|
+
pi: string;
|
|
111
|
+
canView: boolean;
|
|
112
|
+
canEdit: boolean;
|
|
113
|
+
canAdminister: boolean;
|
|
114
|
+
collection: {
|
|
115
|
+
id: string;
|
|
116
|
+
title: string;
|
|
117
|
+
slug: string;
|
|
118
|
+
visibility: CollectionVisibility;
|
|
119
|
+
role: CollectionRole | null;
|
|
120
|
+
rootPi: string;
|
|
121
|
+
hops: number;
|
|
122
|
+
} | null;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
interface CollectionsClientConfig {
|
|
126
|
+
/**
|
|
127
|
+
* Gateway base URL (e.g., https://api.arke.institute).
|
|
128
|
+
* Must already point at the Arke gateway that proxies /collections/*.
|
|
129
|
+
*/
|
|
130
|
+
gatewayUrl: string;
|
|
131
|
+
/**
|
|
132
|
+
* Optional bearer token for authenticated routes.
|
|
133
|
+
* Public routes will still include it if provided.
|
|
134
|
+
*/
|
|
135
|
+
authToken?: string;
|
|
136
|
+
/**
|
|
137
|
+
* Optional custom fetch (useful for testing).
|
|
138
|
+
*/
|
|
139
|
+
fetchImpl?: typeof fetch;
|
|
140
|
+
}
|
|
141
|
+
declare class CollectionsClient {
|
|
142
|
+
private baseUrl;
|
|
143
|
+
private authToken?;
|
|
144
|
+
private fetchImpl;
|
|
145
|
+
constructor(config: CollectionsClientConfig);
|
|
146
|
+
setAuthToken(token?: string): void;
|
|
147
|
+
private buildUrl;
|
|
148
|
+
private getHeaders;
|
|
149
|
+
private request;
|
|
150
|
+
listCollections(params?: {
|
|
151
|
+
limit?: number;
|
|
152
|
+
offset?: number;
|
|
153
|
+
}): Promise<PaginatedCollections>;
|
|
154
|
+
getCollection(id: string): Promise<CollectionDetails>;
|
|
155
|
+
getCollectionRoot(id: string): Promise<RootResponse>;
|
|
156
|
+
getMyAccess(id: string): Promise<MyAccessResponse>;
|
|
157
|
+
createCollection(payload: CreateCollectionPayload): Promise<Collection>;
|
|
158
|
+
registerRoot(payload: RegisterRootPayload): Promise<Collection & {
|
|
159
|
+
rootPi: string;
|
|
160
|
+
}>;
|
|
161
|
+
updateCollection(id: string, payload: UpdateCollectionPayload): Promise<Collection>;
|
|
162
|
+
changeRoot(id: string, payload: ChangeRootPayload): Promise<ChangeRootResponse>;
|
|
163
|
+
deleteCollection(id: string): Promise<SuccessResponse>;
|
|
164
|
+
listMembers(collectionId: string): Promise<MembersResponse>;
|
|
165
|
+
updateMemberRole(collectionId: string, userId: string, role: CollectionRole): Promise<{
|
|
166
|
+
success: true;
|
|
167
|
+
role: CollectionRole;
|
|
168
|
+
}>;
|
|
169
|
+
removeMember(collectionId: string, userId: string): Promise<SuccessResponse>;
|
|
170
|
+
createInvitation(collectionId: string, email: string, role: CollectionRole): Promise<Invitation>;
|
|
171
|
+
listInvitations(collectionId: string): Promise<InvitationsResponse>;
|
|
172
|
+
acceptInvitation(invitationId: string): Promise<{
|
|
173
|
+
success: true;
|
|
174
|
+
role: CollectionRole;
|
|
175
|
+
}>;
|
|
176
|
+
declineInvitation(invitationId: string): Promise<SuccessResponse>;
|
|
177
|
+
revokeInvitation(invitationId: string): Promise<SuccessResponse>;
|
|
178
|
+
getMyCollections(): Promise<MyCollectionsResponse>;
|
|
179
|
+
getMyInvitations(): Promise<InvitationsResponse>;
|
|
180
|
+
getPiPermissions(pi: string): Promise<PiPermissions>;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export { CollectionsClient as C, type Invitation as I, type Member as M, type PaginatedCollections as P, type RegisterRootPayload as R, type SuccessResponse as S, type UpdateCollectionPayload as U, type CollectionsClientConfig as a, type Collection as b, type CollectionDetails as c, type CollectionRole as d, type CollectionVisibility as e, type CreateCollectionPayload as f, type ChangeRootPayload as g, type ChangeRootResponse as h, type MemberUser as i, type MembersResponse as j, type InvitationUser as k, type InvitationsResponse as l, type MyAccessResponse as m, type MyCollectionsResponse as n, type PiPermissions as o, type RootResponse as p };
|
|
@@ -1,3 +1,30 @@
|
|
|
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
|
+
|
|
1
28
|
// src/collections/errors.ts
|
|
2
29
|
var CollectionsError = class extends Error {
|
|
3
30
|
constructor(message, code = "UNKNOWN_ERROR", details) {
|
|
@@ -65,10 +92,11 @@ var CollectionsClient = class {
|
|
|
65
92
|
return await response.text();
|
|
66
93
|
}
|
|
67
94
|
let body;
|
|
95
|
+
const text = await response.text();
|
|
68
96
|
try {
|
|
69
|
-
body =
|
|
97
|
+
body = JSON.parse(text);
|
|
70
98
|
} catch {
|
|
71
|
-
body =
|
|
99
|
+
body = text;
|
|
72
100
|
}
|
|
73
101
|
const message = body?.error && typeof body.error === "string" ? body.error : `Request failed with status ${response.status}`;
|
|
74
102
|
throw new CollectionsError(message, "HTTP_ERROR", {
|
|
@@ -197,8 +225,9 @@ var CollectionsClient = class {
|
|
|
197
225
|
return this.request(`/pi/${pi}/permissions`, { method: "GET" });
|
|
198
226
|
}
|
|
199
227
|
};
|
|
200
|
-
export
|
|
228
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
229
|
+
0 && (module.exports = {
|
|
201
230
|
CollectionsClient,
|
|
202
231
|
CollectionsError
|
|
203
|
-
};
|
|
204
|
-
//# sourceMappingURL=index.
|
|
232
|
+
});
|
|
233
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
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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0,0 +1,9 @@
|
|
|
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 +1,9 @@
|
|
|
1
|
-
export { ChangeRootPayload, ChangeRootResponse, Collection, CollectionDetails, CollectionRole, CollectionVisibility, CollectionsClient, CollectionsClientConfig,
|
|
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,30 +1,3 @@
|
|
|
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
1
|
// src/collections/errors.ts
|
|
29
2
|
var CollectionsError = class extends Error {
|
|
30
3
|
constructor(message, code = "UNKNOWN_ERROR", details) {
|
|
@@ -92,10 +65,11 @@ var CollectionsClient = class {
|
|
|
92
65
|
return await response.text();
|
|
93
66
|
}
|
|
94
67
|
let body;
|
|
68
|
+
const text = await response.text();
|
|
95
69
|
try {
|
|
96
|
-
body =
|
|
70
|
+
body = JSON.parse(text);
|
|
97
71
|
} catch {
|
|
98
|
-
body =
|
|
72
|
+
body = text;
|
|
99
73
|
}
|
|
100
74
|
const message = body?.error && typeof body.error === "string" ? body.error : `Request failed with status ${response.status}`;
|
|
101
75
|
throw new CollectionsError(message, "HTTP_ERROR", {
|
|
@@ -224,9 +198,8 @@ var CollectionsClient = class {
|
|
|
224
198
|
return this.request(`/pi/${pi}/permissions`, { method: "GET" });
|
|
225
199
|
}
|
|
226
200
|
};
|
|
227
|
-
|
|
228
|
-
0 && (module.exports = {
|
|
201
|
+
export {
|
|
229
202
|
CollectionsClient,
|
|
230
203
|
CollectionsError
|
|
231
|
-
}
|
|
204
|
+
};
|
|
232
205
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
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 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;;;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,WAAO,KAAK,QAAQ,OAAO,EAAE,gBAAgB,EAAE,QAAQ,MAAM,CAAC;AAAA,EAChE;AACF;","names":[]}
|
|
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,QAAI,OAAO;AACT,aAAO,QAAQ,KAAK,EAAE,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AAC9C,YAAI,UAAU,UAAa,UAAU,MAAM;AACzC,cAAI,aAAa,IAAI,KAAK,OAAO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