@sylphx/cli 0.1.6 → 0.1.7
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/index.js +8 -17
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -30,7 +30,7 @@ var import_commander16 = require("commander");
|
|
|
30
30
|
// package.json
|
|
31
31
|
var package_default = {
|
|
32
32
|
name: "@sylphx/cli",
|
|
33
|
-
version: "0.1.
|
|
33
|
+
version: "0.1.7",
|
|
34
34
|
description: "Sylphx Platform CLI \u2014 deploy, manage logs, env vars, and more",
|
|
35
35
|
type: "commonjs",
|
|
36
36
|
bin: {
|
|
@@ -252,37 +252,28 @@ var api = {
|
|
|
252
252
|
query: { envType }
|
|
253
253
|
});
|
|
254
254
|
},
|
|
255
|
-
/** Resolve environment ID from project ID + envType.
|
|
256
|
-
* The domains API requires an envId (not projectId).
|
|
257
|
-
*/
|
|
258
|
-
async resolveEnvId(projectId, envType) {
|
|
259
|
-
const project = await request("GET", `/projects/${projectId}`);
|
|
260
|
-
const env = project.environments.find((e) => e.envType === envType || e.name === envType);
|
|
261
|
-
if (!env) throw new ApiError(404, `No environment '${envType}' found for project`);
|
|
262
|
-
return env.id;
|
|
263
|
-
},
|
|
264
255
|
/** List domains for a project environment */
|
|
265
256
|
async listDomains(projectId, envType) {
|
|
266
|
-
const
|
|
257
|
+
const params = new URLSearchParams({ envType });
|
|
267
258
|
const res = await request(
|
|
268
259
|
"GET",
|
|
269
|
-
`/domains/projects/${
|
|
260
|
+
`/domains/projects/${projectId}/domains?${params}`
|
|
270
261
|
);
|
|
271
|
-
return
|
|
262
|
+
return res.customDomains ?? [];
|
|
272
263
|
},
|
|
273
264
|
/** Add a domain for a project environment */
|
|
274
265
|
async addDomain(projectId, domain, envType) {
|
|
275
|
-
const
|
|
276
|
-
return request("POST", `/domains/projects/${
|
|
266
|
+
const params = new URLSearchParams({ envType });
|
|
267
|
+
return request("POST", `/domains/projects/${projectId}/domains?${params}`, {
|
|
277
268
|
body: { domain }
|
|
278
269
|
});
|
|
279
270
|
},
|
|
280
271
|
/** Remove a domain from a project environment */
|
|
281
272
|
async removeDomain(projectId, domain, envType) {
|
|
282
|
-
const
|
|
273
|
+
const params = new URLSearchParams({ envType });
|
|
283
274
|
return request(
|
|
284
275
|
"DELETE",
|
|
285
|
-
`/domains/projects/${
|
|
276
|
+
`/domains/projects/${projectId}/domains/${encodeURIComponent(domain)}?${params}`
|
|
286
277
|
);
|
|
287
278
|
},
|
|
288
279
|
/** Get current user and orgs */
|