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