@fluid-app/fluid-cli-themes 0.1.338 → 0.1.340

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.
@@ -1,6 +1,6 @@
1
1
  // templates.ts — AUTO-GENERATED, DO NOT EDIT
2
2
  import { Command } from "commander";
3
- import type { CommandContext } from "@fluid-app/fluid-cli";
3
+ import { declareInputs, type CommandContext } from "@fluid-app/fluid-cli";
4
4
 
5
5
  function parseBooleanOption(value: string, flag: string): boolean {
6
6
  const normalized = value.trim().toLowerCase();
@@ -12,7 +12,7 @@ function parseBooleanOption(value: string, flag: string): boolean {
12
12
  export function registerTemplates(parent: Command, ctx: CommandContext): void {
13
13
  const resource = parent.command("templates").description("templates");
14
14
 
15
- resource
15
+ declareInputs(resource
16
16
  .command("list")
17
17
  .description("Lists all theme templates")
18
18
  .option("--application-theme-id <value>", "ID of the application theme")
@@ -27,9 +27,9 @@ export function registerTemplates(parent: Command, ctx: CommandContext): void {
27
27
  if (ctx.verbose) process.stderr.write("GET " + `/api/application_theme_templates` + "\n");
28
28
  const result = await client.get(`/api/application_theme_templates`, params);
29
29
  ctx.output(result);
30
- });
30
+ }), () => []);
31
31
 
32
- resource
32
+ declareInputs(resource
33
33
  .command("create")
34
34
  .description("Creates a theme template")
35
35
  .option("--application-theme-id <value>", "ID of the application theme")
@@ -45,17 +45,16 @@ export function registerTemplates(parent: Command, ctx: CommandContext): void {
45
45
  if (opts.published !== undefined) params["published"] = parseBooleanOption(opts.published, "--published");
46
46
  let body: unknown;
47
47
  if (opts.bodyFile) {
48
- const { readFileSync } = await import("fs");
49
- body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
48
+ body = ctx.parseBody(ctx.inputs.readFile(opts.bodyFile, "utf-8"));
50
49
  } else if (opts.body) {
51
50
  body = ctx.parseBody(opts.body);
52
51
  }
53
52
  if (ctx.verbose) process.stderr.write("POST " + `/api/application_theme_templates` + "\n");
54
53
  const result = await client.post(`/api/application_theme_templates`, body, { params });
55
54
  ctx.output(result);
56
- });
55
+ }), (opts) => (opts.bodyFile ? [{ kind: "file", path: String(opts.bodyFile) }] : []));
57
56
 
58
- resource
57
+ declareInputs(resource
59
58
  .command("get <id>")
60
59
  .description("Retrieves a theme template")
61
60
  .option("--version <value>", "Version of the theme template to retrieve")
@@ -68,9 +67,9 @@ export function registerTemplates(parent: Command, ctx: CommandContext): void {
68
67
  if (ctx.verbose) process.stderr.write("GET " + `/api/application_theme_templates/${id}` + "\n");
69
68
  const result = await client.get(`/api/application_theme_templates/${id}`, params);
70
69
  ctx.output(result);
71
- });
70
+ }), () => []);
72
71
 
73
- resource
72
+ declareInputs(resource
74
73
  .command("update <id>")
75
74
  .description("Updates a theme template")
76
75
  .option("--version <value>", "Version of the theme template to retrieve")
@@ -84,17 +83,16 @@ export function registerTemplates(parent: Command, ctx: CommandContext): void {
84
83
  if (opts.published !== undefined) params["published"] = parseBooleanOption(opts.published, "--published");
85
84
  let body: unknown;
86
85
  if (opts.bodyFile) {
87
- const { readFileSync } = await import("fs");
88
- body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
86
+ body = ctx.parseBody(ctx.inputs.readFile(opts.bodyFile, "utf-8"));
89
87
  } else if (opts.body) {
90
88
  body = ctx.parseBody(opts.body);
91
89
  }
92
90
  if (ctx.verbose) process.stderr.write("PATCH " + `/api/application_theme_templates/${id}` + "\n");
93
91
  const result = await client.patch(`/api/application_theme_templates/${id}`, body, { params });
94
92
  ctx.output(result);
95
- });
93
+ }), (opts) => (opts.bodyFile ? [{ kind: "file", path: String(opts.bodyFile) }] : []));
96
94
 
97
- resource
95
+ declareInputs(resource
98
96
  .command("delete <id>")
99
97
  .description("Deletes a theme template")
100
98
  .option("--version <value>", "Version of the theme template to retrieve")
@@ -107,9 +105,9 @@ export function registerTemplates(parent: Command, ctx: CommandContext): void {
107
105
  if (ctx.verbose) process.stderr.write("DELETE " + `/api/application_theme_templates/${id}` + "\n");
108
106
  const result = await client.delete(`/api/application_theme_templates/${id}`, { params });
109
107
  ctx.output(result);
110
- });
108
+ }), () => []);
111
109
 
112
- resource
110
+ declareInputs(resource
113
111
  .command("clone <id>")
114
112
  .description("Clones a theme template")
115
113
  .action(async (id) => {
@@ -117,9 +115,9 @@ export function registerTemplates(parent: Command, ctx: CommandContext): void {
117
115
  if (ctx.verbose) process.stderr.write("POST " + `/api/application_theme_templates/${id}/clone` + "\n");
118
116
  const result = await client.post(`/api/application_theme_templates/${id}/clone`);
119
117
  ctx.output(result);
120
- });
118
+ }), () => []);
121
119
 
122
- resource
120
+ declareInputs(resource
123
121
  .command("set-default <id>")
124
122
  .description("Sets a theme template as default")
125
123
  .action(async (id) => {
@@ -127,9 +125,9 @@ export function registerTemplates(parent: Command, ctx: CommandContext): void {
127
125
  if (ctx.verbose) process.stderr.write("POST " + `/api/application_theme_templates/${id}/set_default` + "\n");
128
126
  const result = await client.post(`/api/application_theme_templates/${id}/set_default`);
129
127
  ctx.output(result);
130
- });
128
+ }), () => []);
131
129
 
132
- resource
130
+ declareInputs(resource
133
131
  .command("version-diff <id>")
134
132
  .description("Gets version diff information")
135
133
  .option("--version <value>", "Version number to compare with")
@@ -140,9 +138,9 @@ export function registerTemplates(parent: Command, ctx: CommandContext): void {
140
138
  if (ctx.verbose) process.stderr.write("GET " + `/api/application_theme_templates/${id}/version_diff` + "\n");
141
139
  const result = await client.get(`/api/application_theme_templates/${id}/version_diff`, params);
142
140
  ctx.output(result);
143
- });
141
+ }), () => []);
144
142
 
145
- resource
143
+ declareInputs(resource
146
144
  .command("render-page <id>")
147
145
  .description("Renders a page for a theme template")
148
146
  .option("--version <value>", "Version of the theme template to retrieve")
@@ -154,17 +152,16 @@ export function registerTemplates(parent: Command, ctx: CommandContext): void {
154
152
  if (opts.version !== undefined) params["version"] = opts.version;
155
153
  let body: unknown;
156
154
  if (opts.bodyFile) {
157
- const { readFileSync } = await import("fs");
158
- body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
155
+ body = ctx.parseBody(ctx.inputs.readFile(opts.bodyFile, "utf-8"));
159
156
  } else if (opts.body) {
160
157
  body = ctx.parseBody(opts.body);
161
158
  }
162
159
  if (ctx.verbose) process.stderr.write("POST " + `/api/application_theme_templates/${id}/render_page` + "\n");
163
160
  const result = await client.post(`/api/application_theme_templates/${id}/render_page`, body, { params });
164
161
  ctx.output(result);
165
- });
162
+ }), (opts) => (opts.bodyFile ? [{ kind: "file", path: String(opts.bodyFile) }] : []));
166
163
 
167
- resource
164
+ declareInputs(resource
168
165
  .command("render-section <id>")
169
166
  .description("Renders a section template")
170
167
  .action(async (id) => {
@@ -172,9 +169,9 @@ export function registerTemplates(parent: Command, ctx: CommandContext): void {
172
169
  if (ctx.verbose) process.stderr.write("POST " + `/api/application_theme_templates/${id}/render_section` + "\n");
173
170
  const result = await client.post(`/api/application_theme_templates/${id}/render_section`);
174
171
  ctx.output(result);
175
- });
172
+ }), () => []);
176
173
 
177
- resource
174
+ declareInputs(resource
178
175
  .command("get-theme-template-available-variables-api <id>")
179
176
  .description("Get available variables for a theme template")
180
177
  .action(async (id) => {
@@ -182,9 +179,9 @@ export function registerTemplates(parent: Command, ctx: CommandContext): void {
182
179
  if (ctx.verbose) process.stderr.write("GET " + `/api/application_theme_templates/${id}/available_variables` + "\n");
183
180
  const result = await client.get(`/api/application_theme_templates/${id}/available_variables`);
184
181
  ctx.output(result);
185
- });
182
+ }), () => []);
186
183
 
187
- resource
184
+ declareInputs(resource
188
185
  .command("publish <id>")
189
186
  .description("Publishes the template")
190
187
  .option("--version <value>", "Version of the theme template to publish. If not specified, the latest version will be published.")
@@ -195,9 +192,9 @@ export function registerTemplates(parent: Command, ctx: CommandContext): void {
195
192
  if (ctx.verbose) process.stderr.write("POST " + `/api/application_theme_templates/${id}/publish` + "\n");
196
193
  const result = await client.post(`/api/application_theme_templates/${id}/publish`, undefined, { params });
197
194
  ctx.output(result);
198
- });
195
+ }), () => []);
199
196
 
200
- resource
197
+ declareInputs(resource
201
198
  .command("available-themeables <id>")
202
199
  .description("Returns all available themeables for theme template")
203
200
  .option("--selected <value>", "Filter themeables that are already assigned to this template")
@@ -210,9 +207,9 @@ export function registerTemplates(parent: Command, ctx: CommandContext): void {
210
207
  if (ctx.verbose) process.stderr.write("GET " + `/api/application_theme_templates/${id}/available_themeables` + "\n");
211
208
  const result = await client.get(`/api/application_theme_templates/${id}/available_themeables`, params);
212
209
  ctx.output(result);
213
- });
210
+ }), () => []);
214
211
 
215
- resource
212
+ declareInputs(resource
216
213
  .command("themeables-update <id>")
217
214
  .description("Updates themeable records to be used by the specified template")
218
215
  .option("--query-params <value>", "query_params")
@@ -223,9 +220,9 @@ export function registerTemplates(parent: Command, ctx: CommandContext): void {
223
220
  if (ctx.verbose) process.stderr.write("PUT " + `/api/application_theme_templates/${id}/themeables_update` + "\n");
224
221
  const result = await client.put(`/api/application_theme_templates/${id}/themeables_update`, undefined, { params });
225
222
  ctx.output(result);
226
- });
223
+ }), () => []);
227
224
 
228
- resource
225
+ declareInputs(resource
229
226
  .command("get-mysite-themes")
230
227
  .description("List all mysite themes")
231
228
  .action(async () => {
@@ -233,6 +230,6 @@ export function registerTemplates(parent: Command, ctx: CommandContext): void {
233
230
  if (ctx.verbose) process.stderr.write("GET " + `/api/application_theme_templates/mysite_themes` + "\n");
234
231
  const result = await client.get(`/api/application_theme_templates/mysite_themes`);
235
232
  ctx.output(result);
236
- });
233
+ }), () => []);
237
234
 
238
235
  }