@revisium/client 0.2.0 → 0.4.0
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/README.md +191 -125
- package/dist/branch-scope.d.ts +37 -0
- package/dist/branch-scope.d.ts.map +1 -0
- package/dist/data-operations.d.ts +108 -10
- package/dist/data-operations.d.ts.map +1 -1
- package/dist/index.cjs +799 -263
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +7 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +796 -263
- package/dist/index.mjs.map +1 -1
- package/dist/org-scope.d.ts +24 -0
- package/dist/org-scope.d.ts.map +1 -0
- package/dist/project-scope.d.ts +34 -0
- package/dist/project-scope.d.ts.map +1 -0
- package/dist/revision-scope.d.ts +122 -0
- package/dist/revision-scope.d.ts.map +1 -0
- package/dist/revisium-client.d.ts +15 -59
- package/dist/revisium-client.d.ts.map +1 -1
- package/dist/scope-owner.d.ts +7 -0
- package/dist/scope-owner.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/revisium-scope.d.ts +0 -76
- package/dist/revisium-scope.d.ts.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -658,23 +658,23 @@ const client = createClient(createConfig());
|
|
|
658
658
|
var sdk_gen_exports = /* @__PURE__ */ __exportAll({
|
|
659
659
|
addUserToOrganization: () => addUserToOrganization,
|
|
660
660
|
addUserToProject: () => addUserToProject,
|
|
661
|
-
applyMigrations: () => applyMigrations,
|
|
661
|
+
applyMigrations: () => applyMigrations$1,
|
|
662
662
|
branch: () => branch,
|
|
663
663
|
branchTouched: () => branchTouched,
|
|
664
664
|
branches: () => branches,
|
|
665
665
|
childBranches: () => childBranches,
|
|
666
666
|
childRevision: () => childRevision,
|
|
667
|
-
createBranch: () => createBranch,
|
|
668
|
-
createEndpoint: () => createEndpoint,
|
|
669
|
-
createProject: () => createProject,
|
|
667
|
+
createBranch: () => createBranch$1,
|
|
668
|
+
createEndpoint: () => createEndpoint$1,
|
|
669
|
+
createProject: () => createProject$1,
|
|
670
670
|
createRevision: () => createRevision,
|
|
671
671
|
createRow: () => createRow$1,
|
|
672
672
|
createRows: () => createRows$1,
|
|
673
673
|
createTable: () => createTable$1,
|
|
674
674
|
createUser: () => createUser,
|
|
675
|
-
deleteBranch: () => deleteBranch,
|
|
676
|
-
deleteEndpoint: () => deleteEndpoint,
|
|
677
|
-
deleteProject: () => deleteProject,
|
|
675
|
+
deleteBranch: () => deleteBranch$1,
|
|
676
|
+
deleteEndpoint: () => deleteEndpoint$1,
|
|
677
|
+
deleteProject: () => deleteProject$1,
|
|
678
678
|
deleteRow: () => deleteRow$1,
|
|
679
679
|
deleteRows: () => deleteRows$1,
|
|
680
680
|
deleteTable: () => deleteTable$1,
|
|
@@ -685,12 +685,12 @@ var sdk_gen_exports = /* @__PURE__ */ __exportAll({
|
|
|
685
685
|
headRevision: () => headRevision,
|
|
686
686
|
liveness: () => liveness,
|
|
687
687
|
login: () => login,
|
|
688
|
-
me: () => me,
|
|
688
|
+
me: () => me$1,
|
|
689
689
|
migrations: () => migrations,
|
|
690
690
|
parentBranch: () => parentBranch,
|
|
691
691
|
parentRevision: () => parentRevision,
|
|
692
692
|
patchRow: () => patchRow$1,
|
|
693
|
-
patchRows: () => patchRows,
|
|
693
|
+
patchRows: () => patchRows$1,
|
|
694
694
|
project: () => project,
|
|
695
695
|
projects: () => projects,
|
|
696
696
|
readiness: () => readiness,
|
|
@@ -721,11 +721,11 @@ var sdk_gen_exports = /* @__PURE__ */ __exportAll({
|
|
|
721
721
|
tableSchema: () => tableSchema,
|
|
722
722
|
tables: () => tables,
|
|
723
723
|
updatePassword: () => updatePassword,
|
|
724
|
-
updateProject: () => updateProject,
|
|
724
|
+
updateProject: () => updateProject$1,
|
|
725
725
|
updateRow: () => updateRow$1,
|
|
726
726
|
updateRows: () => updateRows$1,
|
|
727
727
|
updateTable: () => updateTable$1,
|
|
728
|
-
uploadFile: () => uploadFile,
|
|
728
|
+
uploadFile: () => uploadFile$1,
|
|
729
729
|
usersOrganization: () => usersOrganization,
|
|
730
730
|
usersProject: () => usersProject
|
|
731
731
|
});
|
|
@@ -777,7 +777,7 @@ const updatePassword = (options) => (options.client ?? client).put({
|
|
|
777
777
|
/**
|
|
778
778
|
* Get current authenticated user
|
|
779
779
|
*/
|
|
780
|
-
const me = (options) => (options?.client ?? client).get({
|
|
780
|
+
const me$1 = (options) => (options?.client ?? client).get({
|
|
781
781
|
security: [{
|
|
782
782
|
scheme: "bearer",
|
|
783
783
|
type: "http"
|
|
@@ -799,7 +799,7 @@ const projects = (options) => (options.client ?? client).get({
|
|
|
799
799
|
/**
|
|
800
800
|
* Create a new project
|
|
801
801
|
*/
|
|
802
|
-
const createProject = (options) => (options.client ?? client).post({
|
|
802
|
+
const createProject$1 = (options) => (options.client ?? client).post({
|
|
803
803
|
security: [{
|
|
804
804
|
scheme: "bearer",
|
|
805
805
|
type: "http"
|
|
@@ -855,7 +855,7 @@ const addUserToOrganization = (options) => (options.client ?? client).post({
|
|
|
855
855
|
/**
|
|
856
856
|
* Delete a project
|
|
857
857
|
*/
|
|
858
|
-
const deleteProject = (options) => (options.client ?? client).delete({
|
|
858
|
+
const deleteProject$1 = (options) => (options.client ?? client).delete({
|
|
859
859
|
security: [{
|
|
860
860
|
scheme: "bearer",
|
|
861
861
|
type: "http"
|
|
@@ -877,7 +877,7 @@ const project = (options) => (options.client ?? client).get({
|
|
|
877
877
|
/**
|
|
878
878
|
* Update project settings
|
|
879
879
|
*/
|
|
880
|
-
const updateProject = (options) => (options.client ?? client).put({
|
|
880
|
+
const updateProject$1 = (options) => (options.client ?? client).put({
|
|
881
881
|
security: [{
|
|
882
882
|
scheme: "bearer",
|
|
883
883
|
type: "http"
|
|
@@ -951,7 +951,7 @@ const removeUserFromProject = (options) => (options.client ?? client).delete({
|
|
|
951
951
|
/**
|
|
952
952
|
* Delete a non-root branch
|
|
953
953
|
*/
|
|
954
|
-
const deleteBranch = (options) => (options.client ?? client).delete({
|
|
954
|
+
const deleteBranch$1 = (options) => (options.client ?? client).delete({
|
|
955
955
|
security: [{
|
|
956
956
|
scheme: "bearer",
|
|
957
957
|
type: "http"
|
|
@@ -1109,7 +1109,7 @@ const childBranches = (options) => (options.client ?? client).get({
|
|
|
1109
1109
|
/**
|
|
1110
1110
|
* Create a new branch from this revision
|
|
1111
1111
|
*/
|
|
1112
|
-
const createBranch = (options) => (options.client ?? client).post({
|
|
1112
|
+
const createBranch$1 = (options) => (options.client ?? client).post({
|
|
1113
1113
|
security: [{
|
|
1114
1114
|
scheme: "bearer",
|
|
1115
1115
|
type: "http"
|
|
@@ -1161,7 +1161,7 @@ const endpoints = (options) => (options.client ?? client).get({
|
|
|
1161
1161
|
/**
|
|
1162
1162
|
* Create an API endpoint for this revision
|
|
1163
1163
|
*/
|
|
1164
|
-
const createEndpoint = (options) => (options.client ?? client).post({
|
|
1164
|
+
const createEndpoint$1 = (options) => (options.client ?? client).post({
|
|
1165
1165
|
security: [{
|
|
1166
1166
|
scheme: "bearer",
|
|
1167
1167
|
type: "http"
|
|
@@ -1220,7 +1220,7 @@ const rowChanges = (options) => (options.client ?? client).get({
|
|
|
1220
1220
|
/**
|
|
1221
1221
|
* Apply schema migrations to this revision
|
|
1222
1222
|
*/
|
|
1223
|
-
const applyMigrations = (options) => (options.client ?? client).post({
|
|
1223
|
+
const applyMigrations$1 = (options) => (options.client ?? client).post({
|
|
1224
1224
|
security: [{
|
|
1225
1225
|
scheme: "bearer",
|
|
1226
1226
|
type: "http"
|
|
@@ -1358,7 +1358,7 @@ const updateRows$1 = (options) => (options.client ?? client).put({
|
|
|
1358
1358
|
/**
|
|
1359
1359
|
* Patch multiple rows using JSON Patch
|
|
1360
1360
|
*/
|
|
1361
|
-
const patchRows = (options) => (options.client ?? client).patch({
|
|
1361
|
+
const patchRows$1 = (options) => (options.client ?? client).patch({
|
|
1362
1362
|
security: [{
|
|
1363
1363
|
scheme: "bearer",
|
|
1364
1364
|
type: "http"
|
|
@@ -1554,7 +1554,7 @@ const renameRow$1 = (options) => (options.client ?? client).patch({
|
|
|
1554
1554
|
/**
|
|
1555
1555
|
* Upload a file to a row field
|
|
1556
1556
|
*/
|
|
1557
|
-
const uploadFile = (options) => (options.client ?? client).post({
|
|
1557
|
+
const uploadFile$1 = (options) => (options.client ?? client).post({
|
|
1558
1558
|
...formDataBodySerializer,
|
|
1559
1559
|
security: [{
|
|
1560
1560
|
scheme: "bearer",
|
|
@@ -1581,7 +1581,7 @@ const endpointRelatives = (options) => (options.client ?? client).get({
|
|
|
1581
1581
|
/**
|
|
1582
1582
|
* Delete an endpoint
|
|
1583
1583
|
*/
|
|
1584
|
-
const deleteEndpoint = (options) => (options.client ?? client).delete({
|
|
1584
|
+
const deleteEndpoint$1 = (options) => (options.client ?? client).delete({
|
|
1585
1585
|
security: [{
|
|
1586
1586
|
scheme: "bearer",
|
|
1587
1587
|
type: "http"
|
|
@@ -1616,11 +1616,257 @@ function unwrap(result) {
|
|
|
1616
1616
|
}
|
|
1617
1617
|
function assertDraft(ctx) {
|
|
1618
1618
|
assertContext(ctx);
|
|
1619
|
-
if (!ctx.isDraft) throw new Error("Mutations are only allowed in draft revision.
|
|
1619
|
+
if (!ctx.isDraft) throw new Error("Mutations are only allowed in draft revision.");
|
|
1620
1620
|
}
|
|
1621
1621
|
function assertContext(ctx) {
|
|
1622
1622
|
if (!ctx.branch.organizationId) throw new Error("Context not set. Call setContext() first.");
|
|
1623
1623
|
}
|
|
1624
|
+
async function me(client) {
|
|
1625
|
+
return unwrap(await me$1({ client }));
|
|
1626
|
+
}
|
|
1627
|
+
async function getProjects(ctx, options) {
|
|
1628
|
+
return unwrap(await projects({
|
|
1629
|
+
client: ctx.client,
|
|
1630
|
+
path: { organizationId: ctx.organizationId },
|
|
1631
|
+
query: {
|
|
1632
|
+
first: options?.first ?? 100,
|
|
1633
|
+
after: options?.after
|
|
1634
|
+
}
|
|
1635
|
+
}));
|
|
1636
|
+
}
|
|
1637
|
+
async function createProject(ctx, body) {
|
|
1638
|
+
return unwrap(await createProject$1({
|
|
1639
|
+
client: ctx.client,
|
|
1640
|
+
path: { organizationId: ctx.organizationId },
|
|
1641
|
+
body
|
|
1642
|
+
}));
|
|
1643
|
+
}
|
|
1644
|
+
async function getOrgUsers(ctx, options) {
|
|
1645
|
+
return unwrap(await usersOrganization({
|
|
1646
|
+
client: ctx.client,
|
|
1647
|
+
path: { organizationId: ctx.organizationId },
|
|
1648
|
+
query: {
|
|
1649
|
+
first: options?.first ?? 100,
|
|
1650
|
+
after: options?.after
|
|
1651
|
+
}
|
|
1652
|
+
}));
|
|
1653
|
+
}
|
|
1654
|
+
async function addOrgUser(ctx, userId, roleId) {
|
|
1655
|
+
unwrap(await addUserToOrganization({
|
|
1656
|
+
client: ctx.client,
|
|
1657
|
+
path: { organizationId: ctx.organizationId },
|
|
1658
|
+
body: {
|
|
1659
|
+
userId,
|
|
1660
|
+
roleId
|
|
1661
|
+
}
|
|
1662
|
+
}));
|
|
1663
|
+
}
|
|
1664
|
+
async function removeOrgUser(ctx, userId) {
|
|
1665
|
+
unwrap(await removeUserFromOrganization({
|
|
1666
|
+
client: ctx.client,
|
|
1667
|
+
path: { organizationId: ctx.organizationId },
|
|
1668
|
+
body: { userId }
|
|
1669
|
+
}));
|
|
1670
|
+
}
|
|
1671
|
+
async function getProject(ctx) {
|
|
1672
|
+
return unwrap(await project({
|
|
1673
|
+
client: ctx.client,
|
|
1674
|
+
path: {
|
|
1675
|
+
organizationId: ctx.organizationId,
|
|
1676
|
+
projectName: ctx.projectName
|
|
1677
|
+
}
|
|
1678
|
+
}));
|
|
1679
|
+
}
|
|
1680
|
+
async function updateProject(ctx, body) {
|
|
1681
|
+
unwrap(await updateProject$1({
|
|
1682
|
+
client: ctx.client,
|
|
1683
|
+
path: {
|
|
1684
|
+
organizationId: ctx.organizationId,
|
|
1685
|
+
projectName: ctx.projectName
|
|
1686
|
+
},
|
|
1687
|
+
body
|
|
1688
|
+
}));
|
|
1689
|
+
}
|
|
1690
|
+
async function deleteProject(ctx) {
|
|
1691
|
+
unwrap(await deleteProject$1({
|
|
1692
|
+
client: ctx.client,
|
|
1693
|
+
path: {
|
|
1694
|
+
organizationId: ctx.organizationId,
|
|
1695
|
+
projectName: ctx.projectName
|
|
1696
|
+
}
|
|
1697
|
+
}));
|
|
1698
|
+
}
|
|
1699
|
+
async function getBranches(ctx, options) {
|
|
1700
|
+
return unwrap(await branches({
|
|
1701
|
+
client: ctx.client,
|
|
1702
|
+
path: {
|
|
1703
|
+
organizationId: ctx.organizationId,
|
|
1704
|
+
projectName: ctx.projectName
|
|
1705
|
+
},
|
|
1706
|
+
query: {
|
|
1707
|
+
first: options?.first ?? 100,
|
|
1708
|
+
after: options?.after
|
|
1709
|
+
}
|
|
1710
|
+
}));
|
|
1711
|
+
}
|
|
1712
|
+
async function getRootBranch(ctx) {
|
|
1713
|
+
return unwrap(await rootBranch({
|
|
1714
|
+
client: ctx.client,
|
|
1715
|
+
path: {
|
|
1716
|
+
organizationId: ctx.organizationId,
|
|
1717
|
+
projectName: ctx.projectName
|
|
1718
|
+
}
|
|
1719
|
+
}));
|
|
1720
|
+
}
|
|
1721
|
+
async function getProjectUsers(ctx, options) {
|
|
1722
|
+
return unwrap(await usersProject({
|
|
1723
|
+
client: ctx.client,
|
|
1724
|
+
path: {
|
|
1725
|
+
organizationId: ctx.organizationId,
|
|
1726
|
+
projectName: ctx.projectName
|
|
1727
|
+
},
|
|
1728
|
+
query: {
|
|
1729
|
+
first: options?.first ?? 100,
|
|
1730
|
+
after: options?.after
|
|
1731
|
+
}
|
|
1732
|
+
}));
|
|
1733
|
+
}
|
|
1734
|
+
async function addProjectUser(ctx, userId, roleId) {
|
|
1735
|
+
unwrap(await addUserToProject({
|
|
1736
|
+
client: ctx.client,
|
|
1737
|
+
path: {
|
|
1738
|
+
organizationId: ctx.organizationId,
|
|
1739
|
+
projectName: ctx.projectName
|
|
1740
|
+
},
|
|
1741
|
+
body: {
|
|
1742
|
+
userId,
|
|
1743
|
+
roleId
|
|
1744
|
+
}
|
|
1745
|
+
}));
|
|
1746
|
+
}
|
|
1747
|
+
async function removeProjectUser(ctx, userId) {
|
|
1748
|
+
unwrap(await removeUserFromProject({
|
|
1749
|
+
client: ctx.client,
|
|
1750
|
+
path: {
|
|
1751
|
+
organizationId: ctx.organizationId,
|
|
1752
|
+
projectName: ctx.projectName,
|
|
1753
|
+
userId
|
|
1754
|
+
}
|
|
1755
|
+
}));
|
|
1756
|
+
}
|
|
1757
|
+
async function getBranch(client, branch$1) {
|
|
1758
|
+
return unwrap(await branch({
|
|
1759
|
+
client,
|
|
1760
|
+
path: {
|
|
1761
|
+
organizationId: branch$1.organizationId,
|
|
1762
|
+
projectName: branch$1.projectName,
|
|
1763
|
+
branchName: branch$1.branchName
|
|
1764
|
+
}
|
|
1765
|
+
}));
|
|
1766
|
+
}
|
|
1767
|
+
async function createBranch(client, revisionId, branchName) {
|
|
1768
|
+
return unwrap(await createBranch$1({
|
|
1769
|
+
client,
|
|
1770
|
+
path: { revisionId },
|
|
1771
|
+
body: { branchName }
|
|
1772
|
+
}));
|
|
1773
|
+
}
|
|
1774
|
+
async function deleteBranch(client, branch) {
|
|
1775
|
+
unwrap(await deleteBranch$1({
|
|
1776
|
+
client,
|
|
1777
|
+
path: {
|
|
1778
|
+
organizationId: branch.organizationId,
|
|
1779
|
+
projectName: branch.projectName,
|
|
1780
|
+
branchName: branch.branchName
|
|
1781
|
+
}
|
|
1782
|
+
}));
|
|
1783
|
+
}
|
|
1784
|
+
async function getBranchTouched(client, branch) {
|
|
1785
|
+
return unwrap(await branchTouched({
|
|
1786
|
+
client,
|
|
1787
|
+
path: {
|
|
1788
|
+
organizationId: branch.organizationId,
|
|
1789
|
+
projectName: branch.projectName,
|
|
1790
|
+
branchName: branch.branchName
|
|
1791
|
+
}
|
|
1792
|
+
}));
|
|
1793
|
+
}
|
|
1794
|
+
async function getRevisions(client, branch, options) {
|
|
1795
|
+
return unwrap(await revisions({
|
|
1796
|
+
client,
|
|
1797
|
+
path: {
|
|
1798
|
+
organizationId: branch.organizationId,
|
|
1799
|
+
projectName: branch.projectName,
|
|
1800
|
+
branchName: branch.branchName
|
|
1801
|
+
},
|
|
1802
|
+
query: {
|
|
1803
|
+
...options,
|
|
1804
|
+
first: options?.first ?? 100
|
|
1805
|
+
}
|
|
1806
|
+
}));
|
|
1807
|
+
}
|
|
1808
|
+
async function getStartRevision(client, branch) {
|
|
1809
|
+
return unwrap(await startRevision({
|
|
1810
|
+
client,
|
|
1811
|
+
path: {
|
|
1812
|
+
organizationId: branch.organizationId,
|
|
1813
|
+
projectName: branch.projectName,
|
|
1814
|
+
branchName: branch.branchName
|
|
1815
|
+
}
|
|
1816
|
+
}));
|
|
1817
|
+
}
|
|
1818
|
+
async function fetchDraftRevisionId(client, branch) {
|
|
1819
|
+
return unwrap(await draftRevision({
|
|
1820
|
+
client,
|
|
1821
|
+
path: {
|
|
1822
|
+
organizationId: branch.organizationId,
|
|
1823
|
+
projectName: branch.projectName,
|
|
1824
|
+
branchName: branch.branchName
|
|
1825
|
+
}
|
|
1826
|
+
})).id;
|
|
1827
|
+
}
|
|
1828
|
+
async function fetchHeadRevisionId(client, branch) {
|
|
1829
|
+
return unwrap(await headRevision({
|
|
1830
|
+
client,
|
|
1831
|
+
path: {
|
|
1832
|
+
organizationId: branch.organizationId,
|
|
1833
|
+
projectName: branch.projectName,
|
|
1834
|
+
branchName: branch.branchName
|
|
1835
|
+
}
|
|
1836
|
+
})).id;
|
|
1837
|
+
}
|
|
1838
|
+
async function validateRevisionId(client, revisionId) {
|
|
1839
|
+
unwrap(await revision({
|
|
1840
|
+
client,
|
|
1841
|
+
path: { revisionId }
|
|
1842
|
+
}));
|
|
1843
|
+
}
|
|
1844
|
+
async function getMigrations(ctx) {
|
|
1845
|
+
assertContext(ctx);
|
|
1846
|
+
const revisionId = await ctx.getRevisionId();
|
|
1847
|
+
return unwrap(await migrations({
|
|
1848
|
+
client: ctx.client,
|
|
1849
|
+
path: { revisionId }
|
|
1850
|
+
}));
|
|
1851
|
+
}
|
|
1852
|
+
async function applyMigrations(ctx, migrations) {
|
|
1853
|
+
assertDraft(ctx);
|
|
1854
|
+
const revisionId = await ctx.getRevisionId();
|
|
1855
|
+
unwrap(await applyMigrations$1({
|
|
1856
|
+
client: ctx.client,
|
|
1857
|
+
path: { revisionId },
|
|
1858
|
+
body: migrations
|
|
1859
|
+
}));
|
|
1860
|
+
}
|
|
1861
|
+
async function applyMigrationsWithStatus(ctx, migrations) {
|
|
1862
|
+
assertDraft(ctx);
|
|
1863
|
+
const revisionId = await ctx.getRevisionId();
|
|
1864
|
+
return unwrap(await applyMigrations$1({
|
|
1865
|
+
client: ctx.client,
|
|
1866
|
+
path: { revisionId },
|
|
1867
|
+
body: migrations
|
|
1868
|
+
}));
|
|
1869
|
+
}
|
|
1624
1870
|
async function getTables(ctx, options) {
|
|
1625
1871
|
const revisionId = await ctx.getRevisionId();
|
|
1626
1872
|
return unwrap(await tables({
|
|
@@ -1652,33 +1898,62 @@ async function getTableSchema(ctx, tableId) {
|
|
|
1652
1898
|
}
|
|
1653
1899
|
}));
|
|
1654
1900
|
}
|
|
1655
|
-
async function
|
|
1901
|
+
async function getTableCountRows(ctx, tableId) {
|
|
1656
1902
|
const revisionId = await ctx.getRevisionId();
|
|
1657
|
-
return unwrap(await
|
|
1903
|
+
return unwrap(await tableCountRows({
|
|
1904
|
+
client: ctx.client,
|
|
1905
|
+
path: {
|
|
1906
|
+
revisionId,
|
|
1907
|
+
tableId
|
|
1908
|
+
}
|
|
1909
|
+
}));
|
|
1910
|
+
}
|
|
1911
|
+
async function getTableForeignKeysBy(ctx, tableId, options) {
|
|
1912
|
+
const revisionId = await ctx.getRevisionId();
|
|
1913
|
+
return unwrap(await tableForeignKeysBy({
|
|
1658
1914
|
client: ctx.client,
|
|
1659
1915
|
path: {
|
|
1660
1916
|
revisionId,
|
|
1661
1917
|
tableId
|
|
1662
1918
|
},
|
|
1663
|
-
|
|
1919
|
+
query: {
|
|
1920
|
+
first: options?.first ?? 100,
|
|
1921
|
+
after: options?.after
|
|
1922
|
+
}
|
|
1664
1923
|
}));
|
|
1665
1924
|
}
|
|
1666
|
-
async function
|
|
1925
|
+
async function getTableForeignKeysTo(ctx, tableId, options) {
|
|
1667
1926
|
const revisionId = await ctx.getRevisionId();
|
|
1668
|
-
return unwrap(await
|
|
1927
|
+
return unwrap(await tableForeignKeysTo({
|
|
1669
1928
|
client: ctx.client,
|
|
1670
1929
|
path: {
|
|
1671
1930
|
revisionId,
|
|
1672
|
-
tableId
|
|
1673
|
-
|
|
1931
|
+
tableId
|
|
1932
|
+
},
|
|
1933
|
+
query: {
|
|
1934
|
+
first: options?.first ?? 100,
|
|
1935
|
+
after: options?.after
|
|
1674
1936
|
}
|
|
1675
1937
|
}));
|
|
1676
1938
|
}
|
|
1677
|
-
async function
|
|
1939
|
+
async function getTableCountForeignKeysBy(ctx, tableId) {
|
|
1678
1940
|
const revisionId = await ctx.getRevisionId();
|
|
1679
|
-
return unwrap(await
|
|
1941
|
+
return unwrap(await tableCountForeignKeysBy({
|
|
1680
1942
|
client: ctx.client,
|
|
1681
|
-
path: {
|
|
1943
|
+
path: {
|
|
1944
|
+
revisionId,
|
|
1945
|
+
tableId
|
|
1946
|
+
}
|
|
1947
|
+
}));
|
|
1948
|
+
}
|
|
1949
|
+
async function getTableCountForeignKeysTo(ctx, tableId) {
|
|
1950
|
+
const revisionId = await ctx.getRevisionId();
|
|
1951
|
+
return unwrap(await tableCountForeignKeysTo({
|
|
1952
|
+
client: ctx.client,
|
|
1953
|
+
path: {
|
|
1954
|
+
revisionId,
|
|
1955
|
+
tableId
|
|
1956
|
+
}
|
|
1682
1957
|
}));
|
|
1683
1958
|
}
|
|
1684
1959
|
async function createTable(ctx, tableId, schema) {
|
|
@@ -1728,6 +2003,82 @@ async function renameTable(ctx, tableId, nextTableId) {
|
|
|
1728
2003
|
body: { nextTableId }
|
|
1729
2004
|
}));
|
|
1730
2005
|
}
|
|
2006
|
+
async function getRows(ctx, tableId, options) {
|
|
2007
|
+
const revisionId = await ctx.getRevisionId();
|
|
2008
|
+
return unwrap(await rows({
|
|
2009
|
+
client: ctx.client,
|
|
2010
|
+
path: {
|
|
2011
|
+
revisionId,
|
|
2012
|
+
tableId
|
|
2013
|
+
},
|
|
2014
|
+
body: options ?? { first: 100 }
|
|
2015
|
+
}));
|
|
2016
|
+
}
|
|
2017
|
+
async function getRow(ctx, tableId, rowId) {
|
|
2018
|
+
const revisionId = await ctx.getRevisionId();
|
|
2019
|
+
return unwrap(await row({
|
|
2020
|
+
client: ctx.client,
|
|
2021
|
+
path: {
|
|
2022
|
+
revisionId,
|
|
2023
|
+
tableId,
|
|
2024
|
+
rowId
|
|
2025
|
+
}
|
|
2026
|
+
}));
|
|
2027
|
+
}
|
|
2028
|
+
async function getRowForeignKeysBy(ctx, tableId, rowId, foreignKeyByTableId, options) {
|
|
2029
|
+
const revisionId = await ctx.getRevisionId();
|
|
2030
|
+
return unwrap(await rowForeignKeysBy({
|
|
2031
|
+
client: ctx.client,
|
|
2032
|
+
path: {
|
|
2033
|
+
revisionId,
|
|
2034
|
+
tableId,
|
|
2035
|
+
rowId
|
|
2036
|
+
},
|
|
2037
|
+
query: {
|
|
2038
|
+
foreignKeyByTableId,
|
|
2039
|
+
first: options?.first ?? 100,
|
|
2040
|
+
after: options?.after
|
|
2041
|
+
}
|
|
2042
|
+
}));
|
|
2043
|
+
}
|
|
2044
|
+
async function getRowForeignKeysTo(ctx, tableId, rowId, foreignKeyToTableId, options) {
|
|
2045
|
+
const revisionId = await ctx.getRevisionId();
|
|
2046
|
+
return unwrap(await rowForeignKeysTo({
|
|
2047
|
+
client: ctx.client,
|
|
2048
|
+
path: {
|
|
2049
|
+
revisionId,
|
|
2050
|
+
tableId,
|
|
2051
|
+
rowId
|
|
2052
|
+
},
|
|
2053
|
+
query: {
|
|
2054
|
+
foreignKeyToTableId,
|
|
2055
|
+
first: options?.first ?? 100,
|
|
2056
|
+
after: options?.after
|
|
2057
|
+
}
|
|
2058
|
+
}));
|
|
2059
|
+
}
|
|
2060
|
+
async function getRowCountForeignKeysBy(ctx, tableId, rowId) {
|
|
2061
|
+
const revisionId = await ctx.getRevisionId();
|
|
2062
|
+
return unwrap(await rowCountForeignKeysBy({
|
|
2063
|
+
client: ctx.client,
|
|
2064
|
+
path: {
|
|
2065
|
+
revisionId,
|
|
2066
|
+
tableId,
|
|
2067
|
+
rowId
|
|
2068
|
+
}
|
|
2069
|
+
}));
|
|
2070
|
+
}
|
|
2071
|
+
async function getRowCountForeignKeysTo(ctx, tableId, rowId) {
|
|
2072
|
+
const revisionId = await ctx.getRevisionId();
|
|
2073
|
+
return unwrap(await rowCountForeignKeysTo({
|
|
2074
|
+
client: ctx.client,
|
|
2075
|
+
path: {
|
|
2076
|
+
revisionId,
|
|
2077
|
+
tableId,
|
|
2078
|
+
rowId
|
|
2079
|
+
}
|
|
2080
|
+
}));
|
|
2081
|
+
}
|
|
1731
2082
|
async function createRow(ctx, tableId, rowId, data) {
|
|
1732
2083
|
assertDraft(ctx);
|
|
1733
2084
|
const revisionId = await ctx.getRevisionId();
|
|
@@ -1743,7 +2094,7 @@ async function createRow(ctx, tableId, rowId, data) {
|
|
|
1743
2094
|
}
|
|
1744
2095
|
}));
|
|
1745
2096
|
}
|
|
1746
|
-
async function createRows(ctx, tableId, rows) {
|
|
2097
|
+
async function createRows(ctx, tableId, rows, options) {
|
|
1747
2098
|
assertDraft(ctx);
|
|
1748
2099
|
const revisionId = await ctx.getRevisionId();
|
|
1749
2100
|
return unwrap(await createRows$1({
|
|
@@ -1752,10 +2103,13 @@ async function createRows(ctx, tableId, rows) {
|
|
|
1752
2103
|
revisionId,
|
|
1753
2104
|
tableId
|
|
1754
2105
|
},
|
|
1755
|
-
body: {
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
2106
|
+
body: {
|
|
2107
|
+
rows: rows.map((r) => ({
|
|
2108
|
+
rowId: r.rowId,
|
|
2109
|
+
data: r.data
|
|
2110
|
+
})),
|
|
2111
|
+
isRestore: options?.isRestore
|
|
2112
|
+
}
|
|
1759
2113
|
}));
|
|
1760
2114
|
}
|
|
1761
2115
|
async function updateRow(ctx, tableId, rowId, data) {
|
|
@@ -1771,7 +2125,7 @@ async function updateRow(ctx, tableId, rowId, data) {
|
|
|
1771
2125
|
body: { data }
|
|
1772
2126
|
}));
|
|
1773
2127
|
}
|
|
1774
|
-
async function updateRows(ctx, tableId, rows) {
|
|
2128
|
+
async function updateRows(ctx, tableId, rows, options) {
|
|
1775
2129
|
assertDraft(ctx);
|
|
1776
2130
|
const revisionId = await ctx.getRevisionId();
|
|
1777
2131
|
return unwrap(await updateRows$1({
|
|
@@ -1780,10 +2134,13 @@ async function updateRows(ctx, tableId, rows) {
|
|
|
1780
2134
|
revisionId,
|
|
1781
2135
|
tableId
|
|
1782
2136
|
},
|
|
1783
|
-
body: {
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
2137
|
+
body: {
|
|
2138
|
+
rows: rows.map((r) => ({
|
|
2139
|
+
rowId: r.rowId,
|
|
2140
|
+
data: r.data
|
|
2141
|
+
})),
|
|
2142
|
+
isRestore: options?.isRestore
|
|
2143
|
+
}
|
|
1787
2144
|
}));
|
|
1788
2145
|
}
|
|
1789
2146
|
async function patchRow(ctx, tableId, rowId, patches) {
|
|
@@ -1796,7 +2153,19 @@ async function patchRow(ctx, tableId, rowId, patches) {
|
|
|
1796
2153
|
tableId,
|
|
1797
2154
|
rowId
|
|
1798
2155
|
},
|
|
1799
|
-
body: { patches }
|
|
2156
|
+
body: { patches }
|
|
2157
|
+
}));
|
|
2158
|
+
}
|
|
2159
|
+
async function patchRows(ctx, tableId, body) {
|
|
2160
|
+
assertDraft(ctx);
|
|
2161
|
+
const revisionId = await ctx.getRevisionId();
|
|
2162
|
+
return unwrap(await patchRows$1({
|
|
2163
|
+
client: ctx.client,
|
|
2164
|
+
path: {
|
|
2165
|
+
revisionId,
|
|
2166
|
+
tableId
|
|
2167
|
+
},
|
|
2168
|
+
body
|
|
1800
2169
|
}));
|
|
1801
2170
|
}
|
|
1802
2171
|
async function deleteRow(ctx, tableId, rowId) {
|
|
@@ -1836,6 +2205,35 @@ async function renameRow(ctx, tableId, rowId, nextRowId) {
|
|
|
1836
2205
|
body: { nextRowId }
|
|
1837
2206
|
}));
|
|
1838
2207
|
}
|
|
2208
|
+
async function getChanges(ctx) {
|
|
2209
|
+
const revisionId = await ctx.getRevisionId();
|
|
2210
|
+
return unwrap(await revisionChanges({
|
|
2211
|
+
client: ctx.client,
|
|
2212
|
+
path: { revisionId }
|
|
2213
|
+
}));
|
|
2214
|
+
}
|
|
2215
|
+
async function getTableChanges(ctx, options) {
|
|
2216
|
+
const revisionId = await ctx.getRevisionId();
|
|
2217
|
+
return unwrap(await tableChanges({
|
|
2218
|
+
client: ctx.client,
|
|
2219
|
+
path: { revisionId },
|
|
2220
|
+
query: {
|
|
2221
|
+
...options,
|
|
2222
|
+
first: options?.first ?? 100
|
|
2223
|
+
}
|
|
2224
|
+
}));
|
|
2225
|
+
}
|
|
2226
|
+
async function getRowChanges(ctx, options) {
|
|
2227
|
+
const revisionId = await ctx.getRevisionId();
|
|
2228
|
+
return unwrap(await rowChanges({
|
|
2229
|
+
client: ctx.client,
|
|
2230
|
+
path: { revisionId },
|
|
2231
|
+
query: {
|
|
2232
|
+
...options,
|
|
2233
|
+
first: options?.first ?? 100
|
|
2234
|
+
}
|
|
2235
|
+
}));
|
|
2236
|
+
}
|
|
1839
2237
|
async function commit(ctx, comment) {
|
|
1840
2238
|
assertDraft(ctx);
|
|
1841
2239
|
return unwrap(await createRevision({
|
|
@@ -1859,36 +2257,51 @@ async function revertChanges(ctx) {
|
|
|
1859
2257
|
}
|
|
1860
2258
|
}));
|
|
1861
2259
|
}
|
|
1862
|
-
async function
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
branchName: branch.branchName
|
|
1869
|
-
}
|
|
1870
|
-
})).id;
|
|
2260
|
+
async function getEndpoints(ctx) {
|
|
2261
|
+
const revisionId = await ctx.getRevisionId();
|
|
2262
|
+
return unwrap(await endpoints({
|
|
2263
|
+
client: ctx.client,
|
|
2264
|
+
path: { revisionId }
|
|
2265
|
+
}));
|
|
1871
2266
|
}
|
|
1872
|
-
async function
|
|
1873
|
-
|
|
2267
|
+
async function createEndpoint(ctx, body) {
|
|
2268
|
+
const revisionId = await ctx.getRevisionId();
|
|
2269
|
+
return unwrap(await createEndpoint$1({
|
|
2270
|
+
client: ctx.client,
|
|
2271
|
+
path: { revisionId },
|
|
2272
|
+
body
|
|
2273
|
+
}));
|
|
2274
|
+
}
|
|
2275
|
+
async function deleteEndpoint(client, endpointId) {
|
|
2276
|
+
unwrap(await deleteEndpoint$1({
|
|
1874
2277
|
client,
|
|
1875
|
-
path: {
|
|
1876
|
-
|
|
1877
|
-
projectName: branch.projectName,
|
|
1878
|
-
branchName: branch.branchName
|
|
1879
|
-
}
|
|
1880
|
-
})).id;
|
|
2278
|
+
path: { endpointId }
|
|
2279
|
+
}));
|
|
1881
2280
|
}
|
|
1882
|
-
async function
|
|
1883
|
-
unwrap(await
|
|
2281
|
+
async function getEndpointRelatives(client, endpointId) {
|
|
2282
|
+
return unwrap(await endpointRelatives({
|
|
1884
2283
|
client,
|
|
1885
|
-
path: {
|
|
2284
|
+
path: { endpointId }
|
|
2285
|
+
}));
|
|
2286
|
+
}
|
|
2287
|
+
async function uploadFile(ctx, tableId, rowId, fileId, file) {
|
|
2288
|
+
assertDraft(ctx);
|
|
2289
|
+
const revisionId = await ctx.getRevisionId();
|
|
2290
|
+
return unwrap(await uploadFile$1({
|
|
2291
|
+
client: ctx.client,
|
|
2292
|
+
path: {
|
|
2293
|
+
revisionId,
|
|
2294
|
+
tableId,
|
|
2295
|
+
rowId,
|
|
2296
|
+
fileId
|
|
2297
|
+
},
|
|
2298
|
+
body: { file }
|
|
1886
2299
|
}));
|
|
1887
2300
|
}
|
|
1888
2301
|
|
|
1889
2302
|
//#endregion
|
|
1890
|
-
//#region src/
|
|
1891
|
-
var
|
|
2303
|
+
//#region src/revision-scope.ts
|
|
2304
|
+
var RevisionScope = class {
|
|
1892
2305
|
_client;
|
|
1893
2306
|
_branch;
|
|
1894
2307
|
_revisionMode;
|
|
@@ -1971,7 +2384,7 @@ var RevisiumScope = class {
|
|
|
1971
2384
|
}
|
|
1972
2385
|
return this._revisionId;
|
|
1973
2386
|
}
|
|
1974
|
-
get
|
|
2387
|
+
get context() {
|
|
1975
2388
|
return {
|
|
1976
2389
|
client: this._client,
|
|
1977
2390
|
branch: this._branch,
|
|
@@ -1980,62 +2393,119 @@ var RevisiumScope = class {
|
|
|
1980
2393
|
};
|
|
1981
2394
|
}
|
|
1982
2395
|
async getTables(options) {
|
|
1983
|
-
return getTables(this.
|
|
2396
|
+
return getTables(this.context, options);
|
|
1984
2397
|
}
|
|
1985
2398
|
async getTable(tableId) {
|
|
1986
|
-
return getTable(this.
|
|
2399
|
+
return getTable(this.context, tableId);
|
|
1987
2400
|
}
|
|
1988
2401
|
async getTableSchema(tableId) {
|
|
1989
|
-
return getTableSchema(this.
|
|
2402
|
+
return getTableSchema(this.context, tableId);
|
|
1990
2403
|
}
|
|
1991
|
-
async
|
|
1992
|
-
return
|
|
2404
|
+
async getTableCountRows(tableId) {
|
|
2405
|
+
return getTableCountRows(this.context, tableId);
|
|
1993
2406
|
}
|
|
1994
|
-
async
|
|
1995
|
-
return
|
|
2407
|
+
async getTableForeignKeysBy(tableId, options) {
|
|
2408
|
+
return getTableForeignKeysBy(this.context, tableId, options);
|
|
1996
2409
|
}
|
|
1997
|
-
async
|
|
1998
|
-
return
|
|
2410
|
+
async getTableForeignKeysTo(tableId, options) {
|
|
2411
|
+
return getTableForeignKeysTo(this.context, tableId, options);
|
|
2412
|
+
}
|
|
2413
|
+
async getTableCountForeignKeysBy(tableId) {
|
|
2414
|
+
return getTableCountForeignKeysBy(this.context, tableId);
|
|
2415
|
+
}
|
|
2416
|
+
async getTableCountForeignKeysTo(tableId) {
|
|
2417
|
+
return getTableCountForeignKeysTo(this.context, tableId);
|
|
1999
2418
|
}
|
|
2000
2419
|
async createTable(tableId, schema) {
|
|
2001
|
-
return createTable(this.
|
|
2420
|
+
return createTable(this.context, tableId, schema);
|
|
2002
2421
|
}
|
|
2003
2422
|
async updateTable(tableId, patches) {
|
|
2004
|
-
return updateTable(this.
|
|
2423
|
+
return updateTable(this.context, tableId, patches);
|
|
2005
2424
|
}
|
|
2006
2425
|
async deleteTable(tableId) {
|
|
2007
|
-
return deleteTable(this.
|
|
2426
|
+
return deleteTable(this.context, tableId);
|
|
2008
2427
|
}
|
|
2009
2428
|
async renameTable(tableId, nextTableId) {
|
|
2010
|
-
return renameTable(this.
|
|
2429
|
+
return renameTable(this.context, tableId, nextTableId);
|
|
2430
|
+
}
|
|
2431
|
+
async getRows(tableId, options) {
|
|
2432
|
+
return getRows(this.context, tableId, options);
|
|
2433
|
+
}
|
|
2434
|
+
async getRow(tableId, rowId) {
|
|
2435
|
+
return getRow(this.context, tableId, rowId);
|
|
2436
|
+
}
|
|
2437
|
+
async getRowForeignKeysBy(tableId, rowId, foreignKeyByTableId, options) {
|
|
2438
|
+
return getRowForeignKeysBy(this.context, tableId, rowId, foreignKeyByTableId, options);
|
|
2439
|
+
}
|
|
2440
|
+
async getRowForeignKeysTo(tableId, rowId, foreignKeyToTableId, options) {
|
|
2441
|
+
return getRowForeignKeysTo(this.context, tableId, rowId, foreignKeyToTableId, options);
|
|
2442
|
+
}
|
|
2443
|
+
async getRowCountForeignKeysBy(tableId, rowId) {
|
|
2444
|
+
return getRowCountForeignKeysBy(this.context, tableId, rowId);
|
|
2445
|
+
}
|
|
2446
|
+
async getRowCountForeignKeysTo(tableId, rowId) {
|
|
2447
|
+
return getRowCountForeignKeysTo(this.context, tableId, rowId);
|
|
2011
2448
|
}
|
|
2012
2449
|
async createRow(tableId, rowId, data) {
|
|
2013
|
-
return createRow(this.
|
|
2450
|
+
return createRow(this.context, tableId, rowId, data);
|
|
2014
2451
|
}
|
|
2015
|
-
async createRows(tableId, rows) {
|
|
2016
|
-
return createRows(this.
|
|
2452
|
+
async createRows(tableId, rows, options) {
|
|
2453
|
+
return createRows(this.context, tableId, rows, options);
|
|
2017
2454
|
}
|
|
2018
2455
|
async updateRow(tableId, rowId, data) {
|
|
2019
|
-
return updateRow(this.
|
|
2456
|
+
return updateRow(this.context, tableId, rowId, data);
|
|
2020
2457
|
}
|
|
2021
|
-
async updateRows(tableId, rows) {
|
|
2022
|
-
return updateRows(this.
|
|
2458
|
+
async updateRows(tableId, rows, options) {
|
|
2459
|
+
return updateRows(this.context, tableId, rows, options);
|
|
2023
2460
|
}
|
|
2024
2461
|
async patchRow(tableId, rowId, patches) {
|
|
2025
|
-
return patchRow(this.
|
|
2462
|
+
return patchRow(this.context, tableId, rowId, patches);
|
|
2463
|
+
}
|
|
2464
|
+
async patchRows(tableId, body) {
|
|
2465
|
+
return patchRows(this.context, tableId, body);
|
|
2026
2466
|
}
|
|
2027
2467
|
async deleteRow(tableId, rowId) {
|
|
2028
|
-
return deleteRow(this.
|
|
2468
|
+
return deleteRow(this.context, tableId, rowId);
|
|
2029
2469
|
}
|
|
2030
2470
|
async deleteRows(tableId, rowIds) {
|
|
2031
|
-
return deleteRows(this.
|
|
2471
|
+
return deleteRows(this.context, tableId, rowIds);
|
|
2032
2472
|
}
|
|
2033
2473
|
async renameRow(tableId, rowId, nextRowId) {
|
|
2034
|
-
return renameRow(this.
|
|
2474
|
+
return renameRow(this.context, tableId, rowId, nextRowId);
|
|
2475
|
+
}
|
|
2476
|
+
async getChanges() {
|
|
2477
|
+
return getChanges(this.context);
|
|
2478
|
+
}
|
|
2479
|
+
async getTableChanges(options) {
|
|
2480
|
+
return getTableChanges(this.context, options);
|
|
2481
|
+
}
|
|
2482
|
+
async getRowChanges(options) {
|
|
2483
|
+
return getRowChanges(this.context, options);
|
|
2484
|
+
}
|
|
2485
|
+
async getMigrations() {
|
|
2486
|
+
return getMigrations(this.context);
|
|
2487
|
+
}
|
|
2488
|
+
async applyMigrations(migrations) {
|
|
2489
|
+
this.assertNotDisposed();
|
|
2490
|
+
await applyMigrations(this.context, migrations);
|
|
2491
|
+
await this._owner.refreshRevisionIds();
|
|
2492
|
+
this._revisionId = await fetchDraftRevisionId(this._client, this._branch);
|
|
2493
|
+
this._stale = false;
|
|
2494
|
+
this._owner.notifyBranchChanged(this._branchKey, this);
|
|
2495
|
+
}
|
|
2496
|
+
async applyMigrationsWithStatus(migrations) {
|
|
2497
|
+
this.assertNotDisposed();
|
|
2498
|
+
const result = await applyMigrationsWithStatus(this.context, migrations);
|
|
2499
|
+
await this._owner.refreshRevisionIds();
|
|
2500
|
+
this._revisionId = await fetchDraftRevisionId(this._client, this._branch);
|
|
2501
|
+
this._stale = false;
|
|
2502
|
+
this._owner.notifyBranchChanged(this._branchKey, this);
|
|
2503
|
+
return result;
|
|
2035
2504
|
}
|
|
2036
2505
|
async commit(comment) {
|
|
2037
2506
|
this.assertNotDisposed();
|
|
2038
|
-
const data = await commit(this.
|
|
2507
|
+
const data = await commit(this.context, comment);
|
|
2508
|
+
await this._owner.refreshRevisionIds();
|
|
2039
2509
|
this._revisionId = await fetchDraftRevisionId(this._client, this._branch);
|
|
2040
2510
|
this._stale = false;
|
|
2041
2511
|
this._owner.notifyBranchChanged(this._branchKey, this);
|
|
@@ -2043,242 +2513,308 @@ var RevisiumScope = class {
|
|
|
2043
2513
|
}
|
|
2044
2514
|
async revertChanges() {
|
|
2045
2515
|
this.assertNotDisposed();
|
|
2046
|
-
await revertChanges(this.
|
|
2516
|
+
await revertChanges(this.context);
|
|
2517
|
+
await this._owner.refreshRevisionIds();
|
|
2047
2518
|
this._revisionId = await fetchDraftRevisionId(this._client, this._branch);
|
|
2048
2519
|
this._stale = false;
|
|
2049
2520
|
this._owner.notifyBranchChanged(this._branchKey, this);
|
|
2050
2521
|
}
|
|
2522
|
+
async getEndpoints() {
|
|
2523
|
+
return getEndpoints(this.context);
|
|
2524
|
+
}
|
|
2525
|
+
async createEndpoint(body) {
|
|
2526
|
+
return createEndpoint(this.context, body);
|
|
2527
|
+
}
|
|
2528
|
+
async deleteEndpoint(endpointId) {
|
|
2529
|
+
this.assertNotDisposed();
|
|
2530
|
+
return deleteEndpoint(this._client, endpointId);
|
|
2531
|
+
}
|
|
2532
|
+
async getEndpointRelatives(endpointId) {
|
|
2533
|
+
this.assertNotDisposed();
|
|
2534
|
+
return getEndpointRelatives(this._client, endpointId);
|
|
2535
|
+
}
|
|
2536
|
+
async uploadFile(tableId, rowId, fileId, file) {
|
|
2537
|
+
return uploadFile(this.context, tableId, rowId, fileId, file);
|
|
2538
|
+
}
|
|
2051
2539
|
};
|
|
2052
2540
|
|
|
2053
2541
|
//#endregion
|
|
2054
|
-
//#region src/
|
|
2055
|
-
var
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
const
|
|
2067
|
-
|
|
2068
|
-
this._client = createClient(createConfig({ baseUrl: this._baseUrl }));
|
|
2069
|
-
}
|
|
2070
|
-
get baseUrl() {
|
|
2071
|
-
return this._baseUrl;
|
|
2542
|
+
//#region src/branch-scope.ts
|
|
2543
|
+
var BranchScope = class BranchScope {
|
|
2544
|
+
_headRevisionId;
|
|
2545
|
+
_draftRevisionId;
|
|
2546
|
+
_scopes = /* @__PURE__ */ new Set();
|
|
2547
|
+
constructor(_client, _branch, headRevisionId, draftRevisionId) {
|
|
2548
|
+
this._client = _client;
|
|
2549
|
+
this._branch = _branch;
|
|
2550
|
+
this._headRevisionId = headRevisionId;
|
|
2551
|
+
this._draftRevisionId = draftRevisionId;
|
|
2552
|
+
}
|
|
2553
|
+
static async create(client, branch) {
|
|
2554
|
+
const [headId, draftId] = await Promise.all([fetchHeadRevisionId(client, branch), fetchDraftRevisionId(client, branch)]);
|
|
2555
|
+
return new BranchScope(client, branch, headId, draftId);
|
|
2072
2556
|
}
|
|
2073
2557
|
get organizationId() {
|
|
2074
|
-
return this.
|
|
2558
|
+
return this._branch.organizationId;
|
|
2075
2559
|
}
|
|
2076
2560
|
get projectName() {
|
|
2077
|
-
return this.
|
|
2561
|
+
return this._branch.projectName;
|
|
2078
2562
|
}
|
|
2079
2563
|
get branchName() {
|
|
2080
|
-
return this.
|
|
2564
|
+
return this._branch.branchName;
|
|
2081
2565
|
}
|
|
2082
|
-
get
|
|
2083
|
-
return this.
|
|
2566
|
+
get headRevisionId() {
|
|
2567
|
+
return this._headRevisionId;
|
|
2084
2568
|
}
|
|
2085
|
-
get
|
|
2086
|
-
return this.
|
|
2569
|
+
get draftRevisionId() {
|
|
2570
|
+
return this._draftRevisionId;
|
|
2087
2571
|
}
|
|
2088
2572
|
get client() {
|
|
2089
2573
|
return this._client;
|
|
2090
2574
|
}
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
}
|
|
2094
|
-
async login(username, password) {
|
|
2095
|
-
const result = await login({
|
|
2575
|
+
draft() {
|
|
2576
|
+
const scope = new RevisionScope({
|
|
2096
2577
|
client: this._client,
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2578
|
+
branch: this._branch,
|
|
2579
|
+
revisionId: this._draftRevisionId,
|
|
2580
|
+
isDraft: true,
|
|
2581
|
+
revisionMode: "draft",
|
|
2582
|
+
owner: this
|
|
2101
2583
|
});
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
this._isAuthenticated = true;
|
|
2105
|
-
}
|
|
2106
|
-
loginWithToken(token) {
|
|
2107
|
-
this._client.setConfig({ auth: token });
|
|
2108
|
-
this._isAuthenticated = true;
|
|
2584
|
+
this._scopes.add(scope);
|
|
2585
|
+
return scope;
|
|
2109
2586
|
}
|
|
2110
|
-
|
|
2111
|
-
const
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
this._revisionId = await fetchDraftRevisionId(this._client, branch);
|
|
2122
|
-
this._isDraft = true;
|
|
2123
|
-
} else if (revision === "head") {
|
|
2124
|
-
this._revisionId = await fetchHeadRevisionId(this._client, branch);
|
|
2125
|
-
this._isDraft = false;
|
|
2126
|
-
} else {
|
|
2127
|
-
await validateRevisionId(this._client, revision);
|
|
2128
|
-
this._revisionId = revision;
|
|
2129
|
-
this._isDraft = false;
|
|
2130
|
-
}
|
|
2587
|
+
head() {
|
|
2588
|
+
const scope = new RevisionScope({
|
|
2589
|
+
client: this._client,
|
|
2590
|
+
branch: this._branch,
|
|
2591
|
+
revisionId: this._headRevisionId,
|
|
2592
|
+
isDraft: false,
|
|
2593
|
+
revisionMode: "head",
|
|
2594
|
+
owner: this
|
|
2595
|
+
});
|
|
2596
|
+
this._scopes.add(scope);
|
|
2597
|
+
return scope;
|
|
2131
2598
|
}
|
|
2132
|
-
async
|
|
2133
|
-
|
|
2134
|
-
const
|
|
2135
|
-
organizationId,
|
|
2136
|
-
projectName,
|
|
2137
|
-
branchName
|
|
2138
|
-
};
|
|
2139
|
-
let revisionId;
|
|
2140
|
-
let isDraft;
|
|
2141
|
-
let revisionMode;
|
|
2142
|
-
if (revision === "draft") {
|
|
2143
|
-
revisionId = await fetchDraftRevisionId(this._client, branch);
|
|
2144
|
-
isDraft = true;
|
|
2145
|
-
revisionMode = "draft";
|
|
2146
|
-
} else if (revision === "head") {
|
|
2147
|
-
revisionId = await fetchHeadRevisionId(this._client, branch);
|
|
2148
|
-
isDraft = false;
|
|
2149
|
-
revisionMode = "head";
|
|
2150
|
-
} else {
|
|
2151
|
-
await validateRevisionId(this._client, revision);
|
|
2152
|
-
revisionId = revision;
|
|
2153
|
-
isDraft = false;
|
|
2154
|
-
revisionMode = "explicit";
|
|
2155
|
-
}
|
|
2156
|
-
const scope = new RevisiumScope({
|
|
2599
|
+
async revision(revisionId) {
|
|
2600
|
+
await validateRevisionId(this._client, revisionId);
|
|
2601
|
+
const scope = new RevisionScope({
|
|
2157
2602
|
client: this._client,
|
|
2158
|
-
branch,
|
|
2603
|
+
branch: this._branch,
|
|
2159
2604
|
revisionId,
|
|
2160
|
-
isDraft,
|
|
2161
|
-
revisionMode,
|
|
2605
|
+
isDraft: false,
|
|
2606
|
+
revisionMode: "explicit",
|
|
2162
2607
|
owner: this
|
|
2163
2608
|
});
|
|
2164
|
-
|
|
2165
|
-
let scopeSet = this._scopes.get(branchKey);
|
|
2166
|
-
if (!scopeSet) {
|
|
2167
|
-
scopeSet = /* @__PURE__ */ new Set();
|
|
2168
|
-
this._scopes.set(branchKey, scopeSet);
|
|
2169
|
-
}
|
|
2170
|
-
scopeSet.add(scope);
|
|
2609
|
+
this._scopes.add(scope);
|
|
2171
2610
|
return scope;
|
|
2172
2611
|
}
|
|
2612
|
+
async get() {
|
|
2613
|
+
return getBranch(this._client, this._branch);
|
|
2614
|
+
}
|
|
2615
|
+
async delete() {
|
|
2616
|
+
return deleteBranch(this._client, this._branch);
|
|
2617
|
+
}
|
|
2618
|
+
async getTouched() {
|
|
2619
|
+
return getBranchTouched(this._client, this._branch);
|
|
2620
|
+
}
|
|
2621
|
+
async getRevisions(options) {
|
|
2622
|
+
return getRevisions(this._client, this._branch, options);
|
|
2623
|
+
}
|
|
2624
|
+
async getStartRevision() {
|
|
2625
|
+
return getStartRevision(this._client, this._branch);
|
|
2626
|
+
}
|
|
2173
2627
|
notifyBranchChanged(branchKey, excludeScope) {
|
|
2174
|
-
|
|
2175
|
-
if (
|
|
2176
|
-
for (const scope of scopeSet) if (scope !== excludeScope) scope.markStale();
|
|
2628
|
+
if (branchKey !== `${this._branch.organizationId}/${this._branch.projectName}/${this._branch.branchName}`) return;
|
|
2629
|
+
for (const scope of this._scopes) if (scope !== excludeScope) scope.markStale();
|
|
2177
2630
|
}
|
|
2178
2631
|
unregisterScope(scope) {
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2632
|
+
this._scopes.delete(scope);
|
|
2633
|
+
}
|
|
2634
|
+
async refreshRevisionIds() {
|
|
2635
|
+
const [headId, draftId] = await Promise.all([fetchHeadRevisionId(this._client, this._branch), fetchDraftRevisionId(this._client, this._branch)]);
|
|
2636
|
+
this._headRevisionId = headId;
|
|
2637
|
+
this._draftRevisionId = draftId;
|
|
2638
|
+
}
|
|
2639
|
+
};
|
|
2640
|
+
|
|
2641
|
+
//#endregion
|
|
2642
|
+
//#region src/project-scope.ts
|
|
2643
|
+
var ProjectScope = class {
|
|
2644
|
+
constructor(_client, _organizationId, _projectName) {
|
|
2645
|
+
this._client = _client;
|
|
2646
|
+
this._organizationId = _organizationId;
|
|
2647
|
+
this._projectName = _projectName;
|
|
2648
|
+
}
|
|
2649
|
+
get organizationId() {
|
|
2650
|
+
return this._organizationId;
|
|
2651
|
+
}
|
|
2652
|
+
get projectName() {
|
|
2653
|
+
return this._projectName;
|
|
2654
|
+
}
|
|
2655
|
+
get client() {
|
|
2656
|
+
return this._client;
|
|
2657
|
+
}
|
|
2658
|
+
async branch(branchName) {
|
|
2659
|
+
return BranchScope.create(this._client, {
|
|
2660
|
+
client: this._client,
|
|
2661
|
+
organizationId: this._organizationId,
|
|
2662
|
+
projectName: this._projectName,
|
|
2663
|
+
branchName: branchName ?? "master"
|
|
2664
|
+
});
|
|
2183
2665
|
}
|
|
2184
|
-
get
|
|
2666
|
+
get projectContext() {
|
|
2185
2667
|
return {
|
|
2186
2668
|
client: this._client,
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
projectName: this._projectName ?? "",
|
|
2190
|
-
branchName: this._branchName ?? ""
|
|
2191
|
-
},
|
|
2192
|
-
isDraft: this._isDraft,
|
|
2193
|
-
getRevisionId: () => {
|
|
2194
|
-
if (this._revisionId === null) return Promise.reject(/* @__PURE__ */ new Error("Context not set. Call setContext() first."));
|
|
2195
|
-
return Promise.resolve(this._revisionId);
|
|
2196
|
-
}
|
|
2669
|
+
organizationId: this._organizationId,
|
|
2670
|
+
projectName: this._projectName
|
|
2197
2671
|
};
|
|
2198
2672
|
}
|
|
2199
|
-
async
|
|
2200
|
-
return
|
|
2673
|
+
async get() {
|
|
2674
|
+
return getProject(this.projectContext);
|
|
2201
2675
|
}
|
|
2202
|
-
async
|
|
2203
|
-
return
|
|
2676
|
+
async update(body) {
|
|
2677
|
+
return updateProject(this.projectContext, body);
|
|
2204
2678
|
}
|
|
2205
|
-
async
|
|
2206
|
-
return
|
|
2679
|
+
async delete() {
|
|
2680
|
+
return deleteProject(this.projectContext);
|
|
2207
2681
|
}
|
|
2208
|
-
async
|
|
2209
|
-
return
|
|
2682
|
+
async getBranches(options) {
|
|
2683
|
+
return getBranches(this.projectContext, options);
|
|
2210
2684
|
}
|
|
2211
|
-
async
|
|
2212
|
-
return
|
|
2685
|
+
async getRootBranch() {
|
|
2686
|
+
return getRootBranch(this.projectContext);
|
|
2213
2687
|
}
|
|
2214
|
-
async
|
|
2215
|
-
return
|
|
2688
|
+
async createBranch(branchName, revisionId) {
|
|
2689
|
+
return createBranch(this._client, revisionId, branchName);
|
|
2216
2690
|
}
|
|
2217
|
-
async
|
|
2218
|
-
return
|
|
2691
|
+
async getUsers(options) {
|
|
2692
|
+
return getProjectUsers(this.projectContext, options);
|
|
2219
2693
|
}
|
|
2220
|
-
async
|
|
2221
|
-
return
|
|
2694
|
+
async addUser(userId, roleId) {
|
|
2695
|
+
return addProjectUser(this.projectContext, userId, roleId);
|
|
2222
2696
|
}
|
|
2223
|
-
async
|
|
2224
|
-
return
|
|
2697
|
+
async removeUser(userId) {
|
|
2698
|
+
return removeProjectUser(this.projectContext, userId);
|
|
2225
2699
|
}
|
|
2226
|
-
async
|
|
2227
|
-
return
|
|
2700
|
+
async getEndpoints() {
|
|
2701
|
+
return (await this.branch()).draft().getEndpoints();
|
|
2228
2702
|
}
|
|
2229
|
-
async
|
|
2230
|
-
return
|
|
2703
|
+
async createEndpoint(body) {
|
|
2704
|
+
return (await this.branch()).draft().createEndpoint(body);
|
|
2231
2705
|
}
|
|
2232
|
-
async
|
|
2233
|
-
return
|
|
2706
|
+
async deleteEndpoint(endpointId) {
|
|
2707
|
+
return deleteEndpoint(this._client, endpointId);
|
|
2234
2708
|
}
|
|
2235
|
-
async
|
|
2236
|
-
return
|
|
2709
|
+
async getEndpointRelatives(endpointId) {
|
|
2710
|
+
return getEndpointRelatives(this._client, endpointId);
|
|
2237
2711
|
}
|
|
2238
|
-
|
|
2239
|
-
|
|
2712
|
+
};
|
|
2713
|
+
|
|
2714
|
+
//#endregion
|
|
2715
|
+
//#region src/org-scope.ts
|
|
2716
|
+
var OrgScope = class {
|
|
2717
|
+
constructor(_client, _organizationId) {
|
|
2718
|
+
this._client = _client;
|
|
2719
|
+
this._organizationId = _organizationId;
|
|
2240
2720
|
}
|
|
2241
|
-
|
|
2242
|
-
return
|
|
2721
|
+
get organizationId() {
|
|
2722
|
+
return this._organizationId;
|
|
2243
2723
|
}
|
|
2244
|
-
|
|
2245
|
-
return
|
|
2724
|
+
get client() {
|
|
2725
|
+
return this._client;
|
|
2246
2726
|
}
|
|
2247
|
-
|
|
2248
|
-
return
|
|
2727
|
+
project(projectName) {
|
|
2728
|
+
return new ProjectScope(this._client, this._organizationId, projectName);
|
|
2249
2729
|
}
|
|
2250
|
-
|
|
2251
|
-
return
|
|
2730
|
+
get orgContext() {
|
|
2731
|
+
return {
|
|
2732
|
+
client: this._client,
|
|
2733
|
+
organizationId: this._organizationId
|
|
2734
|
+
};
|
|
2252
2735
|
}
|
|
2253
|
-
async
|
|
2254
|
-
|
|
2255
|
-
await this.refreshDraftRevisionId();
|
|
2256
|
-
this.notifyScopesOnCurrentBranch();
|
|
2257
|
-
return data;
|
|
2736
|
+
async getProjects(options) {
|
|
2737
|
+
return getProjects(this.orgContext, options);
|
|
2258
2738
|
}
|
|
2259
|
-
async
|
|
2260
|
-
|
|
2261
|
-
await this.refreshDraftRevisionId();
|
|
2262
|
-
this.notifyScopesOnCurrentBranch();
|
|
2739
|
+
async createProject(body) {
|
|
2740
|
+
return createProject(this.orgContext, body);
|
|
2263
2741
|
}
|
|
2264
|
-
async
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2742
|
+
async getUsers(options) {
|
|
2743
|
+
return getOrgUsers(this.orgContext, options);
|
|
2744
|
+
}
|
|
2745
|
+
async addUser(userId, roleId) {
|
|
2746
|
+
return addOrgUser(this.orgContext, userId, roleId);
|
|
2747
|
+
}
|
|
2748
|
+
async removeUser(userId) {
|
|
2749
|
+
return removeOrgUser(this.orgContext, userId);
|
|
2750
|
+
}
|
|
2751
|
+
};
|
|
2752
|
+
|
|
2753
|
+
//#endregion
|
|
2754
|
+
//#region src/revisium-client.ts
|
|
2755
|
+
var RevisiumClient = class {
|
|
2756
|
+
_client;
|
|
2757
|
+
_baseUrl;
|
|
2758
|
+
_isAuthenticated = false;
|
|
2759
|
+
constructor(options) {
|
|
2760
|
+
const url = options.baseUrl;
|
|
2761
|
+
this._baseUrl = url.endsWith("/") ? url.slice(0, -1) : url;
|
|
2762
|
+
this._client = createClient(createConfig({ baseUrl: this._baseUrl }));
|
|
2763
|
+
}
|
|
2764
|
+
get baseUrl() {
|
|
2765
|
+
return this._baseUrl;
|
|
2766
|
+
}
|
|
2767
|
+
get client() {
|
|
2768
|
+
return this._client;
|
|
2769
|
+
}
|
|
2770
|
+
isAuthenticated() {
|
|
2771
|
+
return this._isAuthenticated;
|
|
2772
|
+
}
|
|
2773
|
+
async login(username, password) {
|
|
2774
|
+
const result = await login({
|
|
2775
|
+
client: this._client,
|
|
2776
|
+
body: {
|
|
2777
|
+
emailOrUsername: username,
|
|
2778
|
+
password
|
|
2779
|
+
}
|
|
2269
2780
|
});
|
|
2781
|
+
const data = unwrap(result);
|
|
2782
|
+
this._client.setConfig({ auth: data.accessToken });
|
|
2783
|
+
this._isAuthenticated = true;
|
|
2270
2784
|
}
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2785
|
+
loginWithToken(token) {
|
|
2786
|
+
this._client.setConfig({ auth: token });
|
|
2787
|
+
this._isAuthenticated = true;
|
|
2788
|
+
}
|
|
2789
|
+
async me() {
|
|
2790
|
+
return me(this._client);
|
|
2791
|
+
}
|
|
2792
|
+
org(organizationId) {
|
|
2793
|
+
return new OrgScope(this._client, organizationId);
|
|
2794
|
+
}
|
|
2795
|
+
async branch(options) {
|
|
2796
|
+
return BranchScope.create(this._client, {
|
|
2797
|
+
client: this._client,
|
|
2798
|
+
organizationId: options.org,
|
|
2799
|
+
projectName: options.project,
|
|
2800
|
+
branchName: options.branch ?? "master"
|
|
2801
|
+
});
|
|
2802
|
+
}
|
|
2803
|
+
async revision(options) {
|
|
2804
|
+
const bs = await this.branch(options);
|
|
2805
|
+
const rev = options.revision ?? "draft";
|
|
2806
|
+
if (rev === "draft") return bs.draft();
|
|
2807
|
+
if (rev === "head") return bs.head();
|
|
2808
|
+
return bs.revision(rev);
|
|
2276
2809
|
}
|
|
2277
2810
|
};
|
|
2278
2811
|
|
|
2279
2812
|
//#endregion
|
|
2813
|
+
exports.BranchScope = BranchScope;
|
|
2814
|
+
exports.OrgScope = OrgScope;
|
|
2815
|
+
exports.ProjectScope = ProjectScope;
|
|
2816
|
+
exports.RevisionScope = RevisionScope;
|
|
2280
2817
|
exports.RevisiumClient = RevisiumClient;
|
|
2281
|
-
exports.RevisiumScope = RevisiumScope;
|
|
2282
2818
|
exports.client = client;
|
|
2283
2819
|
Object.defineProperty(exports, 'sdk', {
|
|
2284
2820
|
enumerable: true,
|