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