@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.cjs
CHANGED
@@ -172,7 +172,7 @@ function getFetchImplementation(userFetch) {
|
|
172
172
|
return fetchImpl;
|
173
173
|
}
|
174
174
|
|
175
|
-
const VERSION = "0.0.0-alpha.
|
175
|
+
const VERSION = "0.0.0-alpha.vf5a6674";
|
176
176
|
|
177
177
|
class ErrorWithCause extends Error {
|
178
178
|
constructor(message, options) {
|
@@ -256,7 +256,9 @@ async function fetch$1({
|
|
256
256
|
apiUrl,
|
257
257
|
workspacesApiUrl,
|
258
258
|
trace,
|
259
|
-
signal
|
259
|
+
signal,
|
260
|
+
clientID,
|
261
|
+
sessionID
|
260
262
|
}) {
|
261
263
|
return trace(
|
262
264
|
`${method.toUpperCase()} ${path}`,
|
@@ -274,6 +276,8 @@ async function fetch$1({
|
|
274
276
|
headers: {
|
275
277
|
"Content-Type": "application/json",
|
276
278
|
"User-Agent": `Xata client-ts/${VERSION}`,
|
279
|
+
"X-Xata-Client-ID": clientID ?? "",
|
280
|
+
"X-Xata-Session-ID": sessionID ?? "",
|
277
281
|
...headers,
|
278
282
|
...hostHeader(fullUrl),
|
279
283
|
Authorization: `Bearer ${apiKey}`
|
@@ -340,15 +344,15 @@ const deleteUserAPIKey = (variables, signal) => fetch$1({
|
|
340
344
|
...variables,
|
341
345
|
signal
|
342
346
|
});
|
343
|
-
const
|
347
|
+
const getWorkspacesList = (variables, signal) => fetch$1({
|
344
348
|
url: "/workspaces",
|
345
|
-
method: "
|
349
|
+
method: "get",
|
346
350
|
...variables,
|
347
351
|
signal
|
348
352
|
});
|
349
|
-
const
|
353
|
+
const createWorkspace = (variables, signal) => fetch$1({
|
350
354
|
url: "/workspaces",
|
351
|
-
method: "
|
355
|
+
method: "post",
|
352
356
|
...variables,
|
353
357
|
signal
|
354
358
|
});
|
@@ -391,14 +395,14 @@ const cancelWorkspaceMemberInvite = (variables, signal) => fetch$1({
|
|
391
395
|
...variables,
|
392
396
|
signal
|
393
397
|
});
|
394
|
-
const
|
395
|
-
url: "/workspaces/{workspaceId}/invites/{
|
398
|
+
const acceptWorkspaceMemberInvite = (variables, signal) => fetch$1({
|
399
|
+
url: "/workspaces/{workspaceId}/invites/{inviteKey}/accept",
|
396
400
|
method: "post",
|
397
401
|
...variables,
|
398
402
|
signal
|
399
403
|
});
|
400
|
-
const
|
401
|
-
url: "/workspaces/{workspaceId}/invites/{
|
404
|
+
const resendWorkspaceMemberInvite = (variables, signal) => fetch$1({
|
405
|
+
url: "/workspaces/{workspaceId}/invites/{inviteId}/resend",
|
402
406
|
method: "post",
|
403
407
|
...variables,
|
404
408
|
signal
|
@@ -434,33 +438,6 @@ const getDatabaseMetadata = (variables, signal) => fetch$1({
|
|
434
438
|
signal
|
435
439
|
});
|
436
440
|
const updateDatabaseMetadata = (variables, signal) => fetch$1({ url: "/dbs/{dbName}/metadata", method: "patch", ...variables, signal });
|
437
|
-
const getGitBranchesMapping = (variables, signal) => fetch$1({ url: "/dbs/{dbName}/gitBranches", method: "get", ...variables, signal });
|
438
|
-
const addGitBranchesEntry = (variables, signal) => fetch$1({ url: "/dbs/{dbName}/gitBranches", method: "post", ...variables, signal });
|
439
|
-
const removeGitBranchesEntry = (variables, signal) => fetch$1({ url: "/dbs/{dbName}/gitBranches", method: "delete", ...variables, signal });
|
440
|
-
const resolveBranch = (variables, signal) => fetch$1({
|
441
|
-
url: "/dbs/{dbName}/resolveBranch",
|
442
|
-
method: "get",
|
443
|
-
...variables,
|
444
|
-
signal
|
445
|
-
});
|
446
|
-
const queryMigrationRequests = (variables, signal) => fetch$1({ url: "/dbs/{dbName}/migrations/query", method: "post", ...variables, signal });
|
447
|
-
const createMigrationRequest = (variables, signal) => fetch$1({ url: "/dbs/{dbName}/migrations", method: "post", ...variables, signal });
|
448
|
-
const getMigrationRequest = (variables, signal) => fetch$1({
|
449
|
-
url: "/dbs/{dbName}/migrations/{mrNumber}",
|
450
|
-
method: "get",
|
451
|
-
...variables,
|
452
|
-
signal
|
453
|
-
});
|
454
|
-
const updateMigrationRequest = (variables, signal) => fetch$1({ url: "/dbs/{dbName}/migrations/{mrNumber}", method: "patch", ...variables, signal });
|
455
|
-
const listMigrationRequestsCommits = (variables, signal) => fetch$1({ url: "/dbs/{dbName}/migrations/{mrNumber}/commits", method: "post", ...variables, signal });
|
456
|
-
const compareMigrationRequest = (variables, signal) => fetch$1({ url: "/dbs/{dbName}/migrations/{mrNumber}/compare", method: "post", ...variables, signal });
|
457
|
-
const getMigrationRequestIsMerged = (variables, signal) => fetch$1({ url: "/dbs/{dbName}/migrations/{mrNumber}/merge", method: "get", ...variables, signal });
|
458
|
-
const mergeMigrationRequest = (variables, signal) => fetch$1({
|
459
|
-
url: "/dbs/{dbName}/migrations/{mrNumber}/merge",
|
460
|
-
method: "post",
|
461
|
-
...variables,
|
462
|
-
signal
|
463
|
-
});
|
464
441
|
const getBranchDetails = (variables, signal) => fetch$1({
|
465
442
|
url: "/db/{dbBranchName}",
|
466
443
|
method: "get",
|
@@ -486,9 +463,43 @@ const getBranchMetadata = (variables, signal) => fetch$1({
|
|
486
463
|
...variables,
|
487
464
|
signal
|
488
465
|
});
|
466
|
+
const getBranchStats = (variables, signal) => fetch$1({
|
467
|
+
url: "/db/{dbBranchName}/stats",
|
468
|
+
method: "get",
|
469
|
+
...variables,
|
470
|
+
signal
|
471
|
+
});
|
472
|
+
const getGitBranchesMapping = (variables, signal) => fetch$1({ url: "/dbs/{dbName}/gitBranches", method: "get", ...variables, signal });
|
473
|
+
const addGitBranchesEntry = (variables, signal) => fetch$1({ url: "/dbs/{dbName}/gitBranches", method: "post", ...variables, signal });
|
474
|
+
const removeGitBranchesEntry = (variables, signal) => fetch$1({ url: "/dbs/{dbName}/gitBranches", method: "delete", ...variables, signal });
|
475
|
+
const resolveBranch = (variables, signal) => fetch$1({
|
476
|
+
url: "/dbs/{dbName}/resolveBranch",
|
477
|
+
method: "get",
|
478
|
+
...variables,
|
479
|
+
signal
|
480
|
+
});
|
489
481
|
const getBranchMigrationHistory = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/migrations", method: "get", ...variables, signal });
|
490
|
-
const executeBranchMigrationPlan = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/migrations/execute", method: "post", ...variables, signal });
|
491
482
|
const getBranchMigrationPlan = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/migrations/plan", method: "post", ...variables, signal });
|
483
|
+
const executeBranchMigrationPlan = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/migrations/execute", method: "post", ...variables, signal });
|
484
|
+
const queryMigrationRequests = (variables, signal) => fetch$1({ url: "/dbs/{dbName}/migrations/query", method: "post", ...variables, signal });
|
485
|
+
const createMigrationRequest = (variables, signal) => fetch$1({ url: "/dbs/{dbName}/migrations", method: "post", ...variables, signal });
|
486
|
+
const getMigrationRequest = (variables, signal) => fetch$1({
|
487
|
+
url: "/dbs/{dbName}/migrations/{mrNumber}",
|
488
|
+
method: "get",
|
489
|
+
...variables,
|
490
|
+
signal
|
491
|
+
});
|
492
|
+
const updateMigrationRequest = (variables, signal) => fetch$1({ url: "/dbs/{dbName}/migrations/{mrNumber}", method: "patch", ...variables, signal });
|
493
|
+
const listMigrationRequestsCommits = (variables, signal) => fetch$1({ url: "/dbs/{dbName}/migrations/{mrNumber}/commits", method: "post", ...variables, signal });
|
494
|
+
const compareMigrationRequest = (variables, signal) => fetch$1({ url: "/dbs/{dbName}/migrations/{mrNumber}/compare", method: "post", ...variables, signal });
|
495
|
+
const getMigrationRequestIsMerged = (variables, signal) => fetch$1({ url: "/dbs/{dbName}/migrations/{mrNumber}/merge", method: "get", ...variables, signal });
|
496
|
+
const mergeMigrationRequest = (variables, signal) => fetch$1({
|
497
|
+
url: "/dbs/{dbName}/migrations/{mrNumber}/merge",
|
498
|
+
method: "post",
|
499
|
+
...variables,
|
500
|
+
signal
|
501
|
+
});
|
502
|
+
const getBranchSchemaHistory = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/schema/history", method: "post", ...variables, signal });
|
492
503
|
const compareBranchWithUserSchema = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/schema/compare", method: "post", ...variables, signal });
|
493
504
|
const compareBranchSchemas = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/schema/compare/{branchName}", method: "post", ...variables, signal });
|
494
505
|
const updateBranchSchema = (variables, signal) => fetch$1({
|
@@ -499,13 +510,6 @@ const updateBranchSchema = (variables, signal) => fetch$1({
|
|
499
510
|
});
|
500
511
|
const previewBranchSchemaEdit = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/schema/preview", method: "post", ...variables, signal });
|
501
512
|
const applyBranchSchemaEdit = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/schema/apply", method: "post", ...variables, signal });
|
502
|
-
const getBranchSchemaHistory = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/schema/history", method: "post", ...variables, signal });
|
503
|
-
const getBranchStats = (variables, signal) => fetch$1({
|
504
|
-
url: "/db/{dbBranchName}/stats",
|
505
|
-
method: "get",
|
506
|
-
...variables,
|
507
|
-
signal
|
508
|
-
});
|
509
513
|
const createTable = (variables, signal) => fetch$1({
|
510
514
|
url: "/db/{dbBranchName}/tables/{tableName}",
|
511
515
|
method: "put",
|
@@ -554,19 +558,25 @@ const getColumn = (variables, signal) => fetch$1({
|
|
554
558
|
...variables,
|
555
559
|
signal
|
556
560
|
});
|
557
|
-
const
|
561
|
+
const updateColumn = (variables, signal) => fetch$1({
|
558
562
|
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
559
|
-
method: "
|
563
|
+
method: "patch",
|
560
564
|
...variables,
|
561
565
|
signal
|
562
566
|
});
|
563
|
-
const
|
567
|
+
const deleteColumn = (variables, signal) => fetch$1({
|
564
568
|
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
565
|
-
method: "
|
569
|
+
method: "delete",
|
566
570
|
...variables,
|
567
571
|
signal
|
568
572
|
});
|
569
573
|
const insertRecord = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/data", method: "post", ...variables, signal });
|
574
|
+
const getRecord = (variables, signal) => fetch$1({
|
575
|
+
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
576
|
+
method: "get",
|
577
|
+
...variables,
|
578
|
+
signal
|
579
|
+
});
|
570
580
|
const insertRecordWithID = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "put", ...variables, signal });
|
571
581
|
const updateRecordWithID = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "patch", ...variables, signal });
|
572
582
|
const upsertRecordWithID = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "post", ...variables, signal });
|
@@ -576,12 +586,6 @@ const deleteRecord = (variables, signal) => fetch$1({
|
|
576
586
|
...variables,
|
577
587
|
signal
|
578
588
|
});
|
579
|
-
const getRecord = (variables, signal) => fetch$1({
|
580
|
-
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
581
|
-
method: "get",
|
582
|
-
...variables,
|
583
|
-
signal
|
584
|
-
});
|
585
589
|
const bulkInsertTableRecords = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/bulk", method: "post", ...variables, signal });
|
586
590
|
const queryTable = (variables, signal) => fetch$1({
|
587
591
|
url: "/db/{dbBranchName}/tables/{tableName}/query",
|
@@ -589,14 +593,14 @@ const queryTable = (variables, signal) => fetch$1({
|
|
589
593
|
...variables,
|
590
594
|
signal
|
591
595
|
});
|
592
|
-
const
|
593
|
-
url: "/db/{dbBranchName}/
|
596
|
+
const searchBranch = (variables, signal) => fetch$1({
|
597
|
+
url: "/db/{dbBranchName}/search",
|
594
598
|
method: "post",
|
595
599
|
...variables,
|
596
600
|
signal
|
597
601
|
});
|
598
|
-
const
|
599
|
-
url: "/db/{dbBranchName}/search",
|
602
|
+
const searchTable = (variables, signal) => fetch$1({
|
603
|
+
url: "/db/{dbBranchName}/tables/{tableName}/search",
|
600
604
|
method: "post",
|
601
605
|
...variables,
|
602
606
|
signal
|
@@ -630,34 +634,33 @@ const cPGetCPDatabaseMetadata = (variables, signal) => fetch$1(
|
|
630
634
|
{ url: "/workspaces/{workspaceId}/dbs/{dbName}/metadata", method: "get", ...variables, signal }
|
631
635
|
);
|
632
636
|
const cPUpdateCPDatabaseMetadata = (variables, signal) => fetch$1({ url: "/workspaces/{workspaceId}/dbs/{dbName}/metadata", method: "patch", ...variables, signal });
|
637
|
+
const listRegions = (variables, signal) => fetch$1({
|
638
|
+
url: "/workspaces/{workspaceId}/regions",
|
639
|
+
method: "get",
|
640
|
+
...variables,
|
641
|
+
signal
|
642
|
+
});
|
633
643
|
const operationsByTag = {
|
634
|
-
users: { getUser, updateUser, deleteUser
|
644
|
+
users: { getUser, updateUser, deleteUser },
|
645
|
+
authentication: { getUserAPIKeys, createUserAPIKey, deleteUserAPIKey },
|
635
646
|
workspaces: {
|
636
|
-
createWorkspace,
|
637
647
|
getWorkspacesList,
|
648
|
+
createWorkspace,
|
638
649
|
getWorkspace,
|
639
650
|
updateWorkspace,
|
640
651
|
deleteWorkspace,
|
641
652
|
getWorkspaceMembersList,
|
642
653
|
updateWorkspaceMemberRole,
|
643
|
-
removeWorkspaceMember
|
654
|
+
removeWorkspaceMember
|
655
|
+
},
|
656
|
+
invites: {
|
644
657
|
inviteWorkspaceMember,
|
645
658
|
updateWorkspaceMemberInvite,
|
646
659
|
cancelWorkspaceMemberInvite,
|
647
|
-
|
648
|
-
|
649
|
-
},
|
650
|
-
database: {
|
651
|
-
getDatabaseList,
|
652
|
-
createDatabase,
|
653
|
-
deleteDatabase,
|
654
|
-
getDatabaseMetadata,
|
655
|
-
updateDatabaseMetadata,
|
656
|
-
getGitBranchesMapping,
|
657
|
-
addGitBranchesEntry,
|
658
|
-
removeGitBranchesEntry,
|
659
|
-
resolveBranch
|
660
|
+
acceptWorkspaceMemberInvite,
|
661
|
+
resendWorkspaceMemberInvite
|
660
662
|
},
|
663
|
+
database: { getDatabaseList, createDatabase, deleteDatabase, getDatabaseMetadata, updateDatabaseMetadata },
|
661
664
|
branch: {
|
662
665
|
getBranchList,
|
663
666
|
getBranchDetails,
|
@@ -665,7 +668,22 @@ const operationsByTag = {
|
|
665
668
|
deleteBranch,
|
666
669
|
updateBranchMetadata,
|
667
670
|
getBranchMetadata,
|
668
|
-
getBranchStats
|
671
|
+
getBranchStats,
|
672
|
+
getGitBranchesMapping,
|
673
|
+
addGitBranchesEntry,
|
674
|
+
removeGitBranchesEntry,
|
675
|
+
resolveBranch
|
676
|
+
},
|
677
|
+
migrations: {
|
678
|
+
getBranchMigrationHistory,
|
679
|
+
getBranchMigrationPlan,
|
680
|
+
executeBranchMigrationPlan,
|
681
|
+
getBranchSchemaHistory,
|
682
|
+
compareBranchWithUserSchema,
|
683
|
+
compareBranchSchemas,
|
684
|
+
updateBranchSchema,
|
685
|
+
previewBranchSchemaEdit,
|
686
|
+
applyBranchSchemaEdit
|
669
687
|
},
|
670
688
|
migrationRequests: {
|
671
689
|
queryMigrationRequests,
|
@@ -677,17 +695,6 @@ const operationsByTag = {
|
|
677
695
|
getMigrationRequestIsMerged,
|
678
696
|
mergeMigrationRequest
|
679
697
|
},
|
680
|
-
branchSchema: {
|
681
|
-
getBranchMigrationHistory,
|
682
|
-
executeBranchMigrationPlan,
|
683
|
-
getBranchMigrationPlan,
|
684
|
-
compareBranchWithUserSchema,
|
685
|
-
compareBranchSchemas,
|
686
|
-
updateBranchSchema,
|
687
|
-
previewBranchSchemaEdit,
|
688
|
-
applyBranchSchemaEdit,
|
689
|
-
getBranchSchemaHistory
|
690
|
-
},
|
691
698
|
table: {
|
692
699
|
createTable,
|
693
700
|
deleteTable,
|
@@ -697,29 +704,26 @@ const operationsByTag = {
|
|
697
704
|
getTableColumns,
|
698
705
|
addTableColumn,
|
699
706
|
getColumn,
|
700
|
-
|
701
|
-
|
707
|
+
updateColumn,
|
708
|
+
deleteColumn
|
702
709
|
},
|
703
710
|
records: {
|
704
711
|
insertRecord,
|
712
|
+
getRecord,
|
705
713
|
insertRecordWithID,
|
706
714
|
updateRecordWithID,
|
707
715
|
upsertRecordWithID,
|
708
716
|
deleteRecord,
|
709
|
-
|
710
|
-
bulkInsertTableRecords,
|
711
|
-
queryTable,
|
712
|
-
searchTable,
|
713
|
-
searchBranch,
|
714
|
-
summarizeTable,
|
715
|
-
aggregateTable
|
717
|
+
bulkInsertTableRecords
|
716
718
|
},
|
719
|
+
searchAndFilter: { queryTable, searchBranch, searchTable, summarizeTable, aggregateTable },
|
717
720
|
databases: {
|
718
721
|
cPGetDatabaseList,
|
719
722
|
cPCreateDatabase,
|
720
723
|
cPDeleteDatabase,
|
721
724
|
cPGetCPDatabaseMetadata,
|
722
|
-
cPUpdateCPDatabaseMetadata
|
725
|
+
cPUpdateCPDatabaseMetadata,
|
726
|
+
listRegions
|
723
727
|
}
|
724
728
|
};
|
725
729
|
|
@@ -799,21 +803,41 @@ class XataApiClient {
|
|
799
803
|
__privateGet$7(this, _namespaces).user = new UserApi(__privateGet$7(this, _extraProps));
|
800
804
|
return __privateGet$7(this, _namespaces).user;
|
801
805
|
}
|
806
|
+
get authentication() {
|
807
|
+
if (!__privateGet$7(this, _namespaces).authentication)
|
808
|
+
__privateGet$7(this, _namespaces).authentication = new AuthenticationApi(__privateGet$7(this, _extraProps));
|
809
|
+
return __privateGet$7(this, _namespaces).authentication;
|
810
|
+
}
|
802
811
|
get workspaces() {
|
803
812
|
if (!__privateGet$7(this, _namespaces).workspaces)
|
804
813
|
__privateGet$7(this, _namespaces).workspaces = new WorkspaceApi(__privateGet$7(this, _extraProps));
|
805
814
|
return __privateGet$7(this, _namespaces).workspaces;
|
806
815
|
}
|
807
|
-
get
|
808
|
-
if (!__privateGet$7(this, _namespaces).
|
809
|
-
__privateGet$7(this, _namespaces).
|
810
|
-
return __privateGet$7(this, _namespaces).
|
816
|
+
get invites() {
|
817
|
+
if (!__privateGet$7(this, _namespaces).invites)
|
818
|
+
__privateGet$7(this, _namespaces).invites = new InvitesApi(__privateGet$7(this, _extraProps));
|
819
|
+
return __privateGet$7(this, _namespaces).invites;
|
820
|
+
}
|
821
|
+
get database() {
|
822
|
+
if (!__privateGet$7(this, _namespaces).database)
|
823
|
+
__privateGet$7(this, _namespaces).database = new DatabaseApi(__privateGet$7(this, _extraProps));
|
824
|
+
return __privateGet$7(this, _namespaces).database;
|
811
825
|
}
|
812
826
|
get branches() {
|
813
827
|
if (!__privateGet$7(this, _namespaces).branches)
|
814
828
|
__privateGet$7(this, _namespaces).branches = new BranchApi(__privateGet$7(this, _extraProps));
|
815
829
|
return __privateGet$7(this, _namespaces).branches;
|
816
830
|
}
|
831
|
+
get migrations() {
|
832
|
+
if (!__privateGet$7(this, _namespaces).migrations)
|
833
|
+
__privateGet$7(this, _namespaces).migrations = new MigrationsApi(__privateGet$7(this, _extraProps));
|
834
|
+
return __privateGet$7(this, _namespaces).migrations;
|
835
|
+
}
|
836
|
+
get migrationRequests() {
|
837
|
+
if (!__privateGet$7(this, _namespaces).migrationRequests)
|
838
|
+
__privateGet$7(this, _namespaces).migrationRequests = new MigrationRequestsApi(__privateGet$7(this, _extraProps));
|
839
|
+
return __privateGet$7(this, _namespaces).migrationRequests;
|
840
|
+
}
|
817
841
|
get tables() {
|
818
842
|
if (!__privateGet$7(this, _namespaces).tables)
|
819
843
|
__privateGet$7(this, _namespaces).tables = new TableApi(__privateGet$7(this, _extraProps));
|
@@ -824,15 +848,15 @@ class XataApiClient {
|
|
824
848
|
__privateGet$7(this, _namespaces).records = new RecordsApi(__privateGet$7(this, _extraProps));
|
825
849
|
return __privateGet$7(this, _namespaces).records;
|
826
850
|
}
|
827
|
-
get
|
828
|
-
if (!__privateGet$7(this, _namespaces).
|
829
|
-
__privateGet$7(this, _namespaces).
|
830
|
-
return __privateGet$7(this, _namespaces).
|
851
|
+
get searchAndFilter() {
|
852
|
+
if (!__privateGet$7(this, _namespaces).searchAndFilter)
|
853
|
+
__privateGet$7(this, _namespaces).searchAndFilter = new SearchAndFilterApi(__privateGet$7(this, _extraProps));
|
854
|
+
return __privateGet$7(this, _namespaces).searchAndFilter;
|
831
855
|
}
|
832
|
-
get
|
833
|
-
if (!__privateGet$7(this, _namespaces).
|
834
|
-
__privateGet$7(this, _namespaces).
|
835
|
-
return __privateGet$7(this, _namespaces).
|
856
|
+
get databases() {
|
857
|
+
if (!__privateGet$7(this, _namespaces).databases)
|
858
|
+
__privateGet$7(this, _namespaces).databases = new DatabasesApi(__privateGet$7(this, _extraProps));
|
859
|
+
return __privateGet$7(this, _namespaces).databases;
|
836
860
|
}
|
837
861
|
}
|
838
862
|
_extraProps = new WeakMap();
|
@@ -850,17 +874,22 @@ class UserApi {
|
|
850
874
|
deleteUser() {
|
851
875
|
return operationsByTag.users.deleteUser({ ...this.extraProps });
|
852
876
|
}
|
877
|
+
}
|
878
|
+
class AuthenticationApi {
|
879
|
+
constructor(extraProps) {
|
880
|
+
this.extraProps = extraProps;
|
881
|
+
}
|
853
882
|
getUserAPIKeys() {
|
854
|
-
return operationsByTag.
|
883
|
+
return operationsByTag.authentication.getUserAPIKeys({ ...this.extraProps });
|
855
884
|
}
|
856
885
|
createUserAPIKey(keyName) {
|
857
|
-
return operationsByTag.
|
886
|
+
return operationsByTag.authentication.createUserAPIKey({
|
858
887
|
pathParams: { keyName },
|
859
888
|
...this.extraProps
|
860
889
|
});
|
861
890
|
}
|
862
891
|
deleteUserAPIKey(keyName) {
|
863
|
-
return operationsByTag.
|
892
|
+
return operationsByTag.authentication.deleteUserAPIKey({
|
864
893
|
pathParams: { keyName },
|
865
894
|
...this.extraProps
|
866
895
|
});
|
@@ -870,15 +899,15 @@ class WorkspaceApi {
|
|
870
899
|
constructor(extraProps) {
|
871
900
|
this.extraProps = extraProps;
|
872
901
|
}
|
902
|
+
getWorkspacesList() {
|
903
|
+
return operationsByTag.workspaces.getWorkspacesList({ ...this.extraProps });
|
904
|
+
}
|
873
905
|
createWorkspace(workspaceMeta) {
|
874
906
|
return operationsByTag.workspaces.createWorkspace({
|
875
907
|
body: workspaceMeta,
|
876
908
|
...this.extraProps
|
877
909
|
});
|
878
910
|
}
|
879
|
-
getWorkspacesList() {
|
880
|
-
return operationsByTag.workspaces.getWorkspacesList({ ...this.extraProps });
|
881
|
-
}
|
882
911
|
getWorkspace(workspaceId) {
|
883
912
|
return operationsByTag.workspaces.getWorkspace({
|
884
913
|
pathParams: { workspaceId },
|
@@ -917,35 +946,40 @@ class WorkspaceApi {
|
|
917
946
|
...this.extraProps
|
918
947
|
});
|
919
948
|
}
|
949
|
+
}
|
950
|
+
class InvitesApi {
|
951
|
+
constructor(extraProps) {
|
952
|
+
this.extraProps = extraProps;
|
953
|
+
}
|
920
954
|
inviteWorkspaceMember(workspaceId, email, role) {
|
921
|
-
return operationsByTag.
|
955
|
+
return operationsByTag.invites.inviteWorkspaceMember({
|
922
956
|
pathParams: { workspaceId },
|
923
957
|
body: { email, role },
|
924
958
|
...this.extraProps
|
925
959
|
});
|
926
960
|
}
|
927
961
|
updateWorkspaceMemberInvite(workspaceId, inviteId, role) {
|
928
|
-
return operationsByTag.
|
962
|
+
return operationsByTag.invites.updateWorkspaceMemberInvite({
|
929
963
|
pathParams: { workspaceId, inviteId },
|
930
964
|
body: { role },
|
931
965
|
...this.extraProps
|
932
966
|
});
|
933
967
|
}
|
934
968
|
cancelWorkspaceMemberInvite(workspaceId, inviteId) {
|
935
|
-
return operationsByTag.
|
969
|
+
return operationsByTag.invites.cancelWorkspaceMemberInvite({
|
936
970
|
pathParams: { workspaceId, inviteId },
|
937
971
|
...this.extraProps
|
938
972
|
});
|
939
973
|
}
|
940
|
-
|
941
|
-
return operationsByTag.
|
942
|
-
pathParams: { workspaceId,
|
974
|
+
acceptWorkspaceMemberInvite(workspaceId, inviteKey) {
|
975
|
+
return operationsByTag.invites.acceptWorkspaceMemberInvite({
|
976
|
+
pathParams: { workspaceId, inviteKey },
|
943
977
|
...this.extraProps
|
944
978
|
});
|
945
979
|
}
|
946
|
-
|
947
|
-
return operationsByTag.
|
948
|
-
pathParams: { workspaceId,
|
980
|
+
resendWorkspaceMemberInvite(workspaceId, inviteId) {
|
981
|
+
return operationsByTag.invites.resendWorkspaceMemberInvite({
|
982
|
+
pathParams: { workspaceId, inviteId },
|
949
983
|
...this.extraProps
|
950
984
|
});
|
951
985
|
}
|
@@ -986,33 +1020,6 @@ class DatabaseApi {
|
|
986
1020
|
...this.extraProps
|
987
1021
|
});
|
988
1022
|
}
|
989
|
-
getGitBranchesMapping(workspace, dbName) {
|
990
|
-
return operationsByTag.database.getGitBranchesMapping({
|
991
|
-
pathParams: { workspace, dbName },
|
992
|
-
...this.extraProps
|
993
|
-
});
|
994
|
-
}
|
995
|
-
addGitBranchesEntry(workspace, dbName, body) {
|
996
|
-
return operationsByTag.database.addGitBranchesEntry({
|
997
|
-
pathParams: { workspace, dbName },
|
998
|
-
body,
|
999
|
-
...this.extraProps
|
1000
|
-
});
|
1001
|
-
}
|
1002
|
-
removeGitBranchesEntry(workspace, dbName, gitBranch) {
|
1003
|
-
return operationsByTag.database.removeGitBranchesEntry({
|
1004
|
-
pathParams: { workspace, dbName },
|
1005
|
-
queryParams: { gitBranch },
|
1006
|
-
...this.extraProps
|
1007
|
-
});
|
1008
|
-
}
|
1009
|
-
resolveBranch(workspace, dbName, gitBranch, fallbackBranch) {
|
1010
|
-
return operationsByTag.database.resolveBranch({
|
1011
|
-
pathParams: { workspace, dbName },
|
1012
|
-
queryParams: { gitBranch, fallbackBranch },
|
1013
|
-
...this.extraProps
|
1014
|
-
});
|
1015
|
-
}
|
1016
1023
|
}
|
1017
1024
|
class BranchApi {
|
1018
1025
|
constructor(extraProps) {
|
@@ -1063,6 +1070,33 @@ class BranchApi {
|
|
1063
1070
|
...this.extraProps
|
1064
1071
|
});
|
1065
1072
|
}
|
1073
|
+
getGitBranchesMapping(workspace, dbName) {
|
1074
|
+
return operationsByTag.branch.getGitBranchesMapping({
|
1075
|
+
pathParams: { workspace, dbName },
|
1076
|
+
...this.extraProps
|
1077
|
+
});
|
1078
|
+
}
|
1079
|
+
addGitBranchesEntry(workspace, dbName, body) {
|
1080
|
+
return operationsByTag.branch.addGitBranchesEntry({
|
1081
|
+
pathParams: { workspace, dbName },
|
1082
|
+
body,
|
1083
|
+
...this.extraProps
|
1084
|
+
});
|
1085
|
+
}
|
1086
|
+
removeGitBranchesEntry(workspace, dbName, gitBranch) {
|
1087
|
+
return operationsByTag.branch.removeGitBranchesEntry({
|
1088
|
+
pathParams: { workspace, dbName },
|
1089
|
+
queryParams: { gitBranch },
|
1090
|
+
...this.extraProps
|
1091
|
+
});
|
1092
|
+
}
|
1093
|
+
resolveBranch(workspace, dbName, gitBranch, fallbackBranch) {
|
1094
|
+
return operationsByTag.branch.resolveBranch({
|
1095
|
+
pathParams: { workspace, dbName },
|
1096
|
+
queryParams: { gitBranch, fallbackBranch },
|
1097
|
+
...this.extraProps
|
1098
|
+
});
|
1099
|
+
}
|
1066
1100
|
}
|
1067
1101
|
class TableApi {
|
1068
1102
|
constructor(extraProps) {
|
@@ -1119,16 +1153,16 @@ class TableApi {
|
|
1119
1153
|
...this.extraProps
|
1120
1154
|
});
|
1121
1155
|
}
|
1122
|
-
|
1123
|
-
return operationsByTag.table.
|
1156
|
+
updateColumn(workspace, database, branch, tableName, columnName, options) {
|
1157
|
+
return operationsByTag.table.updateColumn({
|
1124
1158
|
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, columnName },
|
1159
|
+
body: options,
|
1125
1160
|
...this.extraProps
|
1126
1161
|
});
|
1127
1162
|
}
|
1128
|
-
|
1129
|
-
return operationsByTag.table.
|
1163
|
+
deleteColumn(workspace, database, branch, tableName, columnName) {
|
1164
|
+
return operationsByTag.table.deleteColumn({
|
1130
1165
|
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, columnName },
|
1131
|
-
body: options,
|
1132
1166
|
...this.extraProps
|
1133
1167
|
});
|
1134
1168
|
}
|
@@ -1145,6 +1179,13 @@ class RecordsApi {
|
|
1145
1179
|
...this.extraProps
|
1146
1180
|
});
|
1147
1181
|
}
|
1182
|
+
getRecord(workspace, database, branch, tableName, recordId, options = {}) {
|
1183
|
+
return operationsByTag.records.getRecord({
|
1184
|
+
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
|
1185
|
+
queryParams: options,
|
1186
|
+
...this.extraProps
|
1187
|
+
});
|
1188
|
+
}
|
1148
1189
|
insertRecordWithID(workspace, database, branch, tableName, recordId, record, options = {}) {
|
1149
1190
|
return operationsByTag.records.insertRecordWithID({
|
1150
1191
|
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
|
@@ -1176,13 +1217,6 @@ class RecordsApi {
|
|
1176
1217
|
...this.extraProps
|
1177
1218
|
});
|
1178
1219
|
}
|
1179
|
-
getRecord(workspace, database, branch, tableName, recordId, options = {}) {
|
1180
|
-
return operationsByTag.records.getRecord({
|
1181
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
|
1182
|
-
queryParams: options,
|
1183
|
-
...this.extraProps
|
1184
|
-
});
|
1185
|
-
}
|
1186
1220
|
bulkInsertTableRecords(workspace, database, branch, tableName, records, options = {}) {
|
1187
1221
|
return operationsByTag.records.bulkInsertTableRecords({
|
1188
1222
|
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
@@ -1191,29 +1225,41 @@ class RecordsApi {
|
|
1191
1225
|
...this.extraProps
|
1192
1226
|
});
|
1193
1227
|
}
|
1228
|
+
}
|
1229
|
+
class SearchAndFilterApi {
|
1230
|
+
constructor(extraProps) {
|
1231
|
+
this.extraProps = extraProps;
|
1232
|
+
}
|
1194
1233
|
queryTable(workspace, database, branch, tableName, query) {
|
1195
|
-
return operationsByTag.
|
1234
|
+
return operationsByTag.searchAndFilter.queryTable({
|
1196
1235
|
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
1197
1236
|
body: query,
|
1198
1237
|
...this.extraProps
|
1199
1238
|
});
|
1200
1239
|
}
|
1201
1240
|
searchTable(workspace, database, branch, tableName, query) {
|
1202
|
-
return operationsByTag.
|
1241
|
+
return operationsByTag.searchAndFilter.searchTable({
|
1203
1242
|
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
1204
1243
|
body: query,
|
1205
1244
|
...this.extraProps
|
1206
1245
|
});
|
1207
1246
|
}
|
1208
1247
|
searchBranch(workspace, database, branch, query) {
|
1209
|
-
return operationsByTag.
|
1248
|
+
return operationsByTag.searchAndFilter.searchBranch({
|
1210
1249
|
pathParams: { workspace, dbBranchName: `${database}:${branch}` },
|
1211
1250
|
body: query,
|
1212
1251
|
...this.extraProps
|
1213
1252
|
});
|
1214
1253
|
}
|
1215
1254
|
summarizeTable(workspace, database, branch, tableName, query) {
|
1216
|
-
return operationsByTag.
|
1255
|
+
return operationsByTag.searchAndFilter.summarizeTable({
|
1256
|
+
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
1257
|
+
body: query,
|
1258
|
+
...this.extraProps
|
1259
|
+
});
|
1260
|
+
}
|
1261
|
+
aggregateTable(workspace, database, branch, tableName, query) {
|
1262
|
+
return operationsByTag.searchAndFilter.aggregateTable({
|
1217
1263
|
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
1218
1264
|
body: query,
|
1219
1265
|
...this.extraProps
|
@@ -1277,73 +1323,116 @@ class MigrationRequestsApi {
|
|
1277
1323
|
});
|
1278
1324
|
}
|
1279
1325
|
}
|
1280
|
-
class
|
1326
|
+
class MigrationsApi {
|
1281
1327
|
constructor(extraProps) {
|
1282
1328
|
this.extraProps = extraProps;
|
1283
1329
|
}
|
1284
1330
|
getBranchMigrationHistory(workspace, database, branch, options = {}) {
|
1285
|
-
return operationsByTag.
|
1331
|
+
return operationsByTag.migrations.getBranchMigrationHistory({
|
1286
1332
|
pathParams: { workspace, dbBranchName: `${database}:${branch}` },
|
1287
1333
|
body: options,
|
1288
1334
|
...this.extraProps
|
1289
1335
|
});
|
1290
1336
|
}
|
1337
|
+
getBranchMigrationPlan(workspace, database, branch, schema) {
|
1338
|
+
return operationsByTag.migrations.getBranchMigrationPlan({
|
1339
|
+
pathParams: { workspace, dbBranchName: `${database}:${branch}` },
|
1340
|
+
body: schema,
|
1341
|
+
...this.extraProps
|
1342
|
+
});
|
1343
|
+
}
|
1291
1344
|
executeBranchMigrationPlan(workspace, database, branch, migrationPlan) {
|
1292
|
-
return operationsByTag.
|
1345
|
+
return operationsByTag.migrations.executeBranchMigrationPlan({
|
1293
1346
|
pathParams: { workspace, dbBranchName: `${database}:${branch}` },
|
1294
1347
|
body: migrationPlan,
|
1295
1348
|
...this.extraProps
|
1296
1349
|
});
|
1297
1350
|
}
|
1298
|
-
|
1299
|
-
return operationsByTag.
|
1351
|
+
getBranchSchemaHistory(workspace, database, branch, options = {}) {
|
1352
|
+
return operationsByTag.migrations.getBranchSchemaHistory({
|
1300
1353
|
pathParams: { workspace, dbBranchName: `${database}:${branch}` },
|
1301
|
-
body:
|
1354
|
+
body: options,
|
1302
1355
|
...this.extraProps
|
1303
1356
|
});
|
1304
1357
|
}
|
1305
1358
|
compareBranchWithUserSchema(workspace, database, branch, schema) {
|
1306
|
-
return operationsByTag.
|
1359
|
+
return operationsByTag.migrations.compareBranchWithUserSchema({
|
1307
1360
|
pathParams: { workspace, dbBranchName: `${database}:${branch}` },
|
1308
1361
|
body: { schema },
|
1309
1362
|
...this.extraProps
|
1310
1363
|
});
|
1311
1364
|
}
|
1312
1365
|
compareBranchSchemas(workspace, database, branch, branchName, schema) {
|
1313
|
-
return operationsByTag.
|
1366
|
+
return operationsByTag.migrations.compareBranchSchemas({
|
1314
1367
|
pathParams: { workspace, dbBranchName: `${database}:${branch}`, branchName },
|
1315
1368
|
body: { schema },
|
1316
1369
|
...this.extraProps
|
1317
1370
|
});
|
1318
1371
|
}
|
1319
1372
|
updateBranchSchema(workspace, database, branch, migration) {
|
1320
|
-
return operationsByTag.
|
1373
|
+
return operationsByTag.migrations.updateBranchSchema({
|
1321
1374
|
pathParams: { workspace, dbBranchName: `${database}:${branch}` },
|
1322
1375
|
body: migration,
|
1323
1376
|
...this.extraProps
|
1324
1377
|
});
|
1325
1378
|
}
|
1326
1379
|
previewBranchSchemaEdit(workspace, database, branch, migration) {
|
1327
|
-
return operationsByTag.
|
1380
|
+
return operationsByTag.migrations.previewBranchSchemaEdit({
|
1328
1381
|
pathParams: { workspace, dbBranchName: `${database}:${branch}` },
|
1329
1382
|
body: migration,
|
1330
1383
|
...this.extraProps
|
1331
1384
|
});
|
1332
1385
|
}
|
1333
1386
|
applyBranchSchemaEdit(workspace, database, branch, edits) {
|
1334
|
-
return operationsByTag.
|
1387
|
+
return operationsByTag.migrations.applyBranchSchemaEdit({
|
1335
1388
|
pathParams: { workspace, dbBranchName: `${database}:${branch}` },
|
1336
1389
|
body: { edits },
|
1337
1390
|
...this.extraProps
|
1338
1391
|
});
|
1339
1392
|
}
|
1340
|
-
|
1341
|
-
|
1342
|
-
|
1393
|
+
}
|
1394
|
+
class DatabasesApi {
|
1395
|
+
constructor(extraProps) {
|
1396
|
+
this.extraProps = extraProps;
|
1397
|
+
}
|
1398
|
+
getDatabaseList(workspaceId) {
|
1399
|
+
return operationsByTag.databases.cPGetDatabaseList({
|
1400
|
+
pathParams: { workspaceId },
|
1401
|
+
...this.extraProps
|
1402
|
+
});
|
1403
|
+
}
|
1404
|
+
createDatabase(workspaceId, dbName, options) {
|
1405
|
+
return operationsByTag.databases.cPCreateDatabase({
|
1406
|
+
pathParams: { workspaceId, dbName },
|
1343
1407
|
body: options,
|
1344
1408
|
...this.extraProps
|
1345
1409
|
});
|
1346
1410
|
}
|
1411
|
+
deleteDatabase(workspaceId, dbName) {
|
1412
|
+
return operationsByTag.databases.cPDeleteDatabase({
|
1413
|
+
pathParams: { workspaceId, dbName },
|
1414
|
+
...this.extraProps
|
1415
|
+
});
|
1416
|
+
}
|
1417
|
+
getDatabaseMetadata(workspaceId, dbName) {
|
1418
|
+
return operationsByTag.databases.cPGetCPDatabaseMetadata({
|
1419
|
+
pathParams: { workspaceId, dbName },
|
1420
|
+
...this.extraProps
|
1421
|
+
});
|
1422
|
+
}
|
1423
|
+
updateDatabaseMetadata(workspaceId, dbName, metadata) {
|
1424
|
+
return operationsByTag.databases.cPUpdateCPDatabaseMetadata({
|
1425
|
+
pathParams: { workspaceId, dbName },
|
1426
|
+
body: metadata,
|
1427
|
+
...this.extraProps
|
1428
|
+
});
|
1429
|
+
}
|
1430
|
+
listRegions(workspaceId) {
|
1431
|
+
return operationsByTag.databases.listRegions({
|
1432
|
+
pathParams: { workspaceId },
|
1433
|
+
...this.extraProps
|
1434
|
+
});
|
1435
|
+
}
|
1347
1436
|
}
|
1348
1437
|
|
1349
1438
|
class XataApiPlugin {
|
@@ -1356,6 +1445,20 @@ class XataApiPlugin {
|
|
1356
1445
|
class XataPlugin {
|
1357
1446
|
}
|
1358
1447
|
|
1448
|
+
function generateUUID() {
|
1449
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
|
1450
|
+
const r = Math.random() * 16 | 0, v = c == "x" ? r : r & 3 | 8;
|
1451
|
+
return v.toString(16);
|
1452
|
+
});
|
1453
|
+
}
|
1454
|
+
|
1455
|
+
function cleanFilter(filter) {
|
1456
|
+
if (!filter)
|
1457
|
+
return void 0;
|
1458
|
+
const values = Object.values(filter).filter(Boolean).filter((value) => Array.isArray(value) ? value.length > 0 : true);
|
1459
|
+
return values.length > 0 ? filter : void 0;
|
1460
|
+
}
|
1461
|
+
|
1359
1462
|
var __accessCheck$6 = (obj, member, msg) => {
|
1360
1463
|
if (!member.has(obj))
|
1361
1464
|
throw TypeError("Cannot " + msg);
|
@@ -1495,7 +1598,7 @@ const _Query = class {
|
|
1495
1598
|
__privateGet$5(this, _data).filter.$not = data.filter?.$not ?? parent?.filter?.$not;
|
1496
1599
|
__privateGet$5(this, _data).filter.$none = data.filter?.$none ?? parent?.filter?.$none;
|
1497
1600
|
__privateGet$5(this, _data).sort = data.sort ?? parent?.sort;
|
1498
|
-
__privateGet$5(this, _data).columns = data.columns ?? parent?.columns
|
1601
|
+
__privateGet$5(this, _data).columns = data.columns ?? parent?.columns;
|
1499
1602
|
__privateGet$5(this, _data).pagination = data.pagination ?? parent?.pagination;
|
1500
1603
|
__privateGet$5(this, _data).cache = data.cache ?? parent?.cache;
|
1501
1604
|
this.any = this.any.bind(this);
|
@@ -1611,6 +1714,16 @@ const _Query = class {
|
|
1611
1714
|
throw new Error("No results found.");
|
1612
1715
|
return records[0];
|
1613
1716
|
}
|
1717
|
+
async summarize(params = {}) {
|
1718
|
+
const { summaries, summariesFilter, ...options } = params;
|
1719
|
+
const query = new _Query(
|
1720
|
+
__privateGet$5(this, _repository),
|
1721
|
+
__privateGet$5(this, _table$1),
|
1722
|
+
options,
|
1723
|
+
__privateGet$5(this, _data)
|
1724
|
+
);
|
1725
|
+
return __privateGet$5(this, _repository).summarizeTable(query, summaries, summariesFilter);
|
1726
|
+
}
|
1614
1727
|
cache(ttl) {
|
1615
1728
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { cache: ttl }, __privateGet$5(this, _data));
|
1616
1729
|
}
|
@@ -1732,10 +1845,13 @@ class RestRepository extends Query {
|
|
1732
1845
|
__privateAdd$4(this, _schemaTables$2, void 0);
|
1733
1846
|
__privateAdd$4(this, _trace, void 0);
|
1734
1847
|
__privateSet$4(this, _table, options.table);
|
1735
|
-
__privateSet$4(this, _getFetchProps, options.pluginOptions.getFetchProps);
|
1736
1848
|
__privateSet$4(this, _db, options.db);
|
1737
1849
|
__privateSet$4(this, _cache, options.pluginOptions.cache);
|
1738
1850
|
__privateSet$4(this, _schemaTables$2, options.schemaTables);
|
1851
|
+
__privateSet$4(this, _getFetchProps, async () => {
|
1852
|
+
const props = await options.pluginOptions.getFetchProps();
|
1853
|
+
return { ...props, sessionID: generateUUID() };
|
1854
|
+
});
|
1739
1855
|
const trace = options.pluginOptions.trace ?? defaultTrace;
|
1740
1856
|
__privateSet$4(this, _trace, async (name, fn, options2 = {}) => {
|
1741
1857
|
return trace(name, fn, {
|
@@ -1951,22 +2067,32 @@ class RestRepository extends Query {
|
|
1951
2067
|
return records.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item, ["*"]));
|
1952
2068
|
});
|
1953
2069
|
}
|
2070
|
+
async aggregate(aggs, filter) {
|
2071
|
+
return __privateGet$4(this, _trace).call(this, "aggregate", async () => {
|
2072
|
+
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2073
|
+
const result = await aggregateTable({
|
2074
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", tableName: __privateGet$4(this, _table) },
|
2075
|
+
body: { aggs, filter },
|
2076
|
+
...fetchProps
|
2077
|
+
});
|
2078
|
+
return result;
|
2079
|
+
});
|
2080
|
+
}
|
1954
2081
|
async query(query) {
|
1955
2082
|
return __privateGet$4(this, _trace).call(this, "query", async () => {
|
1956
2083
|
const cacheQuery = await __privateMethod$2(this, _getCacheQuery, getCacheQuery_fn).call(this, query);
|
1957
2084
|
if (cacheQuery)
|
1958
2085
|
return new Page(query, cacheQuery.meta, cacheQuery.records);
|
1959
2086
|
const data = query.getQueryOptions();
|
1960
|
-
const body = {
|
1961
|
-
filter: cleanFilter(data.filter),
|
1962
|
-
sort: data.sort !== void 0 ? buildSortFilter(data.sort) : void 0,
|
1963
|
-
page: data.pagination,
|
1964
|
-
columns: data.columns
|
1965
|
-
};
|
1966
2087
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1967
2088
|
const { meta, records: objects } = await queryTable({
|
1968
2089
|
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", tableName: __privateGet$4(this, _table) },
|
1969
|
-
body
|
2090
|
+
body: {
|
2091
|
+
filter: cleanFilter(data.filter),
|
2092
|
+
sort: data.sort !== void 0 ? buildSortFilter(data.sort) : void 0,
|
2093
|
+
page: data.pagination,
|
2094
|
+
columns: data.columns ?? ["*"]
|
2095
|
+
},
|
1970
2096
|
...fetchProps
|
1971
2097
|
});
|
1972
2098
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
@@ -1977,6 +2103,24 @@ class RestRepository extends Query {
|
|
1977
2103
|
return new Page(query, meta, records);
|
1978
2104
|
});
|
1979
2105
|
}
|
2106
|
+
async summarizeTable(query, summaries, summariesFilter) {
|
2107
|
+
return __privateGet$4(this, _trace).call(this, "summarize", async () => {
|
2108
|
+
const data = query.getQueryOptions();
|
2109
|
+
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2110
|
+
const result = await summarizeTable({
|
2111
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", tableName: __privateGet$4(this, _table) },
|
2112
|
+
body: {
|
2113
|
+
filter: cleanFilter(data.filter),
|
2114
|
+
sort: data.sort !== void 0 ? buildSortFilter(data.sort) : void 0,
|
2115
|
+
columns: data.columns,
|
2116
|
+
summaries,
|
2117
|
+
summariesFilter
|
2118
|
+
},
|
2119
|
+
...fetchProps
|
2120
|
+
});
|
2121
|
+
return result;
|
2122
|
+
});
|
2123
|
+
}
|
1980
2124
|
}
|
1981
2125
|
_table = new WeakMap();
|
1982
2126
|
_getFetchProps = new WeakMap();
|
@@ -2198,12 +2342,6 @@ function extractId(value) {
|
|
2198
2342
|
return value.id;
|
2199
2343
|
return void 0;
|
2200
2344
|
}
|
2201
|
-
function cleanFilter(filter) {
|
2202
|
-
if (!filter)
|
2203
|
-
return void 0;
|
2204
|
-
const values = Object.values(filter).filter(Boolean).filter((value) => Array.isArray(value) ? value.length > 0 : true);
|
2205
|
-
return values.length > 0 ? filter : void 0;
|
2206
|
-
}
|
2207
2345
|
function isValidColumn(columns, column) {
|
2208
2346
|
if (columns.includes("*"))
|
2209
2347
|
return true;
|
@@ -2574,8 +2712,15 @@ const buildClient = (plugins) => {
|
|
2574
2712
|
if (!databaseURL) {
|
2575
2713
|
throw new Error("Option databaseURL is required");
|
2576
2714
|
}
|
2577
|
-
return { fetch, databaseURL, apiKey, branch, cache, trace };
|
2578
|
-
}, _getFetchProps = new WeakSet(), getFetchProps_fn = async function({
|
2715
|
+
return { fetch, databaseURL, apiKey, branch, cache, trace, clientID: generateUUID() };
|
2716
|
+
}, _getFetchProps = new WeakSet(), getFetchProps_fn = async function({
|
2717
|
+
fetch,
|
2718
|
+
apiKey,
|
2719
|
+
databaseURL,
|
2720
|
+
branch,
|
2721
|
+
trace,
|
2722
|
+
clientID
|
2723
|
+
}) {
|
2579
2724
|
const branchValue = await __privateMethod(this, _evaluateBranch, evaluateBranch_fn).call(this, branch);
|
2580
2725
|
if (!branchValue)
|
2581
2726
|
throw new Error("Unable to resolve branch value");
|
@@ -2588,7 +2733,8 @@ const buildClient = (plugins) => {
|
|
2588
2733
|
const newPath = path.replace(/^\/db\/[^/]+/, hasBranch !== void 0 ? `:${branchValue}` : "");
|
2589
2734
|
return databaseURL + newPath;
|
2590
2735
|
},
|
2591
|
-
trace
|
2736
|
+
trace,
|
2737
|
+
clientID
|
2592
2738
|
};
|
2593
2739
|
}, _evaluateBranch = new WeakSet(), evaluateBranch_fn = async function(param) {
|
2594
2740
|
if (__privateGet(this, _branch))
|
@@ -2807,6 +2953,7 @@ exports.lessEquals = lessEquals;
|
|
2807
2953
|
exports.lessThan = lessThan;
|
2808
2954
|
exports.lessThanEquals = lessThanEquals;
|
2809
2955
|
exports.listMigrationRequestsCommits = listMigrationRequestsCommits;
|
2956
|
+
exports.listRegions = listRegions;
|
2810
2957
|
exports.lt = lt;
|
2811
2958
|
exports.lte = lte;
|
2812
2959
|
exports.mergeMigrationRequest = mergeMigrationRequest;
|