@symbo.ls/sdk 2.33.14 → 2.33.17
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/dist/cjs/services/AuthService.js +1 -1
- package/dist/cjs/services/DnsService.js +9 -43
- package/dist/cjs/services/ProjectService.js +353 -0
- package/dist/cjs/utils/services.js +12 -1
- package/dist/esm/index.js +375 -45
- package/dist/esm/services/AuthService.js +1 -1
- package/dist/esm/services/DnsService.js +9 -43
- package/dist/esm/services/ProjectService.js +353 -0
- package/dist/esm/services/index.js +363 -44
- package/dist/esm/utils/services.js +12 -1
- package/dist/node/services/AuthService.js +1 -1
- package/dist/node/services/DnsService.js +9 -43
- package/dist/node/services/ProjectService.js +353 -0
- package/dist/node/utils/services.js +12 -1
- package/package.json +6 -6
- package/src/services/AuthService.js +1 -1
- package/src/services/DnsService.js +10 -51
- package/src/services/ProjectService.js +411 -0
- package/src/utils/services.js +12 -1
|
@@ -1595,6 +1595,62 @@ var ProjectService = class extends BaseService {
|
|
|
1595
1595
|
throw new Error(`Failed to update project name: ${error.message}`, { cause: error });
|
|
1596
1596
|
}
|
|
1597
1597
|
}
|
|
1598
|
+
async setProjectAccess(projectId, access) {
|
|
1599
|
+
this._requireReady("setProjectAccess");
|
|
1600
|
+
if (!projectId) {
|
|
1601
|
+
throw new Error("Project ID is required");
|
|
1602
|
+
}
|
|
1603
|
+
if (!access) {
|
|
1604
|
+
throw new Error("Access level is required");
|
|
1605
|
+
}
|
|
1606
|
+
const allowedAccessValues = ["account", "team", "organization", "public"];
|
|
1607
|
+
if (!allowedAccessValues.includes(access)) {
|
|
1608
|
+
throw new Error(
|
|
1609
|
+
`Invalid access value: ${access}. Must be one of: ${allowedAccessValues.join(", ")}`
|
|
1610
|
+
);
|
|
1611
|
+
}
|
|
1612
|
+
try {
|
|
1613
|
+
const response = await this._request(`/projects/${projectId}`, {
|
|
1614
|
+
method: "PATCH",
|
|
1615
|
+
body: JSON.stringify({ access }),
|
|
1616
|
+
methodName: "setProjectAccess"
|
|
1617
|
+
});
|
|
1618
|
+
if (response.success) {
|
|
1619
|
+
return response.data;
|
|
1620
|
+
}
|
|
1621
|
+
throw new Error(response.message);
|
|
1622
|
+
} catch (error) {
|
|
1623
|
+
throw new Error(`Failed to set project access: ${error.message}`, { cause: error });
|
|
1624
|
+
}
|
|
1625
|
+
}
|
|
1626
|
+
async setProjectVisibility(projectId, visibility) {
|
|
1627
|
+
this._requireReady("setProjectVisibility");
|
|
1628
|
+
if (!projectId) {
|
|
1629
|
+
throw new Error("Project ID is required");
|
|
1630
|
+
}
|
|
1631
|
+
if (!visibility) {
|
|
1632
|
+
throw new Error("Visibility is required");
|
|
1633
|
+
}
|
|
1634
|
+
const allowedVisibilityValues = ["public", "private", "password-protected"];
|
|
1635
|
+
if (!allowedVisibilityValues.includes(visibility)) {
|
|
1636
|
+
throw new Error(
|
|
1637
|
+
`Invalid visibility value: ${visibility}. Must be one of: ${allowedVisibilityValues.join(", ")}`
|
|
1638
|
+
);
|
|
1639
|
+
}
|
|
1640
|
+
try {
|
|
1641
|
+
const response = await this._request(`/projects/${projectId}`, {
|
|
1642
|
+
method: "PATCH",
|
|
1643
|
+
body: JSON.stringify({ visibility }),
|
|
1644
|
+
methodName: "setProjectVisibility"
|
|
1645
|
+
});
|
|
1646
|
+
if (response.success) {
|
|
1647
|
+
return response.data;
|
|
1648
|
+
}
|
|
1649
|
+
throw new Error(response.message);
|
|
1650
|
+
} catch (error) {
|
|
1651
|
+
throw new Error(`Failed to set project visibility: ${error.message}`, { cause: error });
|
|
1652
|
+
}
|
|
1653
|
+
}
|
|
1598
1654
|
async updateProjectPackage(projectId, pkg) {
|
|
1599
1655
|
this._requireReady("updateProjectPackage");
|
|
1600
1656
|
if (!projectId) {
|
|
@@ -1672,6 +1728,65 @@ var ProjectService = class extends BaseService {
|
|
|
1672
1728
|
);
|
|
1673
1729
|
}
|
|
1674
1730
|
}
|
|
1731
|
+
// ==================== PROJECT PERMISSION CONFIG METHODS ====================
|
|
1732
|
+
/**
|
|
1733
|
+
* Fetch effective role → permissions configuration for a project.
|
|
1734
|
+
* Mirrors ProjectController.getProjectRolePermissionsConfig.
|
|
1735
|
+
*/
|
|
1736
|
+
async getProjectRolePermissionsConfig(projectId, options = {}) {
|
|
1737
|
+
this._requireReady("getProjectRolePermissionsConfig");
|
|
1738
|
+
if (!projectId) {
|
|
1739
|
+
throw new Error("Project ID is required");
|
|
1740
|
+
}
|
|
1741
|
+
const { headers } = options;
|
|
1742
|
+
try {
|
|
1743
|
+
const response = await this._request(`/projects/${projectId}/permissions`, {
|
|
1744
|
+
method: "GET",
|
|
1745
|
+
...headers ? { headers } : {},
|
|
1746
|
+
methodName: "getProjectRolePermissionsConfig"
|
|
1747
|
+
});
|
|
1748
|
+
if (response && response.success) {
|
|
1749
|
+
return response.data;
|
|
1750
|
+
}
|
|
1751
|
+
throw new Error(response.message);
|
|
1752
|
+
} catch (error) {
|
|
1753
|
+
throw new Error(
|
|
1754
|
+
`Failed to get project role permissions config: ${error.message}`,
|
|
1755
|
+
{ cause: error }
|
|
1756
|
+
);
|
|
1757
|
+
}
|
|
1758
|
+
}
|
|
1759
|
+
/**
|
|
1760
|
+
* Update project-level role → permissions overrides.
|
|
1761
|
+
* Mirrors ProjectController.updateProjectRolePermissionsConfig.
|
|
1762
|
+
*/
|
|
1763
|
+
async updateProjectRolePermissionsConfig(projectId, rolePermissions, options = {}) {
|
|
1764
|
+
this._requireReady("updateProjectRolePermissionsConfig");
|
|
1765
|
+
if (!projectId) {
|
|
1766
|
+
throw new Error("Project ID is required");
|
|
1767
|
+
}
|
|
1768
|
+
if (!rolePermissions || typeof rolePermissions !== "object") {
|
|
1769
|
+
throw new Error("rolePermissions object is required");
|
|
1770
|
+
}
|
|
1771
|
+
const { headers } = options;
|
|
1772
|
+
try {
|
|
1773
|
+
const response = await this._request(`/projects/${projectId}/permissions`, {
|
|
1774
|
+
method: "PATCH",
|
|
1775
|
+
body: JSON.stringify({ rolePermissions }),
|
|
1776
|
+
...headers ? { headers } : {},
|
|
1777
|
+
methodName: "updateProjectRolePermissionsConfig"
|
|
1778
|
+
});
|
|
1779
|
+
if (response && response.success) {
|
|
1780
|
+
return response.data;
|
|
1781
|
+
}
|
|
1782
|
+
throw new Error(response.message);
|
|
1783
|
+
} catch (error) {
|
|
1784
|
+
throw new Error(
|
|
1785
|
+
`Failed to update project role permissions config: ${error.message}`,
|
|
1786
|
+
{ cause: error }
|
|
1787
|
+
);
|
|
1788
|
+
}
|
|
1789
|
+
}
|
|
1675
1790
|
// ==================== PROJECT MEMBER METHODS ====================
|
|
1676
1791
|
async getProjectMembers(projectId) {
|
|
1677
1792
|
this._requireReady("getProjectMembers");
|
|
@@ -1721,6 +1836,30 @@ var ProjectService = class extends BaseService {
|
|
|
1721
1836
|
throw new Error(`Failed to invite member: ${error.message}`, { cause: error });
|
|
1722
1837
|
}
|
|
1723
1838
|
}
|
|
1839
|
+
/**
|
|
1840
|
+
* Create a magic invite link for a project.
|
|
1841
|
+
* The backend returns a token and URL that can be shared directly.
|
|
1842
|
+
*/
|
|
1843
|
+
async createMagicInviteLink(projectId, options = {}) {
|
|
1844
|
+
this._requireReady("createMagicInviteLink");
|
|
1845
|
+
if (!projectId) {
|
|
1846
|
+
throw new Error("Project ID is required");
|
|
1847
|
+
}
|
|
1848
|
+
const { headers } = options;
|
|
1849
|
+
try {
|
|
1850
|
+
const response = await this._request(`/projects/${projectId}/invite-link`, {
|
|
1851
|
+
method: "POST",
|
|
1852
|
+
...headers ? { headers } : {},
|
|
1853
|
+
methodName: "createMagicInviteLink"
|
|
1854
|
+
});
|
|
1855
|
+
if (response.success) {
|
|
1856
|
+
return response.data;
|
|
1857
|
+
}
|
|
1858
|
+
throw new Error(response.message);
|
|
1859
|
+
} catch (error) {
|
|
1860
|
+
throw new Error(`Failed to create magic invite link: ${error.message}`, { cause: error });
|
|
1861
|
+
}
|
|
1862
|
+
}
|
|
1724
1863
|
async acceptInvite(token) {
|
|
1725
1864
|
this._requireReady("acceptInvite");
|
|
1726
1865
|
if (!token) {
|
|
@@ -1967,6 +2106,220 @@ var ProjectService = class extends BaseService {
|
|
|
1967
2106
|
throw new Error(`Failed to get project versions: ${error.message}`, { cause: error });
|
|
1968
2107
|
}
|
|
1969
2108
|
}
|
|
2109
|
+
// ==================== PROJECT ENVIRONMENT METHODS ====================
|
|
2110
|
+
/**
|
|
2111
|
+
* List all environments for a project along with plan limits and activation state.
|
|
2112
|
+
* Mirrors ProjectController.listEnvironments.
|
|
2113
|
+
*/
|
|
2114
|
+
async listEnvironments(projectId, options = {}) {
|
|
2115
|
+
this._requireReady("listEnvironments");
|
|
2116
|
+
if (!projectId) {
|
|
2117
|
+
throw new Error("Project ID is required");
|
|
2118
|
+
}
|
|
2119
|
+
const { headers } = options;
|
|
2120
|
+
try {
|
|
2121
|
+
const response = await this._request(`/projects/${projectId}/environments`, {
|
|
2122
|
+
method: "GET",
|
|
2123
|
+
...headers ? { headers } : {},
|
|
2124
|
+
methodName: "listEnvironments"
|
|
2125
|
+
});
|
|
2126
|
+
if (response && response.success) {
|
|
2127
|
+
return response.data;
|
|
2128
|
+
}
|
|
2129
|
+
throw new Error(response.message);
|
|
2130
|
+
} catch (error) {
|
|
2131
|
+
throw new Error(`Failed to list environments: ${error.message}`, { cause: error });
|
|
2132
|
+
}
|
|
2133
|
+
}
|
|
2134
|
+
/**
|
|
2135
|
+
* Activate multi-environment support for a project.
|
|
2136
|
+
* Optional `force` will reconfigure DNS/TLS even if already active.
|
|
2137
|
+
* Mirrors ProjectController.activateMultipleEnvironments.
|
|
2138
|
+
*/
|
|
2139
|
+
async activateMultipleEnvironments(projectId, options = {}) {
|
|
2140
|
+
this._requireReady("activateMultipleEnvironments");
|
|
2141
|
+
if (!projectId) {
|
|
2142
|
+
throw new Error("Project ID is required");
|
|
2143
|
+
}
|
|
2144
|
+
const { force = false, headers } = options;
|
|
2145
|
+
try {
|
|
2146
|
+
const response = await this._request(`/projects/${projectId}/environments/activate`, {
|
|
2147
|
+
method: "POST",
|
|
2148
|
+
body: JSON.stringify({ ...force ? { force: true } : {} }),
|
|
2149
|
+
...headers ? { headers } : {},
|
|
2150
|
+
methodName: "activateMultipleEnvironments"
|
|
2151
|
+
});
|
|
2152
|
+
if (response && response.success) {
|
|
2153
|
+
return response.data;
|
|
2154
|
+
}
|
|
2155
|
+
throw new Error(response.message);
|
|
2156
|
+
} catch (error) {
|
|
2157
|
+
throw new Error(
|
|
2158
|
+
`Failed to activate multiple environments: ${error.message}`,
|
|
2159
|
+
{ cause: error }
|
|
2160
|
+
);
|
|
2161
|
+
}
|
|
2162
|
+
}
|
|
2163
|
+
/**
|
|
2164
|
+
* Create or update (upsert) an environment config for a project.
|
|
2165
|
+
* Mirrors ProjectController.upsertEnvironment.
|
|
2166
|
+
*/
|
|
2167
|
+
async upsertEnvironment(projectId, envKey, config, options = {}) {
|
|
2168
|
+
this._requireReady("upsertEnvironment");
|
|
2169
|
+
if (!projectId) {
|
|
2170
|
+
throw new Error("Project ID is required");
|
|
2171
|
+
}
|
|
2172
|
+
if (!envKey) {
|
|
2173
|
+
throw new Error("Environment key is required");
|
|
2174
|
+
}
|
|
2175
|
+
if (!config || typeof config !== "object") {
|
|
2176
|
+
throw new Error("Environment config object is required");
|
|
2177
|
+
}
|
|
2178
|
+
const { headers } = options;
|
|
2179
|
+
try {
|
|
2180
|
+
const response = await this._request(`/projects/${projectId}/environments`, {
|
|
2181
|
+
method: "POST",
|
|
2182
|
+
body: JSON.stringify({ envKey, config }),
|
|
2183
|
+
...headers ? { headers } : {},
|
|
2184
|
+
methodName: "upsertEnvironment"
|
|
2185
|
+
});
|
|
2186
|
+
if (response && response.success) {
|
|
2187
|
+
return response.data;
|
|
2188
|
+
}
|
|
2189
|
+
throw new Error(response.message);
|
|
2190
|
+
} catch (error) {
|
|
2191
|
+
throw new Error(`Failed to upsert environment: ${error.message}`, { cause: error });
|
|
2192
|
+
}
|
|
2193
|
+
}
|
|
2194
|
+
/**
|
|
2195
|
+
* Update an existing environment config.
|
|
2196
|
+
* Mirrors ProjectController.updateEnvironment.
|
|
2197
|
+
*/
|
|
2198
|
+
async updateEnvironment(projectId, envKey, updates, options = {}) {
|
|
2199
|
+
this._requireReady("updateEnvironment");
|
|
2200
|
+
if (!projectId) {
|
|
2201
|
+
throw new Error("Project ID is required");
|
|
2202
|
+
}
|
|
2203
|
+
if (!envKey) {
|
|
2204
|
+
throw new Error("Environment key is required");
|
|
2205
|
+
}
|
|
2206
|
+
if (!updates || typeof updates !== "object") {
|
|
2207
|
+
throw new Error("Environment updates object is required");
|
|
2208
|
+
}
|
|
2209
|
+
const { headers } = options;
|
|
2210
|
+
try {
|
|
2211
|
+
const response = await this._request(
|
|
2212
|
+
`/projects/${projectId}/environments/${encodeURIComponent(envKey)}`,
|
|
2213
|
+
{
|
|
2214
|
+
method: "PATCH",
|
|
2215
|
+
body: JSON.stringify(updates),
|
|
2216
|
+
...headers ? { headers } : {},
|
|
2217
|
+
methodName: "updateEnvironment"
|
|
2218
|
+
}
|
|
2219
|
+
);
|
|
2220
|
+
if (response && response.success) {
|
|
2221
|
+
return response.data;
|
|
2222
|
+
}
|
|
2223
|
+
throw new Error(response.message);
|
|
2224
|
+
} catch (error) {
|
|
2225
|
+
throw new Error(`Failed to update environment: ${error.message}`, { cause: error });
|
|
2226
|
+
}
|
|
2227
|
+
}
|
|
2228
|
+
/**
|
|
2229
|
+
* Publish a project to a specific environment (set its effective mode/version/branch).
|
|
2230
|
+
* Mirrors ProjectController.publishToEnvironment.
|
|
2231
|
+
*/
|
|
2232
|
+
async publishToEnvironment(projectId, envKey, payload, options = {}) {
|
|
2233
|
+
this._requireReady("publishToEnvironment");
|
|
2234
|
+
if (!projectId) {
|
|
2235
|
+
throw new Error("Project ID is required");
|
|
2236
|
+
}
|
|
2237
|
+
if (!envKey) {
|
|
2238
|
+
throw new Error("Environment key is required");
|
|
2239
|
+
}
|
|
2240
|
+
if (!payload || typeof payload !== "object") {
|
|
2241
|
+
throw new Error("Publish payload is required");
|
|
2242
|
+
}
|
|
2243
|
+
const { headers } = options;
|
|
2244
|
+
try {
|
|
2245
|
+
const response = await this._request(
|
|
2246
|
+
`/projects/${projectId}/environments/${encodeURIComponent(envKey)}/publish`,
|
|
2247
|
+
{
|
|
2248
|
+
method: "POST",
|
|
2249
|
+
body: JSON.stringify(payload),
|
|
2250
|
+
...headers ? { headers } : {},
|
|
2251
|
+
methodName: "publishToEnvironment"
|
|
2252
|
+
}
|
|
2253
|
+
);
|
|
2254
|
+
if (response && response.success) {
|
|
2255
|
+
return response.data;
|
|
2256
|
+
}
|
|
2257
|
+
throw new Error(response.message);
|
|
2258
|
+
} catch (error) {
|
|
2259
|
+
throw new Error(`Failed to publish to environment: ${error.message}`, { cause: error });
|
|
2260
|
+
}
|
|
2261
|
+
}
|
|
2262
|
+
/**
|
|
2263
|
+
* Delete an environment from a project.
|
|
2264
|
+
* Mirrors ProjectController.deleteEnvironment.
|
|
2265
|
+
*/
|
|
2266
|
+
async deleteEnvironment(projectId, envKey, options = {}) {
|
|
2267
|
+
this._requireReady("deleteEnvironment");
|
|
2268
|
+
if (!projectId) {
|
|
2269
|
+
throw new Error("Project ID is required");
|
|
2270
|
+
}
|
|
2271
|
+
if (!envKey) {
|
|
2272
|
+
throw new Error("Environment key is required");
|
|
2273
|
+
}
|
|
2274
|
+
const { headers } = options;
|
|
2275
|
+
try {
|
|
2276
|
+
const response = await this._request(
|
|
2277
|
+
`/projects/${projectId}/environments/${encodeURIComponent(envKey)}`,
|
|
2278
|
+
{
|
|
2279
|
+
method: "DELETE",
|
|
2280
|
+
...headers ? { headers } : {},
|
|
2281
|
+
methodName: "deleteEnvironment"
|
|
2282
|
+
}
|
|
2283
|
+
);
|
|
2284
|
+
if (response && response.success) {
|
|
2285
|
+
return response.data;
|
|
2286
|
+
}
|
|
2287
|
+
throw new Error(response.message);
|
|
2288
|
+
} catch (error) {
|
|
2289
|
+
throw new Error(`Failed to delete environment: ${error.message}`, { cause: error });
|
|
2290
|
+
}
|
|
2291
|
+
}
|
|
2292
|
+
/**
|
|
2293
|
+
* Promote content between environments (simple pipeline).
|
|
2294
|
+
* Mirrors ProjectController.promoteEnvironment.
|
|
2295
|
+
*/
|
|
2296
|
+
async promoteEnvironment(projectId, fromEnvKey, toEnvKey, options = {}) {
|
|
2297
|
+
this._requireReady("promoteEnvironment");
|
|
2298
|
+
if (!projectId) {
|
|
2299
|
+
throw new Error("Project ID is required");
|
|
2300
|
+
}
|
|
2301
|
+
if (!fromEnvKey || !toEnvKey) {
|
|
2302
|
+
throw new Error("Both fromEnvKey and toEnvKey are required");
|
|
2303
|
+
}
|
|
2304
|
+
if (fromEnvKey === toEnvKey) {
|
|
2305
|
+
throw new Error("fromEnvKey and toEnvKey must be different");
|
|
2306
|
+
}
|
|
2307
|
+
const { headers } = options;
|
|
2308
|
+
try {
|
|
2309
|
+
const response = await this._request(`/projects/${projectId}/pipeline/promote`, {
|
|
2310
|
+
method: "POST",
|
|
2311
|
+
body: JSON.stringify({ from: fromEnvKey, to: toEnvKey }),
|
|
2312
|
+
...headers ? { headers } : {},
|
|
2313
|
+
methodName: "promoteEnvironment"
|
|
2314
|
+
});
|
|
2315
|
+
if (response && response.success) {
|
|
2316
|
+
return response.data;
|
|
2317
|
+
}
|
|
2318
|
+
throw new Error(response.message);
|
|
2319
|
+
} catch (error) {
|
|
2320
|
+
throw new Error(`Failed to promote environment: ${error.message}`, { cause: error });
|
|
2321
|
+
}
|
|
2322
|
+
}
|
|
1970
2323
|
/**
|
|
1971
2324
|
* Restore project to a previous version
|
|
1972
2325
|
* Replaces: SymstoryService.restoreVersion()
|