@ptkl/toolkit 1.4.3 → 1.4.4
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/commands/project.js
CHANGED
|
@@ -15,14 +15,6 @@ function parseJSON(label, raw) {
|
|
|
15
15
|
class ProjectCommand {
|
|
16
16
|
register() {
|
|
17
17
|
const cmd = new Command("project").description("Manage projects, workspaces, invites and project users");
|
|
18
|
-
cmd.addCommand(registerCommand(new Command("create")
|
|
19
|
-
.description("Create a new project")
|
|
20
|
-
.requiredOption("-n, --name <name>", "Project name")
|
|
21
|
-
.option("-d, --description <description>", "Project description")).action(withProfile(async (profile, opts) => {
|
|
22
|
-
const { name, description } = opts;
|
|
23
|
-
const res = await sdk.project(profile).create({ name, description });
|
|
24
|
-
return res.data;
|
|
25
|
-
})));
|
|
26
18
|
cmd.addCommand(registerCommand(new Command("list").description("List all projects for the current user")).action(withProfile(async (profile) => {
|
|
27
19
|
const res = await sdk.project(profile).list();
|
|
28
20
|
return res.data;
|
|
@@ -5,17 +5,16 @@ import { registerCommand, withProfile } from "../lib/scaffold.js";
|
|
|
5
5
|
* `search`/`available`/`install`/`upgrade`/`uninstall` map 1:1 onto the SDK `Project` client's
|
|
6
6
|
* template methods (@ptkl/sdk/beta).
|
|
7
7
|
*
|
|
8
|
-
* `activation-code redeem
|
|
8
|
+
* `activation-code redeem` does NOT map onto `Project.getTemplateByCode` — that method wraps
|
|
9
9
|
* `GET /v1/project/template/activationCode/{code}` (platform-api
|
|
10
10
|
* internal/project/controllers/template_activation_code.go), a public read-only lookup that
|
|
11
11
|
* resolves a code to its template's install instructions without redeeming anything. The actual
|
|
12
12
|
* redemption is a *different* platform subsystem — activation codes with `product_type: template`
|
|
13
|
-
* (also `account`/`app`/`integration`) redeemed via `POST /v1/project/codes/{code}/redeem`
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* a follow-up SDK WP to give `Project` `redeemCode()`/`listRedeemedCodes()`. */
|
|
13
|
+
* (also `account`/`app`/`integration`) redeemed via `POST /v1/project/codes/{code}/redeem`
|
|
14
|
+
* (internal/project/controllers/code_redeem.go, internal/project/domain/code/service.go). The v0.10
|
|
15
|
+
* `Project` client has no typed method for that route yet, so the subcommand goes through the
|
|
16
|
+
* authenticated client instance's public `.client` (an AxiosInstance, see @ptkl/sdk/beta
|
|
17
|
+
* BaseClient), pending a follow-up SDK WP to give `Project` a `redeemCode()`. */
|
|
19
18
|
function parseJSON(label, raw) {
|
|
20
19
|
try {
|
|
21
20
|
return JSON.parse(raw);
|
|
@@ -76,7 +75,7 @@ class TemplateCommand {
|
|
|
76
75
|
return cmd;
|
|
77
76
|
}
|
|
78
77
|
registerActivationCode() {
|
|
79
|
-
const activationCode = new Command("activation-code").description("Redeem
|
|
78
|
+
const activationCode = new Command("activation-code").description("Redeem activation codes (account/app/integration/template benefits)");
|
|
80
79
|
activationCode.addCommand(registerCommand(new Command("redeem")
|
|
81
80
|
.description("Redeem an activation code for the current user and project")
|
|
82
81
|
.argument("<code>", "Activation code")).action(withProfile(async (profile, code, opts) => {
|
|
@@ -84,11 +83,6 @@ class TemplateCommand {
|
|
|
84
83
|
const res = await client.client.post(`/v1/project/codes/${encodeURIComponent(code)}/redeem`);
|
|
85
84
|
return res.data;
|
|
86
85
|
})));
|
|
87
|
-
activationCode.addCommand(registerCommand(new Command("list").description("List activation codes redeemed by the current user")).action(withProfile(async (profile) => {
|
|
88
|
-
const client = sdk.project(profile);
|
|
89
|
-
const res = await client.client.get("/v1/project/codes/redeemed");
|
|
90
|
-
return res.data;
|
|
91
|
-
})));
|
|
92
86
|
return activationCode;
|
|
93
87
|
}
|
|
94
88
|
}
|