@dalea/sdk 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/LICENSE +21 -0
- package/README.md +119 -0
- package/dist/index.cjs +1255 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +9088 -0
- package/dist/index.d.ts +9088 -0
- package/dist/index.js +1227 -0
- package/dist/index.js.map +1 -0
- package/package.json +51 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,1227 @@
|
|
|
1
|
+
// src/config.ts
|
|
2
|
+
var SDK_VERSION = "0.1.2" ;
|
|
3
|
+
function detectRuntime() {
|
|
4
|
+
if (typeof globalThis.window !== "undefined" && typeof globalThis.document !== "undefined") {
|
|
5
|
+
return "browser";
|
|
6
|
+
}
|
|
7
|
+
if (typeof globalThis.EdgeRuntime !== "undefined") return "edge";
|
|
8
|
+
return "node";
|
|
9
|
+
}
|
|
10
|
+
function resolveConfig(cfg) {
|
|
11
|
+
const fetchImpl = cfg.fetch ?? globalThis.fetch?.bind(globalThis);
|
|
12
|
+
if (!fetchImpl) {
|
|
13
|
+
throw new Error("DaleaClient: no global fetch available; provide config.fetch");
|
|
14
|
+
}
|
|
15
|
+
return {
|
|
16
|
+
baseUrl: cfg.baseUrl ?? "",
|
|
17
|
+
maxRetries: cfg.maxRetries ?? 2,
|
|
18
|
+
retryWrites: cfg.retryWrites ?? true,
|
|
19
|
+
retryBaseDelayMs: cfg.retryBaseDelayMs ?? 500,
|
|
20
|
+
maxRetryDelayMs: cfg.maxRetryDelayMs ?? 2e4,
|
|
21
|
+
timeoutMs: cfg.timeoutMs ?? 3e4,
|
|
22
|
+
fetch: fetchImpl,
|
|
23
|
+
interceptors: cfg.interceptors ?? {},
|
|
24
|
+
runtime: detectRuntime(),
|
|
25
|
+
apiVersion: cfg.apiVersion
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// src/core/errors.ts
|
|
30
|
+
var PERMISSION_DENIED_CODES = [
|
|
31
|
+
"PERMISSION_DENIED",
|
|
32
|
+
"APP_PERMISSION_DENIED",
|
|
33
|
+
"API_KEY_PERMISSION_DENIED"
|
|
34
|
+
];
|
|
35
|
+
var DaleaError = class extends Error {
|
|
36
|
+
constructor(status, code, message, data, isMutation = false) {
|
|
37
|
+
super(message);
|
|
38
|
+
this.status = status;
|
|
39
|
+
this.code = code;
|
|
40
|
+
this.data = data;
|
|
41
|
+
this.isMutation = isMutation;
|
|
42
|
+
this.name = new.target.name;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
var DaleaAuthError = class extends DaleaError {
|
|
46
|
+
};
|
|
47
|
+
var DaleaBannedError = class extends DaleaError {
|
|
48
|
+
};
|
|
49
|
+
var DaleaPermissionError = class extends DaleaError {
|
|
50
|
+
};
|
|
51
|
+
var DaleaArchivedError = class extends DaleaError {
|
|
52
|
+
};
|
|
53
|
+
var DaleaNotFoundError = class extends DaleaError {
|
|
54
|
+
};
|
|
55
|
+
var DaleaConflictError = class extends DaleaError {
|
|
56
|
+
};
|
|
57
|
+
var DaleaValidationError = class extends DaleaError {
|
|
58
|
+
};
|
|
59
|
+
var DaleaQuotaError = class extends DaleaError {
|
|
60
|
+
};
|
|
61
|
+
var DaleaServerError = class extends DaleaError {
|
|
62
|
+
};
|
|
63
|
+
var DaleaNetworkError = class extends DaleaError {
|
|
64
|
+
};
|
|
65
|
+
var DaleaRateLimitError = class extends DaleaError {
|
|
66
|
+
// 429
|
|
67
|
+
retryAfterSeconds;
|
|
68
|
+
constructor(status, code, message, data, isMutation = false, retryAfterSeconds) {
|
|
69
|
+
super(status, code, message, data, isMutation);
|
|
70
|
+
this.retryAfterSeconds = retryAfterSeconds;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
function mapError(status, code, message, data, isMutation) {
|
|
74
|
+
switch (status) {
|
|
75
|
+
case 401:
|
|
76
|
+
return new DaleaAuthError(status, code, message, data, isMutation);
|
|
77
|
+
case 403:
|
|
78
|
+
if (code === "USER_BANNED") return new DaleaBannedError(status, code, message, data, isMutation);
|
|
79
|
+
return new DaleaPermissionError(status, code, message, data, isMutation);
|
|
80
|
+
case 404:
|
|
81
|
+
return new DaleaNotFoundError(status, code, message, data, isMutation);
|
|
82
|
+
case 409:
|
|
83
|
+
return new DaleaConflictError(status, code, message, data, isMutation);
|
|
84
|
+
case 429: {
|
|
85
|
+
const ra = typeof data.retry_after_seconds === "number" ? data.retry_after_seconds : void 0;
|
|
86
|
+
return new DaleaRateLimitError(status, code, message, data, isMutation, ra);
|
|
87
|
+
}
|
|
88
|
+
case 507:
|
|
89
|
+
return new DaleaQuotaError(status, code, message, data, isMutation);
|
|
90
|
+
case 400:
|
|
91
|
+
if (code === "ENTITY_ARCHIVED") return new DaleaArchivedError(status, code, message, data, isMutation);
|
|
92
|
+
return new DaleaValidationError(status, code, message, data, isMutation);
|
|
93
|
+
case 422:
|
|
94
|
+
return new DaleaValidationError(status, code, message, data, isMutation);
|
|
95
|
+
default:
|
|
96
|
+
if (status >= 500) return new DaleaServerError(status, code, message, data, isMutation);
|
|
97
|
+
return new DaleaError(status, code, message, data, isMutation);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// src/core/retry.ts
|
|
102
|
+
var RETRYABLE_STATUS = /* @__PURE__ */ new Set([429, 503]);
|
|
103
|
+
function shouldAttemptRetry(status, method, attempt, policy) {
|
|
104
|
+
return RETRYABLE_STATUS.has(status) && attempt < policy.maxRetries && (method === "GET" || policy.retryWrites);
|
|
105
|
+
}
|
|
106
|
+
function computeRetryDelay(attempt, retryAfterHeader, retryAfterBody, policy, random = Math.random) {
|
|
107
|
+
const serverHintMs = parseRetryAfterMs(retryAfterHeader, retryAfterBody);
|
|
108
|
+
if (serverHintMs !== null && serverHintMs > policy.maxRetryDelayMs) return null;
|
|
109
|
+
const expBase = Math.min(policy.maxRetryDelayMs, policy.retryBaseDelayMs * 2 ** attempt);
|
|
110
|
+
if (serverHintMs !== null) {
|
|
111
|
+
return Math.min(policy.maxRetryDelayMs, serverHintMs + random() * Math.min(expBase, 1e3));
|
|
112
|
+
}
|
|
113
|
+
return random() * expBase;
|
|
114
|
+
}
|
|
115
|
+
function parseRetryAfterMs(header, body) {
|
|
116
|
+
const parsed = header ? parseInt(header, 10) : NaN;
|
|
117
|
+
if (!Number.isNaN(parsed)) return Math.max(0, parsed) * 1e3;
|
|
118
|
+
if (typeof body === "number" && Number.isFinite(body)) return Math.max(0, body) * 1e3;
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
function sleep(ms, signal) {
|
|
122
|
+
return new Promise((resolve) => {
|
|
123
|
+
if (signal?.aborted) return resolve();
|
|
124
|
+
const timer = setTimeout(resolve, ms);
|
|
125
|
+
signal?.addEventListener(
|
|
126
|
+
"abort",
|
|
127
|
+
() => {
|
|
128
|
+
clearTimeout(timer);
|
|
129
|
+
resolve();
|
|
130
|
+
},
|
|
131
|
+
{ once: true }
|
|
132
|
+
);
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// src/core/transport.ts
|
|
137
|
+
var Transport = class {
|
|
138
|
+
constructor(cfg, credential, workspace) {
|
|
139
|
+
this.cfg = cfg;
|
|
140
|
+
this.credential = credential;
|
|
141
|
+
this.workspace = workspace;
|
|
142
|
+
}
|
|
143
|
+
inflight = /* @__PURE__ */ new Map();
|
|
144
|
+
request(method, path, opts = {}) {
|
|
145
|
+
const url = this.cfg.baseUrl + path + buildQuery(opts.query);
|
|
146
|
+
if (method === "GET" && !opts.skipDedup && !opts.rawResponse) {
|
|
147
|
+
const cred = opts.credential ?? this.credential;
|
|
148
|
+
const ws = opts.workspace ?? this.workspace.get() ?? "";
|
|
149
|
+
const dedupKey = `${cred.key?.() ?? "anon"}:ws-${ws}:${url}`;
|
|
150
|
+
const existing = this.inflight.get(dedupKey);
|
|
151
|
+
if (existing) return existing;
|
|
152
|
+
const p = this.execute(method, url, opts);
|
|
153
|
+
this.inflight.set(dedupKey, p);
|
|
154
|
+
const cleanup = () => this.inflight.delete(dedupKey);
|
|
155
|
+
p.then(cleanup, cleanup);
|
|
156
|
+
return p;
|
|
157
|
+
}
|
|
158
|
+
return this.execute(method, url, opts);
|
|
159
|
+
}
|
|
160
|
+
async execute(method, url, opts, attempt = 0, refreshed = false) {
|
|
161
|
+
const raw = isRawBody(opts.body);
|
|
162
|
+
const headers = new Headers({
|
|
163
|
+
...raw ? {} : { "Content-Type": "application/json" },
|
|
164
|
+
...opts.headers
|
|
165
|
+
});
|
|
166
|
+
if (opts.body instanceof FormData) headers.delete("Content-Type");
|
|
167
|
+
const body = opts.auditReason !== void 0 && !raw && method !== "GET" ? {
|
|
168
|
+
...opts.body && typeof opts.body === "object" ? opts.body : {},
|
|
169
|
+
reason: opts.auditReason
|
|
170
|
+
} : opts.body;
|
|
171
|
+
const ctx = {
|
|
172
|
+
url,
|
|
173
|
+
method,
|
|
174
|
+
headers,
|
|
175
|
+
runtime: this.cfg.runtime,
|
|
176
|
+
includeCookies: false
|
|
177
|
+
};
|
|
178
|
+
const credential = opts.credential ?? this.credential;
|
|
179
|
+
await credential.apply(ctx);
|
|
180
|
+
this.workspace.apply(ctx, opts.workspace);
|
|
181
|
+
if (this.cfg.runtime === "node") {
|
|
182
|
+
headers.set("User-Agent", `dalea-sdk-ts/${SDK_VERSION}`);
|
|
183
|
+
}
|
|
184
|
+
if (this.cfg.apiVersion) headers.set("X-Dalea-Version", this.cfg.apiVersion);
|
|
185
|
+
this.cfg.interceptors.onRequest?.({ url, method, headers });
|
|
186
|
+
const signal = opts.signal ?? (opts.stream || !this.cfg.timeoutMs ? void 0 : AbortSignal.timeout(this.cfg.timeoutMs));
|
|
187
|
+
let res;
|
|
188
|
+
try {
|
|
189
|
+
res = await this.cfg.fetch(url, {
|
|
190
|
+
method,
|
|
191
|
+
headers,
|
|
192
|
+
body: body === void 0 ? void 0 : raw ? body : JSON.stringify(body),
|
|
193
|
+
credentials: ctx.includeCookies ? "include" : "same-origin",
|
|
194
|
+
signal
|
|
195
|
+
});
|
|
196
|
+
} catch (e) {
|
|
197
|
+
const err = new DaleaNetworkError(0, "NETWORK", e.message, void 0, method !== "GET");
|
|
198
|
+
this.cfg.interceptors.onError?.(err);
|
|
199
|
+
throw err;
|
|
200
|
+
}
|
|
201
|
+
credential.onResponse?.(res);
|
|
202
|
+
this.cfg.interceptors.onResponse?.(res);
|
|
203
|
+
if (!res.ok) {
|
|
204
|
+
const data = await res.json().catch(() => ({}));
|
|
205
|
+
const errObj = data.error;
|
|
206
|
+
const message = typeof data.message === "string" && data.message || (typeof errObj === "string" ? errObj : errObj?.message) || "An error occurred";
|
|
207
|
+
const code = typeof data.code === "string" && data.code || (typeof errObj === "object" ? errObj?.code : void 0) || "UNKNOWN_ERROR";
|
|
208
|
+
if (res.status === 401 && !refreshed && credential.refresh) {
|
|
209
|
+
const ok = await credential.refresh();
|
|
210
|
+
if (ok) return this.execute(method, url, opts, attempt, true);
|
|
211
|
+
}
|
|
212
|
+
if (shouldAttemptRetry(res.status, method, attempt, this.cfg)) {
|
|
213
|
+
const delayMs = computeRetryDelay(
|
|
214
|
+
attempt,
|
|
215
|
+
res.headers.get("Retry-After"),
|
|
216
|
+
data.retry_after_seconds,
|
|
217
|
+
this.cfg
|
|
218
|
+
);
|
|
219
|
+
if (delayMs !== null) {
|
|
220
|
+
await sleep(delayMs, opts.signal);
|
|
221
|
+
return this.execute(method, url, opts, attempt + 1, refreshed);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
const err = mapError(res.status, code, message, data, method !== "GET");
|
|
225
|
+
this.cfg.interceptors.onError?.(err);
|
|
226
|
+
throw err;
|
|
227
|
+
}
|
|
228
|
+
if (opts.rawResponse) return res;
|
|
229
|
+
if (res.status === 204) return {};
|
|
230
|
+
return await res.json();
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
function isRawBody(body) {
|
|
234
|
+
if (body === void 0 || body === null) return false;
|
|
235
|
+
return typeof FormData !== "undefined" && body instanceof FormData || typeof Blob !== "undefined" && body instanceof Blob || typeof ArrayBuffer !== "undefined" && (body instanceof ArrayBuffer || ArrayBuffer.isView(body)) || typeof ReadableStream !== "undefined" && body instanceof ReadableStream || typeof URLSearchParams !== "undefined" && body instanceof URLSearchParams;
|
|
236
|
+
}
|
|
237
|
+
function buildQuery(query) {
|
|
238
|
+
if (!query) return "";
|
|
239
|
+
const params = new URLSearchParams();
|
|
240
|
+
for (const [k, v] of Object.entries(query)) {
|
|
241
|
+
if (v !== void 0) params.set(k, String(v));
|
|
242
|
+
}
|
|
243
|
+
const s = params.toString();
|
|
244
|
+
return s ? `?${s}` : "";
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// src/auth/workspace.ts
|
|
248
|
+
var WorkspaceContext = class {
|
|
249
|
+
constructor(workspaceId) {
|
|
250
|
+
this.workspaceId = workspaceId;
|
|
251
|
+
}
|
|
252
|
+
set(id) {
|
|
253
|
+
this.workspaceId = id ?? void 0;
|
|
254
|
+
}
|
|
255
|
+
get() {
|
|
256
|
+
return this.workspaceId;
|
|
257
|
+
}
|
|
258
|
+
apply(ctx, override) {
|
|
259
|
+
const ws = override ?? this.workspaceId;
|
|
260
|
+
if (ws && !ctx.headers.has("X-Workspace")) ctx.headers.set("X-Workspace", ws);
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
// src/auth/api-key.ts
|
|
265
|
+
var ApiKeyCredential = class {
|
|
266
|
+
constructor(apiKey) {
|
|
267
|
+
this.apiKey = apiKey;
|
|
268
|
+
}
|
|
269
|
+
apply(ctx) {
|
|
270
|
+
ctx.headers.set("X-API-Key", this.apiKey);
|
|
271
|
+
}
|
|
272
|
+
key() {
|
|
273
|
+
return `ak:${this.apiKey.slice(-8)}`;
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
// src/auth/session-cookie.ts
|
|
278
|
+
var SessionCookieCredential = class {
|
|
279
|
+
constructor(hooks = {}) {
|
|
280
|
+
this.hooks = hooks;
|
|
281
|
+
}
|
|
282
|
+
apply(ctx) {
|
|
283
|
+
if (ctx.runtime === "node") {
|
|
284
|
+
throw new DaleaError(
|
|
285
|
+
0,
|
|
286
|
+
"CONFIG",
|
|
287
|
+
"session-cookie auth is browser-only; pass an apiKey in Node"
|
|
288
|
+
);
|
|
289
|
+
}
|
|
290
|
+
ctx.includeCookies = true;
|
|
291
|
+
}
|
|
292
|
+
onResponse(res) {
|
|
293
|
+
const rotated = res.headers.get("set-auth-token");
|
|
294
|
+
if (rotated) this.hooks.onRotate?.(rotated);
|
|
295
|
+
}
|
|
296
|
+
key() {
|
|
297
|
+
return "cookie";
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
// src/auth/bearer.ts
|
|
302
|
+
var BearerCredential = class {
|
|
303
|
+
constructor(token) {
|
|
304
|
+
this.token = token;
|
|
305
|
+
}
|
|
306
|
+
apply(ctx) {
|
|
307
|
+
ctx.headers.set("Authorization", `Bearer ${this.token}`);
|
|
308
|
+
}
|
|
309
|
+
key() {
|
|
310
|
+
return `b:${this.token.slice(-8)}`;
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
// src/resources/base.ts
|
|
315
|
+
var Resource = class {
|
|
316
|
+
constructor(transport) {
|
|
317
|
+
this.transport = transport;
|
|
318
|
+
}
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
// src/core/pagination.ts
|
|
322
|
+
var DEFAULT_LIMIT = 100;
|
|
323
|
+
async function* paginate(fetchPage, initialParams, walker) {
|
|
324
|
+
let params = { ...initialParams };
|
|
325
|
+
while (params) {
|
|
326
|
+
const page = await fetchPage(params);
|
|
327
|
+
for (const item of walker.items(page)) yield item;
|
|
328
|
+
params = walker.next(page, params);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
function itemsAt(page, key) {
|
|
332
|
+
const arr = page[key];
|
|
333
|
+
return Array.isArray(arr) ? arr : [];
|
|
334
|
+
}
|
|
335
|
+
function pageLimit(raw, fallback = DEFAULT_LIMIT) {
|
|
336
|
+
return typeof raw === "number" && raw > 0 ? raw : fallback;
|
|
337
|
+
}
|
|
338
|
+
function nextLimit(params, fallback) {
|
|
339
|
+
return pageLimit(params.limit, fallback);
|
|
340
|
+
}
|
|
341
|
+
function offsetWalker(itemsKey, limit = DEFAULT_LIMIT) {
|
|
342
|
+
return {
|
|
343
|
+
items: (p) => itemsAt(p, itemsKey),
|
|
344
|
+
next: (p, params) => {
|
|
345
|
+
const got = itemsAt(p, itemsKey).length;
|
|
346
|
+
if (got === 0) return null;
|
|
347
|
+
const meta = p;
|
|
348
|
+
if (meta.hasMore === false) return null;
|
|
349
|
+
const offset = Number(params.offset ?? 0) + got;
|
|
350
|
+
if (typeof meta.total === "number" && offset >= meta.total) return null;
|
|
351
|
+
return { ...params, offset, limit: nextLimit(params, limit) };
|
|
352
|
+
}
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
function cursorWalker(itemsKey, limit = DEFAULT_LIMIT) {
|
|
356
|
+
return {
|
|
357
|
+
items: (p) => itemsAt(p, itemsKey),
|
|
358
|
+
next: (p, params) => {
|
|
359
|
+
const cursor = p.nextCursor;
|
|
360
|
+
return cursor ? { ...params, cursor, limit: nextLimit(params, limit) } : null;
|
|
361
|
+
}
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
function pageWalker(itemsKey, limit = DEFAULT_LIMIT) {
|
|
365
|
+
return {
|
|
366
|
+
items: (p) => itemsAt(p, itemsKey),
|
|
367
|
+
next: (p, params) => {
|
|
368
|
+
const got = itemsAt(p, itemsKey).length;
|
|
369
|
+
if (got === 0) return null;
|
|
370
|
+
return { ...params, page: Number(params.page ?? 0) + 1, limit: nextLimit(params, limit) };
|
|
371
|
+
}
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
// src/resources/data/tables.ts
|
|
376
|
+
var enc = encodeURIComponent;
|
|
377
|
+
var TablesResource = class extends Resource {
|
|
378
|
+
/** GET /tables/{id} */
|
|
379
|
+
get(id, opts) {
|
|
380
|
+
return this.transport.request("GET", `/api/v1/tables/${enc(id)}`, opts);
|
|
381
|
+
}
|
|
382
|
+
/** PATCH /tables/{id} */
|
|
383
|
+
update(id, body, opts) {
|
|
384
|
+
return this.transport.request("PATCH", `/api/v1/tables/${enc(id)}`, { ...opts, body });
|
|
385
|
+
}
|
|
386
|
+
/** POST /tables/bulk-update (conflict-aware; supports dryRun). */
|
|
387
|
+
bulkUpdate(body, opts) {
|
|
388
|
+
return this.transport.request("POST", "/api/v1/tables/bulk-update", { ...opts, body });
|
|
389
|
+
}
|
|
390
|
+
/** POST /tables/{id}/copy (dry-runnable). */
|
|
391
|
+
copy(id, body, opts) {
|
|
392
|
+
return this.transport.request("POST", `/api/v1/tables/${enc(id)}/copy`, { ...opts, body });
|
|
393
|
+
}
|
|
394
|
+
/** POST /tables/{id}/move (dry-runnable). */
|
|
395
|
+
move(id, body, opts) {
|
|
396
|
+
return this.transport.request("POST", `/api/v1/tables/${enc(id)}/move`, { ...opts, body });
|
|
397
|
+
}
|
|
398
|
+
/** POST /tables/bulk-copy (dry-runnable). */
|
|
399
|
+
bulkCopy(body, opts) {
|
|
400
|
+
return this.transport.request("POST", "/api/v1/tables/bulk-copy", { ...opts, body });
|
|
401
|
+
}
|
|
402
|
+
/** POST /tables/bulk-move (dry-runnable). */
|
|
403
|
+
bulkMove(body, opts) {
|
|
404
|
+
return this.transport.request("POST", "/api/v1/tables/bulk-move", { ...opts, body });
|
|
405
|
+
}
|
|
406
|
+
// --- columns scoped to a table ---
|
|
407
|
+
/** GET /tables/{tableId}/columns */
|
|
408
|
+
listColumns(tableId, params, opts) {
|
|
409
|
+
return this.transport.request("GET", `/api/v1/tables/${enc(tableId)}/columns`, {
|
|
410
|
+
...opts,
|
|
411
|
+
query: params
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
/** GET /tables/{tableId}/columns/archived */
|
|
415
|
+
listArchivedColumns(tableId, opts) {
|
|
416
|
+
return this.transport.request("GET", `/api/v1/tables/${enc(tableId)}/columns/archived`, opts);
|
|
417
|
+
}
|
|
418
|
+
/** POST /tables/{tableId}/columns */
|
|
419
|
+
createColumn(tableId, body, opts) {
|
|
420
|
+
return this.transport.request("POST", `/api/v1/tables/${enc(tableId)}/columns`, { ...opts, body });
|
|
421
|
+
}
|
|
422
|
+
/** POST /tables/{tableId}/columns/bulk (conflict-aware; supports dryRun). */
|
|
423
|
+
bulkCreateColumns(tableId, body, opts) {
|
|
424
|
+
return this.transport.request("POST", `/api/v1/tables/${enc(tableId)}/columns/bulk`, { ...opts, body });
|
|
425
|
+
}
|
|
426
|
+
// --- objects scoped to a table ---
|
|
427
|
+
/** GET /tables/{tableId}/objects */
|
|
428
|
+
listObjects(tableId, params, opts) {
|
|
429
|
+
return this.transport.request("GET", `/api/v1/tables/${enc(tableId)}/objects`, {
|
|
430
|
+
...opts,
|
|
431
|
+
query: params
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* GET /tables/{tableId}/objects — auto-paged: yields every object across all
|
|
436
|
+
* pages. `for await (const obj of …)`; `break` stops fetching. Cancellation
|
|
437
|
+
* rides `opts.signal`.
|
|
438
|
+
*/
|
|
439
|
+
iterateObjects(tableId, params, opts) {
|
|
440
|
+
const limit = pageLimit(params?.limit);
|
|
441
|
+
return paginate(
|
|
442
|
+
(p) => this.listObjects(tableId, p, opts),
|
|
443
|
+
{ offset: 0, ...params, limit },
|
|
444
|
+
offsetWalker("objects", limit)
|
|
445
|
+
);
|
|
446
|
+
}
|
|
447
|
+
/** GET /tables/{tableId}/objects/archived */
|
|
448
|
+
listArchivedObjects(tableId, params, opts) {
|
|
449
|
+
return this.transport.request("GET", `/api/v1/tables/${enc(tableId)}/objects/archived`, {
|
|
450
|
+
...opts,
|
|
451
|
+
query: params
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
/** GET /tables/{tableId}/objects/archived — auto-paged over every archived object. */
|
|
455
|
+
iterateArchivedObjects(tableId, params, opts) {
|
|
456
|
+
const limit = pageLimit(params?.limit);
|
|
457
|
+
return paginate(
|
|
458
|
+
(p) => this.listArchivedObjects(tableId, p, opts),
|
|
459
|
+
{ offset: 0, ...params, limit },
|
|
460
|
+
offsetWalker("objects", limit)
|
|
461
|
+
);
|
|
462
|
+
}
|
|
463
|
+
/** GET /tables/{tableId}/objects/search */
|
|
464
|
+
searchObjects(tableId, params, opts) {
|
|
465
|
+
return this.transport.request("GET", `/api/v1/tables/${enc(tableId)}/objects/search`, {
|
|
466
|
+
...opts,
|
|
467
|
+
query: params
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
/** GET /tables/{tableId}/objects/search — auto-paged over every match. */
|
|
471
|
+
searchObjectsAll(tableId, params, opts) {
|
|
472
|
+
const limit = pageLimit(params?.limit);
|
|
473
|
+
return paginate(
|
|
474
|
+
(p) => this.searchObjects(tableId, p, opts),
|
|
475
|
+
{ offset: 0, ...params, limit },
|
|
476
|
+
offsetWalker("objects", limit)
|
|
477
|
+
);
|
|
478
|
+
}
|
|
479
|
+
/** POST /tables/{tableId}/objects */
|
|
480
|
+
createObject(tableId, body, opts) {
|
|
481
|
+
return this.transport.request("POST", `/api/v1/tables/${enc(tableId)}/objects`, { ...opts, body });
|
|
482
|
+
}
|
|
483
|
+
/** POST /tables/{tableId}/objects/bulk (partial success → 207). */
|
|
484
|
+
bulkCreateObjects(tableId, body, opts) {
|
|
485
|
+
return this.transport.request("POST", `/api/v1/tables/${enc(tableId)}/objects/bulk`, { ...opts, body });
|
|
486
|
+
}
|
|
487
|
+
/** POST /tables/{tableId}/objects/validate-bulk (dry-run; no writes). */
|
|
488
|
+
validateBulkObjects(tableId, body, opts) {
|
|
489
|
+
return this.transport.request("POST", `/api/v1/tables/${enc(tableId)}/objects/validate-bulk`, {
|
|
490
|
+
...opts,
|
|
491
|
+
body
|
|
492
|
+
});
|
|
493
|
+
}
|
|
494
|
+
// --- archive / restore / permanent-delete ---
|
|
495
|
+
/** POST /tables/{id}/archive — soft-archive (reversible); requires a reason. */
|
|
496
|
+
archive(id, body, opts) {
|
|
497
|
+
return this.transport.request("POST", `/api/v1/tables/${enc(id)}/archive`, { ...opts, body });
|
|
498
|
+
}
|
|
499
|
+
/** POST /tables/{id}/restore — restore an archived table. */
|
|
500
|
+
restore(id, body, opts) {
|
|
501
|
+
return this.transport.request("POST", `/api/v1/tables/${enc(id)}/restore`, { ...opts, body });
|
|
502
|
+
}
|
|
503
|
+
};
|
|
504
|
+
|
|
505
|
+
// src/resources/data/columns.ts
|
|
506
|
+
var enc2 = encodeURIComponent;
|
|
507
|
+
var ColumnsResource = class extends Resource {
|
|
508
|
+
/** GET /columns/{id} */
|
|
509
|
+
get(id, opts) {
|
|
510
|
+
return this.transport.request("GET", `/api/v1/columns/${enc2(id)}`, opts);
|
|
511
|
+
}
|
|
512
|
+
/** PATCH /columns/{id} */
|
|
513
|
+
update(id, body, opts) {
|
|
514
|
+
return this.transport.request("PATCH", `/api/v1/columns/${enc2(id)}`, { ...opts, body });
|
|
515
|
+
}
|
|
516
|
+
/** POST /columns/bulk-update (conflict-aware; partial success → 207). */
|
|
517
|
+
bulkUpdate(body, opts) {
|
|
518
|
+
return this.transport.request("POST", "/api/v1/columns/bulk-update", { ...opts, body });
|
|
519
|
+
}
|
|
520
|
+
// --- archive / restore / permanent-delete ---
|
|
521
|
+
/** POST /columns/{id}/archive — soft-archive (reversible); requires a reason. */
|
|
522
|
+
archive(id, body, opts) {
|
|
523
|
+
return this.transport.request("POST", `/api/v1/columns/${enc2(id)}/archive`, { ...opts, body });
|
|
524
|
+
}
|
|
525
|
+
/** POST /columns/{id}/restore — restore an archived column. */
|
|
526
|
+
restore(id, body, opts) {
|
|
527
|
+
return this.transport.request("POST", `/api/v1/columns/${enc2(id)}/restore`, { ...opts, body });
|
|
528
|
+
}
|
|
529
|
+
};
|
|
530
|
+
|
|
531
|
+
// src/resources/data/naming-schemes.ts
|
|
532
|
+
var enc3 = encodeURIComponent;
|
|
533
|
+
var NamingSchemesResource = class extends Resource {
|
|
534
|
+
/** GET /naming-schemes */
|
|
535
|
+
list(opts) {
|
|
536
|
+
return this.transport.request("GET", "/api/v1/naming-schemes", opts);
|
|
537
|
+
}
|
|
538
|
+
/** POST /naming-schemes */
|
|
539
|
+
create(body, opts) {
|
|
540
|
+
return this.transport.request("POST", "/api/v1/naming-schemes", { ...opts, body });
|
|
541
|
+
}
|
|
542
|
+
/** GET /naming-schemes/{id} */
|
|
543
|
+
get(id, opts) {
|
|
544
|
+
return this.transport.request("GET", `/api/v1/naming-schemes/${enc3(id)}`, opts);
|
|
545
|
+
}
|
|
546
|
+
/** PATCH /naming-schemes/{id} */
|
|
547
|
+
update(id, body, opts) {
|
|
548
|
+
return this.transport.request("PATCH", `/api/v1/naming-schemes/${enc3(id)}`, { ...opts, body });
|
|
549
|
+
}
|
|
550
|
+
/** POST /naming-schemes/{id}/generate — the next ID from the scheme. */
|
|
551
|
+
generateNextId(id, opts) {
|
|
552
|
+
return this.transport.request("POST", `/api/v1/naming-schemes/${enc3(id)}/generate`, opts);
|
|
553
|
+
}
|
|
554
|
+
};
|
|
555
|
+
|
|
556
|
+
// src/resources/data/objects.ts
|
|
557
|
+
var enc4 = encodeURIComponent;
|
|
558
|
+
var ObjectsResource = class extends Resource {
|
|
559
|
+
/** POST /objects/resolve — batch-resolve objects by ID (max 100). */
|
|
560
|
+
resolve(body, opts) {
|
|
561
|
+
return this.transport.request("POST", "/api/v1/objects/resolve", { ...opts, body });
|
|
562
|
+
}
|
|
563
|
+
/** GET /objects/{id} */
|
|
564
|
+
get(id, opts) {
|
|
565
|
+
return this.transport.request("GET", `/api/v1/objects/${enc4(id)}`, opts);
|
|
566
|
+
}
|
|
567
|
+
/** GET /objects/{id}/context — object with its table, environment, and columns. */
|
|
568
|
+
getWithContext(id, opts) {
|
|
569
|
+
return this.transport.request("GET", `/api/v1/objects/${enc4(id)}/context`, opts);
|
|
570
|
+
}
|
|
571
|
+
/** GET /objects/{id}/references — incoming references (reverse lookup). */
|
|
572
|
+
getReferences(id, params, opts) {
|
|
573
|
+
return this.transport.request("GET", `/api/v1/objects/${enc4(id)}/references`, {
|
|
574
|
+
...opts,
|
|
575
|
+
query: params
|
|
576
|
+
});
|
|
577
|
+
}
|
|
578
|
+
/** PATCH /objects/{id} */
|
|
579
|
+
update(id, body, opts) {
|
|
580
|
+
return this.transport.request("PATCH", `/api/v1/objects/${enc4(id)}`, { ...opts, body });
|
|
581
|
+
}
|
|
582
|
+
/** POST /objects/bulk-update (partial success → 207). */
|
|
583
|
+
bulkUpdate(body, opts) {
|
|
584
|
+
return this.transport.request("POST", "/api/v1/objects/bulk-update", { ...opts, body });
|
|
585
|
+
}
|
|
586
|
+
// --- archive / restore / permanent-delete (single + bulk) ---
|
|
587
|
+
/** POST /objects/{id}/archive — soft-archive (reversible); requires a reason. */
|
|
588
|
+
archive(id, body, opts) {
|
|
589
|
+
return this.transport.request("POST", `/api/v1/objects/${enc4(id)}/archive`, { ...opts, body });
|
|
590
|
+
}
|
|
591
|
+
/** POST /objects/{id}/restore — restore an archived object. */
|
|
592
|
+
restore(id, body, opts) {
|
|
593
|
+
return this.transport.request("POST", `/api/v1/objects/${enc4(id)}/restore`, { ...opts, body });
|
|
594
|
+
}
|
|
595
|
+
/** POST /objects/bulk-archive — archive many objects (per-id failures aggregated). */
|
|
596
|
+
bulkArchive(body, opts) {
|
|
597
|
+
return this.transport.request("POST", "/api/v1/objects/bulk-archive", { ...opts, body });
|
|
598
|
+
}
|
|
599
|
+
/** POST /objects/bulk-restore — restore many archived objects. */
|
|
600
|
+
bulkRestore(body, opts) {
|
|
601
|
+
return this.transport.request("POST", "/api/v1/objects/bulk-restore", { ...opts, body });
|
|
602
|
+
}
|
|
603
|
+
};
|
|
604
|
+
|
|
605
|
+
// src/resources/data/saved-queries.ts
|
|
606
|
+
var enc5 = encodeURIComponent;
|
|
607
|
+
var SavedQueriesResource = class extends Resource {
|
|
608
|
+
/** GET /queries */
|
|
609
|
+
list(params, opts) {
|
|
610
|
+
return this.transport.request("GET", "/api/v1/queries", { ...opts, query: params });
|
|
611
|
+
}
|
|
612
|
+
/** GET /queries — auto-paged over every saved query. */
|
|
613
|
+
iterate(params, opts) {
|
|
614
|
+
const limit = pageLimit(params?.limit);
|
|
615
|
+
return paginate(
|
|
616
|
+
(p) => this.list(p, opts),
|
|
617
|
+
{ offset: 0, ...params, limit },
|
|
618
|
+
offsetWalker("queries", limit)
|
|
619
|
+
);
|
|
620
|
+
}
|
|
621
|
+
/** POST /queries */
|
|
622
|
+
create(body, params, opts) {
|
|
623
|
+
return this.transport.request("POST", "/api/v1/queries", { ...opts, body, query: params });
|
|
624
|
+
}
|
|
625
|
+
/** GET /queries/{queryId} */
|
|
626
|
+
get(queryId, params, opts) {
|
|
627
|
+
return this.transport.request("GET", `/api/v1/queries/${enc5(queryId)}`, {
|
|
628
|
+
...opts,
|
|
629
|
+
query: params
|
|
630
|
+
});
|
|
631
|
+
}
|
|
632
|
+
/** PATCH /queries/{queryId} */
|
|
633
|
+
update(queryId, body, params, opts) {
|
|
634
|
+
return this.transport.request("PATCH", `/api/v1/queries/${enc5(queryId)}`, {
|
|
635
|
+
...opts,
|
|
636
|
+
body,
|
|
637
|
+
query: params
|
|
638
|
+
});
|
|
639
|
+
}
|
|
640
|
+
/** POST /queries/{queryId}/duplicate */
|
|
641
|
+
duplicate(queryId, body, opts) {
|
|
642
|
+
return this.transport.request("POST", `/api/v1/queries/${enc5(queryId)}/duplicate`, { ...opts, body });
|
|
643
|
+
}
|
|
644
|
+
/** POST /queries/{queryId}/execute — runs the query, returns the raw result. */
|
|
645
|
+
execute(queryId, body, opts) {
|
|
646
|
+
return this.transport.request("POST", `/api/v1/queries/${enc5(queryId)}/execute`, { ...opts, body });
|
|
647
|
+
}
|
|
648
|
+
};
|
|
649
|
+
|
|
650
|
+
// src/resources/data/query.ts
|
|
651
|
+
var enc6 = encodeURIComponent;
|
|
652
|
+
var QueryResource = class extends Resource {
|
|
653
|
+
/** POST /environments/{envId}/query */
|
|
654
|
+
execute(envId, body, params, opts) {
|
|
655
|
+
return this.transport.request("POST", `/api/v1/environments/${enc6(envId)}/query`, {
|
|
656
|
+
...opts,
|
|
657
|
+
body,
|
|
658
|
+
query: params
|
|
659
|
+
});
|
|
660
|
+
}
|
|
661
|
+
/** POST /environments/{envId}/query/preview — generated SQL, no execution. */
|
|
662
|
+
preview(envId, body, opts) {
|
|
663
|
+
return this.transport.request("POST", `/api/v1/environments/${enc6(envId)}/query/preview`, { ...opts, body });
|
|
664
|
+
}
|
|
665
|
+
/** POST /environments/{envId}/query/sql — read-only raw SQL (SELECT only). */
|
|
666
|
+
sql(envId, body, opts) {
|
|
667
|
+
return this.transport.request("POST", `/api/v1/environments/${enc6(envId)}/query/sql`, { ...opts, body });
|
|
668
|
+
}
|
|
669
|
+
};
|
|
670
|
+
|
|
671
|
+
// src/resources/data/results.ts
|
|
672
|
+
var enc7 = encodeURIComponent;
|
|
673
|
+
var ResultsResource = class extends Resource {
|
|
674
|
+
/** GET /results/schemas/{schemaId}/describe — fillable template + columns. */
|
|
675
|
+
describeSchema(schemaId, opts) {
|
|
676
|
+
return this.transport.request("GET", `/api/v1/results/schemas/${enc7(schemaId)}/describe`, opts);
|
|
677
|
+
}
|
|
678
|
+
/** POST /results/batches/validate — dry-run validation (no writes). */
|
|
679
|
+
validateBatch(body, opts) {
|
|
680
|
+
return this.transport.request("POST", "/api/v1/results/batches/validate", { ...opts, body });
|
|
681
|
+
}
|
|
682
|
+
/** POST /results/batches — create a batch (partial success → 207). */
|
|
683
|
+
createBatch(body, opts) {
|
|
684
|
+
return this.transport.request("POST", "/api/v1/results/batches", { ...opts, body });
|
|
685
|
+
}
|
|
686
|
+
/** GET /results/batches */
|
|
687
|
+
listBatches(params, opts) {
|
|
688
|
+
return this.transport.request("GET", "/api/v1/results/batches", {
|
|
689
|
+
...opts,
|
|
690
|
+
query: params
|
|
691
|
+
});
|
|
692
|
+
}
|
|
693
|
+
/** GET /results/batches/{id} */
|
|
694
|
+
getBatch(id, opts) {
|
|
695
|
+
return this.transport.request("GET", `/api/v1/results/batches/${enc7(id)}`, opts);
|
|
696
|
+
}
|
|
697
|
+
/** POST /results/batches/{id}/supersede — re-record (partial success → 207). */
|
|
698
|
+
supersedeBatch(id, body, opts) {
|
|
699
|
+
return this.transport.request("POST", `/api/v1/results/batches/${enc7(id)}/supersede`, { ...opts, body });
|
|
700
|
+
}
|
|
701
|
+
/** GET /results/records — list records (filterable, paginated). */
|
|
702
|
+
listRecords(params, opts) {
|
|
703
|
+
return this.transport.request("GET", "/api/v1/results/records", {
|
|
704
|
+
...opts,
|
|
705
|
+
query: params
|
|
706
|
+
});
|
|
707
|
+
}
|
|
708
|
+
/** GET /results/records/by-object/{objectId} — reverse lookup. */
|
|
709
|
+
recordsByObject(objectId, opts) {
|
|
710
|
+
return this.transport.request("GET", `/api/v1/results/records/by-object/${enc7(objectId)}`, opts);
|
|
711
|
+
}
|
|
712
|
+
/** POST /results/query — analytical query (filter, group, aggregate). */
|
|
713
|
+
query(body, opts) {
|
|
714
|
+
return this.transport.request("POST", "/api/v1/results/query", { ...opts, body });
|
|
715
|
+
}
|
|
716
|
+
// --- result-batch archive / restore / permanent-delete ---
|
|
717
|
+
/** POST /result-batches/{id}/archive — soft-archive a batch (reversible). */
|
|
718
|
+
archiveBatch(id, body, opts) {
|
|
719
|
+
return this.transport.request("POST", `/api/v1/result-batches/${enc7(id)}/archive`, { ...opts, body });
|
|
720
|
+
}
|
|
721
|
+
/** POST /result-batches/{id}/restore — restore an archived batch. */
|
|
722
|
+
restoreBatch(id, body, opts) {
|
|
723
|
+
return this.transport.request("POST", `/api/v1/result-batches/${enc7(id)}/restore`, { ...opts, body });
|
|
724
|
+
}
|
|
725
|
+
};
|
|
726
|
+
|
|
727
|
+
// src/resources/data/schema.ts
|
|
728
|
+
var enc8 = encodeURIComponent;
|
|
729
|
+
var SchemaResource = class extends Resource {
|
|
730
|
+
/** POST /environments/{envId}/schema/validate — detect conflicts (no writes). */
|
|
731
|
+
validate(envId, body, opts) {
|
|
732
|
+
return this.transport.request("POST", `/api/v1/environments/${enc8(envId)}/schema/validate`, { ...opts, body });
|
|
733
|
+
}
|
|
734
|
+
/** GET /environments/{envId}/schema/jobs/{jobId} — async migration status. */
|
|
735
|
+
jobStatus(envId, jobId, opts) {
|
|
736
|
+
return this.transport.request("GET", `/api/v1/environments/${enc8(envId)}/schema/jobs/${enc8(jobId)}`, opts);
|
|
737
|
+
}
|
|
738
|
+
};
|
|
739
|
+
|
|
740
|
+
// src/resources/data/environments.ts
|
|
741
|
+
var enc9 = encodeURIComponent;
|
|
742
|
+
var EnvironmentsResource = class extends Resource {
|
|
743
|
+
/** GET /environments */
|
|
744
|
+
list(opts) {
|
|
745
|
+
return this.transport.request("GET", "/api/v1/environments", opts);
|
|
746
|
+
}
|
|
747
|
+
/** POST /environments */
|
|
748
|
+
create(body, opts) {
|
|
749
|
+
return this.transport.request("POST", "/api/v1/environments", { ...opts, body });
|
|
750
|
+
}
|
|
751
|
+
/** GET /environments/archived */
|
|
752
|
+
listArchived(opts) {
|
|
753
|
+
return this.transport.request("GET", "/api/v1/environments/archived", opts);
|
|
754
|
+
}
|
|
755
|
+
/** GET /environments/{id} */
|
|
756
|
+
get(id, opts) {
|
|
757
|
+
return this.transport.request("GET", `/api/v1/environments/${enc9(id)}`, opts);
|
|
758
|
+
}
|
|
759
|
+
/** PATCH /environments/{id} */
|
|
760
|
+
update(id, body, opts) {
|
|
761
|
+
return this.transport.request("PATCH", `/api/v1/environments/${enc9(id)}`, { ...opts, body });
|
|
762
|
+
}
|
|
763
|
+
// --- staging snapshot ---
|
|
764
|
+
/** GET /environments/{id}/staging */
|
|
765
|
+
getStaging(id, opts) {
|
|
766
|
+
return this.transport.request("GET", `/api/v1/environments/${enc9(id)}/staging`, opts);
|
|
767
|
+
}
|
|
768
|
+
/** GET /environments/{id}/staging/version — cheap version poll. */
|
|
769
|
+
getStagingVersion(id, opts) {
|
|
770
|
+
return this.transport.request("GET", `/api/v1/environments/${enc9(id)}/staging/version`, opts);
|
|
771
|
+
}
|
|
772
|
+
/** POST /environments/{id}/staging/resync — reset staging to live. */
|
|
773
|
+
resyncStaging(id, opts) {
|
|
774
|
+
return this.transport.request("POST", `/api/v1/environments/${enc9(id)}/staging/resync`, opts);
|
|
775
|
+
}
|
|
776
|
+
// --- linkage / references ---
|
|
777
|
+
/** PATCH /environments/{id}/source-market */
|
|
778
|
+
setSourceMarket(id, body, opts) {
|
|
779
|
+
return this.transport.request("PATCH", `/api/v1/environments/${enc9(id)}/source-market`, { ...opts, body });
|
|
780
|
+
}
|
|
781
|
+
/** POST /environments/{id}/detach — break the marketplace link (make editable). */
|
|
782
|
+
detach(id, opts) {
|
|
783
|
+
return this.transport.request("POST", `/api/v1/environments/${enc9(id)}/detach`, opts);
|
|
784
|
+
}
|
|
785
|
+
/** GET /environments/{id}/cross-references */
|
|
786
|
+
crossReferences(id, opts) {
|
|
787
|
+
return this.transport.request("GET", `/api/v1/environments/${enc9(id)}/cross-references`, opts);
|
|
788
|
+
}
|
|
789
|
+
// --- env-scoped collections ---
|
|
790
|
+
/** GET /environments/{envId}/tables (?source=staging for the proposed schema). */
|
|
791
|
+
listTables(envId, params, opts) {
|
|
792
|
+
return this.transport.request("GET", `/api/v1/environments/${enc9(envId)}/tables`, {
|
|
793
|
+
...opts,
|
|
794
|
+
query: params
|
|
795
|
+
});
|
|
796
|
+
}
|
|
797
|
+
/** GET /environments/{envId}/columns (?source=staging for the proposed schema). */
|
|
798
|
+
listColumns(envId, params, opts) {
|
|
799
|
+
return this.transport.request("GET", `/api/v1/environments/${enc9(envId)}/columns`, {
|
|
800
|
+
...opts,
|
|
801
|
+
query: params
|
|
802
|
+
});
|
|
803
|
+
}
|
|
804
|
+
/** GET /environments/{envId}/relationships — every reference edge. */
|
|
805
|
+
listRelationships(envId, opts) {
|
|
806
|
+
return this.transport.request("GET", `/api/v1/environments/${enc9(envId)}/relationships`, opts);
|
|
807
|
+
}
|
|
808
|
+
/** GET /environments/{envId}/tables/{tableId}/relationships */
|
|
809
|
+
listTableRelationships(envId, tableId, opts) {
|
|
810
|
+
return this.transport.request(
|
|
811
|
+
"GET",
|
|
812
|
+
`/api/v1/environments/${enc9(envId)}/tables/${enc9(tableId)}/relationships`,
|
|
813
|
+
opts
|
|
814
|
+
);
|
|
815
|
+
}
|
|
816
|
+
/** GET /environments/{envId}/tables/archived */
|
|
817
|
+
listArchivedTables(envId, opts) {
|
|
818
|
+
return this.transport.request("GET", `/api/v1/environments/${enc9(envId)}/tables/archived`, opts);
|
|
819
|
+
}
|
|
820
|
+
/** POST /environments/{envId}/tables */
|
|
821
|
+
createTable(envId, body, opts) {
|
|
822
|
+
return this.transport.request("POST", `/api/v1/environments/${enc9(envId)}/tables`, { ...opts, body });
|
|
823
|
+
}
|
|
824
|
+
/** POST /environments/{envId}/tables/bulk (partial success → 207). */
|
|
825
|
+
bulkCreateTables(envId, body, opts) {
|
|
826
|
+
return this.transport.request("POST", `/api/v1/environments/${enc9(envId)}/tables/bulk`, { ...opts, body });
|
|
827
|
+
}
|
|
828
|
+
/** GET /environments/{envId}/objects/search */
|
|
829
|
+
searchObjects(envId, params, opts) {
|
|
830
|
+
return this.transport.request("GET", `/api/v1/environments/${enc9(envId)}/objects/search`, {
|
|
831
|
+
...opts,
|
|
832
|
+
query: params
|
|
833
|
+
});
|
|
834
|
+
}
|
|
835
|
+
// --- import / export ---
|
|
836
|
+
/** POST /environments/import — import an EnvironmentPackage. */
|
|
837
|
+
importPackage(body, opts) {
|
|
838
|
+
return this.transport.request("POST", "/api/v1/environments/import", { ...opts, body });
|
|
839
|
+
}
|
|
840
|
+
/** GET /environments/{id}/export — export to EnvironmentPackage. */
|
|
841
|
+
exportPackage(id, opts) {
|
|
842
|
+
return this.transport.request("GET", `/api/v1/environments/${enc9(id)}/export`, opts);
|
|
843
|
+
}
|
|
844
|
+
/** POST /environments/{id}/data/import — import a data package (dry-runnable). */
|
|
845
|
+
importData(id, body, params, opts) {
|
|
846
|
+
return this.transport.request("POST", `/api/v1/environments/${enc9(id)}/data/import`, {
|
|
847
|
+
...opts,
|
|
848
|
+
body,
|
|
849
|
+
query: params
|
|
850
|
+
});
|
|
851
|
+
}
|
|
852
|
+
/** POST /environments/{id}/data/import/apply — structured spreadsheet import. */
|
|
853
|
+
applyImport(id, body, opts) {
|
|
854
|
+
return this.transport.request("POST", `/api/v1/environments/${enc9(id)}/data/import/apply`, { ...opts, body });
|
|
855
|
+
}
|
|
856
|
+
/** POST /environments/{id}/tables/{tableId}/export — export a table to a CSV file. */
|
|
857
|
+
exportTableCsv(id, tableId, body, opts) {
|
|
858
|
+
return this.transport.request("POST", `/api/v1/environments/${enc9(id)}/tables/${enc9(tableId)}/export`, {
|
|
859
|
+
...opts,
|
|
860
|
+
body
|
|
861
|
+
});
|
|
862
|
+
}
|
|
863
|
+
/** GET /environments/{id}/data/export — export environment data (?tables=id1,id2). */
|
|
864
|
+
exportData(id, params, opts) {
|
|
865
|
+
return this.transport.request("GET", `/api/v1/environments/${enc9(id)}/data/export`, {
|
|
866
|
+
...opts,
|
|
867
|
+
query: params
|
|
868
|
+
});
|
|
869
|
+
}
|
|
870
|
+
// --- archive / restore / permanent-delete (cascades to descendants) ---
|
|
871
|
+
/** POST /environments/{id}/archive — soft-archive (reversible); requires a reason. */
|
|
872
|
+
archive(id, body, opts) {
|
|
873
|
+
return this.transport.request("POST", `/api/v1/environments/${enc9(id)}/archive`, { ...opts, body });
|
|
874
|
+
}
|
|
875
|
+
/** POST /environments/{id}/restore — restore an archived environment. */
|
|
876
|
+
restore(id, body, opts) {
|
|
877
|
+
return this.transport.request("POST", `/api/v1/environments/${enc9(id)}/restore`, { ...opts, body });
|
|
878
|
+
}
|
|
879
|
+
};
|
|
880
|
+
|
|
881
|
+
// src/resources/data/import-mappings.ts
|
|
882
|
+
var enc10 = encodeURIComponent;
|
|
883
|
+
var ImportMappingsResource = class extends Resource {
|
|
884
|
+
/** GET /import-mappings?environmentId= — active mappings for an environment. */
|
|
885
|
+
list(params, opts) {
|
|
886
|
+
return this.transport.request("GET", "/api/v1/import-mappings", {
|
|
887
|
+
...opts,
|
|
888
|
+
query: params
|
|
889
|
+
});
|
|
890
|
+
}
|
|
891
|
+
/** GET /import-mappings/{mappingId} — a mapping with its full entries. */
|
|
892
|
+
get(mappingId, opts) {
|
|
893
|
+
return this.transport.request("GET", `/api/v1/import-mappings/${enc10(mappingId)}`, opts);
|
|
894
|
+
}
|
|
895
|
+
/** POST /import-mappings */
|
|
896
|
+
create(data, opts) {
|
|
897
|
+
return this.transport.request("POST", "/api/v1/import-mappings", { ...opts, body: data });
|
|
898
|
+
}
|
|
899
|
+
/** PATCH /import-mappings/{mappingId} */
|
|
900
|
+
update(mappingId, data, opts) {
|
|
901
|
+
return this.transport.request("PATCH", `/api/v1/import-mappings/${enc10(mappingId)}`, { ...opts, body: data });
|
|
902
|
+
}
|
|
903
|
+
/** POST /import-mappings/{mappingId}/archive (reversible soft-delete). */
|
|
904
|
+
archive(mappingId, payload, opts) {
|
|
905
|
+
return this.transport.request("POST", `/api/v1/import-mappings/${enc10(mappingId)}/archive`, {
|
|
906
|
+
...opts,
|
|
907
|
+
body: payload
|
|
908
|
+
});
|
|
909
|
+
}
|
|
910
|
+
/** POST /import-mappings/{mappingId}/restore */
|
|
911
|
+
restore(mappingId, payload, opts) {
|
|
912
|
+
return this.transport.request("POST", `/api/v1/import-mappings/${enc10(mappingId)}/restore`, {
|
|
913
|
+
...opts,
|
|
914
|
+
body: payload
|
|
915
|
+
});
|
|
916
|
+
}
|
|
917
|
+
/** GET /import-mappings/{mappingId}/file-overviews — source sheets + headers. */
|
|
918
|
+
getFileOverviews(mappingId, opts) {
|
|
919
|
+
return this.transport.request("GET", `/api/v1/import-mappings/${enc10(mappingId)}/file-overviews`, opts);
|
|
920
|
+
}
|
|
921
|
+
/** GET /import-mappings/{mappingId}/audit — per-mapping audit trail. */
|
|
922
|
+
getAuditTrail(mappingId, params, opts) {
|
|
923
|
+
return this.transport.request("GET", `/api/v1/import-mappings/${enc10(mappingId)}/audit`, {
|
|
924
|
+
...opts,
|
|
925
|
+
query: params
|
|
926
|
+
});
|
|
927
|
+
}
|
|
928
|
+
};
|
|
929
|
+
|
|
930
|
+
// src/resources/data/index.ts
|
|
931
|
+
var DataResource = class {
|
|
932
|
+
environments;
|
|
933
|
+
tables;
|
|
934
|
+
columns;
|
|
935
|
+
namingSchemes;
|
|
936
|
+
objects;
|
|
937
|
+
savedQueries;
|
|
938
|
+
query;
|
|
939
|
+
results;
|
|
940
|
+
schema;
|
|
941
|
+
importMappings;
|
|
942
|
+
constructor(transport) {
|
|
943
|
+
this.environments = new EnvironmentsResource(transport);
|
|
944
|
+
this.tables = new TablesResource(transport);
|
|
945
|
+
this.columns = new ColumnsResource(transport);
|
|
946
|
+
this.namingSchemes = new NamingSchemesResource(transport);
|
|
947
|
+
this.objects = new ObjectsResource(transport);
|
|
948
|
+
this.savedQueries = new SavedQueriesResource(transport);
|
|
949
|
+
this.query = new QueryResource(transport);
|
|
950
|
+
this.results = new ResultsResource(transport);
|
|
951
|
+
this.schema = new SchemaResource(transport);
|
|
952
|
+
this.importMappings = new ImportMappingsResource(transport);
|
|
953
|
+
}
|
|
954
|
+
};
|
|
955
|
+
|
|
956
|
+
// src/client.ts
|
|
957
|
+
function readEnv(name) {
|
|
958
|
+
return typeof process !== "undefined" && process.env ? process.env[name] : void 0;
|
|
959
|
+
}
|
|
960
|
+
function credentialFromConfig(cfg) {
|
|
961
|
+
if (cfg.credential) return cfg.credential;
|
|
962
|
+
if (cfg.apiKey) return new ApiKeyCredential(cfg.apiKey);
|
|
963
|
+
if (cfg.sessionCookie) return new SessionCookieCredential();
|
|
964
|
+
const envKey = readEnv("DALEA_API_KEY");
|
|
965
|
+
if (envKey) return new ApiKeyCredential(envKey);
|
|
966
|
+
throw new Error(
|
|
967
|
+
"DaleaClient: provide one of { apiKey, sessionCookie, credential }, or set the DALEA_API_KEY env var"
|
|
968
|
+
);
|
|
969
|
+
}
|
|
970
|
+
var DaleaClient = class {
|
|
971
|
+
resolved;
|
|
972
|
+
serviceUrls;
|
|
973
|
+
workspace;
|
|
974
|
+
data;
|
|
975
|
+
constructor(cfg) {
|
|
976
|
+
this.resolved = resolveConfig(cfg);
|
|
977
|
+
this.serviceUrls = cfg.serviceUrls ?? {};
|
|
978
|
+
this.workspace = new WorkspaceContext(cfg.workspace);
|
|
979
|
+
const credential = credentialFromConfig(cfg);
|
|
980
|
+
this.data = new DataResource(this.transportFor("data", credential));
|
|
981
|
+
}
|
|
982
|
+
// A transport bound to the domain's base URL (a per-service override, or the
|
|
983
|
+
// shared baseUrl when none is set). Shares the resolved config and workspace.
|
|
984
|
+
transportFor(domain, credential) {
|
|
985
|
+
const override = this.serviceUrls[domain];
|
|
986
|
+
const resolved = override !== void 0 && override !== this.resolved.baseUrl ? { ...this.resolved, baseUrl: override } : this.resolved;
|
|
987
|
+
return new Transport(resolved, credential, this.workspace);
|
|
988
|
+
}
|
|
989
|
+
/** Set the default workspace (X-Workspace) for subsequent calls. */
|
|
990
|
+
setWorkspace(id) {
|
|
991
|
+
this.workspace.set(id);
|
|
992
|
+
}
|
|
993
|
+
/**
|
|
994
|
+
* Returns a lightweight view authenticated with a per-call bearer token,
|
|
995
|
+
* sharing this client's config, interceptors and workspace context. Useful for
|
|
996
|
+
* authenticating individual requests with a caller-supplied token.
|
|
997
|
+
*/
|
|
998
|
+
as(token) {
|
|
999
|
+
const credential = new BearerCredential(token);
|
|
1000
|
+
return {
|
|
1001
|
+
data: new DataResource(this.transportFor("data", credential))
|
|
1002
|
+
};
|
|
1003
|
+
}
|
|
1004
|
+
};
|
|
1005
|
+
|
|
1006
|
+
// src/auth/oauth-pkce.ts
|
|
1007
|
+
var OAuthPkceCredential = class _OAuthPkceCredential {
|
|
1008
|
+
constructor(cfg) {
|
|
1009
|
+
this.cfg = cfg;
|
|
1010
|
+
this.tokens = cfg.tokens;
|
|
1011
|
+
this.fetchImpl = cfg.fetch ?? globalThis.fetch?.bind(globalThis);
|
|
1012
|
+
if (!this.fetchImpl) {
|
|
1013
|
+
throw new Error("OAuthPkceCredential: no global fetch available; pass cfg.fetch");
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
tokens;
|
|
1017
|
+
fetchImpl;
|
|
1018
|
+
apply(ctx) {
|
|
1019
|
+
ctx.headers.set("Authorization", `Bearer ${this.tokens.accessToken}`);
|
|
1020
|
+
}
|
|
1021
|
+
/**
|
|
1022
|
+
* Called by the transport on a 401. Exchanges the refresh token for a fresh
|
|
1023
|
+
* access token and returns `true` so the request is replayed ONCE. Returns
|
|
1024
|
+
* `false` (no retry — the original 401 surfaces) when there is no refresh token
|
|
1025
|
+
* or the grant fails, so a revoked session can't spin in a refresh loop.
|
|
1026
|
+
*/
|
|
1027
|
+
async refresh() {
|
|
1028
|
+
if (!this.tokens.refreshToken) return false;
|
|
1029
|
+
try {
|
|
1030
|
+
await this.grant({
|
|
1031
|
+
grant_type: "refresh_token",
|
|
1032
|
+
refresh_token: this.tokens.refreshToken,
|
|
1033
|
+
client_id: this.cfg.clientId,
|
|
1034
|
+
...this.cfg.clientSecret ? { client_secret: this.cfg.clientSecret } : {}
|
|
1035
|
+
});
|
|
1036
|
+
return true;
|
|
1037
|
+
} catch {
|
|
1038
|
+
return false;
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
/** Stable-ish dedup id; the access-token suffix changes only on the rare refresh. */
|
|
1042
|
+
key() {
|
|
1043
|
+
return `oauth:${this.tokens.accessToken.slice(-8)}`;
|
|
1044
|
+
}
|
|
1045
|
+
/** The tokens this credential currently holds (post-refresh / post-exchange). */
|
|
1046
|
+
currentTokens() {
|
|
1047
|
+
return this.tokens;
|
|
1048
|
+
}
|
|
1049
|
+
// POST the token endpoint as `application/x-www-form-urlencoded`, adopt the
|
|
1050
|
+
// returned tokens, and notify `onTokens`. Shared by refresh() + exchangeCode().
|
|
1051
|
+
async grant(body) {
|
|
1052
|
+
const res = await this.fetchImpl(this.cfg.tokenEndpoint, {
|
|
1053
|
+
method: "POST",
|
|
1054
|
+
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
1055
|
+
body: new URLSearchParams(body).toString()
|
|
1056
|
+
});
|
|
1057
|
+
if (!res.ok) {
|
|
1058
|
+
throw new Error(`OAuth token endpoint returned ${res.status}`);
|
|
1059
|
+
}
|
|
1060
|
+
const json = await res.json();
|
|
1061
|
+
const next = {
|
|
1062
|
+
accessToken: json.access_token,
|
|
1063
|
+
// A refresh response may omit refresh_token (non-rotating servers) — keep the old one.
|
|
1064
|
+
refreshToken: json.refresh_token ?? this.tokens.refreshToken,
|
|
1065
|
+
expiresAt: typeof json.expires_in === "number" ? Date.now() + json.expires_in * 1e3 : void 0
|
|
1066
|
+
};
|
|
1067
|
+
this.tokens = next;
|
|
1068
|
+
this.cfg.onTokens?.(next);
|
|
1069
|
+
return next;
|
|
1070
|
+
}
|
|
1071
|
+
/**
|
|
1072
|
+
* Exchange a PKCE authorization code for tokens and return a ready credential.
|
|
1073
|
+
* Run after the user is redirected back with `?code=…`; pass the `codeVerifier`
|
|
1074
|
+
* from the matching `generatePkcePair()` call.
|
|
1075
|
+
*/
|
|
1076
|
+
static async exchangeCode(params) {
|
|
1077
|
+
const cred = new _OAuthPkceCredential({
|
|
1078
|
+
tokenEndpoint: params.tokenEndpoint,
|
|
1079
|
+
clientId: params.clientId,
|
|
1080
|
+
clientSecret: params.clientSecret,
|
|
1081
|
+
onTokens: params.onTokens,
|
|
1082
|
+
fetch: params.fetch,
|
|
1083
|
+
// Placeholder — replaced by the grant below before the credential is used.
|
|
1084
|
+
tokens: { accessToken: "" }
|
|
1085
|
+
});
|
|
1086
|
+
await cred.grant({
|
|
1087
|
+
grant_type: "authorization_code",
|
|
1088
|
+
code: params.code,
|
|
1089
|
+
code_verifier: params.codeVerifier,
|
|
1090
|
+
redirect_uri: params.redirectUri,
|
|
1091
|
+
client_id: params.clientId,
|
|
1092
|
+
...params.clientSecret ? { client_secret: params.clientSecret } : {}
|
|
1093
|
+
});
|
|
1094
|
+
return cred;
|
|
1095
|
+
}
|
|
1096
|
+
/**
|
|
1097
|
+
* Generate a PKCE `code_verifier` + S256 `code_challenge`. Stash the verifier
|
|
1098
|
+
* (e.g. sessionStorage) and send the challenge to the authorize endpoint with
|
|
1099
|
+
* `code_challenge_method=S256`. Uses Web Crypto (browser / Node 18+ / edge).
|
|
1100
|
+
*/
|
|
1101
|
+
static async generatePkcePair() {
|
|
1102
|
+
const verifierBytes = crypto.getRandomValues(new Uint8Array(32));
|
|
1103
|
+
const codeVerifier = base64UrlEncode(verifierBytes);
|
|
1104
|
+
const digest = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(codeVerifier));
|
|
1105
|
+
return { codeVerifier, codeChallenge: base64UrlEncode(new Uint8Array(digest)) };
|
|
1106
|
+
}
|
|
1107
|
+
};
|
|
1108
|
+
function base64UrlEncode(bytes) {
|
|
1109
|
+
let binary = "";
|
|
1110
|
+
for (const b of bytes) binary += String.fromCharCode(b);
|
|
1111
|
+
const base64 = typeof btoa === "function" ? btoa(binary) : Buffer.from(bytes).toString("base64");
|
|
1112
|
+
return base64.replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
// src/auth/oauth-client-credentials.ts
|
|
1116
|
+
var OAuthClientCredentialsCredential = class {
|
|
1117
|
+
constructor(cfg) {
|
|
1118
|
+
this.cfg = cfg;
|
|
1119
|
+
this.skewMs = cfg.expirySkewMs ?? 6e4;
|
|
1120
|
+
this.fetchImpl = cfg.fetch ?? globalThis.fetch?.bind(globalThis);
|
|
1121
|
+
if (!this.fetchImpl) {
|
|
1122
|
+
throw new Error("OAuthClientCredentialsCredential: no global fetch available; pass cfg.fetch");
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
accessToken;
|
|
1126
|
+
expiresAt = 0;
|
|
1127
|
+
// epoch ms
|
|
1128
|
+
inflight;
|
|
1129
|
+
skewMs;
|
|
1130
|
+
fetchImpl;
|
|
1131
|
+
/** Ensure a fresh token, then set the bearer header. `apply` is awaited by the transport. */
|
|
1132
|
+
async apply(ctx) {
|
|
1133
|
+
await this.ensureToken();
|
|
1134
|
+
ctx.headers.set("Authorization", `Bearer ${this.accessToken}`);
|
|
1135
|
+
}
|
|
1136
|
+
/** Force a re-mint on a 401 (e.g. the token was revoked mid-life); retry once. */
|
|
1137
|
+
async refresh() {
|
|
1138
|
+
this.inflight = void 0;
|
|
1139
|
+
this.expiresAt = 0;
|
|
1140
|
+
try {
|
|
1141
|
+
await this.ensureToken();
|
|
1142
|
+
return true;
|
|
1143
|
+
} catch {
|
|
1144
|
+
return false;
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
key() {
|
|
1148
|
+
return `cc:${this.cfg.clientId.slice(-8)}`;
|
|
1149
|
+
}
|
|
1150
|
+
// Mint lazily, coalescing concurrent callers onto one in-flight request so a
|
|
1151
|
+
// burst of parallel calls doesn't hammer the token endpoint.
|
|
1152
|
+
ensureToken() {
|
|
1153
|
+
if (this.accessToken && Date.now() < this.expiresAt - this.skewMs) return Promise.resolve();
|
|
1154
|
+
this.inflight ??= this.mint().finally(() => {
|
|
1155
|
+
this.inflight = void 0;
|
|
1156
|
+
});
|
|
1157
|
+
return this.inflight;
|
|
1158
|
+
}
|
|
1159
|
+
async mint() {
|
|
1160
|
+
const body = {
|
|
1161
|
+
grant_type: "client_credentials",
|
|
1162
|
+
client_id: this.cfg.clientId,
|
|
1163
|
+
client_secret: this.cfg.clientSecret
|
|
1164
|
+
};
|
|
1165
|
+
if (this.cfg.scope) body.scope = this.cfg.scope;
|
|
1166
|
+
const res = await this.fetchImpl(this.cfg.tokenEndpoint, {
|
|
1167
|
+
method: "POST",
|
|
1168
|
+
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
1169
|
+
body: new URLSearchParams(body).toString()
|
|
1170
|
+
});
|
|
1171
|
+
if (!res.ok) {
|
|
1172
|
+
throw new Error(`OAuth token endpoint returned ${res.status}`);
|
|
1173
|
+
}
|
|
1174
|
+
const json = await res.json();
|
|
1175
|
+
this.accessToken = json.access_token;
|
|
1176
|
+
this.expiresAt = Date.now() + (typeof json.expires_in === "number" ? json.expires_in : 3600) * 1e3;
|
|
1177
|
+
}
|
|
1178
|
+
};
|
|
1179
|
+
|
|
1180
|
+
// src/core/sse.ts
|
|
1181
|
+
async function* parseSSE(response) {
|
|
1182
|
+
const body = response.body;
|
|
1183
|
+
if (!body) {
|
|
1184
|
+
throw new DaleaNetworkError(0, "NO_STREAM_BODY", "Streaming response had no body", void 0, true);
|
|
1185
|
+
}
|
|
1186
|
+
const reader = body.getReader();
|
|
1187
|
+
const decoder = new TextDecoder();
|
|
1188
|
+
let buffer = "";
|
|
1189
|
+
const frame = (line) => {
|
|
1190
|
+
if (!line.startsWith("data:")) return null;
|
|
1191
|
+
const data = line.slice(5).trim();
|
|
1192
|
+
if (data === "") return null;
|
|
1193
|
+
if (data === "[DONE]") return { done: true };
|
|
1194
|
+
try {
|
|
1195
|
+
return [JSON.parse(data)];
|
|
1196
|
+
} catch {
|
|
1197
|
+
return null;
|
|
1198
|
+
}
|
|
1199
|
+
};
|
|
1200
|
+
try {
|
|
1201
|
+
while (true) {
|
|
1202
|
+
const { done, value } = await reader.read();
|
|
1203
|
+
if (done) {
|
|
1204
|
+
const tail = frame(buffer);
|
|
1205
|
+
if (tail && !("done" in tail)) yield tail[0];
|
|
1206
|
+
break;
|
|
1207
|
+
}
|
|
1208
|
+
buffer += decoder.decode(value, { stream: true });
|
|
1209
|
+
const lines = buffer.split("\n");
|
|
1210
|
+
buffer = lines.pop() ?? "";
|
|
1211
|
+
for (const line of lines) {
|
|
1212
|
+
const f = frame(line);
|
|
1213
|
+
if (f === null) continue;
|
|
1214
|
+
if ("done" in f) return;
|
|
1215
|
+
yield f[0];
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
} finally {
|
|
1219
|
+
reader.releaseLock();
|
|
1220
|
+
void body.cancel().catch(() => {
|
|
1221
|
+
});
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
export { ApiKeyCredential, BearerCredential, DaleaArchivedError, DaleaAuthError, DaleaBannedError, DaleaClient, DaleaConflictError, DaleaError, DaleaNetworkError, DaleaNotFoundError, DaleaPermissionError, DaleaQuotaError, DaleaRateLimitError, DaleaServerError, DaleaValidationError, OAuthClientCredentialsCredential, OAuthPkceCredential, PERMISSION_DENIED_CODES, SDK_VERSION, SessionCookieCredential, WorkspaceContext, cursorWalker, offsetWalker, pageLimit, pageWalker, paginate, parseSSE };
|
|
1226
|
+
//# sourceMappingURL=index.js.map
|
|
1227
|
+
//# sourceMappingURL=index.js.map
|