@xata.io/client 0.0.0-alpha.vf54f8ba → 0.0.0-alpha.vf5a6674
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 +6 -0
- package/dist/index.cjs +346 -199
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +784 -483
- package/dist/index.mjs +346 -200
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
@@ -150,7 +150,7 @@ function getFetchImplementation(userFetch) {
|
|
150
150
|
return fetchImpl;
|
151
151
|
}
|
152
152
|
|
153
|
-
const VERSION = "0.0.0-alpha.
|
153
|
+
const VERSION = "0.0.0-alpha.vf5a6674";
|
154
154
|
|
155
155
|
class ErrorWithCause extends Error {
|
156
156
|
constructor(message, options) {
|
@@ -234,7 +234,9 @@ async function fetch$1({
|
|
234
234
|
apiUrl,
|
235
235
|
workspacesApiUrl,
|
236
236
|
trace,
|
237
|
-
signal
|
237
|
+
signal,
|
238
|
+
clientID,
|
239
|
+
sessionID
|
238
240
|
}) {
|
239
241
|
return trace(
|
240
242
|
`${method.toUpperCase()} ${path}`,
|
@@ -252,6 +254,8 @@ async function fetch$1({
|
|
252
254
|
headers: {
|
253
255
|
"Content-Type": "application/json",
|
254
256
|
"User-Agent": `Xata client-ts/${VERSION}`,
|
257
|
+
"X-Xata-Client-ID": clientID ?? "",
|
258
|
+
"X-Xata-Session-ID": sessionID ?? "",
|
255
259
|
...headers,
|
256
260
|
...hostHeader(fullUrl),
|
257
261
|
Authorization: `Bearer ${apiKey}`
|
@@ -318,15 +322,15 @@ const deleteUserAPIKey = (variables, signal) => fetch$1({
|
|
318
322
|
...variables,
|
319
323
|
signal
|
320
324
|
});
|
321
|
-
const
|
325
|
+
const getWorkspacesList = (variables, signal) => fetch$1({
|
322
326
|
url: "/workspaces",
|
323
|
-
method: "
|
327
|
+
method: "get",
|
324
328
|
...variables,
|
325
329
|
signal
|
326
330
|
});
|
327
|
-
const
|
331
|
+
const createWorkspace = (variables, signal) => fetch$1({
|
328
332
|
url: "/workspaces",
|
329
|
-
method: "
|
333
|
+
method: "post",
|
330
334
|
...variables,
|
331
335
|
signal
|
332
336
|
});
|
@@ -369,14 +373,14 @@ const cancelWorkspaceMemberInvite = (variables, signal) => fetch$1({
|
|
369
373
|
...variables,
|
370
374
|
signal
|
371
375
|
});
|
372
|
-
const
|
373
|
-
url: "/workspaces/{workspaceId}/invites/{
|
376
|
+
const acceptWorkspaceMemberInvite = (variables, signal) => fetch$1({
|
377
|
+
url: "/workspaces/{workspaceId}/invites/{inviteKey}/accept",
|
374
378
|
method: "post",
|
375
379
|
...variables,
|
376
380
|
signal
|
377
381
|
});
|
378
|
-
const
|
379
|
-
url: "/workspaces/{workspaceId}/invites/{
|
382
|
+
const resendWorkspaceMemberInvite = (variables, signal) => fetch$1({
|
383
|
+
url: "/workspaces/{workspaceId}/invites/{inviteId}/resend",
|
380
384
|
method: "post",
|
381
385
|
...variables,
|
382
386
|
signal
|
@@ -412,33 +416,6 @@ const getDatabaseMetadata = (variables, signal) => fetch$1({
|
|
412
416
|
signal
|
413
417
|
});
|
414
418
|
const updateDatabaseMetadata = (variables, signal) => fetch$1({ url: "/dbs/{dbName}/metadata", method: "patch", ...variables, signal });
|
415
|
-
const getGitBranchesMapping = (variables, signal) => fetch$1({ url: "/dbs/{dbName}/gitBranches", method: "get", ...variables, signal });
|
416
|
-
const addGitBranchesEntry = (variables, signal) => fetch$1({ url: "/dbs/{dbName}/gitBranches", method: "post", ...variables, signal });
|
417
|
-
const removeGitBranchesEntry = (variables, signal) => fetch$1({ url: "/dbs/{dbName}/gitBranches", method: "delete", ...variables, signal });
|
418
|
-
const resolveBranch = (variables, signal) => fetch$1({
|
419
|
-
url: "/dbs/{dbName}/resolveBranch",
|
420
|
-
method: "get",
|
421
|
-
...variables,
|
422
|
-
signal
|
423
|
-
});
|
424
|
-
const queryMigrationRequests = (variables, signal) => fetch$1({ url: "/dbs/{dbName}/migrations/query", method: "post", ...variables, signal });
|
425
|
-
const createMigrationRequest = (variables, signal) => fetch$1({ url: "/dbs/{dbName}/migrations", method: "post", ...variables, signal });
|
426
|
-
const getMigrationRequest = (variables, signal) => fetch$1({
|
427
|
-
url: "/dbs/{dbName}/migrations/{mrNumber}",
|
428
|
-
method: "get",
|
429
|
-
...variables,
|
430
|
-
signal
|
431
|
-
});
|
432
|
-
const updateMigrationRequest = (variables, signal) => fetch$1({ url: "/dbs/{dbName}/migrations/{mrNumber}", method: "patch", ...variables, signal });
|
433
|
-
const listMigrationRequestsCommits = (variables, signal) => fetch$1({ url: "/dbs/{dbName}/migrations/{mrNumber}/commits", method: "post", ...variables, signal });
|
434
|
-
const compareMigrationRequest = (variables, signal) => fetch$1({ url: "/dbs/{dbName}/migrations/{mrNumber}/compare", method: "post", ...variables, signal });
|
435
|
-
const getMigrationRequestIsMerged = (variables, signal) => fetch$1({ url: "/dbs/{dbName}/migrations/{mrNumber}/merge", method: "get", ...variables, signal });
|
436
|
-
const mergeMigrationRequest = (variables, signal) => fetch$1({
|
437
|
-
url: "/dbs/{dbName}/migrations/{mrNumber}/merge",
|
438
|
-
method: "post",
|
439
|
-
...variables,
|
440
|
-
signal
|
441
|
-
});
|
442
419
|
const getBranchDetails = (variables, signal) => fetch$1({
|
443
420
|
url: "/db/{dbBranchName}",
|
444
421
|
method: "get",
|
@@ -464,9 +441,43 @@ const getBranchMetadata = (variables, signal) => fetch$1({
|
|
464
441
|
...variables,
|
465
442
|
signal
|
466
443
|
});
|
444
|
+
const getBranchStats = (variables, signal) => fetch$1({
|
445
|
+
url: "/db/{dbBranchName}/stats",
|
446
|
+
method: "get",
|
447
|
+
...variables,
|
448
|
+
signal
|
449
|
+
});
|
450
|
+
const getGitBranchesMapping = (variables, signal) => fetch$1({ url: "/dbs/{dbName}/gitBranches", method: "get", ...variables, signal });
|
451
|
+
const addGitBranchesEntry = (variables, signal) => fetch$1({ url: "/dbs/{dbName}/gitBranches", method: "post", ...variables, signal });
|
452
|
+
const removeGitBranchesEntry = (variables, signal) => fetch$1({ url: "/dbs/{dbName}/gitBranches", method: "delete", ...variables, signal });
|
453
|
+
const resolveBranch = (variables, signal) => fetch$1({
|
454
|
+
url: "/dbs/{dbName}/resolveBranch",
|
455
|
+
method: "get",
|
456
|
+
...variables,
|
457
|
+
signal
|
458
|
+
});
|
467
459
|
const getBranchMigrationHistory = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/migrations", method: "get", ...variables, signal });
|
468
|
-
const executeBranchMigrationPlan = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/migrations/execute", method: "post", ...variables, signal });
|
469
460
|
const getBranchMigrationPlan = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/migrations/plan", method: "post", ...variables, signal });
|
461
|
+
const executeBranchMigrationPlan = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/migrations/execute", method: "post", ...variables, signal });
|
462
|
+
const queryMigrationRequests = (variables, signal) => fetch$1({ url: "/dbs/{dbName}/migrations/query", method: "post", ...variables, signal });
|
463
|
+
const createMigrationRequest = (variables, signal) => fetch$1({ url: "/dbs/{dbName}/migrations", method: "post", ...variables, signal });
|
464
|
+
const getMigrationRequest = (variables, signal) => fetch$1({
|
465
|
+
url: "/dbs/{dbName}/migrations/{mrNumber}",
|
466
|
+
method: "get",
|
467
|
+
...variables,
|
468
|
+
signal
|
469
|
+
});
|
470
|
+
const updateMigrationRequest = (variables, signal) => fetch$1({ url: "/dbs/{dbName}/migrations/{mrNumber}", method: "patch", ...variables, signal });
|
471
|
+
const listMigrationRequestsCommits = (variables, signal) => fetch$1({ url: "/dbs/{dbName}/migrations/{mrNumber}/commits", method: "post", ...variables, signal });
|
472
|
+
const compareMigrationRequest = (variables, signal) => fetch$1({ url: "/dbs/{dbName}/migrations/{mrNumber}/compare", method: "post", ...variables, signal });
|
473
|
+
const getMigrationRequestIsMerged = (variables, signal) => fetch$1({ url: "/dbs/{dbName}/migrations/{mrNumber}/merge", method: "get", ...variables, signal });
|
474
|
+
const mergeMigrationRequest = (variables, signal) => fetch$1({
|
475
|
+
url: "/dbs/{dbName}/migrations/{mrNumber}/merge",
|
476
|
+
method: "post",
|
477
|
+
...variables,
|
478
|
+
signal
|
479
|
+
});
|
480
|
+
const getBranchSchemaHistory = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/schema/history", method: "post", ...variables, signal });
|
470
481
|
const compareBranchWithUserSchema = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/schema/compare", method: "post", ...variables, signal });
|
471
482
|
const compareBranchSchemas = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/schema/compare/{branchName}", method: "post", ...variables, signal });
|
472
483
|
const updateBranchSchema = (variables, signal) => fetch$1({
|
@@ -477,13 +488,6 @@ const updateBranchSchema = (variables, signal) => fetch$1({
|
|
477
488
|
});
|
478
489
|
const previewBranchSchemaEdit = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/schema/preview", method: "post", ...variables, signal });
|
479
490
|
const applyBranchSchemaEdit = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/schema/apply", method: "post", ...variables, signal });
|
480
|
-
const getBranchSchemaHistory = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/schema/history", method: "post", ...variables, signal });
|
481
|
-
const getBranchStats = (variables, signal) => fetch$1({
|
482
|
-
url: "/db/{dbBranchName}/stats",
|
483
|
-
method: "get",
|
484
|
-
...variables,
|
485
|
-
signal
|
486
|
-
});
|
487
491
|
const createTable = (variables, signal) => fetch$1({
|
488
492
|
url: "/db/{dbBranchName}/tables/{tableName}",
|
489
493
|
method: "put",
|
@@ -532,19 +536,25 @@ const getColumn = (variables, signal) => fetch$1({
|
|
532
536
|
...variables,
|
533
537
|
signal
|
534
538
|
});
|
535
|
-
const
|
539
|
+
const updateColumn = (variables, signal) => fetch$1({
|
536
540
|
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
537
|
-
method: "
|
541
|
+
method: "patch",
|
538
542
|
...variables,
|
539
543
|
signal
|
540
544
|
});
|
541
|
-
const
|
545
|
+
const deleteColumn = (variables, signal) => fetch$1({
|
542
546
|
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
543
|
-
method: "
|
547
|
+
method: "delete",
|
544
548
|
...variables,
|
545
549
|
signal
|
546
550
|
});
|
547
551
|
const insertRecord = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/data", method: "post", ...variables, signal });
|
552
|
+
const getRecord = (variables, signal) => fetch$1({
|
553
|
+
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
554
|
+
method: "get",
|
555
|
+
...variables,
|
556
|
+
signal
|
557
|
+
});
|
548
558
|
const insertRecordWithID = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "put", ...variables, signal });
|
549
559
|
const updateRecordWithID = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "patch", ...variables, signal });
|
550
560
|
const upsertRecordWithID = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "post", ...variables, signal });
|
@@ -554,12 +564,6 @@ const deleteRecord = (variables, signal) => fetch$1({
|
|
554
564
|
...variables,
|
555
565
|
signal
|
556
566
|
});
|
557
|
-
const getRecord = (variables, signal) => fetch$1({
|
558
|
-
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
559
|
-
method: "get",
|
560
|
-
...variables,
|
561
|
-
signal
|
562
|
-
});
|
563
567
|
const bulkInsertTableRecords = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/bulk", method: "post", ...variables, signal });
|
564
568
|
const queryTable = (variables, signal) => fetch$1({
|
565
569
|
url: "/db/{dbBranchName}/tables/{tableName}/query",
|
@@ -567,14 +571,14 @@ const queryTable = (variables, signal) => fetch$1({
|
|
567
571
|
...variables,
|
568
572
|
signal
|
569
573
|
});
|
570
|
-
const
|
571
|
-
url: "/db/{dbBranchName}/
|
574
|
+
const searchBranch = (variables, signal) => fetch$1({
|
575
|
+
url: "/db/{dbBranchName}/search",
|
572
576
|
method: "post",
|
573
577
|
...variables,
|
574
578
|
signal
|
575
579
|
});
|
576
|
-
const
|
577
|
-
url: "/db/{dbBranchName}/search",
|
580
|
+
const searchTable = (variables, signal) => fetch$1({
|
581
|
+
url: "/db/{dbBranchName}/tables/{tableName}/search",
|
578
582
|
method: "post",
|
579
583
|
...variables,
|
580
584
|
signal
|
@@ -608,34 +612,33 @@ const cPGetCPDatabaseMetadata = (variables, signal) => fetch$1(
|
|
608
612
|
{ url: "/workspaces/{workspaceId}/dbs/{dbName}/metadata", method: "get", ...variables, signal }
|
609
613
|
);
|
610
614
|
const cPUpdateCPDatabaseMetadata = (variables, signal) => fetch$1({ url: "/workspaces/{workspaceId}/dbs/{dbName}/metadata", method: "patch", ...variables, signal });
|
615
|
+
const listRegions = (variables, signal) => fetch$1({
|
616
|
+
url: "/workspaces/{workspaceId}/regions",
|
617
|
+
method: "get",
|
618
|
+
...variables,
|
619
|
+
signal
|
620
|
+
});
|
611
621
|
const operationsByTag = {
|
612
|
-
users: { getUser, updateUser, deleteUser
|
622
|
+
users: { getUser, updateUser, deleteUser },
|
623
|
+
authentication: { getUserAPIKeys, createUserAPIKey, deleteUserAPIKey },
|
613
624
|
workspaces: {
|
614
|
-
createWorkspace,
|
615
625
|
getWorkspacesList,
|
626
|
+
createWorkspace,
|
616
627
|
getWorkspace,
|
617
628
|
updateWorkspace,
|
618
629
|
deleteWorkspace,
|
619
630
|
getWorkspaceMembersList,
|
620
631
|
updateWorkspaceMemberRole,
|
621
|
-
removeWorkspaceMember
|
632
|
+
removeWorkspaceMember
|
633
|
+
},
|
634
|
+
invites: {
|
622
635
|
inviteWorkspaceMember,
|
623
636
|
updateWorkspaceMemberInvite,
|
624
637
|
cancelWorkspaceMemberInvite,
|
625
|
-
|
626
|
-
|
627
|
-
},
|
628
|
-
database: {
|
629
|
-
getDatabaseList,
|
630
|
-
createDatabase,
|
631
|
-
deleteDatabase,
|
632
|
-
getDatabaseMetadata,
|
633
|
-
updateDatabaseMetadata,
|
634
|
-
getGitBranchesMapping,
|
635
|
-
addGitBranchesEntry,
|
636
|
-
removeGitBranchesEntry,
|
637
|
-
resolveBranch
|
638
|
+
acceptWorkspaceMemberInvite,
|
639
|
+
resendWorkspaceMemberInvite
|
638
640
|
},
|
641
|
+
database: { getDatabaseList, createDatabase, deleteDatabase, getDatabaseMetadata, updateDatabaseMetadata },
|
639
642
|
branch: {
|
640
643
|
getBranchList,
|
641
644
|
getBranchDetails,
|
@@ -643,7 +646,22 @@ const operationsByTag = {
|
|
643
646
|
deleteBranch,
|
644
647
|
updateBranchMetadata,
|
645
648
|
getBranchMetadata,
|
646
|
-
getBranchStats
|
649
|
+
getBranchStats,
|
650
|
+
getGitBranchesMapping,
|
651
|
+
addGitBranchesEntry,
|
652
|
+
removeGitBranchesEntry,
|
653
|
+
resolveBranch
|
654
|
+
},
|
655
|
+
migrations: {
|
656
|
+
getBranchMigrationHistory,
|
657
|
+
getBranchMigrationPlan,
|
658
|
+
executeBranchMigrationPlan,
|
659
|
+
getBranchSchemaHistory,
|
660
|
+
compareBranchWithUserSchema,
|
661
|
+
compareBranchSchemas,
|
662
|
+
updateBranchSchema,
|
663
|
+
previewBranchSchemaEdit,
|
664
|
+
applyBranchSchemaEdit
|
647
665
|
},
|
648
666
|
migrationRequests: {
|
649
667
|
queryMigrationRequests,
|
@@ -655,17 +673,6 @@ const operationsByTag = {
|
|
655
673
|
getMigrationRequestIsMerged,
|
656
674
|
mergeMigrationRequest
|
657
675
|
},
|
658
|
-
branchSchema: {
|
659
|
-
getBranchMigrationHistory,
|
660
|
-
executeBranchMigrationPlan,
|
661
|
-
getBranchMigrationPlan,
|
662
|
-
compareBranchWithUserSchema,
|
663
|
-
compareBranchSchemas,
|
664
|
-
updateBranchSchema,
|
665
|
-
previewBranchSchemaEdit,
|
666
|
-
applyBranchSchemaEdit,
|
667
|
-
getBranchSchemaHistory
|
668
|
-
},
|
669
676
|
table: {
|
670
677
|
createTable,
|
671
678
|
deleteTable,
|
@@ -675,29 +682,26 @@ const operationsByTag = {
|
|
675
682
|
getTableColumns,
|
676
683
|
addTableColumn,
|
677
684
|
getColumn,
|
678
|
-
|
679
|
-
|
685
|
+
updateColumn,
|
686
|
+
deleteColumn
|
680
687
|
},
|
681
688
|
records: {
|
682
689
|
insertRecord,
|
690
|
+
getRecord,
|
683
691
|
insertRecordWithID,
|
684
692
|
updateRecordWithID,
|
685
693
|
upsertRecordWithID,
|
686
694
|
deleteRecord,
|
687
|
-
|
688
|
-
bulkInsertTableRecords,
|
689
|
-
queryTable,
|
690
|
-
searchTable,
|
691
|
-
searchBranch,
|
692
|
-
summarizeTable,
|
693
|
-
aggregateTable
|
695
|
+
bulkInsertTableRecords
|
694
696
|
},
|
697
|
+
searchAndFilter: { queryTable, searchBranch, searchTable, summarizeTable, aggregateTable },
|
695
698
|
databases: {
|
696
699
|
cPGetDatabaseList,
|
697
700
|
cPCreateDatabase,
|
698
701
|
cPDeleteDatabase,
|
699
702
|
cPGetCPDatabaseMetadata,
|
700
|
-
cPUpdateCPDatabaseMetadata
|
703
|
+
cPUpdateCPDatabaseMetadata,
|
704
|
+
listRegions
|
701
705
|
}
|
702
706
|
};
|
703
707
|
|
@@ -777,21 +781,41 @@ class XataApiClient {
|
|
777
781
|
__privateGet$7(this, _namespaces).user = new UserApi(__privateGet$7(this, _extraProps));
|
778
782
|
return __privateGet$7(this, _namespaces).user;
|
779
783
|
}
|
784
|
+
get authentication() {
|
785
|
+
if (!__privateGet$7(this, _namespaces).authentication)
|
786
|
+
__privateGet$7(this, _namespaces).authentication = new AuthenticationApi(__privateGet$7(this, _extraProps));
|
787
|
+
return __privateGet$7(this, _namespaces).authentication;
|
788
|
+
}
|
780
789
|
get workspaces() {
|
781
790
|
if (!__privateGet$7(this, _namespaces).workspaces)
|
782
791
|
__privateGet$7(this, _namespaces).workspaces = new WorkspaceApi(__privateGet$7(this, _extraProps));
|
783
792
|
return __privateGet$7(this, _namespaces).workspaces;
|
784
793
|
}
|
785
|
-
get
|
786
|
-
if (!__privateGet$7(this, _namespaces).
|
787
|
-
__privateGet$7(this, _namespaces).
|
788
|
-
return __privateGet$7(this, _namespaces).
|
794
|
+
get invites() {
|
795
|
+
if (!__privateGet$7(this, _namespaces).invites)
|
796
|
+
__privateGet$7(this, _namespaces).invites = new InvitesApi(__privateGet$7(this, _extraProps));
|
797
|
+
return __privateGet$7(this, _namespaces).invites;
|
798
|
+
}
|
799
|
+
get database() {
|
800
|
+
if (!__privateGet$7(this, _namespaces).database)
|
801
|
+
__privateGet$7(this, _namespaces).database = new DatabaseApi(__privateGet$7(this, _extraProps));
|
802
|
+
return __privateGet$7(this, _namespaces).database;
|
789
803
|
}
|
790
804
|
get branches() {
|
791
805
|
if (!__privateGet$7(this, _namespaces).branches)
|
792
806
|
__privateGet$7(this, _namespaces).branches = new BranchApi(__privateGet$7(this, _extraProps));
|
793
807
|
return __privateGet$7(this, _namespaces).branches;
|
794
808
|
}
|
809
|
+
get migrations() {
|
810
|
+
if (!__privateGet$7(this, _namespaces).migrations)
|
811
|
+
__privateGet$7(this, _namespaces).migrations = new MigrationsApi(__privateGet$7(this, _extraProps));
|
812
|
+
return __privateGet$7(this, _namespaces).migrations;
|
813
|
+
}
|
814
|
+
get migrationRequests() {
|
815
|
+
if (!__privateGet$7(this, _namespaces).migrationRequests)
|
816
|
+
__privateGet$7(this, _namespaces).migrationRequests = new MigrationRequestsApi(__privateGet$7(this, _extraProps));
|
817
|
+
return __privateGet$7(this, _namespaces).migrationRequests;
|
818
|
+
}
|
795
819
|
get tables() {
|
796
820
|
if (!__privateGet$7(this, _namespaces).tables)
|
797
821
|
__privateGet$7(this, _namespaces).tables = new TableApi(__privateGet$7(this, _extraProps));
|
@@ -802,15 +826,15 @@ class XataApiClient {
|
|
802
826
|
__privateGet$7(this, _namespaces).records = new RecordsApi(__privateGet$7(this, _extraProps));
|
803
827
|
return __privateGet$7(this, _namespaces).records;
|
804
828
|
}
|
805
|
-
get
|
806
|
-
if (!__privateGet$7(this, _namespaces).
|
807
|
-
__privateGet$7(this, _namespaces).
|
808
|
-
return __privateGet$7(this, _namespaces).
|
829
|
+
get searchAndFilter() {
|
830
|
+
if (!__privateGet$7(this, _namespaces).searchAndFilter)
|
831
|
+
__privateGet$7(this, _namespaces).searchAndFilter = new SearchAndFilterApi(__privateGet$7(this, _extraProps));
|
832
|
+
return __privateGet$7(this, _namespaces).searchAndFilter;
|
809
833
|
}
|
810
|
-
get
|
811
|
-
if (!__privateGet$7(this, _namespaces).
|
812
|
-
__privateGet$7(this, _namespaces).
|
813
|
-
return __privateGet$7(this, _namespaces).
|
834
|
+
get databases() {
|
835
|
+
if (!__privateGet$7(this, _namespaces).databases)
|
836
|
+
__privateGet$7(this, _namespaces).databases = new DatabasesApi(__privateGet$7(this, _extraProps));
|
837
|
+
return __privateGet$7(this, _namespaces).databases;
|
814
838
|
}
|
815
839
|
}
|
816
840
|
_extraProps = new WeakMap();
|
@@ -828,17 +852,22 @@ class UserApi {
|
|
828
852
|
deleteUser() {
|
829
853
|
return operationsByTag.users.deleteUser({ ...this.extraProps });
|
830
854
|
}
|
855
|
+
}
|
856
|
+
class AuthenticationApi {
|
857
|
+
constructor(extraProps) {
|
858
|
+
this.extraProps = extraProps;
|
859
|
+
}
|
831
860
|
getUserAPIKeys() {
|
832
|
-
return operationsByTag.
|
861
|
+
return operationsByTag.authentication.getUserAPIKeys({ ...this.extraProps });
|
833
862
|
}
|
834
863
|
createUserAPIKey(keyName) {
|
835
|
-
return operationsByTag.
|
864
|
+
return operationsByTag.authentication.createUserAPIKey({
|
836
865
|
pathParams: { keyName },
|
837
866
|
...this.extraProps
|
838
867
|
});
|
839
868
|
}
|
840
869
|
deleteUserAPIKey(keyName) {
|
841
|
-
return operationsByTag.
|
870
|
+
return operationsByTag.authentication.deleteUserAPIKey({
|
842
871
|
pathParams: { keyName },
|
843
872
|
...this.extraProps
|
844
873
|
});
|
@@ -848,15 +877,15 @@ class WorkspaceApi {
|
|
848
877
|
constructor(extraProps) {
|
849
878
|
this.extraProps = extraProps;
|
850
879
|
}
|
880
|
+
getWorkspacesList() {
|
881
|
+
return operationsByTag.workspaces.getWorkspacesList({ ...this.extraProps });
|
882
|
+
}
|
851
883
|
createWorkspace(workspaceMeta) {
|
852
884
|
return operationsByTag.workspaces.createWorkspace({
|
853
885
|
body: workspaceMeta,
|
854
886
|
...this.extraProps
|
855
887
|
});
|
856
888
|
}
|
857
|
-
getWorkspacesList() {
|
858
|
-
return operationsByTag.workspaces.getWorkspacesList({ ...this.extraProps });
|
859
|
-
}
|
860
889
|
getWorkspace(workspaceId) {
|
861
890
|
return operationsByTag.workspaces.getWorkspace({
|
862
891
|
pathParams: { workspaceId },
|
@@ -895,35 +924,40 @@ class WorkspaceApi {
|
|
895
924
|
...this.extraProps
|
896
925
|
});
|
897
926
|
}
|
927
|
+
}
|
928
|
+
class InvitesApi {
|
929
|
+
constructor(extraProps) {
|
930
|
+
this.extraProps = extraProps;
|
931
|
+
}
|
898
932
|
inviteWorkspaceMember(workspaceId, email, role) {
|
899
|
-
return operationsByTag.
|
933
|
+
return operationsByTag.invites.inviteWorkspaceMember({
|
900
934
|
pathParams: { workspaceId },
|
901
935
|
body: { email, role },
|
902
936
|
...this.extraProps
|
903
937
|
});
|
904
938
|
}
|
905
939
|
updateWorkspaceMemberInvite(workspaceId, inviteId, role) {
|
906
|
-
return operationsByTag.
|
940
|
+
return operationsByTag.invites.updateWorkspaceMemberInvite({
|
907
941
|
pathParams: { workspaceId, inviteId },
|
908
942
|
body: { role },
|
909
943
|
...this.extraProps
|
910
944
|
});
|
911
945
|
}
|
912
946
|
cancelWorkspaceMemberInvite(workspaceId, inviteId) {
|
913
|
-
return operationsByTag.
|
947
|
+
return operationsByTag.invites.cancelWorkspaceMemberInvite({
|
914
948
|
pathParams: { workspaceId, inviteId },
|
915
949
|
...this.extraProps
|
916
950
|
});
|
917
951
|
}
|
918
|
-
|
919
|
-
return operationsByTag.
|
920
|
-
pathParams: { workspaceId,
|
952
|
+
acceptWorkspaceMemberInvite(workspaceId, inviteKey) {
|
953
|
+
return operationsByTag.invites.acceptWorkspaceMemberInvite({
|
954
|
+
pathParams: { workspaceId, inviteKey },
|
921
955
|
...this.extraProps
|
922
956
|
});
|
923
957
|
}
|
924
|
-
|
925
|
-
return operationsByTag.
|
926
|
-
pathParams: { workspaceId,
|
958
|
+
resendWorkspaceMemberInvite(workspaceId, inviteId) {
|
959
|
+
return operationsByTag.invites.resendWorkspaceMemberInvite({
|
960
|
+
pathParams: { workspaceId, inviteId },
|
927
961
|
...this.extraProps
|
928
962
|
});
|
929
963
|
}
|
@@ -964,33 +998,6 @@ class DatabaseApi {
|
|
964
998
|
...this.extraProps
|
965
999
|
});
|
966
1000
|
}
|
967
|
-
getGitBranchesMapping(workspace, dbName) {
|
968
|
-
return operationsByTag.database.getGitBranchesMapping({
|
969
|
-
pathParams: { workspace, dbName },
|
970
|
-
...this.extraProps
|
971
|
-
});
|
972
|
-
}
|
973
|
-
addGitBranchesEntry(workspace, dbName, body) {
|
974
|
-
return operationsByTag.database.addGitBranchesEntry({
|
975
|
-
pathParams: { workspace, dbName },
|
976
|
-
body,
|
977
|
-
...this.extraProps
|
978
|
-
});
|
979
|
-
}
|
980
|
-
removeGitBranchesEntry(workspace, dbName, gitBranch) {
|
981
|
-
return operationsByTag.database.removeGitBranchesEntry({
|
982
|
-
pathParams: { workspace, dbName },
|
983
|
-
queryParams: { gitBranch },
|
984
|
-
...this.extraProps
|
985
|
-
});
|
986
|
-
}
|
987
|
-
resolveBranch(workspace, dbName, gitBranch, fallbackBranch) {
|
988
|
-
return operationsByTag.database.resolveBranch({
|
989
|
-
pathParams: { workspace, dbName },
|
990
|
-
queryParams: { gitBranch, fallbackBranch },
|
991
|
-
...this.extraProps
|
992
|
-
});
|
993
|
-
}
|
994
1001
|
}
|
995
1002
|
class BranchApi {
|
996
1003
|
constructor(extraProps) {
|
@@ -1041,6 +1048,33 @@ class BranchApi {
|
|
1041
1048
|
...this.extraProps
|
1042
1049
|
});
|
1043
1050
|
}
|
1051
|
+
getGitBranchesMapping(workspace, dbName) {
|
1052
|
+
return operationsByTag.branch.getGitBranchesMapping({
|
1053
|
+
pathParams: { workspace, dbName },
|
1054
|
+
...this.extraProps
|
1055
|
+
});
|
1056
|
+
}
|
1057
|
+
addGitBranchesEntry(workspace, dbName, body) {
|
1058
|
+
return operationsByTag.branch.addGitBranchesEntry({
|
1059
|
+
pathParams: { workspace, dbName },
|
1060
|
+
body,
|
1061
|
+
...this.extraProps
|
1062
|
+
});
|
1063
|
+
}
|
1064
|
+
removeGitBranchesEntry(workspace, dbName, gitBranch) {
|
1065
|
+
return operationsByTag.branch.removeGitBranchesEntry({
|
1066
|
+
pathParams: { workspace, dbName },
|
1067
|
+
queryParams: { gitBranch },
|
1068
|
+
...this.extraProps
|
1069
|
+
});
|
1070
|
+
}
|
1071
|
+
resolveBranch(workspace, dbName, gitBranch, fallbackBranch) {
|
1072
|
+
return operationsByTag.branch.resolveBranch({
|
1073
|
+
pathParams: { workspace, dbName },
|
1074
|
+
queryParams: { gitBranch, fallbackBranch },
|
1075
|
+
...this.extraProps
|
1076
|
+
});
|
1077
|
+
}
|
1044
1078
|
}
|
1045
1079
|
class TableApi {
|
1046
1080
|
constructor(extraProps) {
|
@@ -1097,16 +1131,16 @@ class TableApi {
|
|
1097
1131
|
...this.extraProps
|
1098
1132
|
});
|
1099
1133
|
}
|
1100
|
-
|
1101
|
-
return operationsByTag.table.
|
1134
|
+
updateColumn(workspace, database, branch, tableName, columnName, options) {
|
1135
|
+
return operationsByTag.table.updateColumn({
|
1102
1136
|
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, columnName },
|
1137
|
+
body: options,
|
1103
1138
|
...this.extraProps
|
1104
1139
|
});
|
1105
1140
|
}
|
1106
|
-
|
1107
|
-
return operationsByTag.table.
|
1141
|
+
deleteColumn(workspace, database, branch, tableName, columnName) {
|
1142
|
+
return operationsByTag.table.deleteColumn({
|
1108
1143
|
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, columnName },
|
1109
|
-
body: options,
|
1110
1144
|
...this.extraProps
|
1111
1145
|
});
|
1112
1146
|
}
|
@@ -1123,6 +1157,13 @@ class RecordsApi {
|
|
1123
1157
|
...this.extraProps
|
1124
1158
|
});
|
1125
1159
|
}
|
1160
|
+
getRecord(workspace, database, branch, tableName, recordId, options = {}) {
|
1161
|
+
return operationsByTag.records.getRecord({
|
1162
|
+
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
|
1163
|
+
queryParams: options,
|
1164
|
+
...this.extraProps
|
1165
|
+
});
|
1166
|
+
}
|
1126
1167
|
insertRecordWithID(workspace, database, branch, tableName, recordId, record, options = {}) {
|
1127
1168
|
return operationsByTag.records.insertRecordWithID({
|
1128
1169
|
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
|
@@ -1154,13 +1195,6 @@ class RecordsApi {
|
|
1154
1195
|
...this.extraProps
|
1155
1196
|
});
|
1156
1197
|
}
|
1157
|
-
getRecord(workspace, database, branch, tableName, recordId, options = {}) {
|
1158
|
-
return operationsByTag.records.getRecord({
|
1159
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
|
1160
|
-
queryParams: options,
|
1161
|
-
...this.extraProps
|
1162
|
-
});
|
1163
|
-
}
|
1164
1198
|
bulkInsertTableRecords(workspace, database, branch, tableName, records, options = {}) {
|
1165
1199
|
return operationsByTag.records.bulkInsertTableRecords({
|
1166
1200
|
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
@@ -1169,29 +1203,41 @@ class RecordsApi {
|
|
1169
1203
|
...this.extraProps
|
1170
1204
|
});
|
1171
1205
|
}
|
1206
|
+
}
|
1207
|
+
class SearchAndFilterApi {
|
1208
|
+
constructor(extraProps) {
|
1209
|
+
this.extraProps = extraProps;
|
1210
|
+
}
|
1172
1211
|
queryTable(workspace, database, branch, tableName, query) {
|
1173
|
-
return operationsByTag.
|
1212
|
+
return operationsByTag.searchAndFilter.queryTable({
|
1174
1213
|
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
1175
1214
|
body: query,
|
1176
1215
|
...this.extraProps
|
1177
1216
|
});
|
1178
1217
|
}
|
1179
1218
|
searchTable(workspace, database, branch, tableName, query) {
|
1180
|
-
return operationsByTag.
|
1219
|
+
return operationsByTag.searchAndFilter.searchTable({
|
1181
1220
|
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
1182
1221
|
body: query,
|
1183
1222
|
...this.extraProps
|
1184
1223
|
});
|
1185
1224
|
}
|
1186
1225
|
searchBranch(workspace, database, branch, query) {
|
1187
|
-
return operationsByTag.
|
1226
|
+
return operationsByTag.searchAndFilter.searchBranch({
|
1188
1227
|
pathParams: { workspace, dbBranchName: `${database}:${branch}` },
|
1189
1228
|
body: query,
|
1190
1229
|
...this.extraProps
|
1191
1230
|
});
|
1192
1231
|
}
|
1193
1232
|
summarizeTable(workspace, database, branch, tableName, query) {
|
1194
|
-
return operationsByTag.
|
1233
|
+
return operationsByTag.searchAndFilter.summarizeTable({
|
1234
|
+
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
1235
|
+
body: query,
|
1236
|
+
...this.extraProps
|
1237
|
+
});
|
1238
|
+
}
|
1239
|
+
aggregateTable(workspace, database, branch, tableName, query) {
|
1240
|
+
return operationsByTag.searchAndFilter.aggregateTable({
|
1195
1241
|
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
1196
1242
|
body: query,
|
1197
1243
|
...this.extraProps
|
@@ -1255,73 +1301,116 @@ class MigrationRequestsApi {
|
|
1255
1301
|
});
|
1256
1302
|
}
|
1257
1303
|
}
|
1258
|
-
class
|
1304
|
+
class MigrationsApi {
|
1259
1305
|
constructor(extraProps) {
|
1260
1306
|
this.extraProps = extraProps;
|
1261
1307
|
}
|
1262
1308
|
getBranchMigrationHistory(workspace, database, branch, options = {}) {
|
1263
|
-
return operationsByTag.
|
1309
|
+
return operationsByTag.migrations.getBranchMigrationHistory({
|
1264
1310
|
pathParams: { workspace, dbBranchName: `${database}:${branch}` },
|
1265
1311
|
body: options,
|
1266
1312
|
...this.extraProps
|
1267
1313
|
});
|
1268
1314
|
}
|
1315
|
+
getBranchMigrationPlan(workspace, database, branch, schema) {
|
1316
|
+
return operationsByTag.migrations.getBranchMigrationPlan({
|
1317
|
+
pathParams: { workspace, dbBranchName: `${database}:${branch}` },
|
1318
|
+
body: schema,
|
1319
|
+
...this.extraProps
|
1320
|
+
});
|
1321
|
+
}
|
1269
1322
|
executeBranchMigrationPlan(workspace, database, branch, migrationPlan) {
|
1270
|
-
return operationsByTag.
|
1323
|
+
return operationsByTag.migrations.executeBranchMigrationPlan({
|
1271
1324
|
pathParams: { workspace, dbBranchName: `${database}:${branch}` },
|
1272
1325
|
body: migrationPlan,
|
1273
1326
|
...this.extraProps
|
1274
1327
|
});
|
1275
1328
|
}
|
1276
|
-
|
1277
|
-
return operationsByTag.
|
1329
|
+
getBranchSchemaHistory(workspace, database, branch, options = {}) {
|
1330
|
+
return operationsByTag.migrations.getBranchSchemaHistory({
|
1278
1331
|
pathParams: { workspace, dbBranchName: `${database}:${branch}` },
|
1279
|
-
body:
|
1332
|
+
body: options,
|
1280
1333
|
...this.extraProps
|
1281
1334
|
});
|
1282
1335
|
}
|
1283
1336
|
compareBranchWithUserSchema(workspace, database, branch, schema) {
|
1284
|
-
return operationsByTag.
|
1337
|
+
return operationsByTag.migrations.compareBranchWithUserSchema({
|
1285
1338
|
pathParams: { workspace, dbBranchName: `${database}:${branch}` },
|
1286
1339
|
body: { schema },
|
1287
1340
|
...this.extraProps
|
1288
1341
|
});
|
1289
1342
|
}
|
1290
1343
|
compareBranchSchemas(workspace, database, branch, branchName, schema) {
|
1291
|
-
return operationsByTag.
|
1344
|
+
return operationsByTag.migrations.compareBranchSchemas({
|
1292
1345
|
pathParams: { workspace, dbBranchName: `${database}:${branch}`, branchName },
|
1293
1346
|
body: { schema },
|
1294
1347
|
...this.extraProps
|
1295
1348
|
});
|
1296
1349
|
}
|
1297
1350
|
updateBranchSchema(workspace, database, branch, migration) {
|
1298
|
-
return operationsByTag.
|
1351
|
+
return operationsByTag.migrations.updateBranchSchema({
|
1299
1352
|
pathParams: { workspace, dbBranchName: `${database}:${branch}` },
|
1300
1353
|
body: migration,
|
1301
1354
|
...this.extraProps
|
1302
1355
|
});
|
1303
1356
|
}
|
1304
1357
|
previewBranchSchemaEdit(workspace, database, branch, migration) {
|
1305
|
-
return operationsByTag.
|
1358
|
+
return operationsByTag.migrations.previewBranchSchemaEdit({
|
1306
1359
|
pathParams: { workspace, dbBranchName: `${database}:${branch}` },
|
1307
1360
|
body: migration,
|
1308
1361
|
...this.extraProps
|
1309
1362
|
});
|
1310
1363
|
}
|
1311
1364
|
applyBranchSchemaEdit(workspace, database, branch, edits) {
|
1312
|
-
return operationsByTag.
|
1365
|
+
return operationsByTag.migrations.applyBranchSchemaEdit({
|
1313
1366
|
pathParams: { workspace, dbBranchName: `${database}:${branch}` },
|
1314
1367
|
body: { edits },
|
1315
1368
|
...this.extraProps
|
1316
1369
|
});
|
1317
1370
|
}
|
1318
|
-
|
1319
|
-
|
1320
|
-
|
1371
|
+
}
|
1372
|
+
class DatabasesApi {
|
1373
|
+
constructor(extraProps) {
|
1374
|
+
this.extraProps = extraProps;
|
1375
|
+
}
|
1376
|
+
getDatabaseList(workspaceId) {
|
1377
|
+
return operationsByTag.databases.cPGetDatabaseList({
|
1378
|
+
pathParams: { workspaceId },
|
1379
|
+
...this.extraProps
|
1380
|
+
});
|
1381
|
+
}
|
1382
|
+
createDatabase(workspaceId, dbName, options) {
|
1383
|
+
return operationsByTag.databases.cPCreateDatabase({
|
1384
|
+
pathParams: { workspaceId, dbName },
|
1321
1385
|
body: options,
|
1322
1386
|
...this.extraProps
|
1323
1387
|
});
|
1324
1388
|
}
|
1389
|
+
deleteDatabase(workspaceId, dbName) {
|
1390
|
+
return operationsByTag.databases.cPDeleteDatabase({
|
1391
|
+
pathParams: { workspaceId, dbName },
|
1392
|
+
...this.extraProps
|
1393
|
+
});
|
1394
|
+
}
|
1395
|
+
getDatabaseMetadata(workspaceId, dbName) {
|
1396
|
+
return operationsByTag.databases.cPGetCPDatabaseMetadata({
|
1397
|
+
pathParams: { workspaceId, dbName },
|
1398
|
+
...this.extraProps
|
1399
|
+
});
|
1400
|
+
}
|
1401
|
+
updateDatabaseMetadata(workspaceId, dbName, metadata) {
|
1402
|
+
return operationsByTag.databases.cPUpdateCPDatabaseMetadata({
|
1403
|
+
pathParams: { workspaceId, dbName },
|
1404
|
+
body: metadata,
|
1405
|
+
...this.extraProps
|
1406
|
+
});
|
1407
|
+
}
|
1408
|
+
listRegions(workspaceId) {
|
1409
|
+
return operationsByTag.databases.listRegions({
|
1410
|
+
pathParams: { workspaceId },
|
1411
|
+
...this.extraProps
|
1412
|
+
});
|
1413
|
+
}
|
1325
1414
|
}
|
1326
1415
|
|
1327
1416
|
class XataApiPlugin {
|
@@ -1334,6 +1423,20 @@ class XataApiPlugin {
|
|
1334
1423
|
class XataPlugin {
|
1335
1424
|
}
|
1336
1425
|
|
1426
|
+
function generateUUID() {
|
1427
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
|
1428
|
+
const r = Math.random() * 16 | 0, v = c == "x" ? r : r & 3 | 8;
|
1429
|
+
return v.toString(16);
|
1430
|
+
});
|
1431
|
+
}
|
1432
|
+
|
1433
|
+
function cleanFilter(filter) {
|
1434
|
+
if (!filter)
|
1435
|
+
return void 0;
|
1436
|
+
const values = Object.values(filter).filter(Boolean).filter((value) => Array.isArray(value) ? value.length > 0 : true);
|
1437
|
+
return values.length > 0 ? filter : void 0;
|
1438
|
+
}
|
1439
|
+
|
1337
1440
|
var __accessCheck$6 = (obj, member, msg) => {
|
1338
1441
|
if (!member.has(obj))
|
1339
1442
|
throw TypeError("Cannot " + msg);
|
@@ -1473,7 +1576,7 @@ const _Query = class {
|
|
1473
1576
|
__privateGet$5(this, _data).filter.$not = data.filter?.$not ?? parent?.filter?.$not;
|
1474
1577
|
__privateGet$5(this, _data).filter.$none = data.filter?.$none ?? parent?.filter?.$none;
|
1475
1578
|
__privateGet$5(this, _data).sort = data.sort ?? parent?.sort;
|
1476
|
-
__privateGet$5(this, _data).columns = data.columns ?? parent?.columns
|
1579
|
+
__privateGet$5(this, _data).columns = data.columns ?? parent?.columns;
|
1477
1580
|
__privateGet$5(this, _data).pagination = data.pagination ?? parent?.pagination;
|
1478
1581
|
__privateGet$5(this, _data).cache = data.cache ?? parent?.cache;
|
1479
1582
|
this.any = this.any.bind(this);
|
@@ -1589,6 +1692,16 @@ const _Query = class {
|
|
1589
1692
|
throw new Error("No results found.");
|
1590
1693
|
return records[0];
|
1591
1694
|
}
|
1695
|
+
async summarize(params = {}) {
|
1696
|
+
const { summaries, summariesFilter, ...options } = params;
|
1697
|
+
const query = new _Query(
|
1698
|
+
__privateGet$5(this, _repository),
|
1699
|
+
__privateGet$5(this, _table$1),
|
1700
|
+
options,
|
1701
|
+
__privateGet$5(this, _data)
|
1702
|
+
);
|
1703
|
+
return __privateGet$5(this, _repository).summarizeTable(query, summaries, summariesFilter);
|
1704
|
+
}
|
1592
1705
|
cache(ttl) {
|
1593
1706
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { cache: ttl }, __privateGet$5(this, _data));
|
1594
1707
|
}
|
@@ -1710,10 +1823,13 @@ class RestRepository extends Query {
|
|
1710
1823
|
__privateAdd$4(this, _schemaTables$2, void 0);
|
1711
1824
|
__privateAdd$4(this, _trace, void 0);
|
1712
1825
|
__privateSet$4(this, _table, options.table);
|
1713
|
-
__privateSet$4(this, _getFetchProps, options.pluginOptions.getFetchProps);
|
1714
1826
|
__privateSet$4(this, _db, options.db);
|
1715
1827
|
__privateSet$4(this, _cache, options.pluginOptions.cache);
|
1716
1828
|
__privateSet$4(this, _schemaTables$2, options.schemaTables);
|
1829
|
+
__privateSet$4(this, _getFetchProps, async () => {
|
1830
|
+
const props = await options.pluginOptions.getFetchProps();
|
1831
|
+
return { ...props, sessionID: generateUUID() };
|
1832
|
+
});
|
1717
1833
|
const trace = options.pluginOptions.trace ?? defaultTrace;
|
1718
1834
|
__privateSet$4(this, _trace, async (name, fn, options2 = {}) => {
|
1719
1835
|
return trace(name, fn, {
|
@@ -1929,22 +2045,32 @@ class RestRepository extends Query {
|
|
1929
2045
|
return records.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item, ["*"]));
|
1930
2046
|
});
|
1931
2047
|
}
|
2048
|
+
async aggregate(aggs, filter) {
|
2049
|
+
return __privateGet$4(this, _trace).call(this, "aggregate", async () => {
|
2050
|
+
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2051
|
+
const result = await aggregateTable({
|
2052
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", tableName: __privateGet$4(this, _table) },
|
2053
|
+
body: { aggs, filter },
|
2054
|
+
...fetchProps
|
2055
|
+
});
|
2056
|
+
return result;
|
2057
|
+
});
|
2058
|
+
}
|
1932
2059
|
async query(query) {
|
1933
2060
|
return __privateGet$4(this, _trace).call(this, "query", async () => {
|
1934
2061
|
const cacheQuery = await __privateMethod$2(this, _getCacheQuery, getCacheQuery_fn).call(this, query);
|
1935
2062
|
if (cacheQuery)
|
1936
2063
|
return new Page(query, cacheQuery.meta, cacheQuery.records);
|
1937
2064
|
const data = query.getQueryOptions();
|
1938
|
-
const body = {
|
1939
|
-
filter: cleanFilter(data.filter),
|
1940
|
-
sort: data.sort !== void 0 ? buildSortFilter(data.sort) : void 0,
|
1941
|
-
page: data.pagination,
|
1942
|
-
columns: data.columns
|
1943
|
-
};
|
1944
2065
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1945
2066
|
const { meta, records: objects } = await queryTable({
|
1946
2067
|
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", tableName: __privateGet$4(this, _table) },
|
1947
|
-
body
|
2068
|
+
body: {
|
2069
|
+
filter: cleanFilter(data.filter),
|
2070
|
+
sort: data.sort !== void 0 ? buildSortFilter(data.sort) : void 0,
|
2071
|
+
page: data.pagination,
|
2072
|
+
columns: data.columns ?? ["*"]
|
2073
|
+
},
|
1948
2074
|
...fetchProps
|
1949
2075
|
});
|
1950
2076
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
@@ -1955,6 +2081,24 @@ class RestRepository extends Query {
|
|
1955
2081
|
return new Page(query, meta, records);
|
1956
2082
|
});
|
1957
2083
|
}
|
2084
|
+
async summarizeTable(query, summaries, summariesFilter) {
|
2085
|
+
return __privateGet$4(this, _trace).call(this, "summarize", async () => {
|
2086
|
+
const data = query.getQueryOptions();
|
2087
|
+
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2088
|
+
const result = await summarizeTable({
|
2089
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", tableName: __privateGet$4(this, _table) },
|
2090
|
+
body: {
|
2091
|
+
filter: cleanFilter(data.filter),
|
2092
|
+
sort: data.sort !== void 0 ? buildSortFilter(data.sort) : void 0,
|
2093
|
+
columns: data.columns,
|
2094
|
+
summaries,
|
2095
|
+
summariesFilter
|
2096
|
+
},
|
2097
|
+
...fetchProps
|
2098
|
+
});
|
2099
|
+
return result;
|
2100
|
+
});
|
2101
|
+
}
|
1958
2102
|
}
|
1959
2103
|
_table = new WeakMap();
|
1960
2104
|
_getFetchProps = new WeakMap();
|
@@ -2176,12 +2320,6 @@ function extractId(value) {
|
|
2176
2320
|
return value.id;
|
2177
2321
|
return void 0;
|
2178
2322
|
}
|
2179
|
-
function cleanFilter(filter) {
|
2180
|
-
if (!filter)
|
2181
|
-
return void 0;
|
2182
|
-
const values = Object.values(filter).filter(Boolean).filter((value) => Array.isArray(value) ? value.length > 0 : true);
|
2183
|
-
return values.length > 0 ? filter : void 0;
|
2184
|
-
}
|
2185
2323
|
function isValidColumn(columns, column) {
|
2186
2324
|
if (columns.includes("*"))
|
2187
2325
|
return true;
|
@@ -2552,8 +2690,15 @@ const buildClient = (plugins) => {
|
|
2552
2690
|
if (!databaseURL) {
|
2553
2691
|
throw new Error("Option databaseURL is required");
|
2554
2692
|
}
|
2555
|
-
return { fetch, databaseURL, apiKey, branch, cache, trace };
|
2556
|
-
}, _getFetchProps = new WeakSet(), getFetchProps_fn = async function({
|
2693
|
+
return { fetch, databaseURL, apiKey, branch, cache, trace, clientID: generateUUID() };
|
2694
|
+
}, _getFetchProps = new WeakSet(), getFetchProps_fn = async function({
|
2695
|
+
fetch,
|
2696
|
+
apiKey,
|
2697
|
+
databaseURL,
|
2698
|
+
branch,
|
2699
|
+
trace,
|
2700
|
+
clientID
|
2701
|
+
}) {
|
2557
2702
|
const branchValue = await __privateMethod(this, _evaluateBranch, evaluateBranch_fn).call(this, branch);
|
2558
2703
|
if (!branchValue)
|
2559
2704
|
throw new Error("Unable to resolve branch value");
|
@@ -2566,7 +2711,8 @@ const buildClient = (plugins) => {
|
|
2566
2711
|
const newPath = path.replace(/^\/db\/[^/]+/, hasBranch !== void 0 ? `:${branchValue}` : "");
|
2567
2712
|
return databaseURL + newPath;
|
2568
2713
|
},
|
2569
|
-
trace
|
2714
|
+
trace,
|
2715
|
+
clientID
|
2570
2716
|
};
|
2571
2717
|
}, _evaluateBranch = new WeakSet(), evaluateBranch_fn = async function(param) {
|
2572
2718
|
if (__privateGet(this, _branch))
|
@@ -2678,5 +2824,5 @@ class XataError extends Error {
|
|
2678
2824
|
}
|
2679
2825
|
}
|
2680
2826
|
|
2681
|
-
export { BaseClient, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, Query, RecordArray, Repository, RestRepository, SchemaPlugin, SearchPlugin, Serializer, SimpleCache, XataApiClient, XataApiPlugin, XataError, XataPlugin, acceptWorkspaceMemberInvite, addGitBranchesEntry, addTableColumn, aggregateTable, applyBranchSchemaEdit, buildClient, buildWorkerRunner, bulkInsertTableRecords, cPCreateDatabase, cPDeleteDatabase, cPGetCPDatabaseMetadata, cPGetDatabaseList, cPUpdateCPDatabaseMetadata, cancelWorkspaceMemberInvite, compareBranchSchemas, compareBranchWithUserSchema, compareMigrationRequest, contains, createBranch, createDatabase, createMigrationRequest, createTable, createUserAPIKey, createWorkspace, deleteBranch, deleteColumn, deleteDatabase, deleteRecord, deleteTable, deleteUser, deleteUserAPIKey, deleteWorkspace, deserialize, endsWith, equals, executeBranchMigrationPlan, exists, ge, getAPIKey, getBranchDetails, getBranchList, getBranchMetadata, getBranchMigrationHistory, getBranchMigrationPlan, getBranchSchemaHistory, getBranchStats, getColumn, getCurrentBranchDetails, getCurrentBranchName, getDatabaseList, getDatabaseMetadata, getDatabaseURL, getGitBranchesMapping, getHostUrl, getMigrationRequest, getMigrationRequestIsMerged, getRecord, getTableColumns, getTableSchema, getUser, getUserAPIKeys, getWorkspace, getWorkspaceMembersList, getWorkspacesList, greaterEquals, greaterThan, greaterThanEquals, gt, gte, includes, includesAll, includesAny, includesNone, insertRecord, insertRecordWithID, inviteWorkspaceMember, is, isCursorPaginationOptions, isHostProviderAlias, isHostProviderBuilder, isIdentifiable, isNot, isXataRecord, le, lessEquals, lessThan, lessThanEquals, listMigrationRequestsCommits, lt, lte, mergeMigrationRequest, notExists, operationsByTag, parseProviderString, pattern, previewBranchSchemaEdit, queryMigrationRequests, queryTable, removeGitBranchesEntry, removeWorkspaceMember, resendWorkspaceMemberInvite, resolveBranch, searchBranch, searchTable, serialize, setTableSchema, startsWith, summarizeTable, updateBranchMetadata, updateBranchSchema, updateColumn, updateDatabaseMetadata, updateMigrationRequest, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberInvite, updateWorkspaceMemberRole, upsertRecordWithID };
|
2827
|
+
export { BaseClient, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, Query, RecordArray, Repository, RestRepository, SchemaPlugin, SearchPlugin, Serializer, SimpleCache, XataApiClient, XataApiPlugin, XataError, XataPlugin, acceptWorkspaceMemberInvite, addGitBranchesEntry, addTableColumn, aggregateTable, applyBranchSchemaEdit, buildClient, buildWorkerRunner, bulkInsertTableRecords, cPCreateDatabase, cPDeleteDatabase, cPGetCPDatabaseMetadata, cPGetDatabaseList, cPUpdateCPDatabaseMetadata, cancelWorkspaceMemberInvite, compareBranchSchemas, compareBranchWithUserSchema, compareMigrationRequest, contains, createBranch, createDatabase, createMigrationRequest, createTable, createUserAPIKey, createWorkspace, deleteBranch, deleteColumn, deleteDatabase, deleteRecord, deleteTable, deleteUser, deleteUserAPIKey, deleteWorkspace, deserialize, endsWith, equals, executeBranchMigrationPlan, exists, ge, getAPIKey, getBranchDetails, getBranchList, getBranchMetadata, getBranchMigrationHistory, getBranchMigrationPlan, getBranchSchemaHistory, getBranchStats, getColumn, getCurrentBranchDetails, getCurrentBranchName, getDatabaseList, getDatabaseMetadata, getDatabaseURL, getGitBranchesMapping, getHostUrl, getMigrationRequest, getMigrationRequestIsMerged, getRecord, getTableColumns, getTableSchema, getUser, getUserAPIKeys, getWorkspace, getWorkspaceMembersList, getWorkspacesList, greaterEquals, greaterThan, greaterThanEquals, gt, gte, includes, includesAll, includesAny, includesNone, insertRecord, insertRecordWithID, inviteWorkspaceMember, is, isCursorPaginationOptions, isHostProviderAlias, isHostProviderBuilder, isIdentifiable, isNot, isXataRecord, le, lessEquals, lessThan, lessThanEquals, listMigrationRequestsCommits, listRegions, lt, lte, mergeMigrationRequest, notExists, operationsByTag, parseProviderString, pattern, previewBranchSchemaEdit, queryMigrationRequests, queryTable, removeGitBranchesEntry, removeWorkspaceMember, resendWorkspaceMemberInvite, resolveBranch, searchBranch, searchTable, serialize, setTableSchema, startsWith, summarizeTable, updateBranchMetadata, updateBranchSchema, updateColumn, updateDatabaseMetadata, updateMigrationRequest, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberInvite, updateWorkspaceMemberRole, upsertRecordWithID };
|
2682
2828
|
//# sourceMappingURL=index.mjs.map
|