@xata.io/client 0.0.0-alpha.vfc692f9 → 0.0.0-alpha.vfcd664d
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 +150 -0
- package/README.md +32 -30
- package/Usage.md +34 -11
- package/dist/index.cjs +1909 -692
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4642 -1234
- package/dist/index.mjs +1869 -693
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- /package/{rollup.config.js → rollup.config.mjs} +0 -0
package/dist/index.mjs
CHANGED
@@ -1,3 +1,25 @@
|
|
1
|
+
const defaultTrace = async (_name, fn, _options) => {
|
2
|
+
return await fn({
|
3
|
+
setAttributes: () => {
|
4
|
+
return;
|
5
|
+
}
|
6
|
+
});
|
7
|
+
};
|
8
|
+
const TraceAttributes = {
|
9
|
+
KIND: "xata.trace.kind",
|
10
|
+
VERSION: "xata.sdk.version",
|
11
|
+
TABLE: "xata.table",
|
12
|
+
HTTP_REQUEST_ID: "http.request_id",
|
13
|
+
HTTP_STATUS_CODE: "http.status_code",
|
14
|
+
HTTP_HOST: "http.host",
|
15
|
+
HTTP_SCHEME: "http.scheme",
|
16
|
+
HTTP_USER_AGENT: "http.user_agent",
|
17
|
+
HTTP_METHOD: "http.method",
|
18
|
+
HTTP_URL: "http.url",
|
19
|
+
HTTP_ROUTE: "http.route",
|
20
|
+
HTTP_TARGET: "http.target"
|
21
|
+
};
|
22
|
+
|
1
23
|
function notEmpty(value) {
|
2
24
|
return value !== null && value !== void 0;
|
3
25
|
}
|
@@ -16,6 +38,9 @@ function isString(value) {
|
|
16
38
|
function isStringArray(value) {
|
17
39
|
return isDefined(value) && Array.isArray(value) && value.every(isString);
|
18
40
|
}
|
41
|
+
function isNumber(value) {
|
42
|
+
return isDefined(value) && typeof value === "number";
|
43
|
+
}
|
19
44
|
function toBase64(value) {
|
20
45
|
try {
|
21
46
|
return btoa(value);
|
@@ -24,6 +49,17 @@ function toBase64(value) {
|
|
24
49
|
return buf.from(value).toString("base64");
|
25
50
|
}
|
26
51
|
}
|
52
|
+
function deepMerge(a, b) {
|
53
|
+
const result = { ...a };
|
54
|
+
for (const [key, value] of Object.entries(b)) {
|
55
|
+
if (isObject(value) && isObject(result[key])) {
|
56
|
+
result[key] = deepMerge(result[key], value);
|
57
|
+
} else {
|
58
|
+
result[key] = value;
|
59
|
+
}
|
60
|
+
}
|
61
|
+
return result;
|
62
|
+
}
|
27
63
|
|
28
64
|
function getEnvironment() {
|
29
65
|
try {
|
@@ -121,12 +157,14 @@ function getFetchImplementation(userFetch) {
|
|
121
157
|
const globalFetch = typeof fetch !== "undefined" ? fetch : void 0;
|
122
158
|
const fetchImpl = userFetch ?? globalFetch;
|
123
159
|
if (!fetchImpl) {
|
124
|
-
throw new Error(
|
160
|
+
throw new Error(
|
161
|
+
`Couldn't find \`fetch\`. Install a fetch implementation such as \`node-fetch\` and pass it explicitly.`
|
162
|
+
);
|
125
163
|
}
|
126
164
|
return fetchImpl;
|
127
165
|
}
|
128
166
|
|
129
|
-
const VERSION = "0.0.0-alpha.
|
167
|
+
const VERSION = "0.0.0-alpha.vfcd664d";
|
130
168
|
|
131
169
|
class ErrorWithCause extends Error {
|
132
170
|
constructor(message, options) {
|
@@ -177,18 +215,24 @@ const resolveUrl = (url, queryParams = {}, pathParams = {}) => {
|
|
177
215
|
}, {});
|
178
216
|
const query = new URLSearchParams(cleanQueryParams).toString();
|
179
217
|
const queryString = query.length > 0 ? `?${query}` : "";
|
180
|
-
|
218
|
+
const cleanPathParams = Object.entries(pathParams).reduce((acc, [key, value]) => {
|
219
|
+
return { ...acc, [key]: encodeURIComponent(String(value ?? "")).replace("%3A", ":") };
|
220
|
+
}, {});
|
221
|
+
return url.replace(/\{\w*\}/g, (key) => cleanPathParams[key.slice(1, -1)]) + queryString;
|
181
222
|
};
|
182
223
|
function buildBaseUrl({
|
224
|
+
endpoint,
|
183
225
|
path,
|
184
226
|
workspacesApiUrl,
|
185
227
|
apiUrl,
|
186
|
-
pathParams
|
228
|
+
pathParams = {}
|
187
229
|
}) {
|
188
|
-
if (
|
189
|
-
|
190
|
-
|
191
|
-
|
230
|
+
if (endpoint === "dataPlane") {
|
231
|
+
const url = isString(workspacesApiUrl) ? `${workspacesApiUrl}${path}` : workspacesApiUrl(path, pathParams);
|
232
|
+
const urlWithWorkspace = isString(pathParams.workspace) ? url.replace("{workspaceId}", String(pathParams.workspace)) : url;
|
233
|
+
return isString(pathParams.region) ? urlWithWorkspace.replace("{region}", String(pathParams.region)) : urlWithWorkspace;
|
234
|
+
}
|
235
|
+
return `${apiUrl}${path}`;
|
192
236
|
}
|
193
237
|
function hostHeader(url) {
|
194
238
|
const pattern = /.*:\/\/(?<host>[^/]+).*/;
|
@@ -204,271 +248,229 @@ async function fetch$1({
|
|
204
248
|
queryParams,
|
205
249
|
fetchImpl,
|
206
250
|
apiKey,
|
251
|
+
endpoint,
|
207
252
|
apiUrl,
|
208
|
-
workspacesApiUrl
|
253
|
+
workspacesApiUrl,
|
254
|
+
trace,
|
255
|
+
signal,
|
256
|
+
clientID,
|
257
|
+
sessionID
|
209
258
|
}) {
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
259
|
+
return trace(
|
260
|
+
`${method.toUpperCase()} ${path}`,
|
261
|
+
async ({ setAttributes }) => {
|
262
|
+
const baseUrl = buildBaseUrl({ endpoint, path, workspacesApiUrl, pathParams, apiUrl });
|
263
|
+
const fullUrl = resolveUrl(baseUrl, queryParams, pathParams);
|
264
|
+
const url = fullUrl.includes("localhost") ? fullUrl.replace(/^[^.]+\./, "http://") : fullUrl;
|
265
|
+
setAttributes({
|
266
|
+
[TraceAttributes.HTTP_URL]: url,
|
267
|
+
[TraceAttributes.HTTP_TARGET]: resolveUrl(path, queryParams, pathParams)
|
268
|
+
});
|
269
|
+
const response = await fetchImpl(url, {
|
270
|
+
method: method.toUpperCase(),
|
271
|
+
body: body ? JSON.stringify(body) : void 0,
|
272
|
+
headers: {
|
273
|
+
"Content-Type": "application/json",
|
274
|
+
"User-Agent": `Xata client-ts/${VERSION}`,
|
275
|
+
"X-Xata-Client-ID": clientID ?? "",
|
276
|
+
"X-Xata-Session-ID": sessionID ?? "",
|
277
|
+
...headers,
|
278
|
+
...hostHeader(fullUrl),
|
279
|
+
Authorization: `Bearer ${apiKey}`
|
280
|
+
},
|
281
|
+
signal
|
282
|
+
});
|
283
|
+
if (response.status === 204) {
|
284
|
+
return {};
|
285
|
+
}
|
286
|
+
const { host, protocol } = parseUrl(response.url);
|
287
|
+
const requestId = response.headers?.get("x-request-id") ?? void 0;
|
288
|
+
setAttributes({
|
289
|
+
[TraceAttributes.KIND]: "http",
|
290
|
+
[TraceAttributes.HTTP_REQUEST_ID]: requestId,
|
291
|
+
[TraceAttributes.HTTP_STATUS_CODE]: response.status,
|
292
|
+
[TraceAttributes.HTTP_HOST]: host,
|
293
|
+
[TraceAttributes.HTTP_SCHEME]: protocol?.replace(":", "")
|
294
|
+
});
|
295
|
+
try {
|
296
|
+
const jsonResponse = await response.json();
|
297
|
+
if (response.ok) {
|
298
|
+
return jsonResponse;
|
299
|
+
}
|
300
|
+
throw new FetcherError(response.status, jsonResponse, requestId);
|
301
|
+
} catch (error) {
|
302
|
+
throw new FetcherError(response.status, error, requestId);
|
303
|
+
}
|
304
|
+
},
|
305
|
+
{ [TraceAttributes.HTTP_METHOD]: method.toUpperCase(), [TraceAttributes.HTTP_ROUTE]: path }
|
306
|
+
);
|
307
|
+
}
|
308
|
+
function parseUrl(url) {
|
228
309
|
try {
|
229
|
-
const
|
230
|
-
|
231
|
-
return jsonResponse;
|
232
|
-
}
|
233
|
-
throw new FetcherError(response.status, jsonResponse, requestId);
|
310
|
+
const { host, protocol } = new URL(url);
|
311
|
+
return { host, protocol };
|
234
312
|
} catch (error) {
|
235
|
-
|
313
|
+
return {};
|
236
314
|
}
|
237
315
|
}
|
238
316
|
|
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 updateWorkspaceMemberInvite = (variables) => fetch$1({ url: "/workspaces/{workspaceId}/invites/{inviteId}", method: "patch", ...variables });
|
295
|
-
const cancelWorkspaceMemberInvite = (variables) => fetch$1({
|
296
|
-
url: "/workspaces/{workspaceId}/invites/{inviteId}",
|
297
|
-
method: "delete",
|
298
|
-
...variables
|
299
|
-
});
|
300
|
-
const resendWorkspaceMemberInvite = (variables) => fetch$1({
|
301
|
-
url: "/workspaces/{workspaceId}/invites/{inviteId}/resend",
|
302
|
-
method: "post",
|
303
|
-
...variables
|
304
|
-
});
|
305
|
-
const acceptWorkspaceMemberInvite = (variables) => fetch$1({
|
306
|
-
url: "/workspaces/{workspaceId}/invites/{inviteKey}/accept",
|
307
|
-
method: "post",
|
308
|
-
...variables
|
309
|
-
});
|
310
|
-
const getDatabaseList = (variables) => fetch$1({
|
311
|
-
url: "/dbs",
|
312
|
-
method: "get",
|
313
|
-
...variables
|
314
|
-
});
|
315
|
-
const getBranchList = (variables) => fetch$1({
|
316
|
-
url: "/dbs/{dbName}",
|
317
|
-
method: "get",
|
318
|
-
...variables
|
319
|
-
});
|
320
|
-
const createDatabase = (variables) => fetch$1({
|
321
|
-
url: "/dbs/{dbName}",
|
322
|
-
method: "put",
|
323
|
-
...variables
|
324
|
-
});
|
325
|
-
const deleteDatabase = (variables) => fetch$1({
|
317
|
+
const dataPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "dataPlane" });
|
318
|
+
|
319
|
+
const dEPRECATEDgetDatabaseList = (variables, signal) => dataPlaneFetch({ url: "/dbs", method: "get", ...variables, signal });
|
320
|
+
const getBranchList = (variables, signal) => dataPlaneFetch({
|
326
321
|
url: "/dbs/{dbName}",
|
327
|
-
method: "delete",
|
328
|
-
...variables
|
329
|
-
});
|
330
|
-
const getGitBranchesMapping = (variables) => fetch$1({ url: "/dbs/{dbName}/gitBranches", method: "get", ...variables });
|
331
|
-
const addGitBranchesEntry = (variables) => fetch$1({ url: "/dbs/{dbName}/gitBranches", method: "post", ...variables });
|
332
|
-
const removeGitBranchesEntry = (variables) => fetch$1({ url: "/dbs/{dbName}/gitBranches", method: "delete", ...variables });
|
333
|
-
const resolveBranch = (variables) => fetch$1({
|
334
|
-
url: "/dbs/{dbName}/resolveBranch",
|
335
322
|
method: "get",
|
336
|
-
...variables
|
323
|
+
...variables,
|
324
|
+
signal
|
337
325
|
});
|
338
|
-
const
|
326
|
+
const dEPRECATEDcreateDatabase = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}", method: "put", ...variables, signal });
|
327
|
+
const dEPRECATEDdeleteDatabase = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}", method: "delete", ...variables, signal });
|
328
|
+
const dEPRECATEDgetDatabaseMetadata = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/metadata", method: "get", ...variables, signal });
|
329
|
+
const dEPRECATEDupdateDatabaseMetadata = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/metadata", method: "patch", ...variables, signal });
|
330
|
+
const getBranchDetails = (variables, signal) => dataPlaneFetch({
|
339
331
|
url: "/db/{dbBranchName}",
|
340
332
|
method: "get",
|
341
|
-
...variables
|
333
|
+
...variables,
|
334
|
+
signal
|
342
335
|
});
|
343
|
-
const createBranch = (variables) =>
|
344
|
-
const deleteBranch = (variables) =>
|
336
|
+
const createBranch = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}", method: "put", ...variables, signal });
|
337
|
+
const deleteBranch = (variables, signal) => dataPlaneFetch({
|
345
338
|
url: "/db/{dbBranchName}",
|
346
339
|
method: "delete",
|
347
|
-
...variables
|
340
|
+
...variables,
|
341
|
+
signal
|
348
342
|
});
|
349
|
-
const updateBranchMetadata = (variables) =>
|
343
|
+
const updateBranchMetadata = (variables, signal) => dataPlaneFetch({
|
350
344
|
url: "/db/{dbBranchName}/metadata",
|
351
345
|
method: "put",
|
352
|
-
...variables
|
346
|
+
...variables,
|
347
|
+
signal
|
353
348
|
});
|
354
|
-
const getBranchMetadata = (variables) =>
|
349
|
+
const getBranchMetadata = (variables, signal) => dataPlaneFetch({
|
355
350
|
url: "/db/{dbBranchName}/metadata",
|
356
351
|
method: "get",
|
357
|
-
...variables
|
352
|
+
...variables,
|
353
|
+
signal
|
358
354
|
});
|
359
|
-
const
|
360
|
-
const executeBranchMigrationPlan = (variables) => fetch$1({ url: "/db/{dbBranchName}/migrations/execute", method: "post", ...variables });
|
361
|
-
const getBranchMigrationPlan = (variables) => fetch$1({ url: "/db/{dbBranchName}/migrations/plan", method: "post", ...variables });
|
362
|
-
const getBranchStats = (variables) => fetch$1({
|
355
|
+
const getBranchStats = (variables, signal) => dataPlaneFetch({
|
363
356
|
url: "/db/{dbBranchName}/stats",
|
364
357
|
method: "get",
|
365
|
-
...variables
|
358
|
+
...variables,
|
359
|
+
signal
|
366
360
|
});
|
367
|
-
const
|
361
|
+
const getGitBranchesMapping = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/gitBranches", method: "get", ...variables, signal });
|
362
|
+
const addGitBranchesEntry = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/gitBranches", method: "post", ...variables, signal });
|
363
|
+
const removeGitBranchesEntry = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/gitBranches", method: "delete", ...variables, signal });
|
364
|
+
const resolveBranch = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/resolveBranch", method: "get", ...variables, signal });
|
365
|
+
const getBranchMigrationHistory = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/migrations", method: "get", ...variables, signal });
|
366
|
+
const getBranchMigrationPlan = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/migrations/plan", method: "post", ...variables, signal });
|
367
|
+
const executeBranchMigrationPlan = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/migrations/execute", method: "post", ...variables, signal });
|
368
|
+
const branchTransaction = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/transaction", method: "post", ...variables, signal });
|
369
|
+
const queryMigrationRequests = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/query", method: "post", ...variables, signal });
|
370
|
+
const createMigrationRequest = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations", method: "post", ...variables, signal });
|
371
|
+
const getMigrationRequest = (variables, signal) => dataPlaneFetch({
|
372
|
+
url: "/dbs/{dbName}/migrations/{mrNumber}",
|
373
|
+
method: "get",
|
374
|
+
...variables,
|
375
|
+
signal
|
376
|
+
});
|
377
|
+
const updateMigrationRequest = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/{mrNumber}", method: "patch", ...variables, signal });
|
378
|
+
const listMigrationRequestsCommits = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/{mrNumber}/commits", method: "post", ...variables, signal });
|
379
|
+
const compareMigrationRequest = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/{mrNumber}/compare", method: "post", ...variables, signal });
|
380
|
+
const getMigrationRequestIsMerged = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/{mrNumber}/merge", method: "get", ...variables, signal });
|
381
|
+
const mergeMigrationRequest = (variables, signal) => dataPlaneFetch({
|
382
|
+
url: "/dbs/{dbName}/migrations/{mrNumber}/merge",
|
383
|
+
method: "post",
|
384
|
+
...variables,
|
385
|
+
signal
|
386
|
+
});
|
387
|
+
const getBranchSchemaHistory = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/history", method: "post", ...variables, signal });
|
388
|
+
const compareBranchWithUserSchema = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/compare", method: "post", ...variables, signal });
|
389
|
+
const compareBranchSchemas = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/compare/{branchName}", method: "post", ...variables, signal });
|
390
|
+
const updateBranchSchema = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/update", method: "post", ...variables, signal });
|
391
|
+
const previewBranchSchemaEdit = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/preview", method: "post", ...variables, signal });
|
392
|
+
const applyBranchSchemaEdit = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/apply", method: "post", ...variables, signal });
|
393
|
+
const createTable = (variables, signal) => dataPlaneFetch({
|
368
394
|
url: "/db/{dbBranchName}/tables/{tableName}",
|
369
395
|
method: "put",
|
370
|
-
...variables
|
396
|
+
...variables,
|
397
|
+
signal
|
371
398
|
});
|
372
|
-
const deleteTable = (variables) =>
|
399
|
+
const deleteTable = (variables, signal) => dataPlaneFetch({
|
373
400
|
url: "/db/{dbBranchName}/tables/{tableName}",
|
374
401
|
method: "delete",
|
375
|
-
...variables
|
402
|
+
...variables,
|
403
|
+
signal
|
376
404
|
});
|
377
|
-
const updateTable = (variables) =>
|
378
|
-
|
379
|
-
method: "patch",
|
380
|
-
...variables
|
381
|
-
});
|
382
|
-
const getTableSchema = (variables) => fetch$1({
|
405
|
+
const updateTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}", method: "patch", ...variables, signal });
|
406
|
+
const getTableSchema = (variables, signal) => dataPlaneFetch({
|
383
407
|
url: "/db/{dbBranchName}/tables/{tableName}/schema",
|
384
408
|
method: "get",
|
385
|
-
...variables
|
386
|
-
|
387
|
-
const setTableSchema = (variables) => fetch$1({
|
388
|
-
url: "/db/{dbBranchName}/tables/{tableName}/schema",
|
389
|
-
method: "put",
|
390
|
-
...variables
|
409
|
+
...variables,
|
410
|
+
signal
|
391
411
|
});
|
392
|
-
const
|
412
|
+
const setTableSchema = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/schema", method: "put", ...variables, signal });
|
413
|
+
const getTableColumns = (variables, signal) => dataPlaneFetch({
|
393
414
|
url: "/db/{dbBranchName}/tables/{tableName}/columns",
|
394
415
|
method: "get",
|
395
|
-
...variables
|
396
|
-
|
397
|
-
const addTableColumn = (variables) => fetch$1({
|
398
|
-
url: "/db/{dbBranchName}/tables/{tableName}/columns",
|
399
|
-
method: "post",
|
400
|
-
...variables
|
416
|
+
...variables,
|
417
|
+
signal
|
401
418
|
});
|
402
|
-
const
|
419
|
+
const addTableColumn = (variables, signal) => dataPlaneFetch(
|
420
|
+
{ url: "/db/{dbBranchName}/tables/{tableName}/columns", method: "post", ...variables, signal }
|
421
|
+
);
|
422
|
+
const getColumn = (variables, signal) => dataPlaneFetch({
|
403
423
|
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
404
424
|
method: "get",
|
405
|
-
...variables
|
406
|
-
|
407
|
-
const deleteColumn = (variables) => fetch$1({
|
408
|
-
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
409
|
-
method: "delete",
|
410
|
-
...variables
|
425
|
+
...variables,
|
426
|
+
signal
|
411
427
|
});
|
412
|
-
const updateColumn = (variables) =>
|
428
|
+
const updateColumn = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}", method: "patch", ...variables, signal });
|
429
|
+
const deleteColumn = (variables, signal) => dataPlaneFetch({
|
413
430
|
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
414
|
-
method: "patch",
|
415
|
-
...variables
|
416
|
-
});
|
417
|
-
const insertRecord = (variables) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/data", method: "post", ...variables });
|
418
|
-
const insertRecordWithID = (variables) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "put", ...variables });
|
419
|
-
const updateRecordWithID = (variables) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "patch", ...variables });
|
420
|
-
const upsertRecordWithID = (variables) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "post", ...variables });
|
421
|
-
const deleteRecord = (variables) => fetch$1({
|
422
|
-
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
423
431
|
method: "delete",
|
424
|
-
...variables
|
432
|
+
...variables,
|
433
|
+
signal
|
425
434
|
});
|
426
|
-
const
|
435
|
+
const insertRecord = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data", method: "post", ...variables, signal });
|
436
|
+
const getRecord = (variables, signal) => dataPlaneFetch({
|
427
437
|
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
428
438
|
method: "get",
|
429
|
-
...variables
|
439
|
+
...variables,
|
440
|
+
signal
|
430
441
|
});
|
431
|
-
const
|
432
|
-
const
|
442
|
+
const insertRecordWithID = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "put", ...variables, signal });
|
443
|
+
const updateRecordWithID = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "patch", ...variables, signal });
|
444
|
+
const upsertRecordWithID = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "post", ...variables, signal });
|
445
|
+
const deleteRecord = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "delete", ...variables, signal });
|
446
|
+
const bulkInsertTableRecords = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/bulk", method: "post", ...variables, signal });
|
447
|
+
const queryTable = (variables, signal) => dataPlaneFetch({
|
433
448
|
url: "/db/{dbBranchName}/tables/{tableName}/query",
|
434
449
|
method: "post",
|
435
|
-
...variables
|
450
|
+
...variables,
|
451
|
+
signal
|
436
452
|
});
|
437
|
-
const
|
438
|
-
url: "/db/{dbBranchName}/
|
453
|
+
const searchBranch = (variables, signal) => dataPlaneFetch({
|
454
|
+
url: "/db/{dbBranchName}/search",
|
439
455
|
method: "post",
|
440
|
-
...variables
|
456
|
+
...variables,
|
457
|
+
signal
|
441
458
|
});
|
442
|
-
const
|
443
|
-
url: "/db/{dbBranchName}/search",
|
459
|
+
const searchTable = (variables, signal) => dataPlaneFetch({
|
460
|
+
url: "/db/{dbBranchName}/tables/{tableName}/search",
|
444
461
|
method: "post",
|
445
|
-
...variables
|
462
|
+
...variables,
|
463
|
+
signal
|
446
464
|
});
|
447
|
-
const
|
448
|
-
|
449
|
-
|
450
|
-
createWorkspace,
|
451
|
-
getWorkspacesList,
|
452
|
-
getWorkspace,
|
453
|
-
updateWorkspace,
|
454
|
-
deleteWorkspace,
|
455
|
-
getWorkspaceMembersList,
|
456
|
-
updateWorkspaceMemberRole,
|
457
|
-
removeWorkspaceMember,
|
458
|
-
inviteWorkspaceMember,
|
459
|
-
updateWorkspaceMemberInvite,
|
460
|
-
cancelWorkspaceMemberInvite,
|
461
|
-
resendWorkspaceMemberInvite,
|
462
|
-
acceptWorkspaceMemberInvite
|
463
|
-
},
|
465
|
+
const summarizeTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/summarize", method: "post", ...variables, signal });
|
466
|
+
const aggregateTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/aggregate", method: "post", ...variables, signal });
|
467
|
+
const operationsByTag$2 = {
|
464
468
|
database: {
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
removeGitBranchesEntry,
|
471
|
-
resolveBranch
|
469
|
+
dEPRECATEDgetDatabaseList,
|
470
|
+
dEPRECATEDcreateDatabase,
|
471
|
+
dEPRECATEDdeleteDatabase,
|
472
|
+
dEPRECATEDgetDatabaseMetadata,
|
473
|
+
dEPRECATEDupdateDatabaseMetadata
|
472
474
|
},
|
473
475
|
branch: {
|
474
476
|
getBranchList,
|
@@ -477,10 +479,42 @@ const operationsByTag = {
|
|
477
479
|
deleteBranch,
|
478
480
|
updateBranchMetadata,
|
479
481
|
getBranchMetadata,
|
482
|
+
getBranchStats,
|
483
|
+
getGitBranchesMapping,
|
484
|
+
addGitBranchesEntry,
|
485
|
+
removeGitBranchesEntry,
|
486
|
+
resolveBranch
|
487
|
+
},
|
488
|
+
migrations: {
|
480
489
|
getBranchMigrationHistory,
|
481
|
-
executeBranchMigrationPlan,
|
482
490
|
getBranchMigrationPlan,
|
483
|
-
|
491
|
+
executeBranchMigrationPlan,
|
492
|
+
getBranchSchemaHistory,
|
493
|
+
compareBranchWithUserSchema,
|
494
|
+
compareBranchSchemas,
|
495
|
+
updateBranchSchema,
|
496
|
+
previewBranchSchemaEdit,
|
497
|
+
applyBranchSchemaEdit
|
498
|
+
},
|
499
|
+
records: {
|
500
|
+
branchTransaction,
|
501
|
+
insertRecord,
|
502
|
+
getRecord,
|
503
|
+
insertRecordWithID,
|
504
|
+
updateRecordWithID,
|
505
|
+
upsertRecordWithID,
|
506
|
+
deleteRecord,
|
507
|
+
bulkInsertTableRecords
|
508
|
+
},
|
509
|
+
migrationRequests: {
|
510
|
+
queryMigrationRequests,
|
511
|
+
createMigrationRequest,
|
512
|
+
getMigrationRequest,
|
513
|
+
updateMigrationRequest,
|
514
|
+
listMigrationRequestsCommits,
|
515
|
+
compareMigrationRequest,
|
516
|
+
getMigrationRequestIsMerged,
|
517
|
+
mergeMigrationRequest
|
484
518
|
},
|
485
519
|
table: {
|
486
520
|
createTable,
|
@@ -491,27 +525,150 @@ const operationsByTag = {
|
|
491
525
|
getTableColumns,
|
492
526
|
addTableColumn,
|
493
527
|
getColumn,
|
494
|
-
|
495
|
-
|
528
|
+
updateColumn,
|
529
|
+
deleteColumn
|
496
530
|
},
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
531
|
+
searchAndFilter: { queryTable, searchBranch, searchTable, summarizeTable, aggregateTable }
|
532
|
+
};
|
533
|
+
|
534
|
+
const controlPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "controlPlane" });
|
535
|
+
|
536
|
+
const getUser = (variables, signal) => controlPlaneFetch({
|
537
|
+
url: "/user",
|
538
|
+
method: "get",
|
539
|
+
...variables,
|
540
|
+
signal
|
541
|
+
});
|
542
|
+
const updateUser = (variables, signal) => controlPlaneFetch({
|
543
|
+
url: "/user",
|
544
|
+
method: "put",
|
545
|
+
...variables,
|
546
|
+
signal
|
547
|
+
});
|
548
|
+
const deleteUser = (variables, signal) => controlPlaneFetch({
|
549
|
+
url: "/user",
|
550
|
+
method: "delete",
|
551
|
+
...variables,
|
552
|
+
signal
|
553
|
+
});
|
554
|
+
const getUserAPIKeys = (variables, signal) => controlPlaneFetch({
|
555
|
+
url: "/user/keys",
|
556
|
+
method: "get",
|
557
|
+
...variables,
|
558
|
+
signal
|
559
|
+
});
|
560
|
+
const createUserAPIKey = (variables, signal) => controlPlaneFetch({
|
561
|
+
url: "/user/keys/{keyName}",
|
562
|
+
method: "post",
|
563
|
+
...variables,
|
564
|
+
signal
|
565
|
+
});
|
566
|
+
const deleteUserAPIKey = (variables, signal) => controlPlaneFetch({
|
567
|
+
url: "/user/keys/{keyName}",
|
568
|
+
method: "delete",
|
569
|
+
...variables,
|
570
|
+
signal
|
571
|
+
});
|
572
|
+
const getWorkspacesList = (variables, signal) => controlPlaneFetch({
|
573
|
+
url: "/workspaces",
|
574
|
+
method: "get",
|
575
|
+
...variables,
|
576
|
+
signal
|
577
|
+
});
|
578
|
+
const createWorkspace = (variables, signal) => controlPlaneFetch({
|
579
|
+
url: "/workspaces",
|
580
|
+
method: "post",
|
581
|
+
...variables,
|
582
|
+
signal
|
583
|
+
});
|
584
|
+
const getWorkspace = (variables, signal) => controlPlaneFetch({
|
585
|
+
url: "/workspaces/{workspaceId}",
|
586
|
+
method: "get",
|
587
|
+
...variables,
|
588
|
+
signal
|
589
|
+
});
|
590
|
+
const updateWorkspace = (variables, signal) => controlPlaneFetch({
|
591
|
+
url: "/workspaces/{workspaceId}",
|
592
|
+
method: "put",
|
593
|
+
...variables,
|
594
|
+
signal
|
595
|
+
});
|
596
|
+
const deleteWorkspace = (variables, signal) => controlPlaneFetch({
|
597
|
+
url: "/workspaces/{workspaceId}",
|
598
|
+
method: "delete",
|
599
|
+
...variables,
|
600
|
+
signal
|
601
|
+
});
|
602
|
+
const getWorkspaceMembersList = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/members", method: "get", ...variables, signal });
|
603
|
+
const updateWorkspaceMemberRole = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/members/{userId}", method: "put", ...variables, signal });
|
604
|
+
const removeWorkspaceMember = (variables, signal) => controlPlaneFetch({
|
605
|
+
url: "/workspaces/{workspaceId}/members/{userId}",
|
606
|
+
method: "delete",
|
607
|
+
...variables,
|
608
|
+
signal
|
609
|
+
});
|
610
|
+
const inviteWorkspaceMember = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites", method: "post", ...variables, signal });
|
611
|
+
const updateWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}", method: "patch", ...variables, signal });
|
612
|
+
const cancelWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}", method: "delete", ...variables, signal });
|
613
|
+
const acceptWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteKey}/accept", method: "post", ...variables, signal });
|
614
|
+
const resendWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}/resend", method: "post", ...variables, signal });
|
615
|
+
const getDatabaseList = (variables, signal) => controlPlaneFetch({
|
616
|
+
url: "/workspaces/{workspaceId}/dbs",
|
617
|
+
method: "get",
|
618
|
+
...variables,
|
619
|
+
signal
|
620
|
+
});
|
621
|
+
const createDatabase = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}", method: "put", ...variables, signal });
|
622
|
+
const deleteDatabase = (variables, signal) => controlPlaneFetch({
|
623
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}",
|
624
|
+
method: "delete",
|
625
|
+
...variables,
|
626
|
+
signal
|
627
|
+
});
|
628
|
+
const getDatabaseMetadata = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}", method: "get", ...variables, signal });
|
629
|
+
const updateDatabaseMetadata = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}", method: "patch", ...variables, signal });
|
630
|
+
const listRegions = (variables, signal) => controlPlaneFetch({
|
631
|
+
url: "/workspaces/{workspaceId}/regions",
|
632
|
+
method: "get",
|
633
|
+
...variables,
|
634
|
+
signal
|
635
|
+
});
|
636
|
+
const operationsByTag$1 = {
|
637
|
+
users: { getUser, updateUser, deleteUser },
|
638
|
+
authentication: { getUserAPIKeys, createUserAPIKey, deleteUserAPIKey },
|
639
|
+
workspaces: {
|
640
|
+
getWorkspacesList,
|
641
|
+
createWorkspace,
|
642
|
+
getWorkspace,
|
643
|
+
updateWorkspace,
|
644
|
+
deleteWorkspace,
|
645
|
+
getWorkspaceMembersList,
|
646
|
+
updateWorkspaceMemberRole,
|
647
|
+
removeWorkspaceMember
|
648
|
+
},
|
649
|
+
invites: {
|
650
|
+
inviteWorkspaceMember,
|
651
|
+
updateWorkspaceMemberInvite,
|
652
|
+
cancelWorkspaceMemberInvite,
|
653
|
+
acceptWorkspaceMemberInvite,
|
654
|
+
resendWorkspaceMemberInvite
|
655
|
+
},
|
656
|
+
databases: {
|
657
|
+
getDatabaseList,
|
658
|
+
createDatabase,
|
659
|
+
deleteDatabase,
|
660
|
+
getDatabaseMetadata,
|
661
|
+
updateDatabaseMetadata,
|
662
|
+
listRegions
|
508
663
|
}
|
509
664
|
};
|
510
665
|
|
666
|
+
const operationsByTag = deepMerge(operationsByTag$2, operationsByTag$1);
|
667
|
+
|
511
668
|
function getHostUrl(provider, type) {
|
512
|
-
if (
|
669
|
+
if (isHostProviderAlias(provider)) {
|
513
670
|
return providers[provider][type];
|
514
|
-
} else if (
|
671
|
+
} else if (isHostProviderBuilder(provider)) {
|
515
672
|
return provider[type];
|
516
673
|
}
|
517
674
|
throw new Error("Invalid API provider");
|
@@ -519,19 +676,38 @@ function getHostUrl(provider, type) {
|
|
519
676
|
const providers = {
|
520
677
|
production: {
|
521
678
|
main: "https://api.xata.io",
|
522
|
-
workspaces: "https://{workspaceId}.xata.sh"
|
679
|
+
workspaces: "https://{workspaceId}.{region}.xata.sh"
|
523
680
|
},
|
524
681
|
staging: {
|
525
682
|
main: "https://staging.xatabase.co",
|
526
|
-
workspaces: "https://{workspaceId}.staging.xatabase.co"
|
683
|
+
workspaces: "https://{workspaceId}.staging.{region}.xatabase.co"
|
527
684
|
}
|
528
685
|
};
|
529
|
-
function
|
686
|
+
function isHostProviderAlias(alias) {
|
530
687
|
return isString(alias) && Object.keys(providers).includes(alias);
|
531
688
|
}
|
532
|
-
function
|
689
|
+
function isHostProviderBuilder(builder) {
|
533
690
|
return isObject(builder) && isString(builder.main) && isString(builder.workspaces);
|
534
691
|
}
|
692
|
+
function parseProviderString(provider = "production") {
|
693
|
+
if (isHostProviderAlias(provider)) {
|
694
|
+
return provider;
|
695
|
+
}
|
696
|
+
const [main, workspaces] = provider.split(",");
|
697
|
+
if (!main || !workspaces)
|
698
|
+
return null;
|
699
|
+
return { main, workspaces };
|
700
|
+
}
|
701
|
+
function parseWorkspacesUrlParts(url) {
|
702
|
+
if (!isString(url))
|
703
|
+
return null;
|
704
|
+
const regex = /(?:https:\/\/)?([^.]+)(?:\.([^.]+))?\.xata\.sh.*/;
|
705
|
+
const regexStaging = /(?:https:\/\/)?([^.]+)\.staging(?:\.([^.]+))?\.xatabase\.co.*/;
|
706
|
+
const match = url.match(regex) || url.match(regexStaging);
|
707
|
+
if (!match)
|
708
|
+
return null;
|
709
|
+
return { workspace: match[1], region: match[2] ?? "eu-west-1" };
|
710
|
+
}
|
535
711
|
|
536
712
|
var __accessCheck$7 = (obj, member, msg) => {
|
537
713
|
if (!member.has(obj))
|
@@ -557,7 +733,8 @@ class XataApiClient {
|
|
557
733
|
__privateAdd$7(this, _extraProps, void 0);
|
558
734
|
__privateAdd$7(this, _namespaces, {});
|
559
735
|
const provider = options.host ?? "production";
|
560
|
-
const apiKey = options
|
736
|
+
const apiKey = options.apiKey ?? getAPIKey();
|
737
|
+
const trace = options.trace ?? defaultTrace;
|
561
738
|
if (!apiKey) {
|
562
739
|
throw new Error("Could not resolve a valid apiKey");
|
563
740
|
}
|
@@ -565,7 +742,8 @@ class XataApiClient {
|
|
565
742
|
apiUrl: getHostUrl(provider, "main"),
|
566
743
|
workspacesApiUrl: getHostUrl(provider, "workspaces"),
|
567
744
|
fetchImpl: getFetchImplementation(options.fetch),
|
568
|
-
apiKey
|
745
|
+
apiKey,
|
746
|
+
trace
|
569
747
|
});
|
570
748
|
}
|
571
749
|
get user() {
|
@@ -573,21 +751,41 @@ class XataApiClient {
|
|
573
751
|
__privateGet$7(this, _namespaces).user = new UserApi(__privateGet$7(this, _extraProps));
|
574
752
|
return __privateGet$7(this, _namespaces).user;
|
575
753
|
}
|
754
|
+
get authentication() {
|
755
|
+
if (!__privateGet$7(this, _namespaces).authentication)
|
756
|
+
__privateGet$7(this, _namespaces).authentication = new AuthenticationApi(__privateGet$7(this, _extraProps));
|
757
|
+
return __privateGet$7(this, _namespaces).authentication;
|
758
|
+
}
|
576
759
|
get workspaces() {
|
577
760
|
if (!__privateGet$7(this, _namespaces).workspaces)
|
578
761
|
__privateGet$7(this, _namespaces).workspaces = new WorkspaceApi(__privateGet$7(this, _extraProps));
|
579
762
|
return __privateGet$7(this, _namespaces).workspaces;
|
580
763
|
}
|
581
|
-
get
|
582
|
-
if (!__privateGet$7(this, _namespaces).
|
583
|
-
__privateGet$7(this, _namespaces).
|
584
|
-
return __privateGet$7(this, _namespaces).
|
764
|
+
get invites() {
|
765
|
+
if (!__privateGet$7(this, _namespaces).invites)
|
766
|
+
__privateGet$7(this, _namespaces).invites = new InvitesApi(__privateGet$7(this, _extraProps));
|
767
|
+
return __privateGet$7(this, _namespaces).invites;
|
768
|
+
}
|
769
|
+
get database() {
|
770
|
+
if (!__privateGet$7(this, _namespaces).database)
|
771
|
+
__privateGet$7(this, _namespaces).database = new DatabaseApi(__privateGet$7(this, _extraProps));
|
772
|
+
return __privateGet$7(this, _namespaces).database;
|
585
773
|
}
|
586
774
|
get branches() {
|
587
775
|
if (!__privateGet$7(this, _namespaces).branches)
|
588
776
|
__privateGet$7(this, _namespaces).branches = new BranchApi(__privateGet$7(this, _extraProps));
|
589
777
|
return __privateGet$7(this, _namespaces).branches;
|
590
778
|
}
|
779
|
+
get migrations() {
|
780
|
+
if (!__privateGet$7(this, _namespaces).migrations)
|
781
|
+
__privateGet$7(this, _namespaces).migrations = new MigrationsApi(__privateGet$7(this, _extraProps));
|
782
|
+
return __privateGet$7(this, _namespaces).migrations;
|
783
|
+
}
|
784
|
+
get migrationRequests() {
|
785
|
+
if (!__privateGet$7(this, _namespaces).migrationRequests)
|
786
|
+
__privateGet$7(this, _namespaces).migrationRequests = new MigrationRequestsApi(__privateGet$7(this, _extraProps));
|
787
|
+
return __privateGet$7(this, _namespaces).migrationRequests;
|
788
|
+
}
|
591
789
|
get tables() {
|
592
790
|
if (!__privateGet$7(this, _namespaces).tables)
|
593
791
|
__privateGet$7(this, _namespaces).tables = new TableApi(__privateGet$7(this, _extraProps));
|
@@ -598,6 +796,11 @@ class XataApiClient {
|
|
598
796
|
__privateGet$7(this, _namespaces).records = new RecordsApi(__privateGet$7(this, _extraProps));
|
599
797
|
return __privateGet$7(this, _namespaces).records;
|
600
798
|
}
|
799
|
+
get searchAndFilter() {
|
800
|
+
if (!__privateGet$7(this, _namespaces).searchAndFilter)
|
801
|
+
__privateGet$7(this, _namespaces).searchAndFilter = new SearchAndFilterApi(__privateGet$7(this, _extraProps));
|
802
|
+
return __privateGet$7(this, _namespaces).searchAndFilter;
|
803
|
+
}
|
601
804
|
}
|
602
805
|
_extraProps = new WeakMap();
|
603
806
|
_namespaces = new WeakMap();
|
@@ -608,24 +811,29 @@ class UserApi {
|
|
608
811
|
getUser() {
|
609
812
|
return operationsByTag.users.getUser({ ...this.extraProps });
|
610
813
|
}
|
611
|
-
updateUser(user) {
|
814
|
+
updateUser({ user }) {
|
612
815
|
return operationsByTag.users.updateUser({ body: user, ...this.extraProps });
|
613
816
|
}
|
614
817
|
deleteUser() {
|
615
818
|
return operationsByTag.users.deleteUser({ ...this.extraProps });
|
616
819
|
}
|
820
|
+
}
|
821
|
+
class AuthenticationApi {
|
822
|
+
constructor(extraProps) {
|
823
|
+
this.extraProps = extraProps;
|
824
|
+
}
|
617
825
|
getUserAPIKeys() {
|
618
|
-
return operationsByTag.
|
826
|
+
return operationsByTag.authentication.getUserAPIKeys({ ...this.extraProps });
|
619
827
|
}
|
620
|
-
createUserAPIKey(
|
621
|
-
return operationsByTag.
|
622
|
-
pathParams: { keyName },
|
828
|
+
createUserAPIKey({ name }) {
|
829
|
+
return operationsByTag.authentication.createUserAPIKey({
|
830
|
+
pathParams: { keyName: name },
|
623
831
|
...this.extraProps
|
624
832
|
});
|
625
833
|
}
|
626
|
-
deleteUserAPIKey(
|
627
|
-
return operationsByTag.
|
628
|
-
pathParams: { keyName },
|
834
|
+
deleteUserAPIKey({ name }) {
|
835
|
+
return operationsByTag.authentication.deleteUserAPIKey({
|
836
|
+
pathParams: { keyName: name },
|
629
837
|
...this.extraProps
|
630
838
|
});
|
631
839
|
}
|
@@ -634,353 +842,882 @@ class WorkspaceApi {
|
|
634
842
|
constructor(extraProps) {
|
635
843
|
this.extraProps = extraProps;
|
636
844
|
}
|
637
|
-
|
845
|
+
getWorkspacesList() {
|
846
|
+
return operationsByTag.workspaces.getWorkspacesList({ ...this.extraProps });
|
847
|
+
}
|
848
|
+
createWorkspace({ data }) {
|
638
849
|
return operationsByTag.workspaces.createWorkspace({
|
639
|
-
body:
|
850
|
+
body: data,
|
640
851
|
...this.extraProps
|
641
852
|
});
|
642
853
|
}
|
643
|
-
|
644
|
-
return operationsByTag.workspaces.getWorkspacesList({ ...this.extraProps });
|
645
|
-
}
|
646
|
-
getWorkspace(workspaceId) {
|
854
|
+
getWorkspace({ workspace }) {
|
647
855
|
return operationsByTag.workspaces.getWorkspace({
|
648
|
-
pathParams: { workspaceId },
|
856
|
+
pathParams: { workspaceId: workspace },
|
649
857
|
...this.extraProps
|
650
858
|
});
|
651
859
|
}
|
652
|
-
updateWorkspace(
|
860
|
+
updateWorkspace({
|
861
|
+
workspace,
|
862
|
+
update
|
863
|
+
}) {
|
653
864
|
return operationsByTag.workspaces.updateWorkspace({
|
654
|
-
pathParams: { workspaceId },
|
655
|
-
body:
|
865
|
+
pathParams: { workspaceId: workspace },
|
866
|
+
body: update,
|
656
867
|
...this.extraProps
|
657
868
|
});
|
658
869
|
}
|
659
|
-
deleteWorkspace(
|
870
|
+
deleteWorkspace({ workspace }) {
|
660
871
|
return operationsByTag.workspaces.deleteWorkspace({
|
661
|
-
pathParams: { workspaceId },
|
872
|
+
pathParams: { workspaceId: workspace },
|
662
873
|
...this.extraProps
|
663
874
|
});
|
664
875
|
}
|
665
|
-
getWorkspaceMembersList(
|
876
|
+
getWorkspaceMembersList({ workspace }) {
|
666
877
|
return operationsByTag.workspaces.getWorkspaceMembersList({
|
667
|
-
pathParams: { workspaceId },
|
878
|
+
pathParams: { workspaceId: workspace },
|
668
879
|
...this.extraProps
|
669
880
|
});
|
670
881
|
}
|
671
|
-
updateWorkspaceMemberRole(
|
882
|
+
updateWorkspaceMemberRole({
|
883
|
+
workspace,
|
884
|
+
user,
|
885
|
+
role
|
886
|
+
}) {
|
672
887
|
return operationsByTag.workspaces.updateWorkspaceMemberRole({
|
673
|
-
pathParams: { workspaceId, userId },
|
888
|
+
pathParams: { workspaceId: workspace, userId: user },
|
674
889
|
body: { role },
|
675
890
|
...this.extraProps
|
676
891
|
});
|
677
892
|
}
|
678
|
-
removeWorkspaceMember(
|
893
|
+
removeWorkspaceMember({
|
894
|
+
workspace,
|
895
|
+
user
|
896
|
+
}) {
|
679
897
|
return operationsByTag.workspaces.removeWorkspaceMember({
|
680
|
-
pathParams: { workspaceId, userId },
|
898
|
+
pathParams: { workspaceId: workspace, userId: user },
|
681
899
|
...this.extraProps
|
682
900
|
});
|
683
901
|
}
|
684
|
-
|
685
|
-
|
686
|
-
|
902
|
+
}
|
903
|
+
class InvitesApi {
|
904
|
+
constructor(extraProps) {
|
905
|
+
this.extraProps = extraProps;
|
906
|
+
}
|
907
|
+
inviteWorkspaceMember({
|
908
|
+
workspace,
|
909
|
+
email,
|
910
|
+
role
|
911
|
+
}) {
|
912
|
+
return operationsByTag.invites.inviteWorkspaceMember({
|
913
|
+
pathParams: { workspaceId: workspace },
|
687
914
|
body: { email, role },
|
688
915
|
...this.extraProps
|
689
916
|
});
|
690
917
|
}
|
691
|
-
updateWorkspaceMemberInvite(
|
692
|
-
|
693
|
-
|
918
|
+
updateWorkspaceMemberInvite({
|
919
|
+
workspace,
|
920
|
+
invite,
|
921
|
+
role
|
922
|
+
}) {
|
923
|
+
return operationsByTag.invites.updateWorkspaceMemberInvite({
|
924
|
+
pathParams: { workspaceId: workspace, inviteId: invite },
|
694
925
|
body: { role },
|
695
926
|
...this.extraProps
|
696
927
|
});
|
697
928
|
}
|
698
|
-
cancelWorkspaceMemberInvite(
|
699
|
-
|
700
|
-
|
929
|
+
cancelWorkspaceMemberInvite({
|
930
|
+
workspace,
|
931
|
+
invite
|
932
|
+
}) {
|
933
|
+
return operationsByTag.invites.cancelWorkspaceMemberInvite({
|
934
|
+
pathParams: { workspaceId: workspace, inviteId: invite },
|
701
935
|
...this.extraProps
|
702
936
|
});
|
703
937
|
}
|
704
|
-
|
705
|
-
|
706
|
-
|
938
|
+
acceptWorkspaceMemberInvite({
|
939
|
+
workspace,
|
940
|
+
key
|
941
|
+
}) {
|
942
|
+
return operationsByTag.invites.acceptWorkspaceMemberInvite({
|
943
|
+
pathParams: { workspaceId: workspace, inviteKey: key },
|
707
944
|
...this.extraProps
|
708
945
|
});
|
709
946
|
}
|
710
|
-
|
711
|
-
|
712
|
-
|
947
|
+
resendWorkspaceMemberInvite({
|
948
|
+
workspace,
|
949
|
+
invite
|
950
|
+
}) {
|
951
|
+
return operationsByTag.invites.resendWorkspaceMemberInvite({
|
952
|
+
pathParams: { workspaceId: workspace, inviteId: invite },
|
713
953
|
...this.extraProps
|
714
954
|
});
|
715
955
|
}
|
716
956
|
}
|
717
|
-
class
|
957
|
+
class BranchApi {
|
958
|
+
constructor(extraProps) {
|
959
|
+
this.extraProps = extraProps;
|
960
|
+
}
|
961
|
+
getBranchList({
|
962
|
+
workspace,
|
963
|
+
region,
|
964
|
+
database
|
965
|
+
}) {
|
966
|
+
return operationsByTag.branch.getBranchList({
|
967
|
+
pathParams: { workspace, region, dbName: database },
|
968
|
+
...this.extraProps
|
969
|
+
});
|
970
|
+
}
|
971
|
+
getBranchDetails({
|
972
|
+
workspace,
|
973
|
+
region,
|
974
|
+
database,
|
975
|
+
branch
|
976
|
+
}) {
|
977
|
+
return operationsByTag.branch.getBranchDetails({
|
978
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
979
|
+
...this.extraProps
|
980
|
+
});
|
981
|
+
}
|
982
|
+
createBranch({
|
983
|
+
workspace,
|
984
|
+
region,
|
985
|
+
database,
|
986
|
+
branch,
|
987
|
+
from,
|
988
|
+
metadata
|
989
|
+
}) {
|
990
|
+
return operationsByTag.branch.createBranch({
|
991
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
992
|
+
body: { from, metadata },
|
993
|
+
...this.extraProps
|
994
|
+
});
|
995
|
+
}
|
996
|
+
deleteBranch({
|
997
|
+
workspace,
|
998
|
+
region,
|
999
|
+
database,
|
1000
|
+
branch
|
1001
|
+
}) {
|
1002
|
+
return operationsByTag.branch.deleteBranch({
|
1003
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1004
|
+
...this.extraProps
|
1005
|
+
});
|
1006
|
+
}
|
1007
|
+
updateBranchMetadata({
|
1008
|
+
workspace,
|
1009
|
+
region,
|
1010
|
+
database,
|
1011
|
+
branch,
|
1012
|
+
metadata
|
1013
|
+
}) {
|
1014
|
+
return operationsByTag.branch.updateBranchMetadata({
|
1015
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1016
|
+
body: metadata,
|
1017
|
+
...this.extraProps
|
1018
|
+
});
|
1019
|
+
}
|
1020
|
+
getBranchMetadata({
|
1021
|
+
workspace,
|
1022
|
+
region,
|
1023
|
+
database,
|
1024
|
+
branch
|
1025
|
+
}) {
|
1026
|
+
return operationsByTag.branch.getBranchMetadata({
|
1027
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1028
|
+
...this.extraProps
|
1029
|
+
});
|
1030
|
+
}
|
1031
|
+
getBranchStats({
|
1032
|
+
workspace,
|
1033
|
+
region,
|
1034
|
+
database,
|
1035
|
+
branch
|
1036
|
+
}) {
|
1037
|
+
return operationsByTag.branch.getBranchStats({
|
1038
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1039
|
+
...this.extraProps
|
1040
|
+
});
|
1041
|
+
}
|
1042
|
+
getGitBranchesMapping({
|
1043
|
+
workspace,
|
1044
|
+
region,
|
1045
|
+
database
|
1046
|
+
}) {
|
1047
|
+
return operationsByTag.branch.getGitBranchesMapping({
|
1048
|
+
pathParams: { workspace, region, dbName: database },
|
1049
|
+
...this.extraProps
|
1050
|
+
});
|
1051
|
+
}
|
1052
|
+
addGitBranchesEntry({
|
1053
|
+
workspace,
|
1054
|
+
region,
|
1055
|
+
database,
|
1056
|
+
gitBranch,
|
1057
|
+
xataBranch
|
1058
|
+
}) {
|
1059
|
+
return operationsByTag.branch.addGitBranchesEntry({
|
1060
|
+
pathParams: { workspace, region, dbName: database },
|
1061
|
+
body: { gitBranch, xataBranch },
|
1062
|
+
...this.extraProps
|
1063
|
+
});
|
1064
|
+
}
|
1065
|
+
removeGitBranchesEntry({
|
1066
|
+
workspace,
|
1067
|
+
region,
|
1068
|
+
database,
|
1069
|
+
gitBranch
|
1070
|
+
}) {
|
1071
|
+
return operationsByTag.branch.removeGitBranchesEntry({
|
1072
|
+
pathParams: { workspace, region, dbName: database },
|
1073
|
+
queryParams: { gitBranch },
|
1074
|
+
...this.extraProps
|
1075
|
+
});
|
1076
|
+
}
|
1077
|
+
resolveBranch({
|
1078
|
+
workspace,
|
1079
|
+
region,
|
1080
|
+
database,
|
1081
|
+
gitBranch,
|
1082
|
+
fallbackBranch
|
1083
|
+
}) {
|
1084
|
+
return operationsByTag.branch.resolveBranch({
|
1085
|
+
pathParams: { workspace, region, dbName: database },
|
1086
|
+
queryParams: { gitBranch, fallbackBranch },
|
1087
|
+
...this.extraProps
|
1088
|
+
});
|
1089
|
+
}
|
1090
|
+
}
|
1091
|
+
class TableApi {
|
718
1092
|
constructor(extraProps) {
|
719
1093
|
this.extraProps = extraProps;
|
720
1094
|
}
|
721
|
-
|
722
|
-
|
723
|
-
|
1095
|
+
createTable({
|
1096
|
+
workspace,
|
1097
|
+
region,
|
1098
|
+
database,
|
1099
|
+
branch,
|
1100
|
+
table
|
1101
|
+
}) {
|
1102
|
+
return operationsByTag.table.createTable({
|
1103
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
724
1104
|
...this.extraProps
|
725
1105
|
});
|
726
1106
|
}
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
1107
|
+
deleteTable({
|
1108
|
+
workspace,
|
1109
|
+
region,
|
1110
|
+
database,
|
1111
|
+
branch,
|
1112
|
+
table
|
1113
|
+
}) {
|
1114
|
+
return operationsByTag.table.deleteTable({
|
1115
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
731
1116
|
...this.extraProps
|
732
1117
|
});
|
733
1118
|
}
|
734
|
-
|
735
|
-
|
736
|
-
|
1119
|
+
updateTable({
|
1120
|
+
workspace,
|
1121
|
+
region,
|
1122
|
+
database,
|
1123
|
+
branch,
|
1124
|
+
table,
|
1125
|
+
update
|
1126
|
+
}) {
|
1127
|
+
return operationsByTag.table.updateTable({
|
1128
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1129
|
+
body: update,
|
1130
|
+
...this.extraProps
|
1131
|
+
});
|
1132
|
+
}
|
1133
|
+
getTableSchema({
|
1134
|
+
workspace,
|
1135
|
+
region,
|
1136
|
+
database,
|
1137
|
+
branch,
|
1138
|
+
table
|
1139
|
+
}) {
|
1140
|
+
return operationsByTag.table.getTableSchema({
|
1141
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1142
|
+
...this.extraProps
|
1143
|
+
});
|
1144
|
+
}
|
1145
|
+
setTableSchema({
|
1146
|
+
workspace,
|
1147
|
+
region,
|
1148
|
+
database,
|
1149
|
+
branch,
|
1150
|
+
table,
|
1151
|
+
schema
|
1152
|
+
}) {
|
1153
|
+
return operationsByTag.table.setTableSchema({
|
1154
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1155
|
+
body: schema,
|
1156
|
+
...this.extraProps
|
1157
|
+
});
|
1158
|
+
}
|
1159
|
+
getTableColumns({
|
1160
|
+
workspace,
|
1161
|
+
region,
|
1162
|
+
database,
|
1163
|
+
branch,
|
1164
|
+
table
|
1165
|
+
}) {
|
1166
|
+
return operationsByTag.table.getTableColumns({
|
1167
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1168
|
+
...this.extraProps
|
1169
|
+
});
|
1170
|
+
}
|
1171
|
+
addTableColumn({
|
1172
|
+
workspace,
|
1173
|
+
region,
|
1174
|
+
database,
|
1175
|
+
branch,
|
1176
|
+
table,
|
1177
|
+
column
|
1178
|
+
}) {
|
1179
|
+
return operationsByTag.table.addTableColumn({
|
1180
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1181
|
+
body: column,
|
1182
|
+
...this.extraProps
|
1183
|
+
});
|
1184
|
+
}
|
1185
|
+
getColumn({
|
1186
|
+
workspace,
|
1187
|
+
region,
|
1188
|
+
database,
|
1189
|
+
branch,
|
1190
|
+
table,
|
1191
|
+
column
|
1192
|
+
}) {
|
1193
|
+
return operationsByTag.table.getColumn({
|
1194
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, columnName: column },
|
1195
|
+
...this.extraProps
|
1196
|
+
});
|
1197
|
+
}
|
1198
|
+
updateColumn({
|
1199
|
+
workspace,
|
1200
|
+
region,
|
1201
|
+
database,
|
1202
|
+
branch,
|
1203
|
+
table,
|
1204
|
+
column,
|
1205
|
+
update
|
1206
|
+
}) {
|
1207
|
+
return operationsByTag.table.updateColumn({
|
1208
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, columnName: column },
|
1209
|
+
body: update,
|
1210
|
+
...this.extraProps
|
1211
|
+
});
|
1212
|
+
}
|
1213
|
+
deleteColumn({
|
1214
|
+
workspace,
|
1215
|
+
region,
|
1216
|
+
database,
|
1217
|
+
branch,
|
1218
|
+
table,
|
1219
|
+
column
|
1220
|
+
}) {
|
1221
|
+
return operationsByTag.table.deleteColumn({
|
1222
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, columnName: column },
|
1223
|
+
...this.extraProps
|
1224
|
+
});
|
1225
|
+
}
|
1226
|
+
}
|
1227
|
+
class RecordsApi {
|
1228
|
+
constructor(extraProps) {
|
1229
|
+
this.extraProps = extraProps;
|
1230
|
+
}
|
1231
|
+
insertRecord({
|
1232
|
+
workspace,
|
1233
|
+
region,
|
1234
|
+
database,
|
1235
|
+
branch,
|
1236
|
+
table,
|
1237
|
+
record,
|
1238
|
+
columns
|
1239
|
+
}) {
|
1240
|
+
return operationsByTag.records.insertRecord({
|
1241
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1242
|
+
queryParams: { columns },
|
1243
|
+
body: record,
|
1244
|
+
...this.extraProps
|
1245
|
+
});
|
1246
|
+
}
|
1247
|
+
getRecord({
|
1248
|
+
workspace,
|
1249
|
+
region,
|
1250
|
+
database,
|
1251
|
+
branch,
|
1252
|
+
table,
|
1253
|
+
id,
|
1254
|
+
columns
|
1255
|
+
}) {
|
1256
|
+
return operationsByTag.records.getRecord({
|
1257
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1258
|
+
queryParams: { columns },
|
1259
|
+
...this.extraProps
|
1260
|
+
});
|
1261
|
+
}
|
1262
|
+
insertRecordWithID({
|
1263
|
+
workspace,
|
1264
|
+
region,
|
1265
|
+
database,
|
1266
|
+
branch,
|
1267
|
+
table,
|
1268
|
+
id,
|
1269
|
+
record,
|
1270
|
+
columns,
|
1271
|
+
createOnly,
|
1272
|
+
ifVersion
|
1273
|
+
}) {
|
1274
|
+
return operationsByTag.records.insertRecordWithID({
|
1275
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1276
|
+
queryParams: { columns, createOnly, ifVersion },
|
1277
|
+
body: record,
|
1278
|
+
...this.extraProps
|
1279
|
+
});
|
1280
|
+
}
|
1281
|
+
updateRecordWithID({
|
1282
|
+
workspace,
|
1283
|
+
region,
|
1284
|
+
database,
|
1285
|
+
branch,
|
1286
|
+
table,
|
1287
|
+
id,
|
1288
|
+
record,
|
1289
|
+
columns,
|
1290
|
+
ifVersion
|
1291
|
+
}) {
|
1292
|
+
return operationsByTag.records.updateRecordWithID({
|
1293
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1294
|
+
queryParams: { columns, ifVersion },
|
1295
|
+
body: record,
|
1296
|
+
...this.extraProps
|
1297
|
+
});
|
1298
|
+
}
|
1299
|
+
upsertRecordWithID({
|
1300
|
+
workspace,
|
1301
|
+
region,
|
1302
|
+
database,
|
1303
|
+
branch,
|
1304
|
+
table,
|
1305
|
+
id,
|
1306
|
+
record,
|
1307
|
+
columns,
|
1308
|
+
ifVersion
|
1309
|
+
}) {
|
1310
|
+
return operationsByTag.records.upsertRecordWithID({
|
1311
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1312
|
+
queryParams: { columns, ifVersion },
|
1313
|
+
body: record,
|
1314
|
+
...this.extraProps
|
1315
|
+
});
|
1316
|
+
}
|
1317
|
+
deleteRecord({
|
1318
|
+
workspace,
|
1319
|
+
region,
|
1320
|
+
database,
|
1321
|
+
branch,
|
1322
|
+
table,
|
1323
|
+
id,
|
1324
|
+
columns
|
1325
|
+
}) {
|
1326
|
+
return operationsByTag.records.deleteRecord({
|
1327
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1328
|
+
queryParams: { columns },
|
1329
|
+
...this.extraProps
|
1330
|
+
});
|
1331
|
+
}
|
1332
|
+
bulkInsertTableRecords({
|
1333
|
+
workspace,
|
1334
|
+
region,
|
1335
|
+
database,
|
1336
|
+
branch,
|
1337
|
+
table,
|
1338
|
+
records,
|
1339
|
+
columns
|
1340
|
+
}) {
|
1341
|
+
return operationsByTag.records.bulkInsertTableRecords({
|
1342
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1343
|
+
queryParams: { columns },
|
1344
|
+
body: { records },
|
1345
|
+
...this.extraProps
|
1346
|
+
});
|
1347
|
+
}
|
1348
|
+
}
|
1349
|
+
class SearchAndFilterApi {
|
1350
|
+
constructor(extraProps) {
|
1351
|
+
this.extraProps = extraProps;
|
1352
|
+
}
|
1353
|
+
queryTable({
|
1354
|
+
workspace,
|
1355
|
+
region,
|
1356
|
+
database,
|
1357
|
+
branch,
|
1358
|
+
table,
|
1359
|
+
filter,
|
1360
|
+
sort,
|
1361
|
+
page,
|
1362
|
+
columns
|
1363
|
+
}) {
|
1364
|
+
return operationsByTag.searchAndFilter.queryTable({
|
1365
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1366
|
+
body: { filter, sort, page, columns },
|
737
1367
|
...this.extraProps
|
738
1368
|
});
|
739
1369
|
}
|
740
|
-
|
741
|
-
|
742
|
-
|
1370
|
+
searchTable({
|
1371
|
+
workspace,
|
1372
|
+
region,
|
1373
|
+
database,
|
1374
|
+
branch,
|
1375
|
+
table,
|
1376
|
+
query,
|
1377
|
+
fuzziness,
|
1378
|
+
target,
|
1379
|
+
prefix,
|
1380
|
+
filter,
|
1381
|
+
highlight,
|
1382
|
+
boosters
|
1383
|
+
}) {
|
1384
|
+
return operationsByTag.searchAndFilter.searchTable({
|
1385
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1386
|
+
body: { query, fuzziness, target, prefix, filter, highlight, boosters },
|
743
1387
|
...this.extraProps
|
744
1388
|
});
|
745
1389
|
}
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
1390
|
+
searchBranch({
|
1391
|
+
workspace,
|
1392
|
+
region,
|
1393
|
+
database,
|
1394
|
+
branch,
|
1395
|
+
tables,
|
1396
|
+
query,
|
1397
|
+
fuzziness,
|
1398
|
+
prefix,
|
1399
|
+
highlight
|
1400
|
+
}) {
|
1401
|
+
return operationsByTag.searchAndFilter.searchBranch({
|
1402
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1403
|
+
body: { tables, query, fuzziness, prefix, highlight },
|
750
1404
|
...this.extraProps
|
751
1405
|
});
|
752
1406
|
}
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
1407
|
+
summarizeTable({
|
1408
|
+
workspace,
|
1409
|
+
region,
|
1410
|
+
database,
|
1411
|
+
branch,
|
1412
|
+
table,
|
1413
|
+
filter,
|
1414
|
+
columns,
|
1415
|
+
summaries,
|
1416
|
+
sort,
|
1417
|
+
summariesFilter,
|
1418
|
+
page
|
1419
|
+
}) {
|
1420
|
+
return operationsByTag.searchAndFilter.summarizeTable({
|
1421
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1422
|
+
body: { filter, columns, summaries, sort, summariesFilter, page },
|
757
1423
|
...this.extraProps
|
758
1424
|
});
|
759
1425
|
}
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
1426
|
+
aggregateTable({
|
1427
|
+
workspace,
|
1428
|
+
region,
|
1429
|
+
database,
|
1430
|
+
branch,
|
1431
|
+
table,
|
1432
|
+
filter,
|
1433
|
+
aggs
|
1434
|
+
}) {
|
1435
|
+
return operationsByTag.searchAndFilter.aggregateTable({
|
1436
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1437
|
+
body: { filter, aggs },
|
764
1438
|
...this.extraProps
|
765
1439
|
});
|
766
1440
|
}
|
767
1441
|
}
|
768
|
-
class
|
1442
|
+
class MigrationRequestsApi {
|
769
1443
|
constructor(extraProps) {
|
770
1444
|
this.extraProps = extraProps;
|
771
1445
|
}
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
createBranch(workspace, database, branch, from, options = {}) {
|
785
|
-
return operationsByTag.branch.createBranch({
|
786
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}` },
|
787
|
-
queryParams: isString(from) ? { from } : void 0,
|
788
|
-
body: options,
|
1446
|
+
queryMigrationRequests({
|
1447
|
+
workspace,
|
1448
|
+
region,
|
1449
|
+
database,
|
1450
|
+
filter,
|
1451
|
+
sort,
|
1452
|
+
page,
|
1453
|
+
columns
|
1454
|
+
}) {
|
1455
|
+
return operationsByTag.migrationRequests.queryMigrationRequests({
|
1456
|
+
pathParams: { workspace, region, dbName: database },
|
1457
|
+
body: { filter, sort, page, columns },
|
789
1458
|
...this.extraProps
|
790
1459
|
});
|
791
1460
|
}
|
792
|
-
|
793
|
-
|
794
|
-
|
1461
|
+
createMigrationRequest({
|
1462
|
+
workspace,
|
1463
|
+
region,
|
1464
|
+
database,
|
1465
|
+
migration
|
1466
|
+
}) {
|
1467
|
+
return operationsByTag.migrationRequests.createMigrationRequest({
|
1468
|
+
pathParams: { workspace, region, dbName: database },
|
1469
|
+
body: migration,
|
795
1470
|
...this.extraProps
|
796
1471
|
});
|
797
1472
|
}
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
1473
|
+
getMigrationRequest({
|
1474
|
+
workspace,
|
1475
|
+
region,
|
1476
|
+
database,
|
1477
|
+
migrationRequest
|
1478
|
+
}) {
|
1479
|
+
return operationsByTag.migrationRequests.getMigrationRequest({
|
1480
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
802
1481
|
...this.extraProps
|
803
1482
|
});
|
804
1483
|
}
|
805
|
-
|
806
|
-
|
807
|
-
|
1484
|
+
updateMigrationRequest({
|
1485
|
+
workspace,
|
1486
|
+
region,
|
1487
|
+
database,
|
1488
|
+
migrationRequest,
|
1489
|
+
update
|
1490
|
+
}) {
|
1491
|
+
return operationsByTag.migrationRequests.updateMigrationRequest({
|
1492
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
1493
|
+
body: update,
|
808
1494
|
...this.extraProps
|
809
1495
|
});
|
810
1496
|
}
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
1497
|
+
listMigrationRequestsCommits({
|
1498
|
+
workspace,
|
1499
|
+
region,
|
1500
|
+
database,
|
1501
|
+
migrationRequest,
|
1502
|
+
page
|
1503
|
+
}) {
|
1504
|
+
return operationsByTag.migrationRequests.listMigrationRequestsCommits({
|
1505
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
1506
|
+
body: { page },
|
815
1507
|
...this.extraProps
|
816
1508
|
});
|
817
1509
|
}
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
1510
|
+
compareMigrationRequest({
|
1511
|
+
workspace,
|
1512
|
+
region,
|
1513
|
+
database,
|
1514
|
+
migrationRequest
|
1515
|
+
}) {
|
1516
|
+
return operationsByTag.migrationRequests.compareMigrationRequest({
|
1517
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
822
1518
|
...this.extraProps
|
823
1519
|
});
|
824
1520
|
}
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
1521
|
+
getMigrationRequestIsMerged({
|
1522
|
+
workspace,
|
1523
|
+
region,
|
1524
|
+
database,
|
1525
|
+
migrationRequest
|
1526
|
+
}) {
|
1527
|
+
return operationsByTag.migrationRequests.getMigrationRequestIsMerged({
|
1528
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
829
1529
|
...this.extraProps
|
830
1530
|
});
|
831
1531
|
}
|
832
|
-
|
833
|
-
|
834
|
-
|
1532
|
+
mergeMigrationRequest({
|
1533
|
+
workspace,
|
1534
|
+
region,
|
1535
|
+
database,
|
1536
|
+
migrationRequest
|
1537
|
+
}) {
|
1538
|
+
return operationsByTag.migrationRequests.mergeMigrationRequest({
|
1539
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
835
1540
|
...this.extraProps
|
836
1541
|
});
|
837
1542
|
}
|
838
1543
|
}
|
839
|
-
class
|
1544
|
+
class MigrationsApi {
|
840
1545
|
constructor(extraProps) {
|
841
1546
|
this.extraProps = extraProps;
|
842
1547
|
}
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
1548
|
+
getBranchMigrationHistory({
|
1549
|
+
workspace,
|
1550
|
+
region,
|
1551
|
+
database,
|
1552
|
+
branch,
|
1553
|
+
limit,
|
1554
|
+
startFrom
|
1555
|
+
}) {
|
1556
|
+
return operationsByTag.migrations.getBranchMigrationHistory({
|
1557
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1558
|
+
body: { limit, startFrom },
|
852
1559
|
...this.extraProps
|
853
1560
|
});
|
854
1561
|
}
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
1562
|
+
getBranchMigrationPlan({
|
1563
|
+
workspace,
|
1564
|
+
region,
|
1565
|
+
database,
|
1566
|
+
branch,
|
1567
|
+
schema
|
1568
|
+
}) {
|
1569
|
+
return operationsByTag.migrations.getBranchMigrationPlan({
|
1570
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1571
|
+
body: schema,
|
859
1572
|
...this.extraProps
|
860
1573
|
});
|
861
1574
|
}
|
862
|
-
|
863
|
-
|
864
|
-
|
1575
|
+
executeBranchMigrationPlan({
|
1576
|
+
workspace,
|
1577
|
+
region,
|
1578
|
+
database,
|
1579
|
+
branch,
|
1580
|
+
plan
|
1581
|
+
}) {
|
1582
|
+
return operationsByTag.migrations.executeBranchMigrationPlan({
|
1583
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1584
|
+
body: plan,
|
865
1585
|
...this.extraProps
|
866
1586
|
});
|
867
1587
|
}
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
1588
|
+
getBranchSchemaHistory({
|
1589
|
+
workspace,
|
1590
|
+
region,
|
1591
|
+
database,
|
1592
|
+
branch,
|
1593
|
+
page
|
1594
|
+
}) {
|
1595
|
+
return operationsByTag.migrations.getBranchSchemaHistory({
|
1596
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1597
|
+
body: { page },
|
872
1598
|
...this.extraProps
|
873
1599
|
});
|
874
1600
|
}
|
875
|
-
|
876
|
-
|
877
|
-
|
1601
|
+
compareBranchWithUserSchema({
|
1602
|
+
workspace,
|
1603
|
+
region,
|
1604
|
+
database,
|
1605
|
+
branch,
|
1606
|
+
schema
|
1607
|
+
}) {
|
1608
|
+
return operationsByTag.migrations.compareBranchWithUserSchema({
|
1609
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1610
|
+
body: { schema },
|
878
1611
|
...this.extraProps
|
879
1612
|
});
|
880
1613
|
}
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
|
1614
|
+
compareBranchSchemas({
|
1615
|
+
workspace,
|
1616
|
+
region,
|
1617
|
+
database,
|
1618
|
+
branch,
|
1619
|
+
compare,
|
1620
|
+
schema
|
1621
|
+
}) {
|
1622
|
+
return operationsByTag.migrations.compareBranchSchemas({
|
1623
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, branchName: compare },
|
1624
|
+
body: { schema },
|
885
1625
|
...this.extraProps
|
886
1626
|
});
|
887
1627
|
}
|
888
|
-
|
889
|
-
|
890
|
-
|
1628
|
+
updateBranchSchema({
|
1629
|
+
workspace,
|
1630
|
+
region,
|
1631
|
+
database,
|
1632
|
+
branch,
|
1633
|
+
migration
|
1634
|
+
}) {
|
1635
|
+
return operationsByTag.migrations.updateBranchSchema({
|
1636
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1637
|
+
body: migration,
|
891
1638
|
...this.extraProps
|
892
1639
|
});
|
893
1640
|
}
|
894
|
-
|
895
|
-
|
896
|
-
|
1641
|
+
previewBranchSchemaEdit({
|
1642
|
+
workspace,
|
1643
|
+
region,
|
1644
|
+
database,
|
1645
|
+
branch,
|
1646
|
+
data
|
1647
|
+
}) {
|
1648
|
+
return operationsByTag.migrations.previewBranchSchemaEdit({
|
1649
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1650
|
+
body: data,
|
897
1651
|
...this.extraProps
|
898
1652
|
});
|
899
1653
|
}
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
1654
|
+
applyBranchSchemaEdit({
|
1655
|
+
workspace,
|
1656
|
+
region,
|
1657
|
+
database,
|
1658
|
+
branch,
|
1659
|
+
edits
|
1660
|
+
}) {
|
1661
|
+
return operationsByTag.migrations.applyBranchSchemaEdit({
|
1662
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1663
|
+
body: { edits },
|
904
1664
|
...this.extraProps
|
905
1665
|
});
|
906
1666
|
}
|
907
1667
|
}
|
908
|
-
class
|
1668
|
+
class DatabaseApi {
|
909
1669
|
constructor(extraProps) {
|
910
1670
|
this.extraProps = extraProps;
|
911
1671
|
}
|
912
|
-
|
913
|
-
return operationsByTag.
|
914
|
-
pathParams: {
|
915
|
-
queryParams: options,
|
916
|
-
body: record,
|
917
|
-
...this.extraProps
|
918
|
-
});
|
919
|
-
}
|
920
|
-
insertRecordWithID(workspace, database, branch, tableName, recordId, record, options = {}) {
|
921
|
-
return operationsByTag.records.insertRecordWithID({
|
922
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
|
923
|
-
queryParams: options,
|
924
|
-
body: record,
|
925
|
-
...this.extraProps
|
926
|
-
});
|
927
|
-
}
|
928
|
-
updateRecordWithID(workspace, database, branch, tableName, recordId, record, options = {}) {
|
929
|
-
return operationsByTag.records.updateRecordWithID({
|
930
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
|
931
|
-
queryParams: options,
|
932
|
-
body: record,
|
933
|
-
...this.extraProps
|
934
|
-
});
|
935
|
-
}
|
936
|
-
upsertRecordWithID(workspace, database, branch, tableName, recordId, record, options = {}) {
|
937
|
-
return operationsByTag.records.upsertRecordWithID({
|
938
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
|
939
|
-
queryParams: options,
|
940
|
-
body: record,
|
941
|
-
...this.extraProps
|
942
|
-
});
|
943
|
-
}
|
944
|
-
deleteRecord(workspace, database, branch, tableName, recordId, options = {}) {
|
945
|
-
return operationsByTag.records.deleteRecord({
|
946
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
|
947
|
-
queryParams: options,
|
1672
|
+
getDatabaseList({ workspace }) {
|
1673
|
+
return operationsByTag.databases.getDatabaseList({
|
1674
|
+
pathParams: { workspaceId: workspace },
|
948
1675
|
...this.extraProps
|
949
1676
|
});
|
950
1677
|
}
|
951
|
-
|
952
|
-
|
953
|
-
|
954
|
-
|
1678
|
+
createDatabase({
|
1679
|
+
workspace,
|
1680
|
+
database,
|
1681
|
+
data
|
1682
|
+
}) {
|
1683
|
+
return operationsByTag.databases.createDatabase({
|
1684
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
1685
|
+
body: data,
|
955
1686
|
...this.extraProps
|
956
1687
|
});
|
957
1688
|
}
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
|
1689
|
+
deleteDatabase({
|
1690
|
+
workspace,
|
1691
|
+
database
|
1692
|
+
}) {
|
1693
|
+
return operationsByTag.databases.deleteDatabase({
|
1694
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
963
1695
|
...this.extraProps
|
964
1696
|
});
|
965
1697
|
}
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
|
1698
|
+
getDatabaseMetadata({
|
1699
|
+
workspace,
|
1700
|
+
database
|
1701
|
+
}) {
|
1702
|
+
return operationsByTag.databases.getDatabaseMetadata({
|
1703
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
970
1704
|
...this.extraProps
|
971
1705
|
});
|
972
1706
|
}
|
973
|
-
|
974
|
-
|
975
|
-
|
976
|
-
|
1707
|
+
updateDatabaseMetadata({
|
1708
|
+
workspace,
|
1709
|
+
database,
|
1710
|
+
metadata
|
1711
|
+
}) {
|
1712
|
+
return operationsByTag.databases.updateDatabaseMetadata({
|
1713
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
1714
|
+
body: metadata,
|
977
1715
|
...this.extraProps
|
978
1716
|
});
|
979
1717
|
}
|
980
|
-
|
981
|
-
return operationsByTag.
|
982
|
-
pathParams: {
|
983
|
-
body: query,
|
1718
|
+
listRegions({ workspace }) {
|
1719
|
+
return operationsByTag.databases.listRegions({
|
1720
|
+
pathParams: { workspaceId: workspace },
|
984
1721
|
...this.extraProps
|
985
1722
|
});
|
986
1723
|
}
|
@@ -996,6 +1733,20 @@ class XataApiPlugin {
|
|
996
1733
|
class XataPlugin {
|
997
1734
|
}
|
998
1735
|
|
1736
|
+
function generateUUID() {
|
1737
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
|
1738
|
+
const r = Math.random() * 16 | 0, v = c == "x" ? r : r & 3 | 8;
|
1739
|
+
return v.toString(16);
|
1740
|
+
});
|
1741
|
+
}
|
1742
|
+
|
1743
|
+
function cleanFilter(filter) {
|
1744
|
+
if (!filter)
|
1745
|
+
return void 0;
|
1746
|
+
const values = Object.values(filter).filter(Boolean).filter((value) => Array.isArray(value) ? value.length > 0 : true);
|
1747
|
+
return values.length > 0 ? filter : void 0;
|
1748
|
+
}
|
1749
|
+
|
999
1750
|
var __accessCheck$6 = (obj, member, msg) => {
|
1000
1751
|
if (!member.has(obj))
|
1001
1752
|
throw TypeError("Cannot " + msg);
|
@@ -1028,11 +1779,11 @@ class Page {
|
|
1028
1779
|
async previousPage(size, offset) {
|
1029
1780
|
return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset, before: this.meta.page.cursor } });
|
1030
1781
|
}
|
1031
|
-
async
|
1032
|
-
return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset,
|
1782
|
+
async startPage(size, offset) {
|
1783
|
+
return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset, start: this.meta.page.cursor } });
|
1033
1784
|
}
|
1034
|
-
async
|
1035
|
-
return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset,
|
1785
|
+
async endPage(size, offset) {
|
1786
|
+
return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset, end: this.meta.page.cursor } });
|
1036
1787
|
}
|
1037
1788
|
hasNextPage() {
|
1038
1789
|
return this.meta.page.more;
|
@@ -1044,7 +1795,7 @@ const PAGINATION_DEFAULT_SIZE = 20;
|
|
1044
1795
|
const PAGINATION_MAX_OFFSET = 800;
|
1045
1796
|
const PAGINATION_DEFAULT_OFFSET = 0;
|
1046
1797
|
function isCursorPaginationOptions(options) {
|
1047
|
-
return isDefined(options) && (isDefined(options.
|
1798
|
+
return isDefined(options) && (isDefined(options.start) || isDefined(options.end) || isDefined(options.after) || isDefined(options.before));
|
1048
1799
|
}
|
1049
1800
|
const _RecordArray = class extends Array {
|
1050
1801
|
constructor(...args) {
|
@@ -1076,12 +1827,12 @@ const _RecordArray = class extends Array {
|
|
1076
1827
|
const newPage = await __privateGet$6(this, _page).previousPage(size, offset);
|
1077
1828
|
return new _RecordArray(newPage);
|
1078
1829
|
}
|
1079
|
-
async
|
1080
|
-
const newPage = await __privateGet$6(this, _page).
|
1830
|
+
async startPage(size, offset) {
|
1831
|
+
const newPage = await __privateGet$6(this, _page).startPage(size, offset);
|
1081
1832
|
return new _RecordArray(newPage);
|
1082
1833
|
}
|
1083
|
-
async
|
1084
|
-
const newPage = await __privateGet$6(this, _page).
|
1834
|
+
async endPage(size, offset) {
|
1835
|
+
const newPage = await __privateGet$6(this, _page).endPage(size, offset);
|
1085
1836
|
return new _RecordArray(newPage);
|
1086
1837
|
}
|
1087
1838
|
hasNextPage() {
|
@@ -1109,9 +1860,14 @@ var __privateSet$5 = (obj, member, value, setter) => {
|
|
1109
1860
|
setter ? setter.call(obj, value) : member.set(obj, value);
|
1110
1861
|
return value;
|
1111
1862
|
};
|
1112
|
-
var
|
1863
|
+
var __privateMethod$3 = (obj, member, method) => {
|
1864
|
+
__accessCheck$5(obj, member, "access private method");
|
1865
|
+
return method;
|
1866
|
+
};
|
1867
|
+
var _table$1, _repository, _data, _cleanFilterConstraint, cleanFilterConstraint_fn;
|
1113
1868
|
const _Query = class {
|
1114
1869
|
constructor(repository, table, data, rawParent) {
|
1870
|
+
__privateAdd$5(this, _cleanFilterConstraint);
|
1115
1871
|
__privateAdd$5(this, _table$1, void 0);
|
1116
1872
|
__privateAdd$5(this, _repository, void 0);
|
1117
1873
|
__privateAdd$5(this, _data, { filter: {} });
|
@@ -1130,7 +1886,7 @@ const _Query = class {
|
|
1130
1886
|
__privateGet$5(this, _data).filter.$not = data.filter?.$not ?? parent?.filter?.$not;
|
1131
1887
|
__privateGet$5(this, _data).filter.$none = data.filter?.$none ?? parent?.filter?.$none;
|
1132
1888
|
__privateGet$5(this, _data).sort = data.sort ?? parent?.sort;
|
1133
|
-
__privateGet$5(this, _data).columns = data.columns ?? parent?.columns
|
1889
|
+
__privateGet$5(this, _data).columns = data.columns ?? parent?.columns;
|
1134
1890
|
__privateGet$5(this, _data).pagination = data.pagination ?? parent?.pagination;
|
1135
1891
|
__privateGet$5(this, _data).cache = data.cache ?? parent?.cache;
|
1136
1892
|
this.any = this.any.bind(this);
|
@@ -1168,21 +1924,29 @@ const _Query = class {
|
|
1168
1924
|
}
|
1169
1925
|
filter(a, b) {
|
1170
1926
|
if (arguments.length === 1) {
|
1171
|
-
const constraints = Object.entries(a).map(([column, constraint]) => ({
|
1927
|
+
const constraints = Object.entries(a ?? {}).map(([column, constraint]) => ({
|
1928
|
+
[column]: __privateMethod$3(this, _cleanFilterConstraint, cleanFilterConstraint_fn).call(this, column, constraint)
|
1929
|
+
}));
|
1172
1930
|
const $all = compact([__privateGet$5(this, _data).filter?.$all].flat().concat(constraints));
|
1173
1931
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $all } }, __privateGet$5(this, _data));
|
1174
1932
|
} else {
|
1175
|
-
const
|
1933
|
+
const constraints = isDefined(a) && isDefined(b) ? [{ [a]: __privateMethod$3(this, _cleanFilterConstraint, cleanFilterConstraint_fn).call(this, a, b) }] : void 0;
|
1934
|
+
const $all = compact([__privateGet$5(this, _data).filter?.$all].flat().concat(constraints));
|
1176
1935
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $all } }, __privateGet$5(this, _data));
|
1177
1936
|
}
|
1178
1937
|
}
|
1179
|
-
sort(column, direction) {
|
1938
|
+
sort(column, direction = "asc") {
|
1180
1939
|
const originalSort = [__privateGet$5(this, _data).sort ?? []].flat();
|
1181
1940
|
const sort = [...originalSort, { column, direction }];
|
1182
1941
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { sort }, __privateGet$5(this, _data));
|
1183
1942
|
}
|
1184
1943
|
select(columns) {
|
1185
|
-
return new _Query(
|
1944
|
+
return new _Query(
|
1945
|
+
__privateGet$5(this, _repository),
|
1946
|
+
__privateGet$5(this, _table$1),
|
1947
|
+
{ columns },
|
1948
|
+
__privateGet$5(this, _data)
|
1949
|
+
);
|
1186
1950
|
}
|
1187
1951
|
getPaginated(options = {}) {
|
1188
1952
|
const query = new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), options, __privateGet$5(this, _data));
|
@@ -1205,11 +1969,20 @@ const _Query = class {
|
|
1205
1969
|
}
|
1206
1970
|
}
|
1207
1971
|
async getMany(options = {}) {
|
1208
|
-
const
|
1972
|
+
const { pagination = {}, ...rest } = options;
|
1973
|
+
const { size = PAGINATION_DEFAULT_SIZE, offset } = pagination;
|
1974
|
+
const batchSize = size <= PAGINATION_MAX_SIZE ? size : PAGINATION_MAX_SIZE;
|
1975
|
+
let page = await this.getPaginated({ ...rest, pagination: { size: batchSize, offset } });
|
1976
|
+
const results = [...page.records];
|
1977
|
+
while (page.hasNextPage() && results.length < size) {
|
1978
|
+
page = await page.nextPage();
|
1979
|
+
results.push(...page.records);
|
1980
|
+
}
|
1209
1981
|
if (page.hasNextPage() && options.pagination?.size === void 0) {
|
1210
1982
|
console.trace("Calling getMany does not return all results. Paginate to get all results or call getAll.");
|
1211
1983
|
}
|
1212
|
-
|
1984
|
+
const array = new RecordArray(page, results.slice(0, size));
|
1985
|
+
return array;
|
1213
1986
|
}
|
1214
1987
|
async getAll(options = {}) {
|
1215
1988
|
const { batchSize = PAGINATION_MAX_SIZE, ...rest } = options;
|
@@ -1223,19 +1996,35 @@ const _Query = class {
|
|
1223
1996
|
const records = await this.getMany({ ...options, pagination: { size: 1 } });
|
1224
1997
|
return records[0] ?? null;
|
1225
1998
|
}
|
1999
|
+
async getFirstOrThrow(options = {}) {
|
2000
|
+
const records = await this.getMany({ ...options, pagination: { size: 1 } });
|
2001
|
+
if (records[0] === void 0)
|
2002
|
+
throw new Error("No results found.");
|
2003
|
+
return records[0];
|
2004
|
+
}
|
2005
|
+
async summarize(params = {}) {
|
2006
|
+
const { summaries, summariesFilter, ...options } = params;
|
2007
|
+
const query = new _Query(
|
2008
|
+
__privateGet$5(this, _repository),
|
2009
|
+
__privateGet$5(this, _table$1),
|
2010
|
+
options,
|
2011
|
+
__privateGet$5(this, _data)
|
2012
|
+
);
|
2013
|
+
return __privateGet$5(this, _repository).summarizeTable(query, summaries, summariesFilter);
|
2014
|
+
}
|
1226
2015
|
cache(ttl) {
|
1227
2016
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { cache: ttl }, __privateGet$5(this, _data));
|
1228
2017
|
}
|
1229
2018
|
nextPage(size, offset) {
|
1230
|
-
return this.
|
2019
|
+
return this.startPage(size, offset);
|
1231
2020
|
}
|
1232
2021
|
previousPage(size, offset) {
|
1233
|
-
return this.
|
2022
|
+
return this.startPage(size, offset);
|
1234
2023
|
}
|
1235
|
-
|
2024
|
+
startPage(size, offset) {
|
1236
2025
|
return this.getPaginated({ pagination: { size, offset } });
|
1237
2026
|
}
|
1238
|
-
|
2027
|
+
endPage(size, offset) {
|
1239
2028
|
return this.getPaginated({ pagination: { size, offset, before: "end" } });
|
1240
2029
|
}
|
1241
2030
|
hasNextPage() {
|
@@ -1246,9 +2035,20 @@ let Query = _Query;
|
|
1246
2035
|
_table$1 = new WeakMap();
|
1247
2036
|
_repository = new WeakMap();
|
1248
2037
|
_data = new WeakMap();
|
2038
|
+
_cleanFilterConstraint = new WeakSet();
|
2039
|
+
cleanFilterConstraint_fn = function(column, value) {
|
2040
|
+
const columnType = __privateGet$5(this, _table$1).schema?.columns.find(({ name }) => name === column)?.type;
|
2041
|
+
if (columnType === "multiple" && (isString(value) || isStringArray(value))) {
|
2042
|
+
return { $includes: value };
|
2043
|
+
}
|
2044
|
+
if (columnType === "link" && isObject(value) && isString(value.id)) {
|
2045
|
+
return value.id;
|
2046
|
+
}
|
2047
|
+
return value;
|
2048
|
+
};
|
1249
2049
|
function cleanParent(data, parent) {
|
1250
2050
|
if (isCursorPaginationOptions(data.pagination)) {
|
1251
|
-
return { ...parent,
|
2051
|
+
return { ...parent, sort: void 0, filter: void 0 };
|
1252
2052
|
}
|
1253
2053
|
return parent;
|
1254
2054
|
}
|
@@ -1307,12 +2107,16 @@ var __privateMethod$2 = (obj, member, method) => {
|
|
1307
2107
|
__accessCheck$4(obj, member, "access private method");
|
1308
2108
|
return method;
|
1309
2109
|
};
|
1310
|
-
var _table, _getFetchProps, _cache, _schemaTables$2, _insertRecordWithoutId, insertRecordWithoutId_fn, _insertRecordWithId, insertRecordWithId_fn, _bulkInsertTableRecords, bulkInsertTableRecords_fn, _updateRecordWithID, updateRecordWithID_fn, _upsertRecordWithID, upsertRecordWithID_fn, _deleteRecord, deleteRecord_fn, _setCacheQuery, setCacheQuery_fn, _getCacheQuery, getCacheQuery_fn, _getSchemaTables$1, getSchemaTables_fn$1;
|
2110
|
+
var _table, _getFetchProps, _db, _cache, _schemaTables$2, _trace, _insertRecordWithoutId, insertRecordWithoutId_fn, _insertRecordWithId, insertRecordWithId_fn, _bulkInsertTableRecords, bulkInsertTableRecords_fn, _updateRecordWithID, updateRecordWithID_fn, _upsertRecordWithID, upsertRecordWithID_fn, _deleteRecord, deleteRecord_fn, _setCacheQuery, setCacheQuery_fn, _getCacheQuery, getCacheQuery_fn, _getSchemaTables$1, getSchemaTables_fn$1;
|
1311
2111
|
class Repository extends Query {
|
1312
2112
|
}
|
1313
2113
|
class RestRepository extends Query {
|
1314
2114
|
constructor(options) {
|
1315
|
-
super(
|
2115
|
+
super(
|
2116
|
+
null,
|
2117
|
+
{ name: options.table, schema: options.schemaTables?.find((table) => table.name === options.table) },
|
2118
|
+
{}
|
2119
|
+
);
|
1316
2120
|
__privateAdd$4(this, _insertRecordWithoutId);
|
1317
2121
|
__privateAdd$4(this, _insertRecordWithId);
|
1318
2122
|
__privateAdd$4(this, _bulkInsertTableRecords);
|
@@ -1324,176 +2128,339 @@ class RestRepository extends Query {
|
|
1324
2128
|
__privateAdd$4(this, _getSchemaTables$1);
|
1325
2129
|
__privateAdd$4(this, _table, void 0);
|
1326
2130
|
__privateAdd$4(this, _getFetchProps, void 0);
|
2131
|
+
__privateAdd$4(this, _db, void 0);
|
1327
2132
|
__privateAdd$4(this, _cache, void 0);
|
1328
2133
|
__privateAdd$4(this, _schemaTables$2, void 0);
|
2134
|
+
__privateAdd$4(this, _trace, void 0);
|
1329
2135
|
__privateSet$4(this, _table, options.table);
|
1330
|
-
__privateSet$4(this,
|
1331
|
-
this.db = options.db;
|
2136
|
+
__privateSet$4(this, _db, options.db);
|
1332
2137
|
__privateSet$4(this, _cache, options.pluginOptions.cache);
|
1333
2138
|
__privateSet$4(this, _schemaTables$2, options.schemaTables);
|
2139
|
+
__privateSet$4(this, _getFetchProps, async () => {
|
2140
|
+
const props = await options.pluginOptions.getFetchProps();
|
2141
|
+
return { ...props, sessionID: generateUUID() };
|
2142
|
+
});
|
2143
|
+
const trace = options.pluginOptions.trace ?? defaultTrace;
|
2144
|
+
__privateSet$4(this, _trace, async (name, fn, options2 = {}) => {
|
2145
|
+
return trace(name, fn, {
|
2146
|
+
...options2,
|
2147
|
+
[TraceAttributes.TABLE]: __privateGet$4(this, _table),
|
2148
|
+
[TraceAttributes.KIND]: "sdk-operation",
|
2149
|
+
[TraceAttributes.VERSION]: VERSION
|
2150
|
+
});
|
2151
|
+
});
|
1334
2152
|
}
|
1335
|
-
async create(a, b, c) {
|
1336
|
-
|
1337
|
-
|
1338
|
-
|
1339
|
-
|
1340
|
-
|
1341
|
-
|
1342
|
-
|
1343
|
-
|
1344
|
-
|
1345
|
-
|
1346
|
-
|
1347
|
-
|
1348
|
-
|
1349
|
-
|
1350
|
-
|
1351
|
-
|
1352
|
-
|
1353
|
-
|
1354
|
-
|
1355
|
-
|
1356
|
-
|
1357
|
-
|
1358
|
-
|
2153
|
+
async create(a, b, c, d) {
|
2154
|
+
return __privateGet$4(this, _trace).call(this, "create", async () => {
|
2155
|
+
const ifVersion = parseIfVersion(b, c, d);
|
2156
|
+
if (Array.isArray(a)) {
|
2157
|
+
if (a.length === 0)
|
2158
|
+
return [];
|
2159
|
+
const columns = isStringArray(b) ? b : void 0;
|
2160
|
+
return __privateMethod$2(this, _bulkInsertTableRecords, bulkInsertTableRecords_fn).call(this, a, columns);
|
2161
|
+
}
|
2162
|
+
if (isString(a) && isObject(b)) {
|
2163
|
+
if (a === "")
|
2164
|
+
throw new Error("The id can't be empty");
|
2165
|
+
const columns = isStringArray(c) ? c : void 0;
|
2166
|
+
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns, { createOnly: true, ifVersion });
|
2167
|
+
}
|
2168
|
+
if (isObject(a) && isString(a.id)) {
|
2169
|
+
if (a.id === "")
|
2170
|
+
throw new Error("The id can't be empty");
|
2171
|
+
const columns = isStringArray(b) ? b : void 0;
|
2172
|
+
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns, { createOnly: true, ifVersion });
|
2173
|
+
}
|
2174
|
+
if (isObject(a)) {
|
2175
|
+
const columns = isStringArray(b) ? b : void 0;
|
2176
|
+
return __privateMethod$2(this, _insertRecordWithoutId, insertRecordWithoutId_fn).call(this, a, columns);
|
2177
|
+
}
|
2178
|
+
throw new Error("Invalid arguments for create method");
|
2179
|
+
});
|
1359
2180
|
}
|
1360
2181
|
async read(a, b) {
|
1361
|
-
|
1362
|
-
|
1363
|
-
if (a
|
1364
|
-
|
1365
|
-
|
1366
|
-
|
1367
|
-
|
1368
|
-
acc
|
1369
|
-
|
1370
|
-
|
1371
|
-
|
1372
|
-
|
1373
|
-
|
1374
|
-
|
1375
|
-
|
1376
|
-
|
1377
|
-
|
1378
|
-
|
1379
|
-
|
1380
|
-
|
1381
|
-
|
1382
|
-
|
1383
|
-
|
1384
|
-
|
1385
|
-
|
1386
|
-
|
2182
|
+
return __privateGet$4(this, _trace).call(this, "read", async () => {
|
2183
|
+
const columns = isStringArray(b) ? b : ["*"];
|
2184
|
+
if (Array.isArray(a)) {
|
2185
|
+
if (a.length === 0)
|
2186
|
+
return [];
|
2187
|
+
const ids = a.map((item) => extractId(item));
|
2188
|
+
const finalObjects = await this.getAll({ filter: { id: { $any: compact(ids) } }, columns });
|
2189
|
+
const dictionary = finalObjects.reduce((acc, object) => {
|
2190
|
+
acc[object.id] = object;
|
2191
|
+
return acc;
|
2192
|
+
}, {});
|
2193
|
+
return ids.map((id2) => dictionary[id2 ?? ""] ?? null);
|
2194
|
+
}
|
2195
|
+
const id = extractId(a);
|
2196
|
+
if (id) {
|
2197
|
+
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2198
|
+
try {
|
2199
|
+
const response = await getRecord({
|
2200
|
+
pathParams: {
|
2201
|
+
workspace: "{workspaceId}",
|
2202
|
+
dbBranchName: "{dbBranch}",
|
2203
|
+
region: "{region}",
|
2204
|
+
tableName: __privateGet$4(this, _table),
|
2205
|
+
recordId: id
|
2206
|
+
},
|
2207
|
+
queryParams: { columns },
|
2208
|
+
...fetchProps
|
2209
|
+
});
|
2210
|
+
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
2211
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
2212
|
+
} catch (e) {
|
2213
|
+
if (isObject(e) && e.status === 404) {
|
2214
|
+
return null;
|
2215
|
+
}
|
2216
|
+
throw e;
|
1387
2217
|
}
|
1388
|
-
throw e;
|
1389
2218
|
}
|
1390
|
-
|
1391
|
-
|
2219
|
+
return null;
|
2220
|
+
});
|
2221
|
+
}
|
2222
|
+
async readOrThrow(a, b) {
|
2223
|
+
return __privateGet$4(this, _trace).call(this, "readOrThrow", async () => {
|
2224
|
+
const result = await this.read(a, b);
|
2225
|
+
if (Array.isArray(result)) {
|
2226
|
+
const missingIds = compact(
|
2227
|
+
a.filter((_item, index) => result[index] === null).map((item) => extractId(item))
|
2228
|
+
);
|
2229
|
+
if (missingIds.length > 0) {
|
2230
|
+
throw new Error(`Could not find records with ids: ${missingIds.join(", ")}`);
|
2231
|
+
}
|
2232
|
+
return result;
|
2233
|
+
}
|
2234
|
+
if (result === null) {
|
2235
|
+
const id = extractId(a) ?? "unknown";
|
2236
|
+
throw new Error(`Record with id ${id} not found`);
|
2237
|
+
}
|
2238
|
+
return result;
|
2239
|
+
});
|
1392
2240
|
}
|
1393
|
-
async update(a, b, c) {
|
1394
|
-
|
1395
|
-
|
1396
|
-
|
1397
|
-
|
1398
|
-
|
2241
|
+
async update(a, b, c, d) {
|
2242
|
+
return __privateGet$4(this, _trace).call(this, "update", async () => {
|
2243
|
+
const ifVersion = parseIfVersion(b, c, d);
|
2244
|
+
if (Array.isArray(a)) {
|
2245
|
+
if (a.length === 0)
|
2246
|
+
return [];
|
2247
|
+
if (a.length > 100) {
|
2248
|
+
console.warn("Bulk update operation is not optimized in the Xata API yet, this request might be slow");
|
2249
|
+
}
|
2250
|
+
const columns = isStringArray(b) ? b : ["*"];
|
2251
|
+
return Promise.all(a.map((object) => this.update(object, columns)));
|
1399
2252
|
}
|
1400
|
-
|
1401
|
-
|
1402
|
-
|
1403
|
-
if (isString(a) && isObject(b)) {
|
1404
|
-
const columns = isStringArray(c) ? c : void 0;
|
1405
|
-
return __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a, b, columns);
|
1406
|
-
}
|
1407
|
-
if (isObject(a) && isString(a.id)) {
|
1408
|
-
const columns = isStringArray(b) ? b : void 0;
|
1409
|
-
return __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns);
|
1410
|
-
}
|
1411
|
-
throw new Error("Invalid arguments for update method");
|
1412
|
-
}
|
1413
|
-
async createOrUpdate(a, b, c) {
|
1414
|
-
if (Array.isArray(a)) {
|
1415
|
-
if (a.length === 0)
|
1416
|
-
return [];
|
1417
|
-
if (a.length > 100) {
|
1418
|
-
console.warn("Bulk update operation is not optimized in the Xata API yet, this request might be slow");
|
2253
|
+
if (isString(a) && isObject(b)) {
|
2254
|
+
const columns = isStringArray(c) ? c : void 0;
|
2255
|
+
return __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a, b, columns, { ifVersion });
|
1419
2256
|
}
|
1420
|
-
|
1421
|
-
|
1422
|
-
|
1423
|
-
if (isString(a) && isObject(b)) {
|
1424
|
-
const columns = isStringArray(c) ? c : void 0;
|
1425
|
-
return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a, b, columns);
|
1426
|
-
}
|
1427
|
-
if (isObject(a) && isString(a.id)) {
|
1428
|
-
const columns = isStringArray(c) ? c : void 0;
|
1429
|
-
return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns);
|
1430
|
-
}
|
1431
|
-
throw new Error("Invalid arguments for createOrUpdate method");
|
1432
|
-
}
|
1433
|
-
async delete(a) {
|
1434
|
-
if (Array.isArray(a)) {
|
1435
|
-
if (a.length === 0)
|
1436
|
-
return;
|
1437
|
-
if (a.length > 100) {
|
1438
|
-
console.warn("Bulk delete operation is not optimized in the Xata API yet, this request might be slow");
|
2257
|
+
if (isObject(a) && isString(a.id)) {
|
2258
|
+
const columns = isStringArray(b) ? b : void 0;
|
2259
|
+
return __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns, { ifVersion });
|
1439
2260
|
}
|
1440
|
-
|
1441
|
-
|
1442
|
-
|
1443
|
-
|
1444
|
-
|
1445
|
-
|
1446
|
-
|
1447
|
-
|
1448
|
-
|
1449
|
-
|
1450
|
-
|
1451
|
-
|
2261
|
+
throw new Error("Invalid arguments for update method");
|
2262
|
+
});
|
2263
|
+
}
|
2264
|
+
async updateOrThrow(a, b, c, d) {
|
2265
|
+
return __privateGet$4(this, _trace).call(this, "updateOrThrow", async () => {
|
2266
|
+
const result = await this.update(a, b, c, d);
|
2267
|
+
if (Array.isArray(result)) {
|
2268
|
+
const missingIds = compact(
|
2269
|
+
a.filter((_item, index) => result[index] === null).map((item) => extractId(item))
|
2270
|
+
);
|
2271
|
+
if (missingIds.length > 0) {
|
2272
|
+
throw new Error(`Could not find records with ids: ${missingIds.join(", ")}`);
|
2273
|
+
}
|
2274
|
+
return result;
|
2275
|
+
}
|
2276
|
+
if (result === null) {
|
2277
|
+
const id = extractId(a) ?? "unknown";
|
2278
|
+
throw new Error(`Record with id ${id} not found`);
|
2279
|
+
}
|
2280
|
+
return result;
|
2281
|
+
});
|
2282
|
+
}
|
2283
|
+
async createOrUpdate(a, b, c, d) {
|
2284
|
+
return __privateGet$4(this, _trace).call(this, "createOrUpdate", async () => {
|
2285
|
+
const ifVersion = parseIfVersion(b, c, d);
|
2286
|
+
if (Array.isArray(a)) {
|
2287
|
+
if (a.length === 0)
|
2288
|
+
return [];
|
2289
|
+
if (a.length > 100) {
|
2290
|
+
console.warn("Bulk update operation is not optimized in the Xata API yet, this request might be slow");
|
2291
|
+
}
|
2292
|
+
const columns = isStringArray(b) ? b : ["*"];
|
2293
|
+
return Promise.all(a.map((object) => this.createOrUpdate(object, columns)));
|
2294
|
+
}
|
2295
|
+
if (isString(a) && isObject(b)) {
|
2296
|
+
const columns = isStringArray(c) ? c : void 0;
|
2297
|
+
return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a, b, columns, { ifVersion });
|
2298
|
+
}
|
2299
|
+
if (isObject(a) && isString(a.id)) {
|
2300
|
+
const columns = isStringArray(c) ? c : void 0;
|
2301
|
+
return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns, { ifVersion });
|
2302
|
+
}
|
2303
|
+
throw new Error("Invalid arguments for createOrUpdate method");
|
2304
|
+
});
|
2305
|
+
}
|
2306
|
+
async createOrReplace(a, b, c, d) {
|
2307
|
+
return __privateGet$4(this, _trace).call(this, "createOrReplace", async () => {
|
2308
|
+
const ifVersion = parseIfVersion(b, c, d);
|
2309
|
+
if (Array.isArray(a)) {
|
2310
|
+
if (a.length === 0)
|
2311
|
+
return [];
|
2312
|
+
const columns = isStringArray(b) ? b : ["*"];
|
2313
|
+
return __privateMethod$2(this, _bulkInsertTableRecords, bulkInsertTableRecords_fn).call(this, a, columns);
|
2314
|
+
}
|
2315
|
+
if (isString(a) && isObject(b)) {
|
2316
|
+
const columns = isStringArray(c) ? c : void 0;
|
2317
|
+
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns, { createOnly: false, ifVersion });
|
2318
|
+
}
|
2319
|
+
if (isObject(a) && isString(a.id)) {
|
2320
|
+
const columns = isStringArray(c) ? c : void 0;
|
2321
|
+
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns, { createOnly: false, ifVersion });
|
2322
|
+
}
|
2323
|
+
throw new Error("Invalid arguments for createOrReplace method");
|
2324
|
+
});
|
2325
|
+
}
|
2326
|
+
async delete(a, b) {
|
2327
|
+
return __privateGet$4(this, _trace).call(this, "delete", async () => {
|
2328
|
+
if (Array.isArray(a)) {
|
2329
|
+
if (a.length === 0)
|
2330
|
+
return [];
|
2331
|
+
if (a.length > 100) {
|
2332
|
+
console.warn("Bulk delete operation is not optimized in the Xata API yet, this request might be slow");
|
2333
|
+
}
|
2334
|
+
return Promise.all(a.map((id) => this.delete(id, b)));
|
2335
|
+
}
|
2336
|
+
if (isString(a)) {
|
2337
|
+
return __privateMethod$2(this, _deleteRecord, deleteRecord_fn).call(this, a, b);
|
2338
|
+
}
|
2339
|
+
if (isObject(a) && isString(a.id)) {
|
2340
|
+
return __privateMethod$2(this, _deleteRecord, deleteRecord_fn).call(this, a.id, b);
|
2341
|
+
}
|
2342
|
+
throw new Error("Invalid arguments for delete method");
|
2343
|
+
});
|
2344
|
+
}
|
2345
|
+
async deleteOrThrow(a, b) {
|
2346
|
+
return __privateGet$4(this, _trace).call(this, "deleteOrThrow", async () => {
|
2347
|
+
const result = await this.delete(a, b);
|
2348
|
+
if (Array.isArray(result)) {
|
2349
|
+
const missingIds = compact(
|
2350
|
+
a.filter((_item, index) => result[index] === null).map((item) => extractId(item))
|
2351
|
+
);
|
2352
|
+
if (missingIds.length > 0) {
|
2353
|
+
throw new Error(`Could not find records with ids: ${missingIds.join(", ")}`);
|
2354
|
+
}
|
2355
|
+
return result;
|
2356
|
+
} else if (result === null) {
|
2357
|
+
const id = extractId(a) ?? "unknown";
|
2358
|
+
throw new Error(`Record with id ${id} not found`);
|
2359
|
+
}
|
2360
|
+
return result;
|
2361
|
+
});
|
1452
2362
|
}
|
1453
2363
|
async search(query, options = {}) {
|
1454
|
-
|
1455
|
-
|
1456
|
-
|
1457
|
-
|
1458
|
-
|
1459
|
-
|
1460
|
-
|
1461
|
-
|
1462
|
-
|
1463
|
-
|
1464
|
-
|
1465
|
-
|
2364
|
+
return __privateGet$4(this, _trace).call(this, "search", async () => {
|
2365
|
+
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2366
|
+
const { records } = await searchTable({
|
2367
|
+
pathParams: {
|
2368
|
+
workspace: "{workspaceId}",
|
2369
|
+
dbBranchName: "{dbBranch}",
|
2370
|
+
region: "{region}",
|
2371
|
+
tableName: __privateGet$4(this, _table)
|
2372
|
+
},
|
2373
|
+
body: {
|
2374
|
+
query,
|
2375
|
+
fuzziness: options.fuzziness,
|
2376
|
+
prefix: options.prefix,
|
2377
|
+
highlight: options.highlight,
|
2378
|
+
filter: options.filter,
|
2379
|
+
boosters: options.boosters
|
2380
|
+
},
|
2381
|
+
...fetchProps
|
2382
|
+
});
|
2383
|
+
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
2384
|
+
return records.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item, ["*"]));
|
2385
|
+
});
|
2386
|
+
}
|
2387
|
+
async aggregate(aggs, filter) {
|
2388
|
+
return __privateGet$4(this, _trace).call(this, "aggregate", async () => {
|
2389
|
+
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2390
|
+
const result = await aggregateTable({
|
2391
|
+
pathParams: {
|
2392
|
+
workspace: "{workspaceId}",
|
2393
|
+
dbBranchName: "{dbBranch}",
|
2394
|
+
region: "{region}",
|
2395
|
+
tableName: __privateGet$4(this, _table)
|
2396
|
+
},
|
2397
|
+
body: { aggs, filter },
|
2398
|
+
...fetchProps
|
2399
|
+
});
|
2400
|
+
return result;
|
1466
2401
|
});
|
1467
|
-
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1468
|
-
return records.map((item) => initObject(this.db, schemaTables, __privateGet$4(this, _table), item));
|
1469
2402
|
}
|
1470
2403
|
async query(query) {
|
1471
|
-
|
1472
|
-
|
1473
|
-
|
1474
|
-
|
1475
|
-
|
1476
|
-
|
1477
|
-
|
1478
|
-
|
1479
|
-
|
1480
|
-
|
1481
|
-
|
1482
|
-
|
1483
|
-
|
1484
|
-
|
1485
|
-
|
2404
|
+
return __privateGet$4(this, _trace).call(this, "query", async () => {
|
2405
|
+
const cacheQuery = await __privateMethod$2(this, _getCacheQuery, getCacheQuery_fn).call(this, query);
|
2406
|
+
if (cacheQuery)
|
2407
|
+
return new Page(query, cacheQuery.meta, cacheQuery.records);
|
2408
|
+
const data = query.getQueryOptions();
|
2409
|
+
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2410
|
+
const { meta, records: objects } = await queryTable({
|
2411
|
+
pathParams: {
|
2412
|
+
workspace: "{workspaceId}",
|
2413
|
+
dbBranchName: "{dbBranch}",
|
2414
|
+
region: "{region}",
|
2415
|
+
tableName: __privateGet$4(this, _table)
|
2416
|
+
},
|
2417
|
+
body: {
|
2418
|
+
filter: cleanFilter(data.filter),
|
2419
|
+
sort: data.sort !== void 0 ? buildSortFilter(data.sort) : void 0,
|
2420
|
+
page: data.pagination,
|
2421
|
+
columns: data.columns ?? ["*"]
|
2422
|
+
},
|
2423
|
+
...fetchProps
|
2424
|
+
});
|
2425
|
+
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
2426
|
+
const records = objects.map(
|
2427
|
+
(record) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), record, data.columns ?? ["*"])
|
2428
|
+
);
|
2429
|
+
await __privateMethod$2(this, _setCacheQuery, setCacheQuery_fn).call(this, query, meta, records);
|
2430
|
+
return new Page(query, meta, records);
|
2431
|
+
});
|
2432
|
+
}
|
2433
|
+
async summarizeTable(query, summaries, summariesFilter) {
|
2434
|
+
return __privateGet$4(this, _trace).call(this, "summarize", async () => {
|
2435
|
+
const data = query.getQueryOptions();
|
2436
|
+
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2437
|
+
const result = await summarizeTable({
|
2438
|
+
pathParams: {
|
2439
|
+
workspace: "{workspaceId}",
|
2440
|
+
dbBranchName: "{dbBranch}",
|
2441
|
+
region: "{region}",
|
2442
|
+
tableName: __privateGet$4(this, _table)
|
2443
|
+
},
|
2444
|
+
body: {
|
2445
|
+
filter: cleanFilter(data.filter),
|
2446
|
+
sort: data.sort !== void 0 ? buildSortFilter(data.sort) : void 0,
|
2447
|
+
columns: data.columns,
|
2448
|
+
page: data.pagination?.size !== void 0 ? { size: data.pagination?.size } : void 0,
|
2449
|
+
summaries,
|
2450
|
+
summariesFilter
|
2451
|
+
},
|
2452
|
+
...fetchProps
|
2453
|
+
});
|
2454
|
+
return result;
|
1486
2455
|
});
|
1487
|
-
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1488
|
-
const records = objects.map((record) => initObject(this.db, schemaTables, __privateGet$4(this, _table), record));
|
1489
|
-
await __privateMethod$2(this, _setCacheQuery, setCacheQuery_fn).call(this, query, meta, records);
|
1490
|
-
return new Page(query, meta, records);
|
1491
2456
|
}
|
1492
2457
|
}
|
1493
2458
|
_table = new WeakMap();
|
1494
2459
|
_getFetchProps = new WeakMap();
|
2460
|
+
_db = new WeakMap();
|
1495
2461
|
_cache = new WeakMap();
|
1496
2462
|
_schemaTables$2 = new WeakMap();
|
2463
|
+
_trace = new WeakMap();
|
1497
2464
|
_insertRecordWithoutId = new WeakSet();
|
1498
2465
|
insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
|
1499
2466
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
@@ -1502,6 +2469,7 @@ insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
|
|
1502
2469
|
pathParams: {
|
1503
2470
|
workspace: "{workspaceId}",
|
1504
2471
|
dbBranchName: "{dbBranch}",
|
2472
|
+
region: "{region}",
|
1505
2473
|
tableName: __privateGet$4(this, _table)
|
1506
2474
|
},
|
1507
2475
|
queryParams: { columns },
|
@@ -1509,32 +2477,38 @@ insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
|
|
1509
2477
|
...fetchProps
|
1510
2478
|
});
|
1511
2479
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1512
|
-
return initObject(this
|
2480
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
1513
2481
|
};
|
1514
2482
|
_insertRecordWithId = new WeakSet();
|
1515
|
-
insertRecordWithId_fn = async function(recordId, object, columns = ["*"]) {
|
2483
|
+
insertRecordWithId_fn = async function(recordId, object, columns = ["*"], { createOnly, ifVersion }) {
|
1516
2484
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1517
2485
|
const record = transformObjectLinks(object);
|
1518
2486
|
const response = await insertRecordWithID({
|
1519
2487
|
pathParams: {
|
1520
2488
|
workspace: "{workspaceId}",
|
1521
2489
|
dbBranchName: "{dbBranch}",
|
2490
|
+
region: "{region}",
|
1522
2491
|
tableName: __privateGet$4(this, _table),
|
1523
2492
|
recordId
|
1524
2493
|
},
|
1525
2494
|
body: record,
|
1526
|
-
queryParams: { createOnly
|
2495
|
+
queryParams: { createOnly, columns, ifVersion },
|
1527
2496
|
...fetchProps
|
1528
2497
|
});
|
1529
2498
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1530
|
-
return initObject(this
|
2499
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
1531
2500
|
};
|
1532
2501
|
_bulkInsertTableRecords = new WeakSet();
|
1533
2502
|
bulkInsertTableRecords_fn = async function(objects, columns = ["*"]) {
|
1534
2503
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1535
2504
|
const records = objects.map((object) => transformObjectLinks(object));
|
1536
2505
|
const response = await bulkInsertTableRecords({
|
1537
|
-
pathParams: {
|
2506
|
+
pathParams: {
|
2507
|
+
workspace: "{workspaceId}",
|
2508
|
+
dbBranchName: "{dbBranch}",
|
2509
|
+
region: "{region}",
|
2510
|
+
tableName: __privateGet$4(this, _table)
|
2511
|
+
},
|
1538
2512
|
queryParams: { columns },
|
1539
2513
|
body: { records },
|
1540
2514
|
...fetchProps
|
@@ -1543,40 +2517,75 @@ bulkInsertTableRecords_fn = async function(objects, columns = ["*"]) {
|
|
1543
2517
|
throw new Error("Request included columns but server didn't include them");
|
1544
2518
|
}
|
1545
2519
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1546
|
-
return response.records?.map((item) => initObject(this
|
2520
|
+
return response.records?.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item, columns));
|
1547
2521
|
};
|
1548
2522
|
_updateRecordWithID = new WeakSet();
|
1549
|
-
updateRecordWithID_fn = async function(recordId, object, columns = ["*"]) {
|
2523
|
+
updateRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVersion }) {
|
1550
2524
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1551
2525
|
const record = transformObjectLinks(object);
|
1552
|
-
|
1553
|
-
|
1554
|
-
|
1555
|
-
|
1556
|
-
|
1557
|
-
|
1558
|
-
|
1559
|
-
|
2526
|
+
try {
|
2527
|
+
const response = await updateRecordWithID({
|
2528
|
+
pathParams: {
|
2529
|
+
workspace: "{workspaceId}",
|
2530
|
+
dbBranchName: "{dbBranch}",
|
2531
|
+
region: "{region}",
|
2532
|
+
tableName: __privateGet$4(this, _table),
|
2533
|
+
recordId
|
2534
|
+
},
|
2535
|
+
queryParams: { columns, ifVersion },
|
2536
|
+
body: record,
|
2537
|
+
...fetchProps
|
2538
|
+
});
|
2539
|
+
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
2540
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
2541
|
+
} catch (e) {
|
2542
|
+
if (isObject(e) && e.status === 404) {
|
2543
|
+
return null;
|
2544
|
+
}
|
2545
|
+
throw e;
|
2546
|
+
}
|
1560
2547
|
};
|
1561
2548
|
_upsertRecordWithID = new WeakSet();
|
1562
|
-
upsertRecordWithID_fn = async function(recordId, object, columns = ["*"]) {
|
2549
|
+
upsertRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVersion }) {
|
1563
2550
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1564
2551
|
const response = await upsertRecordWithID({
|
1565
|
-
pathParams: {
|
1566
|
-
|
2552
|
+
pathParams: {
|
2553
|
+
workspace: "{workspaceId}",
|
2554
|
+
dbBranchName: "{dbBranch}",
|
2555
|
+
region: "{region}",
|
2556
|
+
tableName: __privateGet$4(this, _table),
|
2557
|
+
recordId
|
2558
|
+
},
|
2559
|
+
queryParams: { columns, ifVersion },
|
1567
2560
|
body: object,
|
1568
2561
|
...fetchProps
|
1569
2562
|
});
|
1570
2563
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1571
|
-
return initObject(this
|
2564
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
1572
2565
|
};
|
1573
2566
|
_deleteRecord = new WeakSet();
|
1574
|
-
deleteRecord_fn = async function(recordId) {
|
2567
|
+
deleteRecord_fn = async function(recordId, columns = ["*"]) {
|
1575
2568
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1576
|
-
|
1577
|
-
|
1578
|
-
|
1579
|
-
|
2569
|
+
try {
|
2570
|
+
const response = await deleteRecord({
|
2571
|
+
pathParams: {
|
2572
|
+
workspace: "{workspaceId}",
|
2573
|
+
dbBranchName: "{dbBranch}",
|
2574
|
+
region: "{region}",
|
2575
|
+
tableName: __privateGet$4(this, _table),
|
2576
|
+
recordId
|
2577
|
+
},
|
2578
|
+
queryParams: { columns },
|
2579
|
+
...fetchProps
|
2580
|
+
});
|
2581
|
+
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
2582
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
2583
|
+
} catch (e) {
|
2584
|
+
if (isObject(e) && e.status === 404) {
|
2585
|
+
return null;
|
2586
|
+
}
|
2587
|
+
throw e;
|
2588
|
+
}
|
1580
2589
|
};
|
1581
2590
|
_setCacheQuery = new WeakSet();
|
1582
2591
|
setCacheQuery_fn = async function(query, meta, records) {
|
@@ -1600,7 +2609,7 @@ getSchemaTables_fn$1 = async function() {
|
|
1600
2609
|
return __privateGet$4(this, _schemaTables$2);
|
1601
2610
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1602
2611
|
const { schema } = await getBranchDetails({
|
1603
|
-
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}" },
|
2612
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
1604
2613
|
...fetchProps
|
1605
2614
|
});
|
1606
2615
|
__privateSet$4(this, _schemaTables$2, schema.tables);
|
@@ -1613,7 +2622,7 @@ const transformObjectLinks = (object) => {
|
|
1613
2622
|
return { ...acc, [key]: isIdentifiable(value) ? value.id : value };
|
1614
2623
|
}, {});
|
1615
2624
|
};
|
1616
|
-
const initObject = (db, schemaTables, table, object) => {
|
2625
|
+
const initObject = (db, schemaTables, table, object, selectedColumns) => {
|
1617
2626
|
const result = {};
|
1618
2627
|
const { xata, ...rest } = object ?? {};
|
1619
2628
|
Object.assign(result, rest);
|
@@ -1621,6 +2630,8 @@ const initObject = (db, schemaTables, table, object) => {
|
|
1621
2630
|
if (!columns)
|
1622
2631
|
console.error(`Table ${table} not found in schema`);
|
1623
2632
|
for (const column of columns ?? []) {
|
2633
|
+
if (!isValidColumn(selectedColumns, column))
|
2634
|
+
continue;
|
1624
2635
|
const value = result[column.name];
|
1625
2636
|
switch (column.type) {
|
1626
2637
|
case "datetime": {
|
@@ -1637,17 +2648,42 @@ const initObject = (db, schemaTables, table, object) => {
|
|
1637
2648
|
if (!linkTable) {
|
1638
2649
|
console.error(`Failed to parse link for field ${column.name}`);
|
1639
2650
|
} else if (isObject(value)) {
|
1640
|
-
|
2651
|
+
const selectedLinkColumns = selectedColumns.reduce((acc, item) => {
|
2652
|
+
if (item === column.name) {
|
2653
|
+
return [...acc, "*"];
|
2654
|
+
}
|
2655
|
+
if (item.startsWith(`${column.name}.`)) {
|
2656
|
+
const [, ...path] = item.split(".");
|
2657
|
+
return [...acc, path.join(".")];
|
2658
|
+
}
|
2659
|
+
return acc;
|
2660
|
+
}, []);
|
2661
|
+
result[column.name] = initObject(db, schemaTables, linkTable, value, selectedLinkColumns);
|
2662
|
+
} else {
|
2663
|
+
result[column.name] = null;
|
1641
2664
|
}
|
1642
2665
|
break;
|
1643
2666
|
}
|
2667
|
+
default:
|
2668
|
+
result[column.name] = value ?? null;
|
2669
|
+
if (column.notNull === true && value === null) {
|
2670
|
+
console.error(`Parse error, column ${column.name} is non nullable and value resolves null`);
|
2671
|
+
}
|
2672
|
+
break;
|
1644
2673
|
}
|
1645
2674
|
}
|
1646
2675
|
result.read = function(columns2) {
|
1647
2676
|
return db[table].read(result["id"], columns2);
|
1648
2677
|
};
|
1649
|
-
result.update = function(data,
|
1650
|
-
|
2678
|
+
result.update = function(data, b, c) {
|
2679
|
+
const columns2 = isStringArray(b) ? b : ["*"];
|
2680
|
+
const ifVersion = parseIfVersion(b, c);
|
2681
|
+
return db[table].update(result["id"], data, columns2, { ifVersion });
|
2682
|
+
};
|
2683
|
+
result.replace = function(data, b, c) {
|
2684
|
+
const columns2 = isStringArray(b) ? b : ["*"];
|
2685
|
+
const ifVersion = parseIfVersion(b, c);
|
2686
|
+
return db[table].createOrReplace(result["id"], data, columns2, { ifVersion });
|
1651
2687
|
};
|
1652
2688
|
result.delete = function() {
|
1653
2689
|
return db[table].delete(result["id"]);
|
@@ -1655,7 +2691,7 @@ const initObject = (db, schemaTables, table, object) => {
|
|
1655
2691
|
result.getMetadata = function() {
|
1656
2692
|
return xata;
|
1657
2693
|
};
|
1658
|
-
for (const prop of ["read", "update", "delete", "getMetadata"]) {
|
2694
|
+
for (const prop of ["read", "update", "replace", "delete", "getMetadata"]) {
|
1659
2695
|
Object.defineProperty(result, prop, { enumerable: false });
|
1660
2696
|
}
|
1661
2697
|
Object.freeze(result);
|
@@ -1664,6 +2700,30 @@ const initObject = (db, schemaTables, table, object) => {
|
|
1664
2700
|
function isResponseWithRecords(value) {
|
1665
2701
|
return isObject(value) && Array.isArray(value.records);
|
1666
2702
|
}
|
2703
|
+
function extractId(value) {
|
2704
|
+
if (isString(value))
|
2705
|
+
return value;
|
2706
|
+
if (isObject(value) && isString(value.id))
|
2707
|
+
return value.id;
|
2708
|
+
return void 0;
|
2709
|
+
}
|
2710
|
+
function isValidColumn(columns, column) {
|
2711
|
+
if (columns.includes("*"))
|
2712
|
+
return true;
|
2713
|
+
if (column.type === "link") {
|
2714
|
+
const linkColumns = columns.filter((item) => item.startsWith(column.name));
|
2715
|
+
return linkColumns.length > 0;
|
2716
|
+
}
|
2717
|
+
return columns.includes(column.name);
|
2718
|
+
}
|
2719
|
+
function parseIfVersion(...args) {
|
2720
|
+
for (const arg of args) {
|
2721
|
+
if (isObject(arg) && isNumber(arg.ifVersion)) {
|
2722
|
+
return arg.ifVersion;
|
2723
|
+
}
|
2724
|
+
}
|
2725
|
+
return void 0;
|
2726
|
+
}
|
1667
2727
|
|
1668
2728
|
var __accessCheck$3 = (obj, member, msg) => {
|
1669
2729
|
if (!member.has(obj))
|
@@ -1714,18 +2774,25 @@ class SimpleCache {
|
|
1714
2774
|
}
|
1715
2775
|
_map = new WeakMap();
|
1716
2776
|
|
1717
|
-
const
|
1718
|
-
const
|
1719
|
-
const
|
1720
|
-
const
|
1721
|
-
const
|
1722
|
-
const
|
2777
|
+
const greaterThan = (value) => ({ $gt: value });
|
2778
|
+
const gt = greaterThan;
|
2779
|
+
const greaterThanEquals = (value) => ({ $ge: value });
|
2780
|
+
const greaterEquals = greaterThanEquals;
|
2781
|
+
const gte = greaterThanEquals;
|
2782
|
+
const ge = greaterThanEquals;
|
2783
|
+
const lessThan = (value) => ({ $lt: value });
|
2784
|
+
const lt = lessThan;
|
2785
|
+
const lessThanEquals = (value) => ({ $le: value });
|
2786
|
+
const lessEquals = lessThanEquals;
|
2787
|
+
const lte = lessThanEquals;
|
2788
|
+
const le = lessThanEquals;
|
1723
2789
|
const exists = (column) => ({ $exists: column });
|
1724
2790
|
const notExists = (column) => ({ $notExists: column });
|
1725
2791
|
const startsWith = (value) => ({ $startsWith: value });
|
1726
2792
|
const endsWith = (value) => ({ $endsWith: value });
|
1727
2793
|
const pattern = (value) => ({ $pattern: value });
|
1728
2794
|
const is = (value) => ({ $is: value });
|
2795
|
+
const equals = is;
|
1729
2796
|
const isNot = (value) => ({ $isNot: value });
|
1730
2797
|
const contains = (value) => ({ $contains: value });
|
1731
2798
|
const includes = (value) => ({ $includes: value });
|
@@ -1760,16 +2827,19 @@ class SchemaPlugin extends XataPlugin {
|
|
1760
2827
|
__privateSet$2(this, _schemaTables$1, schemaTables);
|
1761
2828
|
}
|
1762
2829
|
build(pluginOptions) {
|
1763
|
-
const db = new Proxy(
|
1764
|
-
|
1765
|
-
|
1766
|
-
|
1767
|
-
|
1768
|
-
|
2830
|
+
const db = new Proxy(
|
2831
|
+
{},
|
2832
|
+
{
|
2833
|
+
get: (_target, table) => {
|
2834
|
+
if (!isString(table))
|
2835
|
+
throw new Error("Invalid table name");
|
2836
|
+
if (__privateGet$2(this, _tables)[table] === void 0) {
|
2837
|
+
__privateGet$2(this, _tables)[table] = new RestRepository({ db, pluginOptions, table, schemaTables: __privateGet$2(this, _schemaTables$1) });
|
2838
|
+
}
|
2839
|
+
return __privateGet$2(this, _tables)[table];
|
1769
2840
|
}
|
1770
|
-
return __privateGet$2(this, _tables)[table];
|
1771
2841
|
}
|
1772
|
-
|
2842
|
+
);
|
1773
2843
|
const tableNames = __privateGet$2(this, _schemaTables$1)?.map(({ name }) => name) ?? [];
|
1774
2844
|
for (const table of tableNames) {
|
1775
2845
|
db[table] = new RestRepository({ db, pluginOptions, table, schemaTables: __privateGet$2(this, _schemaTables$1) });
|
@@ -1819,7 +2889,7 @@ class SearchPlugin extends XataPlugin {
|
|
1819
2889
|
const schemaTables = await __privateMethod$1(this, _getSchemaTables, getSchemaTables_fn).call(this, getFetchProps);
|
1820
2890
|
return records.map((record) => {
|
1821
2891
|
const { table = "orphan" } = record.xata;
|
1822
|
-
return { table, record: initObject(this.db, schemaTables, table, record) };
|
2892
|
+
return { table, record: initObject(this.db, schemaTables, table, record, ["*"]) };
|
1823
2893
|
});
|
1824
2894
|
},
|
1825
2895
|
byTable: async (query, options = {}) => {
|
@@ -1828,7 +2898,7 @@ class SearchPlugin extends XataPlugin {
|
|
1828
2898
|
return records.reduce((acc, record) => {
|
1829
2899
|
const { table = "orphan" } = record.xata;
|
1830
2900
|
const items = acc[table] ?? [];
|
1831
|
-
const item = initObject(this.db, schemaTables, table, record);
|
2901
|
+
const item = initObject(this.db, schemaTables, table, record, ["*"]);
|
1832
2902
|
return { ...acc, [table]: [...items, item] };
|
1833
2903
|
}, {});
|
1834
2904
|
}
|
@@ -1841,7 +2911,7 @@ search_fn = async function(query, options, getFetchProps) {
|
|
1841
2911
|
const fetchProps = await getFetchProps();
|
1842
2912
|
const { tables, fuzziness, highlight, prefix } = options ?? {};
|
1843
2913
|
const { records } = await searchBranch({
|
1844
|
-
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}" },
|
2914
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
1845
2915
|
body: { tables, query, fuzziness, prefix, highlight },
|
1846
2916
|
...fetchProps
|
1847
2917
|
});
|
@@ -1853,7 +2923,7 @@ getSchemaTables_fn = async function(getFetchProps) {
|
|
1853
2923
|
return __privateGet$1(this, _schemaTables);
|
1854
2924
|
const fetchProps = await getFetchProps();
|
1855
2925
|
const { schema } = await getBranchDetails({
|
1856
|
-
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}" },
|
2926
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
1857
2927
|
...fetchProps
|
1858
2928
|
});
|
1859
2929
|
__privateSet$1(this, _schemaTables, schema.tables);
|
@@ -1883,19 +2953,27 @@ async function resolveXataBranch(gitBranch, options) {
|
|
1883
2953
|
const databaseURL = options?.databaseURL || getDatabaseURL();
|
1884
2954
|
const apiKey = options?.apiKey || getAPIKey();
|
1885
2955
|
if (!databaseURL)
|
1886
|
-
throw new Error(
|
2956
|
+
throw new Error(
|
2957
|
+
"A databaseURL was not defined. Either set the XATA_DATABASE_URL env variable or pass the argument explicitely"
|
2958
|
+
);
|
1887
2959
|
if (!apiKey)
|
1888
|
-
throw new Error(
|
2960
|
+
throw new Error(
|
2961
|
+
"An API key was not defined. Either set the XATA_API_KEY env variable or pass the argument explicitely"
|
2962
|
+
);
|
1889
2963
|
const [protocol, , host, , dbName] = databaseURL.split("/");
|
1890
|
-
const
|
2964
|
+
const urlParts = parseWorkspacesUrlParts(host);
|
2965
|
+
if (!urlParts)
|
2966
|
+
throw new Error(`Unable to parse workspace and region: ${databaseURL}`);
|
2967
|
+
const { workspace, region } = urlParts;
|
1891
2968
|
const { fallbackBranch } = getEnvironment();
|
1892
2969
|
const { branch } = await resolveBranch({
|
1893
2970
|
apiKey,
|
1894
2971
|
apiUrl: databaseURL,
|
1895
2972
|
fetchImpl: getFetchImplementation(options?.fetchImpl),
|
1896
2973
|
workspacesApiUrl: `${protocol}//${host}`,
|
1897
|
-
pathParams: { dbName, workspace },
|
1898
|
-
queryParams: { gitBranch, fallbackBranch }
|
2974
|
+
pathParams: { dbName, workspace, region },
|
2975
|
+
queryParams: { gitBranch, fallbackBranch },
|
2976
|
+
trace: defaultTrace
|
1899
2977
|
});
|
1900
2978
|
return branch;
|
1901
2979
|
}
|
@@ -1903,19 +2981,26 @@ async function getDatabaseBranch(branch, options) {
|
|
1903
2981
|
const databaseURL = options?.databaseURL || getDatabaseURL();
|
1904
2982
|
const apiKey = options?.apiKey || getAPIKey();
|
1905
2983
|
if (!databaseURL)
|
1906
|
-
throw new Error(
|
2984
|
+
throw new Error(
|
2985
|
+
"A databaseURL was not defined. Either set the XATA_DATABASE_URL env variable or pass the argument explicitely"
|
2986
|
+
);
|
1907
2987
|
if (!apiKey)
|
1908
|
-
throw new Error(
|
2988
|
+
throw new Error(
|
2989
|
+
"An API key was not defined. Either set the XATA_API_KEY env variable or pass the argument explicitely"
|
2990
|
+
);
|
1909
2991
|
const [protocol, , host, , database] = databaseURL.split("/");
|
1910
|
-
const
|
1911
|
-
|
2992
|
+
const urlParts = parseWorkspacesUrlParts(host);
|
2993
|
+
if (!urlParts)
|
2994
|
+
throw new Error(`Unable to parse workspace and region: ${databaseURL}`);
|
2995
|
+
const { workspace, region } = urlParts;
|
1912
2996
|
try {
|
1913
2997
|
return await getBranchDetails({
|
1914
2998
|
apiKey,
|
1915
2999
|
apiUrl: databaseURL,
|
1916
3000
|
fetchImpl: getFetchImplementation(options?.fetchImpl),
|
1917
3001
|
workspacesApiUrl: `${protocol}//${host}`,
|
1918
|
-
pathParams: { dbBranchName
|
3002
|
+
pathParams: { dbBranchName: `${database}:${branch}`, workspace, region },
|
3003
|
+
trace: defaultTrace
|
1919
3004
|
});
|
1920
3005
|
} catch (err) {
|
1921
3006
|
if (isObject(err) && err.status === 404)
|
@@ -1955,17 +3040,20 @@ var __privateMethod = (obj, member, method) => {
|
|
1955
3040
|
return method;
|
1956
3041
|
};
|
1957
3042
|
const buildClient = (plugins) => {
|
1958
|
-
var _branch, _parseOptions, parseOptions_fn, _getFetchProps, getFetchProps_fn, _evaluateBranch, evaluateBranch_fn, _a;
|
3043
|
+
var _branch, _options, _parseOptions, parseOptions_fn, _getFetchProps, getFetchProps_fn, _evaluateBranch, evaluateBranch_fn, _a;
|
1959
3044
|
return _a = class {
|
1960
3045
|
constructor(options = {}, schemaTables) {
|
1961
3046
|
__privateAdd(this, _parseOptions);
|
1962
3047
|
__privateAdd(this, _getFetchProps);
|
1963
3048
|
__privateAdd(this, _evaluateBranch);
|
1964
3049
|
__privateAdd(this, _branch, void 0);
|
3050
|
+
__privateAdd(this, _options, void 0);
|
1965
3051
|
const safeOptions = __privateMethod(this, _parseOptions, parseOptions_fn).call(this, options);
|
3052
|
+
__privateSet(this, _options, safeOptions);
|
1966
3053
|
const pluginOptions = {
|
1967
3054
|
getFetchProps: () => __privateMethod(this, _getFetchProps, getFetchProps_fn).call(this, safeOptions),
|
1968
|
-
cache: safeOptions.cache
|
3055
|
+
cache: safeOptions.cache,
|
3056
|
+
trace: safeOptions.trace
|
1969
3057
|
};
|
1970
3058
|
const db = new SchemaPlugin(schemaTables).build(pluginOptions);
|
1971
3059
|
const search = new SearchPlugin(db, schemaTables).build(pluginOptions);
|
@@ -1984,22 +3072,26 @@ const buildClient = (plugins) => {
|
|
1984
3072
|
}
|
1985
3073
|
}
|
1986
3074
|
}
|
1987
|
-
|
3075
|
+
async getConfig() {
|
3076
|
+
const databaseURL = __privateGet(this, _options).databaseURL;
|
3077
|
+
const branch = await __privateGet(this, _options).branch();
|
3078
|
+
return { databaseURL, branch };
|
3079
|
+
}
|
3080
|
+
}, _branch = new WeakMap(), _options = new WeakMap(), _parseOptions = new WeakSet(), parseOptions_fn = function(options) {
|
1988
3081
|
const fetch = getFetchImplementation(options?.fetch);
|
1989
3082
|
const databaseURL = options?.databaseURL || getDatabaseURL();
|
1990
3083
|
const apiKey = options?.apiKey || getAPIKey();
|
1991
3084
|
const cache = options?.cache ?? new SimpleCache({ defaultQueryTTL: 0 });
|
3085
|
+
const trace = options?.trace ?? defaultTrace;
|
1992
3086
|
const branch = async () => options?.branch !== void 0 ? await __privateMethod(this, _evaluateBranch, evaluateBranch_fn).call(this, options.branch) : await getCurrentBranchName({ apiKey, databaseURL, fetchImpl: options?.fetch });
|
1993
|
-
if (!
|
1994
|
-
throw new Error("
|
3087
|
+
if (!apiKey) {
|
3088
|
+
throw new Error("Option apiKey is required");
|
1995
3089
|
}
|
1996
|
-
|
1997
|
-
|
1998
|
-
|
1999
|
-
apiKey,
|
2000
|
-
|
2001
|
-
branch
|
2002
|
-
}) {
|
3090
|
+
if (!databaseURL) {
|
3091
|
+
throw new Error("Option databaseURL is required");
|
3092
|
+
}
|
3093
|
+
return { fetch, databaseURL, apiKey, branch, cache, trace, clientID: generateUUID() };
|
3094
|
+
}, _getFetchProps = new WeakSet(), getFetchProps_fn = async function({ fetch, apiKey, databaseURL, branch, trace, clientID }) {
|
2003
3095
|
const branchValue = await __privateMethod(this, _evaluateBranch, evaluateBranch_fn).call(this, branch);
|
2004
3096
|
if (!branchValue)
|
2005
3097
|
throw new Error("Unable to resolve branch value");
|
@@ -2009,9 +3101,11 @@ const buildClient = (plugins) => {
|
|
2009
3101
|
apiUrl: "",
|
2010
3102
|
workspacesApiUrl: (path, params) => {
|
2011
3103
|
const hasBranch = params.dbBranchName ?? params.branch;
|
2012
|
-
const newPath = path.replace(/^\/db\/[^/]+/, hasBranch ? `:${branchValue}` : "");
|
3104
|
+
const newPath = path.replace(/^\/db\/[^/]+/, hasBranch !== void 0 ? `:${branchValue}` : "");
|
2013
3105
|
return databaseURL + newPath;
|
2014
|
-
}
|
3106
|
+
},
|
3107
|
+
trace,
|
3108
|
+
clientID
|
2015
3109
|
};
|
2016
3110
|
}, _evaluateBranch = new WeakSet(), evaluateBranch_fn = async function(param) {
|
2017
3111
|
if (__privateGet(this, _branch))
|
@@ -2034,6 +3128,88 @@ const buildClient = (plugins) => {
|
|
2034
3128
|
class BaseClient extends buildClient() {
|
2035
3129
|
}
|
2036
3130
|
|
3131
|
+
const META = "__";
|
3132
|
+
const VALUE = "___";
|
3133
|
+
class Serializer {
|
3134
|
+
constructor() {
|
3135
|
+
this.classes = {};
|
3136
|
+
}
|
3137
|
+
add(clazz) {
|
3138
|
+
this.classes[clazz.name] = clazz;
|
3139
|
+
}
|
3140
|
+
toJSON(data) {
|
3141
|
+
function visit(obj) {
|
3142
|
+
if (Array.isArray(obj))
|
3143
|
+
return obj.map(visit);
|
3144
|
+
const type = typeof obj;
|
3145
|
+
if (type === "undefined")
|
3146
|
+
return { [META]: "undefined" };
|
3147
|
+
if (type === "bigint")
|
3148
|
+
return { [META]: "bigint", [VALUE]: obj.toString() };
|
3149
|
+
if (obj === null || type !== "object")
|
3150
|
+
return obj;
|
3151
|
+
const constructor = obj.constructor;
|
3152
|
+
const o = { [META]: constructor.name };
|
3153
|
+
for (const [key, value] of Object.entries(obj)) {
|
3154
|
+
o[key] = visit(value);
|
3155
|
+
}
|
3156
|
+
if (constructor === Date)
|
3157
|
+
o[VALUE] = obj.toISOString();
|
3158
|
+
if (constructor === Map)
|
3159
|
+
o[VALUE] = Object.fromEntries(obj);
|
3160
|
+
if (constructor === Set)
|
3161
|
+
o[VALUE] = [...obj];
|
3162
|
+
return o;
|
3163
|
+
}
|
3164
|
+
return JSON.stringify(visit(data));
|
3165
|
+
}
|
3166
|
+
fromJSON(json) {
|
3167
|
+
return JSON.parse(json, (key, value) => {
|
3168
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
3169
|
+
const { [META]: clazz, [VALUE]: val, ...rest } = value;
|
3170
|
+
const constructor = this.classes[clazz];
|
3171
|
+
if (constructor) {
|
3172
|
+
return Object.assign(Object.create(constructor.prototype), rest);
|
3173
|
+
}
|
3174
|
+
if (clazz === "Date")
|
3175
|
+
return new Date(val);
|
3176
|
+
if (clazz === "Set")
|
3177
|
+
return new Set(val);
|
3178
|
+
if (clazz === "Map")
|
3179
|
+
return new Map(Object.entries(val));
|
3180
|
+
if (clazz === "bigint")
|
3181
|
+
return BigInt(val);
|
3182
|
+
if (clazz === "undefined")
|
3183
|
+
return void 0;
|
3184
|
+
return rest;
|
3185
|
+
}
|
3186
|
+
return value;
|
3187
|
+
});
|
3188
|
+
}
|
3189
|
+
}
|
3190
|
+
const defaultSerializer = new Serializer();
|
3191
|
+
const serialize = (data) => {
|
3192
|
+
return defaultSerializer.toJSON(data);
|
3193
|
+
};
|
3194
|
+
const deserialize = (json) => {
|
3195
|
+
return defaultSerializer.fromJSON(json);
|
3196
|
+
};
|
3197
|
+
|
3198
|
+
function buildWorkerRunner(config) {
|
3199
|
+
return function xataWorker(name, _worker) {
|
3200
|
+
return async (...args) => {
|
3201
|
+
const url = process.env.NODE_ENV === "development" ? `http://localhost:64749/${name}` : `https://dispatcher.xata.workers.dev/${config.workspace}/${config.worker}/${name}`;
|
3202
|
+
const result = await fetch(url, {
|
3203
|
+
method: "POST",
|
3204
|
+
headers: { "Content-Type": "application/json" },
|
3205
|
+
body: serialize({ args })
|
3206
|
+
});
|
3207
|
+
const text = await result.text();
|
3208
|
+
return deserialize(text);
|
3209
|
+
};
|
3210
|
+
};
|
3211
|
+
}
|
3212
|
+
|
2037
3213
|
class XataError extends Error {
|
2038
3214
|
constructor(message, status) {
|
2039
3215
|
super(message);
|
@@ -2041,5 +3217,5 @@ class XataError extends Error {
|
|
2041
3217
|
}
|
2042
3218
|
}
|
2043
3219
|
|
2044
|
-
export { BaseClient, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, Query, RecordArray, Repository, RestRepository, SchemaPlugin, SearchPlugin, SimpleCache, XataApiClient, XataApiPlugin, XataError, XataPlugin, acceptWorkspaceMemberInvite, addGitBranchesEntry, addTableColumn, buildClient, bulkInsertTableRecords, cancelWorkspaceMemberInvite, contains, createBranch, createDatabase, createTable, createUserAPIKey, createWorkspace, deleteBranch, deleteColumn, deleteDatabase, deleteRecord, deleteTable, deleteUser, deleteUserAPIKey, deleteWorkspace, endsWith, executeBranchMigrationPlan, exists, ge, getAPIKey, getBranchDetails, getBranchList, getBranchMetadata, getBranchMigrationHistory, getBranchMigrationPlan, getBranchStats, getColumn, getCurrentBranchDetails, getCurrentBranchName, getDatabaseList, getDatabaseURL, getGitBranchesMapping, getRecord, getTableColumns, getTableSchema, getUser, getUserAPIKeys, getWorkspace, getWorkspaceMembersList, getWorkspacesList, gt, gte, includes, includesAll, includesAny, includesNone, insertRecord, insertRecordWithID, inviteWorkspaceMember, is, isCursorPaginationOptions, isIdentifiable, isNot, isXataRecord, le, lt, lte, notExists, operationsByTag, pattern, queryTable, removeGitBranchesEntry, removeWorkspaceMember, resendWorkspaceMemberInvite, resolveBranch, searchBranch, searchTable, setTableSchema, startsWith, updateBranchMetadata, updateColumn, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberInvite, updateWorkspaceMemberRole, upsertRecordWithID };
|
3220
|
+
export { BaseClient, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, Query, RecordArray, Repository, RestRepository, SchemaPlugin, SearchPlugin, Serializer, SimpleCache, XataApiClient, XataApiPlugin, XataError, XataPlugin, acceptWorkspaceMemberInvite, addGitBranchesEntry, addTableColumn, aggregateTable, applyBranchSchemaEdit, branchTransaction, buildClient, buildWorkerRunner, bulkInsertTableRecords, cancelWorkspaceMemberInvite, compareBranchSchemas, compareBranchWithUserSchema, compareMigrationRequest, contains, createBranch, createDatabase, createMigrationRequest, createTable, createUserAPIKey, createWorkspace, dEPRECATEDcreateDatabase, dEPRECATEDdeleteDatabase, dEPRECATEDgetDatabaseList, dEPRECATEDgetDatabaseMetadata, dEPRECATEDupdateDatabaseMetadata, deleteBranch, deleteColumn, deleteDatabase, deleteRecord, deleteTable, deleteUser, deleteUserAPIKey, deleteWorkspace, deserialize, endsWith, equals, executeBranchMigrationPlan, exists, ge, getAPIKey, getBranchDetails, getBranchList, getBranchMetadata, getBranchMigrationHistory, getBranchMigrationPlan, getBranchSchemaHistory, getBranchStats, getColumn, getCurrentBranchDetails, getCurrentBranchName, getDatabaseList, getDatabaseMetadata, getDatabaseURL, getGitBranchesMapping, getHostUrl, getMigrationRequest, getMigrationRequestIsMerged, getRecord, getTableColumns, getTableSchema, getUser, getUserAPIKeys, getWorkspace, getWorkspaceMembersList, getWorkspacesList, greaterEquals, greaterThan, greaterThanEquals, gt, gte, includes, includesAll, includesAny, includesNone, insertRecord, insertRecordWithID, inviteWorkspaceMember, is, isCursorPaginationOptions, isHostProviderAlias, isHostProviderBuilder, isIdentifiable, isNot, isXataRecord, le, lessEquals, lessThan, lessThanEquals, listMigrationRequestsCommits, listRegions, lt, lte, mergeMigrationRequest, notExists, operationsByTag, parseProviderString, parseWorkspacesUrlParts, pattern, previewBranchSchemaEdit, queryMigrationRequests, queryTable, removeGitBranchesEntry, removeWorkspaceMember, resendWorkspaceMemberInvite, resolveBranch, searchBranch, searchTable, serialize, setTableSchema, startsWith, summarizeTable, updateBranchMetadata, updateBranchSchema, updateColumn, updateDatabaseMetadata, updateMigrationRequest, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberInvite, updateWorkspaceMemberRole, upsertRecordWithID };
|
2045
3221
|
//# sourceMappingURL=index.mjs.map
|