@fluid-app/fluid-cli-themes 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 +516 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +42 -0
- package/scripts/generate.ts +18 -0
- package/src/generated/index.ts +20 -0
- package/src/generated/primary.ts +288 -0
- package/src/generated/region-rules.ts +116 -0
- package/src/generated/resources.ts +78 -0
- package/src/generated/root-themes.ts +119 -0
- package/src/generated/templates.ts +366 -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-themes@0.1.0 build /home/runner/_work/fluid-mono/fluid-mono/packages/cli/themes
|
|
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/themes/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 [2m28.67 kB[22m [2m│ gzip: 3.14 kB[22m
|
|
12
|
+
[34mℹ[39m [2mdist/[22mindex.mjs.map [2m55.53 kB[22m [2m│ gzip: 5.82 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: 84.50 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 [32m3331ms[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,516 @@
|
|
|
1
|
+
import { createDomainCommand } from "@fluid-app/fluid-cli";
|
|
2
|
+
import "commander";
|
|
3
|
+
//#region src/generated/primary.ts
|
|
4
|
+
function parseBooleanOption$2(value, flag) {
|
|
5
|
+
const normalized = value.trim().toLowerCase();
|
|
6
|
+
if ([
|
|
7
|
+
"true",
|
|
8
|
+
"1",
|
|
9
|
+
"yes",
|
|
10
|
+
"on"
|
|
11
|
+
].includes(normalized)) return true;
|
|
12
|
+
if ([
|
|
13
|
+
"false",
|
|
14
|
+
"0",
|
|
15
|
+
"no",
|
|
16
|
+
"off"
|
|
17
|
+
].includes(normalized)) return false;
|
|
18
|
+
throw new Error(`Invalid value for ${flag}: ${value}. Expected true/false.`);
|
|
19
|
+
}
|
|
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) => {
|
|
22
|
+
const client = await ctx.getClient();
|
|
23
|
+
const params = {};
|
|
24
|
+
if (opts.page !== void 0) params["page"] = Number(opts.page);
|
|
25
|
+
if (opts.perPage !== void 0) params["per_page"] = Number(opts.perPage);
|
|
26
|
+
if (opts.rootThemes !== void 0) params["root_themes"] = parseBooleanOption$2(opts.rootThemes, "--root-themes");
|
|
27
|
+
if (opts.includeDefaultHomeTemplate !== void 0) params["include_default_home_template"] = parseBooleanOption$2(opts.includeDefaultHomeTemplate, "--include-default-home-template");
|
|
28
|
+
if (ctx.verbose) process.stderr.write("GET /api/application_themes\n");
|
|
29
|
+
const result = await client.get(`/api/application_themes`, params);
|
|
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) => {
|
|
33
|
+
const client = await ctx.getClient();
|
|
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);
|
|
39
|
+
if (ctx.verbose) process.stderr.write("POST /api/application_themes\n");
|
|
40
|
+
const result = await client.post(`/api/application_themes`, body);
|
|
41
|
+
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) => {
|
|
44
|
+
const client = await ctx.getClient();
|
|
45
|
+
const params = {};
|
|
46
|
+
if (opts.version !== void 0) params["version"] = Number(opts.version);
|
|
47
|
+
if (ctx.verbose) process.stderr.write(`GET /api/application_themes/${id}
|
|
48
|
+
`);
|
|
49
|
+
const result = await client.get(`/api/application_themes/${id}`, params);
|
|
50
|
+
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) => {
|
|
53
|
+
const client = await ctx.getClient();
|
|
54
|
+
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);
|
|
59
|
+
if (ctx.verbose) process.stderr.write(`PATCH /api/application_themes/${id}
|
|
60
|
+
`);
|
|
61
|
+
const result = await client.patch(`/api/application_themes/${id}`, body);
|
|
62
|
+
ctx.output(result);
|
|
63
|
+
});
|
|
64
|
+
parent.command("delete <id>").description("Delete an application theme").action(async (id) => {
|
|
65
|
+
const client = await ctx.getClient();
|
|
66
|
+
if (ctx.verbose) process.stderr.write(`DELETE /api/application_themes/${id}
|
|
67
|
+
`);
|
|
68
|
+
const result = await client.delete(`/api/application_themes/${id}`);
|
|
69
|
+
ctx.output(result);
|
|
70
|
+
});
|
|
71
|
+
parent.command("clone <id>").description("Clone an application theme").action(async (id) => {
|
|
72
|
+
const client = await ctx.getClient();
|
|
73
|
+
if (ctx.verbose) process.stderr.write(`POST /api/application_themes/${id}/clone
|
|
74
|
+
`);
|
|
75
|
+
const result = await client.post(`/api/application_themes/${id}/clone`);
|
|
76
|
+
ctx.output(result);
|
|
77
|
+
});
|
|
78
|
+
parent.command("get-theme-assets <id>").description("Get theme assets").action(async (id) => {
|
|
79
|
+
const client = await ctx.getClient();
|
|
80
|
+
if (ctx.verbose) process.stderr.write(`GET /api/application_themes/${id}/theme_assets
|
|
81
|
+
`);
|
|
82
|
+
const result = await client.get(`/api/application_themes/${id}/theme_assets`);
|
|
83
|
+
ctx.output(result);
|
|
84
|
+
});
|
|
85
|
+
parent.command("get-active").description("Get current active application theme").action(async () => {
|
|
86
|
+
const client = await ctx.getClient();
|
|
87
|
+
if (ctx.verbose) process.stderr.write("GET /api/application_themes/active\n");
|
|
88
|
+
const result = await client.get(`/api/application_themes/active`);
|
|
89
|
+
ctx.output(result);
|
|
90
|
+
});
|
|
91
|
+
parent.command("import <id>").description("Import an application theme").action(async (id) => {
|
|
92
|
+
const client = await ctx.getClient();
|
|
93
|
+
if (ctx.verbose) process.stderr.write(`POST /api/application_themes/${id}/import
|
|
94
|
+
`);
|
|
95
|
+
const result = await client.post(`/api/application_themes/${id}/import`);
|
|
96
|
+
ctx.output(result);
|
|
97
|
+
});
|
|
98
|
+
parent.command("export <id>").description("Export an application theme").action(async (id) => {
|
|
99
|
+
const client = await ctx.getClient();
|
|
100
|
+
if (ctx.verbose) process.stderr.write(`GET /api/application_themes/${id}/export
|
|
101
|
+
`);
|
|
102
|
+
const result = await client.get(`/api/application_themes/${id}/export`);
|
|
103
|
+
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
|
+
const client = await ctx.getClient();
|
|
107
|
+
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);
|
|
112
|
+
if (ctx.verbose) process.stderr.write("POST /api/application_themes/import_zip\n");
|
|
113
|
+
const result = await client.post(`/api/application_themes/import_zip`, body);
|
|
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) => {
|
|
117
|
+
const client = await ctx.getClient();
|
|
118
|
+
const params = {};
|
|
119
|
+
if (opts.version !== void 0) params["version"] = Number(opts.version);
|
|
120
|
+
if (ctx.verbose) process.stderr.write(`GET /api/application_themes/${id}/version_diff
|
|
121
|
+
`);
|
|
122
|
+
const result = await client.get(`/api/application_themes/${id}/version_diff`, params);
|
|
123
|
+
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) => {
|
|
126
|
+
const client = await ctx.getClient();
|
|
127
|
+
const params = {};
|
|
128
|
+
if (opts.version !== void 0) params["version"] = opts.version;
|
|
129
|
+
if (ctx.verbose) process.stderr.write(`POST /api/application_themes/${id}/publish
|
|
130
|
+
`);
|
|
131
|
+
const result = await client.post(`/api/application_themes/${id}/publish`, void 0, { params });
|
|
132
|
+
ctx.output(result);
|
|
133
|
+
});
|
|
134
|
+
parent.command("upgrade <id>").description("Upgrade an application theme").action(async (id) => {
|
|
135
|
+
const client = await ctx.getClient();
|
|
136
|
+
if (ctx.verbose) process.stderr.write(`POST /api/application_themes/${id}/upgrade
|
|
137
|
+
`);
|
|
138
|
+
const result = await client.post(`/api/application_themes/${id}/upgrade`);
|
|
139
|
+
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) => {
|
|
142
|
+
const client = await ctx.getClient();
|
|
143
|
+
const params = {};
|
|
144
|
+
if (opts.themeable !== void 0) params["themeable"] = opts.themeable;
|
|
145
|
+
if (opts.search !== void 0) params["search"] = opts.search;
|
|
146
|
+
if (opts.page !== void 0) params["page"] = Number(opts.page);
|
|
147
|
+
if (opts.perPage !== void 0) params["per_page"] = Number(opts.perPage);
|
|
148
|
+
if (ctx.verbose) process.stderr.write(`GET /api/application_themes/${id}/available_themeables
|
|
149
|
+
`);
|
|
150
|
+
const result = await client.get(`/api/application_themes/${id}/available_themeables`, params);
|
|
151
|
+
ctx.output(result);
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
//#endregion
|
|
155
|
+
//#region src/generated/resources.ts
|
|
156
|
+
function registerResources(parent, ctx) {
|
|
157
|
+
const resource = parent.command("resources").description("resources");
|
|
158
|
+
resource.command("get <application-theme-id>").description("Lists all theme resources").action(async (applicationThemeId) => {
|
|
159
|
+
const client = await ctx.getClient();
|
|
160
|
+
if (ctx.verbose) process.stderr.write(`GET /api/application_themes/${applicationThemeId}/resources
|
|
161
|
+
`);
|
|
162
|
+
const result = await client.get(`/api/application_themes/${applicationThemeId}/resources`);
|
|
163
|
+
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) => {
|
|
166
|
+
const client = await ctx.getClient();
|
|
167
|
+
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);
|
|
172
|
+
if (ctx.verbose) process.stderr.write(`PUT /api/application_themes/${applicationThemeId}/resources
|
|
173
|
+
`);
|
|
174
|
+
const result = await client.put(`/api/application_themes/${applicationThemeId}/resources`, body);
|
|
175
|
+
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) => {
|
|
178
|
+
const client = await ctx.getClient();
|
|
179
|
+
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 (ctx.verbose) process.stderr.write(`DELETE /api/application_themes/${applicationThemeId}/resources
|
|
185
|
+
`);
|
|
186
|
+
const result = await client.delete(`/api/application_themes/${applicationThemeId}/resources`, { body });
|
|
187
|
+
ctx.output(result);
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
//#endregion
|
|
191
|
+
//#region src/generated/templates.ts
|
|
192
|
+
function parseBooleanOption$1(value, flag) {
|
|
193
|
+
const normalized = value.trim().toLowerCase();
|
|
194
|
+
if ([
|
|
195
|
+
"true",
|
|
196
|
+
"1",
|
|
197
|
+
"yes",
|
|
198
|
+
"on"
|
|
199
|
+
].includes(normalized)) return true;
|
|
200
|
+
if ([
|
|
201
|
+
"false",
|
|
202
|
+
"0",
|
|
203
|
+
"no",
|
|
204
|
+
"off"
|
|
205
|
+
].includes(normalized)) return false;
|
|
206
|
+
throw new Error(`Invalid value for ${flag}: ${value}. Expected true/false.`);
|
|
207
|
+
}
|
|
208
|
+
function registerTemplates(parent, ctx) {
|
|
209
|
+
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) => {
|
|
211
|
+
const client = await ctx.getClient();
|
|
212
|
+
const params = {};
|
|
213
|
+
if (opts.applicationThemeId !== void 0) params["application_theme_id"] = opts.applicationThemeId;
|
|
214
|
+
if (opts.themeableType !== void 0) params["themeable_type"] = opts.themeableType;
|
|
215
|
+
if (opts.published !== void 0) params["published"] = parseBooleanOption$1(opts.published, "--published");
|
|
216
|
+
if (ctx.verbose) process.stderr.write("GET /api/application_theme_templates\n");
|
|
217
|
+
const result = await client.get(`/api/application_theme_templates`, params);
|
|
218
|
+
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) => {
|
|
221
|
+
const client = await ctx.getClient();
|
|
222
|
+
const params = {};
|
|
223
|
+
if (opts.applicationThemeId !== void 0) params["application_theme_id"] = opts.applicationThemeId;
|
|
224
|
+
if (opts.themeableType !== void 0) params["themeable_type"] = opts.themeableType;
|
|
225
|
+
if (opts.published !== void 0) params["published"] = parseBooleanOption$1(opts.published, "--published");
|
|
226
|
+
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);
|
|
231
|
+
if (ctx.verbose) process.stderr.write("POST /api/application_theme_templates\n");
|
|
232
|
+
const result = await client.post(`/api/application_theme_templates`, body, { params });
|
|
233
|
+
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) => {
|
|
236
|
+
const client = await ctx.getClient();
|
|
237
|
+
const params = {};
|
|
238
|
+
if (opts.version !== void 0) params["version"] = opts.version;
|
|
239
|
+
if (opts.published !== void 0) params["published"] = parseBooleanOption$1(opts.published, "--published");
|
|
240
|
+
if (ctx.verbose) process.stderr.write(`GET /api/application_theme_templates/${id}
|
|
241
|
+
`);
|
|
242
|
+
const result = await client.get(`/api/application_theme_templates/${id}`, params);
|
|
243
|
+
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) => {
|
|
246
|
+
const client = await ctx.getClient();
|
|
247
|
+
const params = {};
|
|
248
|
+
if (opts.version !== void 0) params["version"] = opts.version;
|
|
249
|
+
if (opts.published !== void 0) params["published"] = parseBooleanOption$1(opts.published, "--published");
|
|
250
|
+
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);
|
|
255
|
+
if (ctx.verbose) process.stderr.write(`PATCH /api/application_theme_templates/${id}
|
|
256
|
+
`);
|
|
257
|
+
const result = await client.patch(`/api/application_theme_templates/${id}`, body, { params });
|
|
258
|
+
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) => {
|
|
261
|
+
const client = await ctx.getClient();
|
|
262
|
+
const params = {};
|
|
263
|
+
if (opts.version !== void 0) params["version"] = opts.version;
|
|
264
|
+
if (opts.published !== void 0) params["published"] = parseBooleanOption$1(opts.published, "--published");
|
|
265
|
+
if (ctx.verbose) process.stderr.write(`DELETE /api/application_theme_templates/${id}
|
|
266
|
+
`);
|
|
267
|
+
const result = await client.delete(`/api/application_theme_templates/${id}`, { params });
|
|
268
|
+
ctx.output(result);
|
|
269
|
+
});
|
|
270
|
+
resource.command("clone <id>").description("Clones a theme template").action(async (id) => {
|
|
271
|
+
const client = await ctx.getClient();
|
|
272
|
+
if (ctx.verbose) process.stderr.write(`POST /api/application_theme_templates/${id}/clone
|
|
273
|
+
`);
|
|
274
|
+
const result = await client.post(`/api/application_theme_templates/${id}/clone`);
|
|
275
|
+
ctx.output(result);
|
|
276
|
+
});
|
|
277
|
+
resource.command("set-default <id>").description("Sets a theme template as default").action(async (id) => {
|
|
278
|
+
const client = await ctx.getClient();
|
|
279
|
+
if (ctx.verbose) process.stderr.write(`POST /api/application_theme_templates/${id}/set_default
|
|
280
|
+
`);
|
|
281
|
+
const result = await client.post(`/api/application_theme_templates/${id}/set_default`);
|
|
282
|
+
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) => {
|
|
285
|
+
const client = await ctx.getClient();
|
|
286
|
+
const params = {};
|
|
287
|
+
if (opts.version !== void 0) params["version"] = Number(opts.version);
|
|
288
|
+
if (ctx.verbose) process.stderr.write(`GET /api/application_theme_templates/${id}/version_diff
|
|
289
|
+
`);
|
|
290
|
+
const result = await client.get(`/api/application_theme_templates/${id}/version_diff`, params);
|
|
291
|
+
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) => {
|
|
294
|
+
const client = await ctx.getClient();
|
|
295
|
+
const params = {};
|
|
296
|
+
if (opts.version !== void 0) params["version"] = opts.version;
|
|
297
|
+
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);
|
|
302
|
+
if (ctx.verbose) process.stderr.write(`POST /api/application_theme_templates/${id}/render_page
|
|
303
|
+
`);
|
|
304
|
+
const result = await client.post(`/api/application_theme_templates/${id}/render_page`, body, { params });
|
|
305
|
+
ctx.output(result);
|
|
306
|
+
});
|
|
307
|
+
resource.command("render-section <id>").description("Renders a section template").action(async (id) => {
|
|
308
|
+
const client = await ctx.getClient();
|
|
309
|
+
if (ctx.verbose) process.stderr.write(`POST /api/application_theme_templates/${id}/render_section
|
|
310
|
+
`);
|
|
311
|
+
const result = await client.post(`/api/application_theme_templates/${id}/render_section`);
|
|
312
|
+
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) => {
|
|
315
|
+
const client = await ctx.getClient();
|
|
316
|
+
if (ctx.verbose) process.stderr.write(`GET /api/application_theme_templates/${id}/available_variables
|
|
317
|
+
`);
|
|
318
|
+
const result = await client.get(`/api/application_theme_templates/${id}/available_variables`);
|
|
319
|
+
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) => {
|
|
322
|
+
const client = await ctx.getClient();
|
|
323
|
+
const params = {};
|
|
324
|
+
if (opts.version !== void 0) params["version"] = opts.version;
|
|
325
|
+
if (ctx.verbose) process.stderr.write(`POST /api/application_theme_templates/${id}/publish
|
|
326
|
+
`);
|
|
327
|
+
const result = await client.post(`/api/application_theme_templates/${id}/publish`, void 0, { params });
|
|
328
|
+
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) => {
|
|
331
|
+
const client = await ctx.getClient();
|
|
332
|
+
const params = {};
|
|
333
|
+
if (opts.selected !== void 0) params["selected"] = parseBooleanOption$1(opts.selected, "--selected");
|
|
334
|
+
if (opts.status !== void 0) params["status"] = opts.status;
|
|
335
|
+
if (ctx.verbose) process.stderr.write(`GET /api/application_theme_templates/${id}/available_themeables
|
|
336
|
+
`);
|
|
337
|
+
const result = await client.get(`/api/application_theme_templates/${id}/available_themeables`, params);
|
|
338
|
+
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) => {
|
|
341
|
+
const client = await ctx.getClient();
|
|
342
|
+
const params = {};
|
|
343
|
+
if (opts.queryParams !== void 0) params["query_params"] = opts.queryParams;
|
|
344
|
+
if (ctx.verbose) process.stderr.write(`PUT /api/application_theme_templates/${id}/themeables_update
|
|
345
|
+
`);
|
|
346
|
+
const result = await client.put(`/api/application_theme_templates/${id}/themeables_update`, void 0, { params });
|
|
347
|
+
ctx.output(result);
|
|
348
|
+
});
|
|
349
|
+
resource.command("get-mysite-themes").description("List all mysite themes").action(async () => {
|
|
350
|
+
const client = await ctx.getClient();
|
|
351
|
+
if (ctx.verbose) process.stderr.write("GET /api/application_theme_templates/mysite_themes\n");
|
|
352
|
+
const result = await client.get(`/api/application_theme_templates/mysite_themes`);
|
|
353
|
+
ctx.output(result);
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
//#endregion
|
|
357
|
+
//#region src/generated/root-themes.ts
|
|
358
|
+
function registerRootThemes(parent, ctx) {
|
|
359
|
+
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)").action(async (opts) => {
|
|
361
|
+
const client = await ctx.getClient();
|
|
362
|
+
const params = {};
|
|
363
|
+
if (opts.page !== void 0) params["page"] = Number(opts.page);
|
|
364
|
+
if (opts.perPage !== void 0) params["per_page"] = Number(opts.perPage);
|
|
365
|
+
if (opts.status !== void 0) params["status"] = opts.status;
|
|
366
|
+
if (ctx.verbose) process.stderr.write("GET /api/root_themes\n");
|
|
367
|
+
const result = await client.get(`/api/root_themes`, params);
|
|
368
|
+
ctx.output(result);
|
|
369
|
+
});
|
|
370
|
+
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) => {
|
|
371
|
+
const client = await ctx.getClient();
|
|
372
|
+
let body;
|
|
373
|
+
if (opts.bodyFile) {
|
|
374
|
+
const { readFileSync } = await import("fs");
|
|
375
|
+
body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
|
|
376
|
+
} else if (opts.body) body = ctx.parseBody(opts.body);
|
|
377
|
+
if (ctx.verbose) process.stderr.write("POST /api/root_themes\n");
|
|
378
|
+
const result = await client.post(`/api/root_themes`, body);
|
|
379
|
+
ctx.output(result);
|
|
380
|
+
});
|
|
381
|
+
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) => {
|
|
382
|
+
const client = await ctx.getClient();
|
|
383
|
+
const params = {};
|
|
384
|
+
if (opts.page !== void 0) params["page"] = Number(opts.page);
|
|
385
|
+
if (opts.perPage !== void 0) params["per_page"] = Number(opts.perPage);
|
|
386
|
+
if (opts.status !== void 0) params["status"] = opts.status;
|
|
387
|
+
if (ctx.verbose) process.stderr.write("GET /api/root_themes/my\n");
|
|
388
|
+
const result = await client.get(`/api/root_themes/my`, params);
|
|
389
|
+
ctx.output(result);
|
|
390
|
+
});
|
|
391
|
+
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) => {
|
|
392
|
+
const client = await ctx.getClient();
|
|
393
|
+
let body;
|
|
394
|
+
if (opts.bodyFile) {
|
|
395
|
+
const { readFileSync } = await import("fs");
|
|
396
|
+
body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
|
|
397
|
+
} else if (opts.body) body = ctx.parseBody(opts.body);
|
|
398
|
+
if (ctx.verbose) process.stderr.write(`PATCH /api/root_themes/${id}
|
|
399
|
+
`);
|
|
400
|
+
const result = await client.patch(`/api/root_themes/${id}`, body);
|
|
401
|
+
ctx.output(result);
|
|
402
|
+
});
|
|
403
|
+
resource.command("delete <id>").description("Delete a root theme").action(async (id) => {
|
|
404
|
+
const client = await ctx.getClient();
|
|
405
|
+
if (ctx.verbose) process.stderr.write(`DELETE /api/root_themes/${id}
|
|
406
|
+
`);
|
|
407
|
+
const result = await client.delete(`/api/root_themes/${id}`);
|
|
408
|
+
ctx.output(result);
|
|
409
|
+
});
|
|
410
|
+
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) => {
|
|
411
|
+
const client = await ctx.getClient();
|
|
412
|
+
let body;
|
|
413
|
+
if (opts.bodyFile) {
|
|
414
|
+
const { readFileSync } = await import("fs");
|
|
415
|
+
body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
|
|
416
|
+
} else if (opts.body) body = ctx.parseBody(opts.body);
|
|
417
|
+
if (ctx.verbose) process.stderr.write(`POST /api/root_themes/${id}/status
|
|
418
|
+
`);
|
|
419
|
+
const result = await client.post(`/api/root_themes/${id}/status`, body);
|
|
420
|
+
ctx.output(result);
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
//#endregion
|
|
424
|
+
//#region src/generated/region-rules.ts
|
|
425
|
+
function parseBooleanOption(value, flag) {
|
|
426
|
+
const normalized = value.trim().toLowerCase();
|
|
427
|
+
if ([
|
|
428
|
+
"true",
|
|
429
|
+
"1",
|
|
430
|
+
"yes",
|
|
431
|
+
"on"
|
|
432
|
+
].includes(normalized)) return true;
|
|
433
|
+
if ([
|
|
434
|
+
"false",
|
|
435
|
+
"0",
|
|
436
|
+
"no",
|
|
437
|
+
"off"
|
|
438
|
+
].includes(normalized)) return false;
|
|
439
|
+
throw new Error(`Invalid value for ${flag}: ${value}. Expected true/false.`);
|
|
440
|
+
}
|
|
441
|
+
function registerRegionRules(parent, ctx) {
|
|
442
|
+
const resource = parent.command("region-rules").description("region-rules");
|
|
443
|
+
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) => {
|
|
444
|
+
const client = await ctx.getClient();
|
|
445
|
+
const params = {};
|
|
446
|
+
if (opts.companyId !== void 0) params["company_id"] = Number(opts.companyId);
|
|
447
|
+
if (opts.applicationThemeTemplateId !== void 0) params["application_theme_template_id"] = Number(opts.applicationThemeTemplateId);
|
|
448
|
+
if (opts.routePath !== void 0) params["route_path"] = opts.routePath;
|
|
449
|
+
if (opts.regionCode !== void 0) params["region_code"] = opts.regionCode;
|
|
450
|
+
if (opts.active !== void 0) params["active"] = parseBooleanOption(opts.active, "--active");
|
|
451
|
+
if (opts.page !== void 0) params["page"] = Number(opts.page);
|
|
452
|
+
if (opts.perPage !== void 0) params["per_page"] = Number(opts.perPage);
|
|
453
|
+
if (ctx.verbose) process.stderr.write("GET /api/theme_region_rules\n");
|
|
454
|
+
const result = await client.get(`/api/theme_region_rules`, params);
|
|
455
|
+
ctx.output(result);
|
|
456
|
+
});
|
|
457
|
+
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) => {
|
|
458
|
+
const client = await ctx.getClient();
|
|
459
|
+
let body;
|
|
460
|
+
if (opts.bodyFile) {
|
|
461
|
+
const { readFileSync } = await import("fs");
|
|
462
|
+
body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
|
|
463
|
+
} else if (opts.body) body = ctx.parseBody(opts.body);
|
|
464
|
+
if (ctx.verbose) process.stderr.write("POST /api/theme_region_rules\n");
|
|
465
|
+
const result = await client.post(`/api/theme_region_rules`, body);
|
|
466
|
+
ctx.output(result);
|
|
467
|
+
});
|
|
468
|
+
resource.command("get <id>").description("Show theme region rule").action(async (id) => {
|
|
469
|
+
const client = await ctx.getClient();
|
|
470
|
+
if (ctx.verbose) process.stderr.write(`GET /api/theme_region_rules/${id}
|
|
471
|
+
`);
|
|
472
|
+
const result = await client.get(`/api/theme_region_rules/${id}`);
|
|
473
|
+
ctx.output(result);
|
|
474
|
+
});
|
|
475
|
+
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) => {
|
|
476
|
+
const client = await ctx.getClient();
|
|
477
|
+
let body;
|
|
478
|
+
if (opts.bodyFile) {
|
|
479
|
+
const { readFileSync } = await import("fs");
|
|
480
|
+
body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
|
|
481
|
+
} else if (opts.body) body = ctx.parseBody(opts.body);
|
|
482
|
+
if (ctx.verbose) process.stderr.write(`PATCH /api/theme_region_rules/${id}
|
|
483
|
+
`);
|
|
484
|
+
const result = await client.patch(`/api/theme_region_rules/${id}`, body);
|
|
485
|
+
ctx.output(result);
|
|
486
|
+
});
|
|
487
|
+
resource.command("delete <id>").description("Delete theme region rule").action(async (id) => {
|
|
488
|
+
const client = await ctx.getClient();
|
|
489
|
+
if (ctx.verbose) process.stderr.write(`DELETE /api/theme_region_rules/${id}
|
|
490
|
+
`);
|
|
491
|
+
const result = await client.delete(`/api/theme_region_rules/${id}`);
|
|
492
|
+
ctx.output(result);
|
|
493
|
+
});
|
|
494
|
+
}
|
|
495
|
+
//#endregion
|
|
496
|
+
//#region src/generated/index.ts
|
|
497
|
+
function registerAllCommands(parent, ctx) {
|
|
498
|
+
registerPrimary(parent, ctx);
|
|
499
|
+
registerResources(parent, ctx);
|
|
500
|
+
registerTemplates(parent, ctx);
|
|
501
|
+
registerRootThemes(parent, ctx);
|
|
502
|
+
registerRegionRules(parent, ctx);
|
|
503
|
+
}
|
|
504
|
+
//#endregion
|
|
505
|
+
//#region src/index.ts
|
|
506
|
+
const plugin = {
|
|
507
|
+
name: "@fluid-app/fluid-cli-themes",
|
|
508
|
+
version: "0.1.0",
|
|
509
|
+
register(ctx) {
|
|
510
|
+
ctx.program.addCommand(createDomainCommand("themes", "Manage Fluid application themes and templates", registerAllCommands));
|
|
511
|
+
}
|
|
512
|
+
};
|
|
513
|
+
//#endregion
|
|
514
|
+
export { plugin as default };
|
|
515
|
+
|
|
516
|
+
//# sourceMappingURL=index.mjs.map
|