@xata.io/client 0.0.0-alpha.vf603f80 → 0.0.0-alpha.vf6a5dcf
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 +158 -0
- package/README.md +30 -28
- package/Usage.md +62 -6
- package/dist/index.cjs +1847 -765
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4750 -1193
- package/dist/index.mjs +1811 -766
- 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
|
}
|
@@ -35,6 +57,12 @@ function isDefined(value) {
|
|
35
57
|
function isString(value) {
|
36
58
|
return isDefined(value) && typeof value === "string";
|
37
59
|
}
|
60
|
+
function isStringArray(value) {
|
61
|
+
return isDefined(value) && Array.isArray(value) && value.every(isString);
|
62
|
+
}
|
63
|
+
function isNumber(value) {
|
64
|
+
return isDefined(value) && typeof value === "number";
|
65
|
+
}
|
38
66
|
function toBase64(value) {
|
39
67
|
try {
|
40
68
|
return btoa(value);
|
@@ -43,6 +71,17 @@ function toBase64(value) {
|
|
43
71
|
return buf.from(value).toString("base64");
|
44
72
|
}
|
45
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
|
+
}
|
46
85
|
|
47
86
|
function getEnvironment() {
|
48
87
|
try {
|
@@ -140,12 +179,14 @@ function getFetchImplementation(userFetch) {
|
|
140
179
|
const globalFetch = typeof fetch !== "undefined" ? fetch : void 0;
|
141
180
|
const fetchImpl = userFetch ?? globalFetch;
|
142
181
|
if (!fetchImpl) {
|
143
|
-
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
|
+
);
|
144
185
|
}
|
145
186
|
return fetchImpl;
|
146
187
|
}
|
147
188
|
|
148
|
-
const VERSION = "0.0.0-alpha.
|
189
|
+
const VERSION = "0.0.0-alpha.vf6a5dcf";
|
149
190
|
|
150
191
|
class ErrorWithCause extends Error {
|
151
192
|
constructor(message, options) {
|
@@ -196,18 +237,24 @@ const resolveUrl = (url, queryParams = {}, pathParams = {}) => {
|
|
196
237
|
}, {});
|
197
238
|
const query = new URLSearchParams(cleanQueryParams).toString();
|
198
239
|
const queryString = query.length > 0 ? `?${query}` : "";
|
199
|
-
|
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;
|
200
244
|
};
|
201
245
|
function buildBaseUrl({
|
246
|
+
endpoint,
|
202
247
|
path,
|
203
248
|
workspacesApiUrl,
|
204
249
|
apiUrl,
|
205
|
-
pathParams
|
250
|
+
pathParams = {}
|
206
251
|
}) {
|
207
|
-
if (
|
208
|
-
|
209
|
-
|
210
|
-
|
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}`;
|
211
258
|
}
|
212
259
|
function hostHeader(url) {
|
213
260
|
const pattern = /.*:\/\/(?<host>[^/]+).*/;
|
@@ -223,279 +270,229 @@ async function fetch$1({
|
|
223
270
|
queryParams,
|
224
271
|
fetchImpl,
|
225
272
|
apiKey,
|
273
|
+
endpoint,
|
226
274
|
apiUrl,
|
227
|
-
workspacesApiUrl
|
275
|
+
workspacesApiUrl,
|
276
|
+
trace,
|
277
|
+
signal,
|
278
|
+
clientID,
|
279
|
+
sessionID
|
228
280
|
}) {
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
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) {
|
247
331
|
try {
|
248
|
-
const
|
249
|
-
|
250
|
-
return jsonResponse;
|
251
|
-
}
|
252
|
-
throw new FetcherError(response.status, jsonResponse, requestId);
|
332
|
+
const { host, protocol } = new URL(url);
|
333
|
+
return { host, protocol };
|
253
334
|
} catch (error) {
|
254
|
-
|
335
|
+
return {};
|
255
336
|
}
|
256
337
|
}
|
257
338
|
|
258
|
-
const
|
259
|
-
|
260
|
-
const
|
261
|
-
const
|
262
|
-
url: "/user/keys",
|
263
|
-
method: "get",
|
264
|
-
...variables
|
265
|
-
});
|
266
|
-
const createUserAPIKey = (variables) => fetch$1({
|
267
|
-
url: "/user/keys/{keyName}",
|
268
|
-
method: "post",
|
269
|
-
...variables
|
270
|
-
});
|
271
|
-
const deleteUserAPIKey = (variables) => fetch$1({
|
272
|
-
url: "/user/keys/{keyName}",
|
273
|
-
method: "delete",
|
274
|
-
...variables
|
275
|
-
});
|
276
|
-
const createWorkspace = (variables) => fetch$1({
|
277
|
-
url: "/workspaces",
|
278
|
-
method: "post",
|
279
|
-
...variables
|
280
|
-
});
|
281
|
-
const getWorkspacesList = (variables) => fetch$1({
|
282
|
-
url: "/workspaces",
|
283
|
-
method: "get",
|
284
|
-
...variables
|
285
|
-
});
|
286
|
-
const getWorkspace = (variables) => fetch$1({
|
287
|
-
url: "/workspaces/{workspaceId}",
|
288
|
-
method: "get",
|
289
|
-
...variables
|
290
|
-
});
|
291
|
-
const updateWorkspace = (variables) => fetch$1({
|
292
|
-
url: "/workspaces/{workspaceId}",
|
293
|
-
method: "put",
|
294
|
-
...variables
|
295
|
-
});
|
296
|
-
const deleteWorkspace = (variables) => fetch$1({
|
297
|
-
url: "/workspaces/{workspaceId}",
|
298
|
-
method: "delete",
|
299
|
-
...variables
|
300
|
-
});
|
301
|
-
const getWorkspaceMembersList = (variables) => fetch$1({
|
302
|
-
url: "/workspaces/{workspaceId}/members",
|
303
|
-
method: "get",
|
304
|
-
...variables
|
305
|
-
});
|
306
|
-
const updateWorkspaceMemberRole = (variables) => fetch$1({ url: "/workspaces/{workspaceId}/members/{userId}", method: "put", ...variables });
|
307
|
-
const removeWorkspaceMember = (variables) => fetch$1({
|
308
|
-
url: "/workspaces/{workspaceId}/members/{userId}",
|
309
|
-
method: "delete",
|
310
|
-
...variables
|
311
|
-
});
|
312
|
-
const inviteWorkspaceMember = (variables) => fetch$1({ url: "/workspaces/{workspaceId}/invites", method: "post", ...variables });
|
313
|
-
const updateWorkspaceMemberInvite = (variables) => fetch$1({ url: "/workspaces/{workspaceId}/invites/{inviteId}", method: "patch", ...variables });
|
314
|
-
const cancelWorkspaceMemberInvite = (variables) => fetch$1({
|
315
|
-
url: "/workspaces/{workspaceId}/invites/{inviteId}",
|
316
|
-
method: "delete",
|
317
|
-
...variables
|
318
|
-
});
|
319
|
-
const resendWorkspaceMemberInvite = (variables) => fetch$1({
|
320
|
-
url: "/workspaces/{workspaceId}/invites/{inviteId}/resend",
|
321
|
-
method: "post",
|
322
|
-
...variables
|
323
|
-
});
|
324
|
-
const acceptWorkspaceMemberInvite = (variables) => fetch$1({
|
325
|
-
url: "/workspaces/{workspaceId}/invites/{inviteKey}/accept",
|
326
|
-
method: "post",
|
327
|
-
...variables
|
328
|
-
});
|
329
|
-
const getDatabaseList = (variables) => fetch$1({
|
330
|
-
url: "/dbs",
|
331
|
-
method: "get",
|
332
|
-
...variables
|
333
|
-
});
|
334
|
-
const getBranchList = (variables) => fetch$1({
|
335
|
-
url: "/dbs/{dbName}",
|
336
|
-
method: "get",
|
337
|
-
...variables
|
338
|
-
});
|
339
|
-
const createDatabase = (variables) => fetch$1({
|
340
|
-
url: "/dbs/{dbName}",
|
341
|
-
method: "put",
|
342
|
-
...variables
|
343
|
-
});
|
344
|
-
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({
|
345
343
|
url: "/dbs/{dbName}",
|
346
|
-
method: "delete",
|
347
|
-
...variables
|
348
|
-
});
|
349
|
-
const getGitBranchesMapping = (variables) => fetch$1({ url: "/dbs/{dbName}/gitBranches", method: "get", ...variables });
|
350
|
-
const addGitBranchesEntry = (variables) => fetch$1({ url: "/dbs/{dbName}/gitBranches", method: "post", ...variables });
|
351
|
-
const removeGitBranchesEntry = (variables) => fetch$1({ url: "/dbs/{dbName}/gitBranches", method: "delete", ...variables });
|
352
|
-
const resolveBranch = (variables) => fetch$1({
|
353
|
-
url: "/dbs/{dbName}/resolveBranch",
|
354
344
|
method: "get",
|
355
|
-
...variables
|
345
|
+
...variables,
|
346
|
+
signal
|
356
347
|
});
|
357
|
-
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({
|
358
353
|
url: "/db/{dbBranchName}",
|
359
354
|
method: "get",
|
360
|
-
...variables
|
355
|
+
...variables,
|
356
|
+
signal
|
361
357
|
});
|
362
|
-
const createBranch = (variables) =>
|
363
|
-
|
364
|
-
method: "put",
|
365
|
-
...variables
|
366
|
-
});
|
367
|
-
const deleteBranch = (variables) => fetch$1({
|
358
|
+
const createBranch = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}", method: "put", ...variables, signal });
|
359
|
+
const deleteBranch = (variables, signal) => dataPlaneFetch({
|
368
360
|
url: "/db/{dbBranchName}",
|
369
361
|
method: "delete",
|
370
|
-
...variables
|
362
|
+
...variables,
|
363
|
+
signal
|
371
364
|
});
|
372
|
-
const updateBranchMetadata = (variables) =>
|
365
|
+
const updateBranchMetadata = (variables, signal) => dataPlaneFetch({
|
373
366
|
url: "/db/{dbBranchName}/metadata",
|
374
367
|
method: "put",
|
375
|
-
...variables
|
368
|
+
...variables,
|
369
|
+
signal
|
376
370
|
});
|
377
|
-
const getBranchMetadata = (variables) =>
|
371
|
+
const getBranchMetadata = (variables, signal) => dataPlaneFetch({
|
378
372
|
url: "/db/{dbBranchName}/metadata",
|
379
373
|
method: "get",
|
380
|
-
...variables
|
374
|
+
...variables,
|
375
|
+
signal
|
381
376
|
});
|
382
|
-
const
|
383
|
-
const executeBranchMigrationPlan = (variables) => fetch$1({ url: "/db/{dbBranchName}/migrations/execute", method: "post", ...variables });
|
384
|
-
const getBranchMigrationPlan = (variables) => fetch$1({ url: "/db/{dbBranchName}/migrations/plan", method: "post", ...variables });
|
385
|
-
const getBranchStats = (variables) => fetch$1({
|
377
|
+
const getBranchStats = (variables, signal) => dataPlaneFetch({
|
386
378
|
url: "/db/{dbBranchName}/stats",
|
387
379
|
method: "get",
|
388
|
-
...variables
|
380
|
+
...variables,
|
381
|
+
signal
|
382
|
+
});
|
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
|
389
398
|
});
|
390
|
-
const
|
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({
|
391
416
|
url: "/db/{dbBranchName}/tables/{tableName}",
|
392
417
|
method: "put",
|
393
|
-
...variables
|
418
|
+
...variables,
|
419
|
+
signal
|
394
420
|
});
|
395
|
-
const deleteTable = (variables) =>
|
421
|
+
const deleteTable = (variables, signal) => dataPlaneFetch({
|
396
422
|
url: "/db/{dbBranchName}/tables/{tableName}",
|
397
423
|
method: "delete",
|
398
|
-
...variables
|
399
|
-
|
400
|
-
const updateTable = (variables) => fetch$1({
|
401
|
-
url: "/db/{dbBranchName}/tables/{tableName}",
|
402
|
-
method: "patch",
|
403
|
-
...variables
|
424
|
+
...variables,
|
425
|
+
signal
|
404
426
|
});
|
405
|
-
const
|
427
|
+
const updateTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}", method: "patch", ...variables, signal });
|
428
|
+
const getTableSchema = (variables, signal) => dataPlaneFetch({
|
406
429
|
url: "/db/{dbBranchName}/tables/{tableName}/schema",
|
407
430
|
method: "get",
|
408
|
-
...variables
|
431
|
+
...variables,
|
432
|
+
signal
|
409
433
|
});
|
410
|
-
const setTableSchema = (variables) =>
|
411
|
-
|
412
|
-
method: "put",
|
413
|
-
...variables
|
414
|
-
});
|
415
|
-
const getTableColumns = (variables) => fetch$1({
|
434
|
+
const setTableSchema = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/schema", method: "put", ...variables, signal });
|
435
|
+
const getTableColumns = (variables, signal) => dataPlaneFetch({
|
416
436
|
url: "/db/{dbBranchName}/tables/{tableName}/columns",
|
417
437
|
method: "get",
|
418
|
-
...variables
|
419
|
-
|
420
|
-
const addTableColumn = (variables) => fetch$1({
|
421
|
-
url: "/db/{dbBranchName}/tables/{tableName}/columns",
|
422
|
-
method: "post",
|
423
|
-
...variables
|
438
|
+
...variables,
|
439
|
+
signal
|
424
440
|
});
|
425
|
-
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({
|
426
445
|
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
427
446
|
method: "get",
|
428
|
-
...variables
|
429
|
-
|
430
|
-
const deleteColumn = (variables) => fetch$1({
|
431
|
-
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
432
|
-
method: "delete",
|
433
|
-
...variables
|
447
|
+
...variables,
|
448
|
+
signal
|
434
449
|
});
|
435
|
-
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({
|
436
452
|
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
437
|
-
method: "patch",
|
438
|
-
...variables
|
439
|
-
});
|
440
|
-
const insertRecord = (variables) => fetch$1({
|
441
|
-
url: "/db/{dbBranchName}/tables/{tableName}/data",
|
442
|
-
method: "post",
|
443
|
-
...variables
|
444
|
-
});
|
445
|
-
const insertRecordWithID = (variables) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "put", ...variables });
|
446
|
-
const updateRecordWithID = (variables) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "patch", ...variables });
|
447
|
-
const upsertRecordWithID = (variables) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "post", ...variables });
|
448
|
-
const deleteRecord = (variables) => fetch$1({
|
449
|
-
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
450
453
|
method: "delete",
|
451
|
-
...variables
|
454
|
+
...variables,
|
455
|
+
signal
|
452
456
|
});
|
453
|
-
const
|
457
|
+
const insertRecord = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data", method: "post", ...variables, signal });
|
458
|
+
const getRecord = (variables, signal) => dataPlaneFetch({
|
454
459
|
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
455
460
|
method: "get",
|
456
|
-
...variables
|
461
|
+
...variables,
|
462
|
+
signal
|
457
463
|
});
|
458
|
-
const
|
459
|
-
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({
|
460
470
|
url: "/db/{dbBranchName}/tables/{tableName}/query",
|
461
471
|
method: "post",
|
462
|
-
...variables
|
472
|
+
...variables,
|
473
|
+
signal
|
463
474
|
});
|
464
|
-
const
|
465
|
-
url: "/db/{dbBranchName}/
|
475
|
+
const searchBranch = (variables, signal) => dataPlaneFetch({
|
476
|
+
url: "/db/{dbBranchName}/search",
|
466
477
|
method: "post",
|
467
|
-
...variables
|
478
|
+
...variables,
|
479
|
+
signal
|
468
480
|
});
|
469
|
-
const
|
470
|
-
url: "/db/{dbBranchName}/search",
|
481
|
+
const searchTable = (variables, signal) => dataPlaneFetch({
|
482
|
+
url: "/db/{dbBranchName}/tables/{tableName}/search",
|
471
483
|
method: "post",
|
472
|
-
...variables
|
484
|
+
...variables,
|
485
|
+
signal
|
473
486
|
});
|
474
|
-
const
|
475
|
-
|
476
|
-
|
477
|
-
createWorkspace,
|
478
|
-
getWorkspacesList,
|
479
|
-
getWorkspace,
|
480
|
-
updateWorkspace,
|
481
|
-
deleteWorkspace,
|
482
|
-
getWorkspaceMembersList,
|
483
|
-
updateWorkspaceMemberRole,
|
484
|
-
removeWorkspaceMember,
|
485
|
-
inviteWorkspaceMember,
|
486
|
-
updateWorkspaceMemberInvite,
|
487
|
-
cancelWorkspaceMemberInvite,
|
488
|
-
resendWorkspaceMemberInvite,
|
489
|
-
acceptWorkspaceMemberInvite
|
490
|
-
},
|
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 = {
|
491
490
|
database: {
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
removeGitBranchesEntry,
|
498
|
-
resolveBranch
|
491
|
+
dEPRECATEDgetDatabaseList,
|
492
|
+
dEPRECATEDcreateDatabase,
|
493
|
+
dEPRECATEDdeleteDatabase,
|
494
|
+
dEPRECATEDgetDatabaseMetadata,
|
495
|
+
dEPRECATEDupdateDatabaseMetadata
|
499
496
|
},
|
500
497
|
branch: {
|
501
498
|
getBranchList,
|
@@ -504,10 +501,42 @@ const operationsByTag = {
|
|
504
501
|
deleteBranch,
|
505
502
|
updateBranchMetadata,
|
506
503
|
getBranchMetadata,
|
504
|
+
getBranchStats,
|
505
|
+
getGitBranchesMapping,
|
506
|
+
addGitBranchesEntry,
|
507
|
+
removeGitBranchesEntry,
|
508
|
+
resolveBranch
|
509
|
+
},
|
510
|
+
migrations: {
|
507
511
|
getBranchMigrationHistory,
|
508
|
-
executeBranchMigrationPlan,
|
509
512
|
getBranchMigrationPlan,
|
510
|
-
|
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
|
511
540
|
},
|
512
541
|
table: {
|
513
542
|
createTable,
|
@@ -518,27 +547,150 @@ const operationsByTag = {
|
|
518
547
|
getTableColumns,
|
519
548
|
addTableColumn,
|
520
549
|
getColumn,
|
521
|
-
|
522
|
-
|
550
|
+
updateColumn,
|
551
|
+
deleteColumn
|
523
552
|
},
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
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
|
535
685
|
}
|
536
686
|
};
|
537
687
|
|
688
|
+
const operationsByTag = deepMerge(operationsByTag$2, operationsByTag$1);
|
689
|
+
|
538
690
|
function getHostUrl(provider, type) {
|
539
|
-
if (
|
691
|
+
if (isHostProviderAlias(provider)) {
|
540
692
|
return providers[provider][type];
|
541
|
-
} else if (
|
693
|
+
} else if (isHostProviderBuilder(provider)) {
|
542
694
|
return provider[type];
|
543
695
|
}
|
544
696
|
throw new Error("Invalid API provider");
|
@@ -546,19 +698,38 @@ function getHostUrl(provider, type) {
|
|
546
698
|
const providers = {
|
547
699
|
production: {
|
548
700
|
main: "https://api.xata.io",
|
549
|
-
workspaces: "https://{workspaceId}.xata.sh"
|
701
|
+
workspaces: "https://{workspaceId}.{region}.xata.sh"
|
550
702
|
},
|
551
703
|
staging: {
|
552
704
|
main: "https://staging.xatabase.co",
|
553
|
-
workspaces: "https://{workspaceId}.staging.xatabase.co"
|
705
|
+
workspaces: "https://{workspaceId}.staging.{region}.xatabase.co"
|
554
706
|
}
|
555
707
|
};
|
556
|
-
function
|
708
|
+
function isHostProviderAlias(alias) {
|
557
709
|
return isString(alias) && Object.keys(providers).includes(alias);
|
558
710
|
}
|
559
|
-
function
|
711
|
+
function isHostProviderBuilder(builder) {
|
560
712
|
return isObject(builder) && isString(builder.main) && isString(builder.workspaces);
|
561
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
|
+
}
|
562
733
|
|
563
734
|
var __accessCheck$7 = (obj, member, msg) => {
|
564
735
|
if (!member.has(obj))
|
@@ -584,7 +755,8 @@ class XataApiClient {
|
|
584
755
|
__privateAdd$7(this, _extraProps, void 0);
|
585
756
|
__privateAdd$7(this, _namespaces, {});
|
586
757
|
const provider = options.host ?? "production";
|
587
|
-
const apiKey = options
|
758
|
+
const apiKey = options.apiKey ?? getAPIKey();
|
759
|
+
const trace = options.trace ?? defaultTrace;
|
588
760
|
if (!apiKey) {
|
589
761
|
throw new Error("Could not resolve a valid apiKey");
|
590
762
|
}
|
@@ -592,7 +764,8 @@ class XataApiClient {
|
|
592
764
|
apiUrl: getHostUrl(provider, "main"),
|
593
765
|
workspacesApiUrl: getHostUrl(provider, "workspaces"),
|
594
766
|
fetchImpl: getFetchImplementation(options.fetch),
|
595
|
-
apiKey
|
767
|
+
apiKey,
|
768
|
+
trace
|
596
769
|
});
|
597
770
|
}
|
598
771
|
get user() {
|
@@ -600,21 +773,41 @@ class XataApiClient {
|
|
600
773
|
__privateGet$7(this, _namespaces).user = new UserApi(__privateGet$7(this, _extraProps));
|
601
774
|
return __privateGet$7(this, _namespaces).user;
|
602
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
|
+
}
|
603
781
|
get workspaces() {
|
604
782
|
if (!__privateGet$7(this, _namespaces).workspaces)
|
605
783
|
__privateGet$7(this, _namespaces).workspaces = new WorkspaceApi(__privateGet$7(this, _extraProps));
|
606
784
|
return __privateGet$7(this, _namespaces).workspaces;
|
607
785
|
}
|
608
|
-
get
|
609
|
-
if (!__privateGet$7(this, _namespaces).
|
610
|
-
__privateGet$7(this, _namespaces).
|
611
|
-
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;
|
612
795
|
}
|
613
796
|
get branches() {
|
614
797
|
if (!__privateGet$7(this, _namespaces).branches)
|
615
798
|
__privateGet$7(this, _namespaces).branches = new BranchApi(__privateGet$7(this, _extraProps));
|
616
799
|
return __privateGet$7(this, _namespaces).branches;
|
617
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
|
+
}
|
618
811
|
get tables() {
|
619
812
|
if (!__privateGet$7(this, _namespaces).tables)
|
620
813
|
__privateGet$7(this, _namespaces).tables = new TableApi(__privateGet$7(this, _extraProps));
|
@@ -625,6 +818,11 @@ class XataApiClient {
|
|
625
818
|
__privateGet$7(this, _namespaces).records = new RecordsApi(__privateGet$7(this, _extraProps));
|
626
819
|
return __privateGet$7(this, _namespaces).records;
|
627
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
|
+
}
|
628
826
|
}
|
629
827
|
_extraProps = new WeakMap();
|
630
828
|
_namespaces = new WeakMap();
|
@@ -635,24 +833,29 @@ class UserApi {
|
|
635
833
|
getUser() {
|
636
834
|
return operationsByTag.users.getUser({ ...this.extraProps });
|
637
835
|
}
|
638
|
-
updateUser(user) {
|
836
|
+
updateUser({ user }) {
|
639
837
|
return operationsByTag.users.updateUser({ body: user, ...this.extraProps });
|
640
838
|
}
|
641
839
|
deleteUser() {
|
642
840
|
return operationsByTag.users.deleteUser({ ...this.extraProps });
|
643
841
|
}
|
842
|
+
}
|
843
|
+
class AuthenticationApi {
|
844
|
+
constructor(extraProps) {
|
845
|
+
this.extraProps = extraProps;
|
846
|
+
}
|
644
847
|
getUserAPIKeys() {
|
645
|
-
return operationsByTag.
|
848
|
+
return operationsByTag.authentication.getUserAPIKeys({ ...this.extraProps });
|
646
849
|
}
|
647
|
-
createUserAPIKey(
|
648
|
-
return operationsByTag.
|
649
|
-
pathParams: { keyName },
|
850
|
+
createUserAPIKey({ name }) {
|
851
|
+
return operationsByTag.authentication.createUserAPIKey({
|
852
|
+
pathParams: { keyName: name },
|
650
853
|
...this.extraProps
|
651
854
|
});
|
652
855
|
}
|
653
|
-
deleteUserAPIKey(
|
654
|
-
return operationsByTag.
|
655
|
-
pathParams: { keyName },
|
856
|
+
deleteUserAPIKey({ name }) {
|
857
|
+
return operationsByTag.authentication.deleteUserAPIKey({
|
858
|
+
pathParams: { keyName: name },
|
656
859
|
...this.extraProps
|
657
860
|
});
|
658
861
|
}
|
@@ -661,349 +864,882 @@ class WorkspaceApi {
|
|
661
864
|
constructor(extraProps) {
|
662
865
|
this.extraProps = extraProps;
|
663
866
|
}
|
664
|
-
|
867
|
+
getWorkspacesList() {
|
868
|
+
return operationsByTag.workspaces.getWorkspacesList({ ...this.extraProps });
|
869
|
+
}
|
870
|
+
createWorkspace({ data }) {
|
665
871
|
return operationsByTag.workspaces.createWorkspace({
|
666
|
-
body:
|
872
|
+
body: data,
|
667
873
|
...this.extraProps
|
668
874
|
});
|
669
875
|
}
|
670
|
-
|
671
|
-
return operationsByTag.workspaces.getWorkspacesList({ ...this.extraProps });
|
672
|
-
}
|
673
|
-
getWorkspace(workspaceId) {
|
876
|
+
getWorkspace({ workspace }) {
|
674
877
|
return operationsByTag.workspaces.getWorkspace({
|
675
|
-
pathParams: { workspaceId },
|
878
|
+
pathParams: { workspaceId: workspace },
|
676
879
|
...this.extraProps
|
677
880
|
});
|
678
881
|
}
|
679
|
-
updateWorkspace(
|
882
|
+
updateWorkspace({
|
883
|
+
workspace,
|
884
|
+
update
|
885
|
+
}) {
|
680
886
|
return operationsByTag.workspaces.updateWorkspace({
|
681
|
-
pathParams: { workspaceId },
|
682
|
-
body:
|
887
|
+
pathParams: { workspaceId: workspace },
|
888
|
+
body: update,
|
683
889
|
...this.extraProps
|
684
890
|
});
|
685
891
|
}
|
686
|
-
deleteWorkspace(
|
892
|
+
deleteWorkspace({ workspace }) {
|
687
893
|
return operationsByTag.workspaces.deleteWorkspace({
|
688
|
-
pathParams: { workspaceId },
|
894
|
+
pathParams: { workspaceId: workspace },
|
689
895
|
...this.extraProps
|
690
896
|
});
|
691
897
|
}
|
692
|
-
getWorkspaceMembersList(
|
898
|
+
getWorkspaceMembersList({ workspace }) {
|
693
899
|
return operationsByTag.workspaces.getWorkspaceMembersList({
|
694
|
-
pathParams: { workspaceId },
|
900
|
+
pathParams: { workspaceId: workspace },
|
695
901
|
...this.extraProps
|
696
902
|
});
|
697
903
|
}
|
698
|
-
updateWorkspaceMemberRole(
|
904
|
+
updateWorkspaceMemberRole({
|
905
|
+
workspace,
|
906
|
+
user,
|
907
|
+
role
|
908
|
+
}) {
|
699
909
|
return operationsByTag.workspaces.updateWorkspaceMemberRole({
|
700
|
-
pathParams: { workspaceId, userId },
|
910
|
+
pathParams: { workspaceId: workspace, userId: user },
|
701
911
|
body: { role },
|
702
912
|
...this.extraProps
|
703
913
|
});
|
704
914
|
}
|
705
|
-
removeWorkspaceMember(
|
915
|
+
removeWorkspaceMember({
|
916
|
+
workspace,
|
917
|
+
user
|
918
|
+
}) {
|
706
919
|
return operationsByTag.workspaces.removeWorkspaceMember({
|
707
|
-
pathParams: { workspaceId, userId },
|
920
|
+
pathParams: { workspaceId: workspace, userId: user },
|
708
921
|
...this.extraProps
|
709
922
|
});
|
710
923
|
}
|
711
|
-
|
712
|
-
|
713
|
-
|
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 },
|
714
936
|
body: { email, role },
|
715
937
|
...this.extraProps
|
716
938
|
});
|
717
939
|
}
|
718
|
-
updateWorkspaceMemberInvite(
|
719
|
-
|
720
|
-
|
940
|
+
updateWorkspaceMemberInvite({
|
941
|
+
workspace,
|
942
|
+
invite,
|
943
|
+
role
|
944
|
+
}) {
|
945
|
+
return operationsByTag.invites.updateWorkspaceMemberInvite({
|
946
|
+
pathParams: { workspaceId: workspace, inviteId: invite },
|
721
947
|
body: { role },
|
722
948
|
...this.extraProps
|
723
949
|
});
|
724
950
|
}
|
725
|
-
cancelWorkspaceMemberInvite(
|
726
|
-
|
727
|
-
|
951
|
+
cancelWorkspaceMemberInvite({
|
952
|
+
workspace,
|
953
|
+
invite
|
954
|
+
}) {
|
955
|
+
return operationsByTag.invites.cancelWorkspaceMemberInvite({
|
956
|
+
pathParams: { workspaceId: workspace, inviteId: invite },
|
957
|
+
...this.extraProps
|
958
|
+
});
|
959
|
+
}
|
960
|
+
acceptWorkspaceMemberInvite({
|
961
|
+
workspace,
|
962
|
+
key
|
963
|
+
}) {
|
964
|
+
return operationsByTag.invites.acceptWorkspaceMemberInvite({
|
965
|
+
pathParams: { workspaceId: workspace, inviteKey: key },
|
966
|
+
...this.extraProps
|
967
|
+
});
|
968
|
+
}
|
969
|
+
resendWorkspaceMemberInvite({
|
970
|
+
workspace,
|
971
|
+
invite
|
972
|
+
}) {
|
973
|
+
return operationsByTag.invites.resendWorkspaceMemberInvite({
|
974
|
+
pathParams: { workspaceId: workspace, inviteId: invite },
|
975
|
+
...this.extraProps
|
976
|
+
});
|
977
|
+
}
|
978
|
+
}
|
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 {
|
1114
|
+
constructor(extraProps) {
|
1115
|
+
this.extraProps = extraProps;
|
1116
|
+
}
|
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 },
|
1126
|
+
...this.extraProps
|
1127
|
+
});
|
1128
|
+
}
|
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 },
|
1138
|
+
...this.extraProps
|
1139
|
+
});
|
1140
|
+
}
|
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,
|
728
1266
|
...this.extraProps
|
729
1267
|
});
|
730
1268
|
}
|
731
|
-
|
732
|
-
|
733
|
-
|
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 },
|
734
1351
|
...this.extraProps
|
735
1352
|
});
|
736
1353
|
}
|
737
|
-
|
738
|
-
|
739
|
-
|
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 },
|
740
1367
|
...this.extraProps
|
741
1368
|
});
|
742
1369
|
}
|
743
1370
|
}
|
744
|
-
class
|
1371
|
+
class SearchAndFilterApi {
|
745
1372
|
constructor(extraProps) {
|
746
1373
|
this.extraProps = extraProps;
|
747
1374
|
}
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
return operationsByTag.database.deleteDatabase({
|
763
|
-
pathParams: { workspace, dbName },
|
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 },
|
764
1389
|
...this.extraProps
|
765
1390
|
});
|
766
1391
|
}
|
767
|
-
|
768
|
-
|
769
|
-
|
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 },
|
770
1409
|
...this.extraProps
|
771
1410
|
});
|
772
1411
|
}
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
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 },
|
777
1426
|
...this.extraProps
|
778
1427
|
});
|
779
1428
|
}
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
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 },
|
784
1445
|
...this.extraProps
|
785
1446
|
});
|
786
1447
|
}
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
|
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 },
|
791
1460
|
...this.extraProps
|
792
1461
|
});
|
793
1462
|
}
|
794
1463
|
}
|
795
|
-
class
|
1464
|
+
class MigrationRequestsApi {
|
796
1465
|
constructor(extraProps) {
|
797
1466
|
this.extraProps = extraProps;
|
798
1467
|
}
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
createBranch(workspace, database, branch, from, options = {}) {
|
812
|
-
return operationsByTag.branch.createBranch({
|
813
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}` },
|
814
|
-
queryParams: isString(from) ? { from } : void 0,
|
815
|
-
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 },
|
816
1480
|
...this.extraProps
|
817
1481
|
});
|
818
1482
|
}
|
819
|
-
|
820
|
-
|
821
|
-
|
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,
|
822
1492
|
...this.extraProps
|
823
1493
|
});
|
824
1494
|
}
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
1495
|
+
getMigrationRequest({
|
1496
|
+
workspace,
|
1497
|
+
region,
|
1498
|
+
database,
|
1499
|
+
migrationRequest
|
1500
|
+
}) {
|
1501
|
+
return operationsByTag.migrationRequests.getMigrationRequest({
|
1502
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
829
1503
|
...this.extraProps
|
830
1504
|
});
|
831
1505
|
}
|
832
|
-
|
833
|
-
|
834
|
-
|
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,
|
835
1516
|
...this.extraProps
|
836
1517
|
});
|
837
1518
|
}
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
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 },
|
842
1529
|
...this.extraProps
|
843
1530
|
});
|
844
1531
|
}
|
845
|
-
|
846
|
-
|
847
|
-
|
848
|
-
|
1532
|
+
compareMigrationRequest({
|
1533
|
+
workspace,
|
1534
|
+
region,
|
1535
|
+
database,
|
1536
|
+
migrationRequest
|
1537
|
+
}) {
|
1538
|
+
return operationsByTag.migrationRequests.compareMigrationRequest({
|
1539
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
849
1540
|
...this.extraProps
|
850
1541
|
});
|
851
1542
|
}
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
|
1543
|
+
getMigrationRequestIsMerged({
|
1544
|
+
workspace,
|
1545
|
+
region,
|
1546
|
+
database,
|
1547
|
+
migrationRequest
|
1548
|
+
}) {
|
1549
|
+
return operationsByTag.migrationRequests.getMigrationRequestIsMerged({
|
1550
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
856
1551
|
...this.extraProps
|
857
1552
|
});
|
858
1553
|
}
|
859
|
-
|
860
|
-
|
861
|
-
|
1554
|
+
mergeMigrationRequest({
|
1555
|
+
workspace,
|
1556
|
+
region,
|
1557
|
+
database,
|
1558
|
+
migrationRequest
|
1559
|
+
}) {
|
1560
|
+
return operationsByTag.migrationRequests.mergeMigrationRequest({
|
1561
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
862
1562
|
...this.extraProps
|
863
1563
|
});
|
864
1564
|
}
|
865
1565
|
}
|
866
|
-
class
|
1566
|
+
class MigrationsApi {
|
867
1567
|
constructor(extraProps) {
|
868
1568
|
this.extraProps = extraProps;
|
869
1569
|
}
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
|
875
|
-
|
876
|
-
|
877
|
-
|
878
|
-
|
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 },
|
879
1581
|
...this.extraProps
|
880
1582
|
});
|
881
1583
|
}
|
882
|
-
|
883
|
-
|
884
|
-
|
885
|
-
|
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,
|
886
1594
|
...this.extraProps
|
887
1595
|
});
|
888
1596
|
}
|
889
|
-
|
890
|
-
|
891
|
-
|
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,
|
892
1607
|
...this.extraProps
|
893
1608
|
});
|
894
1609
|
}
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
|
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 },
|
899
1620
|
...this.extraProps
|
900
1621
|
});
|
901
1622
|
}
|
902
|
-
|
903
|
-
|
904
|
-
|
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 },
|
905
1633
|
...this.extraProps
|
906
1634
|
});
|
907
1635
|
}
|
908
|
-
|
909
|
-
|
910
|
-
|
911
|
-
|
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 },
|
912
1647
|
...this.extraProps
|
913
1648
|
});
|
914
1649
|
}
|
915
|
-
|
916
|
-
|
917
|
-
|
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,
|
918
1660
|
...this.extraProps
|
919
1661
|
});
|
920
1662
|
}
|
921
|
-
|
922
|
-
|
923
|
-
|
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,
|
924
1673
|
...this.extraProps
|
925
1674
|
});
|
926
1675
|
}
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
|
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 },
|
931
1686
|
...this.extraProps
|
932
1687
|
});
|
933
1688
|
}
|
934
1689
|
}
|
935
|
-
class
|
1690
|
+
class DatabaseApi {
|
936
1691
|
constructor(extraProps) {
|
937
1692
|
this.extraProps = extraProps;
|
938
1693
|
}
|
939
|
-
|
940
|
-
return operationsByTag.
|
941
|
-
pathParams: {
|
942
|
-
body: record,
|
943
|
-
...this.extraProps
|
944
|
-
});
|
945
|
-
}
|
946
|
-
insertRecordWithID(workspace, database, branch, tableName, recordId, record, options = {}) {
|
947
|
-
return operationsByTag.records.insertRecordWithID({
|
948
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
|
949
|
-
queryParams: options,
|
950
|
-
body: record,
|
951
|
-
...this.extraProps
|
952
|
-
});
|
953
|
-
}
|
954
|
-
updateRecordWithID(workspace, database, branch, tableName, recordId, record, options = {}) {
|
955
|
-
return operationsByTag.records.updateRecordWithID({
|
956
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
|
957
|
-
queryParams: options,
|
958
|
-
body: record,
|
959
|
-
...this.extraProps
|
960
|
-
});
|
961
|
-
}
|
962
|
-
upsertRecordWithID(workspace, database, branch, tableName, recordId, record, options = {}) {
|
963
|
-
return operationsByTag.records.upsertRecordWithID({
|
964
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
|
965
|
-
queryParams: options,
|
966
|
-
body: record,
|
967
|
-
...this.extraProps
|
968
|
-
});
|
969
|
-
}
|
970
|
-
deleteRecord(workspace, database, branch, tableName, recordId) {
|
971
|
-
return operationsByTag.records.deleteRecord({
|
972
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
|
1694
|
+
getDatabaseList({ workspace }) {
|
1695
|
+
return operationsByTag.databases.getDatabaseList({
|
1696
|
+
pathParams: { workspaceId: workspace },
|
973
1697
|
...this.extraProps
|
974
1698
|
});
|
975
1699
|
}
|
976
|
-
|
977
|
-
|
978
|
-
|
1700
|
+
createDatabase({
|
1701
|
+
workspace,
|
1702
|
+
database,
|
1703
|
+
data
|
1704
|
+
}) {
|
1705
|
+
return operationsByTag.databases.createDatabase({
|
1706
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
1707
|
+
body: data,
|
979
1708
|
...this.extraProps
|
980
1709
|
});
|
981
1710
|
}
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
|
1711
|
+
deleteDatabase({
|
1712
|
+
workspace,
|
1713
|
+
database
|
1714
|
+
}) {
|
1715
|
+
return operationsByTag.databases.deleteDatabase({
|
1716
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
986
1717
|
...this.extraProps
|
987
1718
|
});
|
988
1719
|
}
|
989
|
-
|
990
|
-
|
991
|
-
|
992
|
-
|
1720
|
+
getDatabaseMetadata({
|
1721
|
+
workspace,
|
1722
|
+
database
|
1723
|
+
}) {
|
1724
|
+
return operationsByTag.databases.getDatabaseMetadata({
|
1725
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
993
1726
|
...this.extraProps
|
994
1727
|
});
|
995
1728
|
}
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
|
1729
|
+
updateDatabaseMetadata({
|
1730
|
+
workspace,
|
1731
|
+
database,
|
1732
|
+
metadata
|
1733
|
+
}) {
|
1734
|
+
return operationsByTag.databases.updateDatabaseMetadata({
|
1735
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
1736
|
+
body: metadata,
|
1000
1737
|
...this.extraProps
|
1001
1738
|
});
|
1002
1739
|
}
|
1003
|
-
|
1004
|
-
return operationsByTag.
|
1005
|
-
pathParams: {
|
1006
|
-
body: query,
|
1740
|
+
listRegions({ workspace }) {
|
1741
|
+
return operationsByTag.databases.listRegions({
|
1742
|
+
pathParams: { workspaceId: workspace },
|
1007
1743
|
...this.extraProps
|
1008
1744
|
});
|
1009
1745
|
}
|
@@ -1019,6 +1755,20 @@ class XataApiPlugin {
|
|
1019
1755
|
class XataPlugin {
|
1020
1756
|
}
|
1021
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
|
+
|
1022
1772
|
var __accessCheck$6 = (obj, member, msg) => {
|
1023
1773
|
if (!member.has(obj))
|
1024
1774
|
throw TypeError("Cannot " + msg);
|
@@ -1132,9 +1882,14 @@ var __privateSet$5 = (obj, member, value, setter) => {
|
|
1132
1882
|
setter ? setter.call(obj, value) : member.set(obj, value);
|
1133
1883
|
return value;
|
1134
1884
|
};
|
1135
|
-
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;
|
1136
1890
|
const _Query = class {
|
1137
1891
|
constructor(repository, table, data, rawParent) {
|
1892
|
+
__privateAdd$5(this, _cleanFilterConstraint);
|
1138
1893
|
__privateAdd$5(this, _table$1, void 0);
|
1139
1894
|
__privateAdd$5(this, _repository, void 0);
|
1140
1895
|
__privateAdd$5(this, _data, { filter: {} });
|
@@ -1153,7 +1908,7 @@ const _Query = class {
|
|
1153
1908
|
__privateGet$5(this, _data).filter.$not = data.filter?.$not ?? parent?.filter?.$not;
|
1154
1909
|
__privateGet$5(this, _data).filter.$none = data.filter?.$none ?? parent?.filter?.$none;
|
1155
1910
|
__privateGet$5(this, _data).sort = data.sort ?? parent?.sort;
|
1156
|
-
__privateGet$5(this, _data).columns = data.columns ?? parent?.columns
|
1911
|
+
__privateGet$5(this, _data).columns = data.columns ?? parent?.columns;
|
1157
1912
|
__privateGet$5(this, _data).pagination = data.pagination ?? parent?.pagination;
|
1158
1913
|
__privateGet$5(this, _data).cache = data.cache ?? parent?.cache;
|
1159
1914
|
this.any = this.any.bind(this);
|
@@ -1191,21 +1946,29 @@ const _Query = class {
|
|
1191
1946
|
}
|
1192
1947
|
filter(a, b) {
|
1193
1948
|
if (arguments.length === 1) {
|
1194
|
-
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
|
+
}));
|
1195
1952
|
const $all = compact([__privateGet$5(this, _data).filter?.$all].flat().concat(constraints));
|
1196
1953
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $all } }, __privateGet$5(this, _data));
|
1197
1954
|
} else {
|
1198
|
-
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));
|
1199
1957
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $all } }, __privateGet$5(this, _data));
|
1200
1958
|
}
|
1201
1959
|
}
|
1202
|
-
sort(column, direction) {
|
1960
|
+
sort(column, direction = "asc") {
|
1203
1961
|
const originalSort = [__privateGet$5(this, _data).sort ?? []].flat();
|
1204
1962
|
const sort = [...originalSort, { column, direction }];
|
1205
1963
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { sort }, __privateGet$5(this, _data));
|
1206
1964
|
}
|
1207
1965
|
select(columns) {
|
1208
|
-
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
|
+
);
|
1209
1972
|
}
|
1210
1973
|
getPaginated(options = {}) {
|
1211
1974
|
const query = new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), options, __privateGet$5(this, _data));
|
@@ -1228,11 +1991,20 @@ const _Query = class {
|
|
1228
1991
|
}
|
1229
1992
|
}
|
1230
1993
|
async getMany(options = {}) {
|
1231
|
-
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
|
+
}
|
1232
2003
|
if (page.hasNextPage() && options.pagination?.size === void 0) {
|
1233
2004
|
console.trace("Calling getMany does not return all results. Paginate to get all results or call getAll.");
|
1234
2005
|
}
|
1235
|
-
|
2006
|
+
const array = new RecordArray(page, results.slice(0, size));
|
2007
|
+
return array;
|
1236
2008
|
}
|
1237
2009
|
async getAll(options = {}) {
|
1238
2010
|
const { batchSize = PAGINATION_MAX_SIZE, ...rest } = options;
|
@@ -1246,6 +2018,22 @@ const _Query = class {
|
|
1246
2018
|
const records = await this.getMany({ ...options, pagination: { size: 1 } });
|
1247
2019
|
return records[0] ?? null;
|
1248
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
|
+
}
|
1249
2037
|
cache(ttl) {
|
1250
2038
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { cache: ttl }, __privateGet$5(this, _data));
|
1251
2039
|
}
|
@@ -1269,9 +2057,20 @@ let Query = _Query;
|
|
1269
2057
|
_table$1 = new WeakMap();
|
1270
2058
|
_repository = new WeakMap();
|
1271
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
|
+
};
|
1272
2071
|
function cleanParent(data, parent) {
|
1273
2072
|
if (isCursorPaginationOptions(data.pagination)) {
|
1274
|
-
return { ...parent,
|
2073
|
+
return { ...parent, sort: void 0, filter: void 0 };
|
1275
2074
|
}
|
1276
2075
|
return parent;
|
1277
2076
|
}
|
@@ -1330,318 +2129,486 @@ var __privateMethod$2 = (obj, member, method) => {
|
|
1330
2129
|
__accessCheck$4(obj, member, "access private method");
|
1331
2130
|
return method;
|
1332
2131
|
};
|
1333
|
-
var _table, _getFetchProps, _cache, _schemaTables$2, _insertRecordWithoutId, insertRecordWithoutId_fn, _insertRecordWithId, insertRecordWithId_fn, _bulkInsertTableRecords, bulkInsertTableRecords_fn, _updateRecordWithID, updateRecordWithID_fn, _upsertRecordWithID, upsertRecordWithID_fn, _deleteRecord, deleteRecord_fn,
|
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;
|
1334
2133
|
class Repository extends Query {
|
1335
2134
|
}
|
1336
2135
|
class RestRepository extends Query {
|
1337
2136
|
constructor(options) {
|
1338
|
-
super(
|
2137
|
+
super(
|
2138
|
+
null,
|
2139
|
+
{ name: options.table, schema: options.schemaTables?.find((table) => table.name === options.table) },
|
2140
|
+
{}
|
2141
|
+
);
|
1339
2142
|
__privateAdd$4(this, _insertRecordWithoutId);
|
1340
2143
|
__privateAdd$4(this, _insertRecordWithId);
|
1341
2144
|
__privateAdd$4(this, _bulkInsertTableRecords);
|
1342
2145
|
__privateAdd$4(this, _updateRecordWithID);
|
1343
2146
|
__privateAdd$4(this, _upsertRecordWithID);
|
1344
2147
|
__privateAdd$4(this, _deleteRecord);
|
1345
|
-
__privateAdd$4(this, _invalidateCache);
|
1346
|
-
__privateAdd$4(this, _setCacheRecord);
|
1347
|
-
__privateAdd$4(this, _getCacheRecord);
|
1348
2148
|
__privateAdd$4(this, _setCacheQuery);
|
1349
2149
|
__privateAdd$4(this, _getCacheQuery);
|
1350
2150
|
__privateAdd$4(this, _getSchemaTables$1);
|
1351
2151
|
__privateAdd$4(this, _table, void 0);
|
1352
2152
|
__privateAdd$4(this, _getFetchProps, void 0);
|
2153
|
+
__privateAdd$4(this, _db, void 0);
|
1353
2154
|
__privateAdd$4(this, _cache, void 0);
|
1354
2155
|
__privateAdd$4(this, _schemaTables$2, void 0);
|
2156
|
+
__privateAdd$4(this, _trace, void 0);
|
1355
2157
|
__privateSet$4(this, _table, options.table);
|
1356
|
-
__privateSet$4(this,
|
1357
|
-
this.db = options.db;
|
2158
|
+
__privateSet$4(this, _db, options.db);
|
1358
2159
|
__privateSet$4(this, _cache, options.pluginOptions.cache);
|
1359
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
|
+
});
|
1360
2174
|
}
|
1361
|
-
async create(a, b) {
|
1362
|
-
|
1363
|
-
|
1364
|
-
|
1365
|
-
|
1366
|
-
|
1367
|
-
|
1368
|
-
|
1369
|
-
|
1370
|
-
if (a
|
1371
|
-
|
1372
|
-
|
1373
|
-
|
1374
|
-
|
1375
|
-
|
1376
|
-
|
1377
|
-
|
1378
|
-
|
1379
|
-
|
1380
|
-
|
1381
|
-
|
1382
|
-
|
1383
|
-
|
1384
|
-
|
1385
|
-
|
1386
|
-
|
1387
|
-
}
|
1388
|
-
|
1389
|
-
|
1390
|
-
|
1391
|
-
|
1392
|
-
if (a
|
1393
|
-
|
1394
|
-
|
1395
|
-
|
1396
|
-
|
1397
|
-
|
1398
|
-
|
1399
|
-
|
1400
|
-
|
1401
|
-
return
|
1402
|
-
|
1403
|
-
|
1404
|
-
|
1405
|
-
|
1406
|
-
|
1407
|
-
|
1408
|
-
|
1409
|
-
|
1410
|
-
|
1411
|
-
|
1412
|
-
|
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
|
+
});
|
2202
|
+
}
|
2203
|
+
async read(a, b) {
|
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;
|
1413
2239
|
}
|
1414
|
-
throw e;
|
1415
2240
|
}
|
1416
|
-
|
2241
|
+
return null;
|
2242
|
+
});
|
1417
2243
|
}
|
1418
|
-
async
|
1419
|
-
|
1420
|
-
|
1421
|
-
|
1422
|
-
|
1423
|
-
|
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;
|
1424
2255
|
}
|
1425
|
-
|
1426
|
-
|
1427
|
-
|
1428
|
-
await __privateMethod$2(this, _invalidateCache, invalidateCache_fn).call(this, a);
|
1429
|
-
const record = await __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a, b);
|
1430
|
-
await __privateMethod$2(this, _setCacheRecord, setCacheRecord_fn).call(this, record);
|
1431
|
-
return record;
|
1432
|
-
}
|
1433
|
-
if (isObject(a) && isString(a.id)) {
|
1434
|
-
await __privateMethod$2(this, _invalidateCache, invalidateCache_fn).call(this, a.id);
|
1435
|
-
const record = await __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a.id, { ...a, id: void 0 });
|
1436
|
-
await __privateMethod$2(this, _setCacheRecord, setCacheRecord_fn).call(this, record);
|
1437
|
-
return record;
|
1438
|
-
}
|
1439
|
-
throw new Error("Invalid arguments for update method");
|
1440
|
-
}
|
1441
|
-
async createOrUpdate(a, b) {
|
1442
|
-
if (Array.isArray(a)) {
|
1443
|
-
if (a.length === 0)
|
1444
|
-
return [];
|
1445
|
-
if (a.length > 100) {
|
1446
|
-
console.warn("Bulk update operation is not optimized in the Xata API yet, this request might be slow");
|
2256
|
+
if (result === null) {
|
2257
|
+
const id = extractId(a) ?? "unknown";
|
2258
|
+
throw new Error(`Record with id ${id} not found`);
|
1447
2259
|
}
|
1448
|
-
return
|
1449
|
-
}
|
1450
|
-
|
1451
|
-
|
1452
|
-
|
1453
|
-
|
1454
|
-
|
1455
|
-
|
1456
|
-
|
1457
|
-
|
1458
|
-
|
1459
|
-
|
1460
|
-
|
1461
|
-
|
1462
|
-
throw new Error("Invalid arguments for createOrUpdate method");
|
1463
|
-
}
|
1464
|
-
async delete(a) {
|
1465
|
-
if (Array.isArray(a)) {
|
1466
|
-
if (a.length === 0)
|
1467
|
-
return;
|
1468
|
-
if (a.length > 100) {
|
1469
|
-
console.warn("Bulk delete operation is not optimized in the Xata API yet, this request might be slow");
|
2260
|
+
return result;
|
2261
|
+
});
|
2262
|
+
}
|
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)));
|
1470
2274
|
}
|
1471
|
-
|
1472
|
-
|
1473
|
-
|
1474
|
-
|
1475
|
-
|
1476
|
-
|
1477
|
-
|
1478
|
-
|
1479
|
-
|
1480
|
-
|
1481
|
-
|
1482
|
-
|
1483
|
-
|
1484
|
-
|
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 });
|
2278
|
+
}
|
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 });
|
2282
|
+
}
|
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
|
+
});
|
1485
2384
|
}
|
1486
2385
|
async search(query, options = {}) {
|
1487
|
-
|
1488
|
-
|
1489
|
-
|
1490
|
-
|
1491
|
-
|
1492
|
-
|
1493
|
-
|
1494
|
-
|
1495
|
-
|
1496
|
-
|
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;
|
1497
2423
|
});
|
1498
|
-
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1499
|
-
return records.map((item) => initObject(this.db, schemaTables, __privateGet$4(this, _table), item));
|
1500
2424
|
}
|
1501
2425
|
async query(query) {
|
1502
|
-
|
1503
|
-
|
1504
|
-
|
1505
|
-
|
1506
|
-
|
1507
|
-
|
1508
|
-
|
1509
|
-
|
1510
|
-
|
1511
|
-
|
1512
|
-
|
1513
|
-
|
1514
|
-
|
1515
|
-
|
1516
|
-
|
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;
|
1517
2477
|
});
|
1518
|
-
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1519
|
-
const records = objects.map((record) => initObject(this.db, schemaTables, __privateGet$4(this, _table), record));
|
1520
|
-
await __privateMethod$2(this, _setCacheQuery, setCacheQuery_fn).call(this, query, meta, records);
|
1521
|
-
return new Page(query, meta, records);
|
1522
2478
|
}
|
1523
2479
|
}
|
1524
2480
|
_table = new WeakMap();
|
1525
2481
|
_getFetchProps = new WeakMap();
|
2482
|
+
_db = new WeakMap();
|
1526
2483
|
_cache = new WeakMap();
|
1527
2484
|
_schemaTables$2 = new WeakMap();
|
2485
|
+
_trace = new WeakMap();
|
1528
2486
|
_insertRecordWithoutId = new WeakSet();
|
1529
|
-
insertRecordWithoutId_fn = async function(object) {
|
2487
|
+
insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
|
1530
2488
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1531
2489
|
const record = transformObjectLinks(object);
|
1532
2490
|
const response = await insertRecord({
|
1533
2491
|
pathParams: {
|
1534
2492
|
workspace: "{workspaceId}",
|
1535
2493
|
dbBranchName: "{dbBranch}",
|
2494
|
+
region: "{region}",
|
1536
2495
|
tableName: __privateGet$4(this, _table)
|
1537
2496
|
},
|
2497
|
+
queryParams: { columns },
|
1538
2498
|
body: record,
|
1539
2499
|
...fetchProps
|
1540
2500
|
});
|
1541
|
-
const
|
1542
|
-
|
1543
|
-
throw new Error("The server failed to save the record");
|
1544
|
-
}
|
1545
|
-
return finalObject;
|
2501
|
+
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
2502
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
1546
2503
|
};
|
1547
2504
|
_insertRecordWithId = new WeakSet();
|
1548
|
-
insertRecordWithId_fn = async function(recordId, object) {
|
2505
|
+
insertRecordWithId_fn = async function(recordId, object, columns = ["*"], { createOnly, ifVersion }) {
|
1549
2506
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1550
2507
|
const record = transformObjectLinks(object);
|
1551
2508
|
const response = await insertRecordWithID({
|
1552
2509
|
pathParams: {
|
1553
2510
|
workspace: "{workspaceId}",
|
1554
2511
|
dbBranchName: "{dbBranch}",
|
2512
|
+
region: "{region}",
|
1555
2513
|
tableName: __privateGet$4(this, _table),
|
1556
2514
|
recordId
|
1557
2515
|
},
|
1558
2516
|
body: record,
|
1559
|
-
queryParams: { createOnly
|
2517
|
+
queryParams: { createOnly, columns, ifVersion },
|
1560
2518
|
...fetchProps
|
1561
2519
|
});
|
1562
|
-
const
|
1563
|
-
|
1564
|
-
throw new Error("The server failed to save the record");
|
1565
|
-
}
|
1566
|
-
return finalObject;
|
2520
|
+
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
2521
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
1567
2522
|
};
|
1568
2523
|
_bulkInsertTableRecords = new WeakSet();
|
1569
|
-
bulkInsertTableRecords_fn = async function(objects) {
|
2524
|
+
bulkInsertTableRecords_fn = async function(objects, columns = ["*"]) {
|
1570
2525
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1571
2526
|
const records = objects.map((object) => transformObjectLinks(object));
|
1572
|
-
const
|
1573
|
-
pathParams: {
|
2527
|
+
const response = await bulkInsertTableRecords({
|
2528
|
+
pathParams: {
|
2529
|
+
workspace: "{workspaceId}",
|
2530
|
+
dbBranchName: "{dbBranch}",
|
2531
|
+
region: "{region}",
|
2532
|
+
tableName: __privateGet$4(this, _table)
|
2533
|
+
},
|
2534
|
+
queryParams: { columns },
|
1574
2535
|
body: { records },
|
1575
2536
|
...fetchProps
|
1576
2537
|
});
|
1577
|
-
|
1578
|
-
|
1579
|
-
throw new Error("The server failed to save some records");
|
2538
|
+
if (!isResponseWithRecords(response)) {
|
2539
|
+
throw new Error("Request included columns but server didn't include them");
|
1580
2540
|
}
|
1581
|
-
const
|
1582
|
-
|
1583
|
-
return acc;
|
1584
|
-
}, {});
|
1585
|
-
return recordIDs.map((id) => dictionary[id]);
|
2541
|
+
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
2542
|
+
return response.records?.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item, columns));
|
1586
2543
|
};
|
1587
2544
|
_updateRecordWithID = new WeakSet();
|
1588
|
-
updateRecordWithID_fn = async function(recordId, object) {
|
2545
|
+
updateRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVersion }) {
|
1589
2546
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1590
2547
|
const record = transformObjectLinks(object);
|
1591
|
-
|
1592
|
-
|
1593
|
-
|
1594
|
-
|
1595
|
-
|
1596
|
-
|
1597
|
-
|
1598
|
-
|
1599
|
-
|
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
|
+
}
|
1600
2569
|
};
|
1601
2570
|
_upsertRecordWithID = new WeakSet();
|
1602
|
-
upsertRecordWithID_fn = async function(recordId, object) {
|
2571
|
+
upsertRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVersion }) {
|
1603
2572
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1604
2573
|
const response = await upsertRecordWithID({
|
1605
|
-
pathParams: {
|
2574
|
+
pathParams: {
|
2575
|
+
workspace: "{workspaceId}",
|
2576
|
+
dbBranchName: "{dbBranch}",
|
2577
|
+
region: "{region}",
|
2578
|
+
tableName: __privateGet$4(this, _table),
|
2579
|
+
recordId
|
2580
|
+
},
|
2581
|
+
queryParams: { columns, ifVersion },
|
1606
2582
|
body: object,
|
1607
2583
|
...fetchProps
|
1608
2584
|
});
|
1609
|
-
const
|
1610
|
-
|
1611
|
-
throw new Error("The server failed to save the record");
|
1612
|
-
return item;
|
2585
|
+
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
2586
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
1613
2587
|
};
|
1614
2588
|
_deleteRecord = new WeakSet();
|
1615
|
-
deleteRecord_fn = async function(recordId) {
|
2589
|
+
deleteRecord_fn = async function(recordId, columns = ["*"]) {
|
1616
2590
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1617
|
-
|
1618
|
-
|
1619
|
-
|
1620
|
-
|
1621
|
-
}
|
1622
|
-
|
1623
|
-
|
1624
|
-
|
1625
|
-
|
1626
|
-
|
1627
|
-
|
1628
|
-
|
1629
|
-
|
1630
|
-
|
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;
|
1631
2610
|
}
|
1632
2611
|
};
|
1633
|
-
_setCacheRecord = new WeakSet();
|
1634
|
-
setCacheRecord_fn = async function(record) {
|
1635
|
-
if (!__privateGet$4(this, _cache).cacheRecords)
|
1636
|
-
return;
|
1637
|
-
await __privateGet$4(this, _cache).set(`rec_${__privateGet$4(this, _table)}:${record.id}`, record);
|
1638
|
-
};
|
1639
|
-
_getCacheRecord = new WeakSet();
|
1640
|
-
getCacheRecord_fn = async function(recordId) {
|
1641
|
-
if (!__privateGet$4(this, _cache).cacheRecords)
|
1642
|
-
return null;
|
1643
|
-
return __privateGet$4(this, _cache).get(`rec_${__privateGet$4(this, _table)}:${recordId}`);
|
1644
|
-
};
|
1645
2612
|
_setCacheQuery = new WeakSet();
|
1646
2613
|
setCacheQuery_fn = async function(query, meta, records) {
|
1647
2614
|
await __privateGet$4(this, _cache).set(`query_${__privateGet$4(this, _table)}:${query.key()}`, { date: new Date(), meta, records });
|
@@ -1664,7 +2631,7 @@ getSchemaTables_fn$1 = async function() {
|
|
1664
2631
|
return __privateGet$4(this, _schemaTables$2);
|
1665
2632
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1666
2633
|
const { schema } = await getBranchDetails({
|
1667
|
-
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}" },
|
2634
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
1668
2635
|
...fetchProps
|
1669
2636
|
});
|
1670
2637
|
__privateSet$4(this, _schemaTables$2, schema.tables);
|
@@ -1677,7 +2644,7 @@ const transformObjectLinks = (object) => {
|
|
1677
2644
|
return { ...acc, [key]: isIdentifiable(value) ? value.id : value };
|
1678
2645
|
}, {});
|
1679
2646
|
};
|
1680
|
-
const initObject = (db, schemaTables, table, object) => {
|
2647
|
+
const initObject = (db, schemaTables, table, object, selectedColumns) => {
|
1681
2648
|
const result = {};
|
1682
2649
|
const { xata, ...rest } = object ?? {};
|
1683
2650
|
Object.assign(result, rest);
|
@@ -1685,6 +2652,8 @@ const initObject = (db, schemaTables, table, object) => {
|
|
1685
2652
|
if (!columns)
|
1686
2653
|
console.error(`Table ${table} not found in schema`);
|
1687
2654
|
for (const column of columns ?? []) {
|
2655
|
+
if (!isValidColumn(selectedColumns, column))
|
2656
|
+
continue;
|
1688
2657
|
const value = result[column.name];
|
1689
2658
|
switch (column.type) {
|
1690
2659
|
case "datetime": {
|
@@ -1701,17 +2670,42 @@ const initObject = (db, schemaTables, table, object) => {
|
|
1701
2670
|
if (!linkTable) {
|
1702
2671
|
console.error(`Failed to parse link for field ${column.name}`);
|
1703
2672
|
} else if (isObject(value)) {
|
1704
|
-
|
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;
|
1705
2686
|
}
|
1706
2687
|
break;
|
1707
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;
|
1708
2695
|
}
|
1709
2696
|
}
|
1710
|
-
result.read = function() {
|
1711
|
-
return db[table].read(result["id"]);
|
2697
|
+
result.read = function(columns2) {
|
2698
|
+
return db[table].read(result["id"], columns2);
|
1712
2699
|
};
|
1713
|
-
result.update = function(data) {
|
1714
|
-
|
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 });
|
1715
2709
|
};
|
1716
2710
|
result.delete = function() {
|
1717
2711
|
return db[table].delete(result["id"]);
|
@@ -1719,20 +2713,38 @@ const initObject = (db, schemaTables, table, object) => {
|
|
1719
2713
|
result.getMetadata = function() {
|
1720
2714
|
return xata;
|
1721
2715
|
};
|
1722
|
-
for (const prop of ["read", "update", "delete", "getMetadata"]) {
|
2716
|
+
for (const prop of ["read", "update", "replace", "delete", "getMetadata"]) {
|
1723
2717
|
Object.defineProperty(result, prop, { enumerable: false });
|
1724
2718
|
}
|
1725
2719
|
Object.freeze(result);
|
1726
2720
|
return result;
|
1727
2721
|
};
|
1728
|
-
function
|
1729
|
-
|
1730
|
-
|
2722
|
+
function isResponseWithRecords(value) {
|
2723
|
+
return isObject(value) && Array.isArray(value.records);
|
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
|
+
}
|
1731
2746
|
}
|
1732
|
-
|
1733
|
-
return [];
|
1734
|
-
const nestedIds = Object.values(value).map((item) => getIds(item)).flat();
|
1735
|
-
return isString(value.id) ? [value.id, ...nestedIds] : nestedIds;
|
2747
|
+
return void 0;
|
1736
2748
|
}
|
1737
2749
|
|
1738
2750
|
var __accessCheck$3 = (obj, member, msg) => {
|
@@ -1759,7 +2771,6 @@ class SimpleCache {
|
|
1759
2771
|
__privateAdd$3(this, _map, void 0);
|
1760
2772
|
__privateSet$3(this, _map, /* @__PURE__ */ new Map());
|
1761
2773
|
this.capacity = options.max ?? 500;
|
1762
|
-
this.cacheRecords = options.cacheRecords ?? true;
|
1763
2774
|
this.defaultQueryTTL = options.defaultQueryTTL ?? 60 * 1e3;
|
1764
2775
|
}
|
1765
2776
|
async getAll() {
|
@@ -1785,18 +2796,25 @@ class SimpleCache {
|
|
1785
2796
|
}
|
1786
2797
|
_map = new WeakMap();
|
1787
2798
|
|
1788
|
-
const
|
1789
|
-
const
|
1790
|
-
const
|
1791
|
-
const
|
1792
|
-
const
|
1793
|
-
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;
|
1794
2811
|
const exists = (column) => ({ $exists: column });
|
1795
2812
|
const notExists = (column) => ({ $notExists: column });
|
1796
2813
|
const startsWith = (value) => ({ $startsWith: value });
|
1797
2814
|
const endsWith = (value) => ({ $endsWith: value });
|
1798
2815
|
const pattern = (value) => ({ $pattern: value });
|
1799
2816
|
const is = (value) => ({ $is: value });
|
2817
|
+
const equals = is;
|
1800
2818
|
const isNot = (value) => ({ $isNot: value });
|
1801
2819
|
const contains = (value) => ({ $contains: value });
|
1802
2820
|
const includes = (value) => ({ $includes: value });
|
@@ -1831,16 +2849,19 @@ class SchemaPlugin extends XataPlugin {
|
|
1831
2849
|
__privateSet$2(this, _schemaTables$1, schemaTables);
|
1832
2850
|
}
|
1833
2851
|
build(pluginOptions) {
|
1834
|
-
const db = new Proxy(
|
1835
|
-
|
1836
|
-
|
1837
|
-
|
1838
|
-
|
1839
|
-
|
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];
|
1840
2862
|
}
|
1841
|
-
return __privateGet$2(this, _tables)[table];
|
1842
2863
|
}
|
1843
|
-
|
2864
|
+
);
|
1844
2865
|
const tableNames = __privateGet$2(this, _schemaTables$1)?.map(({ name }) => name) ?? [];
|
1845
2866
|
for (const table of tableNames) {
|
1846
2867
|
db[table] = new RestRepository({ db, pluginOptions, table, schemaTables: __privateGet$2(this, _schemaTables$1) });
|
@@ -1890,7 +2911,7 @@ class SearchPlugin extends XataPlugin {
|
|
1890
2911
|
const schemaTables = await __privateMethod$1(this, _getSchemaTables, getSchemaTables_fn).call(this, getFetchProps);
|
1891
2912
|
return records.map((record) => {
|
1892
2913
|
const { table = "orphan" } = record.xata;
|
1893
|
-
return { table, record: initObject(this.db, schemaTables, table, record) };
|
2914
|
+
return { table, record: initObject(this.db, schemaTables, table, record, ["*"]) };
|
1894
2915
|
});
|
1895
2916
|
},
|
1896
2917
|
byTable: async (query, options = {}) => {
|
@@ -1899,7 +2920,7 @@ class SearchPlugin extends XataPlugin {
|
|
1899
2920
|
return records.reduce((acc, record) => {
|
1900
2921
|
const { table = "orphan" } = record.xata;
|
1901
2922
|
const items = acc[table] ?? [];
|
1902
|
-
const item = initObject(this.db, schemaTables, table, record);
|
2923
|
+
const item = initObject(this.db, schemaTables, table, record, ["*"]);
|
1903
2924
|
return { ...acc, [table]: [...items, item] };
|
1904
2925
|
}, {});
|
1905
2926
|
}
|
@@ -1910,10 +2931,10 @@ _schemaTables = new WeakMap();
|
|
1910
2931
|
_search = new WeakSet();
|
1911
2932
|
search_fn = async function(query, options, getFetchProps) {
|
1912
2933
|
const fetchProps = await getFetchProps();
|
1913
|
-
const { tables, fuzziness, highlight } = options ?? {};
|
2934
|
+
const { tables, fuzziness, highlight, prefix } = options ?? {};
|
1914
2935
|
const { records } = await searchBranch({
|
1915
|
-
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}" },
|
1916
|
-
body: { tables, query, fuzziness, highlight },
|
2936
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
2937
|
+
body: { tables, query, fuzziness, prefix, highlight },
|
1917
2938
|
...fetchProps
|
1918
2939
|
});
|
1919
2940
|
return records;
|
@@ -1924,7 +2945,7 @@ getSchemaTables_fn = async function(getFetchProps) {
|
|
1924
2945
|
return __privateGet$1(this, _schemaTables);
|
1925
2946
|
const fetchProps = await getFetchProps();
|
1926
2947
|
const { schema } = await getBranchDetails({
|
1927
|
-
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}" },
|
2948
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
1928
2949
|
...fetchProps
|
1929
2950
|
});
|
1930
2951
|
__privateSet$1(this, _schemaTables, schema.tables);
|
@@ -1954,19 +2975,27 @@ async function resolveXataBranch(gitBranch, options) {
|
|
1954
2975
|
const databaseURL = options?.databaseURL || getDatabaseURL();
|
1955
2976
|
const apiKey = options?.apiKey || getAPIKey();
|
1956
2977
|
if (!databaseURL)
|
1957
|
-
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
|
+
);
|
1958
2981
|
if (!apiKey)
|
1959
|
-
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
|
+
);
|
1960
2985
|
const [protocol, , host, , dbName] = databaseURL.split("/");
|
1961
|
-
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;
|
1962
2990
|
const { fallbackBranch } = getEnvironment();
|
1963
2991
|
const { branch } = await resolveBranch({
|
1964
2992
|
apiKey,
|
1965
2993
|
apiUrl: databaseURL,
|
1966
2994
|
fetchImpl: getFetchImplementation(options?.fetchImpl),
|
1967
2995
|
workspacesApiUrl: `${protocol}//${host}`,
|
1968
|
-
pathParams: { dbName, workspace },
|
1969
|
-
queryParams: { gitBranch, fallbackBranch }
|
2996
|
+
pathParams: { dbName, workspace, region },
|
2997
|
+
queryParams: { gitBranch, fallbackBranch },
|
2998
|
+
trace: defaultTrace
|
1970
2999
|
});
|
1971
3000
|
return branch;
|
1972
3001
|
}
|
@@ -1974,19 +3003,26 @@ async function getDatabaseBranch(branch, options) {
|
|
1974
3003
|
const databaseURL = options?.databaseURL || getDatabaseURL();
|
1975
3004
|
const apiKey = options?.apiKey || getAPIKey();
|
1976
3005
|
if (!databaseURL)
|
1977
|
-
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
|
+
);
|
1978
3009
|
if (!apiKey)
|
1979
|
-
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
|
+
);
|
1980
3013
|
const [protocol, , host, , database] = databaseURL.split("/");
|
1981
|
-
const
|
1982
|
-
|
3014
|
+
const urlParts = parseWorkspacesUrlParts(host);
|
3015
|
+
if (!urlParts)
|
3016
|
+
throw new Error(`Unable to parse workspace and region: ${databaseURL}`);
|
3017
|
+
const { workspace, region } = urlParts;
|
1983
3018
|
try {
|
1984
3019
|
return await getBranchDetails({
|
1985
3020
|
apiKey,
|
1986
3021
|
apiUrl: databaseURL,
|
1987
3022
|
fetchImpl: getFetchImplementation(options?.fetchImpl),
|
1988
3023
|
workspacesApiUrl: `${protocol}//${host}`,
|
1989
|
-
pathParams: { dbBranchName
|
3024
|
+
pathParams: { dbBranchName: `${database}:${branch}`, workspace, region },
|
3025
|
+
trace: defaultTrace
|
1990
3026
|
});
|
1991
3027
|
} catch (err) {
|
1992
3028
|
if (isObject(err) && err.status === 404)
|
@@ -2026,17 +3062,20 @@ var __privateMethod = (obj, member, method) => {
|
|
2026
3062
|
return method;
|
2027
3063
|
};
|
2028
3064
|
const buildClient = (plugins) => {
|
2029
|
-
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;
|
2030
3066
|
return _a = class {
|
2031
3067
|
constructor(options = {}, schemaTables) {
|
2032
3068
|
__privateAdd(this, _parseOptions);
|
2033
3069
|
__privateAdd(this, _getFetchProps);
|
2034
3070
|
__privateAdd(this, _evaluateBranch);
|
2035
3071
|
__privateAdd(this, _branch, void 0);
|
3072
|
+
__privateAdd(this, _options, void 0);
|
2036
3073
|
const safeOptions = __privateMethod(this, _parseOptions, parseOptions_fn).call(this, options);
|
3074
|
+
__privateSet(this, _options, safeOptions);
|
2037
3075
|
const pluginOptions = {
|
2038
3076
|
getFetchProps: () => __privateMethod(this, _getFetchProps, getFetchProps_fn).call(this, safeOptions),
|
2039
|
-
cache: safeOptions.cache
|
3077
|
+
cache: safeOptions.cache,
|
3078
|
+
trace: safeOptions.trace
|
2040
3079
|
};
|
2041
3080
|
const db = new SchemaPlugin(schemaTables).build(pluginOptions);
|
2042
3081
|
const search = new SearchPlugin(db, schemaTables).build(pluginOptions);
|
@@ -2055,22 +3094,26 @@ const buildClient = (plugins) => {
|
|
2055
3094
|
}
|
2056
3095
|
}
|
2057
3096
|
}
|
2058
|
-
|
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) {
|
2059
3103
|
const fetch = getFetchImplementation(options?.fetch);
|
2060
3104
|
const databaseURL = options?.databaseURL || getDatabaseURL();
|
2061
3105
|
const apiKey = options?.apiKey || getAPIKey();
|
2062
|
-
const cache = options?.cache ?? new SimpleCache({
|
3106
|
+
const cache = options?.cache ?? new SimpleCache({ defaultQueryTTL: 0 });
|
3107
|
+
const trace = options?.trace ?? defaultTrace;
|
2063
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 });
|
2064
|
-
if (!
|
2065
|
-
throw new Error("
|
3109
|
+
if (!apiKey) {
|
3110
|
+
throw new Error("Option apiKey is required");
|
2066
3111
|
}
|
2067
|
-
|
2068
|
-
|
2069
|
-
|
2070
|
-
apiKey,
|
2071
|
-
|
2072
|
-
branch
|
2073
|
-
}) {
|
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 }) {
|
2074
3117
|
const branchValue = await __privateMethod(this, _evaluateBranch, evaluateBranch_fn).call(this, branch);
|
2075
3118
|
if (!branchValue)
|
2076
3119
|
throw new Error("Unable to resolve branch value");
|
@@ -2080,9 +3123,11 @@ const buildClient = (plugins) => {
|
|
2080
3123
|
apiUrl: "",
|
2081
3124
|
workspacesApiUrl: (path, params) => {
|
2082
3125
|
const hasBranch = params.dbBranchName ?? params.branch;
|
2083
|
-
const newPath = path.replace(/^\/db\/[^/]+/, hasBranch ? `:${branchValue}` : "");
|
3126
|
+
const newPath = path.replace(/^\/db\/[^/]+/, hasBranch !== void 0 ? `:${branchValue}` : "");
|
2084
3127
|
return databaseURL + newPath;
|
2085
|
-
}
|
3128
|
+
},
|
3129
|
+
trace,
|
3130
|
+
clientID
|
2086
3131
|
};
|
2087
3132
|
}, _evaluateBranch = new WeakSet(), evaluateBranch_fn = async function(param) {
|
2088
3133
|
if (__privateGet(this, _branch))
|
@@ -2164,25 +3209,25 @@ class Serializer {
|
|
2164
3209
|
});
|
2165
3210
|
}
|
2166
3211
|
}
|
2167
|
-
const
|
2168
|
-
|
3212
|
+
const defaultSerializer = new Serializer();
|
3213
|
+
const serialize = (data) => {
|
3214
|
+
return defaultSerializer.toJSON(data);
|
2169
3215
|
};
|
2170
|
-
const deserialize = () => {
|
2171
|
-
|
3216
|
+
const deserialize = (json) => {
|
3217
|
+
return defaultSerializer.fromJSON(json);
|
2172
3218
|
};
|
2173
3219
|
|
2174
3220
|
function buildWorkerRunner(config) {
|
2175
3221
|
return function xataWorker(name, _worker) {
|
2176
3222
|
return async (...args) => {
|
2177
|
-
const
|
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, {
|
2178
3225
|
method: "POST",
|
2179
3226
|
headers: { "Content-Type": "application/json" },
|
2180
|
-
body:
|
2181
|
-
name,
|
2182
|
-
payload: args
|
2183
|
-
})
|
3227
|
+
body: serialize({ args })
|
2184
3228
|
});
|
2185
|
-
|
3229
|
+
const text = await result.text();
|
3230
|
+
return deserialize(text);
|
2186
3231
|
};
|
2187
3232
|
};
|
2188
3233
|
}
|
@@ -2216,16 +3261,28 @@ exports.XataPlugin = XataPlugin;
|
|
2216
3261
|
exports.acceptWorkspaceMemberInvite = acceptWorkspaceMemberInvite;
|
2217
3262
|
exports.addGitBranchesEntry = addGitBranchesEntry;
|
2218
3263
|
exports.addTableColumn = addTableColumn;
|
3264
|
+
exports.aggregateTable = aggregateTable;
|
3265
|
+
exports.applyBranchSchemaEdit = applyBranchSchemaEdit;
|
3266
|
+
exports.branchTransaction = branchTransaction;
|
2219
3267
|
exports.buildClient = buildClient;
|
2220
3268
|
exports.buildWorkerRunner = buildWorkerRunner;
|
2221
3269
|
exports.bulkInsertTableRecords = bulkInsertTableRecords;
|
2222
3270
|
exports.cancelWorkspaceMemberInvite = cancelWorkspaceMemberInvite;
|
3271
|
+
exports.compareBranchSchemas = compareBranchSchemas;
|
3272
|
+
exports.compareBranchWithUserSchema = compareBranchWithUserSchema;
|
3273
|
+
exports.compareMigrationRequest = compareMigrationRequest;
|
2223
3274
|
exports.contains = contains;
|
2224
3275
|
exports.createBranch = createBranch;
|
2225
3276
|
exports.createDatabase = createDatabase;
|
3277
|
+
exports.createMigrationRequest = createMigrationRequest;
|
2226
3278
|
exports.createTable = createTable;
|
2227
3279
|
exports.createUserAPIKey = createUserAPIKey;
|
2228
3280
|
exports.createWorkspace = createWorkspace;
|
3281
|
+
exports.dEPRECATEDcreateDatabase = dEPRECATEDcreateDatabase;
|
3282
|
+
exports.dEPRECATEDdeleteDatabase = dEPRECATEDdeleteDatabase;
|
3283
|
+
exports.dEPRECATEDgetDatabaseList = dEPRECATEDgetDatabaseList;
|
3284
|
+
exports.dEPRECATEDgetDatabaseMetadata = dEPRECATEDgetDatabaseMetadata;
|
3285
|
+
exports.dEPRECATEDupdateDatabaseMetadata = dEPRECATEDupdateDatabaseMetadata;
|
2229
3286
|
exports.deleteBranch = deleteBranch;
|
2230
3287
|
exports.deleteColumn = deleteColumn;
|
2231
3288
|
exports.deleteDatabase = deleteDatabase;
|
@@ -2236,6 +3293,7 @@ exports.deleteUserAPIKey = deleteUserAPIKey;
|
|
2236
3293
|
exports.deleteWorkspace = deleteWorkspace;
|
2237
3294
|
exports.deserialize = deserialize;
|
2238
3295
|
exports.endsWith = endsWith;
|
3296
|
+
exports.equals = equals;
|
2239
3297
|
exports.executeBranchMigrationPlan = executeBranchMigrationPlan;
|
2240
3298
|
exports.exists = exists;
|
2241
3299
|
exports.ge = ge;
|
@@ -2245,13 +3303,18 @@ exports.getBranchList = getBranchList;
|
|
2245
3303
|
exports.getBranchMetadata = getBranchMetadata;
|
2246
3304
|
exports.getBranchMigrationHistory = getBranchMigrationHistory;
|
2247
3305
|
exports.getBranchMigrationPlan = getBranchMigrationPlan;
|
3306
|
+
exports.getBranchSchemaHistory = getBranchSchemaHistory;
|
2248
3307
|
exports.getBranchStats = getBranchStats;
|
2249
3308
|
exports.getColumn = getColumn;
|
2250
3309
|
exports.getCurrentBranchDetails = getCurrentBranchDetails;
|
2251
3310
|
exports.getCurrentBranchName = getCurrentBranchName;
|
2252
3311
|
exports.getDatabaseList = getDatabaseList;
|
3312
|
+
exports.getDatabaseMetadata = getDatabaseMetadata;
|
2253
3313
|
exports.getDatabaseURL = getDatabaseURL;
|
2254
3314
|
exports.getGitBranchesMapping = getGitBranchesMapping;
|
3315
|
+
exports.getHostUrl = getHostUrl;
|
3316
|
+
exports.getMigrationRequest = getMigrationRequest;
|
3317
|
+
exports.getMigrationRequestIsMerged = getMigrationRequestIsMerged;
|
2255
3318
|
exports.getRecord = getRecord;
|
2256
3319
|
exports.getTableColumns = getTableColumns;
|
2257
3320
|
exports.getTableSchema = getTableSchema;
|
@@ -2260,6 +3323,9 @@ exports.getUserAPIKeys = getUserAPIKeys;
|
|
2260
3323
|
exports.getWorkspace = getWorkspace;
|
2261
3324
|
exports.getWorkspaceMembersList = getWorkspaceMembersList;
|
2262
3325
|
exports.getWorkspacesList = getWorkspacesList;
|
3326
|
+
exports.greaterEquals = greaterEquals;
|
3327
|
+
exports.greaterThan = greaterThan;
|
3328
|
+
exports.greaterThanEquals = greaterThanEquals;
|
2263
3329
|
exports.gt = gt;
|
2264
3330
|
exports.gte = gte;
|
2265
3331
|
exports.includes = includes;
|
@@ -2271,15 +3337,27 @@ exports.insertRecordWithID = insertRecordWithID;
|
|
2271
3337
|
exports.inviteWorkspaceMember = inviteWorkspaceMember;
|
2272
3338
|
exports.is = is;
|
2273
3339
|
exports.isCursorPaginationOptions = isCursorPaginationOptions;
|
3340
|
+
exports.isHostProviderAlias = isHostProviderAlias;
|
3341
|
+
exports.isHostProviderBuilder = isHostProviderBuilder;
|
2274
3342
|
exports.isIdentifiable = isIdentifiable;
|
2275
3343
|
exports.isNot = isNot;
|
2276
3344
|
exports.isXataRecord = isXataRecord;
|
2277
3345
|
exports.le = le;
|
3346
|
+
exports.lessEquals = lessEquals;
|
3347
|
+
exports.lessThan = lessThan;
|
3348
|
+
exports.lessThanEquals = lessThanEquals;
|
3349
|
+
exports.listMigrationRequestsCommits = listMigrationRequestsCommits;
|
3350
|
+
exports.listRegions = listRegions;
|
2278
3351
|
exports.lt = lt;
|
2279
3352
|
exports.lte = lte;
|
3353
|
+
exports.mergeMigrationRequest = mergeMigrationRequest;
|
2280
3354
|
exports.notExists = notExists;
|
2281
3355
|
exports.operationsByTag = operationsByTag;
|
3356
|
+
exports.parseProviderString = parseProviderString;
|
3357
|
+
exports.parseWorkspacesUrlParts = parseWorkspacesUrlParts;
|
2282
3358
|
exports.pattern = pattern;
|
3359
|
+
exports.previewBranchSchemaEdit = previewBranchSchemaEdit;
|
3360
|
+
exports.queryMigrationRequests = queryMigrationRequests;
|
2283
3361
|
exports.queryTable = queryTable;
|
2284
3362
|
exports.removeGitBranchesEntry = removeGitBranchesEntry;
|
2285
3363
|
exports.removeWorkspaceMember = removeWorkspaceMember;
|
@@ -2290,8 +3368,12 @@ exports.searchTable = searchTable;
|
|
2290
3368
|
exports.serialize = serialize;
|
2291
3369
|
exports.setTableSchema = setTableSchema;
|
2292
3370
|
exports.startsWith = startsWith;
|
3371
|
+
exports.summarizeTable = summarizeTable;
|
2293
3372
|
exports.updateBranchMetadata = updateBranchMetadata;
|
3373
|
+
exports.updateBranchSchema = updateBranchSchema;
|
2294
3374
|
exports.updateColumn = updateColumn;
|
3375
|
+
exports.updateDatabaseMetadata = updateDatabaseMetadata;
|
3376
|
+
exports.updateMigrationRequest = updateMigrationRequest;
|
2295
3377
|
exports.updateRecordWithID = updateRecordWithID;
|
2296
3378
|
exports.updateTable = updateTable;
|
2297
3379
|
exports.updateUser = updateUser;
|