@xata.io/client 0.0.0-alpha.vf481c73 → 0.0.0-alpha.vf4e6746
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/CHANGELOG.md +208 -0
- package/README.md +32 -30
- package/Usage.md +67 -11
- package/dist/index.cjs +2197 -760
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +5051 -1193
- package/dist/index.mjs +2157 -760
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- /package/{rollup.config.js → rollup.config.mjs} +0 -0
package/dist/index.cjs
CHANGED
@@ -1,6 +1,26 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
-
|
3
|
+
const defaultTrace = async (_name, fn, _options) => {
|
4
|
+
return await fn({
|
5
|
+
setAttributes: () => {
|
6
|
+
return;
|
7
|
+
}
|
8
|
+
});
|
9
|
+
};
|
10
|
+
const TraceAttributes = {
|
11
|
+
KIND: "xata.trace.kind",
|
12
|
+
VERSION: "xata.sdk.version",
|
13
|
+
TABLE: "xata.table",
|
14
|
+
HTTP_REQUEST_ID: "http.request_id",
|
15
|
+
HTTP_STATUS_CODE: "http.status_code",
|
16
|
+
HTTP_HOST: "http.host",
|
17
|
+
HTTP_SCHEME: "http.scheme",
|
18
|
+
HTTP_USER_AGENT: "http.user_agent",
|
19
|
+
HTTP_METHOD: "http.method",
|
20
|
+
HTTP_URL: "http.url",
|
21
|
+
HTTP_ROUTE: "http.route",
|
22
|
+
HTTP_TARGET: "http.target"
|
23
|
+
};
|
4
24
|
|
5
25
|
function notEmpty(value) {
|
6
26
|
return value !== null && value !== void 0;
|
@@ -17,6 +37,24 @@ function isDefined(value) {
|
|
17
37
|
function isString(value) {
|
18
38
|
return isDefined(value) && typeof value === "string";
|
19
39
|
}
|
40
|
+
function isStringArray(value) {
|
41
|
+
return isDefined(value) && Array.isArray(value) && value.every(isString);
|
42
|
+
}
|
43
|
+
function isNumber(value) {
|
44
|
+
return isDefined(value) && typeof value === "number";
|
45
|
+
}
|
46
|
+
function parseNumber(value) {
|
47
|
+
if (isNumber(value)) {
|
48
|
+
return value;
|
49
|
+
}
|
50
|
+
if (isString(value)) {
|
51
|
+
const parsed = Number(value);
|
52
|
+
if (!Number.isNaN(parsed)) {
|
53
|
+
return parsed;
|
54
|
+
}
|
55
|
+
}
|
56
|
+
return void 0;
|
57
|
+
}
|
20
58
|
function toBase64(value) {
|
21
59
|
try {
|
22
60
|
return btoa(value);
|
@@ -25,14 +63,35 @@ function toBase64(value) {
|
|
25
63
|
return buf.from(value).toString("base64");
|
26
64
|
}
|
27
65
|
}
|
66
|
+
function deepMerge(a, b) {
|
67
|
+
const result = { ...a };
|
68
|
+
for (const [key, value] of Object.entries(b)) {
|
69
|
+
if (isObject(value) && isObject(result[key])) {
|
70
|
+
result[key] = deepMerge(result[key], value);
|
71
|
+
} else {
|
72
|
+
result[key] = value;
|
73
|
+
}
|
74
|
+
}
|
75
|
+
return result;
|
76
|
+
}
|
77
|
+
function chunk(array, chunkSize) {
|
78
|
+
const result = [];
|
79
|
+
for (let i = 0; i < array.length; i += chunkSize) {
|
80
|
+
result.push(array.slice(i, i + chunkSize));
|
81
|
+
}
|
82
|
+
return result;
|
83
|
+
}
|
84
|
+
async function timeout(ms) {
|
85
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
86
|
+
}
|
28
87
|
|
29
88
|
function getEnvironment() {
|
30
89
|
try {
|
31
|
-
if (
|
90
|
+
if (isDefined(process) && isDefined(process.env)) {
|
32
91
|
return {
|
33
92
|
apiKey: process.env.XATA_API_KEY ?? getGlobalApiKey(),
|
34
93
|
databaseURL: process.env.XATA_DATABASE_URL ?? getGlobalDatabaseURL(),
|
35
|
-
branch: process.env.XATA_BRANCH,
|
94
|
+
branch: process.env.XATA_BRANCH ?? getGlobalBranch(),
|
36
95
|
envBranch: process.env.VERCEL_GIT_COMMIT_REF ?? process.env.CF_PAGES_BRANCH ?? process.env.BRANCH,
|
37
96
|
fallbackBranch: process.env.XATA_FALLBACK_BRANCH ?? getGlobalFallbackBranch()
|
38
97
|
};
|
@@ -44,7 +103,7 @@ function getEnvironment() {
|
|
44
103
|
return {
|
45
104
|
apiKey: Deno.env.get("XATA_API_KEY") ?? getGlobalApiKey(),
|
46
105
|
databaseURL: Deno.env.get("XATA_DATABASE_URL") ?? getGlobalDatabaseURL(),
|
47
|
-
branch: Deno.env.get("XATA_BRANCH"),
|
106
|
+
branch: Deno.env.get("XATA_BRANCH") ?? getGlobalBranch(),
|
48
107
|
envBranch: Deno.env.get("VERCEL_GIT_COMMIT_REF") ?? Deno.env.get("CF_PAGES_BRANCH") ?? Deno.env.get("BRANCH"),
|
49
108
|
fallbackBranch: Deno.env.get("XATA_FALLBACK_BRANCH") ?? getGlobalFallbackBranch()
|
50
109
|
};
|
@@ -59,6 +118,25 @@ function getEnvironment() {
|
|
59
118
|
fallbackBranch: getGlobalFallbackBranch()
|
60
119
|
};
|
61
120
|
}
|
121
|
+
function getEnableBrowserVariable() {
|
122
|
+
try {
|
123
|
+
if (isObject(process) && isObject(process.env) && process.env.XATA_ENABLE_BROWSER !== void 0) {
|
124
|
+
return process.env.XATA_ENABLE_BROWSER === "true";
|
125
|
+
}
|
126
|
+
} catch (err) {
|
127
|
+
}
|
128
|
+
try {
|
129
|
+
if (isObject(Deno) && isObject(Deno.env) && Deno.env.get("XATA_ENABLE_BROWSER") !== void 0) {
|
130
|
+
return Deno.env.get("XATA_ENABLE_BROWSER") === "true";
|
131
|
+
}
|
132
|
+
} catch (err) {
|
133
|
+
}
|
134
|
+
try {
|
135
|
+
return XATA_ENABLE_BROWSER === true || XATA_ENABLE_BROWSER === "true";
|
136
|
+
} catch (err) {
|
137
|
+
return void 0;
|
138
|
+
}
|
139
|
+
}
|
62
140
|
function getGlobalApiKey() {
|
63
141
|
try {
|
64
142
|
return XATA_API_KEY;
|
@@ -88,20 +166,21 @@ function getGlobalFallbackBranch() {
|
|
88
166
|
}
|
89
167
|
}
|
90
168
|
async function getGitBranch() {
|
169
|
+
const cmd = ["git", "branch", "--show-current"];
|
170
|
+
const fullCmd = cmd.join(" ");
|
171
|
+
const nodeModule = ["child", "process"].join("_");
|
172
|
+
const execOptions = { encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"] };
|
91
173
|
try {
|
92
174
|
if (typeof require === "function") {
|
93
|
-
|
94
|
-
return req("child_process").execSync("git branch --show-current", { encoding: "utf-8" }).trim();
|
175
|
+
return require(nodeModule).execSync(fullCmd, execOptions).trim();
|
95
176
|
}
|
177
|
+
const { execSync } = await import(nodeModule);
|
178
|
+
return execSync(fullCmd, execOptions).toString().trim();
|
96
179
|
} catch (err) {
|
97
180
|
}
|
98
181
|
try {
|
99
182
|
if (isObject(Deno)) {
|
100
|
-
const process2 = Deno.run({
|
101
|
-
cmd: ["git", "branch", "--show-current"],
|
102
|
-
stdout: "piped",
|
103
|
-
stderr: "piped"
|
104
|
-
});
|
183
|
+
const process2 = Deno.run({ cmd, stdout: "piped", stderr: "null" });
|
105
184
|
return new TextDecoder().decode(await process2.output()).trim();
|
106
185
|
}
|
107
186
|
} catch (err) {
|
@@ -117,16 +196,107 @@ function getAPIKey() {
|
|
117
196
|
}
|
118
197
|
}
|
119
198
|
|
199
|
+
var __accessCheck$8 = (obj, member, msg) => {
|
200
|
+
if (!member.has(obj))
|
201
|
+
throw TypeError("Cannot " + msg);
|
202
|
+
};
|
203
|
+
var __privateGet$8 = (obj, member, getter) => {
|
204
|
+
__accessCheck$8(obj, member, "read from private field");
|
205
|
+
return getter ? getter.call(obj) : member.get(obj);
|
206
|
+
};
|
207
|
+
var __privateAdd$8 = (obj, member, value) => {
|
208
|
+
if (member.has(obj))
|
209
|
+
throw TypeError("Cannot add the same private member more than once");
|
210
|
+
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
211
|
+
};
|
212
|
+
var __privateSet$8 = (obj, member, value, setter) => {
|
213
|
+
__accessCheck$8(obj, member, "write to private field");
|
214
|
+
setter ? setter.call(obj, value) : member.set(obj, value);
|
215
|
+
return value;
|
216
|
+
};
|
217
|
+
var __privateMethod$4 = (obj, member, method) => {
|
218
|
+
__accessCheck$8(obj, member, "access private method");
|
219
|
+
return method;
|
220
|
+
};
|
221
|
+
var _fetch, _queue, _concurrency, _enqueue, enqueue_fn;
|
120
222
|
function getFetchImplementation(userFetch) {
|
121
223
|
const globalFetch = typeof fetch !== "undefined" ? fetch : void 0;
|
122
224
|
const fetchImpl = userFetch ?? globalFetch;
|
123
225
|
if (!fetchImpl) {
|
124
|
-
throw new Error(
|
226
|
+
throw new Error(
|
227
|
+
`Couldn't find \`fetch\`. Install a fetch implementation such as \`node-fetch\` and pass it explicitly.`
|
228
|
+
);
|
125
229
|
}
|
126
230
|
return fetchImpl;
|
127
231
|
}
|
232
|
+
class ApiRequestPool {
|
233
|
+
constructor(concurrency = 10) {
|
234
|
+
__privateAdd$8(this, _enqueue);
|
235
|
+
__privateAdd$8(this, _fetch, void 0);
|
236
|
+
__privateAdd$8(this, _queue, void 0);
|
237
|
+
__privateAdd$8(this, _concurrency, void 0);
|
238
|
+
__privateSet$8(this, _queue, []);
|
239
|
+
__privateSet$8(this, _concurrency, concurrency);
|
240
|
+
this.running = 0;
|
241
|
+
this.started = 0;
|
242
|
+
}
|
243
|
+
setFetch(fetch2) {
|
244
|
+
__privateSet$8(this, _fetch, fetch2);
|
245
|
+
}
|
246
|
+
getFetch() {
|
247
|
+
if (!__privateGet$8(this, _fetch)) {
|
248
|
+
throw new Error("Fetch not set");
|
249
|
+
}
|
250
|
+
return __privateGet$8(this, _fetch);
|
251
|
+
}
|
252
|
+
request(url, options) {
|
253
|
+
const start = new Date();
|
254
|
+
const fetch2 = this.getFetch();
|
255
|
+
const runRequest = async (stalled = false) => {
|
256
|
+
const response = await fetch2(url, options);
|
257
|
+
if (response.status === 429) {
|
258
|
+
const rateLimitReset = parseNumber(response.headers?.get("x-ratelimit-reset")) ?? 1;
|
259
|
+
await timeout(rateLimitReset * 1e3);
|
260
|
+
return await runRequest(true);
|
261
|
+
}
|
262
|
+
if (stalled) {
|
263
|
+
const stalledTime = new Date().getTime() - start.getTime();
|
264
|
+
console.warn(`A request to Xata hit your workspace limits, was retried and stalled for ${stalledTime}ms`);
|
265
|
+
}
|
266
|
+
return response;
|
267
|
+
};
|
268
|
+
return __privateMethod$4(this, _enqueue, enqueue_fn).call(this, async () => {
|
269
|
+
return await runRequest();
|
270
|
+
});
|
271
|
+
}
|
272
|
+
}
|
273
|
+
_fetch = new WeakMap();
|
274
|
+
_queue = new WeakMap();
|
275
|
+
_concurrency = new WeakMap();
|
276
|
+
_enqueue = new WeakSet();
|
277
|
+
enqueue_fn = function(task) {
|
278
|
+
const promise = new Promise((resolve) => __privateGet$8(this, _queue).push(resolve)).finally(() => {
|
279
|
+
this.started--;
|
280
|
+
this.running++;
|
281
|
+
}).then(() => task()).finally(() => {
|
282
|
+
this.running--;
|
283
|
+
const next = __privateGet$8(this, _queue).shift();
|
284
|
+
if (next !== void 0) {
|
285
|
+
this.started++;
|
286
|
+
next();
|
287
|
+
}
|
288
|
+
});
|
289
|
+
if (this.running + this.started < __privateGet$8(this, _concurrency)) {
|
290
|
+
const next = __privateGet$8(this, _queue).shift();
|
291
|
+
if (next !== void 0) {
|
292
|
+
this.started++;
|
293
|
+
next();
|
294
|
+
}
|
295
|
+
}
|
296
|
+
return promise;
|
297
|
+
};
|
128
298
|
|
129
|
-
const VERSION = "0.0.0-alpha.
|
299
|
+
const VERSION = "0.0.0-alpha.vf4e6746";
|
130
300
|
|
131
301
|
class ErrorWithCause extends Error {
|
132
302
|
constructor(message, options) {
|
@@ -169,6 +339,7 @@ function getMessage(data) {
|
|
169
339
|
}
|
170
340
|
}
|
171
341
|
|
342
|
+
const pool = new ApiRequestPool();
|
172
343
|
const resolveUrl = (url, queryParams = {}, pathParams = {}) => {
|
173
344
|
const cleanQueryParams = Object.entries(queryParams).reduce((acc, [key, value]) => {
|
174
345
|
if (value === void 0 || value === null)
|
@@ -177,18 +348,24 @@ const resolveUrl = (url, queryParams = {}, pathParams = {}) => {
|
|
177
348
|
}, {});
|
178
349
|
const query = new URLSearchParams(cleanQueryParams).toString();
|
179
350
|
const queryString = query.length > 0 ? `?${query}` : "";
|
180
|
-
|
351
|
+
const cleanPathParams = Object.entries(pathParams).reduce((acc, [key, value]) => {
|
352
|
+
return { ...acc, [key]: encodeURIComponent(String(value ?? "")).replace("%3A", ":") };
|
353
|
+
}, {});
|
354
|
+
return url.replace(/\{\w*\}/g, (key) => cleanPathParams[key.slice(1, -1)]) + queryString;
|
181
355
|
};
|
182
356
|
function buildBaseUrl({
|
357
|
+
endpoint,
|
183
358
|
path,
|
184
359
|
workspacesApiUrl,
|
185
360
|
apiUrl,
|
186
|
-
pathParams
|
361
|
+
pathParams = {}
|
187
362
|
}) {
|
188
|
-
if (
|
189
|
-
|
190
|
-
|
191
|
-
|
363
|
+
if (endpoint === "dataPlane") {
|
364
|
+
const url = isString(workspacesApiUrl) ? `${workspacesApiUrl}${path}` : workspacesApiUrl(path, pathParams);
|
365
|
+
const urlWithWorkspace = isString(pathParams.workspace) ? url.replace("{workspaceId}", String(pathParams.workspace)) : url;
|
366
|
+
return isString(pathParams.region) ? urlWithWorkspace.replace("{region}", String(pathParams.region)) : urlWithWorkspace;
|
367
|
+
}
|
368
|
+
return `${apiUrl}${path}`;
|
192
369
|
}
|
193
370
|
function hostHeader(url) {
|
194
371
|
const pattern = /.*:\/\/(?<host>[^/]+).*/;
|
@@ -204,277 +381,235 @@ async function fetch$1({
|
|
204
381
|
queryParams,
|
205
382
|
fetchImpl,
|
206
383
|
apiKey,
|
384
|
+
endpoint,
|
207
385
|
apiUrl,
|
208
|
-
workspacesApiUrl
|
386
|
+
workspacesApiUrl,
|
387
|
+
trace,
|
388
|
+
signal,
|
389
|
+
clientID,
|
390
|
+
sessionID,
|
391
|
+
fetchOptions = {}
|
209
392
|
}) {
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
393
|
+
pool.setFetch(fetchImpl);
|
394
|
+
return await trace(
|
395
|
+
`${method.toUpperCase()} ${path}`,
|
396
|
+
async ({ setAttributes }) => {
|
397
|
+
const baseUrl = buildBaseUrl({ endpoint, path, workspacesApiUrl, pathParams, apiUrl });
|
398
|
+
const fullUrl = resolveUrl(baseUrl, queryParams, pathParams);
|
399
|
+
const url = fullUrl.includes("localhost") ? fullUrl.replace(/^[^.]+\./, "http://") : fullUrl;
|
400
|
+
setAttributes({
|
401
|
+
[TraceAttributes.HTTP_URL]: url,
|
402
|
+
[TraceAttributes.HTTP_TARGET]: resolveUrl(path, queryParams, pathParams)
|
403
|
+
});
|
404
|
+
const response = await pool.request(url, {
|
405
|
+
...fetchOptions,
|
406
|
+
method: method.toUpperCase(),
|
407
|
+
body: body ? JSON.stringify(body) : void 0,
|
408
|
+
headers: {
|
409
|
+
"Content-Type": "application/json",
|
410
|
+
"User-Agent": `Xata client-ts/${VERSION}`,
|
411
|
+
"X-Xata-Client-ID": clientID ?? "",
|
412
|
+
"X-Xata-Session-ID": sessionID ?? "",
|
413
|
+
...headers,
|
414
|
+
...hostHeader(fullUrl),
|
415
|
+
Authorization: `Bearer ${apiKey}`
|
416
|
+
},
|
417
|
+
signal
|
418
|
+
});
|
419
|
+
const { host, protocol } = parseUrl(response.url);
|
420
|
+
const requestId = response.headers?.get("x-request-id") ?? void 0;
|
421
|
+
setAttributes({
|
422
|
+
[TraceAttributes.KIND]: "http",
|
423
|
+
[TraceAttributes.HTTP_REQUEST_ID]: requestId,
|
424
|
+
[TraceAttributes.HTTP_STATUS_CODE]: response.status,
|
425
|
+
[TraceAttributes.HTTP_HOST]: host,
|
426
|
+
[TraceAttributes.HTTP_SCHEME]: protocol?.replace(":", "")
|
427
|
+
});
|
428
|
+
if (response.status === 204) {
|
429
|
+
return {};
|
430
|
+
}
|
431
|
+
if (response.status === 429) {
|
432
|
+
throw new FetcherError(response.status, "Rate limit exceeded", requestId);
|
433
|
+
}
|
434
|
+
try {
|
435
|
+
const jsonResponse = await response.json();
|
436
|
+
if (response.ok) {
|
437
|
+
return jsonResponse;
|
438
|
+
}
|
439
|
+
throw new FetcherError(response.status, jsonResponse, requestId);
|
440
|
+
} catch (error) {
|
441
|
+
throw new FetcherError(response.status, error, requestId);
|
442
|
+
}
|
443
|
+
},
|
444
|
+
{ [TraceAttributes.HTTP_METHOD]: method.toUpperCase(), [TraceAttributes.HTTP_ROUTE]: path }
|
445
|
+
);
|
446
|
+
}
|
447
|
+
function parseUrl(url) {
|
228
448
|
try {
|
229
|
-
const
|
230
|
-
|
231
|
-
return jsonResponse;
|
232
|
-
}
|
233
|
-
throw new FetcherError(response.status, jsonResponse, requestId);
|
449
|
+
const { host, protocol } = new URL(url);
|
450
|
+
return { host, protocol };
|
234
451
|
} catch (error) {
|
235
|
-
|
452
|
+
return {};
|
236
453
|
}
|
237
454
|
}
|
238
455
|
|
239
|
-
const
|
240
|
-
|
241
|
-
const
|
242
|
-
const
|
243
|
-
url: "/user/keys",
|
244
|
-
method: "get",
|
245
|
-
...variables
|
246
|
-
});
|
247
|
-
const createUserAPIKey = (variables) => fetch$1({
|
248
|
-
url: "/user/keys/{keyName}",
|
249
|
-
method: "post",
|
250
|
-
...variables
|
251
|
-
});
|
252
|
-
const deleteUserAPIKey = (variables) => fetch$1({
|
253
|
-
url: "/user/keys/{keyName}",
|
254
|
-
method: "delete",
|
255
|
-
...variables
|
256
|
-
});
|
257
|
-
const createWorkspace = (variables) => fetch$1({
|
258
|
-
url: "/workspaces",
|
259
|
-
method: "post",
|
260
|
-
...variables
|
261
|
-
});
|
262
|
-
const getWorkspacesList = (variables) => fetch$1({
|
263
|
-
url: "/workspaces",
|
264
|
-
method: "get",
|
265
|
-
...variables
|
266
|
-
});
|
267
|
-
const getWorkspace = (variables) => fetch$1({
|
268
|
-
url: "/workspaces/{workspaceId}",
|
269
|
-
method: "get",
|
270
|
-
...variables
|
271
|
-
});
|
272
|
-
const updateWorkspace = (variables) => fetch$1({
|
273
|
-
url: "/workspaces/{workspaceId}",
|
274
|
-
method: "put",
|
275
|
-
...variables
|
276
|
-
});
|
277
|
-
const deleteWorkspace = (variables) => fetch$1({
|
278
|
-
url: "/workspaces/{workspaceId}",
|
279
|
-
method: "delete",
|
280
|
-
...variables
|
281
|
-
});
|
282
|
-
const getWorkspaceMembersList = (variables) => fetch$1({
|
283
|
-
url: "/workspaces/{workspaceId}/members",
|
284
|
-
method: "get",
|
285
|
-
...variables
|
286
|
-
});
|
287
|
-
const updateWorkspaceMemberRole = (variables) => fetch$1({ url: "/workspaces/{workspaceId}/members/{userId}", method: "put", ...variables });
|
288
|
-
const removeWorkspaceMember = (variables) => fetch$1({
|
289
|
-
url: "/workspaces/{workspaceId}/members/{userId}",
|
290
|
-
method: "delete",
|
291
|
-
...variables
|
292
|
-
});
|
293
|
-
const inviteWorkspaceMember = (variables) => fetch$1({ url: "/workspaces/{workspaceId}/invites", method: "post", ...variables });
|
294
|
-
const cancelWorkspaceMemberInvite = (variables) => fetch$1({
|
295
|
-
url: "/workspaces/{workspaceId}/invites/{inviteId}",
|
296
|
-
method: "delete",
|
297
|
-
...variables
|
298
|
-
});
|
299
|
-
const resendWorkspaceMemberInvite = (variables) => fetch$1({
|
300
|
-
url: "/workspaces/{workspaceId}/invites/{inviteId}/resend",
|
301
|
-
method: "post",
|
302
|
-
...variables
|
303
|
-
});
|
304
|
-
const acceptWorkspaceMemberInvite = (variables) => fetch$1({
|
305
|
-
url: "/workspaces/{workspaceId}/invites/{inviteKey}/accept",
|
306
|
-
method: "post",
|
307
|
-
...variables
|
308
|
-
});
|
309
|
-
const getDatabaseList = (variables) => fetch$1({
|
310
|
-
url: "/dbs",
|
311
|
-
method: "get",
|
312
|
-
...variables
|
313
|
-
});
|
314
|
-
const getBranchList = (variables) => fetch$1({
|
315
|
-
url: "/dbs/{dbName}",
|
316
|
-
method: "get",
|
317
|
-
...variables
|
318
|
-
});
|
319
|
-
const createDatabase = (variables) => fetch$1({
|
320
|
-
url: "/dbs/{dbName}",
|
321
|
-
method: "put",
|
322
|
-
...variables
|
323
|
-
});
|
324
|
-
const deleteDatabase = (variables) => fetch$1({
|
456
|
+
const dataPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "dataPlane" });
|
457
|
+
|
458
|
+
const dEPRECATEDgetDatabaseList = (variables, signal) => dataPlaneFetch({ url: "/dbs", method: "get", ...variables, signal });
|
459
|
+
const getBranchList = (variables, signal) => dataPlaneFetch({
|
325
460
|
url: "/dbs/{dbName}",
|
326
|
-
method: "delete",
|
327
|
-
...variables
|
328
|
-
});
|
329
|
-
const getGitBranchesMapping = (variables) => fetch$1({ url: "/dbs/{dbName}/gitBranches", method: "get", ...variables });
|
330
|
-
const addGitBranchesEntry = (variables) => fetch$1({ url: "/dbs/{dbName}/gitBranches", method: "post", ...variables });
|
331
|
-
const removeGitBranchesEntry = (variables) => fetch$1({ url: "/dbs/{dbName}/gitBranches", method: "delete", ...variables });
|
332
|
-
const resolveBranch = (variables) => fetch$1({
|
333
|
-
url: "/dbs/{dbName}/resolveBranch",
|
334
461
|
method: "get",
|
335
|
-
...variables
|
462
|
+
...variables,
|
463
|
+
signal
|
336
464
|
});
|
337
|
-
const
|
465
|
+
const dEPRECATEDcreateDatabase = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}", method: "put", ...variables, signal });
|
466
|
+
const dEPRECATEDdeleteDatabase = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}", method: "delete", ...variables, signal });
|
467
|
+
const dEPRECATEDgetDatabaseMetadata = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/metadata", method: "get", ...variables, signal });
|
468
|
+
const dEPRECATEDupdateDatabaseMetadata = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/metadata", method: "patch", ...variables, signal });
|
469
|
+
const getBranchDetails = (variables, signal) => dataPlaneFetch({
|
338
470
|
url: "/db/{dbBranchName}",
|
339
471
|
method: "get",
|
340
|
-
...variables
|
341
|
-
|
342
|
-
const createBranch = (variables) => fetch$1({
|
343
|
-
url: "/db/{dbBranchName}",
|
344
|
-
method: "put",
|
345
|
-
...variables
|
472
|
+
...variables,
|
473
|
+
signal
|
346
474
|
});
|
347
|
-
const
|
475
|
+
const createBranch = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}", method: "put", ...variables, signal });
|
476
|
+
const deleteBranch = (variables, signal) => dataPlaneFetch({
|
348
477
|
url: "/db/{dbBranchName}",
|
349
478
|
method: "delete",
|
350
|
-
...variables
|
479
|
+
...variables,
|
480
|
+
signal
|
351
481
|
});
|
352
|
-
const updateBranchMetadata = (variables) =>
|
482
|
+
const updateBranchMetadata = (variables, signal) => dataPlaneFetch({
|
353
483
|
url: "/db/{dbBranchName}/metadata",
|
354
484
|
method: "put",
|
355
|
-
...variables
|
485
|
+
...variables,
|
486
|
+
signal
|
356
487
|
});
|
357
|
-
const getBranchMetadata = (variables) =>
|
488
|
+
const getBranchMetadata = (variables, signal) => dataPlaneFetch({
|
358
489
|
url: "/db/{dbBranchName}/metadata",
|
359
490
|
method: "get",
|
360
|
-
...variables
|
491
|
+
...variables,
|
492
|
+
signal
|
361
493
|
});
|
362
|
-
const
|
363
|
-
const executeBranchMigrationPlan = (variables) => fetch$1({ url: "/db/{dbBranchName}/migrations/execute", method: "post", ...variables });
|
364
|
-
const getBranchMigrationPlan = (variables) => fetch$1({ url: "/db/{dbBranchName}/migrations/plan", method: "post", ...variables });
|
365
|
-
const getBranchStats = (variables) => fetch$1({
|
494
|
+
const getBranchStats = (variables, signal) => dataPlaneFetch({
|
366
495
|
url: "/db/{dbBranchName}/stats",
|
367
496
|
method: "get",
|
368
|
-
...variables
|
497
|
+
...variables,
|
498
|
+
signal
|
499
|
+
});
|
500
|
+
const getGitBranchesMapping = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/gitBranches", method: "get", ...variables, signal });
|
501
|
+
const addGitBranchesEntry = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/gitBranches", method: "post", ...variables, signal });
|
502
|
+
const removeGitBranchesEntry = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/gitBranches", method: "delete", ...variables, signal });
|
503
|
+
const resolveBranch = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/resolveBranch", method: "get", ...variables, signal });
|
504
|
+
const getBranchMigrationHistory = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/migrations", method: "get", ...variables, signal });
|
505
|
+
const getBranchMigrationPlan = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/migrations/plan", method: "post", ...variables, signal });
|
506
|
+
const executeBranchMigrationPlan = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/migrations/execute", method: "post", ...variables, signal });
|
507
|
+
const branchTransaction = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/transaction", method: "post", ...variables, signal });
|
508
|
+
const queryMigrationRequests = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/query", method: "post", ...variables, signal });
|
509
|
+
const createMigrationRequest = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations", method: "post", ...variables, signal });
|
510
|
+
const getMigrationRequest = (variables, signal) => dataPlaneFetch({
|
511
|
+
url: "/dbs/{dbName}/migrations/{mrNumber}",
|
512
|
+
method: "get",
|
513
|
+
...variables,
|
514
|
+
signal
|
369
515
|
});
|
370
|
-
const
|
516
|
+
const updateMigrationRequest = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/{mrNumber}", method: "patch", ...variables, signal });
|
517
|
+
const listMigrationRequestsCommits = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/{mrNumber}/commits", method: "post", ...variables, signal });
|
518
|
+
const compareMigrationRequest = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/{mrNumber}/compare", method: "post", ...variables, signal });
|
519
|
+
const getMigrationRequestIsMerged = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/{mrNumber}/merge", method: "get", ...variables, signal });
|
520
|
+
const mergeMigrationRequest = (variables, signal) => dataPlaneFetch({
|
521
|
+
url: "/dbs/{dbName}/migrations/{mrNumber}/merge",
|
522
|
+
method: "post",
|
523
|
+
...variables,
|
524
|
+
signal
|
525
|
+
});
|
526
|
+
const getBranchSchemaHistory = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/history", method: "post", ...variables, signal });
|
527
|
+
const compareBranchWithUserSchema = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/compare", method: "post", ...variables, signal });
|
528
|
+
const compareBranchSchemas = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/compare/{branchName}", method: "post", ...variables, signal });
|
529
|
+
const updateBranchSchema = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/update", method: "post", ...variables, signal });
|
530
|
+
const previewBranchSchemaEdit = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/preview", method: "post", ...variables, signal });
|
531
|
+
const applyBranchSchemaEdit = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/apply", method: "post", ...variables, signal });
|
532
|
+
const createTable = (variables, signal) => dataPlaneFetch({
|
371
533
|
url: "/db/{dbBranchName}/tables/{tableName}",
|
372
534
|
method: "put",
|
373
|
-
...variables
|
535
|
+
...variables,
|
536
|
+
signal
|
374
537
|
});
|
375
|
-
const deleteTable = (variables) =>
|
538
|
+
const deleteTable = (variables, signal) => dataPlaneFetch({
|
376
539
|
url: "/db/{dbBranchName}/tables/{tableName}",
|
377
540
|
method: "delete",
|
378
|
-
...variables
|
379
|
-
|
380
|
-
const updateTable = (variables) => fetch$1({
|
381
|
-
url: "/db/{dbBranchName}/tables/{tableName}",
|
382
|
-
method: "patch",
|
383
|
-
...variables
|
541
|
+
...variables,
|
542
|
+
signal
|
384
543
|
});
|
385
|
-
const
|
544
|
+
const updateTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}", method: "patch", ...variables, signal });
|
545
|
+
const getTableSchema = (variables, signal) => dataPlaneFetch({
|
386
546
|
url: "/db/{dbBranchName}/tables/{tableName}/schema",
|
387
547
|
method: "get",
|
388
|
-
...variables
|
389
|
-
|
390
|
-
const setTableSchema = (variables) => fetch$1({
|
391
|
-
url: "/db/{dbBranchName}/tables/{tableName}/schema",
|
392
|
-
method: "put",
|
393
|
-
...variables
|
548
|
+
...variables,
|
549
|
+
signal
|
394
550
|
});
|
395
|
-
const
|
551
|
+
const setTableSchema = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/schema", method: "put", ...variables, signal });
|
552
|
+
const getTableColumns = (variables, signal) => dataPlaneFetch({
|
396
553
|
url: "/db/{dbBranchName}/tables/{tableName}/columns",
|
397
554
|
method: "get",
|
398
|
-
...variables
|
399
|
-
|
400
|
-
const addTableColumn = (variables) => fetch$1({
|
401
|
-
url: "/db/{dbBranchName}/tables/{tableName}/columns",
|
402
|
-
method: "post",
|
403
|
-
...variables
|
555
|
+
...variables,
|
556
|
+
signal
|
404
557
|
});
|
405
|
-
const
|
558
|
+
const addTableColumn = (variables, signal) => dataPlaneFetch(
|
559
|
+
{ url: "/db/{dbBranchName}/tables/{tableName}/columns", method: "post", ...variables, signal }
|
560
|
+
);
|
561
|
+
const getColumn = (variables, signal) => dataPlaneFetch({
|
406
562
|
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
407
563
|
method: "get",
|
408
|
-
...variables
|
564
|
+
...variables,
|
565
|
+
signal
|
409
566
|
});
|
410
|
-
const
|
567
|
+
const updateColumn = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}", method: "patch", ...variables, signal });
|
568
|
+
const deleteColumn = (variables, signal) => dataPlaneFetch({
|
411
569
|
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
412
570
|
method: "delete",
|
413
|
-
...variables
|
571
|
+
...variables,
|
572
|
+
signal
|
414
573
|
});
|
415
|
-
const
|
416
|
-
|
417
|
-
method: "patch",
|
418
|
-
...variables
|
419
|
-
});
|
420
|
-
const insertRecord = (variables) => fetch$1({
|
421
|
-
url: "/db/{dbBranchName}/tables/{tableName}/data",
|
422
|
-
method: "post",
|
423
|
-
...variables
|
424
|
-
});
|
425
|
-
const insertRecordWithID = (variables) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "put", ...variables });
|
426
|
-
const updateRecordWithID = (variables) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "patch", ...variables });
|
427
|
-
const upsertRecordWithID = (variables) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "post", ...variables });
|
428
|
-
const deleteRecord = (variables) => fetch$1({
|
429
|
-
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
430
|
-
method: "delete",
|
431
|
-
...variables
|
432
|
-
});
|
433
|
-
const getRecord = (variables) => fetch$1({
|
574
|
+
const insertRecord = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data", method: "post", ...variables, signal });
|
575
|
+
const getRecord = (variables, signal) => dataPlaneFetch({
|
434
576
|
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
435
577
|
method: "get",
|
436
|
-
...variables
|
578
|
+
...variables,
|
579
|
+
signal
|
437
580
|
});
|
438
|
-
const
|
439
|
-
const
|
581
|
+
const insertRecordWithID = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "put", ...variables, signal });
|
582
|
+
const updateRecordWithID = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "patch", ...variables, signal });
|
583
|
+
const upsertRecordWithID = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "post", ...variables, signal });
|
584
|
+
const deleteRecord = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "delete", ...variables, signal });
|
585
|
+
const bulkInsertTableRecords = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/bulk", method: "post", ...variables, signal });
|
586
|
+
const queryTable = (variables, signal) => dataPlaneFetch({
|
440
587
|
url: "/db/{dbBranchName}/tables/{tableName}/query",
|
441
588
|
method: "post",
|
442
|
-
...variables
|
589
|
+
...variables,
|
590
|
+
signal
|
443
591
|
});
|
444
|
-
const
|
445
|
-
url: "/db/{dbBranchName}/
|
592
|
+
const searchBranch = (variables, signal) => dataPlaneFetch({
|
593
|
+
url: "/db/{dbBranchName}/search",
|
446
594
|
method: "post",
|
447
|
-
...variables
|
595
|
+
...variables,
|
596
|
+
signal
|
448
597
|
});
|
449
|
-
const
|
450
|
-
url: "/db/{dbBranchName}/search",
|
598
|
+
const searchTable = (variables, signal) => dataPlaneFetch({
|
599
|
+
url: "/db/{dbBranchName}/tables/{tableName}/search",
|
451
600
|
method: "post",
|
452
|
-
...variables
|
601
|
+
...variables,
|
602
|
+
signal
|
453
603
|
});
|
454
|
-
const
|
455
|
-
|
456
|
-
|
457
|
-
createWorkspace,
|
458
|
-
getWorkspacesList,
|
459
|
-
getWorkspace,
|
460
|
-
updateWorkspace,
|
461
|
-
deleteWorkspace,
|
462
|
-
getWorkspaceMembersList,
|
463
|
-
updateWorkspaceMemberRole,
|
464
|
-
removeWorkspaceMember,
|
465
|
-
inviteWorkspaceMember,
|
466
|
-
cancelWorkspaceMemberInvite,
|
467
|
-
resendWorkspaceMemberInvite,
|
468
|
-
acceptWorkspaceMemberInvite
|
469
|
-
},
|
604
|
+
const summarizeTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/summarize", method: "post", ...variables, signal });
|
605
|
+
const aggregateTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/aggregate", method: "post", ...variables, signal });
|
606
|
+
const operationsByTag$2 = {
|
470
607
|
database: {
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
removeGitBranchesEntry,
|
477
|
-
resolveBranch
|
608
|
+
dEPRECATEDgetDatabaseList,
|
609
|
+
dEPRECATEDcreateDatabase,
|
610
|
+
dEPRECATEDdeleteDatabase,
|
611
|
+
dEPRECATEDgetDatabaseMetadata,
|
612
|
+
dEPRECATEDupdateDatabaseMetadata
|
478
613
|
},
|
479
614
|
branch: {
|
480
615
|
getBranchList,
|
@@ -483,10 +618,42 @@ const operationsByTag = {
|
|
483
618
|
deleteBranch,
|
484
619
|
updateBranchMetadata,
|
485
620
|
getBranchMetadata,
|
621
|
+
getBranchStats,
|
622
|
+
getGitBranchesMapping,
|
623
|
+
addGitBranchesEntry,
|
624
|
+
removeGitBranchesEntry,
|
625
|
+
resolveBranch
|
626
|
+
},
|
627
|
+
migrations: {
|
486
628
|
getBranchMigrationHistory,
|
487
|
-
executeBranchMigrationPlan,
|
488
629
|
getBranchMigrationPlan,
|
489
|
-
|
630
|
+
executeBranchMigrationPlan,
|
631
|
+
getBranchSchemaHistory,
|
632
|
+
compareBranchWithUserSchema,
|
633
|
+
compareBranchSchemas,
|
634
|
+
updateBranchSchema,
|
635
|
+
previewBranchSchemaEdit,
|
636
|
+
applyBranchSchemaEdit
|
637
|
+
},
|
638
|
+
records: {
|
639
|
+
branchTransaction,
|
640
|
+
insertRecord,
|
641
|
+
getRecord,
|
642
|
+
insertRecordWithID,
|
643
|
+
updateRecordWithID,
|
644
|
+
upsertRecordWithID,
|
645
|
+
deleteRecord,
|
646
|
+
bulkInsertTableRecords
|
647
|
+
},
|
648
|
+
migrationRequests: {
|
649
|
+
queryMigrationRequests,
|
650
|
+
createMigrationRequest,
|
651
|
+
getMigrationRequest,
|
652
|
+
updateMigrationRequest,
|
653
|
+
listMigrationRequestsCommits,
|
654
|
+
compareMigrationRequest,
|
655
|
+
getMigrationRequestIsMerged,
|
656
|
+
mergeMigrationRequest
|
490
657
|
},
|
491
658
|
table: {
|
492
659
|
createTable,
|
@@ -497,27 +664,150 @@ const operationsByTag = {
|
|
497
664
|
getTableColumns,
|
498
665
|
addTableColumn,
|
499
666
|
getColumn,
|
500
|
-
|
501
|
-
|
667
|
+
updateColumn,
|
668
|
+
deleteColumn
|
502
669
|
},
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
670
|
+
searchAndFilter: { queryTable, searchBranch, searchTable, summarizeTable, aggregateTable }
|
671
|
+
};
|
672
|
+
|
673
|
+
const controlPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "controlPlane" });
|
674
|
+
|
675
|
+
const getUser = (variables, signal) => controlPlaneFetch({
|
676
|
+
url: "/user",
|
677
|
+
method: "get",
|
678
|
+
...variables,
|
679
|
+
signal
|
680
|
+
});
|
681
|
+
const updateUser = (variables, signal) => controlPlaneFetch({
|
682
|
+
url: "/user",
|
683
|
+
method: "put",
|
684
|
+
...variables,
|
685
|
+
signal
|
686
|
+
});
|
687
|
+
const deleteUser = (variables, signal) => controlPlaneFetch({
|
688
|
+
url: "/user",
|
689
|
+
method: "delete",
|
690
|
+
...variables,
|
691
|
+
signal
|
692
|
+
});
|
693
|
+
const getUserAPIKeys = (variables, signal) => controlPlaneFetch({
|
694
|
+
url: "/user/keys",
|
695
|
+
method: "get",
|
696
|
+
...variables,
|
697
|
+
signal
|
698
|
+
});
|
699
|
+
const createUserAPIKey = (variables, signal) => controlPlaneFetch({
|
700
|
+
url: "/user/keys/{keyName}",
|
701
|
+
method: "post",
|
702
|
+
...variables,
|
703
|
+
signal
|
704
|
+
});
|
705
|
+
const deleteUserAPIKey = (variables, signal) => controlPlaneFetch({
|
706
|
+
url: "/user/keys/{keyName}",
|
707
|
+
method: "delete",
|
708
|
+
...variables,
|
709
|
+
signal
|
710
|
+
});
|
711
|
+
const getWorkspacesList = (variables, signal) => controlPlaneFetch({
|
712
|
+
url: "/workspaces",
|
713
|
+
method: "get",
|
714
|
+
...variables,
|
715
|
+
signal
|
716
|
+
});
|
717
|
+
const createWorkspace = (variables, signal) => controlPlaneFetch({
|
718
|
+
url: "/workspaces",
|
719
|
+
method: "post",
|
720
|
+
...variables,
|
721
|
+
signal
|
722
|
+
});
|
723
|
+
const getWorkspace = (variables, signal) => controlPlaneFetch({
|
724
|
+
url: "/workspaces/{workspaceId}",
|
725
|
+
method: "get",
|
726
|
+
...variables,
|
727
|
+
signal
|
728
|
+
});
|
729
|
+
const updateWorkspace = (variables, signal) => controlPlaneFetch({
|
730
|
+
url: "/workspaces/{workspaceId}",
|
731
|
+
method: "put",
|
732
|
+
...variables,
|
733
|
+
signal
|
734
|
+
});
|
735
|
+
const deleteWorkspace = (variables, signal) => controlPlaneFetch({
|
736
|
+
url: "/workspaces/{workspaceId}",
|
737
|
+
method: "delete",
|
738
|
+
...variables,
|
739
|
+
signal
|
740
|
+
});
|
741
|
+
const getWorkspaceMembersList = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/members", method: "get", ...variables, signal });
|
742
|
+
const updateWorkspaceMemberRole = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/members/{userId}", method: "put", ...variables, signal });
|
743
|
+
const removeWorkspaceMember = (variables, signal) => controlPlaneFetch({
|
744
|
+
url: "/workspaces/{workspaceId}/members/{userId}",
|
745
|
+
method: "delete",
|
746
|
+
...variables,
|
747
|
+
signal
|
748
|
+
});
|
749
|
+
const inviteWorkspaceMember = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites", method: "post", ...variables, signal });
|
750
|
+
const updateWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}", method: "patch", ...variables, signal });
|
751
|
+
const cancelWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}", method: "delete", ...variables, signal });
|
752
|
+
const acceptWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteKey}/accept", method: "post", ...variables, signal });
|
753
|
+
const resendWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}/resend", method: "post", ...variables, signal });
|
754
|
+
const getDatabaseList = (variables, signal) => controlPlaneFetch({
|
755
|
+
url: "/workspaces/{workspaceId}/dbs",
|
756
|
+
method: "get",
|
757
|
+
...variables,
|
758
|
+
signal
|
759
|
+
});
|
760
|
+
const createDatabase = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}", method: "put", ...variables, signal });
|
761
|
+
const deleteDatabase = (variables, signal) => controlPlaneFetch({
|
762
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}",
|
763
|
+
method: "delete",
|
764
|
+
...variables,
|
765
|
+
signal
|
766
|
+
});
|
767
|
+
const getDatabaseMetadata = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}", method: "get", ...variables, signal });
|
768
|
+
const updateDatabaseMetadata = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}", method: "patch", ...variables, signal });
|
769
|
+
const listRegions = (variables, signal) => controlPlaneFetch({
|
770
|
+
url: "/workspaces/{workspaceId}/regions",
|
771
|
+
method: "get",
|
772
|
+
...variables,
|
773
|
+
signal
|
774
|
+
});
|
775
|
+
const operationsByTag$1 = {
|
776
|
+
users: { getUser, updateUser, deleteUser },
|
777
|
+
authentication: { getUserAPIKeys, createUserAPIKey, deleteUserAPIKey },
|
778
|
+
workspaces: {
|
779
|
+
getWorkspacesList,
|
780
|
+
createWorkspace,
|
781
|
+
getWorkspace,
|
782
|
+
updateWorkspace,
|
783
|
+
deleteWorkspace,
|
784
|
+
getWorkspaceMembersList,
|
785
|
+
updateWorkspaceMemberRole,
|
786
|
+
removeWorkspaceMember
|
787
|
+
},
|
788
|
+
invites: {
|
789
|
+
inviteWorkspaceMember,
|
790
|
+
updateWorkspaceMemberInvite,
|
791
|
+
cancelWorkspaceMemberInvite,
|
792
|
+
acceptWorkspaceMemberInvite,
|
793
|
+
resendWorkspaceMemberInvite
|
794
|
+
},
|
795
|
+
databases: {
|
796
|
+
getDatabaseList,
|
797
|
+
createDatabase,
|
798
|
+
deleteDatabase,
|
799
|
+
getDatabaseMetadata,
|
800
|
+
updateDatabaseMetadata,
|
801
|
+
listRegions
|
514
802
|
}
|
515
803
|
};
|
516
804
|
|
805
|
+
const operationsByTag = deepMerge(operationsByTag$2, operationsByTag$1);
|
806
|
+
|
517
807
|
function getHostUrl(provider, type) {
|
518
|
-
if (
|
808
|
+
if (isHostProviderAlias(provider)) {
|
519
809
|
return providers[provider][type];
|
520
|
-
} else if (
|
810
|
+
} else if (isHostProviderBuilder(provider)) {
|
521
811
|
return provider[type];
|
522
812
|
}
|
523
813
|
throw new Error("Invalid API provider");
|
@@ -525,19 +815,38 @@ function getHostUrl(provider, type) {
|
|
525
815
|
const providers = {
|
526
816
|
production: {
|
527
817
|
main: "https://api.xata.io",
|
528
|
-
workspaces: "https://{workspaceId}.xata.sh"
|
818
|
+
workspaces: "https://{workspaceId}.{region}.xata.sh"
|
529
819
|
},
|
530
820
|
staging: {
|
531
821
|
main: "https://staging.xatabase.co",
|
532
|
-
workspaces: "https://{workspaceId}.staging.xatabase.co"
|
822
|
+
workspaces: "https://{workspaceId}.staging.{region}.xatabase.co"
|
533
823
|
}
|
534
824
|
};
|
535
|
-
function
|
825
|
+
function isHostProviderAlias(alias) {
|
536
826
|
return isString(alias) && Object.keys(providers).includes(alias);
|
537
827
|
}
|
538
|
-
function
|
828
|
+
function isHostProviderBuilder(builder) {
|
539
829
|
return isObject(builder) && isString(builder.main) && isString(builder.workspaces);
|
540
830
|
}
|
831
|
+
function parseProviderString(provider = "production") {
|
832
|
+
if (isHostProviderAlias(provider)) {
|
833
|
+
return provider;
|
834
|
+
}
|
835
|
+
const [main, workspaces] = provider.split(",");
|
836
|
+
if (!main || !workspaces)
|
837
|
+
return null;
|
838
|
+
return { main, workspaces };
|
839
|
+
}
|
840
|
+
function parseWorkspacesUrlParts(url) {
|
841
|
+
if (!isString(url))
|
842
|
+
return null;
|
843
|
+
const regex = /(?:https:\/\/)?([^.]+)(?:\.([^.]+))?\.xata\.sh.*/;
|
844
|
+
const regexStaging = /(?:https:\/\/)?([^.]+)\.staging(?:\.([^.]+))?\.xatabase\.co.*/;
|
845
|
+
const match = url.match(regex) || url.match(regexStaging);
|
846
|
+
if (!match)
|
847
|
+
return null;
|
848
|
+
return { workspace: match[1], region: match[2] ?? "eu-west-1" };
|
849
|
+
}
|
541
850
|
|
542
851
|
var __accessCheck$7 = (obj, member, msg) => {
|
543
852
|
if (!member.has(obj))
|
@@ -563,7 +872,8 @@ class XataApiClient {
|
|
563
872
|
__privateAdd$7(this, _extraProps, void 0);
|
564
873
|
__privateAdd$7(this, _namespaces, {});
|
565
874
|
const provider = options.host ?? "production";
|
566
|
-
const apiKey = options
|
875
|
+
const apiKey = options.apiKey ?? getAPIKey();
|
876
|
+
const trace = options.trace ?? defaultTrace;
|
567
877
|
if (!apiKey) {
|
568
878
|
throw new Error("Could not resolve a valid apiKey");
|
569
879
|
}
|
@@ -571,7 +881,8 @@ class XataApiClient {
|
|
571
881
|
apiUrl: getHostUrl(provider, "main"),
|
572
882
|
workspacesApiUrl: getHostUrl(provider, "workspaces"),
|
573
883
|
fetchImpl: getFetchImplementation(options.fetch),
|
574
|
-
apiKey
|
884
|
+
apiKey,
|
885
|
+
trace
|
575
886
|
});
|
576
887
|
}
|
577
888
|
get user() {
|
@@ -579,21 +890,41 @@ class XataApiClient {
|
|
579
890
|
__privateGet$7(this, _namespaces).user = new UserApi(__privateGet$7(this, _extraProps));
|
580
891
|
return __privateGet$7(this, _namespaces).user;
|
581
892
|
}
|
893
|
+
get authentication() {
|
894
|
+
if (!__privateGet$7(this, _namespaces).authentication)
|
895
|
+
__privateGet$7(this, _namespaces).authentication = new AuthenticationApi(__privateGet$7(this, _extraProps));
|
896
|
+
return __privateGet$7(this, _namespaces).authentication;
|
897
|
+
}
|
582
898
|
get workspaces() {
|
583
899
|
if (!__privateGet$7(this, _namespaces).workspaces)
|
584
900
|
__privateGet$7(this, _namespaces).workspaces = new WorkspaceApi(__privateGet$7(this, _extraProps));
|
585
901
|
return __privateGet$7(this, _namespaces).workspaces;
|
586
902
|
}
|
587
|
-
get
|
588
|
-
if (!__privateGet$7(this, _namespaces).
|
589
|
-
__privateGet$7(this, _namespaces).
|
590
|
-
return __privateGet$7(this, _namespaces).
|
903
|
+
get invites() {
|
904
|
+
if (!__privateGet$7(this, _namespaces).invites)
|
905
|
+
__privateGet$7(this, _namespaces).invites = new InvitesApi(__privateGet$7(this, _extraProps));
|
906
|
+
return __privateGet$7(this, _namespaces).invites;
|
907
|
+
}
|
908
|
+
get database() {
|
909
|
+
if (!__privateGet$7(this, _namespaces).database)
|
910
|
+
__privateGet$7(this, _namespaces).database = new DatabaseApi(__privateGet$7(this, _extraProps));
|
911
|
+
return __privateGet$7(this, _namespaces).database;
|
591
912
|
}
|
592
913
|
get branches() {
|
593
914
|
if (!__privateGet$7(this, _namespaces).branches)
|
594
915
|
__privateGet$7(this, _namespaces).branches = new BranchApi(__privateGet$7(this, _extraProps));
|
595
916
|
return __privateGet$7(this, _namespaces).branches;
|
596
917
|
}
|
918
|
+
get migrations() {
|
919
|
+
if (!__privateGet$7(this, _namespaces).migrations)
|
920
|
+
__privateGet$7(this, _namespaces).migrations = new MigrationsApi(__privateGet$7(this, _extraProps));
|
921
|
+
return __privateGet$7(this, _namespaces).migrations;
|
922
|
+
}
|
923
|
+
get migrationRequests() {
|
924
|
+
if (!__privateGet$7(this, _namespaces).migrationRequests)
|
925
|
+
__privateGet$7(this, _namespaces).migrationRequests = new MigrationRequestsApi(__privateGet$7(this, _extraProps));
|
926
|
+
return __privateGet$7(this, _namespaces).migrationRequests;
|
927
|
+
}
|
597
928
|
get tables() {
|
598
929
|
if (!__privateGet$7(this, _namespaces).tables)
|
599
930
|
__privateGet$7(this, _namespaces).tables = new TableApi(__privateGet$7(this, _extraProps));
|
@@ -604,6 +935,11 @@ class XataApiClient {
|
|
604
935
|
__privateGet$7(this, _namespaces).records = new RecordsApi(__privateGet$7(this, _extraProps));
|
605
936
|
return __privateGet$7(this, _namespaces).records;
|
606
937
|
}
|
938
|
+
get searchAndFilter() {
|
939
|
+
if (!__privateGet$7(this, _namespaces).searchAndFilter)
|
940
|
+
__privateGet$7(this, _namespaces).searchAndFilter = new SearchAndFilterApi(__privateGet$7(this, _extraProps));
|
941
|
+
return __privateGet$7(this, _namespaces).searchAndFilter;
|
942
|
+
}
|
607
943
|
}
|
608
944
|
_extraProps = new WeakMap();
|
609
945
|
_namespaces = new WeakMap();
|
@@ -614,24 +950,29 @@ class UserApi {
|
|
614
950
|
getUser() {
|
615
951
|
return operationsByTag.users.getUser({ ...this.extraProps });
|
616
952
|
}
|
617
|
-
updateUser(user) {
|
953
|
+
updateUser({ user }) {
|
618
954
|
return operationsByTag.users.updateUser({ body: user, ...this.extraProps });
|
619
955
|
}
|
620
956
|
deleteUser() {
|
621
957
|
return operationsByTag.users.deleteUser({ ...this.extraProps });
|
622
958
|
}
|
959
|
+
}
|
960
|
+
class AuthenticationApi {
|
961
|
+
constructor(extraProps) {
|
962
|
+
this.extraProps = extraProps;
|
963
|
+
}
|
623
964
|
getUserAPIKeys() {
|
624
|
-
return operationsByTag.
|
965
|
+
return operationsByTag.authentication.getUserAPIKeys({ ...this.extraProps });
|
625
966
|
}
|
626
|
-
createUserAPIKey(
|
627
|
-
return operationsByTag.
|
628
|
-
pathParams: { keyName },
|
967
|
+
createUserAPIKey({ name }) {
|
968
|
+
return operationsByTag.authentication.createUserAPIKey({
|
969
|
+
pathParams: { keyName: name },
|
629
970
|
...this.extraProps
|
630
971
|
});
|
631
972
|
}
|
632
|
-
deleteUserAPIKey(
|
633
|
-
return operationsByTag.
|
634
|
-
pathParams: { keyName },
|
973
|
+
deleteUserAPIKey({ name }) {
|
974
|
+
return operationsByTag.authentication.deleteUserAPIKey({
|
975
|
+
pathParams: { keyName: name },
|
635
976
|
...this.extraProps
|
636
977
|
});
|
637
978
|
}
|
@@ -640,342 +981,897 @@ class WorkspaceApi {
|
|
640
981
|
constructor(extraProps) {
|
641
982
|
this.extraProps = extraProps;
|
642
983
|
}
|
643
|
-
|
984
|
+
getWorkspacesList() {
|
985
|
+
return operationsByTag.workspaces.getWorkspacesList({ ...this.extraProps });
|
986
|
+
}
|
987
|
+
createWorkspace({ data }) {
|
644
988
|
return operationsByTag.workspaces.createWorkspace({
|
645
|
-
body:
|
989
|
+
body: data,
|
646
990
|
...this.extraProps
|
647
991
|
});
|
648
992
|
}
|
649
|
-
|
650
|
-
return operationsByTag.workspaces.getWorkspacesList({ ...this.extraProps });
|
651
|
-
}
|
652
|
-
getWorkspace(workspaceId) {
|
993
|
+
getWorkspace({ workspace }) {
|
653
994
|
return operationsByTag.workspaces.getWorkspace({
|
654
|
-
pathParams: { workspaceId },
|
995
|
+
pathParams: { workspaceId: workspace },
|
655
996
|
...this.extraProps
|
656
997
|
});
|
657
998
|
}
|
658
|
-
updateWorkspace(
|
999
|
+
updateWorkspace({
|
1000
|
+
workspace,
|
1001
|
+
update
|
1002
|
+
}) {
|
659
1003
|
return operationsByTag.workspaces.updateWorkspace({
|
660
|
-
pathParams: { workspaceId },
|
661
|
-
body:
|
1004
|
+
pathParams: { workspaceId: workspace },
|
1005
|
+
body: update,
|
662
1006
|
...this.extraProps
|
663
1007
|
});
|
664
1008
|
}
|
665
|
-
deleteWorkspace(
|
1009
|
+
deleteWorkspace({ workspace }) {
|
666
1010
|
return operationsByTag.workspaces.deleteWorkspace({
|
667
|
-
pathParams: { workspaceId },
|
1011
|
+
pathParams: { workspaceId: workspace },
|
668
1012
|
...this.extraProps
|
669
1013
|
});
|
670
1014
|
}
|
671
|
-
getWorkspaceMembersList(
|
1015
|
+
getWorkspaceMembersList({ workspace }) {
|
672
1016
|
return operationsByTag.workspaces.getWorkspaceMembersList({
|
673
|
-
pathParams: { workspaceId },
|
1017
|
+
pathParams: { workspaceId: workspace },
|
674
1018
|
...this.extraProps
|
675
1019
|
});
|
676
1020
|
}
|
677
|
-
updateWorkspaceMemberRole(
|
1021
|
+
updateWorkspaceMemberRole({
|
1022
|
+
workspace,
|
1023
|
+
user,
|
1024
|
+
role
|
1025
|
+
}) {
|
678
1026
|
return operationsByTag.workspaces.updateWorkspaceMemberRole({
|
679
|
-
pathParams: { workspaceId, userId },
|
1027
|
+
pathParams: { workspaceId: workspace, userId: user },
|
680
1028
|
body: { role },
|
681
1029
|
...this.extraProps
|
682
1030
|
});
|
683
1031
|
}
|
684
|
-
removeWorkspaceMember(
|
1032
|
+
removeWorkspaceMember({
|
1033
|
+
workspace,
|
1034
|
+
user
|
1035
|
+
}) {
|
685
1036
|
return operationsByTag.workspaces.removeWorkspaceMember({
|
686
|
-
pathParams: { workspaceId, userId },
|
1037
|
+
pathParams: { workspaceId: workspace, userId: user },
|
687
1038
|
...this.extraProps
|
688
1039
|
});
|
689
1040
|
}
|
690
|
-
|
691
|
-
|
692
|
-
|
1041
|
+
}
|
1042
|
+
class InvitesApi {
|
1043
|
+
constructor(extraProps) {
|
1044
|
+
this.extraProps = extraProps;
|
1045
|
+
}
|
1046
|
+
inviteWorkspaceMember({
|
1047
|
+
workspace,
|
1048
|
+
email,
|
1049
|
+
role
|
1050
|
+
}) {
|
1051
|
+
return operationsByTag.invites.inviteWorkspaceMember({
|
1052
|
+
pathParams: { workspaceId: workspace },
|
693
1053
|
body: { email, role },
|
694
1054
|
...this.extraProps
|
695
1055
|
});
|
696
1056
|
}
|
697
|
-
|
698
|
-
|
699
|
-
|
1057
|
+
updateWorkspaceMemberInvite({
|
1058
|
+
workspace,
|
1059
|
+
invite,
|
1060
|
+
role
|
1061
|
+
}) {
|
1062
|
+
return operationsByTag.invites.updateWorkspaceMemberInvite({
|
1063
|
+
pathParams: { workspaceId: workspace, inviteId: invite },
|
1064
|
+
body: { role },
|
1065
|
+
...this.extraProps
|
1066
|
+
});
|
1067
|
+
}
|
1068
|
+
cancelWorkspaceMemberInvite({
|
1069
|
+
workspace,
|
1070
|
+
invite
|
1071
|
+
}) {
|
1072
|
+
return operationsByTag.invites.cancelWorkspaceMemberInvite({
|
1073
|
+
pathParams: { workspaceId: workspace, inviteId: invite },
|
700
1074
|
...this.extraProps
|
701
1075
|
});
|
702
1076
|
}
|
703
|
-
|
704
|
-
|
705
|
-
|
1077
|
+
acceptWorkspaceMemberInvite({
|
1078
|
+
workspace,
|
1079
|
+
key
|
1080
|
+
}) {
|
1081
|
+
return operationsByTag.invites.acceptWorkspaceMemberInvite({
|
1082
|
+
pathParams: { workspaceId: workspace, inviteKey: key },
|
706
1083
|
...this.extraProps
|
707
1084
|
});
|
708
1085
|
}
|
709
|
-
|
710
|
-
|
711
|
-
|
1086
|
+
resendWorkspaceMemberInvite({
|
1087
|
+
workspace,
|
1088
|
+
invite
|
1089
|
+
}) {
|
1090
|
+
return operationsByTag.invites.resendWorkspaceMemberInvite({
|
1091
|
+
pathParams: { workspaceId: workspace, inviteId: invite },
|
712
1092
|
...this.extraProps
|
713
1093
|
});
|
714
1094
|
}
|
715
1095
|
}
|
716
|
-
class
|
1096
|
+
class BranchApi {
|
717
1097
|
constructor(extraProps) {
|
718
1098
|
this.extraProps = extraProps;
|
719
1099
|
}
|
720
|
-
|
721
|
-
|
722
|
-
|
1100
|
+
getBranchList({
|
1101
|
+
workspace,
|
1102
|
+
region,
|
1103
|
+
database
|
1104
|
+
}) {
|
1105
|
+
return operationsByTag.branch.getBranchList({
|
1106
|
+
pathParams: { workspace, region, dbName: database },
|
723
1107
|
...this.extraProps
|
724
1108
|
});
|
725
1109
|
}
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
1110
|
+
getBranchDetails({
|
1111
|
+
workspace,
|
1112
|
+
region,
|
1113
|
+
database,
|
1114
|
+
branch
|
1115
|
+
}) {
|
1116
|
+
return operationsByTag.branch.getBranchDetails({
|
1117
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
730
1118
|
...this.extraProps
|
731
1119
|
});
|
732
1120
|
}
|
733
|
-
|
734
|
-
|
735
|
-
|
1121
|
+
createBranch({
|
1122
|
+
workspace,
|
1123
|
+
region,
|
1124
|
+
database,
|
1125
|
+
branch,
|
1126
|
+
from,
|
1127
|
+
metadata
|
1128
|
+
}) {
|
1129
|
+
return operationsByTag.branch.createBranch({
|
1130
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1131
|
+
body: { from, metadata },
|
736
1132
|
...this.extraProps
|
737
1133
|
});
|
738
1134
|
}
|
739
|
-
|
740
|
-
|
741
|
-
|
1135
|
+
deleteBranch({
|
1136
|
+
workspace,
|
1137
|
+
region,
|
1138
|
+
database,
|
1139
|
+
branch
|
1140
|
+
}) {
|
1141
|
+
return operationsByTag.branch.deleteBranch({
|
1142
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
742
1143
|
...this.extraProps
|
743
1144
|
});
|
744
1145
|
}
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
1146
|
+
updateBranchMetadata({
|
1147
|
+
workspace,
|
1148
|
+
region,
|
1149
|
+
database,
|
1150
|
+
branch,
|
1151
|
+
metadata
|
1152
|
+
}) {
|
1153
|
+
return operationsByTag.branch.updateBranchMetadata({
|
1154
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1155
|
+
body: metadata,
|
749
1156
|
...this.extraProps
|
750
1157
|
});
|
751
1158
|
}
|
752
|
-
|
753
|
-
|
754
|
-
|
1159
|
+
getBranchMetadata({
|
1160
|
+
workspace,
|
1161
|
+
region,
|
1162
|
+
database,
|
1163
|
+
branch
|
1164
|
+
}) {
|
1165
|
+
return operationsByTag.branch.getBranchMetadata({
|
1166
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1167
|
+
...this.extraProps
|
1168
|
+
});
|
1169
|
+
}
|
1170
|
+
getBranchStats({
|
1171
|
+
workspace,
|
1172
|
+
region,
|
1173
|
+
database,
|
1174
|
+
branch
|
1175
|
+
}) {
|
1176
|
+
return operationsByTag.branch.getBranchStats({
|
1177
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1178
|
+
...this.extraProps
|
1179
|
+
});
|
1180
|
+
}
|
1181
|
+
getGitBranchesMapping({
|
1182
|
+
workspace,
|
1183
|
+
region,
|
1184
|
+
database
|
1185
|
+
}) {
|
1186
|
+
return operationsByTag.branch.getGitBranchesMapping({
|
1187
|
+
pathParams: { workspace, region, dbName: database },
|
1188
|
+
...this.extraProps
|
1189
|
+
});
|
1190
|
+
}
|
1191
|
+
addGitBranchesEntry({
|
1192
|
+
workspace,
|
1193
|
+
region,
|
1194
|
+
database,
|
1195
|
+
gitBranch,
|
1196
|
+
xataBranch
|
1197
|
+
}) {
|
1198
|
+
return operationsByTag.branch.addGitBranchesEntry({
|
1199
|
+
pathParams: { workspace, region, dbName: database },
|
1200
|
+
body: { gitBranch, xataBranch },
|
1201
|
+
...this.extraProps
|
1202
|
+
});
|
1203
|
+
}
|
1204
|
+
removeGitBranchesEntry({
|
1205
|
+
workspace,
|
1206
|
+
region,
|
1207
|
+
database,
|
1208
|
+
gitBranch
|
1209
|
+
}) {
|
1210
|
+
return operationsByTag.branch.removeGitBranchesEntry({
|
1211
|
+
pathParams: { workspace, region, dbName: database },
|
755
1212
|
queryParams: { gitBranch },
|
756
1213
|
...this.extraProps
|
757
1214
|
});
|
758
1215
|
}
|
759
|
-
resolveBranch(
|
760
|
-
|
761
|
-
|
1216
|
+
resolveBranch({
|
1217
|
+
workspace,
|
1218
|
+
region,
|
1219
|
+
database,
|
1220
|
+
gitBranch,
|
1221
|
+
fallbackBranch
|
1222
|
+
}) {
|
1223
|
+
return operationsByTag.branch.resolveBranch({
|
1224
|
+
pathParams: { workspace, region, dbName: database },
|
762
1225
|
queryParams: { gitBranch, fallbackBranch },
|
763
1226
|
...this.extraProps
|
764
1227
|
});
|
765
1228
|
}
|
766
1229
|
}
|
767
|
-
class
|
1230
|
+
class TableApi {
|
768
1231
|
constructor(extraProps) {
|
769
1232
|
this.extraProps = extraProps;
|
770
1233
|
}
|
771
|
-
|
772
|
-
|
773
|
-
|
1234
|
+
createTable({
|
1235
|
+
workspace,
|
1236
|
+
region,
|
1237
|
+
database,
|
1238
|
+
branch,
|
1239
|
+
table
|
1240
|
+
}) {
|
1241
|
+
return operationsByTag.table.createTable({
|
1242
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
774
1243
|
...this.extraProps
|
775
1244
|
});
|
776
1245
|
}
|
777
|
-
|
778
|
-
|
779
|
-
|
1246
|
+
deleteTable({
|
1247
|
+
workspace,
|
1248
|
+
region,
|
1249
|
+
database,
|
1250
|
+
branch,
|
1251
|
+
table
|
1252
|
+
}) {
|
1253
|
+
return operationsByTag.table.deleteTable({
|
1254
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
780
1255
|
...this.extraProps
|
781
1256
|
});
|
782
1257
|
}
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
1258
|
+
updateTable({
|
1259
|
+
workspace,
|
1260
|
+
region,
|
1261
|
+
database,
|
1262
|
+
branch,
|
1263
|
+
table,
|
1264
|
+
update
|
1265
|
+
}) {
|
1266
|
+
return operationsByTag.table.updateTable({
|
1267
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1268
|
+
body: update,
|
788
1269
|
...this.extraProps
|
789
1270
|
});
|
790
1271
|
}
|
791
|
-
|
792
|
-
|
793
|
-
|
1272
|
+
getTableSchema({
|
1273
|
+
workspace,
|
1274
|
+
region,
|
1275
|
+
database,
|
1276
|
+
branch,
|
1277
|
+
table
|
1278
|
+
}) {
|
1279
|
+
return operationsByTag.table.getTableSchema({
|
1280
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
794
1281
|
...this.extraProps
|
795
1282
|
});
|
796
1283
|
}
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
1284
|
+
setTableSchema({
|
1285
|
+
workspace,
|
1286
|
+
region,
|
1287
|
+
database,
|
1288
|
+
branch,
|
1289
|
+
table,
|
1290
|
+
schema
|
1291
|
+
}) {
|
1292
|
+
return operationsByTag.table.setTableSchema({
|
1293
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1294
|
+
body: schema,
|
801
1295
|
...this.extraProps
|
802
1296
|
});
|
803
1297
|
}
|
804
|
-
|
805
|
-
|
806
|
-
|
1298
|
+
getTableColumns({
|
1299
|
+
workspace,
|
1300
|
+
region,
|
1301
|
+
database,
|
1302
|
+
branch,
|
1303
|
+
table
|
1304
|
+
}) {
|
1305
|
+
return operationsByTag.table.getTableColumns({
|
1306
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
807
1307
|
...this.extraProps
|
808
1308
|
});
|
809
1309
|
}
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
1310
|
+
addTableColumn({
|
1311
|
+
workspace,
|
1312
|
+
region,
|
1313
|
+
database,
|
1314
|
+
branch,
|
1315
|
+
table,
|
1316
|
+
column
|
1317
|
+
}) {
|
1318
|
+
return operationsByTag.table.addTableColumn({
|
1319
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1320
|
+
body: column,
|
814
1321
|
...this.extraProps
|
815
1322
|
});
|
816
1323
|
}
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
1324
|
+
getColumn({
|
1325
|
+
workspace,
|
1326
|
+
region,
|
1327
|
+
database,
|
1328
|
+
branch,
|
1329
|
+
table,
|
1330
|
+
column
|
1331
|
+
}) {
|
1332
|
+
return operationsByTag.table.getColumn({
|
1333
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, columnName: column },
|
821
1334
|
...this.extraProps
|
822
1335
|
});
|
823
1336
|
}
|
824
|
-
|
825
|
-
|
826
|
-
|
827
|
-
|
1337
|
+
updateColumn({
|
1338
|
+
workspace,
|
1339
|
+
region,
|
1340
|
+
database,
|
1341
|
+
branch,
|
1342
|
+
table,
|
1343
|
+
column,
|
1344
|
+
update
|
1345
|
+
}) {
|
1346
|
+
return operationsByTag.table.updateColumn({
|
1347
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, columnName: column },
|
1348
|
+
body: update,
|
828
1349
|
...this.extraProps
|
829
1350
|
});
|
830
1351
|
}
|
831
|
-
|
832
|
-
|
833
|
-
|
1352
|
+
deleteColumn({
|
1353
|
+
workspace,
|
1354
|
+
region,
|
1355
|
+
database,
|
1356
|
+
branch,
|
1357
|
+
table,
|
1358
|
+
column
|
1359
|
+
}) {
|
1360
|
+
return operationsByTag.table.deleteColumn({
|
1361
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, columnName: column },
|
834
1362
|
...this.extraProps
|
835
1363
|
});
|
836
1364
|
}
|
837
1365
|
}
|
838
|
-
class
|
1366
|
+
class RecordsApi {
|
839
1367
|
constructor(extraProps) {
|
840
1368
|
this.extraProps = extraProps;
|
841
1369
|
}
|
842
|
-
|
843
|
-
|
844
|
-
|
1370
|
+
insertRecord({
|
1371
|
+
workspace,
|
1372
|
+
region,
|
1373
|
+
database,
|
1374
|
+
branch,
|
1375
|
+
table,
|
1376
|
+
record,
|
1377
|
+
columns
|
1378
|
+
}) {
|
1379
|
+
return operationsByTag.records.insertRecord({
|
1380
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1381
|
+
queryParams: { columns },
|
1382
|
+
body: record,
|
1383
|
+
...this.extraProps
|
1384
|
+
});
|
1385
|
+
}
|
1386
|
+
getRecord({
|
1387
|
+
workspace,
|
1388
|
+
region,
|
1389
|
+
database,
|
1390
|
+
branch,
|
1391
|
+
table,
|
1392
|
+
id,
|
1393
|
+
columns
|
1394
|
+
}) {
|
1395
|
+
return operationsByTag.records.getRecord({
|
1396
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1397
|
+
queryParams: { columns },
|
1398
|
+
...this.extraProps
|
1399
|
+
});
|
1400
|
+
}
|
1401
|
+
insertRecordWithID({
|
1402
|
+
workspace,
|
1403
|
+
region,
|
1404
|
+
database,
|
1405
|
+
branch,
|
1406
|
+
table,
|
1407
|
+
id,
|
1408
|
+
record,
|
1409
|
+
columns,
|
1410
|
+
createOnly,
|
1411
|
+
ifVersion
|
1412
|
+
}) {
|
1413
|
+
return operationsByTag.records.insertRecordWithID({
|
1414
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1415
|
+
queryParams: { columns, createOnly, ifVersion },
|
1416
|
+
body: record,
|
1417
|
+
...this.extraProps
|
1418
|
+
});
|
1419
|
+
}
|
1420
|
+
updateRecordWithID({
|
1421
|
+
workspace,
|
1422
|
+
region,
|
1423
|
+
database,
|
1424
|
+
branch,
|
1425
|
+
table,
|
1426
|
+
id,
|
1427
|
+
record,
|
1428
|
+
columns,
|
1429
|
+
ifVersion
|
1430
|
+
}) {
|
1431
|
+
return operationsByTag.records.updateRecordWithID({
|
1432
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1433
|
+
queryParams: { columns, ifVersion },
|
1434
|
+
body: record,
|
1435
|
+
...this.extraProps
|
1436
|
+
});
|
1437
|
+
}
|
1438
|
+
upsertRecordWithID({
|
1439
|
+
workspace,
|
1440
|
+
region,
|
1441
|
+
database,
|
1442
|
+
branch,
|
1443
|
+
table,
|
1444
|
+
id,
|
1445
|
+
record,
|
1446
|
+
columns,
|
1447
|
+
ifVersion
|
1448
|
+
}) {
|
1449
|
+
return operationsByTag.records.upsertRecordWithID({
|
1450
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1451
|
+
queryParams: { columns, ifVersion },
|
1452
|
+
body: record,
|
1453
|
+
...this.extraProps
|
1454
|
+
});
|
1455
|
+
}
|
1456
|
+
deleteRecord({
|
1457
|
+
workspace,
|
1458
|
+
region,
|
1459
|
+
database,
|
1460
|
+
branch,
|
1461
|
+
table,
|
1462
|
+
id,
|
1463
|
+
columns
|
1464
|
+
}) {
|
1465
|
+
return operationsByTag.records.deleteRecord({
|
1466
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1467
|
+
queryParams: { columns },
|
1468
|
+
...this.extraProps
|
1469
|
+
});
|
1470
|
+
}
|
1471
|
+
bulkInsertTableRecords({
|
1472
|
+
workspace,
|
1473
|
+
region,
|
1474
|
+
database,
|
1475
|
+
branch,
|
1476
|
+
table,
|
1477
|
+
records,
|
1478
|
+
columns
|
1479
|
+
}) {
|
1480
|
+
return operationsByTag.records.bulkInsertTableRecords({
|
1481
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1482
|
+
queryParams: { columns },
|
1483
|
+
body: { records },
|
1484
|
+
...this.extraProps
|
1485
|
+
});
|
1486
|
+
}
|
1487
|
+
branchTransaction({
|
1488
|
+
workspace,
|
1489
|
+
region,
|
1490
|
+
database,
|
1491
|
+
branch,
|
1492
|
+
operations
|
1493
|
+
}) {
|
1494
|
+
return operationsByTag.records.branchTransaction({
|
1495
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1496
|
+
body: { operations },
|
1497
|
+
...this.extraProps
|
1498
|
+
});
|
1499
|
+
}
|
1500
|
+
}
|
1501
|
+
class SearchAndFilterApi {
|
1502
|
+
constructor(extraProps) {
|
1503
|
+
this.extraProps = extraProps;
|
1504
|
+
}
|
1505
|
+
queryTable({
|
1506
|
+
workspace,
|
1507
|
+
region,
|
1508
|
+
database,
|
1509
|
+
branch,
|
1510
|
+
table,
|
1511
|
+
filter,
|
1512
|
+
sort,
|
1513
|
+
page,
|
1514
|
+
columns,
|
1515
|
+
consistency
|
1516
|
+
}) {
|
1517
|
+
return operationsByTag.searchAndFilter.queryTable({
|
1518
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1519
|
+
body: { filter, sort, page, columns, consistency },
|
1520
|
+
...this.extraProps
|
1521
|
+
});
|
1522
|
+
}
|
1523
|
+
searchTable({
|
1524
|
+
workspace,
|
1525
|
+
region,
|
1526
|
+
database,
|
1527
|
+
branch,
|
1528
|
+
table,
|
1529
|
+
query,
|
1530
|
+
fuzziness,
|
1531
|
+
target,
|
1532
|
+
prefix,
|
1533
|
+
filter,
|
1534
|
+
highlight,
|
1535
|
+
boosters
|
1536
|
+
}) {
|
1537
|
+
return operationsByTag.searchAndFilter.searchTable({
|
1538
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1539
|
+
body: { query, fuzziness, target, prefix, filter, highlight, boosters },
|
1540
|
+
...this.extraProps
|
1541
|
+
});
|
1542
|
+
}
|
1543
|
+
searchBranch({
|
1544
|
+
workspace,
|
1545
|
+
region,
|
1546
|
+
database,
|
1547
|
+
branch,
|
1548
|
+
tables,
|
1549
|
+
query,
|
1550
|
+
fuzziness,
|
1551
|
+
prefix,
|
1552
|
+
highlight
|
1553
|
+
}) {
|
1554
|
+
return operationsByTag.searchAndFilter.searchBranch({
|
1555
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1556
|
+
body: { tables, query, fuzziness, prefix, highlight },
|
1557
|
+
...this.extraProps
|
1558
|
+
});
|
1559
|
+
}
|
1560
|
+
summarizeTable({
|
1561
|
+
workspace,
|
1562
|
+
region,
|
1563
|
+
database,
|
1564
|
+
branch,
|
1565
|
+
table,
|
1566
|
+
filter,
|
1567
|
+
columns,
|
1568
|
+
summaries,
|
1569
|
+
sort,
|
1570
|
+
summariesFilter,
|
1571
|
+
page,
|
1572
|
+
consistency
|
1573
|
+
}) {
|
1574
|
+
return operationsByTag.searchAndFilter.summarizeTable({
|
1575
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1576
|
+
body: { filter, columns, summaries, sort, summariesFilter, page, consistency },
|
1577
|
+
...this.extraProps
|
1578
|
+
});
|
1579
|
+
}
|
1580
|
+
aggregateTable({
|
1581
|
+
workspace,
|
1582
|
+
region,
|
1583
|
+
database,
|
1584
|
+
branch,
|
1585
|
+
table,
|
1586
|
+
filter,
|
1587
|
+
aggs
|
1588
|
+
}) {
|
1589
|
+
return operationsByTag.searchAndFilter.aggregateTable({
|
1590
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1591
|
+
body: { filter, aggs },
|
1592
|
+
...this.extraProps
|
1593
|
+
});
|
1594
|
+
}
|
1595
|
+
}
|
1596
|
+
class MigrationRequestsApi {
|
1597
|
+
constructor(extraProps) {
|
1598
|
+
this.extraProps = extraProps;
|
1599
|
+
}
|
1600
|
+
queryMigrationRequests({
|
1601
|
+
workspace,
|
1602
|
+
region,
|
1603
|
+
database,
|
1604
|
+
filter,
|
1605
|
+
sort,
|
1606
|
+
page,
|
1607
|
+
columns
|
1608
|
+
}) {
|
1609
|
+
return operationsByTag.migrationRequests.queryMigrationRequests({
|
1610
|
+
pathParams: { workspace, region, dbName: database },
|
1611
|
+
body: { filter, sort, page, columns },
|
1612
|
+
...this.extraProps
|
1613
|
+
});
|
1614
|
+
}
|
1615
|
+
createMigrationRequest({
|
1616
|
+
workspace,
|
1617
|
+
region,
|
1618
|
+
database,
|
1619
|
+
migration
|
1620
|
+
}) {
|
1621
|
+
return operationsByTag.migrationRequests.createMigrationRequest({
|
1622
|
+
pathParams: { workspace, region, dbName: database },
|
1623
|
+
body: migration,
|
1624
|
+
...this.extraProps
|
1625
|
+
});
|
1626
|
+
}
|
1627
|
+
getMigrationRequest({
|
1628
|
+
workspace,
|
1629
|
+
region,
|
1630
|
+
database,
|
1631
|
+
migrationRequest
|
1632
|
+
}) {
|
1633
|
+
return operationsByTag.migrationRequests.getMigrationRequest({
|
1634
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
845
1635
|
...this.extraProps
|
846
1636
|
});
|
847
1637
|
}
|
848
|
-
|
849
|
-
|
850
|
-
|
1638
|
+
updateMigrationRequest({
|
1639
|
+
workspace,
|
1640
|
+
region,
|
1641
|
+
database,
|
1642
|
+
migrationRequest,
|
1643
|
+
update
|
1644
|
+
}) {
|
1645
|
+
return operationsByTag.migrationRequests.updateMigrationRequest({
|
1646
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
1647
|
+
body: update,
|
851
1648
|
...this.extraProps
|
852
1649
|
});
|
853
1650
|
}
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
1651
|
+
listMigrationRequestsCommits({
|
1652
|
+
workspace,
|
1653
|
+
region,
|
1654
|
+
database,
|
1655
|
+
migrationRequest,
|
1656
|
+
page
|
1657
|
+
}) {
|
1658
|
+
return operationsByTag.migrationRequests.listMigrationRequestsCommits({
|
1659
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
1660
|
+
body: { page },
|
858
1661
|
...this.extraProps
|
859
1662
|
});
|
860
1663
|
}
|
861
|
-
|
862
|
-
|
863
|
-
|
1664
|
+
compareMigrationRequest({
|
1665
|
+
workspace,
|
1666
|
+
region,
|
1667
|
+
database,
|
1668
|
+
migrationRequest
|
1669
|
+
}) {
|
1670
|
+
return operationsByTag.migrationRequests.compareMigrationRequest({
|
1671
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
864
1672
|
...this.extraProps
|
865
1673
|
});
|
866
1674
|
}
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
1675
|
+
getMigrationRequestIsMerged({
|
1676
|
+
workspace,
|
1677
|
+
region,
|
1678
|
+
database,
|
1679
|
+
migrationRequest
|
1680
|
+
}) {
|
1681
|
+
return operationsByTag.migrationRequests.getMigrationRequestIsMerged({
|
1682
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
871
1683
|
...this.extraProps
|
872
1684
|
});
|
873
1685
|
}
|
874
|
-
|
875
|
-
|
876
|
-
|
1686
|
+
mergeMigrationRequest({
|
1687
|
+
workspace,
|
1688
|
+
region,
|
1689
|
+
database,
|
1690
|
+
migrationRequest
|
1691
|
+
}) {
|
1692
|
+
return operationsByTag.migrationRequests.mergeMigrationRequest({
|
1693
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
877
1694
|
...this.extraProps
|
878
1695
|
});
|
879
1696
|
}
|
880
|
-
|
881
|
-
|
882
|
-
|
883
|
-
|
1697
|
+
}
|
1698
|
+
class MigrationsApi {
|
1699
|
+
constructor(extraProps) {
|
1700
|
+
this.extraProps = extraProps;
|
1701
|
+
}
|
1702
|
+
getBranchMigrationHistory({
|
1703
|
+
workspace,
|
1704
|
+
region,
|
1705
|
+
database,
|
1706
|
+
branch,
|
1707
|
+
limit,
|
1708
|
+
startFrom
|
1709
|
+
}) {
|
1710
|
+
return operationsByTag.migrations.getBranchMigrationHistory({
|
1711
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1712
|
+
body: { limit, startFrom },
|
884
1713
|
...this.extraProps
|
885
1714
|
});
|
886
1715
|
}
|
887
|
-
|
888
|
-
|
889
|
-
|
1716
|
+
getBranchMigrationPlan({
|
1717
|
+
workspace,
|
1718
|
+
region,
|
1719
|
+
database,
|
1720
|
+
branch,
|
1721
|
+
schema
|
1722
|
+
}) {
|
1723
|
+
return operationsByTag.migrations.getBranchMigrationPlan({
|
1724
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1725
|
+
body: schema,
|
890
1726
|
...this.extraProps
|
891
1727
|
});
|
892
1728
|
}
|
893
|
-
|
894
|
-
|
895
|
-
|
1729
|
+
executeBranchMigrationPlan({
|
1730
|
+
workspace,
|
1731
|
+
region,
|
1732
|
+
database,
|
1733
|
+
branch,
|
1734
|
+
plan
|
1735
|
+
}) {
|
1736
|
+
return operationsByTag.migrations.executeBranchMigrationPlan({
|
1737
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1738
|
+
body: plan,
|
896
1739
|
...this.extraProps
|
897
1740
|
});
|
898
1741
|
}
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
1742
|
+
getBranchSchemaHistory({
|
1743
|
+
workspace,
|
1744
|
+
region,
|
1745
|
+
database,
|
1746
|
+
branch,
|
1747
|
+
page
|
1748
|
+
}) {
|
1749
|
+
return operationsByTag.migrations.getBranchSchemaHistory({
|
1750
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1751
|
+
body: { page },
|
903
1752
|
...this.extraProps
|
904
1753
|
});
|
905
1754
|
}
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
1755
|
+
compareBranchWithUserSchema({
|
1756
|
+
workspace,
|
1757
|
+
region,
|
1758
|
+
database,
|
1759
|
+
branch,
|
1760
|
+
schema
|
1761
|
+
}) {
|
1762
|
+
return operationsByTag.migrations.compareBranchWithUserSchema({
|
1763
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1764
|
+
body: { schema },
|
1765
|
+
...this.extraProps
|
1766
|
+
});
|
910
1767
|
}
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
|
1768
|
+
compareBranchSchemas({
|
1769
|
+
workspace,
|
1770
|
+
region,
|
1771
|
+
database,
|
1772
|
+
branch,
|
1773
|
+
compare,
|
1774
|
+
schema
|
1775
|
+
}) {
|
1776
|
+
return operationsByTag.migrations.compareBranchSchemas({
|
1777
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, branchName: compare },
|
1778
|
+
body: { schema },
|
915
1779
|
...this.extraProps
|
916
1780
|
});
|
917
1781
|
}
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
1782
|
+
updateBranchSchema({
|
1783
|
+
workspace,
|
1784
|
+
region,
|
1785
|
+
database,
|
1786
|
+
branch,
|
1787
|
+
migration
|
1788
|
+
}) {
|
1789
|
+
return operationsByTag.migrations.updateBranchSchema({
|
1790
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1791
|
+
body: migration,
|
923
1792
|
...this.extraProps
|
924
1793
|
});
|
925
1794
|
}
|
926
|
-
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
|
1795
|
+
previewBranchSchemaEdit({
|
1796
|
+
workspace,
|
1797
|
+
region,
|
1798
|
+
database,
|
1799
|
+
branch,
|
1800
|
+
data
|
1801
|
+
}) {
|
1802
|
+
return operationsByTag.migrations.previewBranchSchemaEdit({
|
1803
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1804
|
+
body: data,
|
931
1805
|
...this.extraProps
|
932
1806
|
});
|
933
1807
|
}
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
|
1808
|
+
applyBranchSchemaEdit({
|
1809
|
+
workspace,
|
1810
|
+
region,
|
1811
|
+
database,
|
1812
|
+
branch,
|
1813
|
+
edits
|
1814
|
+
}) {
|
1815
|
+
return operationsByTag.migrations.applyBranchSchemaEdit({
|
1816
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1817
|
+
body: { edits },
|
939
1818
|
...this.extraProps
|
940
1819
|
});
|
941
1820
|
}
|
942
|
-
|
943
|
-
|
944
|
-
|
1821
|
+
}
|
1822
|
+
class DatabaseApi {
|
1823
|
+
constructor(extraProps) {
|
1824
|
+
this.extraProps = extraProps;
|
1825
|
+
}
|
1826
|
+
getDatabaseList({ workspace }) {
|
1827
|
+
return operationsByTag.databases.getDatabaseList({
|
1828
|
+
pathParams: { workspaceId: workspace },
|
945
1829
|
...this.extraProps
|
946
1830
|
});
|
947
1831
|
}
|
948
|
-
|
949
|
-
|
950
|
-
|
1832
|
+
createDatabase({
|
1833
|
+
workspace,
|
1834
|
+
database,
|
1835
|
+
data
|
1836
|
+
}) {
|
1837
|
+
return operationsByTag.databases.createDatabase({
|
1838
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
1839
|
+
body: data,
|
951
1840
|
...this.extraProps
|
952
1841
|
});
|
953
1842
|
}
|
954
|
-
|
955
|
-
|
956
|
-
|
957
|
-
|
1843
|
+
deleteDatabase({
|
1844
|
+
workspace,
|
1845
|
+
database
|
1846
|
+
}) {
|
1847
|
+
return operationsByTag.databases.deleteDatabase({
|
1848
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
958
1849
|
...this.extraProps
|
959
1850
|
});
|
960
1851
|
}
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
|
1852
|
+
getDatabaseMetadata({
|
1853
|
+
workspace,
|
1854
|
+
database
|
1855
|
+
}) {
|
1856
|
+
return operationsByTag.databases.getDatabaseMetadata({
|
1857
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
965
1858
|
...this.extraProps
|
966
1859
|
});
|
967
1860
|
}
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
|
1861
|
+
updateDatabaseMetadata({
|
1862
|
+
workspace,
|
1863
|
+
database,
|
1864
|
+
metadata
|
1865
|
+
}) {
|
1866
|
+
return operationsByTag.databases.updateDatabaseMetadata({
|
1867
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
1868
|
+
body: metadata,
|
972
1869
|
...this.extraProps
|
973
1870
|
});
|
974
1871
|
}
|
975
|
-
|
976
|
-
return operationsByTag.
|
977
|
-
pathParams: {
|
978
|
-
body: query,
|
1872
|
+
listRegions({ workspace }) {
|
1873
|
+
return operationsByTag.databases.listRegions({
|
1874
|
+
pathParams: { workspaceId: workspace },
|
979
1875
|
...this.extraProps
|
980
1876
|
});
|
981
1877
|
}
|
@@ -991,6 +1887,20 @@ class XataApiPlugin {
|
|
991
1887
|
class XataPlugin {
|
992
1888
|
}
|
993
1889
|
|
1890
|
+
function generateUUID() {
|
1891
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
|
1892
|
+
const r = Math.random() * 16 | 0, v = c == "x" ? r : r & 3 | 8;
|
1893
|
+
return v.toString(16);
|
1894
|
+
});
|
1895
|
+
}
|
1896
|
+
|
1897
|
+
function cleanFilter(filter) {
|
1898
|
+
if (!filter)
|
1899
|
+
return void 0;
|
1900
|
+
const values = Object.values(filter).filter(Boolean).filter((value) => Array.isArray(value) ? value.length > 0 : true);
|
1901
|
+
return values.length > 0 ? filter : void 0;
|
1902
|
+
}
|
1903
|
+
|
994
1904
|
var __accessCheck$6 = (obj, member, msg) => {
|
995
1905
|
if (!member.has(obj))
|
996
1906
|
throw TypeError("Cannot " + msg);
|
@@ -1023,11 +1933,11 @@ class Page {
|
|
1023
1933
|
async previousPage(size, offset) {
|
1024
1934
|
return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset, before: this.meta.page.cursor } });
|
1025
1935
|
}
|
1026
|
-
async
|
1027
|
-
return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset,
|
1936
|
+
async startPage(size, offset) {
|
1937
|
+
return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset, start: this.meta.page.cursor } });
|
1028
1938
|
}
|
1029
|
-
async
|
1030
|
-
return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset,
|
1939
|
+
async endPage(size, offset) {
|
1940
|
+
return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset, end: this.meta.page.cursor } });
|
1031
1941
|
}
|
1032
1942
|
hasNextPage() {
|
1033
1943
|
return this.meta.page.more;
|
@@ -1039,13 +1949,13 @@ const PAGINATION_DEFAULT_SIZE = 20;
|
|
1039
1949
|
const PAGINATION_MAX_OFFSET = 800;
|
1040
1950
|
const PAGINATION_DEFAULT_OFFSET = 0;
|
1041
1951
|
function isCursorPaginationOptions(options) {
|
1042
|
-
return isDefined(options) && (isDefined(options.
|
1952
|
+
return isDefined(options) && (isDefined(options.start) || isDefined(options.end) || isDefined(options.after) || isDefined(options.before));
|
1043
1953
|
}
|
1044
1954
|
const _RecordArray = class extends Array {
|
1045
|
-
constructor(
|
1046
|
-
super(..._RecordArray.parseConstructorParams(
|
1955
|
+
constructor(...args) {
|
1956
|
+
super(..._RecordArray.parseConstructorParams(...args));
|
1047
1957
|
__privateAdd$6(this, _page, void 0);
|
1048
|
-
__privateSet$6(this, _page, page);
|
1958
|
+
__privateSet$6(this, _page, isObject(args[0]?.meta) ? args[0] : { meta: { page: { cursor: "", more: false } }, records: [] });
|
1049
1959
|
}
|
1050
1960
|
static parseConstructorParams(...args) {
|
1051
1961
|
if (args.length === 1 && typeof args[0] === "number") {
|
@@ -1057,6 +1967,12 @@ const _RecordArray = class extends Array {
|
|
1057
1967
|
}
|
1058
1968
|
return new Array(...args);
|
1059
1969
|
}
|
1970
|
+
toArray() {
|
1971
|
+
return new Array(...this);
|
1972
|
+
}
|
1973
|
+
map(callbackfn, thisArg) {
|
1974
|
+
return this.toArray().map(callbackfn, thisArg);
|
1975
|
+
}
|
1060
1976
|
async nextPage(size, offset) {
|
1061
1977
|
const newPage = await __privateGet$6(this, _page).nextPage(size, offset);
|
1062
1978
|
return new _RecordArray(newPage);
|
@@ -1065,12 +1981,12 @@ const _RecordArray = class extends Array {
|
|
1065
1981
|
const newPage = await __privateGet$6(this, _page).previousPage(size, offset);
|
1066
1982
|
return new _RecordArray(newPage);
|
1067
1983
|
}
|
1068
|
-
async
|
1069
|
-
const newPage = await __privateGet$6(this, _page).
|
1984
|
+
async startPage(size, offset) {
|
1985
|
+
const newPage = await __privateGet$6(this, _page).startPage(size, offset);
|
1070
1986
|
return new _RecordArray(newPage);
|
1071
1987
|
}
|
1072
|
-
async
|
1073
|
-
const newPage = await __privateGet$6(this, _page).
|
1988
|
+
async endPage(size, offset) {
|
1989
|
+
const newPage = await __privateGet$6(this, _page).endPage(size, offset);
|
1074
1990
|
return new _RecordArray(newPage);
|
1075
1991
|
}
|
1076
1992
|
hasNextPage() {
|
@@ -1098,9 +2014,14 @@ var __privateSet$5 = (obj, member, value, setter) => {
|
|
1098
2014
|
setter ? setter.call(obj, value) : member.set(obj, value);
|
1099
2015
|
return value;
|
1100
2016
|
};
|
1101
|
-
var
|
2017
|
+
var __privateMethod$3 = (obj, member, method) => {
|
2018
|
+
__accessCheck$5(obj, member, "access private method");
|
2019
|
+
return method;
|
2020
|
+
};
|
2021
|
+
var _table$1, _repository, _data, _cleanFilterConstraint, cleanFilterConstraint_fn;
|
1102
2022
|
const _Query = class {
|
1103
2023
|
constructor(repository, table, data, rawParent) {
|
2024
|
+
__privateAdd$5(this, _cleanFilterConstraint);
|
1104
2025
|
__privateAdd$5(this, _table$1, void 0);
|
1105
2026
|
__privateAdd$5(this, _repository, void 0);
|
1106
2027
|
__privateAdd$5(this, _data, { filter: {} });
|
@@ -1119,9 +2040,10 @@ const _Query = class {
|
|
1119
2040
|
__privateGet$5(this, _data).filter.$not = data.filter?.$not ?? parent?.filter?.$not;
|
1120
2041
|
__privateGet$5(this, _data).filter.$none = data.filter?.$none ?? parent?.filter?.$none;
|
1121
2042
|
__privateGet$5(this, _data).sort = data.sort ?? parent?.sort;
|
1122
|
-
__privateGet$5(this, _data).columns = data.columns ?? parent?.columns
|
2043
|
+
__privateGet$5(this, _data).columns = data.columns ?? parent?.columns;
|
1123
2044
|
__privateGet$5(this, _data).pagination = data.pagination ?? parent?.pagination;
|
1124
2045
|
__privateGet$5(this, _data).cache = data.cache ?? parent?.cache;
|
2046
|
+
__privateGet$5(this, _data).fetchOptions = data.fetchOptions ?? parent?.fetchOptions;
|
1125
2047
|
this.any = this.any.bind(this);
|
1126
2048
|
this.all = this.all.bind(this);
|
1127
2049
|
this.not = this.not.bind(this);
|
@@ -1157,21 +2079,29 @@ const _Query = class {
|
|
1157
2079
|
}
|
1158
2080
|
filter(a, b) {
|
1159
2081
|
if (arguments.length === 1) {
|
1160
|
-
const constraints = Object.entries(a).map(([column, constraint]) => ({
|
2082
|
+
const constraints = Object.entries(a ?? {}).map(([column, constraint]) => ({
|
2083
|
+
[column]: __privateMethod$3(this, _cleanFilterConstraint, cleanFilterConstraint_fn).call(this, column, constraint)
|
2084
|
+
}));
|
1161
2085
|
const $all = compact([__privateGet$5(this, _data).filter?.$all].flat().concat(constraints));
|
1162
2086
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $all } }, __privateGet$5(this, _data));
|
1163
2087
|
} else {
|
1164
|
-
const
|
2088
|
+
const constraints = isDefined(a) && isDefined(b) ? [{ [a]: __privateMethod$3(this, _cleanFilterConstraint, cleanFilterConstraint_fn).call(this, a, b) }] : void 0;
|
2089
|
+
const $all = compact([__privateGet$5(this, _data).filter?.$all].flat().concat(constraints));
|
1165
2090
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $all } }, __privateGet$5(this, _data));
|
1166
2091
|
}
|
1167
2092
|
}
|
1168
|
-
sort(column, direction) {
|
2093
|
+
sort(column, direction = "asc") {
|
1169
2094
|
const originalSort = [__privateGet$5(this, _data).sort ?? []].flat();
|
1170
2095
|
const sort = [...originalSort, { column, direction }];
|
1171
2096
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { sort }, __privateGet$5(this, _data));
|
1172
2097
|
}
|
1173
2098
|
select(columns) {
|
1174
|
-
return new _Query(
|
2099
|
+
return new _Query(
|
2100
|
+
__privateGet$5(this, _repository),
|
2101
|
+
__privateGet$5(this, _table$1),
|
2102
|
+
{ columns },
|
2103
|
+
__privateGet$5(this, _data)
|
2104
|
+
);
|
1175
2105
|
}
|
1176
2106
|
getPaginated(options = {}) {
|
1177
2107
|
const query = new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), options, __privateGet$5(this, _data));
|
@@ -1194,11 +2124,20 @@ const _Query = class {
|
|
1194
2124
|
}
|
1195
2125
|
}
|
1196
2126
|
async getMany(options = {}) {
|
1197
|
-
const
|
2127
|
+
const { pagination = {}, ...rest } = options;
|
2128
|
+
const { size = PAGINATION_DEFAULT_SIZE, offset } = pagination;
|
2129
|
+
const batchSize = size <= PAGINATION_MAX_SIZE ? size : PAGINATION_MAX_SIZE;
|
2130
|
+
let page = await this.getPaginated({ ...rest, pagination: { size: batchSize, offset } });
|
2131
|
+
const results = [...page.records];
|
2132
|
+
while (page.hasNextPage() && results.length < size) {
|
2133
|
+
page = await page.nextPage();
|
2134
|
+
results.push(...page.records);
|
2135
|
+
}
|
1198
2136
|
if (page.hasNextPage() && options.pagination?.size === void 0) {
|
1199
2137
|
console.trace("Calling getMany does not return all results. Paginate to get all results or call getAll.");
|
1200
2138
|
}
|
1201
|
-
|
2139
|
+
const array = new RecordArray(page, results.slice(0, size));
|
2140
|
+
return array;
|
1202
2141
|
}
|
1203
2142
|
async getAll(options = {}) {
|
1204
2143
|
const { batchSize = PAGINATION_MAX_SIZE, ...rest } = options;
|
@@ -1212,19 +2151,35 @@ const _Query = class {
|
|
1212
2151
|
const records = await this.getMany({ ...options, pagination: { size: 1 } });
|
1213
2152
|
return records[0] ?? null;
|
1214
2153
|
}
|
2154
|
+
async getFirstOrThrow(options = {}) {
|
2155
|
+
const records = await this.getMany({ ...options, pagination: { size: 1 } });
|
2156
|
+
if (records[0] === void 0)
|
2157
|
+
throw new Error("No results found.");
|
2158
|
+
return records[0];
|
2159
|
+
}
|
2160
|
+
async summarize(params = {}) {
|
2161
|
+
const { summaries, summariesFilter, ...options } = params;
|
2162
|
+
const query = new _Query(
|
2163
|
+
__privateGet$5(this, _repository),
|
2164
|
+
__privateGet$5(this, _table$1),
|
2165
|
+
options,
|
2166
|
+
__privateGet$5(this, _data)
|
2167
|
+
);
|
2168
|
+
return __privateGet$5(this, _repository).summarizeTable(query, summaries, summariesFilter);
|
2169
|
+
}
|
1215
2170
|
cache(ttl) {
|
1216
2171
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { cache: ttl }, __privateGet$5(this, _data));
|
1217
2172
|
}
|
1218
2173
|
nextPage(size, offset) {
|
1219
|
-
return this.
|
2174
|
+
return this.startPage(size, offset);
|
1220
2175
|
}
|
1221
2176
|
previousPage(size, offset) {
|
1222
|
-
return this.
|
2177
|
+
return this.startPage(size, offset);
|
1223
2178
|
}
|
1224
|
-
|
2179
|
+
startPage(size, offset) {
|
1225
2180
|
return this.getPaginated({ pagination: { size, offset } });
|
1226
2181
|
}
|
1227
|
-
|
2182
|
+
endPage(size, offset) {
|
1228
2183
|
return this.getPaginated({ pagination: { size, offset, before: "end" } });
|
1229
2184
|
}
|
1230
2185
|
hasNextPage() {
|
@@ -1235,9 +2190,20 @@ let Query = _Query;
|
|
1235
2190
|
_table$1 = new WeakMap();
|
1236
2191
|
_repository = new WeakMap();
|
1237
2192
|
_data = new WeakMap();
|
2193
|
+
_cleanFilterConstraint = new WeakSet();
|
2194
|
+
cleanFilterConstraint_fn = function(column, value) {
|
2195
|
+
const columnType = __privateGet$5(this, _table$1).schema?.columns.find(({ name }) => name === column)?.type;
|
2196
|
+
if (columnType === "multiple" && (isString(value) || isStringArray(value))) {
|
2197
|
+
return { $includes: value };
|
2198
|
+
}
|
2199
|
+
if (columnType === "link" && isObject(value) && isString(value.id)) {
|
2200
|
+
return value.id;
|
2201
|
+
}
|
2202
|
+
return value;
|
2203
|
+
};
|
1238
2204
|
function cleanParent(data, parent) {
|
1239
2205
|
if (isCursorPaginationOptions(data.pagination)) {
|
1240
|
-
return { ...parent,
|
2206
|
+
return { ...parent, sort: void 0, filter: void 0 };
|
1241
2207
|
}
|
1242
2208
|
return parent;
|
1243
2209
|
}
|
@@ -1296,317 +2262,564 @@ var __privateMethod$2 = (obj, member, method) => {
|
|
1296
2262
|
__accessCheck$4(obj, member, "access private method");
|
1297
2263
|
return method;
|
1298
2264
|
};
|
1299
|
-
var _table, _getFetchProps, _cache, _schemaTables$2, _insertRecordWithoutId, insertRecordWithoutId_fn, _insertRecordWithId, insertRecordWithId_fn,
|
2265
|
+
var _table, _getFetchProps, _db, _cache, _schemaTables$2, _trace, _insertRecordWithoutId, insertRecordWithoutId_fn, _insertRecordWithId, insertRecordWithId_fn, _insertRecords, insertRecords_fn, _updateRecordWithID, updateRecordWithID_fn, _updateRecords, updateRecords_fn, _upsertRecordWithID, upsertRecordWithID_fn, _deleteRecord, deleteRecord_fn, _deleteRecords, deleteRecords_fn, _setCacheQuery, setCacheQuery_fn, _getCacheQuery, getCacheQuery_fn, _getSchemaTables$1, getSchemaTables_fn$1;
|
2266
|
+
const BULK_OPERATION_MAX_SIZE = 1e3;
|
1300
2267
|
class Repository extends Query {
|
1301
2268
|
}
|
1302
2269
|
class RestRepository extends Query {
|
1303
2270
|
constructor(options) {
|
1304
|
-
super(
|
2271
|
+
super(
|
2272
|
+
null,
|
2273
|
+
{ name: options.table, schema: options.schemaTables?.find((table) => table.name === options.table) },
|
2274
|
+
{}
|
2275
|
+
);
|
1305
2276
|
__privateAdd$4(this, _insertRecordWithoutId);
|
1306
2277
|
__privateAdd$4(this, _insertRecordWithId);
|
1307
|
-
__privateAdd$4(this,
|
2278
|
+
__privateAdd$4(this, _insertRecords);
|
1308
2279
|
__privateAdd$4(this, _updateRecordWithID);
|
2280
|
+
__privateAdd$4(this, _updateRecords);
|
1309
2281
|
__privateAdd$4(this, _upsertRecordWithID);
|
1310
2282
|
__privateAdd$4(this, _deleteRecord);
|
1311
|
-
__privateAdd$4(this,
|
1312
|
-
__privateAdd$4(this, _setCacheRecord);
|
1313
|
-
__privateAdd$4(this, _getCacheRecord);
|
2283
|
+
__privateAdd$4(this, _deleteRecords);
|
1314
2284
|
__privateAdd$4(this, _setCacheQuery);
|
1315
2285
|
__privateAdd$4(this, _getCacheQuery);
|
1316
2286
|
__privateAdd$4(this, _getSchemaTables$1);
|
1317
2287
|
__privateAdd$4(this, _table, void 0);
|
1318
2288
|
__privateAdd$4(this, _getFetchProps, void 0);
|
2289
|
+
__privateAdd$4(this, _db, void 0);
|
1319
2290
|
__privateAdd$4(this, _cache, void 0);
|
1320
2291
|
__privateAdd$4(this, _schemaTables$2, void 0);
|
2292
|
+
__privateAdd$4(this, _trace, void 0);
|
1321
2293
|
__privateSet$4(this, _table, options.table);
|
1322
|
-
__privateSet$4(this,
|
1323
|
-
this.db = options.db;
|
2294
|
+
__privateSet$4(this, _db, options.db);
|
1324
2295
|
__privateSet$4(this, _cache, options.pluginOptions.cache);
|
1325
2296
|
__privateSet$4(this, _schemaTables$2, options.schemaTables);
|
2297
|
+
__privateSet$4(this, _getFetchProps, async () => {
|
2298
|
+
const props = await options.pluginOptions.getFetchProps();
|
2299
|
+
return { ...props, sessionID: generateUUID() };
|
2300
|
+
});
|
2301
|
+
const trace = options.pluginOptions.trace ?? defaultTrace;
|
2302
|
+
__privateSet$4(this, _trace, async (name, fn, options2 = {}) => {
|
2303
|
+
return trace(name, fn, {
|
2304
|
+
...options2,
|
2305
|
+
[TraceAttributes.TABLE]: __privateGet$4(this, _table),
|
2306
|
+
[TraceAttributes.KIND]: "sdk-operation",
|
2307
|
+
[TraceAttributes.VERSION]: VERSION
|
2308
|
+
});
|
2309
|
+
});
|
1326
2310
|
}
|
1327
|
-
async create(a, b) {
|
1328
|
-
|
1329
|
-
|
1330
|
-
|
1331
|
-
|
1332
|
-
|
1333
|
-
|
1334
|
-
|
1335
|
-
|
1336
|
-
|
1337
|
-
|
1338
|
-
|
1339
|
-
|
1340
|
-
|
1341
|
-
|
1342
|
-
|
1343
|
-
|
1344
|
-
|
1345
|
-
|
1346
|
-
|
1347
|
-
|
1348
|
-
|
1349
|
-
|
1350
|
-
|
1351
|
-
|
1352
|
-
|
1353
|
-
|
1354
|
-
|
1355
|
-
|
1356
|
-
|
1357
|
-
|
1358
|
-
|
1359
|
-
|
1360
|
-
|
1361
|
-
|
1362
|
-
|
1363
|
-
|
1364
|
-
|
1365
|
-
|
1366
|
-
|
1367
|
-
|
1368
|
-
|
1369
|
-
|
1370
|
-
|
1371
|
-
|
1372
|
-
|
2311
|
+
async create(a, b, c, d) {
|
2312
|
+
return __privateGet$4(this, _trace).call(this, "create", async () => {
|
2313
|
+
const ifVersion = parseIfVersion(b, c, d);
|
2314
|
+
if (Array.isArray(a)) {
|
2315
|
+
if (a.length === 0)
|
2316
|
+
return [];
|
2317
|
+
const ids = await __privateMethod$2(this, _insertRecords, insertRecords_fn).call(this, a, { ifVersion, createOnly: true });
|
2318
|
+
const columns = isStringArray(b) ? b : ["*"];
|
2319
|
+
const result = await this.read(ids, columns);
|
2320
|
+
return result;
|
2321
|
+
}
|
2322
|
+
if (isString(a) && isObject(b)) {
|
2323
|
+
if (a === "")
|
2324
|
+
throw new Error("The id can't be empty");
|
2325
|
+
const columns = isStringArray(c) ? c : void 0;
|
2326
|
+
return await __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns, { createOnly: true, ifVersion });
|
2327
|
+
}
|
2328
|
+
if (isObject(a) && isString(a.id)) {
|
2329
|
+
if (a.id === "")
|
2330
|
+
throw new Error("The id can't be empty");
|
2331
|
+
const columns = isStringArray(b) ? b : void 0;
|
2332
|
+
return await __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns, { createOnly: true, ifVersion });
|
2333
|
+
}
|
2334
|
+
if (isObject(a)) {
|
2335
|
+
const columns = isStringArray(b) ? b : void 0;
|
2336
|
+
return __privateMethod$2(this, _insertRecordWithoutId, insertRecordWithoutId_fn).call(this, a, columns);
|
2337
|
+
}
|
2338
|
+
throw new Error("Invalid arguments for create method");
|
2339
|
+
});
|
2340
|
+
}
|
2341
|
+
async read(a, b) {
|
2342
|
+
return __privateGet$4(this, _trace).call(this, "read", async () => {
|
2343
|
+
const columns = isStringArray(b) ? b : ["*"];
|
2344
|
+
if (Array.isArray(a)) {
|
2345
|
+
if (a.length === 0)
|
2346
|
+
return [];
|
2347
|
+
const ids = a.map((item) => extractId(item));
|
2348
|
+
const finalObjects = await this.getAll({ filter: { id: { $any: compact(ids) } }, columns });
|
2349
|
+
const dictionary = finalObjects.reduce((acc, object) => {
|
2350
|
+
acc[object.id] = object;
|
2351
|
+
return acc;
|
2352
|
+
}, {});
|
2353
|
+
return ids.map((id2) => dictionary[id2 ?? ""] ?? null);
|
2354
|
+
}
|
2355
|
+
const id = extractId(a);
|
2356
|
+
if (id) {
|
2357
|
+
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2358
|
+
try {
|
2359
|
+
const response = await getRecord({
|
2360
|
+
pathParams: {
|
2361
|
+
workspace: "{workspaceId}",
|
2362
|
+
dbBranchName: "{dbBranch}",
|
2363
|
+
region: "{region}",
|
2364
|
+
tableName: __privateGet$4(this, _table),
|
2365
|
+
recordId: id
|
2366
|
+
},
|
2367
|
+
queryParams: { columns },
|
2368
|
+
...fetchProps
|
2369
|
+
});
|
2370
|
+
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
2371
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
2372
|
+
} catch (e) {
|
2373
|
+
if (isObject(e) && e.status === 404) {
|
2374
|
+
return null;
|
2375
|
+
}
|
2376
|
+
throw e;
|
2377
|
+
}
|
2378
|
+
}
|
2379
|
+
return null;
|
2380
|
+
});
|
2381
|
+
}
|
2382
|
+
async readOrThrow(a, b) {
|
2383
|
+
return __privateGet$4(this, _trace).call(this, "readOrThrow", async () => {
|
2384
|
+
const result = await this.read(a, b);
|
2385
|
+
if (Array.isArray(result)) {
|
2386
|
+
const missingIds = compact(
|
2387
|
+
a.filter((_item, index) => result[index] === null).map((item) => extractId(item))
|
2388
|
+
);
|
2389
|
+
if (missingIds.length > 0) {
|
2390
|
+
throw new Error(`Could not find records with ids: ${missingIds.join(", ")}`);
|
2391
|
+
}
|
2392
|
+
return result;
|
2393
|
+
}
|
2394
|
+
if (result === null) {
|
2395
|
+
const id = extractId(a) ?? "unknown";
|
2396
|
+
throw new Error(`Record with id ${id} not found`);
|
2397
|
+
}
|
2398
|
+
return result;
|
2399
|
+
});
|
2400
|
+
}
|
2401
|
+
async update(a, b, c, d) {
|
2402
|
+
return __privateGet$4(this, _trace).call(this, "update", async () => {
|
2403
|
+
const ifVersion = parseIfVersion(b, c, d);
|
2404
|
+
if (Array.isArray(a)) {
|
2405
|
+
if (a.length === 0)
|
2406
|
+
return [];
|
2407
|
+
const existing = await this.read(a, ["id"]);
|
2408
|
+
const updates = a.filter((_item, index) => existing[index] !== null);
|
2409
|
+
await __privateMethod$2(this, _updateRecords, updateRecords_fn).call(this, updates, {
|
2410
|
+
ifVersion,
|
2411
|
+
upsert: false
|
1373
2412
|
});
|
1374
|
-
const
|
1375
|
-
|
1376
|
-
|
1377
|
-
|
1378
|
-
|
2413
|
+
const columns = isStringArray(b) ? b : ["*"];
|
2414
|
+
const result = await this.read(a, columns);
|
2415
|
+
return result;
|
2416
|
+
}
|
2417
|
+
if (isString(a) && isObject(b)) {
|
2418
|
+
const columns = isStringArray(c) ? c : void 0;
|
2419
|
+
return __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a, b, columns, { ifVersion });
|
2420
|
+
}
|
2421
|
+
if (isObject(a) && isString(a.id)) {
|
2422
|
+
const columns = isStringArray(b) ? b : void 0;
|
2423
|
+
return __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns, { ifVersion });
|
2424
|
+
}
|
2425
|
+
throw new Error("Invalid arguments for update method");
|
2426
|
+
});
|
2427
|
+
}
|
2428
|
+
async updateOrThrow(a, b, c, d) {
|
2429
|
+
return __privateGet$4(this, _trace).call(this, "updateOrThrow", async () => {
|
2430
|
+
const result = await this.update(a, b, c, d);
|
2431
|
+
if (Array.isArray(result)) {
|
2432
|
+
const missingIds = compact(
|
2433
|
+
a.filter((_item, index) => result[index] === null).map((item) => extractId(item))
|
2434
|
+
);
|
2435
|
+
if (missingIds.length > 0) {
|
2436
|
+
throw new Error(`Could not find records with ids: ${missingIds.join(", ")}`);
|
1379
2437
|
}
|
1380
|
-
|
2438
|
+
return result;
|
1381
2439
|
}
|
1382
|
-
|
2440
|
+
if (result === null) {
|
2441
|
+
const id = extractId(a) ?? "unknown";
|
2442
|
+
throw new Error(`Record with id ${id} not found`);
|
2443
|
+
}
|
2444
|
+
return result;
|
2445
|
+
});
|
1383
2446
|
}
|
1384
|
-
async
|
1385
|
-
|
1386
|
-
|
1387
|
-
|
1388
|
-
|
1389
|
-
|
2447
|
+
async createOrUpdate(a, b, c, d) {
|
2448
|
+
return __privateGet$4(this, _trace).call(this, "createOrUpdate", async () => {
|
2449
|
+
const ifVersion = parseIfVersion(b, c, d);
|
2450
|
+
if (Array.isArray(a)) {
|
2451
|
+
if (a.length === 0)
|
2452
|
+
return [];
|
2453
|
+
await __privateMethod$2(this, _updateRecords, updateRecords_fn).call(this, a, {
|
2454
|
+
ifVersion,
|
2455
|
+
upsert: true
|
2456
|
+
});
|
2457
|
+
const columns = isStringArray(b) ? b : ["*"];
|
2458
|
+
const result = await this.read(a, columns);
|
2459
|
+
return result;
|
1390
2460
|
}
|
1391
|
-
|
1392
|
-
|
1393
|
-
|
1394
|
-
await __privateMethod$2(this, _invalidateCache, invalidateCache_fn).call(this, a);
|
1395
|
-
const record = await __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a, b);
|
1396
|
-
await __privateMethod$2(this, _setCacheRecord, setCacheRecord_fn).call(this, record);
|
1397
|
-
return record;
|
1398
|
-
}
|
1399
|
-
if (isObject(a) && isString(a.id)) {
|
1400
|
-
await __privateMethod$2(this, _invalidateCache, invalidateCache_fn).call(this, a.id);
|
1401
|
-
const record = await __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a.id, { ...a, id: void 0 });
|
1402
|
-
await __privateMethod$2(this, _setCacheRecord, setCacheRecord_fn).call(this, record);
|
1403
|
-
return record;
|
1404
|
-
}
|
1405
|
-
throw new Error("Invalid arguments for update method");
|
1406
|
-
}
|
1407
|
-
async createOrUpdate(a, b) {
|
1408
|
-
if (Array.isArray(a)) {
|
1409
|
-
if (a.length === 0)
|
1410
|
-
return [];
|
1411
|
-
if (a.length > 100) {
|
1412
|
-
console.warn("Bulk update operation is not optimized in the Xata API yet, this request might be slow");
|
2461
|
+
if (isString(a) && isObject(b)) {
|
2462
|
+
const columns = isStringArray(c) ? c : void 0;
|
2463
|
+
return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a, b, columns, { ifVersion });
|
1413
2464
|
}
|
1414
|
-
|
1415
|
-
|
1416
|
-
|
1417
|
-
await __privateMethod$2(this, _invalidateCache, invalidateCache_fn).call(this, a);
|
1418
|
-
const record = await __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a, b);
|
1419
|
-
await __privateMethod$2(this, _setCacheRecord, setCacheRecord_fn).call(this, record);
|
1420
|
-
return record;
|
1421
|
-
}
|
1422
|
-
if (isObject(a) && isString(a.id)) {
|
1423
|
-
await __privateMethod$2(this, _invalidateCache, invalidateCache_fn).call(this, a.id);
|
1424
|
-
const record = await __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a.id, { ...a, id: void 0 });
|
1425
|
-
await __privateMethod$2(this, _setCacheRecord, setCacheRecord_fn).call(this, record);
|
1426
|
-
return record;
|
1427
|
-
}
|
1428
|
-
throw new Error("Invalid arguments for createOrUpdate method");
|
1429
|
-
}
|
1430
|
-
async delete(a) {
|
1431
|
-
if (Array.isArray(a)) {
|
1432
|
-
if (a.length === 0)
|
1433
|
-
return;
|
1434
|
-
if (a.length > 100) {
|
1435
|
-
console.warn("Bulk delete operation is not optimized in the Xata API yet, this request might be slow");
|
2465
|
+
if (isObject(a) && isString(a.id)) {
|
2466
|
+
const columns = isStringArray(c) ? c : void 0;
|
2467
|
+
return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns, { ifVersion });
|
1436
2468
|
}
|
1437
|
-
|
1438
|
-
|
1439
|
-
|
1440
|
-
|
1441
|
-
|
1442
|
-
|
1443
|
-
|
1444
|
-
|
1445
|
-
|
1446
|
-
|
1447
|
-
|
1448
|
-
|
1449
|
-
|
1450
|
-
|
2469
|
+
throw new Error("Invalid arguments for createOrUpdate method");
|
2470
|
+
});
|
2471
|
+
}
|
2472
|
+
async createOrReplace(a, b, c, d) {
|
2473
|
+
return __privateGet$4(this, _trace).call(this, "createOrReplace", async () => {
|
2474
|
+
const ifVersion = parseIfVersion(b, c, d);
|
2475
|
+
if (Array.isArray(a)) {
|
2476
|
+
if (a.length === 0)
|
2477
|
+
return [];
|
2478
|
+
const ids = await __privateMethod$2(this, _insertRecords, insertRecords_fn).call(this, a, { ifVersion, createOnly: false });
|
2479
|
+
const columns = isStringArray(b) ? b : ["*"];
|
2480
|
+
const result = await this.read(ids, columns);
|
2481
|
+
return result;
|
2482
|
+
}
|
2483
|
+
if (isString(a) && isObject(b)) {
|
2484
|
+
const columns = isStringArray(c) ? c : void 0;
|
2485
|
+
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns, { createOnly: false, ifVersion });
|
2486
|
+
}
|
2487
|
+
if (isObject(a) && isString(a.id)) {
|
2488
|
+
const columns = isStringArray(c) ? c : void 0;
|
2489
|
+
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns, { createOnly: false, ifVersion });
|
2490
|
+
}
|
2491
|
+
throw new Error("Invalid arguments for createOrReplace method");
|
2492
|
+
});
|
2493
|
+
}
|
2494
|
+
async delete(a, b) {
|
2495
|
+
return __privateGet$4(this, _trace).call(this, "delete", async () => {
|
2496
|
+
if (Array.isArray(a)) {
|
2497
|
+
if (a.length === 0)
|
2498
|
+
return [];
|
2499
|
+
const ids = a.map((o) => {
|
2500
|
+
if (isString(o))
|
2501
|
+
return o;
|
2502
|
+
if (isString(o.id))
|
2503
|
+
return o.id;
|
2504
|
+
throw new Error("Invalid arguments for delete method");
|
2505
|
+
});
|
2506
|
+
const columns = isStringArray(b) ? b : ["*"];
|
2507
|
+
const result = await this.read(a, columns);
|
2508
|
+
await __privateMethod$2(this, _deleteRecords, deleteRecords_fn).call(this, ids);
|
2509
|
+
return result;
|
2510
|
+
}
|
2511
|
+
if (isString(a)) {
|
2512
|
+
return __privateMethod$2(this, _deleteRecord, deleteRecord_fn).call(this, a, b);
|
2513
|
+
}
|
2514
|
+
if (isObject(a) && isString(a.id)) {
|
2515
|
+
return __privateMethod$2(this, _deleteRecord, deleteRecord_fn).call(this, a.id, b);
|
2516
|
+
}
|
2517
|
+
throw new Error("Invalid arguments for delete method");
|
2518
|
+
});
|
2519
|
+
}
|
2520
|
+
async deleteOrThrow(a, b) {
|
2521
|
+
return __privateGet$4(this, _trace).call(this, "deleteOrThrow", async () => {
|
2522
|
+
const result = await this.delete(a, b);
|
2523
|
+
if (Array.isArray(result)) {
|
2524
|
+
const missingIds = compact(
|
2525
|
+
a.filter((_item, index) => result[index] === null).map((item) => extractId(item))
|
2526
|
+
);
|
2527
|
+
if (missingIds.length > 0) {
|
2528
|
+
throw new Error(`Could not find records with ids: ${missingIds.join(", ")}`);
|
2529
|
+
}
|
2530
|
+
return result;
|
2531
|
+
} else if (result === null) {
|
2532
|
+
const id = extractId(a) ?? "unknown";
|
2533
|
+
throw new Error(`Record with id ${id} not found`);
|
2534
|
+
}
|
2535
|
+
return result;
|
2536
|
+
});
|
1451
2537
|
}
|
1452
2538
|
async search(query, options = {}) {
|
1453
|
-
|
1454
|
-
|
1455
|
-
|
1456
|
-
|
1457
|
-
|
1458
|
-
|
1459
|
-
|
1460
|
-
|
1461
|
-
|
1462
|
-
|
2539
|
+
return __privateGet$4(this, _trace).call(this, "search", async () => {
|
2540
|
+
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2541
|
+
const { records } = await searchTable({
|
2542
|
+
pathParams: {
|
2543
|
+
workspace: "{workspaceId}",
|
2544
|
+
dbBranchName: "{dbBranch}",
|
2545
|
+
region: "{region}",
|
2546
|
+
tableName: __privateGet$4(this, _table)
|
2547
|
+
},
|
2548
|
+
body: {
|
2549
|
+
query,
|
2550
|
+
fuzziness: options.fuzziness,
|
2551
|
+
prefix: options.prefix,
|
2552
|
+
highlight: options.highlight,
|
2553
|
+
filter: options.filter,
|
2554
|
+
boosters: options.boosters
|
2555
|
+
},
|
2556
|
+
...fetchProps
|
2557
|
+
});
|
2558
|
+
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
2559
|
+
return records.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item, ["*"]));
|
2560
|
+
});
|
2561
|
+
}
|
2562
|
+
async aggregate(aggs, filter) {
|
2563
|
+
return __privateGet$4(this, _trace).call(this, "aggregate", async () => {
|
2564
|
+
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2565
|
+
const result = await aggregateTable({
|
2566
|
+
pathParams: {
|
2567
|
+
workspace: "{workspaceId}",
|
2568
|
+
dbBranchName: "{dbBranch}",
|
2569
|
+
region: "{region}",
|
2570
|
+
tableName: __privateGet$4(this, _table)
|
2571
|
+
},
|
2572
|
+
body: { aggs, filter },
|
2573
|
+
...fetchProps
|
2574
|
+
});
|
2575
|
+
return result;
|
1463
2576
|
});
|
1464
|
-
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1465
|
-
return records.map((item) => initObject(this.db, schemaTables, __privateGet$4(this, _table), item));
|
1466
2577
|
}
|
1467
2578
|
async query(query) {
|
1468
|
-
|
1469
|
-
|
1470
|
-
|
1471
|
-
|
1472
|
-
|
1473
|
-
|
1474
|
-
|
1475
|
-
|
1476
|
-
|
1477
|
-
|
1478
|
-
|
1479
|
-
|
1480
|
-
|
1481
|
-
|
1482
|
-
|
2579
|
+
return __privateGet$4(this, _trace).call(this, "query", async () => {
|
2580
|
+
const cacheQuery = await __privateMethod$2(this, _getCacheQuery, getCacheQuery_fn).call(this, query);
|
2581
|
+
if (cacheQuery)
|
2582
|
+
return new Page(query, cacheQuery.meta, cacheQuery.records);
|
2583
|
+
const data = query.getQueryOptions();
|
2584
|
+
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2585
|
+
const { meta, records: objects } = await queryTable({
|
2586
|
+
pathParams: {
|
2587
|
+
workspace: "{workspaceId}",
|
2588
|
+
dbBranchName: "{dbBranch}",
|
2589
|
+
region: "{region}",
|
2590
|
+
tableName: __privateGet$4(this, _table)
|
2591
|
+
},
|
2592
|
+
body: {
|
2593
|
+
filter: cleanFilter(data.filter),
|
2594
|
+
sort: data.sort !== void 0 ? buildSortFilter(data.sort) : void 0,
|
2595
|
+
page: data.pagination,
|
2596
|
+
columns: data.columns ?? ["*"]
|
2597
|
+
},
|
2598
|
+
fetchOptions: data.fetchOptions,
|
2599
|
+
...fetchProps
|
2600
|
+
});
|
2601
|
+
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
2602
|
+
const records = objects.map(
|
2603
|
+
(record) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), record, data.columns ?? ["*"])
|
2604
|
+
);
|
2605
|
+
await __privateMethod$2(this, _setCacheQuery, setCacheQuery_fn).call(this, query, meta, records);
|
2606
|
+
return new Page(query, meta, records);
|
2607
|
+
});
|
2608
|
+
}
|
2609
|
+
async summarizeTable(query, summaries, summariesFilter) {
|
2610
|
+
return __privateGet$4(this, _trace).call(this, "summarize", async () => {
|
2611
|
+
const data = query.getQueryOptions();
|
2612
|
+
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2613
|
+
const result = await summarizeTable({
|
2614
|
+
pathParams: {
|
2615
|
+
workspace: "{workspaceId}",
|
2616
|
+
dbBranchName: "{dbBranch}",
|
2617
|
+
region: "{region}",
|
2618
|
+
tableName: __privateGet$4(this, _table)
|
2619
|
+
},
|
2620
|
+
body: {
|
2621
|
+
filter: cleanFilter(data.filter),
|
2622
|
+
sort: data.sort !== void 0 ? buildSortFilter(data.sort) : void 0,
|
2623
|
+
columns: data.columns,
|
2624
|
+
page: data.pagination?.size !== void 0 ? { size: data.pagination?.size } : void 0,
|
2625
|
+
summaries,
|
2626
|
+
summariesFilter
|
2627
|
+
},
|
2628
|
+
...fetchProps
|
2629
|
+
});
|
2630
|
+
return result;
|
1483
2631
|
});
|
1484
|
-
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1485
|
-
const records = objects.map((record) => initObject(this.db, schemaTables, __privateGet$4(this, _table), record));
|
1486
|
-
await __privateMethod$2(this, _setCacheQuery, setCacheQuery_fn).call(this, query, meta, records);
|
1487
|
-
return new Page(query, meta, records);
|
1488
2632
|
}
|
1489
2633
|
}
|
1490
2634
|
_table = new WeakMap();
|
1491
2635
|
_getFetchProps = new WeakMap();
|
2636
|
+
_db = new WeakMap();
|
1492
2637
|
_cache = new WeakMap();
|
1493
2638
|
_schemaTables$2 = new WeakMap();
|
2639
|
+
_trace = new WeakMap();
|
1494
2640
|
_insertRecordWithoutId = new WeakSet();
|
1495
|
-
insertRecordWithoutId_fn = async function(object) {
|
2641
|
+
insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
|
1496
2642
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1497
2643
|
const record = transformObjectLinks(object);
|
1498
2644
|
const response = await insertRecord({
|
1499
2645
|
pathParams: {
|
1500
2646
|
workspace: "{workspaceId}",
|
1501
2647
|
dbBranchName: "{dbBranch}",
|
2648
|
+
region: "{region}",
|
1502
2649
|
tableName: __privateGet$4(this, _table)
|
1503
2650
|
},
|
2651
|
+
queryParams: { columns },
|
1504
2652
|
body: record,
|
1505
2653
|
...fetchProps
|
1506
2654
|
});
|
1507
|
-
const
|
1508
|
-
|
1509
|
-
throw new Error("The server failed to save the record");
|
1510
|
-
}
|
1511
|
-
return finalObject;
|
2655
|
+
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
2656
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
1512
2657
|
};
|
1513
2658
|
_insertRecordWithId = new WeakSet();
|
1514
|
-
insertRecordWithId_fn = async function(recordId, object) {
|
2659
|
+
insertRecordWithId_fn = async function(recordId, object, columns = ["*"], { createOnly, ifVersion }) {
|
1515
2660
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1516
2661
|
const record = transformObjectLinks(object);
|
1517
2662
|
const response = await insertRecordWithID({
|
1518
2663
|
pathParams: {
|
1519
2664
|
workspace: "{workspaceId}",
|
1520
2665
|
dbBranchName: "{dbBranch}",
|
2666
|
+
region: "{region}",
|
1521
2667
|
tableName: __privateGet$4(this, _table),
|
1522
2668
|
recordId
|
1523
2669
|
},
|
1524
2670
|
body: record,
|
1525
|
-
queryParams: { createOnly
|
2671
|
+
queryParams: { createOnly, columns, ifVersion },
|
1526
2672
|
...fetchProps
|
1527
2673
|
});
|
1528
|
-
const
|
1529
|
-
|
1530
|
-
throw new Error("The server failed to save the record");
|
1531
|
-
}
|
1532
|
-
return finalObject;
|
2674
|
+
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
2675
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
1533
2676
|
};
|
1534
|
-
|
1535
|
-
|
2677
|
+
_insertRecords = new WeakSet();
|
2678
|
+
insertRecords_fn = async function(objects, { createOnly, ifVersion }) {
|
1536
2679
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1537
|
-
const
|
1538
|
-
|
1539
|
-
|
1540
|
-
|
1541
|
-
|
1542
|
-
|
1543
|
-
const
|
1544
|
-
|
1545
|
-
|
2680
|
+
const chunkedOperations = chunk(
|
2681
|
+
objects.map((object) => ({
|
2682
|
+
insert: { table: __privateGet$4(this, _table), record: transformObjectLinks(object), createOnly, ifVersion }
|
2683
|
+
})),
|
2684
|
+
BULK_OPERATION_MAX_SIZE
|
2685
|
+
);
|
2686
|
+
const ids = [];
|
2687
|
+
for (const operations of chunkedOperations) {
|
2688
|
+
const { results } = await branchTransaction({
|
2689
|
+
pathParams: {
|
2690
|
+
workspace: "{workspaceId}",
|
2691
|
+
dbBranchName: "{dbBranch}",
|
2692
|
+
region: "{region}"
|
2693
|
+
},
|
2694
|
+
body: { operations },
|
2695
|
+
...fetchProps
|
2696
|
+
});
|
2697
|
+
for (const result of results) {
|
2698
|
+
if (result.operation === "insert") {
|
2699
|
+
ids.push(result.id);
|
2700
|
+
} else {
|
2701
|
+
ids.push(null);
|
2702
|
+
}
|
2703
|
+
}
|
1546
2704
|
}
|
1547
|
-
|
1548
|
-
acc[object.id] = object;
|
1549
|
-
return acc;
|
1550
|
-
}, {});
|
1551
|
-
return recordIDs.map((id) => dictionary[id]);
|
2705
|
+
return ids;
|
1552
2706
|
};
|
1553
2707
|
_updateRecordWithID = new WeakSet();
|
1554
|
-
updateRecordWithID_fn = async function(recordId, object) {
|
2708
|
+
updateRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVersion }) {
|
1555
2709
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1556
|
-
const record = transformObjectLinks(object);
|
1557
|
-
|
1558
|
-
|
1559
|
-
|
1560
|
-
|
1561
|
-
|
1562
|
-
|
1563
|
-
|
1564
|
-
|
1565
|
-
|
2710
|
+
const { id: _id, ...record } = transformObjectLinks(object);
|
2711
|
+
try {
|
2712
|
+
const response = await updateRecordWithID({
|
2713
|
+
pathParams: {
|
2714
|
+
workspace: "{workspaceId}",
|
2715
|
+
dbBranchName: "{dbBranch}",
|
2716
|
+
region: "{region}",
|
2717
|
+
tableName: __privateGet$4(this, _table),
|
2718
|
+
recordId
|
2719
|
+
},
|
2720
|
+
queryParams: { columns, ifVersion },
|
2721
|
+
body: record,
|
2722
|
+
...fetchProps
|
2723
|
+
});
|
2724
|
+
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
2725
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
2726
|
+
} catch (e) {
|
2727
|
+
if (isObject(e) && e.status === 404) {
|
2728
|
+
return null;
|
2729
|
+
}
|
2730
|
+
throw e;
|
2731
|
+
}
|
2732
|
+
};
|
2733
|
+
_updateRecords = new WeakSet();
|
2734
|
+
updateRecords_fn = async function(objects, { ifVersion, upsert }) {
|
2735
|
+
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2736
|
+
const chunkedOperations = chunk(
|
2737
|
+
objects.map(({ id, ...object }) => ({
|
2738
|
+
update: { table: __privateGet$4(this, _table), id, ifVersion, upsert, fields: transformObjectLinks(object) }
|
2739
|
+
})),
|
2740
|
+
BULK_OPERATION_MAX_SIZE
|
2741
|
+
);
|
2742
|
+
const ids = [];
|
2743
|
+
for (const operations of chunkedOperations) {
|
2744
|
+
const { results } = await branchTransaction({
|
2745
|
+
pathParams: {
|
2746
|
+
workspace: "{workspaceId}",
|
2747
|
+
dbBranchName: "{dbBranch}",
|
2748
|
+
region: "{region}"
|
2749
|
+
},
|
2750
|
+
body: { operations },
|
2751
|
+
...fetchProps
|
2752
|
+
});
|
2753
|
+
for (const result of results) {
|
2754
|
+
if (result.operation === "update") {
|
2755
|
+
ids.push(result.id);
|
2756
|
+
} else {
|
2757
|
+
ids.push(null);
|
2758
|
+
}
|
2759
|
+
}
|
2760
|
+
}
|
2761
|
+
return ids;
|
1566
2762
|
};
|
1567
2763
|
_upsertRecordWithID = new WeakSet();
|
1568
|
-
upsertRecordWithID_fn = async function(recordId, object) {
|
2764
|
+
upsertRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVersion }) {
|
1569
2765
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1570
2766
|
const response = await upsertRecordWithID({
|
1571
|
-
pathParams: {
|
2767
|
+
pathParams: {
|
2768
|
+
workspace: "{workspaceId}",
|
2769
|
+
dbBranchName: "{dbBranch}",
|
2770
|
+
region: "{region}",
|
2771
|
+
tableName: __privateGet$4(this, _table),
|
2772
|
+
recordId
|
2773
|
+
},
|
2774
|
+
queryParams: { columns, ifVersion },
|
1572
2775
|
body: object,
|
1573
2776
|
...fetchProps
|
1574
2777
|
});
|
1575
|
-
const
|
1576
|
-
|
1577
|
-
throw new Error("The server failed to save the record");
|
1578
|
-
return item;
|
2778
|
+
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
2779
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
1579
2780
|
};
|
1580
2781
|
_deleteRecord = new WeakSet();
|
1581
|
-
deleteRecord_fn = async function(recordId) {
|
2782
|
+
deleteRecord_fn = async function(recordId, columns = ["*"]) {
|
1582
2783
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1583
|
-
|
1584
|
-
|
1585
|
-
|
1586
|
-
|
2784
|
+
try {
|
2785
|
+
const response = await deleteRecord({
|
2786
|
+
pathParams: {
|
2787
|
+
workspace: "{workspaceId}",
|
2788
|
+
dbBranchName: "{dbBranch}",
|
2789
|
+
region: "{region}",
|
2790
|
+
tableName: __privateGet$4(this, _table),
|
2791
|
+
recordId
|
2792
|
+
},
|
2793
|
+
queryParams: { columns },
|
2794
|
+
...fetchProps
|
2795
|
+
});
|
2796
|
+
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
2797
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
2798
|
+
} catch (e) {
|
2799
|
+
if (isObject(e) && e.status === 404) {
|
2800
|
+
return null;
|
2801
|
+
}
|
2802
|
+
throw e;
|
2803
|
+
}
|
1587
2804
|
};
|
1588
|
-
|
1589
|
-
|
1590
|
-
await __privateGet$4(this,
|
1591
|
-
const
|
1592
|
-
|
1593
|
-
|
1594
|
-
|
1595
|
-
|
1596
|
-
|
1597
|
-
|
1598
|
-
}
|
1599
|
-
|
1600
|
-
|
1601
|
-
|
1602
|
-
|
1603
|
-
|
1604
|
-
};
|
1605
|
-
|
1606
|
-
getCacheRecord_fn = async function(recordId) {
|
1607
|
-
if (!__privateGet$4(this, _cache).cacheRecords)
|
1608
|
-
return null;
|
1609
|
-
return __privateGet$4(this, _cache).get(`rec_${__privateGet$4(this, _table)}:${recordId}`);
|
2805
|
+
_deleteRecords = new WeakSet();
|
2806
|
+
deleteRecords_fn = async function(recordIds) {
|
2807
|
+
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2808
|
+
const chunkedOperations = chunk(
|
2809
|
+
recordIds.map((id) => ({ delete: { table: __privateGet$4(this, _table), id } })),
|
2810
|
+
BULK_OPERATION_MAX_SIZE
|
2811
|
+
);
|
2812
|
+
for (const operations of chunkedOperations) {
|
2813
|
+
await branchTransaction({
|
2814
|
+
pathParams: {
|
2815
|
+
workspace: "{workspaceId}",
|
2816
|
+
dbBranchName: "{dbBranch}",
|
2817
|
+
region: "{region}"
|
2818
|
+
},
|
2819
|
+
body: { operations },
|
2820
|
+
...fetchProps
|
2821
|
+
});
|
2822
|
+
}
|
1610
2823
|
};
|
1611
2824
|
_setCacheQuery = new WeakSet();
|
1612
2825
|
setCacheQuery_fn = async function(query, meta, records) {
|
@@ -1630,7 +2843,7 @@ getSchemaTables_fn$1 = async function() {
|
|
1630
2843
|
return __privateGet$4(this, _schemaTables$2);
|
1631
2844
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1632
2845
|
const { schema } = await getBranchDetails({
|
1633
|
-
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}" },
|
2846
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
1634
2847
|
...fetchProps
|
1635
2848
|
});
|
1636
2849
|
__privateSet$4(this, _schemaTables$2, schema.tables);
|
@@ -1643,7 +2856,7 @@ const transformObjectLinks = (object) => {
|
|
1643
2856
|
return { ...acc, [key]: isIdentifiable(value) ? value.id : value };
|
1644
2857
|
}, {});
|
1645
2858
|
};
|
1646
|
-
const initObject = (db, schemaTables, table, object) => {
|
2859
|
+
const initObject = (db, schemaTables, table, object, selectedColumns) => {
|
1647
2860
|
const result = {};
|
1648
2861
|
const { xata, ...rest } = object ?? {};
|
1649
2862
|
Object.assign(result, rest);
|
@@ -1651,13 +2864,15 @@ const initObject = (db, schemaTables, table, object) => {
|
|
1651
2864
|
if (!columns)
|
1652
2865
|
console.error(`Table ${table} not found in schema`);
|
1653
2866
|
for (const column of columns ?? []) {
|
2867
|
+
if (!isValidColumn(selectedColumns, column))
|
2868
|
+
continue;
|
1654
2869
|
const value = result[column.name];
|
1655
2870
|
switch (column.type) {
|
1656
2871
|
case "datetime": {
|
1657
|
-
const date = value !== void 0 ? new Date(value) :
|
1658
|
-
if (date && isNaN(date.getTime())) {
|
2872
|
+
const date = value !== void 0 ? new Date(value) : null;
|
2873
|
+
if (date !== null && isNaN(date.getTime())) {
|
1659
2874
|
console.error(`Failed to parse date ${value} for field ${column.name}`);
|
1660
|
-
} else
|
2875
|
+
} else {
|
1661
2876
|
result[column.name] = date;
|
1662
2877
|
}
|
1663
2878
|
break;
|
@@ -1667,17 +2882,42 @@ const initObject = (db, schemaTables, table, object) => {
|
|
1667
2882
|
if (!linkTable) {
|
1668
2883
|
console.error(`Failed to parse link for field ${column.name}`);
|
1669
2884
|
} else if (isObject(value)) {
|
1670
|
-
|
2885
|
+
const selectedLinkColumns = selectedColumns.reduce((acc, item) => {
|
2886
|
+
if (item === column.name) {
|
2887
|
+
return [...acc, "*"];
|
2888
|
+
}
|
2889
|
+
if (item.startsWith(`${column.name}.`)) {
|
2890
|
+
const [, ...path] = item.split(".");
|
2891
|
+
return [...acc, path.join(".")];
|
2892
|
+
}
|
2893
|
+
return acc;
|
2894
|
+
}, []);
|
2895
|
+
result[column.name] = initObject(db, schemaTables, linkTable, value, selectedLinkColumns);
|
2896
|
+
} else {
|
2897
|
+
result[column.name] = null;
|
1671
2898
|
}
|
1672
2899
|
break;
|
1673
2900
|
}
|
2901
|
+
default:
|
2902
|
+
result[column.name] = value ?? null;
|
2903
|
+
if (column.notNull === true && value === null) {
|
2904
|
+
console.error(`Parse error, column ${column.name} is non nullable and value resolves null`);
|
2905
|
+
}
|
2906
|
+
break;
|
1674
2907
|
}
|
1675
2908
|
}
|
1676
|
-
result.read = function() {
|
1677
|
-
return db[table].read(result["id"]);
|
2909
|
+
result.read = function(columns2) {
|
2910
|
+
return db[table].read(result["id"], columns2);
|
1678
2911
|
};
|
1679
|
-
result.update = function(data) {
|
1680
|
-
|
2912
|
+
result.update = function(data, b, c) {
|
2913
|
+
const columns2 = isStringArray(b) ? b : ["*"];
|
2914
|
+
const ifVersion = parseIfVersion(b, c);
|
2915
|
+
return db[table].update(result["id"], data, columns2, { ifVersion });
|
2916
|
+
};
|
2917
|
+
result.replace = function(data, b, c) {
|
2918
|
+
const columns2 = isStringArray(b) ? b : ["*"];
|
2919
|
+
const ifVersion = parseIfVersion(b, c);
|
2920
|
+
return db[table].createOrReplace(result["id"], data, columns2, { ifVersion });
|
1681
2921
|
};
|
1682
2922
|
result.delete = function() {
|
1683
2923
|
return db[table].delete(result["id"]);
|
@@ -1685,20 +2925,35 @@ const initObject = (db, schemaTables, table, object) => {
|
|
1685
2925
|
result.getMetadata = function() {
|
1686
2926
|
return xata;
|
1687
2927
|
};
|
1688
|
-
for (const prop of ["read", "update", "delete", "getMetadata"]) {
|
2928
|
+
for (const prop of ["read", "update", "replace", "delete", "getMetadata"]) {
|
1689
2929
|
Object.defineProperty(result, prop, { enumerable: false });
|
1690
2930
|
}
|
1691
2931
|
Object.freeze(result);
|
1692
2932
|
return result;
|
1693
2933
|
};
|
1694
|
-
function
|
1695
|
-
if (
|
1696
|
-
return value
|
2934
|
+
function extractId(value) {
|
2935
|
+
if (isString(value))
|
2936
|
+
return value;
|
2937
|
+
if (isObject(value) && isString(value.id))
|
2938
|
+
return value.id;
|
2939
|
+
return void 0;
|
2940
|
+
}
|
2941
|
+
function isValidColumn(columns, column) {
|
2942
|
+
if (columns.includes("*"))
|
2943
|
+
return true;
|
2944
|
+
if (column.type === "link") {
|
2945
|
+
const linkColumns = columns.filter((item) => item.startsWith(column.name));
|
2946
|
+
return linkColumns.length > 0;
|
2947
|
+
}
|
2948
|
+
return columns.includes(column.name);
|
2949
|
+
}
|
2950
|
+
function parseIfVersion(...args) {
|
2951
|
+
for (const arg of args) {
|
2952
|
+
if (isObject(arg) && isNumber(arg.ifVersion)) {
|
2953
|
+
return arg.ifVersion;
|
2954
|
+
}
|
1697
2955
|
}
|
1698
|
-
|
1699
|
-
return [];
|
1700
|
-
const nestedIds = Object.values(value).map((item) => getIds(item)).flat();
|
1701
|
-
return isString(value.id) ? [value.id, ...nestedIds] : nestedIds;
|
2956
|
+
return void 0;
|
1702
2957
|
}
|
1703
2958
|
|
1704
2959
|
var __accessCheck$3 = (obj, member, msg) => {
|
@@ -1725,7 +2980,6 @@ class SimpleCache {
|
|
1725
2980
|
__privateAdd$3(this, _map, void 0);
|
1726
2981
|
__privateSet$3(this, _map, /* @__PURE__ */ new Map());
|
1727
2982
|
this.capacity = options.max ?? 500;
|
1728
|
-
this.cacheRecords = options.cacheRecords ?? true;
|
1729
2983
|
this.defaultQueryTTL = options.defaultQueryTTL ?? 60 * 1e3;
|
1730
2984
|
}
|
1731
2985
|
async getAll() {
|
@@ -1751,18 +3005,25 @@ class SimpleCache {
|
|
1751
3005
|
}
|
1752
3006
|
_map = new WeakMap();
|
1753
3007
|
|
1754
|
-
const
|
1755
|
-
const
|
1756
|
-
const
|
1757
|
-
const
|
1758
|
-
const
|
1759
|
-
const
|
3008
|
+
const greaterThan = (value) => ({ $gt: value });
|
3009
|
+
const gt = greaterThan;
|
3010
|
+
const greaterThanEquals = (value) => ({ $ge: value });
|
3011
|
+
const greaterEquals = greaterThanEquals;
|
3012
|
+
const gte = greaterThanEquals;
|
3013
|
+
const ge = greaterThanEquals;
|
3014
|
+
const lessThan = (value) => ({ $lt: value });
|
3015
|
+
const lt = lessThan;
|
3016
|
+
const lessThanEquals = (value) => ({ $le: value });
|
3017
|
+
const lessEquals = lessThanEquals;
|
3018
|
+
const lte = lessThanEquals;
|
3019
|
+
const le = lessThanEquals;
|
1760
3020
|
const exists = (column) => ({ $exists: column });
|
1761
3021
|
const notExists = (column) => ({ $notExists: column });
|
1762
3022
|
const startsWith = (value) => ({ $startsWith: value });
|
1763
3023
|
const endsWith = (value) => ({ $endsWith: value });
|
1764
3024
|
const pattern = (value) => ({ $pattern: value });
|
1765
3025
|
const is = (value) => ({ $is: value });
|
3026
|
+
const equals = is;
|
1766
3027
|
const isNot = (value) => ({ $isNot: value });
|
1767
3028
|
const contains = (value) => ({ $contains: value });
|
1768
3029
|
const includes = (value) => ({ $includes: value });
|
@@ -1797,16 +3058,19 @@ class SchemaPlugin extends XataPlugin {
|
|
1797
3058
|
__privateSet$2(this, _schemaTables$1, schemaTables);
|
1798
3059
|
}
|
1799
3060
|
build(pluginOptions) {
|
1800
|
-
const db = new Proxy(
|
1801
|
-
|
1802
|
-
|
1803
|
-
|
1804
|
-
|
1805
|
-
|
3061
|
+
const db = new Proxy(
|
3062
|
+
{},
|
3063
|
+
{
|
3064
|
+
get: (_target, table) => {
|
3065
|
+
if (!isString(table))
|
3066
|
+
throw new Error("Invalid table name");
|
3067
|
+
if (__privateGet$2(this, _tables)[table] === void 0) {
|
3068
|
+
__privateGet$2(this, _tables)[table] = new RestRepository({ db, pluginOptions, table, schemaTables: __privateGet$2(this, _schemaTables$1) });
|
3069
|
+
}
|
3070
|
+
return __privateGet$2(this, _tables)[table];
|
1806
3071
|
}
|
1807
|
-
return __privateGet$2(this, _tables)[table];
|
1808
3072
|
}
|
1809
|
-
|
3073
|
+
);
|
1810
3074
|
const tableNames = __privateGet$2(this, _schemaTables$1)?.map(({ name }) => name) ?? [];
|
1811
3075
|
for (const table of tableNames) {
|
1812
3076
|
db[table] = new RestRepository({ db, pluginOptions, table, schemaTables: __privateGet$2(this, _schemaTables$1) });
|
@@ -1856,7 +3120,7 @@ class SearchPlugin extends XataPlugin {
|
|
1856
3120
|
const schemaTables = await __privateMethod$1(this, _getSchemaTables, getSchemaTables_fn).call(this, getFetchProps);
|
1857
3121
|
return records.map((record) => {
|
1858
3122
|
const { table = "orphan" } = record.xata;
|
1859
|
-
return { table, record: initObject(this.db, schemaTables, table, record) };
|
3123
|
+
return { table, record: initObject(this.db, schemaTables, table, record, ["*"]) };
|
1860
3124
|
});
|
1861
3125
|
},
|
1862
3126
|
byTable: async (query, options = {}) => {
|
@@ -1865,7 +3129,7 @@ class SearchPlugin extends XataPlugin {
|
|
1865
3129
|
return records.reduce((acc, record) => {
|
1866
3130
|
const { table = "orphan" } = record.xata;
|
1867
3131
|
const items = acc[table] ?? [];
|
1868
|
-
const item = initObject(this.db, schemaTables, table, record);
|
3132
|
+
const item = initObject(this.db, schemaTables, table, record, ["*"]);
|
1869
3133
|
return { ...acc, [table]: [...items, item] };
|
1870
3134
|
}, {});
|
1871
3135
|
}
|
@@ -1876,10 +3140,10 @@ _schemaTables = new WeakMap();
|
|
1876
3140
|
_search = new WeakSet();
|
1877
3141
|
search_fn = async function(query, options, getFetchProps) {
|
1878
3142
|
const fetchProps = await getFetchProps();
|
1879
|
-
const { tables, fuzziness, highlight } = options ?? {};
|
3143
|
+
const { tables, fuzziness, highlight, prefix } = options ?? {};
|
1880
3144
|
const { records } = await searchBranch({
|
1881
|
-
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}" },
|
1882
|
-
body: { tables, query, fuzziness, highlight },
|
3145
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
3146
|
+
body: { tables, query, fuzziness, prefix, highlight },
|
1883
3147
|
...fetchProps
|
1884
3148
|
});
|
1885
3149
|
return records;
|
@@ -1890,13 +3154,29 @@ getSchemaTables_fn = async function(getFetchProps) {
|
|
1890
3154
|
return __privateGet$1(this, _schemaTables);
|
1891
3155
|
const fetchProps = await getFetchProps();
|
1892
3156
|
const { schema } = await getBranchDetails({
|
1893
|
-
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}" },
|
3157
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
1894
3158
|
...fetchProps
|
1895
3159
|
});
|
1896
3160
|
__privateSet$1(this, _schemaTables, schema.tables);
|
1897
3161
|
return schema.tables;
|
1898
3162
|
};
|
1899
3163
|
|
3164
|
+
class TransactionPlugin extends XataPlugin {
|
3165
|
+
build({ getFetchProps }) {
|
3166
|
+
return {
|
3167
|
+
run: async (operations) => {
|
3168
|
+
const fetchProps = await getFetchProps();
|
3169
|
+
const response = await branchTransaction({
|
3170
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
3171
|
+
body: { operations },
|
3172
|
+
...fetchProps
|
3173
|
+
});
|
3174
|
+
return response;
|
3175
|
+
}
|
3176
|
+
};
|
3177
|
+
}
|
3178
|
+
}
|
3179
|
+
|
1900
3180
|
const isBranchStrategyBuilder = (strategy) => {
|
1901
3181
|
return typeof strategy === "function";
|
1902
3182
|
};
|
@@ -1920,19 +3200,27 @@ async function resolveXataBranch(gitBranch, options) {
|
|
1920
3200
|
const databaseURL = options?.databaseURL || getDatabaseURL();
|
1921
3201
|
const apiKey = options?.apiKey || getAPIKey();
|
1922
3202
|
if (!databaseURL)
|
1923
|
-
throw new Error(
|
3203
|
+
throw new Error(
|
3204
|
+
"A databaseURL was not defined. Either set the XATA_DATABASE_URL env variable or pass the argument explicitely"
|
3205
|
+
);
|
1924
3206
|
if (!apiKey)
|
1925
|
-
throw new Error(
|
3207
|
+
throw new Error(
|
3208
|
+
"An API key was not defined. Either set the XATA_API_KEY env variable or pass the argument explicitely"
|
3209
|
+
);
|
1926
3210
|
const [protocol, , host, , dbName] = databaseURL.split("/");
|
1927
|
-
const
|
3211
|
+
const urlParts = parseWorkspacesUrlParts(host);
|
3212
|
+
if (!urlParts)
|
3213
|
+
throw new Error(`Unable to parse workspace and region: ${databaseURL}`);
|
3214
|
+
const { workspace, region } = urlParts;
|
1928
3215
|
const { fallbackBranch } = getEnvironment();
|
1929
3216
|
const { branch } = await resolveBranch({
|
1930
3217
|
apiKey,
|
1931
3218
|
apiUrl: databaseURL,
|
1932
3219
|
fetchImpl: getFetchImplementation(options?.fetchImpl),
|
1933
3220
|
workspacesApiUrl: `${protocol}//${host}`,
|
1934
|
-
pathParams: { dbName, workspace },
|
1935
|
-
queryParams: { gitBranch, fallbackBranch }
|
3221
|
+
pathParams: { dbName, workspace, region },
|
3222
|
+
queryParams: { gitBranch, fallbackBranch },
|
3223
|
+
trace: defaultTrace
|
1936
3224
|
});
|
1937
3225
|
return branch;
|
1938
3226
|
}
|
@@ -1940,19 +3228,26 @@ async function getDatabaseBranch(branch, options) {
|
|
1940
3228
|
const databaseURL = options?.databaseURL || getDatabaseURL();
|
1941
3229
|
const apiKey = options?.apiKey || getAPIKey();
|
1942
3230
|
if (!databaseURL)
|
1943
|
-
throw new Error(
|
3231
|
+
throw new Error(
|
3232
|
+
"A databaseURL was not defined. Either set the XATA_DATABASE_URL env variable or pass the argument explicitely"
|
3233
|
+
);
|
1944
3234
|
if (!apiKey)
|
1945
|
-
throw new Error(
|
3235
|
+
throw new Error(
|
3236
|
+
"An API key was not defined. Either set the XATA_API_KEY env variable or pass the argument explicitely"
|
3237
|
+
);
|
1946
3238
|
const [protocol, , host, , database] = databaseURL.split("/");
|
1947
|
-
const
|
1948
|
-
|
3239
|
+
const urlParts = parseWorkspacesUrlParts(host);
|
3240
|
+
if (!urlParts)
|
3241
|
+
throw new Error(`Unable to parse workspace and region: ${databaseURL}`);
|
3242
|
+
const { workspace, region } = urlParts;
|
1949
3243
|
try {
|
1950
3244
|
return await getBranchDetails({
|
1951
3245
|
apiKey,
|
1952
3246
|
apiUrl: databaseURL,
|
1953
3247
|
fetchImpl: getFetchImplementation(options?.fetchImpl),
|
1954
3248
|
workspacesApiUrl: `${protocol}//${host}`,
|
1955
|
-
pathParams: { dbBranchName
|
3249
|
+
pathParams: { dbBranchName: `${database}:${branch}`, workspace, region },
|
3250
|
+
trace: defaultTrace
|
1956
3251
|
});
|
1957
3252
|
} catch (err) {
|
1958
3253
|
if (isObject(err) && err.status === 404)
|
@@ -1992,22 +3287,27 @@ var __privateMethod = (obj, member, method) => {
|
|
1992
3287
|
return method;
|
1993
3288
|
};
|
1994
3289
|
const buildClient = (plugins) => {
|
1995
|
-
var _branch, _parseOptions, parseOptions_fn, _getFetchProps, getFetchProps_fn, _evaluateBranch, evaluateBranch_fn, _a;
|
3290
|
+
var _branch, _options, _parseOptions, parseOptions_fn, _getFetchProps, getFetchProps_fn, _evaluateBranch, evaluateBranch_fn, _a;
|
1996
3291
|
return _a = class {
|
1997
3292
|
constructor(options = {}, schemaTables) {
|
1998
3293
|
__privateAdd(this, _parseOptions);
|
1999
3294
|
__privateAdd(this, _getFetchProps);
|
2000
3295
|
__privateAdd(this, _evaluateBranch);
|
2001
3296
|
__privateAdd(this, _branch, void 0);
|
3297
|
+
__privateAdd(this, _options, void 0);
|
2002
3298
|
const safeOptions = __privateMethod(this, _parseOptions, parseOptions_fn).call(this, options);
|
3299
|
+
__privateSet(this, _options, safeOptions);
|
2003
3300
|
const pluginOptions = {
|
2004
3301
|
getFetchProps: () => __privateMethod(this, _getFetchProps, getFetchProps_fn).call(this, safeOptions),
|
2005
|
-
cache: safeOptions.cache
|
3302
|
+
cache: safeOptions.cache,
|
3303
|
+
trace: safeOptions.trace
|
2006
3304
|
};
|
2007
3305
|
const db = new SchemaPlugin(schemaTables).build(pluginOptions);
|
2008
3306
|
const search = new SearchPlugin(db, schemaTables).build(pluginOptions);
|
3307
|
+
const transactions = new TransactionPlugin().build(pluginOptions);
|
2009
3308
|
this.db = db;
|
2010
3309
|
this.search = search;
|
3310
|
+
this.transactions = transactions;
|
2011
3311
|
for (const [key, namespace] of Object.entries(plugins ?? {})) {
|
2012
3312
|
if (namespace === void 0)
|
2013
3313
|
continue;
|
@@ -2021,22 +3321,33 @@ const buildClient = (plugins) => {
|
|
2021
3321
|
}
|
2022
3322
|
}
|
2023
3323
|
}
|
2024
|
-
|
3324
|
+
async getConfig() {
|
3325
|
+
const databaseURL = __privateGet(this, _options).databaseURL;
|
3326
|
+
const branch = await __privateGet(this, _options).branch();
|
3327
|
+
return { databaseURL, branch };
|
3328
|
+
}
|
3329
|
+
}, _branch = new WeakMap(), _options = new WeakMap(), _parseOptions = new WeakSet(), parseOptions_fn = function(options) {
|
3330
|
+
const enableBrowser = options?.enableBrowser ?? getEnableBrowserVariable() ?? false;
|
3331
|
+
const isBrowser = typeof window !== "undefined";
|
3332
|
+
if (isBrowser && !enableBrowser) {
|
3333
|
+
throw new Error(
|
3334
|
+
"You are trying to use Xata from the browser, which is potentially a non-secure environment. If you understand the security concerns, such as leaking your credentials, pass `enableBrowser: true` to the client options to remove this error."
|
3335
|
+
);
|
3336
|
+
}
|
2025
3337
|
const fetch = getFetchImplementation(options?.fetch);
|
2026
3338
|
const databaseURL = options?.databaseURL || getDatabaseURL();
|
2027
3339
|
const apiKey = options?.apiKey || getAPIKey();
|
2028
|
-
const cache = options?.cache ?? new SimpleCache({
|
3340
|
+
const cache = options?.cache ?? new SimpleCache({ defaultQueryTTL: 0 });
|
3341
|
+
const trace = options?.trace ?? defaultTrace;
|
2029
3342
|
const branch = async () => options?.branch !== void 0 ? await __privateMethod(this, _evaluateBranch, evaluateBranch_fn).call(this, options.branch) : await getCurrentBranchName({ apiKey, databaseURL, fetchImpl: options?.fetch });
|
2030
|
-
if (!
|
2031
|
-
throw new Error("
|
3343
|
+
if (!apiKey) {
|
3344
|
+
throw new Error("Option apiKey is required");
|
2032
3345
|
}
|
2033
|
-
|
2034
|
-
|
2035
|
-
|
2036
|
-
apiKey,
|
2037
|
-
|
2038
|
-
branch
|
2039
|
-
}) {
|
3346
|
+
if (!databaseURL) {
|
3347
|
+
throw new Error("Option databaseURL is required");
|
3348
|
+
}
|
3349
|
+
return { fetch, databaseURL, apiKey, branch, cache, trace, clientID: generateUUID(), enableBrowser };
|
3350
|
+
}, _getFetchProps = new WeakSet(), getFetchProps_fn = async function({ fetch, apiKey, databaseURL, branch, trace, clientID }) {
|
2040
3351
|
const branchValue = await __privateMethod(this, _evaluateBranch, evaluateBranch_fn).call(this, branch);
|
2041
3352
|
if (!branchValue)
|
2042
3353
|
throw new Error("Unable to resolve branch value");
|
@@ -2046,9 +3357,11 @@ const buildClient = (plugins) => {
|
|
2046
3357
|
apiUrl: "",
|
2047
3358
|
workspacesApiUrl: (path, params) => {
|
2048
3359
|
const hasBranch = params.dbBranchName ?? params.branch;
|
2049
|
-
const newPath = path.replace(/^\/db\/[^/]+/, hasBranch ? `:${branchValue}` : "");
|
3360
|
+
const newPath = path.replace(/^\/db\/[^/]+/, hasBranch !== void 0 ? `:${branchValue}` : "");
|
2050
3361
|
return databaseURL + newPath;
|
2051
|
-
}
|
3362
|
+
},
|
3363
|
+
trace,
|
3364
|
+
clientID
|
2052
3365
|
};
|
2053
3366
|
}, _evaluateBranch = new WeakSet(), evaluateBranch_fn = async function(param) {
|
2054
3367
|
if (__privateGet(this, _branch))
|
@@ -2071,6 +3384,88 @@ const buildClient = (plugins) => {
|
|
2071
3384
|
class BaseClient extends buildClient() {
|
2072
3385
|
}
|
2073
3386
|
|
3387
|
+
const META = "__";
|
3388
|
+
const VALUE = "___";
|
3389
|
+
class Serializer {
|
3390
|
+
constructor() {
|
3391
|
+
this.classes = {};
|
3392
|
+
}
|
3393
|
+
add(clazz) {
|
3394
|
+
this.classes[clazz.name] = clazz;
|
3395
|
+
}
|
3396
|
+
toJSON(data) {
|
3397
|
+
function visit(obj) {
|
3398
|
+
if (Array.isArray(obj))
|
3399
|
+
return obj.map(visit);
|
3400
|
+
const type = typeof obj;
|
3401
|
+
if (type === "undefined")
|
3402
|
+
return { [META]: "undefined" };
|
3403
|
+
if (type === "bigint")
|
3404
|
+
return { [META]: "bigint", [VALUE]: obj.toString() };
|
3405
|
+
if (obj === null || type !== "object")
|
3406
|
+
return obj;
|
3407
|
+
const constructor = obj.constructor;
|
3408
|
+
const o = { [META]: constructor.name };
|
3409
|
+
for (const [key, value] of Object.entries(obj)) {
|
3410
|
+
o[key] = visit(value);
|
3411
|
+
}
|
3412
|
+
if (constructor === Date)
|
3413
|
+
o[VALUE] = obj.toISOString();
|
3414
|
+
if (constructor === Map)
|
3415
|
+
o[VALUE] = Object.fromEntries(obj);
|
3416
|
+
if (constructor === Set)
|
3417
|
+
o[VALUE] = [...obj];
|
3418
|
+
return o;
|
3419
|
+
}
|
3420
|
+
return JSON.stringify(visit(data));
|
3421
|
+
}
|
3422
|
+
fromJSON(json) {
|
3423
|
+
return JSON.parse(json, (key, value) => {
|
3424
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
3425
|
+
const { [META]: clazz, [VALUE]: val, ...rest } = value;
|
3426
|
+
const constructor = this.classes[clazz];
|
3427
|
+
if (constructor) {
|
3428
|
+
return Object.assign(Object.create(constructor.prototype), rest);
|
3429
|
+
}
|
3430
|
+
if (clazz === "Date")
|
3431
|
+
return new Date(val);
|
3432
|
+
if (clazz === "Set")
|
3433
|
+
return new Set(val);
|
3434
|
+
if (clazz === "Map")
|
3435
|
+
return new Map(Object.entries(val));
|
3436
|
+
if (clazz === "bigint")
|
3437
|
+
return BigInt(val);
|
3438
|
+
if (clazz === "undefined")
|
3439
|
+
return void 0;
|
3440
|
+
return rest;
|
3441
|
+
}
|
3442
|
+
return value;
|
3443
|
+
});
|
3444
|
+
}
|
3445
|
+
}
|
3446
|
+
const defaultSerializer = new Serializer();
|
3447
|
+
const serialize = (data) => {
|
3448
|
+
return defaultSerializer.toJSON(data);
|
3449
|
+
};
|
3450
|
+
const deserialize = (json) => {
|
3451
|
+
return defaultSerializer.fromJSON(json);
|
3452
|
+
};
|
3453
|
+
|
3454
|
+
function buildWorkerRunner(config) {
|
3455
|
+
return function xataWorker(name, _worker) {
|
3456
|
+
return async (...args) => {
|
3457
|
+
const url = process.env.NODE_ENV === "development" ? `http://localhost:64749/${name}` : `https://dispatcher.xata.workers.dev/${config.workspace}/${config.worker}/${name}`;
|
3458
|
+
const result = await fetch(url, {
|
3459
|
+
method: "POST",
|
3460
|
+
headers: { "Content-Type": "application/json" },
|
3461
|
+
body: serialize({ args })
|
3462
|
+
});
|
3463
|
+
const text = await result.text();
|
3464
|
+
return deserialize(text);
|
3465
|
+
};
|
3466
|
+
};
|
3467
|
+
}
|
3468
|
+
|
2074
3469
|
class XataError extends Error {
|
2075
3470
|
constructor(message, status) {
|
2076
3471
|
super(message);
|
@@ -2091,6 +3486,7 @@ exports.Repository = Repository;
|
|
2091
3486
|
exports.RestRepository = RestRepository;
|
2092
3487
|
exports.SchemaPlugin = SchemaPlugin;
|
2093
3488
|
exports.SearchPlugin = SearchPlugin;
|
3489
|
+
exports.Serializer = Serializer;
|
2094
3490
|
exports.SimpleCache = SimpleCache;
|
2095
3491
|
exports.XataApiClient = XataApiClient;
|
2096
3492
|
exports.XataApiPlugin = XataApiPlugin;
|
@@ -2099,15 +3495,28 @@ exports.XataPlugin = XataPlugin;
|
|
2099
3495
|
exports.acceptWorkspaceMemberInvite = acceptWorkspaceMemberInvite;
|
2100
3496
|
exports.addGitBranchesEntry = addGitBranchesEntry;
|
2101
3497
|
exports.addTableColumn = addTableColumn;
|
3498
|
+
exports.aggregateTable = aggregateTable;
|
3499
|
+
exports.applyBranchSchemaEdit = applyBranchSchemaEdit;
|
3500
|
+
exports.branchTransaction = branchTransaction;
|
2102
3501
|
exports.buildClient = buildClient;
|
3502
|
+
exports.buildWorkerRunner = buildWorkerRunner;
|
2103
3503
|
exports.bulkInsertTableRecords = bulkInsertTableRecords;
|
2104
3504
|
exports.cancelWorkspaceMemberInvite = cancelWorkspaceMemberInvite;
|
3505
|
+
exports.compareBranchSchemas = compareBranchSchemas;
|
3506
|
+
exports.compareBranchWithUserSchema = compareBranchWithUserSchema;
|
3507
|
+
exports.compareMigrationRequest = compareMigrationRequest;
|
2105
3508
|
exports.contains = contains;
|
2106
3509
|
exports.createBranch = createBranch;
|
2107
3510
|
exports.createDatabase = createDatabase;
|
3511
|
+
exports.createMigrationRequest = createMigrationRequest;
|
2108
3512
|
exports.createTable = createTable;
|
2109
3513
|
exports.createUserAPIKey = createUserAPIKey;
|
2110
3514
|
exports.createWorkspace = createWorkspace;
|
3515
|
+
exports.dEPRECATEDcreateDatabase = dEPRECATEDcreateDatabase;
|
3516
|
+
exports.dEPRECATEDdeleteDatabase = dEPRECATEDdeleteDatabase;
|
3517
|
+
exports.dEPRECATEDgetDatabaseList = dEPRECATEDgetDatabaseList;
|
3518
|
+
exports.dEPRECATEDgetDatabaseMetadata = dEPRECATEDgetDatabaseMetadata;
|
3519
|
+
exports.dEPRECATEDupdateDatabaseMetadata = dEPRECATEDupdateDatabaseMetadata;
|
2111
3520
|
exports.deleteBranch = deleteBranch;
|
2112
3521
|
exports.deleteColumn = deleteColumn;
|
2113
3522
|
exports.deleteDatabase = deleteDatabase;
|
@@ -2116,7 +3525,9 @@ exports.deleteTable = deleteTable;
|
|
2116
3525
|
exports.deleteUser = deleteUser;
|
2117
3526
|
exports.deleteUserAPIKey = deleteUserAPIKey;
|
2118
3527
|
exports.deleteWorkspace = deleteWorkspace;
|
3528
|
+
exports.deserialize = deserialize;
|
2119
3529
|
exports.endsWith = endsWith;
|
3530
|
+
exports.equals = equals;
|
2120
3531
|
exports.executeBranchMigrationPlan = executeBranchMigrationPlan;
|
2121
3532
|
exports.exists = exists;
|
2122
3533
|
exports.ge = ge;
|
@@ -2126,13 +3537,18 @@ exports.getBranchList = getBranchList;
|
|
2126
3537
|
exports.getBranchMetadata = getBranchMetadata;
|
2127
3538
|
exports.getBranchMigrationHistory = getBranchMigrationHistory;
|
2128
3539
|
exports.getBranchMigrationPlan = getBranchMigrationPlan;
|
3540
|
+
exports.getBranchSchemaHistory = getBranchSchemaHistory;
|
2129
3541
|
exports.getBranchStats = getBranchStats;
|
2130
3542
|
exports.getColumn = getColumn;
|
2131
3543
|
exports.getCurrentBranchDetails = getCurrentBranchDetails;
|
2132
3544
|
exports.getCurrentBranchName = getCurrentBranchName;
|
2133
3545
|
exports.getDatabaseList = getDatabaseList;
|
3546
|
+
exports.getDatabaseMetadata = getDatabaseMetadata;
|
2134
3547
|
exports.getDatabaseURL = getDatabaseURL;
|
2135
3548
|
exports.getGitBranchesMapping = getGitBranchesMapping;
|
3549
|
+
exports.getHostUrl = getHostUrl;
|
3550
|
+
exports.getMigrationRequest = getMigrationRequest;
|
3551
|
+
exports.getMigrationRequestIsMerged = getMigrationRequestIsMerged;
|
2136
3552
|
exports.getRecord = getRecord;
|
2137
3553
|
exports.getTableColumns = getTableColumns;
|
2138
3554
|
exports.getTableSchema = getTableSchema;
|
@@ -2141,6 +3557,9 @@ exports.getUserAPIKeys = getUserAPIKeys;
|
|
2141
3557
|
exports.getWorkspace = getWorkspace;
|
2142
3558
|
exports.getWorkspaceMembersList = getWorkspaceMembersList;
|
2143
3559
|
exports.getWorkspacesList = getWorkspacesList;
|
3560
|
+
exports.greaterEquals = greaterEquals;
|
3561
|
+
exports.greaterThan = greaterThan;
|
3562
|
+
exports.greaterThanEquals = greaterThanEquals;
|
2144
3563
|
exports.gt = gt;
|
2145
3564
|
exports.gte = gte;
|
2146
3565
|
exports.includes = includes;
|
@@ -2152,15 +3571,27 @@ exports.insertRecordWithID = insertRecordWithID;
|
|
2152
3571
|
exports.inviteWorkspaceMember = inviteWorkspaceMember;
|
2153
3572
|
exports.is = is;
|
2154
3573
|
exports.isCursorPaginationOptions = isCursorPaginationOptions;
|
3574
|
+
exports.isHostProviderAlias = isHostProviderAlias;
|
3575
|
+
exports.isHostProviderBuilder = isHostProviderBuilder;
|
2155
3576
|
exports.isIdentifiable = isIdentifiable;
|
2156
3577
|
exports.isNot = isNot;
|
2157
3578
|
exports.isXataRecord = isXataRecord;
|
2158
3579
|
exports.le = le;
|
3580
|
+
exports.lessEquals = lessEquals;
|
3581
|
+
exports.lessThan = lessThan;
|
3582
|
+
exports.lessThanEquals = lessThanEquals;
|
3583
|
+
exports.listMigrationRequestsCommits = listMigrationRequestsCommits;
|
3584
|
+
exports.listRegions = listRegions;
|
2159
3585
|
exports.lt = lt;
|
2160
3586
|
exports.lte = lte;
|
3587
|
+
exports.mergeMigrationRequest = mergeMigrationRequest;
|
2161
3588
|
exports.notExists = notExists;
|
2162
3589
|
exports.operationsByTag = operationsByTag;
|
3590
|
+
exports.parseProviderString = parseProviderString;
|
3591
|
+
exports.parseWorkspacesUrlParts = parseWorkspacesUrlParts;
|
2163
3592
|
exports.pattern = pattern;
|
3593
|
+
exports.previewBranchSchemaEdit = previewBranchSchemaEdit;
|
3594
|
+
exports.queryMigrationRequests = queryMigrationRequests;
|
2164
3595
|
exports.queryTable = queryTable;
|
2165
3596
|
exports.removeGitBranchesEntry = removeGitBranchesEntry;
|
2166
3597
|
exports.removeWorkspaceMember = removeWorkspaceMember;
|
@@ -2168,14 +3599,20 @@ exports.resendWorkspaceMemberInvite = resendWorkspaceMemberInvite;
|
|
2168
3599
|
exports.resolveBranch = resolveBranch;
|
2169
3600
|
exports.searchBranch = searchBranch;
|
2170
3601
|
exports.searchTable = searchTable;
|
3602
|
+
exports.serialize = serialize;
|
2171
3603
|
exports.setTableSchema = setTableSchema;
|
2172
3604
|
exports.startsWith = startsWith;
|
3605
|
+
exports.summarizeTable = summarizeTable;
|
2173
3606
|
exports.updateBranchMetadata = updateBranchMetadata;
|
3607
|
+
exports.updateBranchSchema = updateBranchSchema;
|
2174
3608
|
exports.updateColumn = updateColumn;
|
3609
|
+
exports.updateDatabaseMetadata = updateDatabaseMetadata;
|
3610
|
+
exports.updateMigrationRequest = updateMigrationRequest;
|
2175
3611
|
exports.updateRecordWithID = updateRecordWithID;
|
2176
3612
|
exports.updateTable = updateTable;
|
2177
3613
|
exports.updateUser = updateUser;
|
2178
3614
|
exports.updateWorkspace = updateWorkspace;
|
3615
|
+
exports.updateWorkspaceMemberInvite = updateWorkspaceMemberInvite;
|
2179
3616
|
exports.updateWorkspaceMemberRole = updateWorkspaceMemberRole;
|
2180
3617
|
exports.upsertRecordWithID = upsertRecordWithID;
|
2181
3618
|
//# sourceMappingURL=index.cjs.map
|