@celestoai/sdk 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +68 -22
- package/dist/chunk-4KVRJSVJ.js +177 -0
- package/dist/chunk-4KVRJSVJ.js.map +1 -0
- package/dist/chunk-N3HU6ONW.js +148 -0
- package/dist/chunk-N3HU6ONW.js.map +1 -0
- package/dist/chunk-OGMV3NFZ.js +164 -0
- package/dist/chunk-OGMV3NFZ.js.map +1 -0
- package/dist/computers/index.cjs +325 -0
- package/dist/computers/index.cjs.map +1 -0
- package/dist/computers/index.d.cts +107 -0
- package/dist/computers/index.d.ts +107 -0
- package/dist/computers/index.js +8 -0
- package/dist/computers/index.js.map +1 -0
- package/dist/config-BTTpuv_b.d.cts +25 -0
- package/dist/config-BTTpuv_b.d.ts +25 -0
- package/dist/gatekeeper/index.cjs +338 -0
- package/dist/gatekeeper/index.cjs.map +1 -0
- package/dist/gatekeeper/index.d.cts +104 -0
- package/dist/gatekeeper/index.d.ts +104 -0
- package/dist/gatekeeper/index.js +8 -0
- package/dist/gatekeeper/index.js.map +1 -0
- package/dist/index.cjs +511 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +31 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -0
- package/package.json +11 -3
|
@@ -0,0 +1,338 @@
|
|
|
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/gatekeeper/index.ts
|
|
21
|
+
var gatekeeper_exports = {};
|
|
22
|
+
__export(gatekeeper_exports, {
|
|
23
|
+
GatekeeperClient: () => GatekeeperClient
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(gatekeeper_exports);
|
|
26
|
+
|
|
27
|
+
// src/core/config.ts
|
|
28
|
+
var DEFAULT_BASE_URL = "https://api.celesto.ai";
|
|
29
|
+
var buildRequestContext = (config) => ({
|
|
30
|
+
fetch: config.fetch ?? fetch,
|
|
31
|
+
baseUrl: config.baseUrl ?? DEFAULT_BASE_URL,
|
|
32
|
+
token: config.token ?? config.apiKey,
|
|
33
|
+
organizationId: config.organizationId,
|
|
34
|
+
userAgent: config.userAgent,
|
|
35
|
+
timeoutMs: config.timeoutMs,
|
|
36
|
+
headers: config.headers
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// src/core/errors.ts
|
|
40
|
+
var CelestoError = class extends Error {
|
|
41
|
+
constructor(message) {
|
|
42
|
+
super(message);
|
|
43
|
+
this.name = "CelestoError";
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
var CelestoApiError = class extends CelestoError {
|
|
47
|
+
constructor(message, status, data, requestId) {
|
|
48
|
+
super(message);
|
|
49
|
+
this.name = "CelestoApiError";
|
|
50
|
+
this.status = status;
|
|
51
|
+
this.data = data;
|
|
52
|
+
this.requestId = requestId;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
var CelestoNetworkError = class extends CelestoError {
|
|
56
|
+
constructor(message, cause) {
|
|
57
|
+
super(message);
|
|
58
|
+
this.name = "CelestoNetworkError";
|
|
59
|
+
this.cause = cause;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
// src/core/http.ts
|
|
64
|
+
var joinUrl = (baseUrl, path) => {
|
|
65
|
+
const trimmedBase = baseUrl.endsWith("/") ? baseUrl.slice(0, -1) : baseUrl;
|
|
66
|
+
const normalizedPath = path.startsWith("/") ? path : `/${path}`;
|
|
67
|
+
return `${trimmedBase}${normalizedPath}`;
|
|
68
|
+
};
|
|
69
|
+
var buildQuery = (query) => {
|
|
70
|
+
if (!query) {
|
|
71
|
+
return "";
|
|
72
|
+
}
|
|
73
|
+
const params = new URLSearchParams();
|
|
74
|
+
for (const [key, value] of Object.entries(query)) {
|
|
75
|
+
if (value === void 0 || value === null) {
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
if (Array.isArray(value)) {
|
|
79
|
+
for (const item of value) {
|
|
80
|
+
params.append(key, String(item));
|
|
81
|
+
}
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
params.set(key, String(value));
|
|
85
|
+
}
|
|
86
|
+
const serialized = params.toString();
|
|
87
|
+
return serialized ? `?${serialized}` : "";
|
|
88
|
+
};
|
|
89
|
+
var parseResponseBody = async (response) => {
|
|
90
|
+
if (response.status === 204) {
|
|
91
|
+
return void 0;
|
|
92
|
+
}
|
|
93
|
+
const contentType = response.headers.get("content-type") ?? "";
|
|
94
|
+
if (contentType.includes("application/json")) {
|
|
95
|
+
return response.json();
|
|
96
|
+
}
|
|
97
|
+
return response.text();
|
|
98
|
+
};
|
|
99
|
+
var extractErrorMessage = (data, status) => {
|
|
100
|
+
if (data && typeof data === "object") {
|
|
101
|
+
const record = data;
|
|
102
|
+
if (typeof record.detail === "string") {
|
|
103
|
+
return record.detail;
|
|
104
|
+
}
|
|
105
|
+
if (typeof record.message === "string") {
|
|
106
|
+
return record.message;
|
|
107
|
+
}
|
|
108
|
+
if (typeof record.error === "string") {
|
|
109
|
+
return record.error;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return `Request failed with status ${status}`;
|
|
113
|
+
};
|
|
114
|
+
var request = async (ctx, options) => {
|
|
115
|
+
const url = `${joinUrl(ctx.baseUrl, options.path)}${buildQuery(options.query)}`;
|
|
116
|
+
const headers = {
|
|
117
|
+
...ctx.headers ?? {},
|
|
118
|
+
...options.headers ?? {}
|
|
119
|
+
};
|
|
120
|
+
if (ctx.token) {
|
|
121
|
+
headers.Authorization = `Bearer ${ctx.token}`;
|
|
122
|
+
}
|
|
123
|
+
if (ctx.organizationId) {
|
|
124
|
+
headers["X-Current-Organization"] = ctx.organizationId;
|
|
125
|
+
}
|
|
126
|
+
if (ctx.userAgent && !headers["User-Agent"]) {
|
|
127
|
+
headers["User-Agent"] = ctx.userAgent;
|
|
128
|
+
}
|
|
129
|
+
const init = {
|
|
130
|
+
method: options.method,
|
|
131
|
+
headers,
|
|
132
|
+
body: void 0,
|
|
133
|
+
signal: options.signal
|
|
134
|
+
};
|
|
135
|
+
if (options.body !== void 0) {
|
|
136
|
+
headers["Content-Type"] = headers["Content-Type"] ?? "application/json";
|
|
137
|
+
init.body = headers["Content-Type"].includes("application/json") ? JSON.stringify(options.body) : options.body;
|
|
138
|
+
}
|
|
139
|
+
let timeoutId;
|
|
140
|
+
let controller;
|
|
141
|
+
if (!options.signal && ctx.timeoutMs && ctx.timeoutMs > 0) {
|
|
142
|
+
controller = new AbortController();
|
|
143
|
+
timeoutId = setTimeout(() => controller?.abort(), ctx.timeoutMs);
|
|
144
|
+
init.signal = controller.signal;
|
|
145
|
+
}
|
|
146
|
+
try {
|
|
147
|
+
const response = await ctx.fetch(url, init);
|
|
148
|
+
const data = await parseResponseBody(response);
|
|
149
|
+
if (!response.ok) {
|
|
150
|
+
const message = extractErrorMessage(data, response.status);
|
|
151
|
+
throw new CelestoApiError(message, response.status, data, response.headers.get("x-request-id") ?? void 0);
|
|
152
|
+
}
|
|
153
|
+
return data;
|
|
154
|
+
} catch (err) {
|
|
155
|
+
if (err instanceof CelestoApiError) {
|
|
156
|
+
throw err;
|
|
157
|
+
}
|
|
158
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
159
|
+
throw new CelestoNetworkError(error.message, error);
|
|
160
|
+
} finally {
|
|
161
|
+
if (timeoutId) {
|
|
162
|
+
clearTimeout(timeoutId);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
// src/gatekeeper/client.ts
|
|
168
|
+
var toConnectRequest = (payload) => ({
|
|
169
|
+
subject: payload.subject,
|
|
170
|
+
provider: payload.provider ?? "google_drive",
|
|
171
|
+
project_name: payload.projectName,
|
|
172
|
+
redirect_uri: payload.redirectUri
|
|
173
|
+
});
|
|
174
|
+
var toConnectResponse = (payload) => ({
|
|
175
|
+
status: payload.status,
|
|
176
|
+
oauthUrl: payload.oauth_url ?? void 0,
|
|
177
|
+
connectionId: payload.connection_id ?? void 0
|
|
178
|
+
});
|
|
179
|
+
var toConnection = (payload) => ({
|
|
180
|
+
id: payload.id,
|
|
181
|
+
subject: payload.subject,
|
|
182
|
+
provider: payload.provider,
|
|
183
|
+
projectId: payload.project_id,
|
|
184
|
+
accountEmail: payload.account_email ?? null,
|
|
185
|
+
scopes: payload.scopes ?? [],
|
|
186
|
+
status: payload.status,
|
|
187
|
+
createdAt: payload.created_at,
|
|
188
|
+
updatedAt: payload.updated_at,
|
|
189
|
+
lastUsedAt: payload.last_used_at ?? null,
|
|
190
|
+
accessRules: payload.access_rules ? {
|
|
191
|
+
version: payload.access_rules.version ?? "1",
|
|
192
|
+
allowedFolders: payload.access_rules.allowed_folders ?? [],
|
|
193
|
+
allowedFiles: payload.access_rules.allowed_files ?? [],
|
|
194
|
+
unrestricted: false
|
|
195
|
+
} : null
|
|
196
|
+
});
|
|
197
|
+
var toAccessRules = (payload) => ({
|
|
198
|
+
version: payload.version,
|
|
199
|
+
allowedFolders: payload.allowed_folders ?? [],
|
|
200
|
+
allowedFiles: payload.allowed_files ?? [],
|
|
201
|
+
unrestricted: payload.unrestricted
|
|
202
|
+
});
|
|
203
|
+
var toDriveFile = (payload) => ({
|
|
204
|
+
id: payload.id,
|
|
205
|
+
name: payload.name ?? null,
|
|
206
|
+
mimeType: payload.mime_type ?? null,
|
|
207
|
+
size: payload.size ?? null,
|
|
208
|
+
modifiedTime: payload.modified_time ?? null,
|
|
209
|
+
createdTime: payload.created_time ?? null,
|
|
210
|
+
webViewLink: payload.web_view_link ?? null,
|
|
211
|
+
iconLink: payload.icon_link ?? null,
|
|
212
|
+
thumbnailLink: payload.thumbnail_link ?? null,
|
|
213
|
+
parents: payload.parents ?? null,
|
|
214
|
+
driveId: payload.drive_id ?? null,
|
|
215
|
+
shared: payload.shared ?? null,
|
|
216
|
+
ownedByMe: payload.owned_by_me ?? null
|
|
217
|
+
});
|
|
218
|
+
var gatekeeperPath = (path) => `/v1/gatekeeper${path}`;
|
|
219
|
+
var pickOverrides = (options) => ({
|
|
220
|
+
headers: options?.headers,
|
|
221
|
+
signal: options?.signal
|
|
222
|
+
});
|
|
223
|
+
var GatekeeperClient = class {
|
|
224
|
+
constructor(config) {
|
|
225
|
+
this.config = config;
|
|
226
|
+
}
|
|
227
|
+
async connect(payload, options) {
|
|
228
|
+
const ctx = buildRequestContext(this.config);
|
|
229
|
+
const data = await request(ctx, {
|
|
230
|
+
method: "POST",
|
|
231
|
+
path: gatekeeperPath("/connect"),
|
|
232
|
+
body: toConnectRequest(payload),
|
|
233
|
+
...pickOverrides(options)
|
|
234
|
+
});
|
|
235
|
+
return toConnectResponse(data);
|
|
236
|
+
}
|
|
237
|
+
async listConnections(params, options) {
|
|
238
|
+
const ctx = buildRequestContext(this.config);
|
|
239
|
+
const data = await request(ctx, {
|
|
240
|
+
method: "GET",
|
|
241
|
+
path: gatekeeperPath("/connections"),
|
|
242
|
+
query: {
|
|
243
|
+
project_name: params.projectName,
|
|
244
|
+
status_filter: params.statusFilter
|
|
245
|
+
},
|
|
246
|
+
...pickOverrides(options)
|
|
247
|
+
});
|
|
248
|
+
return {
|
|
249
|
+
total: data.total,
|
|
250
|
+
data: data.data.map(toConnection)
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
async getConnection(connectionId, options) {
|
|
254
|
+
const ctx = buildRequestContext(this.config);
|
|
255
|
+
const data = await request(ctx, {
|
|
256
|
+
method: "GET",
|
|
257
|
+
path: gatekeeperPath(`/connections/${connectionId}`),
|
|
258
|
+
...pickOverrides(options)
|
|
259
|
+
});
|
|
260
|
+
return toConnection(data);
|
|
261
|
+
}
|
|
262
|
+
async revokeConnection(params, options) {
|
|
263
|
+
const ctx = buildRequestContext(this.config);
|
|
264
|
+
return request(ctx, {
|
|
265
|
+
method: "DELETE",
|
|
266
|
+
path: gatekeeperPath("/connections"),
|
|
267
|
+
query: {
|
|
268
|
+
subject: params.subject,
|
|
269
|
+
project_name: params.projectName,
|
|
270
|
+
provider: params.provider
|
|
271
|
+
},
|
|
272
|
+
...pickOverrides(options)
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
async listDriveFiles(params, options) {
|
|
276
|
+
const ctx = buildRequestContext(this.config);
|
|
277
|
+
const data = await request(ctx, {
|
|
278
|
+
method: "GET",
|
|
279
|
+
path: gatekeeperPath("/connectors/drive/files"),
|
|
280
|
+
query: {
|
|
281
|
+
project_name: params.projectName,
|
|
282
|
+
subject: params.subject,
|
|
283
|
+
page_size: params.pageSize,
|
|
284
|
+
page_token: params.pageToken,
|
|
285
|
+
folder_id: params.folderId,
|
|
286
|
+
query: params.query,
|
|
287
|
+
include_folders: params.includeFolders,
|
|
288
|
+
order_by: params.orderBy
|
|
289
|
+
},
|
|
290
|
+
...pickOverrides(options)
|
|
291
|
+
});
|
|
292
|
+
return {
|
|
293
|
+
files: data.files.map(toDriveFile),
|
|
294
|
+
nextPageToken: data.next_page_token ?? null
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
async getAccessRules(connectionId, options) {
|
|
298
|
+
const ctx = buildRequestContext(this.config);
|
|
299
|
+
const data = await request(ctx, {
|
|
300
|
+
method: "GET",
|
|
301
|
+
path: gatekeeperPath(`/connections/${connectionId}/access-rules`),
|
|
302
|
+
...pickOverrides(options)
|
|
303
|
+
});
|
|
304
|
+
return toAccessRules(data);
|
|
305
|
+
}
|
|
306
|
+
async updateAccessRules(params, options) {
|
|
307
|
+
const ctx = buildRequestContext(this.config);
|
|
308
|
+
const data = await request(ctx, {
|
|
309
|
+
method: "PUT",
|
|
310
|
+
path: gatekeeperPath("/connections/access-rules"),
|
|
311
|
+
query: {
|
|
312
|
+
subject: params.subject,
|
|
313
|
+
project_name: params.projectName,
|
|
314
|
+
provider: params.provider
|
|
315
|
+
},
|
|
316
|
+
body: {
|
|
317
|
+
allowed_folders: params.accessRules.allowedFolders ?? [],
|
|
318
|
+
allowed_files: params.accessRules.allowedFiles ?? []
|
|
319
|
+
},
|
|
320
|
+
...pickOverrides(options)
|
|
321
|
+
});
|
|
322
|
+
return toAccessRules(data);
|
|
323
|
+
}
|
|
324
|
+
async clearAccessRules(connectionId, options) {
|
|
325
|
+
const ctx = buildRequestContext(this.config);
|
|
326
|
+
const data = await request(ctx, {
|
|
327
|
+
method: "DELETE",
|
|
328
|
+
path: gatekeeperPath(`/connections/${connectionId}/access-rules`),
|
|
329
|
+
...pickOverrides(options)
|
|
330
|
+
});
|
|
331
|
+
return toAccessRules(data);
|
|
332
|
+
}
|
|
333
|
+
};
|
|
334
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
335
|
+
0 && (module.exports = {
|
|
336
|
+
GatekeeperClient
|
|
337
|
+
});
|
|
338
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/gatekeeper/index.ts","../../src/core/config.ts","../../src/core/errors.ts","../../src/core/http.ts","../../src/gatekeeper/client.ts"],"sourcesContent":["export { GatekeeperClient } from \"./client\";\nexport type {\n GatekeeperAccessRules,\n GatekeeperAccessRulesParams,\n GatekeeperAccessRulesUpdate,\n GatekeeperConnectRequest,\n GatekeeperConnectResponse,\n GatekeeperConnection,\n GatekeeperDriveFile,\n GatekeeperDriveListParams,\n GatekeeperDriveListResponse,\n GatekeeperListConnectionsParams,\n GatekeeperListConnectionsResponse,\n GatekeeperRevokeParams,\n GatekeeperRevokeResponse,\n} from \"./types\";\nexport type { RequestOverrides } from \"../core/config\";\n","export type FetchLike = typeof fetch;\n\nexport interface ClientConfig {\n /** Base API URL, e.g. https://api.celesto.ai */\n baseUrl?: string;\n /** Bearer token (API key or JWT). */\n token?: string;\n /** Alias for token. */\n apiKey?: string;\n /** Organization ID to send as X-Current-Organization. */\n organizationId?: string;\n /** Optional user agent for server-side requests. */\n userAgent?: string;\n /** Default request timeout in milliseconds. */\n timeoutMs?: number;\n /** Override fetch implementation (useful for testing). */\n fetch?: FetchLike;\n /** Default headers to include in every request. */\n headers?: Record<string, string>;\n}\n\nexport interface RequestOptions {\n method: \"GET\" | \"POST\" | \"PUT\" | \"PATCH\" | \"DELETE\";\n path: string;\n query?: Record<string, string | number | boolean | undefined | null | (string | number | boolean)[]>;\n body?: unknown;\n headers?: Record<string, string>;\n signal?: AbortSignal;\n}\n\nexport interface RequestOverrides {\n headers?: Record<string, string>;\n signal?: AbortSignal;\n}\n\nexport interface RequestContext {\n fetch: FetchLike;\n baseUrl: string;\n token?: string;\n organizationId?: string;\n userAgent?: string;\n timeoutMs?: number;\n headers?: Record<string, string>;\n}\n\nexport const DEFAULT_BASE_URL = \"https://api.celesto.ai\";\n\nexport const buildRequestContext = (config: ClientConfig): RequestContext => ({\n fetch: config.fetch ?? fetch,\n baseUrl: config.baseUrl ?? DEFAULT_BASE_URL,\n token: config.token ?? config.apiKey,\n organizationId: config.organizationId,\n userAgent: config.userAgent,\n timeoutMs: config.timeoutMs,\n headers: config.headers,\n});\n","/** Base error for all Celesto SDK errors. */\nexport class CelestoError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"CelestoError\";\n }\n}\n\n/** Thrown when an API request returns a non-2xx HTTP status. */\nexport class CelestoApiError extends CelestoError {\n readonly status: number;\n readonly data: unknown;\n readonly requestId?: string;\n\n constructor(message: string, status: number, data: unknown, requestId?: string) {\n super(message);\n this.name = \"CelestoApiError\";\n this.status = status;\n this.data = data;\n this.requestId = requestId;\n }\n}\n\n/** Thrown when fetch() itself fails — DNS, network, timeout, abort. */\nexport class CelestoNetworkError extends CelestoError {\n readonly cause?: Error;\n\n constructor(message: string, cause?: Error) {\n super(message);\n this.name = \"CelestoNetworkError\";\n this.cause = cause;\n }\n}\n","import { CelestoApiError, CelestoNetworkError } from \"./errors\";\nimport { RequestContext, RequestOptions } from \"./config\";\n\nconst joinUrl = (baseUrl: string, path: string): string => {\n const trimmedBase = baseUrl.endsWith(\"/\") ? baseUrl.slice(0, -1) : baseUrl;\n const normalizedPath = path.startsWith(\"/\") ? path : `/${path}`;\n return `${trimmedBase}${normalizedPath}`;\n};\n\nconst buildQuery = (\n query?: RequestOptions[\"query\"],\n): string => {\n if (!query) {\n return \"\";\n }\n\n const params = new URLSearchParams();\n for (const [key, value] of Object.entries(query)) {\n if (value === undefined || value === null) {\n continue;\n }\n if (Array.isArray(value)) {\n for (const item of value) {\n params.append(key, String(item));\n }\n continue;\n }\n params.set(key, String(value));\n }\n\n const serialized = params.toString();\n return serialized ? `?${serialized}` : \"\";\n};\n\nconst parseResponseBody = async (response: Response): Promise<unknown> => {\n if (response.status === 204) {\n return undefined;\n }\n\n const contentType = response.headers.get(\"content-type\") ?? \"\";\n if (contentType.includes(\"application/json\")) {\n return response.json();\n }\n\n return response.text();\n};\n\nconst extractErrorMessage = (data: unknown, status: number): string => {\n if (data && typeof data === \"object\") {\n const record = data as Record<string, unknown>;\n if (typeof record.detail === \"string\") {\n return record.detail;\n }\n if (typeof record.message === \"string\") {\n return record.message;\n }\n if (typeof record.error === \"string\") {\n return record.error;\n }\n }\n return `Request failed with status ${status}`;\n};\n\nexport const request = async <T>(ctx: RequestContext, options: RequestOptions): Promise<T> => {\n const url = `${joinUrl(ctx.baseUrl, options.path)}${buildQuery(options.query)}`;\n\n const headers: Record<string, string> = {\n ...(ctx.headers ?? {}),\n ...(options.headers ?? {}),\n };\n\n if (ctx.token) {\n headers.Authorization = `Bearer ${ctx.token}`;\n }\n\n if (ctx.organizationId) {\n headers[\"X-Current-Organization\"] = ctx.organizationId;\n }\n\n if (ctx.userAgent && !headers[\"User-Agent\"]) {\n headers[\"User-Agent\"] = ctx.userAgent;\n }\n\n const init: RequestInit = {\n method: options.method,\n headers,\n body: undefined,\n signal: options.signal,\n };\n\n if (options.body !== undefined) {\n headers[\"Content-Type\"] = headers[\"Content-Type\"] ?? \"application/json\";\n init.body = headers[\"Content-Type\"].includes(\"application/json\")\n ? JSON.stringify(options.body)\n : (options.body as BodyInit);\n }\n\n let timeoutId: ReturnType<typeof setTimeout> | undefined;\n let controller: AbortController | undefined;\n\n if (!options.signal && ctx.timeoutMs && ctx.timeoutMs > 0) {\n controller = new AbortController();\n timeoutId = setTimeout(() => controller?.abort(), ctx.timeoutMs);\n init.signal = controller.signal;\n }\n\n try {\n const response = await ctx.fetch(url, init);\n const data = await parseResponseBody(response);\n\n if (!response.ok) {\n const message = extractErrorMessage(data, response.status);\n throw new CelestoApiError(message, response.status, data, response.headers.get(\"x-request-id\") ?? undefined);\n }\n\n return data as T;\n } catch (err) {\n if (err instanceof CelestoApiError) {\n throw err;\n }\n const error = err instanceof Error ? err : new Error(String(err));\n throw new CelestoNetworkError(error.message, error);\n } finally {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n }\n};\n","import { buildRequestContext, ClientConfig, RequestOverrides } from \"../core/config\";\nimport { request } from \"../core/http\";\nimport {\n GatekeeperAccessRules,\n GatekeeperAccessRulesParams,\n GatekeeperConnectRequest,\n GatekeeperConnectResponse,\n GatekeeperConnection,\n GatekeeperDriveFile,\n GatekeeperDriveListParams,\n GatekeeperDriveListResponse,\n GatekeeperListConnectionsParams,\n GatekeeperListConnectionsResponse,\n GatekeeperRevokeParams,\n GatekeeperRevokeResponse,\n} from \"./types\";\n\ninterface GatekeeperConnectRequestWire {\n subject: string;\n provider: string;\n project_name: string;\n redirect_uri?: string;\n}\n\ninterface GatekeeperConnectResponseWire {\n status: string;\n oauth_url?: string | null;\n connection_id?: string | null;\n}\n\ninterface GatekeeperConnectionWire {\n id: string;\n subject: string;\n provider: string;\n project_id: string;\n account_email?: string | null;\n scopes?: string[];\n status: string;\n created_at: string;\n updated_at: string;\n last_used_at?: string | null;\n access_rules?: {\n allowed_folders?: string[];\n allowed_files?: string[];\n version?: string;\n } | null;\n}\n\ninterface GatekeeperListConnectionsResponseWire {\n data: GatekeeperConnectionWire[];\n total: number;\n}\n\ninterface GatekeeperDriveFileWire {\n id: string;\n name?: string | null;\n mime_type?: string | null;\n size?: number | null;\n modified_time?: string | null;\n created_time?: string | null;\n web_view_link?: string | null;\n icon_link?: string | null;\n thumbnail_link?: string | null;\n parents?: string[] | null;\n drive_id?: string | null;\n shared?: boolean | null;\n owned_by_me?: boolean | null;\n}\n\ninterface GatekeeperDriveListResponseWire {\n files: GatekeeperDriveFileWire[];\n next_page_token?: string | null;\n}\n\ninterface GatekeeperAccessRulesResponseWire {\n version: string;\n allowed_folders: string[];\n allowed_files: string[];\n unrestricted: boolean;\n}\n\nconst toConnectRequest = (payload: GatekeeperConnectRequest): GatekeeperConnectRequestWire => ({\n subject: payload.subject,\n provider: payload.provider ?? \"google_drive\",\n project_name: payload.projectName,\n redirect_uri: payload.redirectUri,\n});\n\nconst toConnectResponse = (payload: GatekeeperConnectResponseWire): GatekeeperConnectResponse => ({\n status: payload.status,\n oauthUrl: payload.oauth_url ?? undefined,\n connectionId: payload.connection_id ?? undefined,\n});\n\nconst toConnection = (payload: GatekeeperConnectionWire): GatekeeperConnection => ({\n id: payload.id,\n subject: payload.subject,\n provider: payload.provider,\n projectId: payload.project_id,\n accountEmail: payload.account_email ?? null,\n scopes: payload.scopes ?? [],\n status: payload.status,\n createdAt: payload.created_at,\n updatedAt: payload.updated_at,\n lastUsedAt: payload.last_used_at ?? null,\n accessRules: payload.access_rules\n ? {\n version: payload.access_rules.version ?? \"1\",\n allowedFolders: payload.access_rules.allowed_folders ?? [],\n allowedFiles: payload.access_rules.allowed_files ?? [],\n unrestricted: false,\n }\n : null,\n});\n\nconst toAccessRules = (payload: GatekeeperAccessRulesResponseWire): GatekeeperAccessRules => ({\n version: payload.version,\n allowedFolders: payload.allowed_folders ?? [],\n allowedFiles: payload.allowed_files ?? [],\n unrestricted: payload.unrestricted,\n});\n\nconst toDriveFile = (payload: GatekeeperDriveFileWire): GatekeeperDriveFile => ({\n id: payload.id,\n name: payload.name ?? null,\n mimeType: payload.mime_type ?? null,\n size: payload.size ?? null,\n modifiedTime: payload.modified_time ?? null,\n createdTime: payload.created_time ?? null,\n webViewLink: payload.web_view_link ?? null,\n iconLink: payload.icon_link ?? null,\n thumbnailLink: payload.thumbnail_link ?? null,\n parents: payload.parents ?? null,\n driveId: payload.drive_id ?? null,\n shared: payload.shared ?? null,\n ownedByMe: payload.owned_by_me ?? null,\n});\n\nconst gatekeeperPath = (path: string): string => `/v1/gatekeeper${path}`;\n\nconst pickOverrides = (options?: RequestOverrides): RequestOverrides => ({\n headers: options?.headers,\n signal: options?.signal,\n});\n\nexport class GatekeeperClient {\n private readonly config: ClientConfig;\n\n constructor(config: ClientConfig) {\n this.config = config;\n }\n\n async connect(payload: GatekeeperConnectRequest, options?: RequestOverrides): Promise<GatekeeperConnectResponse> {\n const ctx = buildRequestContext(this.config);\n const data = await request<GatekeeperConnectResponseWire>(ctx, {\n method: \"POST\",\n path: gatekeeperPath(\"/connect\"),\n body: toConnectRequest(payload),\n ...pickOverrides(options),\n });\n return toConnectResponse(data);\n }\n\n async listConnections(params: GatekeeperListConnectionsParams, options?: RequestOverrides): Promise<GatekeeperListConnectionsResponse> {\n const ctx = buildRequestContext(this.config);\n const data = await request<GatekeeperListConnectionsResponseWire>(ctx, {\n method: \"GET\",\n path: gatekeeperPath(\"/connections\"),\n query: {\n project_name: params.projectName,\n status_filter: params.statusFilter,\n },\n ...pickOverrides(options),\n });\n\n return {\n total: data.total,\n data: data.data.map(toConnection),\n };\n }\n\n async getConnection(connectionId: string, options?: RequestOverrides): Promise<GatekeeperConnection> {\n const ctx = buildRequestContext(this.config);\n const data = await request<GatekeeperConnectionWire>(ctx, {\n method: \"GET\",\n path: gatekeeperPath(`/connections/${connectionId}`),\n ...pickOverrides(options),\n });\n return toConnection(data);\n }\n\n async revokeConnection(params: GatekeeperRevokeParams, options?: RequestOverrides): Promise<GatekeeperRevokeResponse> {\n const ctx = buildRequestContext(this.config);\n return request<GatekeeperRevokeResponse>(ctx, {\n method: \"DELETE\",\n path: gatekeeperPath(\"/connections\"),\n query: {\n subject: params.subject,\n project_name: params.projectName,\n provider: params.provider,\n },\n ...pickOverrides(options),\n });\n }\n\n async listDriveFiles(params: GatekeeperDriveListParams, options?: RequestOverrides): Promise<GatekeeperDriveListResponse> {\n const ctx = buildRequestContext(this.config);\n const data = await request<GatekeeperDriveListResponseWire>(ctx, {\n method: \"GET\",\n path: gatekeeperPath(\"/connectors/drive/files\"),\n query: {\n project_name: params.projectName,\n subject: params.subject,\n page_size: params.pageSize,\n page_token: params.pageToken,\n folder_id: params.folderId,\n query: params.query,\n include_folders: params.includeFolders,\n order_by: params.orderBy,\n },\n ...pickOverrides(options),\n });\n\n return {\n files: data.files.map(toDriveFile),\n nextPageToken: data.next_page_token ?? null,\n };\n }\n\n async getAccessRules(connectionId: string, options?: RequestOverrides): Promise<GatekeeperAccessRules> {\n const ctx = buildRequestContext(this.config);\n const data = await request<GatekeeperAccessRulesResponseWire>(ctx, {\n method: \"GET\",\n path: gatekeeperPath(`/connections/${connectionId}/access-rules`),\n ...pickOverrides(options),\n });\n return toAccessRules(data);\n }\n\n async updateAccessRules(params: GatekeeperAccessRulesParams, options?: RequestOverrides): Promise<GatekeeperAccessRules> {\n const ctx = buildRequestContext(this.config);\n const data = await request<GatekeeperAccessRulesResponseWire>(ctx, {\n method: \"PUT\",\n path: gatekeeperPath(\"/connections/access-rules\"),\n query: {\n subject: params.subject,\n project_name: params.projectName,\n provider: params.provider,\n },\n body: {\n allowed_folders: params.accessRules.allowedFolders ?? [],\n allowed_files: params.accessRules.allowedFiles ?? [],\n },\n ...pickOverrides(options),\n });\n return toAccessRules(data);\n }\n\n async clearAccessRules(connectionId: string, options?: RequestOverrides): Promise<GatekeeperAccessRules> {\n const ctx = buildRequestContext(this.config);\n const data = await request<GatekeeperAccessRulesResponseWire>(ctx, {\n method: \"DELETE\",\n path: gatekeeperPath(`/connections/${connectionId}/access-rules`),\n ...pickOverrides(options),\n });\n return toAccessRules(data);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;AC6CO,IAAM,mBAAmB;AAEzB,IAAM,sBAAsB,CAAC,YAA0C;AAAA,EAC5E,OAAO,OAAO,SAAS;AAAA,EACvB,SAAS,OAAO,WAAW;AAAA,EAC3B,OAAO,OAAO,SAAS,OAAO;AAAA,EAC9B,gBAAgB,OAAO;AAAA,EACvB,WAAW,OAAO;AAAA,EAClB,WAAW,OAAO;AAAA,EAClB,SAAS,OAAO;AAClB;;;ACtDO,IAAM,eAAN,cAA2B,MAAM;AAAA,EACtC,YAAY,SAAiB;AAC3B,UAAM,OAAO;AACb,SAAK,OAAO;AAAA,EACd;AACF;AAGO,IAAM,kBAAN,cAA8B,aAAa;AAAA,EAKhD,YAAY,SAAiB,QAAgB,MAAe,WAAoB;AAC9E,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,SAAS;AACd,SAAK,OAAO;AACZ,SAAK,YAAY;AAAA,EACnB;AACF;AAGO,IAAM,sBAAN,cAAkC,aAAa;AAAA,EAGpD,YAAY,SAAiB,OAAe;AAC1C,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,QAAQ;AAAA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b.cjs';
|
|
2
|
+
|
|
3
|
+
interface GatekeeperConnectRequest {
|
|
4
|
+
subject: string;
|
|
5
|
+
/** Defaults to "google_drive". */
|
|
6
|
+
provider?: string;
|
|
7
|
+
projectName: string;
|
|
8
|
+
redirectUri?: string;
|
|
9
|
+
}
|
|
10
|
+
interface GatekeeperConnectResponse {
|
|
11
|
+
status: "redirect" | "connected" | string;
|
|
12
|
+
oauthUrl?: string;
|
|
13
|
+
connectionId?: string;
|
|
14
|
+
}
|
|
15
|
+
interface GatekeeperConnection {
|
|
16
|
+
id: string;
|
|
17
|
+
subject: string;
|
|
18
|
+
provider: string;
|
|
19
|
+
projectId: string;
|
|
20
|
+
accountEmail?: string | null;
|
|
21
|
+
scopes: string[];
|
|
22
|
+
status: string;
|
|
23
|
+
createdAt: string;
|
|
24
|
+
updatedAt: string;
|
|
25
|
+
lastUsedAt?: string | null;
|
|
26
|
+
accessRules?: GatekeeperAccessRules | null;
|
|
27
|
+
}
|
|
28
|
+
interface GatekeeperListConnectionsResponse {
|
|
29
|
+
data: GatekeeperConnection[];
|
|
30
|
+
total: number;
|
|
31
|
+
}
|
|
32
|
+
interface GatekeeperDriveFile {
|
|
33
|
+
id: string;
|
|
34
|
+
name?: string | null;
|
|
35
|
+
mimeType?: string | null;
|
|
36
|
+
size?: number | null;
|
|
37
|
+
modifiedTime?: string | null;
|
|
38
|
+
createdTime?: string | null;
|
|
39
|
+
webViewLink?: string | null;
|
|
40
|
+
iconLink?: string | null;
|
|
41
|
+
thumbnailLink?: string | null;
|
|
42
|
+
parents?: string[] | null;
|
|
43
|
+
driveId?: string | null;
|
|
44
|
+
shared?: boolean | null;
|
|
45
|
+
ownedByMe?: boolean | null;
|
|
46
|
+
}
|
|
47
|
+
interface GatekeeperDriveListResponse {
|
|
48
|
+
files: GatekeeperDriveFile[];
|
|
49
|
+
nextPageToken?: string | null;
|
|
50
|
+
}
|
|
51
|
+
interface GatekeeperAccessRules {
|
|
52
|
+
version: string;
|
|
53
|
+
allowedFolders: string[];
|
|
54
|
+
allowedFiles: string[];
|
|
55
|
+
unrestricted: boolean;
|
|
56
|
+
}
|
|
57
|
+
interface GatekeeperAccessRulesUpdate {
|
|
58
|
+
allowedFolders?: string[];
|
|
59
|
+
allowedFiles?: string[];
|
|
60
|
+
}
|
|
61
|
+
interface GatekeeperRevokeResponse {
|
|
62
|
+
status: string;
|
|
63
|
+
id: string;
|
|
64
|
+
}
|
|
65
|
+
interface GatekeeperListConnectionsParams {
|
|
66
|
+
projectName: string;
|
|
67
|
+
statusFilter?: string;
|
|
68
|
+
}
|
|
69
|
+
interface GatekeeperDriveListParams {
|
|
70
|
+
projectName: string;
|
|
71
|
+
subject: string;
|
|
72
|
+
pageSize?: number;
|
|
73
|
+
pageToken?: string;
|
|
74
|
+
folderId?: string;
|
|
75
|
+
query?: string;
|
|
76
|
+
includeFolders?: boolean;
|
|
77
|
+
orderBy?: string;
|
|
78
|
+
}
|
|
79
|
+
interface GatekeeperRevokeParams {
|
|
80
|
+
subject: string;
|
|
81
|
+
projectName: string;
|
|
82
|
+
provider?: string;
|
|
83
|
+
}
|
|
84
|
+
interface GatekeeperAccessRulesParams {
|
|
85
|
+
subject: string;
|
|
86
|
+
projectName: string;
|
|
87
|
+
provider?: string;
|
|
88
|
+
accessRules: GatekeeperAccessRulesUpdate;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
declare class GatekeeperClient {
|
|
92
|
+
private readonly config;
|
|
93
|
+
constructor(config: ClientConfig);
|
|
94
|
+
connect(payload: GatekeeperConnectRequest, options?: RequestOverrides): Promise<GatekeeperConnectResponse>;
|
|
95
|
+
listConnections(params: GatekeeperListConnectionsParams, options?: RequestOverrides): Promise<GatekeeperListConnectionsResponse>;
|
|
96
|
+
getConnection(connectionId: string, options?: RequestOverrides): Promise<GatekeeperConnection>;
|
|
97
|
+
revokeConnection(params: GatekeeperRevokeParams, options?: RequestOverrides): Promise<GatekeeperRevokeResponse>;
|
|
98
|
+
listDriveFiles(params: GatekeeperDriveListParams, options?: RequestOverrides): Promise<GatekeeperDriveListResponse>;
|
|
99
|
+
getAccessRules(connectionId: string, options?: RequestOverrides): Promise<GatekeeperAccessRules>;
|
|
100
|
+
updateAccessRules(params: GatekeeperAccessRulesParams, options?: RequestOverrides): Promise<GatekeeperAccessRules>;
|
|
101
|
+
clearAccessRules(connectionId: string, options?: RequestOverrides): Promise<GatekeeperAccessRules>;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export { type GatekeeperAccessRules, type GatekeeperAccessRulesParams, type GatekeeperAccessRulesUpdate, GatekeeperClient, type GatekeeperConnectRequest, type GatekeeperConnectResponse, type GatekeeperConnection, type GatekeeperDriveFile, type GatekeeperDriveListParams, type GatekeeperDriveListResponse, type GatekeeperListConnectionsParams, type GatekeeperListConnectionsResponse, type GatekeeperRevokeParams, type GatekeeperRevokeResponse, RequestOverrides };
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { C as ClientConfig, R as RequestOverrides } from '../config-BTTpuv_b.js';
|
|
2
|
+
|
|
3
|
+
interface GatekeeperConnectRequest {
|
|
4
|
+
subject: string;
|
|
5
|
+
/** Defaults to "google_drive". */
|
|
6
|
+
provider?: string;
|
|
7
|
+
projectName: string;
|
|
8
|
+
redirectUri?: string;
|
|
9
|
+
}
|
|
10
|
+
interface GatekeeperConnectResponse {
|
|
11
|
+
status: "redirect" | "connected" | string;
|
|
12
|
+
oauthUrl?: string;
|
|
13
|
+
connectionId?: string;
|
|
14
|
+
}
|
|
15
|
+
interface GatekeeperConnection {
|
|
16
|
+
id: string;
|
|
17
|
+
subject: string;
|
|
18
|
+
provider: string;
|
|
19
|
+
projectId: string;
|
|
20
|
+
accountEmail?: string | null;
|
|
21
|
+
scopes: string[];
|
|
22
|
+
status: string;
|
|
23
|
+
createdAt: string;
|
|
24
|
+
updatedAt: string;
|
|
25
|
+
lastUsedAt?: string | null;
|
|
26
|
+
accessRules?: GatekeeperAccessRules | null;
|
|
27
|
+
}
|
|
28
|
+
interface GatekeeperListConnectionsResponse {
|
|
29
|
+
data: GatekeeperConnection[];
|
|
30
|
+
total: number;
|
|
31
|
+
}
|
|
32
|
+
interface GatekeeperDriveFile {
|
|
33
|
+
id: string;
|
|
34
|
+
name?: string | null;
|
|
35
|
+
mimeType?: string | null;
|
|
36
|
+
size?: number | null;
|
|
37
|
+
modifiedTime?: string | null;
|
|
38
|
+
createdTime?: string | null;
|
|
39
|
+
webViewLink?: string | null;
|
|
40
|
+
iconLink?: string | null;
|
|
41
|
+
thumbnailLink?: string | null;
|
|
42
|
+
parents?: string[] | null;
|
|
43
|
+
driveId?: string | null;
|
|
44
|
+
shared?: boolean | null;
|
|
45
|
+
ownedByMe?: boolean | null;
|
|
46
|
+
}
|
|
47
|
+
interface GatekeeperDriveListResponse {
|
|
48
|
+
files: GatekeeperDriveFile[];
|
|
49
|
+
nextPageToken?: string | null;
|
|
50
|
+
}
|
|
51
|
+
interface GatekeeperAccessRules {
|
|
52
|
+
version: string;
|
|
53
|
+
allowedFolders: string[];
|
|
54
|
+
allowedFiles: string[];
|
|
55
|
+
unrestricted: boolean;
|
|
56
|
+
}
|
|
57
|
+
interface GatekeeperAccessRulesUpdate {
|
|
58
|
+
allowedFolders?: string[];
|
|
59
|
+
allowedFiles?: string[];
|
|
60
|
+
}
|
|
61
|
+
interface GatekeeperRevokeResponse {
|
|
62
|
+
status: string;
|
|
63
|
+
id: string;
|
|
64
|
+
}
|
|
65
|
+
interface GatekeeperListConnectionsParams {
|
|
66
|
+
projectName: string;
|
|
67
|
+
statusFilter?: string;
|
|
68
|
+
}
|
|
69
|
+
interface GatekeeperDriveListParams {
|
|
70
|
+
projectName: string;
|
|
71
|
+
subject: string;
|
|
72
|
+
pageSize?: number;
|
|
73
|
+
pageToken?: string;
|
|
74
|
+
folderId?: string;
|
|
75
|
+
query?: string;
|
|
76
|
+
includeFolders?: boolean;
|
|
77
|
+
orderBy?: string;
|
|
78
|
+
}
|
|
79
|
+
interface GatekeeperRevokeParams {
|
|
80
|
+
subject: string;
|
|
81
|
+
projectName: string;
|
|
82
|
+
provider?: string;
|
|
83
|
+
}
|
|
84
|
+
interface GatekeeperAccessRulesParams {
|
|
85
|
+
subject: string;
|
|
86
|
+
projectName: string;
|
|
87
|
+
provider?: string;
|
|
88
|
+
accessRules: GatekeeperAccessRulesUpdate;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
declare class GatekeeperClient {
|
|
92
|
+
private readonly config;
|
|
93
|
+
constructor(config: ClientConfig);
|
|
94
|
+
connect(payload: GatekeeperConnectRequest, options?: RequestOverrides): Promise<GatekeeperConnectResponse>;
|
|
95
|
+
listConnections(params: GatekeeperListConnectionsParams, options?: RequestOverrides): Promise<GatekeeperListConnectionsResponse>;
|
|
96
|
+
getConnection(connectionId: string, options?: RequestOverrides): Promise<GatekeeperConnection>;
|
|
97
|
+
revokeConnection(params: GatekeeperRevokeParams, options?: RequestOverrides): Promise<GatekeeperRevokeResponse>;
|
|
98
|
+
listDriveFiles(params: GatekeeperDriveListParams, options?: RequestOverrides): Promise<GatekeeperDriveListResponse>;
|
|
99
|
+
getAccessRules(connectionId: string, options?: RequestOverrides): Promise<GatekeeperAccessRules>;
|
|
100
|
+
updateAccessRules(params: GatekeeperAccessRulesParams, options?: RequestOverrides): Promise<GatekeeperAccessRules>;
|
|
101
|
+
clearAccessRules(connectionId: string, options?: RequestOverrides): Promise<GatekeeperAccessRules>;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export { type GatekeeperAccessRules, type GatekeeperAccessRulesParams, type GatekeeperAccessRulesUpdate, GatekeeperClient, type GatekeeperConnectRequest, type GatekeeperConnectResponse, type GatekeeperConnection, type GatekeeperDriveFile, type GatekeeperDriveListParams, type GatekeeperDriveListResponse, type GatekeeperListConnectionsParams, type GatekeeperListConnectionsResponse, type GatekeeperRevokeParams, type GatekeeperRevokeResponse, RequestOverrides };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|