@fluid-app/fluid-cli-portal 0.1.27 → 0.1.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +107 -0
- package/dist/index.d.mts +629 -276
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1987 -86
- package/dist/index.mjs.map +1 -1
- package/dist/{pull-hAdXOpgb.mjs → pull-zrTaJuSb.mjs} +145 -80
- package/dist/pull-zrTaJuSb.mjs.map +1 -0
- package/package.json +2 -2
- package/templates/base/src/navigation.config.ts +1 -1
- package/templates/base/src/portal.config.ts +1 -1
- package/templates/base/src/preview-entry.tsx +35 -1
- package/templates/starter/package.json.template +3 -1
- package/dist/pull-hAdXOpgb.mjs.map +0 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "node:module";
|
|
1
2
|
import { Command } from "commander";
|
|
2
3
|
import chalk from "chalk";
|
|
3
4
|
import ora from "ora";
|
|
@@ -27,11 +28,13 @@ var __exportAll = (all, no_symbols) => {
|
|
|
27
28
|
var ApiError = class ApiError extends Error {
|
|
28
29
|
status;
|
|
29
30
|
data;
|
|
30
|
-
|
|
31
|
+
requestId;
|
|
32
|
+
constructor(message, status, data, requestId) {
|
|
31
33
|
super(message);
|
|
32
34
|
this.name = "ApiError";
|
|
33
35
|
this.status = status;
|
|
34
36
|
this.data = data;
|
|
37
|
+
this.requestId = requestId;
|
|
35
38
|
if ("captureStackTrace" in Error) Error.captureStackTrace(this, ApiError);
|
|
36
39
|
}
|
|
37
40
|
toJSON() {
|
|
@@ -39,15 +42,32 @@ var ApiError = class ApiError extends Error {
|
|
|
39
42
|
name: this.name,
|
|
40
43
|
message: this.message,
|
|
41
44
|
status: this.status,
|
|
42
|
-
data: this.data
|
|
45
|
+
data: this.data,
|
|
46
|
+
requestId: this.requestId
|
|
43
47
|
};
|
|
44
48
|
}
|
|
45
49
|
};
|
|
50
|
+
function getStringRequestId(value) {
|
|
51
|
+
if (typeof value !== "string") return;
|
|
52
|
+
const trimmed = value.trim();
|
|
53
|
+
return trimmed.length > 0 ? trimmed : void 0;
|
|
54
|
+
}
|
|
55
|
+
function getRequestIdFromHeaders(headers) {
|
|
56
|
+
return getStringRequestId(headers.get("x-request-id")) ?? getStringRequestId(headers.get("request-id")) ?? getStringRequestId(headers.get("X-Request-ID"));
|
|
57
|
+
}
|
|
58
|
+
function getRequestIdFromJsonBody(body) {
|
|
59
|
+
if (!body || typeof body !== "object" || Array.isArray(body)) return;
|
|
60
|
+
const record = body;
|
|
61
|
+
const meta = record.meta;
|
|
62
|
+
return getStringRequestId(record.request_id) ?? getStringRequestId(record.requestId) ?? (meta && typeof meta === "object" && !Array.isArray(meta) ? getStringRequestId(meta.request_id) ?? getStringRequestId(meta.requestId) : void 0);
|
|
63
|
+
}
|
|
46
64
|
/**
|
|
47
65
|
* Creates a configured fetch client instance
|
|
48
66
|
*/
|
|
49
67
|
function createFetchClient(config) {
|
|
50
|
-
const { baseUrl, getAuthToken, onAuthError, defaultHeaders = {}, credentials } = config;
|
|
68
|
+
const { baseUrl, getAuthToken, onAuthError, defaultHeaders = {}, credentials, cache, networkRetry, throwOnInvalidJson = false } = config;
|
|
69
|
+
const maxNetworkRetries = Math.max(0, networkRetry?.maxRetries ?? 0);
|
|
70
|
+
const baseNetworkRetryDelayMs = Math.max(0, networkRetry?.baseDelayMs ?? 0);
|
|
51
71
|
/**
|
|
52
72
|
* Build headers for a request
|
|
53
73
|
*/
|
|
@@ -98,6 +118,7 @@ function createFetchClient(config) {
|
|
|
98
118
|
* Handles auth errors, non-OK responses, 204 No Content, and JSON parsing.
|
|
99
119
|
*/
|
|
100
120
|
async function handleResponse(response, method, _url) {
|
|
121
|
+
const headerRequestId = getRequestIdFromHeaders(response.headers);
|
|
101
122
|
if (response.status === 401 && onAuthError) onAuthError();
|
|
102
123
|
if (!response.ok) {
|
|
103
124
|
const errorText = await response.text().catch(() => "");
|
|
@@ -106,29 +127,48 @@ function createFetchClient(config) {
|
|
|
106
127
|
try {
|
|
107
128
|
data = JSON.parse(errorText);
|
|
108
129
|
} catch {
|
|
109
|
-
throw new ApiError(errorText.slice(0, 200) || `${method} request failed with status ${response.status}`, response.status, null);
|
|
130
|
+
throw new ApiError(errorText.slice(0, 200) || `${method} request failed with status ${response.status}`, response.status, null, headerRequestId);
|
|
110
131
|
}
|
|
111
132
|
const nestedError = typeof data.error === "object" && data.error !== null ? data.error.message : void 0;
|
|
112
|
-
throw new ApiError(data.message || data.error_message || (typeof nestedError === "string" ? nestedError : void 0) || `${method} request failed`, response.status, data.errors || data);
|
|
113
|
-
} else throw new ApiError(`${method} request failed with status ${response.status}`, response.status, null);
|
|
133
|
+
throw new ApiError(data.message || data.error_message || (typeof nestedError === "string" ? nestedError : void 0) || `${method} request failed`, response.status, data.errors || data, headerRequestId ?? getRequestIdFromJsonBody(data));
|
|
134
|
+
} else throw new ApiError(`${method} request failed with status ${response.status}`, response.status, null, headerRequestId);
|
|
114
135
|
}
|
|
115
136
|
if (response.status === 204 || response.headers.get("content-length") === "0") return null;
|
|
116
|
-
if (response.headers.get("content-type")?.includes("application/json"))
|
|
117
|
-
|
|
118
|
-
} catch {
|
|
137
|
+
if (response.headers.get("content-type")?.includes("application/json")) {
|
|
138
|
+
const responseText = await response.text();
|
|
119
139
|
try {
|
|
120
|
-
return
|
|
140
|
+
return JSON.parse(responseText);
|
|
121
141
|
} catch {
|
|
122
|
-
|
|
142
|
+
if (throwOnInvalidJson) throw new ApiError("Failed to parse response as JSON", response.status, null, headerRequestId);
|
|
143
|
+
return responseText ? responseText : null;
|
|
123
144
|
}
|
|
124
145
|
}
|
|
125
146
|
return null;
|
|
126
147
|
}
|
|
148
|
+
function getNetworkRetryDelayMs(retryAttempt) {
|
|
149
|
+
return baseNetworkRetryDelayMs * 2 ** (retryAttempt - 1);
|
|
150
|
+
}
|
|
151
|
+
async function waitForNetworkRetry(retryAttempt) {
|
|
152
|
+
const delayMs = getNetworkRetryDelayMs(retryAttempt);
|
|
153
|
+
if (delayMs <= 0) return;
|
|
154
|
+
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
155
|
+
}
|
|
156
|
+
async function fetchWithNetworkRetry(url, fetchOptions, signal) {
|
|
157
|
+
let retryCount = 0;
|
|
158
|
+
while (true) try {
|
|
159
|
+
return await fetch(url, fetchOptions);
|
|
160
|
+
} catch (networkError) {
|
|
161
|
+
if (signal?.aborted || retryCount >= maxNetworkRetries) throw networkError;
|
|
162
|
+
retryCount += 1;
|
|
163
|
+
await waitForNetworkRetry(retryCount);
|
|
164
|
+
if (signal?.aborted) throw networkError;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
127
167
|
/**
|
|
128
168
|
* Main request function
|
|
129
169
|
*/
|
|
130
170
|
async function request(endpoint, options = {}) {
|
|
131
|
-
const { method = "GET", headers: customHeaders, params, body, signal } = options;
|
|
171
|
+
const { method = "GET", headers: customHeaders, params, body, signal, priority } = options;
|
|
132
172
|
const url = params ? buildUrl(endpoint, params) : joinUrl(endpoint);
|
|
133
173
|
const headers = await buildHeaders(customHeaders);
|
|
134
174
|
let response;
|
|
@@ -138,10 +178,12 @@ function createFetchClient(config) {
|
|
|
138
178
|
headers
|
|
139
179
|
};
|
|
140
180
|
if (credentials) fetchOptions.credentials = credentials;
|
|
181
|
+
if (cache) fetchOptions.cache = cache;
|
|
182
|
+
if (priority) fetchOptions.priority = priority;
|
|
141
183
|
const serializedBody = body && method !== "GET" ? JSON.stringify(body) : null;
|
|
142
184
|
if (serializedBody) fetchOptions.body = serializedBody;
|
|
143
185
|
if (signal) fetchOptions.signal = signal;
|
|
144
|
-
response = await
|
|
186
|
+
response = await fetchWithNetworkRetry(url, fetchOptions, signal);
|
|
145
187
|
} catch (networkError) {
|
|
146
188
|
throw new ApiError(`Network error: ${networkError instanceof Error ? networkError.message : "Unknown network error"}`, 0, null);
|
|
147
189
|
}
|
|
@@ -151,7 +193,7 @@ function createFetchClient(config) {
|
|
|
151
193
|
* Request with FormData (for file uploads)
|
|
152
194
|
*/
|
|
153
195
|
async function requestWithFormData(endpoint, formData, options = {}) {
|
|
154
|
-
const { method = "POST", headers: customHeaders, signal } = options;
|
|
196
|
+
const { method = "POST", headers: customHeaders, signal, priority } = options;
|
|
155
197
|
const url = joinUrl(endpoint);
|
|
156
198
|
const headers = await buildHeaders(customHeaders);
|
|
157
199
|
delete headers["Content-Type"];
|
|
@@ -163,8 +205,10 @@ function createFetchClient(config) {
|
|
|
163
205
|
body: formData
|
|
164
206
|
};
|
|
165
207
|
if (credentials) fetchOptions.credentials = credentials;
|
|
208
|
+
if (cache) fetchOptions.cache = cache;
|
|
209
|
+
if (priority) fetchOptions.priority = priority;
|
|
166
210
|
if (signal) fetchOptions.signal = signal;
|
|
167
|
-
response = await
|
|
211
|
+
response = await fetchWithNetworkRetry(url, fetchOptions, signal);
|
|
168
212
|
} catch (networkError) {
|
|
169
213
|
throw new ApiError(`Network error: ${networkError instanceof Error ? networkError.message : "Unknown network error"}`, 0, null);
|
|
170
214
|
}
|
|
@@ -200,7 +244,7 @@ function createFetchClient(config) {
|
|
|
200
244
|
};
|
|
201
245
|
}
|
|
202
246
|
//#endregion
|
|
203
|
-
//#region ../../api-clients/fluidos/src/namespaces/
|
|
247
|
+
//#region ../../api-clients/fluidos/src/namespaces/fluid_os_v0.ts
|
|
204
248
|
/**
|
|
205
249
|
* List Fluid OS definitions
|
|
206
250
|
* Retrieve a list of Fluid OS definitions for the current company
|
|
@@ -208,101 +252,101 @@ function createFetchClient(config) {
|
|
|
208
252
|
* @param client - Fetch client instance
|
|
209
253
|
* @param [params] - params
|
|
210
254
|
*/
|
|
211
|
-
async function
|
|
255
|
+
async function fluid_os_v0_list_fluid_osdefinitions(client, params) {
|
|
212
256
|
return client.get(`/api/company/fluid_os/definitions`, params);
|
|
213
257
|
}
|
|
214
258
|
/**
|
|
215
|
-
* List
|
|
216
|
-
* Retrieve a list of
|
|
259
|
+
* List navigations for a Fluid OS definition
|
|
260
|
+
* Retrieve a list of navigations for a specific Fluid OS definition
|
|
217
261
|
*
|
|
218
262
|
* @param client - Fetch client instance
|
|
219
263
|
* @param definition_id - definition_id
|
|
220
|
-
* @param
|
|
264
|
+
* @param [params] - params
|
|
221
265
|
*/
|
|
222
|
-
async function
|
|
223
|
-
return client.get(`/api/company/fluid_os/definitions/${definition_id}/navigations
|
|
266
|
+
async function fluid_os_v0_list_fluid_osnavigations(client, definition_id, params) {
|
|
267
|
+
return client.get(`/api/company/fluid_os/definitions/${definition_id}/navigations`, params);
|
|
224
268
|
}
|
|
225
269
|
/**
|
|
226
|
-
* Create a navigation
|
|
227
|
-
* Create a new navigation
|
|
270
|
+
* Create a navigation for a Fluid OS definition
|
|
271
|
+
* Create a new navigation for a Fluid OS definition
|
|
228
272
|
*
|
|
229
273
|
* @param client - Fetch client instance
|
|
230
274
|
* @param definition_id - definition_id
|
|
231
|
-
* @param navigation_id - navigation_id
|
|
232
275
|
* @param body - body
|
|
233
276
|
*/
|
|
234
|
-
async function
|
|
235
|
-
return client.post(`/api/company/fluid_os/definitions/${definition_id}/navigations
|
|
277
|
+
async function fluid_os_v0_create_fluid_osnavigation(client, definition_id, body) {
|
|
278
|
+
return client.post(`/api/company/fluid_os/definitions/${definition_id}/navigations`, body);
|
|
236
279
|
}
|
|
237
280
|
/**
|
|
238
|
-
* Update a navigation
|
|
239
|
-
* Update an existing navigation
|
|
281
|
+
* Update a navigation
|
|
282
|
+
* Update an existing navigation
|
|
240
283
|
*
|
|
241
284
|
* @param client - Fetch client instance
|
|
242
285
|
* @param definition_id - definition_id
|
|
243
|
-
* @param navigation_id - navigation_id
|
|
244
286
|
* @param id - id
|
|
245
287
|
* @param body - body
|
|
246
288
|
*/
|
|
247
|
-
async function
|
|
248
|
-
return client.put(`/api/company/fluid_os/definitions/${definition_id}/navigations/${
|
|
289
|
+
async function fluid_os_v0_update_fluid_osnavigation(client, definition_id, id, body) {
|
|
290
|
+
return client.put(`/api/company/fluid_os/definitions/${definition_id}/navigations/${id}`, body);
|
|
249
291
|
}
|
|
250
292
|
/**
|
|
251
|
-
* Delete a navigation
|
|
252
|
-
* Delete a navigation
|
|
293
|
+
* Delete a navigation
|
|
294
|
+
* Delete a navigation
|
|
253
295
|
*
|
|
254
296
|
* @param client - Fetch client instance
|
|
255
297
|
* @param definition_id - definition_id
|
|
256
|
-
* @param navigation_id - navigation_id
|
|
257
298
|
* @param id - id
|
|
258
299
|
*/
|
|
259
|
-
async function
|
|
260
|
-
return client.delete(`/api/company/fluid_os/definitions/${definition_id}/navigations/${
|
|
300
|
+
async function fluid_os_v0_delete_fluid_osnavigation(client, definition_id, id) {
|
|
301
|
+
return client.delete(`/api/company/fluid_os/definitions/${definition_id}/navigations/${id}`);
|
|
261
302
|
}
|
|
262
303
|
/**
|
|
263
|
-
* List
|
|
264
|
-
* Retrieve a list of
|
|
304
|
+
* List navigation items for a navigation
|
|
305
|
+
* Retrieve a list of navigation items for a specific navigation
|
|
265
306
|
*
|
|
266
307
|
* @param client - Fetch client instance
|
|
267
308
|
* @param definition_id - definition_id
|
|
268
|
-
* @param
|
|
309
|
+
* @param navigation_id - navigation_id
|
|
269
310
|
*/
|
|
270
|
-
async function
|
|
271
|
-
return client.get(`/api/company/fluid_os/definitions/${definition_id}/navigations
|
|
311
|
+
async function fluid_os_v0_list_fluid_osnavigation_items(client, definition_id, navigation_id) {
|
|
312
|
+
return client.get(`/api/company/fluid_os/definitions/${definition_id}/navigations/${navigation_id}/navigation_items`);
|
|
272
313
|
}
|
|
273
314
|
/**
|
|
274
|
-
* Create a navigation
|
|
275
|
-
* Create a new navigation for a
|
|
315
|
+
* Create a navigation item
|
|
316
|
+
* Create a new navigation item for a navigation
|
|
276
317
|
*
|
|
277
318
|
* @param client - Fetch client instance
|
|
278
319
|
* @param definition_id - definition_id
|
|
320
|
+
* @param navigation_id - navigation_id
|
|
279
321
|
* @param body - body
|
|
280
322
|
*/
|
|
281
|
-
async function
|
|
282
|
-
return client.post(`/api/company/fluid_os/definitions/${definition_id}/navigations`, body);
|
|
323
|
+
async function fluid_os_v0_create_fluid_osnavigation_item(client, definition_id, navigation_id, body) {
|
|
324
|
+
return client.post(`/api/company/fluid_os/definitions/${definition_id}/navigations/${navigation_id}/navigation_items`, body);
|
|
283
325
|
}
|
|
284
326
|
/**
|
|
285
|
-
* Update a navigation
|
|
286
|
-
* Update an existing navigation
|
|
327
|
+
* Update a navigation item
|
|
328
|
+
* Update an existing navigation item
|
|
287
329
|
*
|
|
288
330
|
* @param client - Fetch client instance
|
|
289
331
|
* @param definition_id - definition_id
|
|
332
|
+
* @param navigation_id - navigation_id
|
|
290
333
|
* @param id - id
|
|
291
334
|
* @param body - body
|
|
292
335
|
*/
|
|
293
|
-
async function
|
|
294
|
-
return client.put(`/api/company/fluid_os/definitions/${definition_id}/navigations/${id}`, body);
|
|
336
|
+
async function fluid_os_v0_update_fluid_osnavigation_item(client, definition_id, navigation_id, id, body) {
|
|
337
|
+
return client.put(`/api/company/fluid_os/definitions/${definition_id}/navigations/${navigation_id}/navigation_items/${id}`, body);
|
|
295
338
|
}
|
|
296
339
|
/**
|
|
297
|
-
* Delete a navigation
|
|
298
|
-
* Delete a navigation
|
|
340
|
+
* Delete a navigation item
|
|
341
|
+
* Delete a navigation item
|
|
299
342
|
*
|
|
300
343
|
* @param client - Fetch client instance
|
|
301
344
|
* @param definition_id - definition_id
|
|
345
|
+
* @param navigation_id - navigation_id
|
|
302
346
|
* @param id - id
|
|
303
347
|
*/
|
|
304
|
-
async function
|
|
305
|
-
return client.delete(`/api/company/fluid_os/definitions/${definition_id}/navigations/${id}`);
|
|
348
|
+
async function fluid_os_v0_delete_fluid_osnavigation_item(client, definition_id, navigation_id, id) {
|
|
349
|
+
return client.delete(`/api/company/fluid_os/definitions/${definition_id}/navigations/${navigation_id}/navigation_items/${id}`);
|
|
306
350
|
}
|
|
307
351
|
/**
|
|
308
352
|
* List profiles for a Fluid OS definition
|
|
@@ -312,7 +356,7 @@ async function deleteFluidOSNavigation(client, definition_id, id) {
|
|
|
312
356
|
* @param definition_id - definition_id
|
|
313
357
|
* @param [params] - params
|
|
314
358
|
*/
|
|
315
|
-
async function
|
|
359
|
+
async function fluid_os_v0_list_fluid_osprofiles(client, definition_id, params) {
|
|
316
360
|
return client.get(`/api/company/fluid_os/definitions/${definition_id}/profiles`, params);
|
|
317
361
|
}
|
|
318
362
|
/**
|
|
@@ -323,7 +367,7 @@ async function listFluidOSProfiles(client, definition_id, params) {
|
|
|
323
367
|
* @param definition_id - definition_id
|
|
324
368
|
* @param body - body
|
|
325
369
|
*/
|
|
326
|
-
async function
|
|
370
|
+
async function fluid_os_v0_create_fluid_osprofile(client, definition_id, body) {
|
|
327
371
|
return client.post(`/api/company/fluid_os/definitions/${definition_id}/profiles`, body);
|
|
328
372
|
}
|
|
329
373
|
/**
|
|
@@ -335,7 +379,7 @@ async function createFluidOSProfile(client, definition_id, body) {
|
|
|
335
379
|
* @param id - id
|
|
336
380
|
* @param body - body
|
|
337
381
|
*/
|
|
338
|
-
async function
|
|
382
|
+
async function fluid_os_v0_update_fluid_osprofile(client, definition_id, id, body) {
|
|
339
383
|
return client.put(`/api/company/fluid_os/definitions/${definition_id}/profiles/${id}`, body);
|
|
340
384
|
}
|
|
341
385
|
/**
|
|
@@ -346,7 +390,7 @@ async function updateFluidOSProfile(client, definition_id, id, body) {
|
|
|
346
390
|
* @param definition_id - definition_id
|
|
347
391
|
* @param id - id
|
|
348
392
|
*/
|
|
349
|
-
async function
|
|
393
|
+
async function fluid_os_v0_delete_fluid_osprofile(client, definition_id, id) {
|
|
350
394
|
return client.delete(`/api/company/fluid_os/definitions/${definition_id}/profiles/${id}`);
|
|
351
395
|
}
|
|
352
396
|
/**
|
|
@@ -357,7 +401,7 @@ async function deleteFluidOSProfile(client, definition_id, id) {
|
|
|
357
401
|
* @param definition_id - definition_id
|
|
358
402
|
* @param [params] - params
|
|
359
403
|
*/
|
|
360
|
-
async function
|
|
404
|
+
async function fluid_os_v0_list_fluid_osscreens(client, definition_id, params) {
|
|
361
405
|
return client.get(`/api/company/fluid_os/definitions/${definition_id}/screens`, params);
|
|
362
406
|
}
|
|
363
407
|
/**
|
|
@@ -368,7 +412,7 @@ async function listFluidOSScreens(client, definition_id, params) {
|
|
|
368
412
|
* @param definition_id - definition_id
|
|
369
413
|
* @param body - body
|
|
370
414
|
*/
|
|
371
|
-
async function
|
|
415
|
+
async function fluid_os_v0_create_fluid_osscreen(client, definition_id, body) {
|
|
372
416
|
return client.post(`/api/company/fluid_os/definitions/${definition_id}/screens`, body);
|
|
373
417
|
}
|
|
374
418
|
/**
|
|
@@ -379,7 +423,7 @@ async function createFluidOSScreen(client, definition_id, body) {
|
|
|
379
423
|
* @param definition_id - definition_id
|
|
380
424
|
* @param id - id
|
|
381
425
|
*/
|
|
382
|
-
async function
|
|
426
|
+
async function fluid_os_v0_get_fluid_osscreen(client, definition_id, id) {
|
|
383
427
|
return client.get(`/api/company/fluid_os/definitions/${definition_id}/screens/${id}`);
|
|
384
428
|
}
|
|
385
429
|
/**
|
|
@@ -391,7 +435,7 @@ async function getFluidOSScreen(client, definition_id, id) {
|
|
|
391
435
|
* @param id - id
|
|
392
436
|
* @param body - body
|
|
393
437
|
*/
|
|
394
|
-
async function
|
|
438
|
+
async function fluid_os_v0_update_fluid_osscreen(client, definition_id, id, body) {
|
|
395
439
|
return client.put(`/api/company/fluid_os/definitions/${definition_id}/screens/${id}`, body);
|
|
396
440
|
}
|
|
397
441
|
/**
|
|
@@ -402,7 +446,7 @@ async function updateFluidOSScreen(client, definition_id, id, body) {
|
|
|
402
446
|
* @param definition_id - definition_id
|
|
403
447
|
* @param id - id
|
|
404
448
|
*/
|
|
405
|
-
async function
|
|
449
|
+
async function fluid_os_v0_delete_fluid_osscreen(client, definition_id, id) {
|
|
406
450
|
return client.delete(`/api/company/fluid_os/definitions/${definition_id}/screens/${id}`);
|
|
407
451
|
}
|
|
408
452
|
/**
|
|
@@ -413,7 +457,7 @@ async function deleteFluidOSScreen(client, definition_id, id) {
|
|
|
413
457
|
* @param definition_id - definition_id
|
|
414
458
|
* @param [params] - params
|
|
415
459
|
*/
|
|
416
|
-
async function
|
|
460
|
+
async function fluid_os_v0_list_fluid_osthemes(client, definition_id, params) {
|
|
417
461
|
return client.get(`/api/company/fluid_os/definitions/${definition_id}/themes`, params);
|
|
418
462
|
}
|
|
419
463
|
/**
|
|
@@ -424,7 +468,7 @@ async function listFluidOSThemes(client, definition_id, params) {
|
|
|
424
468
|
* @param definition_id - definition_id
|
|
425
469
|
* @param body - body
|
|
426
470
|
*/
|
|
427
|
-
async function
|
|
471
|
+
async function fluid_os_v0_create_fluid_ostheme(client, definition_id, body) {
|
|
428
472
|
return client.post(`/api/company/fluid_os/definitions/${definition_id}/themes`, body);
|
|
429
473
|
}
|
|
430
474
|
/**
|
|
@@ -436,7 +480,7 @@ async function createFluidOSTheme(client, definition_id, body) {
|
|
|
436
480
|
* @param id - id
|
|
437
481
|
* @param body - body
|
|
438
482
|
*/
|
|
439
|
-
async function
|
|
483
|
+
async function fluid_os_v0_update_fluid_ostheme(client, definition_id, id, body) {
|
|
440
484
|
return client.put(`/api/company/fluid_os/definitions/${definition_id}/themes/${id}`, body);
|
|
441
485
|
}
|
|
442
486
|
/**
|
|
@@ -447,7 +491,7 @@ async function updateFluidOSTheme(client, definition_id, id, body) {
|
|
|
447
491
|
* @param definition_id - definition_id
|
|
448
492
|
* @param id - id
|
|
449
493
|
*/
|
|
450
|
-
async function
|
|
494
|
+
async function fluid_os_v0_delete_fluid_ostheme(client, definition_id, id) {
|
|
451
495
|
return client.delete(`/api/company/fluid_os/definitions/${definition_id}/themes/${id}`);
|
|
452
496
|
}
|
|
453
497
|
/**
|
|
@@ -458,7 +502,7 @@ async function deleteFluidOSTheme(client, definition_id, id) {
|
|
|
458
502
|
* @param definition_id - definition_id
|
|
459
503
|
* @param [params] - params
|
|
460
504
|
*/
|
|
461
|
-
async function
|
|
505
|
+
async function fluid_os_v0_list_fluid_osversions(client, definition_id, params) {
|
|
462
506
|
return client.get(`/api/company/fluid_os/definitions/${definition_id}/versions`, params);
|
|
463
507
|
}
|
|
464
508
|
/**
|
|
@@ -468,7 +512,7 @@ async function listFluidOSVersions(client, definition_id, params) {
|
|
|
468
512
|
* @param client - Fetch client instance
|
|
469
513
|
* @param definition_id - definition_id
|
|
470
514
|
*/
|
|
471
|
-
async function
|
|
515
|
+
async function fluid_os_v0_create_fluid_osversion(client, definition_id) {
|
|
472
516
|
return client.post(`/api/company/fluid_os/definitions/${definition_id}/versions`);
|
|
473
517
|
}
|
|
474
518
|
/**
|
|
@@ -480,9 +524,30 @@ async function createFluidOSVersion(client, definition_id) {
|
|
|
480
524
|
* @param id - id
|
|
481
525
|
* @param body - body
|
|
482
526
|
*/
|
|
483
|
-
async function
|
|
527
|
+
async function fluid_os_v0_update_fluid_osversion(client, definition_id, id, body) {
|
|
484
528
|
return client.put(`/api/company/fluid_os/definitions/${definition_id}/versions/${id}`, body);
|
|
485
529
|
}
|
|
530
|
+
/**
|
|
531
|
+
* Create a Fluid OS widget package version
|
|
532
|
+
* Start a company-owned Fluid OS widget package publish flow and return signed upload URLs for each artifact.
|
|
533
|
+
*
|
|
534
|
+
* @param client - Fetch client instance
|
|
535
|
+
* @param body - body
|
|
536
|
+
*/
|
|
537
|
+
async function fluid_os_v0_create_widget_package_version(client, body) {
|
|
538
|
+
return client.post(`/api/company/fluid_os/widget_package_versions`, body);
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
* Complete a Fluid OS widget package upload
|
|
542
|
+
* Verify uploaded artifacts for a company-owned Fluid OS widget package version and approve the version when verification succeeds. Uploaded manifest.json is verified for matching packageId, matching version, and valid company-owned `company.<package_key>.` widget type prefixes.
|
|
543
|
+
*
|
|
544
|
+
* @param client - Fetch client instance
|
|
545
|
+
* @param version - version
|
|
546
|
+
* @param [body] - body
|
|
547
|
+
*/
|
|
548
|
+
async function fluid_os_v0_complete_widget_package_version_upload(client, version, body) {
|
|
549
|
+
return client.post(`/api/company/fluid_os/widget_package_versions/${version}/complete_upload`, body);
|
|
550
|
+
}
|
|
486
551
|
//#endregion
|
|
487
552
|
//#region src/utils/atomic-write.ts
|
|
488
553
|
/**
|
|
@@ -803,7 +868,7 @@ function transformNavigationItems(items, screenIdToSlug) {
|
|
|
803
868
|
label: item.label ?? null,
|
|
804
869
|
screen: item.screen_id ? screenIdToSlug.get(item.screen_id) ?? null : null,
|
|
805
870
|
slug: item.slug ?? null,
|
|
806
|
-
source: item.source,
|
|
871
|
+
source: item.source ?? "user",
|
|
807
872
|
position: item.position ?? null,
|
|
808
873
|
parent_id: item.parent_id ?? null,
|
|
809
874
|
children: transformNavigationItems(item.children ?? [], screenIdToSlug)
|
|
@@ -885,7 +950,7 @@ async function fetchAllDefinitions(client) {
|
|
|
885
950
|
const all = [];
|
|
886
951
|
let page = 1;
|
|
887
952
|
while (true) {
|
|
888
|
-
const response = await
|
|
953
|
+
const response = await fluid_os_v0_list_fluid_osdefinitions(client, {
|
|
889
954
|
page,
|
|
890
955
|
per_page: PAGE_LIMIT
|
|
891
956
|
});
|
|
@@ -1005,10 +1070,10 @@ const pullCommand = new Command("pull").description("Pull a Fluid OS definition'
|
|
|
1005
1070
|
const navigationItemsMap = /* @__PURE__ */ new Map();
|
|
1006
1071
|
try {
|
|
1007
1072
|
const [screensResponse, themesResponse, navigationsResponse, profilesResponse] = await Promise.all([
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1073
|
+
fluid_os_v0_list_fluid_osscreens(client, definitionId, { per_page: PAGE_LIMIT }),
|
|
1074
|
+
fluid_os_v0_list_fluid_osthemes(client, definitionId, { per_page: PAGE_LIMIT }),
|
|
1075
|
+
fluid_os_v0_list_fluid_osnavigations(client, definitionId, { per_page: PAGE_LIMIT }),
|
|
1076
|
+
fluid_os_v0_list_fluid_osprofiles(client, definitionId, { per_page: PAGE_LIMIT })
|
|
1012
1077
|
]);
|
|
1013
1078
|
screenBasics = screensResponse.screens ?? [];
|
|
1014
1079
|
themes = themesResponse.themes ?? [];
|
|
@@ -1021,13 +1086,13 @@ const pullCommand = new Command("pull").description("Pull a Fluid OS definition'
|
|
|
1021
1086
|
spinner.text = "Fetching screen details...";
|
|
1022
1087
|
const limit = pLimit(10);
|
|
1023
1088
|
screens = await Promise.all(screenBasics.map((s) => limit(async () => {
|
|
1024
|
-
const res = await
|
|
1089
|
+
const res = await fluid_os_v0_get_fluid_osscreen(client, definitionId, s.id);
|
|
1025
1090
|
if (!res.screen) throw new Error(`Failed to fetch details for screen ID ${s.id}`);
|
|
1026
1091
|
return res.screen;
|
|
1027
1092
|
})));
|
|
1028
1093
|
spinner.text = "Fetching navigation items...";
|
|
1029
1094
|
await Promise.all(navigations.map((nav) => limit(async () => {
|
|
1030
|
-
const res = await
|
|
1095
|
+
const res = await fluid_os_v0_list_fluid_osnavigation_items(client, definitionId, nav.id);
|
|
1031
1096
|
navigationItemsMap.set(nav.id, res.navigation_items ?? []);
|
|
1032
1097
|
})));
|
|
1033
1098
|
spinner.succeed(`Fetched ${screens.length} screen(s), ${themes.length} theme(s), ${navigations.length} navigation(s), ${profiles.length} profile(s)`);
|
|
@@ -1146,6 +1211,6 @@ const pullCommand = new Command("pull").description("Pull a Fluid OS definition'
|
|
|
1146
1211
|
console.log();
|
|
1147
1212
|
});
|
|
1148
1213
|
//#endregion
|
|
1149
|
-
export {
|
|
1214
|
+
export { fluid_os_v0_create_fluid_osversion as A, fluid_os_v0_update_fluid_osnavigation_item as B, writeMappings as C, fluid_os_v0_create_fluid_osprofile as D, fluid_os_v0_create_fluid_osnavigation_item as E, fluid_os_v0_delete_fluid_osscreen as F, createFetchClient as G, fluid_os_v0_update_fluid_osscreen as H, fluid_os_v0_delete_fluid_ostheme as I, fluid_os_v0_list_fluid_osnavigation_items as L, fluid_os_v0_delete_fluid_osnavigation as M, fluid_os_v0_delete_fluid_osnavigation_item as N, fluid_os_v0_create_fluid_osscreen as O, fluid_os_v0_delete_fluid_osprofile as P, fluid_os_v0_list_fluid_osversions as R, updateMapping as S, fluid_os_v0_create_fluid_osnavigation as T, fluid_os_v0_update_fluid_ostheme as U, fluid_os_v0_update_fluid_osprofile as V, fluid_os_v0_update_fluid_osversion as W, deriveSlug as _, buildThemeIdToSlugMap as a, resolveIdToSlug as b, transformNavigationItems as c, transformTheme as d, buildSnapshot as f, writeSnapshot as g, readSnapshot as h, buildNavigationIdToSlugMap as i, fluid_os_v0_create_widget_package_version as j, fluid_os_v0_create_fluid_ostheme as k, transformProfile as l, diffAgainstSnapshot as m, pull_exports as n, deriveScreenSlug as o, computeFileHash as p, buildIdToSlugMap as r, transformNavigation as s, pullCommand as t, transformScreen as u, readMappings as v, fluid_os_v0_complete_widget_package_version_upload as w, resolveSlugToId as x, removeMapping as y, fluid_os_v0_update_fluid_osnavigation as z };
|
|
1150
1215
|
|
|
1151
|
-
//# sourceMappingURL=pull-
|
|
1216
|
+
//# sourceMappingURL=pull-zrTaJuSb.mjs.map
|