@fluid-app/fluid-cli-droplets 0.1.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/.turbo/turbo-build.log +18 -0
- package/dist/index.d.mts +7 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +141 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +42 -0
- package/scripts/generate.ts +16 -0
- package/src/generated/categories.ts +18 -0
- package/src/generated/index.ts +16 -0
- package/src/generated/installations.ts +99 -0
- package/src/generated/primary.ts +96 -0
- package/src/index.ts +20 -0
- package/tsconfig.json +10 -0
- package/tsdown.config.ts +12 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
> @fluid-app/fluid-cli-droplets@0.1.0 build /home/runner/_work/fluid-mono/fluid-mono/packages/cli/droplets
|
|
3
|
+
> tsdown
|
|
4
|
+
|
|
5
|
+
[34mℹ[39m tsdown [2mv0.21.0[22m powered by rolldown [2mv1.0.0-rc.7[22m
|
|
6
|
+
[34mℹ[39m config file: [4m/home/runner/_work/fluid-mono/fluid-mono/packages/cli/droplets/tsdown.config.ts[24m
|
|
7
|
+
[34mℹ[39m entry: [34msrc/index.ts[39m
|
|
8
|
+
[34mℹ[39m target: [34mnode18[39m
|
|
9
|
+
[34mℹ[39m tsconfig: [34mtsconfig.json[39m
|
|
10
|
+
[34mℹ[39m Build start
|
|
11
|
+
[34mℹ[39m [2mdist/[22m[1mindex.mjs[22m [2m 6.70 kB[22m [2m│ gzip: 1.17 kB[22m
|
|
12
|
+
[34mℹ[39m [2mdist/[22mindex.mjs.map [2m13.57 kB[22m [2m│ gzip: 2.30 kB[22m
|
|
13
|
+
[34mℹ[39m [2mdist/[22mindex.d.mts.map [2m 0.11 kB[22m [2m│ gzip: 0.12 kB[22m
|
|
14
|
+
[34mℹ[39m [2mdist/[22m[32m[1mindex.d.mts[22m[39m [2m 0.19 kB[22m [2m│ gzip: 0.16 kB[22m
|
|
15
|
+
[34mℹ[39m 4 files, total: 20.58 kB
|
|
16
|
+
[33m[PLUGIN_TIMINGS] Warning:[0m Your build spent significant time in plugin `rolldown-plugin-dts:generate`. See https://rolldown.rs/options/checks#plugintimings for more details.
|
|
17
|
+
|
|
18
|
+
[32m✔[39m Build complete in [32m3282ms[39m
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;cAKM,MAAA,EAAQ,WAAA"}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { createDomainCommand } from "@fluid-app/fluid-cli";
|
|
2
|
+
import "commander";
|
|
3
|
+
//#region src/generated/categories.ts
|
|
4
|
+
function registerCategories(parent, ctx) {
|
|
5
|
+
parent.command("categories").description("categories").command("list").description("Returns a list of all droplet categories").action(async () => {
|
|
6
|
+
const client = await ctx.getClient();
|
|
7
|
+
if (ctx.verbose) process.stderr.write("GET /api/droplet_categories\n");
|
|
8
|
+
const result = await client.get(`/api/droplet_categories`);
|
|
9
|
+
ctx.output(result);
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/generated/installations.ts
|
|
14
|
+
function registerInstallations(parent, ctx) {
|
|
15
|
+
const resource = parent.command("installations").description("installations");
|
|
16
|
+
resource.command("list").description("List droplet installations").option("--page <value>", "Page number for pagination").option("--per-page <value>", "Number of records per page (max: 100)").option("--category <value>", "Filter by droplet category").action(async (opts) => {
|
|
17
|
+
const client = await ctx.getClient();
|
|
18
|
+
const params = {};
|
|
19
|
+
if (opts.page !== void 0) params["page"] = Number(opts.page);
|
|
20
|
+
if (opts.perPage !== void 0) params["per_page"] = Number(opts.perPage);
|
|
21
|
+
if (opts.category !== void 0) params["category"] = opts.category;
|
|
22
|
+
if (ctx.verbose) process.stderr.write("GET /api/droplet_installations\n");
|
|
23
|
+
const result = await client.get(`/api/droplet_installations`, params);
|
|
24
|
+
ctx.output(result);
|
|
25
|
+
});
|
|
26
|
+
resource.command("create").description("Create a droplet installation").option("--body <json>", "Request body as JSON string").option("--body-file <path>", "Read request body from file").action(async (opts) => {
|
|
27
|
+
const client = await ctx.getClient();
|
|
28
|
+
let body;
|
|
29
|
+
if (opts.bodyFile) {
|
|
30
|
+
const { readFileSync } = await import("fs");
|
|
31
|
+
body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
|
|
32
|
+
} else if (opts.body) body = ctx.parseBody(opts.body);
|
|
33
|
+
if (ctx.verbose) process.stderr.write("POST /api/droplet_installations\n");
|
|
34
|
+
const result = await client.post(`/api/droplet_installations`, body);
|
|
35
|
+
ctx.output(result);
|
|
36
|
+
});
|
|
37
|
+
resource.command("get <uuid>").description("Show a droplet installation").action(async (uuid) => {
|
|
38
|
+
const client = await ctx.getClient();
|
|
39
|
+
if (ctx.verbose) process.stderr.write(`GET /api/droplet_installations/${uuid}
|
|
40
|
+
`);
|
|
41
|
+
const result = await client.get(`/api/droplet_installations/${uuid}`);
|
|
42
|
+
ctx.output(result);
|
|
43
|
+
});
|
|
44
|
+
resource.command("update <uuid>").description("Update a droplet installation").option("--body <json>", "Request body as JSON string").option("--body-file <path>", "Read request body from file").action(async (uuid, opts) => {
|
|
45
|
+
const client = await ctx.getClient();
|
|
46
|
+
let body;
|
|
47
|
+
if (opts.bodyFile) {
|
|
48
|
+
const { readFileSync } = await import("fs");
|
|
49
|
+
body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
|
|
50
|
+
} else if (opts.body) body = ctx.parseBody(opts.body);
|
|
51
|
+
if (ctx.verbose) process.stderr.write(`PUT /api/droplet_installations/${uuid}
|
|
52
|
+
`);
|
|
53
|
+
const result = await client.put(`/api/droplet_installations/${uuid}`, body);
|
|
54
|
+
ctx.output(result);
|
|
55
|
+
});
|
|
56
|
+
resource.command("delete <uuid>").description("Delete a droplet installation").action(async (uuid) => {
|
|
57
|
+
const client = await ctx.getClient();
|
|
58
|
+
if (ctx.verbose) process.stderr.write(`DELETE /api/droplet_installations/${uuid}
|
|
59
|
+
`);
|
|
60
|
+
const result = await client.delete(`/api/droplet_installations/${uuid}`);
|
|
61
|
+
ctx.output(result);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
//#endregion
|
|
65
|
+
//#region src/generated/primary.ts
|
|
66
|
+
function registerPrimary(parent, ctx) {
|
|
67
|
+
parent.command("get-companies <uuid>").description("returns an array of companies using a droplet").option("--pagination <value>", "pagination").action(async (uuid, opts) => {
|
|
68
|
+
const client = await ctx.getClient();
|
|
69
|
+
const params = {};
|
|
70
|
+
if (opts.pagination !== void 0) params["pagination"] = opts.pagination;
|
|
71
|
+
if (ctx.verbose) process.stderr.write(`GET /api/droplets/${uuid}/companies
|
|
72
|
+
`);
|
|
73
|
+
const result = await client.get(`/api/droplets/${uuid}/companies`, params);
|
|
74
|
+
ctx.output(result);
|
|
75
|
+
});
|
|
76
|
+
parent.command("list").description("An array of available droplets").option("--pagination <value>", "pagination").action(async (opts) => {
|
|
77
|
+
const client = await ctx.getClient();
|
|
78
|
+
const params = {};
|
|
79
|
+
if (opts.pagination !== void 0) params["pagination"] = opts.pagination;
|
|
80
|
+
if (ctx.verbose) process.stderr.write("GET /api/droplets\n");
|
|
81
|
+
const result = await client.get(`/api/droplets`, params);
|
|
82
|
+
ctx.output(result);
|
|
83
|
+
});
|
|
84
|
+
parent.command("create").description("creates a droplet").option("--body <json>", "Request body as JSON string").option("--body-file <path>", "Read request body from file").action(async (opts) => {
|
|
85
|
+
const client = await ctx.getClient();
|
|
86
|
+
let body;
|
|
87
|
+
if (opts.bodyFile) {
|
|
88
|
+
const { readFileSync } = await import("fs");
|
|
89
|
+
body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
|
|
90
|
+
} else if (opts.body) body = ctx.parseBody(opts.body);
|
|
91
|
+
if (ctx.verbose) process.stderr.write("POST /api/droplets\n");
|
|
92
|
+
const result = await client.post(`/api/droplets`, body);
|
|
93
|
+
ctx.output(result);
|
|
94
|
+
});
|
|
95
|
+
parent.command("get <uuid>").description("shows a droplet").action(async (uuid) => {
|
|
96
|
+
const client = await ctx.getClient();
|
|
97
|
+
if (ctx.verbose) process.stderr.write(`GET /api/droplets/${uuid}
|
|
98
|
+
`);
|
|
99
|
+
const result = await client.get(`/api/droplets/${uuid}`);
|
|
100
|
+
ctx.output(result);
|
|
101
|
+
});
|
|
102
|
+
parent.command("update <uuid>").description("updates a droplet").option("--body <json>", "Request body as JSON string").option("--body-file <path>", "Read request body from file").action(async (uuid, opts) => {
|
|
103
|
+
const client = await ctx.getClient();
|
|
104
|
+
let body;
|
|
105
|
+
if (opts.bodyFile) {
|
|
106
|
+
const { readFileSync } = await import("fs");
|
|
107
|
+
body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
|
|
108
|
+
} else if (opts.body) body = ctx.parseBody(opts.body);
|
|
109
|
+
if (ctx.verbose) process.stderr.write(`PUT /api/droplets/${uuid}
|
|
110
|
+
`);
|
|
111
|
+
const result = await client.put(`/api/droplets/${uuid}`, body);
|
|
112
|
+
ctx.output(result);
|
|
113
|
+
});
|
|
114
|
+
parent.command("delete <uuid>").description("deletes a droplet").action(async (uuid) => {
|
|
115
|
+
const client = await ctx.getClient();
|
|
116
|
+
if (ctx.verbose) process.stderr.write(`DELETE /api/droplets/${uuid}
|
|
117
|
+
`);
|
|
118
|
+
const result = await client.delete(`/api/droplets/${uuid}`);
|
|
119
|
+
ctx.output(result);
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
//#endregion
|
|
123
|
+
//#region src/generated/index.ts
|
|
124
|
+
function registerAllCommands(parent, ctx) {
|
|
125
|
+
registerCategories(parent, ctx);
|
|
126
|
+
registerInstallations(parent, ctx);
|
|
127
|
+
registerPrimary(parent, ctx);
|
|
128
|
+
}
|
|
129
|
+
//#endregion
|
|
130
|
+
//#region src/index.ts
|
|
131
|
+
const plugin = {
|
|
132
|
+
name: "@fluid-app/fluid-cli-droplets",
|
|
133
|
+
version: "0.1.0",
|
|
134
|
+
register(ctx) {
|
|
135
|
+
ctx.program.addCommand(createDomainCommand("droplets", "Manage Fluid droplets and installations", registerAllCommands));
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
//#endregion
|
|
139
|
+
export { plugin as default };
|
|
140
|
+
|
|
141
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/generated/categories.ts","../src/generated/installations.ts","../src/generated/primary.ts","../src/generated/index.ts","../src/index.ts"],"sourcesContent":["// categories.ts — AUTO-GENERATED, DO NOT EDIT\nimport { Command } from \"commander\";\nimport type { CommandContext } from \"@fluid-app/fluid-cli\";\n\nexport function registerCategories(parent: Command, ctx: CommandContext): void {\n const resource = parent.command(\"categories\").description(\"categories\");\n\n resource\n .command(\"list\")\n .description(\"Returns a list of all droplet categories\")\n .action(async () => {\n const client = await ctx.getClient();\n if (ctx.verbose)\n process.stderr.write(\"GET \" + `/api/droplet_categories` + \"\\n\");\n const result = await client.get(`/api/droplet_categories`);\n ctx.output(result);\n });\n}\n","// installations.ts — AUTO-GENERATED, DO NOT EDIT\nimport { Command } from \"commander\";\nimport type { CommandContext } from \"@fluid-app/fluid-cli\";\n\nexport function registerInstallations(\n parent: Command,\n ctx: CommandContext,\n): void {\n const resource = parent.command(\"installations\").description(\"installations\");\n\n resource\n .command(\"list\")\n .description(\"List droplet installations\")\n .option(\"--page <value>\", \"Page number for pagination\")\n .option(\"--per-page <value>\", \"Number of records per page (max: 100)\")\n .option(\"--category <value>\", \"Filter by droplet category\")\n .action(async (opts) => {\n const client = await ctx.getClient();\n const params: Record<string, unknown> = {};\n if (opts.page !== undefined) params[\"page\"] = Number(opts.page);\n if (opts.perPage !== undefined) params[\"per_page\"] = Number(opts.perPage);\n if (opts.category !== undefined) params[\"category\"] = opts.category;\n if (ctx.verbose)\n process.stderr.write(\"GET \" + `/api/droplet_installations` + \"\\n\");\n const result = await client.get(`/api/droplet_installations`, params);\n ctx.output(result);\n });\n\n resource\n .command(\"create\")\n .description(\"Create a droplet installation\")\n .option(\"--body <json>\", \"Request body as JSON string\")\n .option(\"--body-file <path>\", \"Read request body from file\")\n .action(async (opts) => {\n const client = await ctx.getClient();\n let body: unknown;\n if (opts.bodyFile) {\n const { readFileSync } = await import(\"fs\");\n body = ctx.parseBody(readFileSync(opts.bodyFile, \"utf-8\"));\n } else if (opts.body) {\n body = ctx.parseBody(opts.body);\n }\n if (ctx.verbose)\n process.stderr.write(\"POST \" + `/api/droplet_installations` + \"\\n\");\n const result = await client.post(`/api/droplet_installations`, body);\n ctx.output(result);\n });\n\n resource\n .command(\"get <uuid>\")\n .description(\"Show a droplet installation\")\n .action(async (uuid) => {\n const client = await ctx.getClient();\n if (ctx.verbose)\n process.stderr.write(\n \"GET \" + `/api/droplet_installations/${uuid}` + \"\\n\",\n );\n const result = await client.get(`/api/droplet_installations/${uuid}`);\n ctx.output(result);\n });\n\n resource\n .command(\"update <uuid>\")\n .description(\"Update a droplet installation\")\n .option(\"--body <json>\", \"Request body as JSON string\")\n .option(\"--body-file <path>\", \"Read request body from file\")\n .action(async (uuid, opts) => {\n const client = await ctx.getClient();\n let body: unknown;\n if (opts.bodyFile) {\n const { readFileSync } = await import(\"fs\");\n body = ctx.parseBody(readFileSync(opts.bodyFile, \"utf-8\"));\n } else if (opts.body) {\n body = ctx.parseBody(opts.body);\n }\n if (ctx.verbose)\n process.stderr.write(\n \"PUT \" + `/api/droplet_installations/${uuid}` + \"\\n\",\n );\n const result = await client.put(\n `/api/droplet_installations/${uuid}`,\n body,\n );\n ctx.output(result);\n });\n\n resource\n .command(\"delete <uuid>\")\n .description(\"Delete a droplet installation\")\n .action(async (uuid) => {\n const client = await ctx.getClient();\n if (ctx.verbose)\n process.stderr.write(\n \"DELETE \" + `/api/droplet_installations/${uuid}` + \"\\n\",\n );\n const result = await client.delete(`/api/droplet_installations/${uuid}`);\n ctx.output(result);\n });\n}\n","// primary.ts — AUTO-GENERATED, DO NOT EDIT\nimport { Command } from \"commander\";\nimport type { CommandContext } from \"@fluid-app/fluid-cli\";\n\nexport function registerPrimary(parent: Command, ctx: CommandContext): void {\n parent\n .command(\"get-companies <uuid>\")\n .description(\"returns an array of companies using a droplet\")\n .option(\"--pagination <value>\", \"pagination\")\n .action(async (uuid, opts) => {\n const client = await ctx.getClient();\n const params: Record<string, unknown> = {};\n if (opts.pagination !== undefined) params[\"pagination\"] = opts.pagination;\n if (ctx.verbose)\n process.stderr.write(\"GET \" + `/api/droplets/${uuid}/companies` + \"\\n\");\n const result = await client.get(\n `/api/droplets/${uuid}/companies`,\n params,\n );\n ctx.output(result);\n });\n\n parent\n .command(\"list\")\n .description(\"An array of available droplets\")\n .option(\"--pagination <value>\", \"pagination\")\n .action(async (opts) => {\n const client = await ctx.getClient();\n const params: Record<string, unknown> = {};\n if (opts.pagination !== undefined) params[\"pagination\"] = opts.pagination;\n if (ctx.verbose) process.stderr.write(\"GET \" + `/api/droplets` + \"\\n\");\n const result = await client.get(`/api/droplets`, params);\n ctx.output(result);\n });\n\n parent\n .command(\"create\")\n .description(\"creates a droplet\")\n .option(\"--body <json>\", \"Request body as JSON string\")\n .option(\"--body-file <path>\", \"Read request body from file\")\n .action(async (opts) => {\n const client = await ctx.getClient();\n let body: unknown;\n if (opts.bodyFile) {\n const { readFileSync } = await import(\"fs\");\n body = ctx.parseBody(readFileSync(opts.bodyFile, \"utf-8\"));\n } else if (opts.body) {\n body = ctx.parseBody(opts.body);\n }\n if (ctx.verbose) process.stderr.write(\"POST \" + `/api/droplets` + \"\\n\");\n const result = await client.post(`/api/droplets`, body);\n ctx.output(result);\n });\n\n parent\n .command(\"get <uuid>\")\n .description(\"shows a droplet\")\n .action(async (uuid) => {\n const client = await ctx.getClient();\n if (ctx.verbose)\n process.stderr.write(\"GET \" + `/api/droplets/${uuid}` + \"\\n\");\n const result = await client.get(`/api/droplets/${uuid}`);\n ctx.output(result);\n });\n\n parent\n .command(\"update <uuid>\")\n .description(\"updates a droplet\")\n .option(\"--body <json>\", \"Request body as JSON string\")\n .option(\"--body-file <path>\", \"Read request body from file\")\n .action(async (uuid, opts) => {\n const client = await ctx.getClient();\n let body: unknown;\n if (opts.bodyFile) {\n const { readFileSync } = await import(\"fs\");\n body = ctx.parseBody(readFileSync(opts.bodyFile, \"utf-8\"));\n } else if (opts.body) {\n body = ctx.parseBody(opts.body);\n }\n if (ctx.verbose)\n process.stderr.write(\"PUT \" + `/api/droplets/${uuid}` + \"\\n\");\n const result = await client.put(`/api/droplets/${uuid}`, body);\n ctx.output(result);\n });\n\n parent\n .command(\"delete <uuid>\")\n .description(\"deletes a droplet\")\n .action(async (uuid) => {\n const client = await ctx.getClient();\n if (ctx.verbose)\n process.stderr.write(\"DELETE \" + `/api/droplets/${uuid}` + \"\\n\");\n const result = await client.delete(`/api/droplets/${uuid}`);\n ctx.output(result);\n });\n}\n","// index.ts — AUTO-GENERATED, DO NOT EDIT\nimport { Command } from \"commander\";\nimport type { CommandContext } from \"@fluid-app/fluid-cli\";\n\nimport { registerCategories } from \"./categories.js\";\nimport { registerInstallations } from \"./installations.js\";\nimport { registerPrimary } from \"./primary.js\";\n\nexport function registerAllCommands(\n parent: Command,\n ctx: CommandContext,\n): void {\n registerCategories(parent, ctx);\n registerInstallations(parent, ctx);\n registerPrimary(parent, ctx);\n}\n","import type { FluidPlugin } from \"@fluid-app/fluid-cli\";\nimport { createDomainCommand } from \"@fluid-app/fluid-cli\";\n\nimport { registerAllCommands } from \"./generated/index.js\";\n\nconst plugin: FluidPlugin = {\n name: \"@fluid-app/fluid-cli-droplets\",\n version: \"0.1.0\",\n register(ctx) {\n ctx.program.addCommand(\n createDomainCommand(\n \"droplets\",\n \"Manage Fluid droplets and installations\",\n registerAllCommands,\n ),\n );\n },\n};\n\nexport default plugin;\n"],"mappings":";;;AAIA,SAAgB,mBAAmB,QAAiB,KAA2B;AAC5D,QAAO,QAAQ,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fluid-app/fluid-cli-droplets",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Fluid CLI commands for droplet management",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.mjs",
|
|
7
|
+
"types": "./dist/index.d.mts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": {
|
|
11
|
+
"types": "./dist/index.d.mts",
|
|
12
|
+
"default": "./dist/index.mjs"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"commander": "^12.0.0",
|
|
21
|
+
"@fluid-app/fluid-cli": "0.1.0"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@types/node": "^24",
|
|
25
|
+
"tsdown": "^0.21.0",
|
|
26
|
+
"tsx": "^4.21.0",
|
|
27
|
+
"typescript": "^5",
|
|
28
|
+
"@fluid-app/typescript-config": "0.0.0",
|
|
29
|
+
"@fluid-app/api-client-scripts": "0.0.0"
|
|
30
|
+
},
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=18.0.0"
|
|
33
|
+
},
|
|
34
|
+
"scripts": {
|
|
35
|
+
"build": "tsdown",
|
|
36
|
+
"dev": "tsdown --watch",
|
|
37
|
+
"generate": "tsx scripts/generate.ts",
|
|
38
|
+
"lint": "oxlint",
|
|
39
|
+
"lint:fix": "oxlint --fix",
|
|
40
|
+
"typecheck": "tsgo --noEmit"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { resolve } from "path";
|
|
2
|
+
import { generateCLICommands } from "@fluid-app/api-client-scripts";
|
|
3
|
+
|
|
4
|
+
const packageDir = resolve(import.meta.dirname, "..");
|
|
5
|
+
const specPath = resolve(packageDir, "..", "specs", "swagger.json");
|
|
6
|
+
|
|
7
|
+
await generateCLICommands({
|
|
8
|
+
packageDir,
|
|
9
|
+
specPath,
|
|
10
|
+
contextImportPath: "@fluid-app/fluid-cli",
|
|
11
|
+
primaryTags: ["Droplets"],
|
|
12
|
+
tagGroups: {
|
|
13
|
+
installations: ["Droplet Installations"],
|
|
14
|
+
categories: ["Droplet Categories"],
|
|
15
|
+
},
|
|
16
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// categories.ts — AUTO-GENERATED, DO NOT EDIT
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
import type { CommandContext } from "@fluid-app/fluid-cli";
|
|
4
|
+
|
|
5
|
+
export function registerCategories(parent: Command, ctx: CommandContext): void {
|
|
6
|
+
const resource = parent.command("categories").description("categories");
|
|
7
|
+
|
|
8
|
+
resource
|
|
9
|
+
.command("list")
|
|
10
|
+
.description("Returns a list of all droplet categories")
|
|
11
|
+
.action(async () => {
|
|
12
|
+
const client = await ctx.getClient();
|
|
13
|
+
if (ctx.verbose)
|
|
14
|
+
process.stderr.write("GET " + `/api/droplet_categories` + "\n");
|
|
15
|
+
const result = await client.get(`/api/droplet_categories`);
|
|
16
|
+
ctx.output(result);
|
|
17
|
+
});
|
|
18
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// index.ts — AUTO-GENERATED, DO NOT EDIT
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
import type { CommandContext } from "@fluid-app/fluid-cli";
|
|
4
|
+
|
|
5
|
+
import { registerCategories } from "./categories.js";
|
|
6
|
+
import { registerInstallations } from "./installations.js";
|
|
7
|
+
import { registerPrimary } from "./primary.js";
|
|
8
|
+
|
|
9
|
+
export function registerAllCommands(
|
|
10
|
+
parent: Command,
|
|
11
|
+
ctx: CommandContext,
|
|
12
|
+
): void {
|
|
13
|
+
registerCategories(parent, ctx);
|
|
14
|
+
registerInstallations(parent, ctx);
|
|
15
|
+
registerPrimary(parent, ctx);
|
|
16
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// installations.ts — AUTO-GENERATED, DO NOT EDIT
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
import type { CommandContext } from "@fluid-app/fluid-cli";
|
|
4
|
+
|
|
5
|
+
export function registerInstallations(
|
|
6
|
+
parent: Command,
|
|
7
|
+
ctx: CommandContext,
|
|
8
|
+
): void {
|
|
9
|
+
const resource = parent.command("installations").description("installations");
|
|
10
|
+
|
|
11
|
+
resource
|
|
12
|
+
.command("list")
|
|
13
|
+
.description("List droplet installations")
|
|
14
|
+
.option("--page <value>", "Page number for pagination")
|
|
15
|
+
.option("--per-page <value>", "Number of records per page (max: 100)")
|
|
16
|
+
.option("--category <value>", "Filter by droplet category")
|
|
17
|
+
.action(async (opts) => {
|
|
18
|
+
const client = await ctx.getClient();
|
|
19
|
+
const params: Record<string, unknown> = {};
|
|
20
|
+
if (opts.page !== undefined) params["page"] = Number(opts.page);
|
|
21
|
+
if (opts.perPage !== undefined) params["per_page"] = Number(opts.perPage);
|
|
22
|
+
if (opts.category !== undefined) params["category"] = opts.category;
|
|
23
|
+
if (ctx.verbose)
|
|
24
|
+
process.stderr.write("GET " + `/api/droplet_installations` + "\n");
|
|
25
|
+
const result = await client.get(`/api/droplet_installations`, params);
|
|
26
|
+
ctx.output(result);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
resource
|
|
30
|
+
.command("create")
|
|
31
|
+
.description("Create a droplet installation")
|
|
32
|
+
.option("--body <json>", "Request body as JSON string")
|
|
33
|
+
.option("--body-file <path>", "Read request body from file")
|
|
34
|
+
.action(async (opts) => {
|
|
35
|
+
const client = await ctx.getClient();
|
|
36
|
+
let body: unknown;
|
|
37
|
+
if (opts.bodyFile) {
|
|
38
|
+
const { readFileSync } = await import("fs");
|
|
39
|
+
body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
|
|
40
|
+
} else if (opts.body) {
|
|
41
|
+
body = ctx.parseBody(opts.body);
|
|
42
|
+
}
|
|
43
|
+
if (ctx.verbose)
|
|
44
|
+
process.stderr.write("POST " + `/api/droplet_installations` + "\n");
|
|
45
|
+
const result = await client.post(`/api/droplet_installations`, body);
|
|
46
|
+
ctx.output(result);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
resource
|
|
50
|
+
.command("get <uuid>")
|
|
51
|
+
.description("Show a droplet installation")
|
|
52
|
+
.action(async (uuid) => {
|
|
53
|
+
const client = await ctx.getClient();
|
|
54
|
+
if (ctx.verbose)
|
|
55
|
+
process.stderr.write(
|
|
56
|
+
"GET " + `/api/droplet_installations/${uuid}` + "\n",
|
|
57
|
+
);
|
|
58
|
+
const result = await client.get(`/api/droplet_installations/${uuid}`);
|
|
59
|
+
ctx.output(result);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
resource
|
|
63
|
+
.command("update <uuid>")
|
|
64
|
+
.description("Update a droplet installation")
|
|
65
|
+
.option("--body <json>", "Request body as JSON string")
|
|
66
|
+
.option("--body-file <path>", "Read request body from file")
|
|
67
|
+
.action(async (uuid, opts) => {
|
|
68
|
+
const client = await ctx.getClient();
|
|
69
|
+
let body: unknown;
|
|
70
|
+
if (opts.bodyFile) {
|
|
71
|
+
const { readFileSync } = await import("fs");
|
|
72
|
+
body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
|
|
73
|
+
} else if (opts.body) {
|
|
74
|
+
body = ctx.parseBody(opts.body);
|
|
75
|
+
}
|
|
76
|
+
if (ctx.verbose)
|
|
77
|
+
process.stderr.write(
|
|
78
|
+
"PUT " + `/api/droplet_installations/${uuid}` + "\n",
|
|
79
|
+
);
|
|
80
|
+
const result = await client.put(
|
|
81
|
+
`/api/droplet_installations/${uuid}`,
|
|
82
|
+
body,
|
|
83
|
+
);
|
|
84
|
+
ctx.output(result);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
resource
|
|
88
|
+
.command("delete <uuid>")
|
|
89
|
+
.description("Delete a droplet installation")
|
|
90
|
+
.action(async (uuid) => {
|
|
91
|
+
const client = await ctx.getClient();
|
|
92
|
+
if (ctx.verbose)
|
|
93
|
+
process.stderr.write(
|
|
94
|
+
"DELETE " + `/api/droplet_installations/${uuid}` + "\n",
|
|
95
|
+
);
|
|
96
|
+
const result = await client.delete(`/api/droplet_installations/${uuid}`);
|
|
97
|
+
ctx.output(result);
|
|
98
|
+
});
|
|
99
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
// primary.ts — AUTO-GENERATED, DO NOT EDIT
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
import type { CommandContext } from "@fluid-app/fluid-cli";
|
|
4
|
+
|
|
5
|
+
export function registerPrimary(parent: Command, ctx: CommandContext): void {
|
|
6
|
+
parent
|
|
7
|
+
.command("get-companies <uuid>")
|
|
8
|
+
.description("returns an array of companies using a droplet")
|
|
9
|
+
.option("--pagination <value>", "pagination")
|
|
10
|
+
.action(async (uuid, opts) => {
|
|
11
|
+
const client = await ctx.getClient();
|
|
12
|
+
const params: Record<string, unknown> = {};
|
|
13
|
+
if (opts.pagination !== undefined) params["pagination"] = opts.pagination;
|
|
14
|
+
if (ctx.verbose)
|
|
15
|
+
process.stderr.write("GET " + `/api/droplets/${uuid}/companies` + "\n");
|
|
16
|
+
const result = await client.get(
|
|
17
|
+
`/api/droplets/${uuid}/companies`,
|
|
18
|
+
params,
|
|
19
|
+
);
|
|
20
|
+
ctx.output(result);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
parent
|
|
24
|
+
.command("list")
|
|
25
|
+
.description("An array of available droplets")
|
|
26
|
+
.option("--pagination <value>", "pagination")
|
|
27
|
+
.action(async (opts) => {
|
|
28
|
+
const client = await ctx.getClient();
|
|
29
|
+
const params: Record<string, unknown> = {};
|
|
30
|
+
if (opts.pagination !== undefined) params["pagination"] = opts.pagination;
|
|
31
|
+
if (ctx.verbose) process.stderr.write("GET " + `/api/droplets` + "\n");
|
|
32
|
+
const result = await client.get(`/api/droplets`, params);
|
|
33
|
+
ctx.output(result);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
parent
|
|
37
|
+
.command("create")
|
|
38
|
+
.description("creates a droplet")
|
|
39
|
+
.option("--body <json>", "Request body as JSON string")
|
|
40
|
+
.option("--body-file <path>", "Read request body from file")
|
|
41
|
+
.action(async (opts) => {
|
|
42
|
+
const client = await ctx.getClient();
|
|
43
|
+
let body: unknown;
|
|
44
|
+
if (opts.bodyFile) {
|
|
45
|
+
const { readFileSync } = await import("fs");
|
|
46
|
+
body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
|
|
47
|
+
} else if (opts.body) {
|
|
48
|
+
body = ctx.parseBody(opts.body);
|
|
49
|
+
}
|
|
50
|
+
if (ctx.verbose) process.stderr.write("POST " + `/api/droplets` + "\n");
|
|
51
|
+
const result = await client.post(`/api/droplets`, body);
|
|
52
|
+
ctx.output(result);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
parent
|
|
56
|
+
.command("get <uuid>")
|
|
57
|
+
.description("shows a droplet")
|
|
58
|
+
.action(async (uuid) => {
|
|
59
|
+
const client = await ctx.getClient();
|
|
60
|
+
if (ctx.verbose)
|
|
61
|
+
process.stderr.write("GET " + `/api/droplets/${uuid}` + "\n");
|
|
62
|
+
const result = await client.get(`/api/droplets/${uuid}`);
|
|
63
|
+
ctx.output(result);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
parent
|
|
67
|
+
.command("update <uuid>")
|
|
68
|
+
.description("updates a droplet")
|
|
69
|
+
.option("--body <json>", "Request body as JSON string")
|
|
70
|
+
.option("--body-file <path>", "Read request body from file")
|
|
71
|
+
.action(async (uuid, opts) => {
|
|
72
|
+
const client = await ctx.getClient();
|
|
73
|
+
let body: unknown;
|
|
74
|
+
if (opts.bodyFile) {
|
|
75
|
+
const { readFileSync } = await import("fs");
|
|
76
|
+
body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
|
|
77
|
+
} else if (opts.body) {
|
|
78
|
+
body = ctx.parseBody(opts.body);
|
|
79
|
+
}
|
|
80
|
+
if (ctx.verbose)
|
|
81
|
+
process.stderr.write("PUT " + `/api/droplets/${uuid}` + "\n");
|
|
82
|
+
const result = await client.put(`/api/droplets/${uuid}`, body);
|
|
83
|
+
ctx.output(result);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
parent
|
|
87
|
+
.command("delete <uuid>")
|
|
88
|
+
.description("deletes a droplet")
|
|
89
|
+
.action(async (uuid) => {
|
|
90
|
+
const client = await ctx.getClient();
|
|
91
|
+
if (ctx.verbose)
|
|
92
|
+
process.stderr.write("DELETE " + `/api/droplets/${uuid}` + "\n");
|
|
93
|
+
const result = await client.delete(`/api/droplets/${uuid}`);
|
|
94
|
+
ctx.output(result);
|
|
95
|
+
});
|
|
96
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { FluidPlugin } from "@fluid-app/fluid-cli";
|
|
2
|
+
import { createDomainCommand } from "@fluid-app/fluid-cli";
|
|
3
|
+
|
|
4
|
+
import { registerAllCommands } from "./generated/index.js";
|
|
5
|
+
|
|
6
|
+
const plugin: FluidPlugin = {
|
|
7
|
+
name: "@fluid-app/fluid-cli-droplets",
|
|
8
|
+
version: "0.1.0",
|
|
9
|
+
register(ctx) {
|
|
10
|
+
ctx.program.addCommand(
|
|
11
|
+
createDomainCommand(
|
|
12
|
+
"droplets",
|
|
13
|
+
"Manage Fluid droplets and installations",
|
|
14
|
+
registerAllCommands,
|
|
15
|
+
),
|
|
16
|
+
);
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default plugin;
|
package/tsconfig.json
ADDED
package/tsdown.config.ts
ADDED