@fluid-app/fluid-cli-portal 0.1.26 → 0.1.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,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
- constructor(message, status, data) {
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,28 +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
- throw new ApiError(data.message || data.error_message || `${method} request failed`, response.status, data.errors || data);
112
- } else throw new ApiError(`${method} request failed with status ${response.status}`, response.status, null);
132
+ const nestedError = typeof data.error === "object" && data.error !== null ? data.error.message : void 0;
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);
113
135
  }
114
136
  if (response.status === 204 || response.headers.get("content-length") === "0") return null;
115
- if (response.headers.get("content-type")?.includes("application/json")) try {
116
- return await response.json();
117
- } catch {
137
+ if (response.headers.get("content-type")?.includes("application/json")) {
138
+ const responseText = await response.text();
118
139
  try {
119
- return await response.text();
140
+ return JSON.parse(responseText);
120
141
  } catch {
121
- return null;
142
+ if (throwOnInvalidJson) throw new ApiError("Failed to parse response as JSON", response.status, null, headerRequestId);
143
+ return responseText ? responseText : null;
122
144
  }
123
145
  }
124
146
  return null;
125
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
+ }
126
167
  /**
127
168
  * Main request function
128
169
  */
129
170
  async function request(endpoint, options = {}) {
130
- const { method = "GET", headers: customHeaders, params, body, signal } = options;
171
+ const { method = "GET", headers: customHeaders, params, body, signal, priority } = options;
131
172
  const url = params ? buildUrl(endpoint, params) : joinUrl(endpoint);
132
173
  const headers = await buildHeaders(customHeaders);
133
174
  let response;
@@ -137,10 +178,12 @@ function createFetchClient(config) {
137
178
  headers
138
179
  };
139
180
  if (credentials) fetchOptions.credentials = credentials;
181
+ if (cache) fetchOptions.cache = cache;
182
+ if (priority) fetchOptions.priority = priority;
140
183
  const serializedBody = body && method !== "GET" ? JSON.stringify(body) : null;
141
184
  if (serializedBody) fetchOptions.body = serializedBody;
142
185
  if (signal) fetchOptions.signal = signal;
143
- response = await fetch(url, fetchOptions);
186
+ response = await fetchWithNetworkRetry(url, fetchOptions, signal);
144
187
  } catch (networkError) {
145
188
  throw new ApiError(`Network error: ${networkError instanceof Error ? networkError.message : "Unknown network error"}`, 0, null);
146
189
  }
@@ -150,7 +193,7 @@ function createFetchClient(config) {
150
193
  * Request with FormData (for file uploads)
151
194
  */
152
195
  async function requestWithFormData(endpoint, formData, options = {}) {
153
- const { method = "POST", headers: customHeaders, signal } = options;
196
+ const { method = "POST", headers: customHeaders, signal, priority } = options;
154
197
  const url = joinUrl(endpoint);
155
198
  const headers = await buildHeaders(customHeaders);
156
199
  delete headers["Content-Type"];
@@ -162,8 +205,10 @@ function createFetchClient(config) {
162
205
  body: formData
163
206
  };
164
207
  if (credentials) fetchOptions.credentials = credentials;
208
+ if (cache) fetchOptions.cache = cache;
209
+ if (priority) fetchOptions.priority = priority;
165
210
  if (signal) fetchOptions.signal = signal;
166
- response = await fetch(url, fetchOptions);
211
+ response = await fetchWithNetworkRetry(url, fetchOptions, signal);
167
212
  } catch (networkError) {
168
213
  throw new ApiError(`Network error: ${networkError instanceof Error ? networkError.message : "Unknown network error"}`, 0, null);
169
214
  }
@@ -199,109 +244,109 @@ function createFetchClient(config) {
199
244
  };
200
245
  }
201
246
  //#endregion
202
- //#region ../../api-clients/fluidos/src/namespaces/fluid_os.ts
247
+ //#region ../../api-clients/fluidos/src/namespaces/fluid_os_v0.ts
203
248
  /**
204
249
  * List Fluid OS definitions
205
250
  * Retrieve a list of Fluid OS definitions for the current company
206
251
  *
207
252
  * @param client - Fetch client instance
208
- * @param params? - params?
253
+ * @param [params] - params
209
254
  */
210
- async function listFluidOSDefinitions(client, params) {
255
+ async function fluid_os_v0_list_fluid_osdefinitions(client, params) {
211
256
  return client.get(`/api/company/fluid_os/definitions`, params);
212
257
  }
213
258
  /**
214
- * List navigation items for a navigation
215
- * Retrieve a list of navigation items for a specific navigation
259
+ * List navigations for a Fluid OS definition
260
+ * Retrieve a list of navigations for a specific Fluid OS definition
216
261
  *
217
262
  * @param client - Fetch client instance
218
263
  * @param definition_id - definition_id
219
- * @param navigation_id - navigation_id
264
+ * @param [params] - params
220
265
  */
221
- async function listFluidOSNavigationItems(client, definition_id, navigation_id) {
222
- return client.get(`/api/company/fluid_os/definitions/${definition_id}/navigations/${navigation_id}/navigation_items`);
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);
223
268
  }
224
269
  /**
225
- * Create a navigation item
226
- * Create a new navigation item for a navigation
270
+ * Create a navigation for a Fluid OS definition
271
+ * Create a new navigation for a Fluid OS definition
227
272
  *
228
273
  * @param client - Fetch client instance
229
274
  * @param definition_id - definition_id
230
- * @param navigation_id - navigation_id
231
275
  * @param body - body
232
276
  */
233
- async function createFluidOSNavigationItem(client, definition_id, navigation_id, body) {
234
- return client.post(`/api/company/fluid_os/definitions/${definition_id}/navigations/${navigation_id}/navigation_items`, body);
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);
235
279
  }
236
280
  /**
237
- * Update a navigation item
238
- * Update an existing navigation item
281
+ * Update a navigation
282
+ * Update an existing navigation
239
283
  *
240
284
  * @param client - Fetch client instance
241
285
  * @param definition_id - definition_id
242
- * @param navigation_id - navigation_id
243
286
  * @param id - id
244
287
  * @param body - body
245
288
  */
246
- async function updateFluidOSNavigationItem(client, definition_id, navigation_id, id, body) {
247
- return client.put(`/api/company/fluid_os/definitions/${definition_id}/navigations/${navigation_id}/navigation_items/${id}`, body);
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);
248
291
  }
249
292
  /**
250
- * Delete a navigation item
251
- * Delete a navigation item
293
+ * Delete a navigation
294
+ * Delete a navigation
252
295
  *
253
296
  * @param client - Fetch client instance
254
297
  * @param definition_id - definition_id
255
- * @param navigation_id - navigation_id
256
298
  * @param id - id
257
299
  */
258
- async function deleteFluidOSNavigationItem(client, definition_id, navigation_id, id) {
259
- return client.delete(`/api/company/fluid_os/definitions/${definition_id}/navigations/${navigation_id}/navigation_items/${id}`);
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}`);
260
302
  }
261
303
  /**
262
- * List navigations for a Fluid OS definition
263
- * Retrieve a list of navigations for a specific Fluid OS definition
304
+ * List navigation items for a navigation
305
+ * Retrieve a list of navigation items for a specific navigation
264
306
  *
265
307
  * @param client - Fetch client instance
266
308
  * @param definition_id - definition_id
267
- * @param params? - params?
309
+ * @param navigation_id - navigation_id
268
310
  */
269
- async function listFluidOSNavigations(client, definition_id, params) {
270
- return client.get(`/api/company/fluid_os/definitions/${definition_id}/navigations`, params);
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`);
271
313
  }
272
314
  /**
273
- * Create a navigation for a Fluid OS definition
274
- * Create a new navigation for a Fluid OS definition
315
+ * Create a navigation item
316
+ * Create a new navigation item for a navigation
275
317
  *
276
318
  * @param client - Fetch client instance
277
319
  * @param definition_id - definition_id
320
+ * @param navigation_id - navigation_id
278
321
  * @param body - body
279
322
  */
280
- async function createFluidOSNavigation(client, definition_id, body) {
281
- 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);
282
325
  }
283
326
  /**
284
- * Update a navigation
285
- * Update an existing navigation
327
+ * Update a navigation item
328
+ * Update an existing navigation item
286
329
  *
287
330
  * @param client - Fetch client instance
288
331
  * @param definition_id - definition_id
332
+ * @param navigation_id - navigation_id
289
333
  * @param id - id
290
334
  * @param body - body
291
335
  */
292
- async function updateFluidOSNavigation(client, definition_id, id, body) {
293
- 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);
294
338
  }
295
339
  /**
296
- * Delete a navigation
297
- * Delete a navigation
340
+ * Delete a navigation item
341
+ * Delete a navigation item
298
342
  *
299
343
  * @param client - Fetch client instance
300
344
  * @param definition_id - definition_id
345
+ * @param navigation_id - navigation_id
301
346
  * @param id - id
302
347
  */
303
- async function deleteFluidOSNavigation(client, definition_id, id) {
304
- 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}`);
305
350
  }
306
351
  /**
307
352
  * List profiles for a Fluid OS definition
@@ -309,9 +354,9 @@ async function deleteFluidOSNavigation(client, definition_id, id) {
309
354
  *
310
355
  * @param client - Fetch client instance
311
356
  * @param definition_id - definition_id
312
- * @param params? - params?
357
+ * @param [params] - params
313
358
  */
314
- async function listFluidOSProfiles(client, definition_id, params) {
359
+ async function fluid_os_v0_list_fluid_osprofiles(client, definition_id, params) {
315
360
  return client.get(`/api/company/fluid_os/definitions/${definition_id}/profiles`, params);
316
361
  }
317
362
  /**
@@ -322,7 +367,7 @@ async function listFluidOSProfiles(client, definition_id, params) {
322
367
  * @param definition_id - definition_id
323
368
  * @param body - body
324
369
  */
325
- async function createFluidOSProfile(client, definition_id, body) {
370
+ async function fluid_os_v0_create_fluid_osprofile(client, definition_id, body) {
326
371
  return client.post(`/api/company/fluid_os/definitions/${definition_id}/profiles`, body);
327
372
  }
328
373
  /**
@@ -334,7 +379,7 @@ async function createFluidOSProfile(client, definition_id, body) {
334
379
  * @param id - id
335
380
  * @param body - body
336
381
  */
337
- async function updateFluidOSProfile(client, definition_id, id, body) {
382
+ async function fluid_os_v0_update_fluid_osprofile(client, definition_id, id, body) {
338
383
  return client.put(`/api/company/fluid_os/definitions/${definition_id}/profiles/${id}`, body);
339
384
  }
340
385
  /**
@@ -345,7 +390,7 @@ async function updateFluidOSProfile(client, definition_id, id, body) {
345
390
  * @param definition_id - definition_id
346
391
  * @param id - id
347
392
  */
348
- async function deleteFluidOSProfile(client, definition_id, id) {
393
+ async function fluid_os_v0_delete_fluid_osprofile(client, definition_id, id) {
349
394
  return client.delete(`/api/company/fluid_os/definitions/${definition_id}/profiles/${id}`);
350
395
  }
351
396
  /**
@@ -354,9 +399,9 @@ async function deleteFluidOSProfile(client, definition_id, id) {
354
399
  *
355
400
  * @param client - Fetch client instance
356
401
  * @param definition_id - definition_id
357
- * @param params? - params?
402
+ * @param [params] - params
358
403
  */
359
- async function listFluidOSScreens(client, definition_id, params) {
404
+ async function fluid_os_v0_list_fluid_osscreens(client, definition_id, params) {
360
405
  return client.get(`/api/company/fluid_os/definitions/${definition_id}/screens`, params);
361
406
  }
362
407
  /**
@@ -367,7 +412,7 @@ async function listFluidOSScreens(client, definition_id, params) {
367
412
  * @param definition_id - definition_id
368
413
  * @param body - body
369
414
  */
370
- async function createFluidOSScreen(client, definition_id, body) {
415
+ async function fluid_os_v0_create_fluid_osscreen(client, definition_id, body) {
371
416
  return client.post(`/api/company/fluid_os/definitions/${definition_id}/screens`, body);
372
417
  }
373
418
  /**
@@ -378,7 +423,7 @@ async function createFluidOSScreen(client, definition_id, body) {
378
423
  * @param definition_id - definition_id
379
424
  * @param id - id
380
425
  */
381
- async function getFluidOSScreen(client, definition_id, id) {
426
+ async function fluid_os_v0_get_fluid_osscreen(client, definition_id, id) {
382
427
  return client.get(`/api/company/fluid_os/definitions/${definition_id}/screens/${id}`);
383
428
  }
384
429
  /**
@@ -390,7 +435,7 @@ async function getFluidOSScreen(client, definition_id, id) {
390
435
  * @param id - id
391
436
  * @param body - body
392
437
  */
393
- async function updateFluidOSScreen(client, definition_id, id, body) {
438
+ async function fluid_os_v0_update_fluid_osscreen(client, definition_id, id, body) {
394
439
  return client.put(`/api/company/fluid_os/definitions/${definition_id}/screens/${id}`, body);
395
440
  }
396
441
  /**
@@ -401,7 +446,7 @@ async function updateFluidOSScreen(client, definition_id, id, body) {
401
446
  * @param definition_id - definition_id
402
447
  * @param id - id
403
448
  */
404
- async function deleteFluidOSScreen(client, definition_id, id) {
449
+ async function fluid_os_v0_delete_fluid_osscreen(client, definition_id, id) {
405
450
  return client.delete(`/api/company/fluid_os/definitions/${definition_id}/screens/${id}`);
406
451
  }
407
452
  /**
@@ -410,9 +455,9 @@ async function deleteFluidOSScreen(client, definition_id, id) {
410
455
  *
411
456
  * @param client - Fetch client instance
412
457
  * @param definition_id - definition_id
413
- * @param params? - params?
458
+ * @param [params] - params
414
459
  */
415
- async function listFluidOSThemes(client, definition_id, params) {
460
+ async function fluid_os_v0_list_fluid_osthemes(client, definition_id, params) {
416
461
  return client.get(`/api/company/fluid_os/definitions/${definition_id}/themes`, params);
417
462
  }
418
463
  /**
@@ -423,7 +468,7 @@ async function listFluidOSThemes(client, definition_id, params) {
423
468
  * @param definition_id - definition_id
424
469
  * @param body - body
425
470
  */
426
- async function createFluidOSTheme(client, definition_id, body) {
471
+ async function fluid_os_v0_create_fluid_ostheme(client, definition_id, body) {
427
472
  return client.post(`/api/company/fluid_os/definitions/${definition_id}/themes`, body);
428
473
  }
429
474
  /**
@@ -435,7 +480,7 @@ async function createFluidOSTheme(client, definition_id, body) {
435
480
  * @param id - id
436
481
  * @param body - body
437
482
  */
438
- async function updateFluidOSTheme(client, definition_id, id, body) {
483
+ async function fluid_os_v0_update_fluid_ostheme(client, definition_id, id, body) {
439
484
  return client.put(`/api/company/fluid_os/definitions/${definition_id}/themes/${id}`, body);
440
485
  }
441
486
  /**
@@ -446,7 +491,7 @@ async function updateFluidOSTheme(client, definition_id, id, body) {
446
491
  * @param definition_id - definition_id
447
492
  * @param id - id
448
493
  */
449
- async function deleteFluidOSTheme(client, definition_id, id) {
494
+ async function fluid_os_v0_delete_fluid_ostheme(client, definition_id, id) {
450
495
  return client.delete(`/api/company/fluid_os/definitions/${definition_id}/themes/${id}`);
451
496
  }
452
497
  /**
@@ -455,9 +500,9 @@ async function deleteFluidOSTheme(client, definition_id, id) {
455
500
  *
456
501
  * @param client - Fetch client instance
457
502
  * @param definition_id - definition_id
458
- * @param params? - params?
503
+ * @param [params] - params
459
504
  */
460
- async function listFluidOSVersions(client, definition_id, params) {
505
+ async function fluid_os_v0_list_fluid_osversions(client, definition_id, params) {
461
506
  return client.get(`/api/company/fluid_os/definitions/${definition_id}/versions`, params);
462
507
  }
463
508
  /**
@@ -467,7 +512,7 @@ async function listFluidOSVersions(client, definition_id, params) {
467
512
  * @param client - Fetch client instance
468
513
  * @param definition_id - definition_id
469
514
  */
470
- async function createFluidOSVersion(client, definition_id) {
515
+ async function fluid_os_v0_create_fluid_osversion(client, definition_id) {
471
516
  return client.post(`/api/company/fluid_os/definitions/${definition_id}/versions`);
472
517
  }
473
518
  /**
@@ -479,9 +524,30 @@ async function createFluidOSVersion(client, definition_id) {
479
524
  * @param id - id
480
525
  * @param body - body
481
526
  */
482
- async function updateFluidOSVersion(client, definition_id, id, body) {
527
+ async function fluid_os_v0_update_fluid_osversion(client, definition_id, id, body) {
483
528
  return client.put(`/api/company/fluid_os/definitions/${definition_id}/versions/${id}`, body);
484
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
+ }
485
551
  //#endregion
486
552
  //#region src/utils/atomic-write.ts
487
553
  /**
@@ -802,7 +868,7 @@ function transformNavigationItems(items, screenIdToSlug) {
802
868
  label: item.label ?? null,
803
869
  screen: item.screen_id ? screenIdToSlug.get(item.screen_id) ?? null : null,
804
870
  slug: item.slug ?? null,
805
- source: item.source,
871
+ source: item.source ?? "user",
806
872
  position: item.position ?? null,
807
873
  parent_id: item.parent_id ?? null,
808
874
  children: transformNavigationItems(item.children ?? [], screenIdToSlug)
@@ -884,7 +950,7 @@ async function fetchAllDefinitions(client) {
884
950
  const all = [];
885
951
  let page = 1;
886
952
  while (true) {
887
- const response = await listFluidOSDefinitions(client, {
953
+ const response = await fluid_os_v0_list_fluid_osdefinitions(client, {
888
954
  page,
889
955
  per_page: PAGE_LIMIT
890
956
  });
@@ -1004,10 +1070,10 @@ const pullCommand = new Command("pull").description("Pull a Fluid OS definition'
1004
1070
  const navigationItemsMap = /* @__PURE__ */ new Map();
1005
1071
  try {
1006
1072
  const [screensResponse, themesResponse, navigationsResponse, profilesResponse] = await Promise.all([
1007
- listFluidOSScreens(client, definitionId, { per_page: PAGE_LIMIT }),
1008
- listFluidOSThemes(client, definitionId, { per_page: PAGE_LIMIT }),
1009
- listFluidOSNavigations(client, definitionId, { per_page: PAGE_LIMIT }),
1010
- listFluidOSProfiles(client, definitionId, { per_page: PAGE_LIMIT })
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 })
1011
1077
  ]);
1012
1078
  screenBasics = screensResponse.screens ?? [];
1013
1079
  themes = themesResponse.themes ?? [];
@@ -1020,13 +1086,13 @@ const pullCommand = new Command("pull").description("Pull a Fluid OS definition'
1020
1086
  spinner.text = "Fetching screen details...";
1021
1087
  const limit = pLimit(10);
1022
1088
  screens = await Promise.all(screenBasics.map((s) => limit(async () => {
1023
- const res = await getFluidOSScreen(client, definitionId, s.id);
1089
+ const res = await fluid_os_v0_get_fluid_osscreen(client, definitionId, s.id);
1024
1090
  if (!res.screen) throw new Error(`Failed to fetch details for screen ID ${s.id}`);
1025
1091
  return res.screen;
1026
1092
  })));
1027
1093
  spinner.text = "Fetching navigation items...";
1028
1094
  await Promise.all(navigations.map((nav) => limit(async () => {
1029
- const res = await listFluidOSNavigationItems(client, definitionId, nav.id);
1095
+ const res = await fluid_os_v0_list_fluid_osnavigation_items(client, definitionId, nav.id);
1030
1096
  navigationItemsMap.set(nav.id, res.navigation_items ?? []);
1031
1097
  })));
1032
1098
  spinner.succeed(`Fetched ${screens.length} screen(s), ${themes.length} theme(s), ${navigations.length} navigation(s), ${profiles.length} profile(s)`);
@@ -1145,6 +1211,6 @@ const pullCommand = new Command("pull").description("Pull a Fluid OS definition'
1145
1211
  console.log();
1146
1212
  });
1147
1213
  //#endregion
1148
- export { deleteFluidOSNavigation as A, updateFluidOSScreen as B, writeMappings as C, createFluidOSScreen as D, createFluidOSProfile as E, listFluidOSNavigationItems as F, updateFluidOSVersion as H, listFluidOSVersions as I, updateFluidOSNavigation as L, deleteFluidOSProfile as M, deleteFluidOSScreen as N, createFluidOSTheme as O, deleteFluidOSTheme as P, updateFluidOSNavigationItem as R, updateMapping as S, createFluidOSNavigationItem as T, createFetchClient as U, updateFluidOSTheme as V, 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, deleteFluidOSNavigationItem as j, createFluidOSVersion 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, createFluidOSNavigation as w, resolveSlugToId as x, removeMapping as y, updateFluidOSProfile as z };
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 };
1149
1215
 
1150
- //# sourceMappingURL=pull-CxQwoQrZ.mjs.map
1216
+ //# sourceMappingURL=pull-zrTaJuSb.mjs.map