@fluid-app/fluid-cli-themes 0.1.337 → 0.1.339

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.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { createDomainCommand } from "@fluid-app/fluid-cli";
1
+ import { createDomainCommand, declareInputs } from "@fluid-app/fluid-cli";
2
2
  import "commander";
3
3
  //#region src/generated/primary.ts
4
4
  function parseBooleanOption$2(value, flag) {
@@ -18,7 +18,7 @@ function parseBooleanOption$2(value, flag) {
18
18
  throw new Error(`Invalid value for ${flag}: ${value}. Expected true/false.`);
19
19
  }
20
20
  function registerPrimary(parent, ctx) {
21
- parent.command("list").description("List application themes").option("--page <value>", "Page number for pagination").option("--per-page <value>", "Number of records per page").option("--root-themes <value>", "If true, returns root themes instead of company-specific themes").option("--include-default-home-template <value>", "If true, includes each theme's default home page template ID in the response").action(async (opts) => {
21
+ declareInputs(parent.command("list").description("List application themes").option("--page <value>", "Page number for pagination").option("--per-page <value>", "Number of records per page").option("--root-themes <value>", "If true, returns root themes instead of company-specific themes").option("--include-default-home-template <value>", "If true, includes each theme's default home page template ID in the response").action(async (opts) => {
22
22
  const client = await ctx.getClient();
23
23
  const params = {};
24
24
  if (opts.page !== void 0) params["page"] = Number(opts.page);
@@ -28,19 +28,20 @@ function registerPrimary(parent, ctx) {
28
28
  if (ctx.verbose) process.stderr.write("GET /api/application_themes\n");
29
29
  const result = await client.get(`/api/application_themes`, params);
30
30
  ctx.output(result);
31
- });
32
- parent.command("create").description("Create an application theme").option("--body <json>", "Request body as JSON string").option("--body-file <path>", "Read request body from file").action(async (opts) => {
31
+ }), () => []);
32
+ declareInputs(parent.command("create").description("Create an application theme").option("--body <json>", "Request body as JSON string").option("--body-file <path>", "Read request body from file").action(async (opts) => {
33
33
  const client = await ctx.getClient();
34
34
  let body;
35
- if (opts.bodyFile) {
36
- const { readFileSync } = await import("fs");
37
- body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
38
- } else if (opts.body) body = ctx.parseBody(opts.body);
35
+ if (opts.bodyFile) body = ctx.parseBody(ctx.inputs.readFile(opts.bodyFile, "utf-8"));
36
+ else if (opts.body) body = ctx.parseBody(opts.body);
39
37
  if (ctx.verbose) process.stderr.write("POST /api/application_themes\n");
40
38
  const result = await client.post(`/api/application_themes`, body);
41
39
  ctx.output(result);
42
- });
43
- parent.command("get <id>").description("Get an application theme").option("--version <value>", "Version of the theme to retrieve").action(async (id, opts) => {
40
+ }), (opts) => opts.bodyFile ? [{
41
+ kind: "file",
42
+ path: String(opts.bodyFile)
43
+ }] : []);
44
+ declareInputs(parent.command("get <id>").description("Get an application theme").option("--version <value>", "Version of the theme to retrieve").action(async (id, opts) => {
44
45
  const client = await ctx.getClient();
45
46
  const params = {};
46
47
  if (opts.version !== void 0) params["version"] = Number(opts.version);
@@ -48,72 +49,74 @@ function registerPrimary(parent, ctx) {
48
49
  `);
49
50
  const result = await client.get(`/api/application_themes/${id}`, params);
50
51
  ctx.output(result);
51
- });
52
- parent.command("update <id>").description("Update an application theme").option("--body <json>", "Request body as JSON string").option("--body-file <path>", "Read request body from file").action(async (id, opts) => {
52
+ }), () => []);
53
+ declareInputs(parent.command("update <id>").description("Update an application theme").option("--body <json>", "Request body as JSON string").option("--body-file <path>", "Read request body from file").action(async (id, opts) => {
53
54
  const client = await ctx.getClient();
54
55
  let body;
55
- if (opts.bodyFile) {
56
- const { readFileSync } = await import("fs");
57
- body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
58
- } else if (opts.body) body = ctx.parseBody(opts.body);
56
+ if (opts.bodyFile) body = ctx.parseBody(ctx.inputs.readFile(opts.bodyFile, "utf-8"));
57
+ else if (opts.body) body = ctx.parseBody(opts.body);
59
58
  if (ctx.verbose) process.stderr.write(`PATCH /api/application_themes/${id}
60
59
  `);
61
60
  const result = await client.patch(`/api/application_themes/${id}`, body);
62
61
  ctx.output(result);
63
- });
64
- parent.command("delete <id>").description("Delete an application theme").action(async (id) => {
62
+ }), (opts) => opts.bodyFile ? [{
63
+ kind: "file",
64
+ path: String(opts.bodyFile)
65
+ }] : []);
66
+ declareInputs(parent.command("delete <id>").description("Delete an application theme").action(async (id) => {
65
67
  const client = await ctx.getClient();
66
68
  if (ctx.verbose) process.stderr.write(`DELETE /api/application_themes/${id}
67
69
  `);
68
70
  const result = await client.delete(`/api/application_themes/${id}`);
69
71
  ctx.output(result);
70
- });
71
- parent.command("clone <id>").description("Clone an application theme").action(async (id) => {
72
+ }), () => []);
73
+ declareInputs(parent.command("clone <id>").description("Clone an application theme").action(async (id) => {
72
74
  const client = await ctx.getClient();
73
75
  if (ctx.verbose) process.stderr.write(`POST /api/application_themes/${id}/clone
74
76
  `);
75
77
  const result = await client.post(`/api/application_themes/${id}/clone`);
76
78
  ctx.output(result);
77
- });
78
- parent.command("get-theme-assets <id>").description("Get theme assets").action(async (id) => {
79
+ }), () => []);
80
+ declareInputs(parent.command("get-theme-assets <id>").description("Get theme assets").action(async (id) => {
79
81
  const client = await ctx.getClient();
80
82
  if (ctx.verbose) process.stderr.write(`GET /api/application_themes/${id}/theme_assets
81
83
  `);
82
84
  const result = await client.get(`/api/application_themes/${id}/theme_assets`);
83
85
  ctx.output(result);
84
- });
85
- parent.command("get-active").description("Get current active application theme").action(async () => {
86
+ }), () => []);
87
+ declareInputs(parent.command("get-active").description("Get current active application theme").action(async () => {
86
88
  const client = await ctx.getClient();
87
89
  if (ctx.verbose) process.stderr.write("GET /api/application_themes/active\n");
88
90
  const result = await client.get(`/api/application_themes/active`);
89
91
  ctx.output(result);
90
- });
91
- parent.command("import <id>").description("Import an application theme").action(async (id) => {
92
+ }), () => []);
93
+ declareInputs(parent.command("import <id>").description("Import an application theme").action(async (id) => {
92
94
  const client = await ctx.getClient();
93
95
  if (ctx.verbose) process.stderr.write(`POST /api/application_themes/${id}/import
94
96
  `);
95
97
  const result = await client.post(`/api/application_themes/${id}/import`);
96
98
  ctx.output(result);
97
- });
98
- parent.command("export <id>").description("Export an application theme").action(async (id) => {
99
+ }), () => []);
100
+ declareInputs(parent.command("export <id>").description("Export an application theme").action(async (id) => {
99
101
  const client = await ctx.getClient();
100
102
  if (ctx.verbose) process.stderr.write(`GET /api/application_themes/${id}/export
101
103
  `);
102
104
  const result = await client.get(`/api/application_themes/${id}/export`);
103
105
  ctx.output(result);
104
- });
105
- parent.command("import-from-zip").description("Import an application theme from zip file").option("--body <json>", "Request body as JSON string").option("--body-file <path>", "Read request body from file").action(async (opts) => {
106
+ }), () => []);
107
+ declareInputs(parent.command("import-from-zip").description("Import an application theme from zip file").option("--body <json>", "Request body as JSON string").option("--body-file <path>", "Read request body from file").action(async (opts) => {
106
108
  const client = await ctx.getClient();
107
109
  let body;
108
- if (opts.bodyFile) {
109
- const { readFileSync } = await import("fs");
110
- body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
111
- } else if (opts.body) body = ctx.parseBody(opts.body);
110
+ if (opts.bodyFile) body = ctx.parseBody(ctx.inputs.readFile(opts.bodyFile, "utf-8"));
111
+ else if (opts.body) body = ctx.parseBody(opts.body);
112
112
  if (ctx.verbose) process.stderr.write("POST /api/application_themes/import_zip\n");
113
113
  const result = await client.post(`/api/application_themes/import_zip`, body);
114
114
  ctx.output(result);
115
- });
116
- parent.command("version-diff <id>").description("Gets version diff information").option("--version <value>", "Version number to compare with").action(async (id, opts) => {
115
+ }), (opts) => opts.bodyFile ? [{
116
+ kind: "file",
117
+ path: String(opts.bodyFile)
118
+ }] : []);
119
+ declareInputs(parent.command("version-diff <id>").description("Gets version diff information").option("--version <value>", "Version number to compare with").action(async (id, opts) => {
117
120
  const client = await ctx.getClient();
118
121
  const params = {};
119
122
  if (opts.version !== void 0) params["version"] = Number(opts.version);
@@ -121,8 +124,8 @@ function registerPrimary(parent, ctx) {
121
124
  `);
122
125
  const result = await client.get(`/api/application_themes/${id}/version_diff`, params);
123
126
  ctx.output(result);
124
- });
125
- parent.command("publish <id>").description("Publishes the theme").option("--version <value>", "Version of the theme template to publish. If not specified, the latest version will be published.").action(async (id, opts) => {
127
+ }), () => []);
128
+ declareInputs(parent.command("publish <id>").description("Publishes the theme").option("--version <value>", "Version of the theme template to publish. If not specified, the latest version will be published.").action(async (id, opts) => {
126
129
  const client = await ctx.getClient();
127
130
  const params = {};
128
131
  if (opts.version !== void 0) params["version"] = opts.version;
@@ -130,15 +133,15 @@ function registerPrimary(parent, ctx) {
130
133
  `);
131
134
  const result = await client.post(`/api/application_themes/${id}/publish`, void 0, { params });
132
135
  ctx.output(result);
133
- });
134
- parent.command("upgrade <id>").description("Upgrade an application theme").action(async (id) => {
136
+ }), () => []);
137
+ declareInputs(parent.command("upgrade <id>").description("Upgrade an application theme").action(async (id) => {
135
138
  const client = await ctx.getClient();
136
139
  if (ctx.verbose) process.stderr.write(`POST /api/application_themes/${id}/upgrade
137
140
  `);
138
141
  const result = await client.post(`/api/application_themes/${id}/upgrade`);
139
142
  ctx.output(result);
140
- });
141
- parent.command("available-themeables <id>").description("Returns available themeables for a given type scoped to the theme's company").option("--themeable <value>", "The themeable type to list (e.g. product, medium, page)").option("--search <value>", "Filter themeables by title").option("--page <value>", "Page number for pagination").option("--per-page <value>", "Number of items per page").action(async (id, opts) => {
143
+ }), () => []);
144
+ declareInputs(parent.command("available-themeables <id>").description("Returns available themeables for a given type scoped to the theme's company").option("--themeable <value>", "The themeable type to list (e.g. product, medium, page)").option("--search <value>", "Filter themeables by title").option("--page <value>", "Page number for pagination").option("--per-page <value>", "Number of items per page").action(async (id, opts) => {
142
145
  const client = await ctx.getClient();
143
146
  const params = {};
144
147
  if (opts.themeable !== void 0) params["themeable"] = opts.themeable;
@@ -149,43 +152,45 @@ function registerPrimary(parent, ctx) {
149
152
  `);
150
153
  const result = await client.get(`/api/application_themes/${id}/available_themeables`, params);
151
154
  ctx.output(result);
152
- });
155
+ }), () => []);
153
156
  }
154
157
  //#endregion
155
158
  //#region src/generated/resources.ts
156
159
  function registerResources(parent, ctx) {
157
160
  const resource = parent.command("resources").description("resources");
158
- resource.command("get <application-theme-id>").description("Lists all theme resources").action(async (applicationThemeId) => {
161
+ declareInputs(resource.command("get <application-theme-id>").description("Lists all theme resources").action(async (applicationThemeId) => {
159
162
  const client = await ctx.getClient();
160
163
  if (ctx.verbose) process.stderr.write(`GET /api/application_themes/${applicationThemeId}/resources
161
164
  `);
162
165
  const result = await client.get(`/api/application_themes/${applicationThemeId}/resources`);
163
166
  ctx.output(result);
164
- });
165
- resource.command("update <application-theme-id>").description("Updates a theme resource").option("--body <json>", "Request body as JSON string").option("--body-file <path>", "Read request body from file").action(async (applicationThemeId, opts) => {
167
+ }), () => []);
168
+ declareInputs(resource.command("update <application-theme-id>").description("Updates a theme resource").option("--body <json>", "Request body as JSON string").option("--body-file <path>", "Read request body from file").action(async (applicationThemeId, opts) => {
166
169
  const client = await ctx.getClient();
167
170
  let body;
168
- if (opts.bodyFile) {
169
- const { readFileSync } = await import("fs");
170
- body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
171
- } else if (opts.body) body = ctx.parseBody(opts.body);
171
+ if (opts.bodyFile) body = ctx.parseBody(ctx.inputs.readFile(opts.bodyFile, "utf-8"));
172
+ else if (opts.body) body = ctx.parseBody(opts.body);
172
173
  if (ctx.verbose) process.stderr.write(`PUT /api/application_themes/${applicationThemeId}/resources
173
174
  `);
174
175
  const result = await client.put(`/api/application_themes/${applicationThemeId}/resources`, body);
175
176
  ctx.output(result);
176
- });
177
- resource.command("delete <application-theme-id>").description("Deletes a theme resource").option("--body <json>", "Request body as JSON string").option("--body-file <path>", "Read request body from file").action(async (applicationThemeId, opts) => {
177
+ }), (opts) => opts.bodyFile ? [{
178
+ kind: "file",
179
+ path: String(opts.bodyFile)
180
+ }] : []);
181
+ declareInputs(resource.command("delete <application-theme-id>").description("Deletes a theme resource").option("--body <json>", "Request body as JSON string").option("--body-file <path>", "Read request body from file").action(async (applicationThemeId, opts) => {
178
182
  const client = await ctx.getClient();
179
183
  let body;
180
- if (opts.bodyFile) {
181
- const { readFileSync } = await import("fs");
182
- body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
183
- } else if (opts.body) body = ctx.parseBody(opts.body);
184
+ if (opts.bodyFile) body = ctx.parseBody(ctx.inputs.readFile(opts.bodyFile, "utf-8"));
185
+ else if (opts.body) body = ctx.parseBody(opts.body);
184
186
  if (ctx.verbose) process.stderr.write(`DELETE /api/application_themes/${applicationThemeId}/resources
185
187
  `);
186
188
  const result = await client.delete(`/api/application_themes/${applicationThemeId}/resources`, { body });
187
189
  ctx.output(result);
188
- });
190
+ }), (opts) => opts.bodyFile ? [{
191
+ kind: "file",
192
+ path: String(opts.bodyFile)
193
+ }] : []);
189
194
  }
190
195
  //#endregion
191
196
  //#region src/generated/templates.ts
@@ -207,7 +212,7 @@ function parseBooleanOption$1(value, flag) {
207
212
  }
208
213
  function registerTemplates(parent, ctx) {
209
214
  const resource = parent.command("templates").description("templates");
210
- resource.command("list").description("Lists all theme templates").option("--application-theme-id <value>", "ID of the application theme").option("--themeable-type <value>", "Filter templates by themeable type").option("--published <value>", "return published versions").action(async (opts) => {
215
+ declareInputs(resource.command("list").description("Lists all theme templates").option("--application-theme-id <value>", "ID of the application theme").option("--themeable-type <value>", "Filter templates by themeable type").option("--published <value>", "return published versions").action(async (opts) => {
211
216
  const client = await ctx.getClient();
212
217
  const params = {};
213
218
  if (opts.applicationThemeId !== void 0) params["application_theme_id"] = opts.applicationThemeId;
@@ -216,23 +221,24 @@ function registerTemplates(parent, ctx) {
216
221
  if (ctx.verbose) process.stderr.write("GET /api/application_theme_templates\n");
217
222
  const result = await client.get(`/api/application_theme_templates`, params);
218
223
  ctx.output(result);
219
- });
220
- resource.command("create").description("Creates a theme template").option("--application-theme-id <value>", "ID of the application theme").option("--themeable-type <value>", "Filter templates by themeable type").option("--published <value>", "return published versions").option("--body <json>", "Request body as JSON string").option("--body-file <path>", "Read request body from file").action(async (opts) => {
224
+ }), () => []);
225
+ declareInputs(resource.command("create").description("Creates a theme template").option("--application-theme-id <value>", "ID of the application theme").option("--themeable-type <value>", "Filter templates by themeable type").option("--published <value>", "return published versions").option("--body <json>", "Request body as JSON string").option("--body-file <path>", "Read request body from file").action(async (opts) => {
221
226
  const client = await ctx.getClient();
222
227
  const params = {};
223
228
  if (opts.applicationThemeId !== void 0) params["application_theme_id"] = opts.applicationThemeId;
224
229
  if (opts.themeableType !== void 0) params["themeable_type"] = opts.themeableType;
225
230
  if (opts.published !== void 0) params["published"] = parseBooleanOption$1(opts.published, "--published");
226
231
  let body;
227
- if (opts.bodyFile) {
228
- const { readFileSync } = await import("fs");
229
- body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
230
- } else if (opts.body) body = ctx.parseBody(opts.body);
232
+ if (opts.bodyFile) body = ctx.parseBody(ctx.inputs.readFile(opts.bodyFile, "utf-8"));
233
+ else if (opts.body) body = ctx.parseBody(opts.body);
231
234
  if (ctx.verbose) process.stderr.write("POST /api/application_theme_templates\n");
232
235
  const result = await client.post(`/api/application_theme_templates`, body, { params });
233
236
  ctx.output(result);
234
- });
235
- resource.command("get <id>").description("Retrieves a theme template").option("--version <value>", "Version of the theme template to retrieve").option("--published <value>", "Retrieve the published version of the theme template").action(async (id, opts) => {
237
+ }), (opts) => opts.bodyFile ? [{
238
+ kind: "file",
239
+ path: String(opts.bodyFile)
240
+ }] : []);
241
+ declareInputs(resource.command("get <id>").description("Retrieves a theme template").option("--version <value>", "Version of the theme template to retrieve").option("--published <value>", "Retrieve the published version of the theme template").action(async (id, opts) => {
236
242
  const client = await ctx.getClient();
237
243
  const params = {};
238
244
  if (opts.version !== void 0) params["version"] = opts.version;
@@ -241,23 +247,24 @@ function registerTemplates(parent, ctx) {
241
247
  `);
242
248
  const result = await client.get(`/api/application_theme_templates/${id}`, params);
243
249
  ctx.output(result);
244
- });
245
- resource.command("update <id>").description("Updates a theme template").option("--version <value>", "Version of the theme template to retrieve").option("--published <value>", "Retrieve the published version of the theme template").option("--body <json>", "Request body as JSON string").option("--body-file <path>", "Read request body from file").action(async (id, opts) => {
250
+ }), () => []);
251
+ declareInputs(resource.command("update <id>").description("Updates a theme template").option("--version <value>", "Version of the theme template to retrieve").option("--published <value>", "Retrieve the published version of the theme template").option("--body <json>", "Request body as JSON string").option("--body-file <path>", "Read request body from file").action(async (id, opts) => {
246
252
  const client = await ctx.getClient();
247
253
  const params = {};
248
254
  if (opts.version !== void 0) params["version"] = opts.version;
249
255
  if (opts.published !== void 0) params["published"] = parseBooleanOption$1(opts.published, "--published");
250
256
  let body;
251
- if (opts.bodyFile) {
252
- const { readFileSync } = await import("fs");
253
- body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
254
- } else if (opts.body) body = ctx.parseBody(opts.body);
257
+ if (opts.bodyFile) body = ctx.parseBody(ctx.inputs.readFile(opts.bodyFile, "utf-8"));
258
+ else if (opts.body) body = ctx.parseBody(opts.body);
255
259
  if (ctx.verbose) process.stderr.write(`PATCH /api/application_theme_templates/${id}
256
260
  `);
257
261
  const result = await client.patch(`/api/application_theme_templates/${id}`, body, { params });
258
262
  ctx.output(result);
259
- });
260
- resource.command("delete <id>").description("Deletes a theme template").option("--version <value>", "Version of the theme template to retrieve").option("--published <value>", "Retrieve the published version of the theme template").action(async (id, opts) => {
263
+ }), (opts) => opts.bodyFile ? [{
264
+ kind: "file",
265
+ path: String(opts.bodyFile)
266
+ }] : []);
267
+ declareInputs(resource.command("delete <id>").description("Deletes a theme template").option("--version <value>", "Version of the theme template to retrieve").option("--published <value>", "Retrieve the published version of the theme template").action(async (id, opts) => {
261
268
  const client = await ctx.getClient();
262
269
  const params = {};
263
270
  if (opts.version !== void 0) params["version"] = opts.version;
@@ -266,22 +273,22 @@ function registerTemplates(parent, ctx) {
266
273
  `);
267
274
  const result = await client.delete(`/api/application_theme_templates/${id}`, { params });
268
275
  ctx.output(result);
269
- });
270
- resource.command("clone <id>").description("Clones a theme template").action(async (id) => {
276
+ }), () => []);
277
+ declareInputs(resource.command("clone <id>").description("Clones a theme template").action(async (id) => {
271
278
  const client = await ctx.getClient();
272
279
  if (ctx.verbose) process.stderr.write(`POST /api/application_theme_templates/${id}/clone
273
280
  `);
274
281
  const result = await client.post(`/api/application_theme_templates/${id}/clone`);
275
282
  ctx.output(result);
276
- });
277
- resource.command("set-default <id>").description("Sets a theme template as default").action(async (id) => {
283
+ }), () => []);
284
+ declareInputs(resource.command("set-default <id>").description("Sets a theme template as default").action(async (id) => {
278
285
  const client = await ctx.getClient();
279
286
  if (ctx.verbose) process.stderr.write(`POST /api/application_theme_templates/${id}/set_default
280
287
  `);
281
288
  const result = await client.post(`/api/application_theme_templates/${id}/set_default`);
282
289
  ctx.output(result);
283
- });
284
- resource.command("version-diff <id>").description("Gets version diff information").option("--version <value>", "Version number to compare with").action(async (id, opts) => {
290
+ }), () => []);
291
+ declareInputs(resource.command("version-diff <id>").description("Gets version diff information").option("--version <value>", "Version number to compare with").action(async (id, opts) => {
285
292
  const client = await ctx.getClient();
286
293
  const params = {};
287
294
  if (opts.version !== void 0) params["version"] = Number(opts.version);
@@ -289,36 +296,37 @@ function registerTemplates(parent, ctx) {
289
296
  `);
290
297
  const result = await client.get(`/api/application_theme_templates/${id}/version_diff`, params);
291
298
  ctx.output(result);
292
- });
293
- resource.command("render-page <id>").description("Renders a page for a theme template").option("--version <value>", "Version of the theme template to retrieve").option("--body <json>", "Request body as JSON string").option("--body-file <path>", "Read request body from file").action(async (id, opts) => {
299
+ }), () => []);
300
+ declareInputs(resource.command("render-page <id>").description("Renders a page for a theme template").option("--version <value>", "Version of the theme template to retrieve").option("--body <json>", "Request body as JSON string").option("--body-file <path>", "Read request body from file").action(async (id, opts) => {
294
301
  const client = await ctx.getClient();
295
302
  const params = {};
296
303
  if (opts.version !== void 0) params["version"] = opts.version;
297
304
  let body;
298
- if (opts.bodyFile) {
299
- const { readFileSync } = await import("fs");
300
- body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
301
- } else if (opts.body) body = ctx.parseBody(opts.body);
305
+ if (opts.bodyFile) body = ctx.parseBody(ctx.inputs.readFile(opts.bodyFile, "utf-8"));
306
+ else if (opts.body) body = ctx.parseBody(opts.body);
302
307
  if (ctx.verbose) process.stderr.write(`POST /api/application_theme_templates/${id}/render_page
303
308
  `);
304
309
  const result = await client.post(`/api/application_theme_templates/${id}/render_page`, body, { params });
305
310
  ctx.output(result);
306
- });
307
- resource.command("render-section <id>").description("Renders a section template").action(async (id) => {
311
+ }), (opts) => opts.bodyFile ? [{
312
+ kind: "file",
313
+ path: String(opts.bodyFile)
314
+ }] : []);
315
+ declareInputs(resource.command("render-section <id>").description("Renders a section template").action(async (id) => {
308
316
  const client = await ctx.getClient();
309
317
  if (ctx.verbose) process.stderr.write(`POST /api/application_theme_templates/${id}/render_section
310
318
  `);
311
319
  const result = await client.post(`/api/application_theme_templates/${id}/render_section`);
312
320
  ctx.output(result);
313
- });
314
- resource.command("get-theme-template-available-variables-api <id>").description("Get available variables for a theme template").action(async (id) => {
321
+ }), () => []);
322
+ declareInputs(resource.command("get-theme-template-available-variables-api <id>").description("Get available variables for a theme template").action(async (id) => {
315
323
  const client = await ctx.getClient();
316
324
  if (ctx.verbose) process.stderr.write(`GET /api/application_theme_templates/${id}/available_variables
317
325
  `);
318
326
  const result = await client.get(`/api/application_theme_templates/${id}/available_variables`);
319
327
  ctx.output(result);
320
- });
321
- resource.command("publish <id>").description("Publishes the template").option("--version <value>", "Version of the theme template to publish. If not specified, the latest version will be published.").action(async (id, opts) => {
328
+ }), () => []);
329
+ declareInputs(resource.command("publish <id>").description("Publishes the template").option("--version <value>", "Version of the theme template to publish. If not specified, the latest version will be published.").action(async (id, opts) => {
322
330
  const client = await ctx.getClient();
323
331
  const params = {};
324
332
  if (opts.version !== void 0) params["version"] = opts.version;
@@ -326,8 +334,8 @@ function registerTemplates(parent, ctx) {
326
334
  `);
327
335
  const result = await client.post(`/api/application_theme_templates/${id}/publish`, void 0, { params });
328
336
  ctx.output(result);
329
- });
330
- resource.command("available-themeables <id>").description("Returns all available themeables for theme template").option("--selected <value>", "Filter themeables that are already assigned to this template").option("--status <value>", "Filter themeables by status (active, draft, archived)").action(async (id, opts) => {
337
+ }), () => []);
338
+ declareInputs(resource.command("available-themeables <id>").description("Returns all available themeables for theme template").option("--selected <value>", "Filter themeables that are already assigned to this template").option("--status <value>", "Filter themeables by status (active, draft, archived)").action(async (id, opts) => {
331
339
  const client = await ctx.getClient();
332
340
  const params = {};
333
341
  if (opts.selected !== void 0) params["selected"] = parseBooleanOption$1(opts.selected, "--selected");
@@ -336,8 +344,8 @@ function registerTemplates(parent, ctx) {
336
344
  `);
337
345
  const result = await client.get(`/api/application_theme_templates/${id}/available_themeables`, params);
338
346
  ctx.output(result);
339
- });
340
- resource.command("themeables-update <id>").description("Updates themeable records to be used by the specified template").option("--query-params <value>", "query_params").action(async (id, opts) => {
347
+ }), () => []);
348
+ declareInputs(resource.command("themeables-update <id>").description("Updates themeable records to be used by the specified template").option("--query-params <value>", "query_params").action(async (id, opts) => {
341
349
  const client = await ctx.getClient();
342
350
  const params = {};
343
351
  if (opts.queryParams !== void 0) params["query_params"] = opts.queryParams;
@@ -345,19 +353,19 @@ function registerTemplates(parent, ctx) {
345
353
  `);
346
354
  const result = await client.put(`/api/application_theme_templates/${id}/themeables_update`, void 0, { params });
347
355
  ctx.output(result);
348
- });
349
- resource.command("get-mysite-themes").description("List all mysite themes").action(async () => {
356
+ }), () => []);
357
+ declareInputs(resource.command("get-mysite-themes").description("List all mysite themes").action(async () => {
350
358
  const client = await ctx.getClient();
351
359
  if (ctx.verbose) process.stderr.write("GET /api/application_theme_templates/mysite_themes\n");
352
360
  const result = await client.get(`/api/application_theme_templates/mysite_themes`);
353
361
  ctx.output(result);
354
- });
362
+ }), () => []);
355
363
  }
356
364
  //#endregion
357
365
  //#region src/generated/root-themes.ts
358
366
  function registerRootThemes(parent, ctx) {
359
367
  const resource = parent.command("root-themes").description("root-themes");
360
- resource.command("list").description("List root themes").option("--page <value>", "Page number for pagination").option("--per-page <value>", "Number of records per page").option("--status <value>", "Filter themes by status of their versions (draft, publishing, rejected, published)").option("--search-query <value>", "Search themes by name").action(async (opts) => {
368
+ declareInputs(resource.command("list").description("List root themes").option("--page <value>", "Page number for pagination").option("--per-page <value>", "Number of records per page").option("--status <value>", "Filter themes by status of their versions (draft, publishing, rejected, published)").option("--search-query <value>", "Search themes by name").action(async (opts) => {
361
369
  const client = await ctx.getClient();
362
370
  const params = {};
363
371
  if (opts.page !== void 0) params["page"] = Number(opts.page);
@@ -367,19 +375,20 @@ function registerRootThemes(parent, ctx) {
367
375
  if (ctx.verbose) process.stderr.write("GET /api/root_themes\n");
368
376
  const result = await client.get(`/api/root_themes`, params);
369
377
  ctx.output(result);
370
- });
371
- resource.command("create").description("Create a root theme").option("--body <json>", "Request body as JSON string").option("--body-file <path>", "Read request body from file").action(async (opts) => {
378
+ }), () => []);
379
+ declareInputs(resource.command("create").description("Create a root theme").option("--body <json>", "Request body as JSON string").option("--body-file <path>", "Read request body from file").action(async (opts) => {
372
380
  const client = await ctx.getClient();
373
381
  let body;
374
- if (opts.bodyFile) {
375
- const { readFileSync } = await import("fs");
376
- body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
377
- } else if (opts.body) body = ctx.parseBody(opts.body);
382
+ if (opts.bodyFile) body = ctx.parseBody(ctx.inputs.readFile(opts.bodyFile, "utf-8"));
383
+ else if (opts.body) body = ctx.parseBody(opts.body);
378
384
  if (ctx.verbose) process.stderr.write("POST /api/root_themes\n");
379
385
  const result = await client.post(`/api/root_themes`, body);
380
386
  ctx.output(result);
381
- });
382
- resource.command("list-company").description("List company root themes").option("--page <value>", "Page number for pagination").option("--per-page <value>", "Number of records per page").option("--status <value>", "Filter themes by status of their versions (draft, publishing, rejected, published, active)").action(async (opts) => {
387
+ }), (opts) => opts.bodyFile ? [{
388
+ kind: "file",
389
+ path: String(opts.bodyFile)
390
+ }] : []);
391
+ declareInputs(resource.command("list-company").description("List company root themes").option("--page <value>", "Page number for pagination").option("--per-page <value>", "Number of records per page").option("--status <value>", "Filter themes by status of their versions (draft, publishing, rejected, published, active)").action(async (opts) => {
383
392
  const client = await ctx.getClient();
384
393
  const params = {};
385
394
  if (opts.page !== void 0) params["page"] = Number(opts.page);
@@ -388,38 +397,40 @@ function registerRootThemes(parent, ctx) {
388
397
  if (ctx.verbose) process.stderr.write("GET /api/root_themes/my\n");
389
398
  const result = await client.get(`/api/root_themes/my`, params);
390
399
  ctx.output(result);
391
- });
392
- resource.command("update <id>").description("Update a root theme").option("--body <json>", "Request body as JSON string").option("--body-file <path>", "Read request body from file").action(async (id, opts) => {
400
+ }), () => []);
401
+ declareInputs(resource.command("update <id>").description("Update a root theme").option("--body <json>", "Request body as JSON string").option("--body-file <path>", "Read request body from file").action(async (id, opts) => {
393
402
  const client = await ctx.getClient();
394
403
  let body;
395
- if (opts.bodyFile) {
396
- const { readFileSync } = await import("fs");
397
- body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
398
- } else if (opts.body) body = ctx.parseBody(opts.body);
404
+ if (opts.bodyFile) body = ctx.parseBody(ctx.inputs.readFile(opts.bodyFile, "utf-8"));
405
+ else if (opts.body) body = ctx.parseBody(opts.body);
399
406
  if (ctx.verbose) process.stderr.write(`PATCH /api/root_themes/${id}
400
407
  `);
401
408
  const result = await client.patch(`/api/root_themes/${id}`, body);
402
409
  ctx.output(result);
403
- });
404
- resource.command("delete <id>").description("Delete a root theme").action(async (id) => {
410
+ }), (opts) => opts.bodyFile ? [{
411
+ kind: "file",
412
+ path: String(opts.bodyFile)
413
+ }] : []);
414
+ declareInputs(resource.command("delete <id>").description("Delete a root theme").action(async (id) => {
405
415
  const client = await ctx.getClient();
406
416
  if (ctx.verbose) process.stderr.write(`DELETE /api/root_themes/${id}
407
417
  `);
408
418
  const result = await client.delete(`/api/root_themes/${id}`);
409
419
  ctx.output(result);
410
- });
411
- resource.command("update-status <id>").description("Update a root theme status").option("--body <json>", "Request body as JSON string").option("--body-file <path>", "Read request body from file").action(async (id, opts) => {
420
+ }), () => []);
421
+ declareInputs(resource.command("update-status <id>").description("Update a root theme status").option("--body <json>", "Request body as JSON string").option("--body-file <path>", "Read request body from file").action(async (id, opts) => {
412
422
  const client = await ctx.getClient();
413
423
  let body;
414
- if (opts.bodyFile) {
415
- const { readFileSync } = await import("fs");
416
- body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
417
- } else if (opts.body) body = ctx.parseBody(opts.body);
424
+ if (opts.bodyFile) body = ctx.parseBody(ctx.inputs.readFile(opts.bodyFile, "utf-8"));
425
+ else if (opts.body) body = ctx.parseBody(opts.body);
418
426
  if (ctx.verbose) process.stderr.write(`POST /api/root_themes/${id}/status
419
427
  `);
420
428
  const result = await client.post(`/api/root_themes/${id}/status`, body);
421
429
  ctx.output(result);
422
- });
430
+ }), (opts) => opts.bodyFile ? [{
431
+ kind: "file",
432
+ path: String(opts.bodyFile)
433
+ }] : []);
423
434
  }
424
435
  //#endregion
425
436
  //#region src/generated/region-rules.ts
@@ -441,7 +452,7 @@ function parseBooleanOption(value, flag) {
441
452
  }
442
453
  function registerRegionRules(parent, ctx) {
443
454
  const resource = parent.command("region-rules").description("region-rules");
444
- resource.command("list").description("List theme region rules").option("--company-id <value>", "Filter by company ID").option("--application-theme-template-id <value>", "Filter by application theme template ID").option("--route-path <value>", "Filter by route path").option("--region-code <value>", "Filter by region code").option("--active <value>", "Filter by active status").option("--page <value>", "Page number for pagination").option("--per-page <value>", "Number of items per page").action(async (opts) => {
455
+ declareInputs(resource.command("list").description("List theme region rules").option("--company-id <value>", "Filter by company ID").option("--application-theme-template-id <value>", "Filter by application theme template ID").option("--route-path <value>", "Filter by route path").option("--region-code <value>", "Filter by region code").option("--active <value>", "Filter by active status").option("--page <value>", "Page number for pagination").option("--per-page <value>", "Number of items per page").action(async (opts) => {
445
456
  const client = await ctx.getClient();
446
457
  const params = {};
447
458
  if (opts.companyId !== void 0) params["company_id"] = Number(opts.companyId);
@@ -454,44 +465,46 @@ function registerRegionRules(parent, ctx) {
454
465
  if (ctx.verbose) process.stderr.write("GET /api/theme_region_rules\n");
455
466
  const result = await client.get(`/api/theme_region_rules`, params);
456
467
  ctx.output(result);
457
- });
458
- resource.command("create").description("Create theme region rule").option("--body <json>", "Request body as JSON string").option("--body-file <path>", "Read request body from file").action(async (opts) => {
468
+ }), () => []);
469
+ declareInputs(resource.command("create").description("Create theme region rule").option("--body <json>", "Request body as JSON string").option("--body-file <path>", "Read request body from file").action(async (opts) => {
459
470
  const client = await ctx.getClient();
460
471
  let body;
461
- if (opts.bodyFile) {
462
- const { readFileSync } = await import("fs");
463
- body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
464
- } else if (opts.body) body = ctx.parseBody(opts.body);
472
+ if (opts.bodyFile) body = ctx.parseBody(ctx.inputs.readFile(opts.bodyFile, "utf-8"));
473
+ else if (opts.body) body = ctx.parseBody(opts.body);
465
474
  if (ctx.verbose) process.stderr.write("POST /api/theme_region_rules\n");
466
475
  const result = await client.post(`/api/theme_region_rules`, body);
467
476
  ctx.output(result);
468
- });
469
- resource.command("get <id>").description("Show theme region rule").action(async (id) => {
477
+ }), (opts) => opts.bodyFile ? [{
478
+ kind: "file",
479
+ path: String(opts.bodyFile)
480
+ }] : []);
481
+ declareInputs(resource.command("get <id>").description("Show theme region rule").action(async (id) => {
470
482
  const client = await ctx.getClient();
471
483
  if (ctx.verbose) process.stderr.write(`GET /api/theme_region_rules/${id}
472
484
  `);
473
485
  const result = await client.get(`/api/theme_region_rules/${id}`);
474
486
  ctx.output(result);
475
- });
476
- resource.command("update <id>").description("Update theme region rule").option("--body <json>", "Request body as JSON string").option("--body-file <path>", "Read request body from file").action(async (id, opts) => {
487
+ }), () => []);
488
+ declareInputs(resource.command("update <id>").description("Update theme region rule").option("--body <json>", "Request body as JSON string").option("--body-file <path>", "Read request body from file").action(async (id, opts) => {
477
489
  const client = await ctx.getClient();
478
490
  let body;
479
- if (opts.bodyFile) {
480
- const { readFileSync } = await import("fs");
481
- body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
482
- } else if (opts.body) body = ctx.parseBody(opts.body);
491
+ if (opts.bodyFile) body = ctx.parseBody(ctx.inputs.readFile(opts.bodyFile, "utf-8"));
492
+ else if (opts.body) body = ctx.parseBody(opts.body);
483
493
  if (ctx.verbose) process.stderr.write(`PATCH /api/theme_region_rules/${id}
484
494
  `);
485
495
  const result = await client.patch(`/api/theme_region_rules/${id}`, body);
486
496
  ctx.output(result);
487
- });
488
- resource.command("delete <id>").description("Delete theme region rule").action(async (id) => {
497
+ }), (opts) => opts.bodyFile ? [{
498
+ kind: "file",
499
+ path: String(opts.bodyFile)
500
+ }] : []);
501
+ declareInputs(resource.command("delete <id>").description("Delete theme region rule").action(async (id) => {
489
502
  const client = await ctx.getClient();
490
503
  if (ctx.verbose) process.stderr.write(`DELETE /api/theme_region_rules/${id}
491
504
  `);
492
505
  const result = await client.delete(`/api/theme_region_rules/${id}`);
493
506
  ctx.output(result);
494
- });
507
+ }), () => []);
495
508
  }
496
509
  //#endregion
497
510
  //#region src/generated/index.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-app/fluid-cli-themes",
3
- "version": "0.1.337",
3
+ "version": "0.1.339",
4
4
  "description": "Fluid CLI commands for theme management",
5
5
  "type": "module",
6
6
  "main": "./dist/index.mjs",
@@ -17,7 +17,7 @@
17
17
  "access": "public"
18
18
  },
19
19
  "dependencies": {
20
- "@fluid-app/fluid-cli": "0.1.348",
20
+ "@fluid-app/fluid-cli": "0.1.350",
21
21
  "commander": "^12.0.0"
22
22
  },
23
23
  "devDependencies": {