@pump-inc/cli 0.0.1
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 +905 -0
- package/bin/dev.cmd +3 -0
- package/bin/dev.js +7 -0
- package/bin/run-pkg.js +13 -0
- package/bin/run.cmd +3 -0
- package/bin/run.js +7 -0
- package/dist/api-XWM8zKbb.cjs +21 -0
- package/dist/api-client-bnV0ib_r.cjs +1207 -0
- package/dist/base-command-GfDxcqx6.cjs +451 -0
- package/dist/bin.cjs +15 -0
- package/dist/chunk-CbDLau6x.cjs +34 -0
- package/dist/commands/admin/config/set.cjs +40 -0
- package/dist/commands/admin/organization/create.cjs +83 -0
- package/dist/commands/admin/organization/get.cjs +77 -0
- package/dist/commands/admin/organization/list.cjs +103 -0
- package/dist/commands/admin/user/create.cjs +82 -0
- package/dist/commands/api-key/create.cjs +81 -0
- package/dist/commands/api-key/delete.cjs +48 -0
- package/dist/commands/api-key/list.cjs +85 -0
- package/dist/commands/api-key/update.cjs +81 -0
- package/dist/commands/app/create.cjs +97 -0
- package/dist/commands/app/deploy.cjs +74 -0
- package/dist/commands/app/list.cjs +64 -0
- package/dist/commands/app/secrets.cjs +43 -0
- package/dist/commands/app/status.cjs +78 -0
- package/dist/commands/app/stop.cjs +49 -0
- package/dist/commands/app/usage.cjs +79 -0
- package/dist/commands/auth/test.cjs +56 -0
- package/dist/commands/config/validate.cjs +32 -0
- package/dist/commands/project/create.cjs +79 -0
- package/dist/fix-event-emitter-uhRntilb.cjs +21 -0
- package/dist/index.cjs +16 -0
- package/dist/util/api.cjs +3 -0
- package/dist/util/base-command.cjs +4 -0
- package/dist/util/fix-event-emitter.cjs +3 -0
- package/dist/util/validate-config.cjs +3 -0
- package/dist/validate-config-C9krCzRv.cjs +24 -0
- package/oclif.manifest.json +1099 -0
- package/package.json +85 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
const require_chunk = require('../../../chunk-CbDLau6x.cjs');
|
|
2
|
+
const require_base_command = require('../../../base-command-GfDxcqx6.cjs');
|
|
3
|
+
const require_api = require('../../../api-XWM8zKbb.cjs');
|
|
4
|
+
const require_api_client = require('../../../api-client-bnV0ib_r.cjs');
|
|
5
|
+
let __oclif_core = require("@oclif/core");
|
|
6
|
+
|
|
7
|
+
//#region src/commands/admin/organization/get.ts
|
|
8
|
+
var AdminOrganizationGet = class AdminOrganizationGet extends require_base_command.BaseCommand {
|
|
9
|
+
static args = { organizationId: __oclif_core.Args.string({
|
|
10
|
+
description: "Organization ID to retrieve",
|
|
11
|
+
required: true
|
|
12
|
+
}) };
|
|
13
|
+
static description = "Get organization details with owner and members (admin only)";
|
|
14
|
+
static examples = [
|
|
15
|
+
"<%= config.bin %> <%= command.id %> org_1234567890",
|
|
16
|
+
"<%= config.bin %> <%= command.id %> org_1234567890 --json",
|
|
17
|
+
"<%= config.bin %> <%= command.id %> org_1234567890 --members-only"
|
|
18
|
+
];
|
|
19
|
+
static flags = {
|
|
20
|
+
json: __oclif_core.Flags.boolean({
|
|
21
|
+
char: "j",
|
|
22
|
+
description: "Output as JSON",
|
|
23
|
+
default: false
|
|
24
|
+
}),
|
|
25
|
+
membersOnly: __oclif_core.Flags.boolean({
|
|
26
|
+
char: "m",
|
|
27
|
+
description: "Show only members information",
|
|
28
|
+
default: false
|
|
29
|
+
}),
|
|
30
|
+
apikey: __oclif_core.Flags.string({
|
|
31
|
+
char: "k",
|
|
32
|
+
description: "API key to use for authentication (overrides API_KEY env variable)"
|
|
33
|
+
})
|
|
34
|
+
};
|
|
35
|
+
async run() {
|
|
36
|
+
const { args, flags } = await this.parse(AdminOrganizationGet);
|
|
37
|
+
const apiClient = new require_api_client.ApiClient(require_api.getApiUrl(), flags.apikey || process.env.API_KEY);
|
|
38
|
+
if (!flags.json) this.log(require_base_command.source_default.gray(`Fetching organization details for ${args.organizationId}...`));
|
|
39
|
+
const [organizationDetails, error] = (await apiClient.admin.organizations.get(args.organizationId)).toTuple();
|
|
40
|
+
if (error) {
|
|
41
|
+
this.error(`Failed to get organization details: ${error.message}`);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
if (flags.json) {
|
|
45
|
+
this.log(JSON.stringify(organizationDetails, null, 2));
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (!flags.membersOnly) {
|
|
49
|
+
this.log(require_base_command.source_default.green("✓ Organization Details"));
|
|
50
|
+
this.log(require_base_command.source_default.white(`ID: ${require_base_command.source_default.cyan(organizationDetails.id)}`));
|
|
51
|
+
this.log(require_base_command.source_default.white(`Name: ${require_base_command.source_default.cyan(organizationDetails.name)}`));
|
|
52
|
+
this.log(require_base_command.source_default.white(`Description: ${require_base_command.source_default.cyan(organizationDetails.description || "N/A")}`));
|
|
53
|
+
this.log(require_base_command.source_default.white(`Domain: ${require_base_command.source_default.cyan(organizationDetails.domainName || "N/A")}`));
|
|
54
|
+
this.log(require_base_command.source_default.white(`Created: ${require_base_command.source_default.gray(organizationDetails.createdAt)}`));
|
|
55
|
+
this.log(require_base_command.source_default.green("\n✓ Owner Information"));
|
|
56
|
+
this.log(require_base_command.source_default.white(`Name: ${require_base_command.source_default.cyan(organizationDetails.owner.name)}`));
|
|
57
|
+
this.log(require_base_command.source_default.white(`Email: ${require_base_command.source_default.cyan(organizationDetails.owner.email)}`));
|
|
58
|
+
this.log(require_base_command.source_default.white(`ID: ${require_base_command.source_default.gray(organizationDetails.owner.id)}`));
|
|
59
|
+
this.log(require_base_command.source_default.white(`Admin: ${organizationDetails.owner.isAdmin ? require_base_command.source_default.green("Yes") : require_base_command.source_default.red("No")}`));
|
|
60
|
+
this.log(require_base_command.source_default.white(`Email Verified: ${organizationDetails.owner.emailVerified ? require_base_command.source_default.green("Yes") : require_base_command.source_default.red("No")}`));
|
|
61
|
+
}
|
|
62
|
+
this.log(require_base_command.source_default.green(`\n✓ Members (${organizationDetails.members.length})`));
|
|
63
|
+
if (organizationDetails.members.length === 0) this.log(require_base_command.source_default.gray(" No members found"));
|
|
64
|
+
else organizationDetails.members.forEach((member, index) => {
|
|
65
|
+
this.log(require_base_command.source_default.white(`\n ${index + 1}. ${require_base_command.source_default.cyan(member.user.name)} (${require_base_command.source_default.yellow(member.role)})`));
|
|
66
|
+
this.log(require_base_command.source_default.white(` Email: ${require_base_command.source_default.gray(member.user.email)}`));
|
|
67
|
+
this.log(require_base_command.source_default.white(` User ID: ${require_base_command.source_default.gray(member.user.id)}`));
|
|
68
|
+
this.log(require_base_command.source_default.white(` Member ID: ${require_base_command.source_default.gray(member.id)}`));
|
|
69
|
+
this.log(require_base_command.source_default.white(` Joined: ${require_base_command.source_default.gray(member.createdAt)}`));
|
|
70
|
+
this.log(require_base_command.source_default.white(` Admin: ${member.user.isAdmin ? require_base_command.source_default.green("Yes") : require_base_command.source_default.red("No")}`));
|
|
71
|
+
});
|
|
72
|
+
this.log(require_base_command.source_default.green(`\n✓ Successfully retrieved organization details`));
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
//#endregion
|
|
77
|
+
module.exports = AdminOrganizationGet;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
const require_chunk = require('../../../chunk-CbDLau6x.cjs');
|
|
2
|
+
const require_fix_event_emitter = require('../../../fix-event-emitter-uhRntilb.cjs');
|
|
3
|
+
const require_base_command = require('../../../base-command-GfDxcqx6.cjs');
|
|
4
|
+
const require_api = require('../../../api-XWM8zKbb.cjs');
|
|
5
|
+
const require_api_client = require('../../../api-client-bnV0ib_r.cjs');
|
|
6
|
+
let __oclif_core = require("@oclif/core");
|
|
7
|
+
|
|
8
|
+
//#region src/commands/admin/organization/list.ts
|
|
9
|
+
require_fix_event_emitter.fixEventEmitterWarning();
|
|
10
|
+
var AdminOrganizationList = class AdminOrganizationList extends require_base_command.BaseCommand {
|
|
11
|
+
static description = "List all organizations (admin only)";
|
|
12
|
+
static examples = [
|
|
13
|
+
"<%= config.bin %> <%= command.id %>",
|
|
14
|
+
"<%= config.bin %> <%= command.id %> --json",
|
|
15
|
+
"<%= config.bin %> <%= command.id %> --sort-by=name",
|
|
16
|
+
"<%= config.bin %> <%= command.id %> --sort-by=created --desc"
|
|
17
|
+
];
|
|
18
|
+
static flags = {
|
|
19
|
+
json: __oclif_core.Flags.boolean({
|
|
20
|
+
char: "j",
|
|
21
|
+
description: "Output as JSON",
|
|
22
|
+
default: false
|
|
23
|
+
}),
|
|
24
|
+
sortBy: __oclif_core.Flags.string({
|
|
25
|
+
char: "s",
|
|
26
|
+
description: "Sort by field",
|
|
27
|
+
options: [
|
|
28
|
+
"name",
|
|
29
|
+
"created",
|
|
30
|
+
"members"
|
|
31
|
+
],
|
|
32
|
+
default: "name"
|
|
33
|
+
}),
|
|
34
|
+
desc: __oclif_core.Flags.boolean({
|
|
35
|
+
char: "d",
|
|
36
|
+
description: "Sort in descending order",
|
|
37
|
+
default: false
|
|
38
|
+
}),
|
|
39
|
+
apikey: __oclif_core.Flags.string({
|
|
40
|
+
char: "k",
|
|
41
|
+
description: "API key to use for authentication (overrides API_KEY env variable)"
|
|
42
|
+
})
|
|
43
|
+
};
|
|
44
|
+
async run() {
|
|
45
|
+
const { flags } = await this.parse(AdminOrganizationList);
|
|
46
|
+
const apiClient = new require_api_client.ApiClient(require_api.getApiUrl(), flags.apikey || process.env.API_KEY);
|
|
47
|
+
this.log(require_base_command.source_default.gray("Fetching organizations list..."));
|
|
48
|
+
const [organizationsList, error] = (await apiClient.admin.organizations.list()).toTuple();
|
|
49
|
+
if (error) {
|
|
50
|
+
this.error(`Failed to get organizations list: ${error.message}`);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (organizationsList.length === 0) {
|
|
54
|
+
this.log(require_base_command.source_default.yellow("No organizations found"));
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const sortedOrganizations = [...organizationsList].sort((a, b) => {
|
|
58
|
+
let aValue;
|
|
59
|
+
let bValue;
|
|
60
|
+
switch (flags.sortBy) {
|
|
61
|
+
case "name":
|
|
62
|
+
aValue = a.name.toLowerCase();
|
|
63
|
+
bValue = b.name.toLowerCase();
|
|
64
|
+
break;
|
|
65
|
+
case "created":
|
|
66
|
+
aValue = new Date(a.createdAt).getTime();
|
|
67
|
+
bValue = new Date(b.createdAt).getTime();
|
|
68
|
+
break;
|
|
69
|
+
case "members":
|
|
70
|
+
aValue = a.memberCount;
|
|
71
|
+
bValue = b.memberCount;
|
|
72
|
+
break;
|
|
73
|
+
default:
|
|
74
|
+
aValue = a.name.toLowerCase();
|
|
75
|
+
bValue = b.name.toLowerCase();
|
|
76
|
+
}
|
|
77
|
+
if (aValue < bValue) return flags.desc ? 1 : -1;
|
|
78
|
+
if (aValue > bValue) return flags.desc ? -1 : 1;
|
|
79
|
+
return 0;
|
|
80
|
+
});
|
|
81
|
+
if (flags.json) {
|
|
82
|
+
this.log(JSON.stringify(sortedOrganizations, null, 2));
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
this.log(require_base_command.source_default.green(`✓ Found ${sortedOrganizations.length} organizations`));
|
|
86
|
+
this.log("");
|
|
87
|
+
sortedOrganizations.forEach((org, index) => {
|
|
88
|
+
this.log(require_base_command.source_default.white(`${index + 1}. ${require_base_command.source_default.cyan(org.name)}`));
|
|
89
|
+
this.log(require_base_command.source_default.white(` ID: ${require_base_command.source_default.gray(org.id)}`));
|
|
90
|
+
this.log(require_base_command.source_default.white(` Description: ${require_base_command.source_default.gray(org.description || "N/A")}`));
|
|
91
|
+
this.log(require_base_command.source_default.white(` Domain: ${require_base_command.source_default.gray(org.domainName || "N/A")}`));
|
|
92
|
+
this.log(require_base_command.source_default.white(` Owner: ${require_base_command.source_default.yellow(org.owner.name)} (${require_base_command.source_default.gray(org.owner.email)})`));
|
|
93
|
+
this.log(require_base_command.source_default.white(` Members: ${require_base_command.source_default.blue(org.memberCount.toString())}`));
|
|
94
|
+
this.log(require_base_command.source_default.white(` Created: ${require_base_command.source_default.gray(new Date(org.createdAt).toLocaleDateString())}`));
|
|
95
|
+
if (index < sortedOrganizations.length - 1) this.log("");
|
|
96
|
+
});
|
|
97
|
+
this.log("");
|
|
98
|
+
this.log(require_base_command.source_default.green(`✓ Successfully listed ${sortedOrganizations.length} organizations`));
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
//#endregion
|
|
103
|
+
module.exports = AdminOrganizationList;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
const require_chunk = require('../../../chunk-CbDLau6x.cjs');
|
|
2
|
+
const require_base_command = require('../../../base-command-GfDxcqx6.cjs');
|
|
3
|
+
const require_api = require('../../../api-XWM8zKbb.cjs');
|
|
4
|
+
const require_api_client = require('../../../api-client-bnV0ib_r.cjs');
|
|
5
|
+
let __oclif_core = require("@oclif/core");
|
|
6
|
+
|
|
7
|
+
//#region src/commands/admin/user/create.ts
|
|
8
|
+
var AdminUserCreate = class AdminUserCreate extends require_base_command.BaseCommand {
|
|
9
|
+
static args = {
|
|
10
|
+
name: __oclif_core.Args.string({
|
|
11
|
+
description: "User's full name",
|
|
12
|
+
required: true
|
|
13
|
+
}),
|
|
14
|
+
email: __oclif_core.Args.string({
|
|
15
|
+
description: "User's email address",
|
|
16
|
+
required: true
|
|
17
|
+
})
|
|
18
|
+
};
|
|
19
|
+
static description = "Create a new user (admin only)";
|
|
20
|
+
static examples = [
|
|
21
|
+
"<%= config.bin %> <%= command.id %> \"John Doe\" john@example.com",
|
|
22
|
+
"<%= config.bin %> <%= command.id %> \"Jane Admin\" jane@example.com --admin",
|
|
23
|
+
"<%= config.bin %> <%= command.id %> \"Bob User\" bob@example.com --admin --verified --image=\"https://example.com/avatar.jpg\"",
|
|
24
|
+
"<%= config.bin %> <%= command.id %> \"Json User\" json@example.com --json"
|
|
25
|
+
];
|
|
26
|
+
static flags = {
|
|
27
|
+
json: __oclif_core.Flags.boolean({
|
|
28
|
+
char: "j",
|
|
29
|
+
description: "Output as JSON",
|
|
30
|
+
default: false
|
|
31
|
+
}),
|
|
32
|
+
admin: __oclif_core.Flags.boolean({
|
|
33
|
+
char: "a",
|
|
34
|
+
description: "Make the user an admin",
|
|
35
|
+
default: false
|
|
36
|
+
}),
|
|
37
|
+
verified: __oclif_core.Flags.boolean({
|
|
38
|
+
char: "v",
|
|
39
|
+
description: "Mark the user's email as verified",
|
|
40
|
+
default: false
|
|
41
|
+
}),
|
|
42
|
+
image: __oclif_core.Flags.string({
|
|
43
|
+
char: "i",
|
|
44
|
+
description: "User's profile image URL"
|
|
45
|
+
}),
|
|
46
|
+
apikey: __oclif_core.Flags.string({
|
|
47
|
+
char: "k",
|
|
48
|
+
description: "API key to use for authentication (overrides API_KEY env variable)"
|
|
49
|
+
})
|
|
50
|
+
};
|
|
51
|
+
async run() {
|
|
52
|
+
const { args, flags } = await this.parse(AdminUserCreate);
|
|
53
|
+
const apiClient = new require_api_client.ApiClient(require_api.getApiUrl(), flags.apikey || process.env.API_KEY);
|
|
54
|
+
const userData = {
|
|
55
|
+
name: args.name,
|
|
56
|
+
email: args.email,
|
|
57
|
+
isAdmin: flags.admin,
|
|
58
|
+
emailVerified: flags.verified,
|
|
59
|
+
...flags.image && { image: flags.image }
|
|
60
|
+
};
|
|
61
|
+
if (!flags.json) this.log(require_base_command.source_default.gray("Creating user..."));
|
|
62
|
+
const [user, error] = (await apiClient.admin.users.create(userData)).toTuple();
|
|
63
|
+
if (error) {
|
|
64
|
+
this.error(`Failed to create user: ${error.message}`);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
if (flags.json) {
|
|
68
|
+
this.log(JSON.stringify(user, null, 2));
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
this.log(require_base_command.source_default.green("✓ User created successfully!"));
|
|
72
|
+
this.log(require_base_command.source_default.white(`ID: ${require_base_command.source_default.cyan(user.id)}`));
|
|
73
|
+
this.log(require_base_command.source_default.white(`Name: ${require_base_command.source_default.cyan(user.name)}`));
|
|
74
|
+
this.log(require_base_command.source_default.white(`Email: ${require_base_command.source_default.cyan(user.email)}`));
|
|
75
|
+
this.log(require_base_command.source_default.white(`Admin: ${user.isAdmin ? require_base_command.source_default.green("Yes") : require_base_command.source_default.gray("No")}`));
|
|
76
|
+
this.log(require_base_command.source_default.white(`Email Verified: ${user.emailVerified ? require_base_command.source_default.green("Yes") : require_base_command.source_default.gray("No")}`));
|
|
77
|
+
if (user.image) this.log(require_base_command.source_default.white(`Image: ${require_base_command.source_default.cyan(user.image)}`));
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
//#endregion
|
|
82
|
+
module.exports = AdminUserCreate;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
const require_chunk = require('../../chunk-CbDLau6x.cjs');
|
|
2
|
+
const require_fix_event_emitter = require('../../fix-event-emitter-uhRntilb.cjs');
|
|
3
|
+
const require_base_command = require('../../base-command-GfDxcqx6.cjs');
|
|
4
|
+
const require_api = require('../../api-XWM8zKbb.cjs');
|
|
5
|
+
const require_api_client = require('../../api-client-bnV0ib_r.cjs');
|
|
6
|
+
let __oclif_core = require("@oclif/core");
|
|
7
|
+
|
|
8
|
+
//#region src/commands/api-key/create.ts
|
|
9
|
+
require_fix_event_emitter.fixEventEmitterWarning();
|
|
10
|
+
var ApiKeyCreate = class ApiKeyCreate extends require_base_command.BaseCommand {
|
|
11
|
+
static args = { name: __oclif_core.Args.string({
|
|
12
|
+
description: "API key name",
|
|
13
|
+
required: true
|
|
14
|
+
}) };
|
|
15
|
+
static description = "Create a new API key for your organization";
|
|
16
|
+
static examples = [
|
|
17
|
+
"<%= config.bin %> <%= command.id %> \"My API Key\"",
|
|
18
|
+
"<%= config.bin %> <%= command.id %> \"Production API\" --description=\"For production use\" --status=active",
|
|
19
|
+
"<%= config.bin %> <%= command.id %> \"Test Key\" --description=\"Temporary test key\" --status=pending"
|
|
20
|
+
];
|
|
21
|
+
static flags = {
|
|
22
|
+
description: __oclif_core.Flags.string({
|
|
23
|
+
char: "d",
|
|
24
|
+
description: "API key description"
|
|
25
|
+
}),
|
|
26
|
+
status: __oclif_core.Flags.string({
|
|
27
|
+
char: "s",
|
|
28
|
+
description: "API key status",
|
|
29
|
+
options: [
|
|
30
|
+
"active",
|
|
31
|
+
"inactive",
|
|
32
|
+
"revoked",
|
|
33
|
+
"pending",
|
|
34
|
+
"suspended"
|
|
35
|
+
],
|
|
36
|
+
default: "active"
|
|
37
|
+
}),
|
|
38
|
+
apikey: __oclif_core.Flags.string({
|
|
39
|
+
char: "k",
|
|
40
|
+
description: "API key to use for authentication (overrides API_KEY env variable)"
|
|
41
|
+
})
|
|
42
|
+
};
|
|
43
|
+
async run() {
|
|
44
|
+
const { args, flags } = await this.parse(ApiKeyCreate);
|
|
45
|
+
const apiClient = new require_api_client.ApiClient(require_api.getApiUrl(), flags.apikey || process.env.API_KEY);
|
|
46
|
+
const apiKeyData = {
|
|
47
|
+
name: args.name,
|
|
48
|
+
...flags.description && { description: flags.description },
|
|
49
|
+
status: flags.status
|
|
50
|
+
};
|
|
51
|
+
this.log(require_base_command.source_default.gray("Creating API key..."));
|
|
52
|
+
const [result, error] = (await apiClient.apiKeys.create(apiKeyData)).toTuple();
|
|
53
|
+
if (error) {
|
|
54
|
+
this.error(`Failed to create API key: ${error.message}`);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const apiKey = result.data.apiKey;
|
|
58
|
+
this.log(require_base_command.source_default.green("✓ API key created successfully!"));
|
|
59
|
+
this.log(require_base_command.source_default.white(`ID: ${require_base_command.source_default.cyan(apiKey.id)}`));
|
|
60
|
+
this.log(require_base_command.source_default.white(`Name: ${require_base_command.source_default.cyan(apiKey.name)}`));
|
|
61
|
+
this.log(require_base_command.source_default.white(`Public Key: ${require_base_command.source_default.cyan(apiKey.publicKey)}`));
|
|
62
|
+
const statusColor = {
|
|
63
|
+
active: require_base_command.source_default.green,
|
|
64
|
+
inactive: require_base_command.source_default.gray,
|
|
65
|
+
revoked: require_base_command.source_default.red,
|
|
66
|
+
pending: require_base_command.source_default.yellow,
|
|
67
|
+
suspended: require_base_command.source_default.red
|
|
68
|
+
}[apiKey.status] || require_base_command.source_default.gray;
|
|
69
|
+
this.log(require_base_command.source_default.white(`Status: ${statusColor(apiKey.status)}`));
|
|
70
|
+
this.log(require_base_command.source_default.white(`Description: ${require_base_command.source_default.gray(apiKey.description || "N/A")}`));
|
|
71
|
+
this.log(require_base_command.source_default.white(`Created: ${require_base_command.source_default.gray(new Date(apiKey.createdAt).toLocaleDateString())}`));
|
|
72
|
+
this.log("");
|
|
73
|
+
this.log(require_base_command.source_default.yellow("⚠️ IMPORTANT: Save this API key - it will only be shown once!"));
|
|
74
|
+
this.log(require_base_command.source_default.white(`Full API Key: ${require_base_command.source_default.red(apiKey.fullKey)}`));
|
|
75
|
+
this.log("");
|
|
76
|
+
this.log(require_base_command.source_default.gray("You can now use this API key to authenticate with the Pump API."));
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
//#endregion
|
|
81
|
+
module.exports = ApiKeyCreate;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
const require_chunk = require('../../chunk-CbDLau6x.cjs');
|
|
2
|
+
const require_fix_event_emitter = require('../../fix-event-emitter-uhRntilb.cjs');
|
|
3
|
+
const require_base_command = require('../../base-command-GfDxcqx6.cjs');
|
|
4
|
+
const require_api = require('../../api-XWM8zKbb.cjs');
|
|
5
|
+
const require_api_client = require('../../api-client-bnV0ib_r.cjs');
|
|
6
|
+
let __oclif_core = require("@oclif/core");
|
|
7
|
+
|
|
8
|
+
//#region src/commands/api-key/delete.ts
|
|
9
|
+
require_fix_event_emitter.fixEventEmitterWarning();
|
|
10
|
+
var ApiKeyDelete = class ApiKeyDelete extends require_base_command.BaseCommand {
|
|
11
|
+
static args = { id: __oclif_core.Args.string({
|
|
12
|
+
description: "API key ID to delete",
|
|
13
|
+
required: true
|
|
14
|
+
}) };
|
|
15
|
+
static description = "Delete an API key";
|
|
16
|
+
static examples = ["<%= config.bin %> <%= command.id %> abc-123", "<%= config.bin %> <%= command.id %> abc-123 --force"];
|
|
17
|
+
static flags = {
|
|
18
|
+
force: __oclif_core.Flags.boolean({
|
|
19
|
+
char: "f",
|
|
20
|
+
description: "Skip confirmation prompt",
|
|
21
|
+
default: false
|
|
22
|
+
}),
|
|
23
|
+
apikey: __oclif_core.Flags.string({
|
|
24
|
+
char: "k",
|
|
25
|
+
description: "API key to use for authentication (overrides API_KEY env variable)"
|
|
26
|
+
})
|
|
27
|
+
};
|
|
28
|
+
async run() {
|
|
29
|
+
const { args, flags } = await this.parse(ApiKeyDelete);
|
|
30
|
+
if (!flags.force) {
|
|
31
|
+
this.log(require_base_command.source_default.yellow("⚠️ This will permanently delete the API key. This action cannot be undone."));
|
|
32
|
+
this.log(require_base_command.source_default.gray("Use --force to skip this warning."));
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const apiClient = new require_api_client.ApiClient(require_api.getApiUrl(), flags.apikey || process.env.API_KEY);
|
|
36
|
+
this.log(require_base_command.source_default.gray("Deleting API key..."));
|
|
37
|
+
const [, error] = (await apiClient.apiKeys.delete(args.id)).toTuple();
|
|
38
|
+
if (error) {
|
|
39
|
+
this.error(`Failed to delete API key: ${error.message}`);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
this.log(require_base_command.source_default.green("✓ API key deleted successfully!"));
|
|
43
|
+
this.log(require_base_command.source_default.white(`ID: ${require_base_command.source_default.cyan(args.id)}`));
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
//#endregion
|
|
48
|
+
module.exports = ApiKeyDelete;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
const require_chunk = require('../../chunk-CbDLau6x.cjs');
|
|
2
|
+
const require_fix_event_emitter = require('../../fix-event-emitter-uhRntilb.cjs');
|
|
3
|
+
const require_base_command = require('../../base-command-GfDxcqx6.cjs');
|
|
4
|
+
const require_api = require('../../api-XWM8zKbb.cjs');
|
|
5
|
+
const require_api_client = require('../../api-client-bnV0ib_r.cjs');
|
|
6
|
+
let __oclif_core = require("@oclif/core");
|
|
7
|
+
|
|
8
|
+
//#region src/commands/api-key/list.ts
|
|
9
|
+
require_fix_event_emitter.fixEventEmitterWarning();
|
|
10
|
+
var ApiKeyList = class ApiKeyList extends require_base_command.BaseCommand {
|
|
11
|
+
static description = "List all API keys for your organization";
|
|
12
|
+
static examples = [
|
|
13
|
+
"<%= config.bin %> <%= command.id %>",
|
|
14
|
+
"<%= config.bin %> <%= command.id %> --json",
|
|
15
|
+
"<%= config.bin %> <%= command.id %> --status=active"
|
|
16
|
+
];
|
|
17
|
+
static flags = {
|
|
18
|
+
json: __oclif_core.Flags.boolean({
|
|
19
|
+
char: "j",
|
|
20
|
+
description: "Output as JSON",
|
|
21
|
+
default: false
|
|
22
|
+
}),
|
|
23
|
+
status: __oclif_core.Flags.string({
|
|
24
|
+
char: "s",
|
|
25
|
+
description: "Filter by status",
|
|
26
|
+
options: [
|
|
27
|
+
"active",
|
|
28
|
+
"inactive",
|
|
29
|
+
"revoked",
|
|
30
|
+
"pending",
|
|
31
|
+
"suspended"
|
|
32
|
+
]
|
|
33
|
+
}),
|
|
34
|
+
apikey: __oclif_core.Flags.string({
|
|
35
|
+
char: "k",
|
|
36
|
+
description: "API key to use for authentication (overrides API_KEY env variable)"
|
|
37
|
+
})
|
|
38
|
+
};
|
|
39
|
+
async run() {
|
|
40
|
+
const { flags } = await this.parse(ApiKeyList);
|
|
41
|
+
const apiClient = new require_api_client.ApiClient(require_api.getApiUrl(), flags.apikey || process.env.API_KEY);
|
|
42
|
+
this.log(require_base_command.source_default.gray("Fetching API keys..."));
|
|
43
|
+
const [result, error] = (await apiClient.apiKeys.list()).toTuple();
|
|
44
|
+
if (error) {
|
|
45
|
+
this.error(`Failed to get API keys: ${error.message}`);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
let apiKeys = result.data.apiKeys;
|
|
49
|
+
if (flags.status) apiKeys = apiKeys.filter((key) => key.status === flags.status);
|
|
50
|
+
if (apiKeys.length === 0) {
|
|
51
|
+
const statusMsg = flags.status ? ` with status "${flags.status}"` : "";
|
|
52
|
+
this.log(require_base_command.source_default.yellow(`No API keys found${statusMsg}`));
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
if (flags.json) {
|
|
56
|
+
this.log(JSON.stringify(apiKeys, null, 2));
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
this.log(require_base_command.source_default.green(`✓ Found ${apiKeys.length} API keys`));
|
|
60
|
+
this.log("");
|
|
61
|
+
apiKeys.forEach((key, index) => {
|
|
62
|
+
const statusColor = {
|
|
63
|
+
active: require_base_command.source_default.green,
|
|
64
|
+
inactive: require_base_command.source_default.gray,
|
|
65
|
+
revoked: require_base_command.source_default.red,
|
|
66
|
+
pending: require_base_command.source_default.yellow,
|
|
67
|
+
suspended: require_base_command.source_default.red
|
|
68
|
+
}[key.status] || require_base_command.source_default.gray;
|
|
69
|
+
this.log(require_base_command.source_default.white(`${index + 1}. ${require_base_command.source_default.cyan(key.name)}`));
|
|
70
|
+
this.log(require_base_command.source_default.white(` ID: ${require_base_command.source_default.gray(key.id)}`));
|
|
71
|
+
this.log(require_base_command.source_default.white(` Api Key: ${require_base_command.source_default.gray(`pump-inc-${key.publicKey}-${key.privateKey}`)}`));
|
|
72
|
+
this.log(require_base_command.source_default.white(` Public Key: ${require_base_command.source_default.gray(key.publicKey)}`));
|
|
73
|
+
this.log(require_base_command.source_default.white(` Status: ${statusColor(key.status)}`));
|
|
74
|
+
this.log(require_base_command.source_default.white(` Description: ${require_base_command.source_default.gray(key.description || "N/A")}`));
|
|
75
|
+
this.log(require_base_command.source_default.white(` Created: ${require_base_command.source_default.gray(new Date(key.createdAt).toLocaleString())}`));
|
|
76
|
+
this.log(require_base_command.source_default.white(` Updated: ${require_base_command.source_default.gray(new Date(key.updatedAt).toLocaleString())}`));
|
|
77
|
+
if (index < apiKeys.length - 1) this.log("");
|
|
78
|
+
});
|
|
79
|
+
this.log("");
|
|
80
|
+
this.log(require_base_command.source_default.green(`✓ Successfully listed ${apiKeys.length} API keys`));
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
//#endregion
|
|
85
|
+
module.exports = ApiKeyList;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
const require_chunk = require('../../chunk-CbDLau6x.cjs');
|
|
2
|
+
const require_fix_event_emitter = require('../../fix-event-emitter-uhRntilb.cjs');
|
|
3
|
+
const require_base_command = require('../../base-command-GfDxcqx6.cjs');
|
|
4
|
+
const require_api = require('../../api-XWM8zKbb.cjs');
|
|
5
|
+
const require_api_client = require('../../api-client-bnV0ib_r.cjs');
|
|
6
|
+
let __oclif_core = require("@oclif/core");
|
|
7
|
+
|
|
8
|
+
//#region src/commands/api-key/update.ts
|
|
9
|
+
require_fix_event_emitter.fixEventEmitterWarning();
|
|
10
|
+
var ApiKeyUpdate = class ApiKeyUpdate extends require_base_command.BaseCommand {
|
|
11
|
+
static args = { id: __oclif_core.Args.string({
|
|
12
|
+
description: "API key ID to update",
|
|
13
|
+
required: true
|
|
14
|
+
}) };
|
|
15
|
+
static description = "Update an existing API key";
|
|
16
|
+
static examples = [
|
|
17
|
+
"<%= config.bin %> <%= command.id %> abc-123 --name=\"Updated Name\"",
|
|
18
|
+
"<%= config.bin %> <%= command.id %> abc-123 --description=\"New description\" --status=inactive",
|
|
19
|
+
"<%= config.bin %> <%= command.id %> abc-123 --status=revoked"
|
|
20
|
+
];
|
|
21
|
+
static flags = {
|
|
22
|
+
name: __oclif_core.Flags.string({
|
|
23
|
+
char: "n",
|
|
24
|
+
description: "New API key name"
|
|
25
|
+
}),
|
|
26
|
+
description: __oclif_core.Flags.string({
|
|
27
|
+
char: "d",
|
|
28
|
+
description: "New API key description"
|
|
29
|
+
}),
|
|
30
|
+
status: __oclif_core.Flags.string({
|
|
31
|
+
char: "s",
|
|
32
|
+
description: "New API key status",
|
|
33
|
+
options: [
|
|
34
|
+
"active",
|
|
35
|
+
"inactive",
|
|
36
|
+
"revoked",
|
|
37
|
+
"pending",
|
|
38
|
+
"suspended"
|
|
39
|
+
]
|
|
40
|
+
}),
|
|
41
|
+
apikey: __oclif_core.Flags.string({
|
|
42
|
+
char: "k",
|
|
43
|
+
description: "API key to use for authentication (overrides API_KEY env variable)"
|
|
44
|
+
})
|
|
45
|
+
};
|
|
46
|
+
async run() {
|
|
47
|
+
const { args, flags } = await this.parse(ApiKeyUpdate);
|
|
48
|
+
if (!flags.name && !flags.description && !flags.status) {
|
|
49
|
+
this.error("You must provide at least one field to update (--name, --description, or --status)");
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const apiClient = new require_api_client.ApiClient(require_api.getApiUrl(), flags.apikey || process.env.API_KEY);
|
|
53
|
+
const updateData = {};
|
|
54
|
+
if (flags.name) updateData.name = flags.name;
|
|
55
|
+
if (flags.description !== void 0) updateData.description = flags.description;
|
|
56
|
+
if (flags.status) updateData.status = flags.status;
|
|
57
|
+
this.log(require_base_command.source_default.gray("Updating API key..."));
|
|
58
|
+
const [result, error] = (await apiClient.apiKeys.update(args.id, updateData)).toTuple();
|
|
59
|
+
if (error) {
|
|
60
|
+
this.error(`Failed to update API key: ${error.message}`);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
const apiKey = result.data.apiKey;
|
|
64
|
+
this.log(require_base_command.source_default.green("✓ API key updated successfully!"));
|
|
65
|
+
this.log(require_base_command.source_default.white(`ID: ${require_base_command.source_default.cyan(apiKey.id)}`));
|
|
66
|
+
this.log(require_base_command.source_default.white(`Name: ${require_base_command.source_default.cyan(apiKey.name)}`));
|
|
67
|
+
const statusColor = {
|
|
68
|
+
active: require_base_command.source_default.green,
|
|
69
|
+
inactive: require_base_command.source_default.gray,
|
|
70
|
+
revoked: require_base_command.source_default.red,
|
|
71
|
+
pending: require_base_command.source_default.yellow,
|
|
72
|
+
suspended: require_base_command.source_default.red
|
|
73
|
+
}[apiKey.status] || require_base_command.source_default.gray;
|
|
74
|
+
this.log(require_base_command.source_default.white(`Status: ${statusColor(apiKey.status)}`));
|
|
75
|
+
this.log(require_base_command.source_default.white(`Description: ${require_base_command.source_default.gray(apiKey.description || "N/A")}`));
|
|
76
|
+
this.log(require_base_command.source_default.white(`Updated: ${require_base_command.source_default.gray(new Date(apiKey.updatedAt).toLocaleDateString())}`));
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
//#endregion
|
|
81
|
+
module.exports = ApiKeyUpdate;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
const require_chunk = require('../../chunk-CbDLau6x.cjs');
|
|
2
|
+
const require_fix_event_emitter = require('../../fix-event-emitter-uhRntilb.cjs');
|
|
3
|
+
const require_base_command = require('../../base-command-GfDxcqx6.cjs');
|
|
4
|
+
const require_api = require('../../api-XWM8zKbb.cjs');
|
|
5
|
+
const require_api_client = require('../../api-client-bnV0ib_r.cjs');
|
|
6
|
+
let __oclif_core = require("@oclif/core");
|
|
7
|
+
|
|
8
|
+
//#region src/commands/app/create.ts
|
|
9
|
+
require_fix_event_emitter.fixEventEmitterWarning();
|
|
10
|
+
var AppCreate = class AppCreate extends require_base_command.BaseCommand {
|
|
11
|
+
static args = { name: __oclif_core.Args.string({
|
|
12
|
+
description: "Application name",
|
|
13
|
+
required: true
|
|
14
|
+
}) };
|
|
15
|
+
static description = "Create a new application";
|
|
16
|
+
static examples = [
|
|
17
|
+
"<%= config.bin %> <%= command.id %> \"My App\" --project-id=proj-123 --type=processor",
|
|
18
|
+
"<%= config.bin %> <%= command.id %> \"API Service\" --project-id=proj-456 --type=processor --cpu=1 --memory=512",
|
|
19
|
+
"<%= config.bin %> <%= command.id %> \"Worker\" --project-id=proj-789 --type=cron --cpu=2 --status=active",
|
|
20
|
+
"<%= config.bin %> <%= command.id %> \"My App\" --project-id=proj-123 --type=processor --json"
|
|
21
|
+
];
|
|
22
|
+
static flags = {
|
|
23
|
+
"project-id": __oclif_core.Flags.string({
|
|
24
|
+
char: "p",
|
|
25
|
+
description: "Project ID where the application will be created",
|
|
26
|
+
required: true
|
|
27
|
+
}),
|
|
28
|
+
"type": __oclif_core.Flags.string({
|
|
29
|
+
char: "t",
|
|
30
|
+
description: "Application type",
|
|
31
|
+
options: ["processor", "cron"],
|
|
32
|
+
default: "processor",
|
|
33
|
+
required: false
|
|
34
|
+
}),
|
|
35
|
+
"status": __oclif_core.Flags.string({
|
|
36
|
+
char: "s",
|
|
37
|
+
description: "Application status",
|
|
38
|
+
options: [
|
|
39
|
+
"pending",
|
|
40
|
+
"active",
|
|
41
|
+
"inactive"
|
|
42
|
+
],
|
|
43
|
+
default: "pending"
|
|
44
|
+
}),
|
|
45
|
+
"cpu": __oclif_core.Flags.string({ description: "CPU resources (cores)" }),
|
|
46
|
+
"memory": __oclif_core.Flags.string({ description: "Memory resources (MB)" }),
|
|
47
|
+
"storage": __oclif_core.Flags.string({ description: "Storage resources (GB)" }),
|
|
48
|
+
"network": __oclif_core.Flags.string({ description: "Network resources (Mbps)" }),
|
|
49
|
+
"apikey": __oclif_core.Flags.string({
|
|
50
|
+
char: "k",
|
|
51
|
+
description: "API key to use for authentication (overrides API_KEY env variable)"
|
|
52
|
+
}),
|
|
53
|
+
"json": __oclif_core.Flags.boolean({ description: "Output result as JSON" })
|
|
54
|
+
};
|
|
55
|
+
async run() {
|
|
56
|
+
const { args, flags } = await this.parse(AppCreate);
|
|
57
|
+
const apiClient = new require_api_client.ApiClient(require_api.getApiUrl(), flags.apikey || process.env.API_KEY);
|
|
58
|
+
const applicationData = {
|
|
59
|
+
name: args.name,
|
|
60
|
+
projectId: flags["project-id"],
|
|
61
|
+
type: flags.type,
|
|
62
|
+
status: flags.status,
|
|
63
|
+
...flags.cpu && { resourceCpu: parseFloat(flags.cpu) },
|
|
64
|
+
...flags.memory && { resourceMemory: parseInt(flags.memory) },
|
|
65
|
+
...flags.storage && { resourceStorage: parseInt(flags.storage) },
|
|
66
|
+
...flags.network && { resourceNetwork: parseInt(flags.network) }
|
|
67
|
+
};
|
|
68
|
+
if (!flags.json) this.log(require_base_command.source_default.gray("Creating application..."));
|
|
69
|
+
const [result, error] = (await apiClient.applications.create(applicationData)).toTuple();
|
|
70
|
+
if (error) {
|
|
71
|
+
if (flags.json) {
|
|
72
|
+
this.log(JSON.stringify({ error: error.message }, null, 2));
|
|
73
|
+
this.exit(1);
|
|
74
|
+
} else this.error(`Failed to create application: ${error.message}`);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const application = result.data.application;
|
|
78
|
+
if (flags.json) this.log(JSON.stringify({ application }, null, 2));
|
|
79
|
+
else {
|
|
80
|
+
this.log(require_base_command.source_default.green("✓ Application created successfully!"));
|
|
81
|
+
this.log(require_base_command.source_default.white(`ID: ${require_base_command.source_default.cyan(application.id)}`));
|
|
82
|
+
this.log(require_base_command.source_default.white(`Name: ${require_base_command.source_default.cyan(application.name)}`));
|
|
83
|
+
const statusColor = {
|
|
84
|
+
pending: require_base_command.source_default.yellow,
|
|
85
|
+
active: require_base_command.source_default.green,
|
|
86
|
+
inactive: require_base_command.source_default.gray
|
|
87
|
+
}[application.status] || require_base_command.source_default.gray;
|
|
88
|
+
this.log(require_base_command.source_default.white(`Status: ${statusColor(application.status)}`));
|
|
89
|
+
this.log(require_base_command.source_default.white(`Project: ${require_base_command.source_default.gray(application.project.name)}`));
|
|
90
|
+
this.log(require_base_command.source_default.white(`Created: ${require_base_command.source_default.gray(new Date(application.createdAt).toLocaleDateString())}`));
|
|
91
|
+
if (application.domainName) this.log(require_base_command.source_default.white(`Domain: ${require_base_command.source_default.gray(application.domainName)}`));
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
//#endregion
|
|
97
|
+
module.exports = AppCreate;
|