@fluid-app/fluid-cli-portal 0.1.43 → 0.1.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +388 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +26 -29
- package/dist/index.mjs.map +1 -1
- package/dist/{pull-Cl7omGLf.mjs → pull-CG5dELOX.mjs} +537 -10
- package/dist/pull-CG5dELOX.mjs.map +1 -0
- package/package.json +3 -3
- package/dist/pull-Cl7omGLf.mjs.map +0 -1
|
@@ -7,7 +7,6 @@ import { mkdir, readFile, readdir, rename, rm, stat, unlink, writeFile } from "n
|
|
|
7
7
|
import { getActiveProfile, getAuthToken } from "@fluid-app/fluid-cli";
|
|
8
8
|
import prompts from "prompts";
|
|
9
9
|
import { existsSync } from "node:fs";
|
|
10
|
-
import { createFetchClient, fluidOs } from "@fluid-app/fluidos-api-client";
|
|
11
10
|
import pLimit from "p-limit";
|
|
12
11
|
import { createHash, randomBytes } from "node:crypto";
|
|
13
12
|
//#region \0rolldown/runtime.js
|
|
@@ -22,6 +21,534 @@ var __exportAll = (all, no_symbols) => {
|
|
|
22
21
|
return target;
|
|
23
22
|
};
|
|
24
23
|
//#endregion
|
|
24
|
+
//#region ../../platform/api-client-core/src/fetch-client.ts
|
|
25
|
+
/**
|
|
26
|
+
* API Error class compatible with fluid-admin's ApiError
|
|
27
|
+
*/
|
|
28
|
+
var ApiError = class ApiError extends Error {
|
|
29
|
+
status;
|
|
30
|
+
data;
|
|
31
|
+
requestId;
|
|
32
|
+
constructor(message, status, data, requestId) {
|
|
33
|
+
super(message);
|
|
34
|
+
this.name = "ApiError";
|
|
35
|
+
this.status = status;
|
|
36
|
+
this.data = data;
|
|
37
|
+
this.requestId = requestId;
|
|
38
|
+
if ("captureStackTrace" in Error) Error.captureStackTrace(this, ApiError);
|
|
39
|
+
}
|
|
40
|
+
toJSON() {
|
|
41
|
+
return {
|
|
42
|
+
name: this.name,
|
|
43
|
+
message: this.message,
|
|
44
|
+
status: this.status,
|
|
45
|
+
data: this.data,
|
|
46
|
+
requestId: this.requestId
|
|
47
|
+
};
|
|
48
|
+
}
|
|
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
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Creates a configured fetch client instance
|
|
66
|
+
*/
|
|
67
|
+
function createFetchClient(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);
|
|
71
|
+
/**
|
|
72
|
+
* Build headers for a request
|
|
73
|
+
*/
|
|
74
|
+
async function buildHeaders(customHeaders) {
|
|
75
|
+
const headers = {
|
|
76
|
+
Accept: "application/json",
|
|
77
|
+
"Content-Type": "application/json",
|
|
78
|
+
...defaultHeaders,
|
|
79
|
+
...customHeaders
|
|
80
|
+
};
|
|
81
|
+
if (getAuthToken) {
|
|
82
|
+
const token = await getAuthToken();
|
|
83
|
+
if (token) headers.Authorization = `Bearer ${token}`;
|
|
84
|
+
}
|
|
85
|
+
return headers;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Join baseUrl + endpoint via string concatenation (matches fetchApi).
|
|
89
|
+
* Using `new URL(endpoint, baseUrl)` would strip any path prefix from
|
|
90
|
+
* baseUrl (e.g. "/api") when the endpoint starts with "/".
|
|
91
|
+
*/
|
|
92
|
+
function joinUrl(endpoint) {
|
|
93
|
+
return `${baseUrl}${endpoint}`;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Build URL with query parameters for GET requests
|
|
97
|
+
* Compatible with fluid-admin's query param handling
|
|
98
|
+
*/
|
|
99
|
+
function buildUrl(endpoint, params) {
|
|
100
|
+
const fullUrl = joinUrl(endpoint);
|
|
101
|
+
if (!params || Object.keys(params).length === 0) return fullUrl;
|
|
102
|
+
const queryString = new URLSearchParams();
|
|
103
|
+
Object.entries(params).forEach(([key, value]) => {
|
|
104
|
+
if (value === void 0 || value === null) return;
|
|
105
|
+
if (Array.isArray(value)) value.forEach((item) => queryString.append(`${key}[]`, String(item)));
|
|
106
|
+
else if (typeof value === "object") Object.entries(value).forEach(([subKey, subValue]) => {
|
|
107
|
+
if (subValue === void 0 || subValue === null) return;
|
|
108
|
+
if (Array.isArray(subValue)) subValue.forEach((item) => queryString.append(`${key}[${subKey}][]`, String(item)));
|
|
109
|
+
else queryString.append(`${key}[${subKey}]`, String(subValue));
|
|
110
|
+
});
|
|
111
|
+
else queryString.append(key, String(value));
|
|
112
|
+
});
|
|
113
|
+
const qs = queryString.toString();
|
|
114
|
+
return qs ? `${fullUrl}?${qs}` : fullUrl;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Shared response handler for both JSON and FormData requests.
|
|
118
|
+
* Handles auth errors, non-OK responses, 204 No Content, and JSON parsing.
|
|
119
|
+
*/
|
|
120
|
+
async function handleResponse(response, method, _url) {
|
|
121
|
+
const headerRequestId = getRequestIdFromHeaders(response.headers);
|
|
122
|
+
if (response.status === 401 && onAuthError) onAuthError();
|
|
123
|
+
if (!response.ok) {
|
|
124
|
+
const errorText = await response.text().catch(() => "");
|
|
125
|
+
if (response.headers.get("content-type")?.includes("application/json")) {
|
|
126
|
+
let data;
|
|
127
|
+
try {
|
|
128
|
+
data = JSON.parse(errorText);
|
|
129
|
+
} catch {
|
|
130
|
+
throw new ApiError(errorText.slice(0, 200) || `${method} request failed with status ${response.status}`, response.status, null, headerRequestId);
|
|
131
|
+
}
|
|
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);
|
|
135
|
+
}
|
|
136
|
+
if (response.status === 204 || response.headers.get("content-length") === "0") return null;
|
|
137
|
+
if (response.headers.get("content-type")?.includes("application/json")) {
|
|
138
|
+
const responseText = await response.text();
|
|
139
|
+
try {
|
|
140
|
+
return JSON.parse(responseText);
|
|
141
|
+
} catch {
|
|
142
|
+
if (throwOnInvalidJson) throw new ApiError("Failed to parse response as JSON", response.status, null, headerRequestId);
|
|
143
|
+
return responseText ? responseText : null;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return null;
|
|
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
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Main request function
|
|
169
|
+
*/
|
|
170
|
+
async function request(endpoint, options = {}) {
|
|
171
|
+
const { method = "GET", headers: customHeaders, params, body, signal, priority } = options;
|
|
172
|
+
const url = params ? buildUrl(endpoint, params) : joinUrl(endpoint);
|
|
173
|
+
const headers = await buildHeaders(customHeaders);
|
|
174
|
+
let response;
|
|
175
|
+
try {
|
|
176
|
+
const fetchOptions = {
|
|
177
|
+
method,
|
|
178
|
+
headers
|
|
179
|
+
};
|
|
180
|
+
if (credentials) fetchOptions.credentials = credentials;
|
|
181
|
+
if (cache) fetchOptions.cache = cache;
|
|
182
|
+
if (priority) fetchOptions.priority = priority;
|
|
183
|
+
const serializedBody = body && method !== "GET" ? JSON.stringify(body) : null;
|
|
184
|
+
if (serializedBody) fetchOptions.body = serializedBody;
|
|
185
|
+
if (signal) fetchOptions.signal = signal;
|
|
186
|
+
response = await fetchWithNetworkRetry(url, fetchOptions, signal);
|
|
187
|
+
} catch (networkError) {
|
|
188
|
+
throw new ApiError(`Network error: ${networkError instanceof Error ? networkError.message : "Unknown network error"}`, 0, null);
|
|
189
|
+
}
|
|
190
|
+
return handleResponse(response, method, url);
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Request with FormData (for file uploads)
|
|
194
|
+
*/
|
|
195
|
+
async function requestWithFormData(endpoint, formData, options = {}) {
|
|
196
|
+
const { method = "POST", headers: customHeaders, signal, priority } = options;
|
|
197
|
+
const url = joinUrl(endpoint);
|
|
198
|
+
const headers = await buildHeaders(customHeaders);
|
|
199
|
+
delete headers["Content-Type"];
|
|
200
|
+
let response;
|
|
201
|
+
try {
|
|
202
|
+
const fetchOptions = {
|
|
203
|
+
method,
|
|
204
|
+
headers,
|
|
205
|
+
body: formData
|
|
206
|
+
};
|
|
207
|
+
if (credentials) fetchOptions.credentials = credentials;
|
|
208
|
+
if (cache) fetchOptions.cache = cache;
|
|
209
|
+
if (priority) fetchOptions.priority = priority;
|
|
210
|
+
if (signal) fetchOptions.signal = signal;
|
|
211
|
+
response = await fetchWithNetworkRetry(url, fetchOptions, signal);
|
|
212
|
+
} catch (networkError) {
|
|
213
|
+
throw new ApiError(`Network error: ${networkError instanceof Error ? networkError.message : "Unknown network error"}`, 0, null);
|
|
214
|
+
}
|
|
215
|
+
return handleResponse(response, method, url);
|
|
216
|
+
}
|
|
217
|
+
return {
|
|
218
|
+
request,
|
|
219
|
+
requestWithFormData,
|
|
220
|
+
get: (endpoint, params, options) => request(endpoint, {
|
|
221
|
+
...options,
|
|
222
|
+
method: "GET",
|
|
223
|
+
...params && { params }
|
|
224
|
+
}),
|
|
225
|
+
post: (endpoint, body, options) => request(endpoint, {
|
|
226
|
+
...options,
|
|
227
|
+
method: "POST",
|
|
228
|
+
body
|
|
229
|
+
}),
|
|
230
|
+
put: (endpoint, body, options) => request(endpoint, {
|
|
231
|
+
...options,
|
|
232
|
+
method: "PUT",
|
|
233
|
+
body
|
|
234
|
+
}),
|
|
235
|
+
patch: (endpoint, body, options) => request(endpoint, {
|
|
236
|
+
...options,
|
|
237
|
+
method: "PATCH",
|
|
238
|
+
body
|
|
239
|
+
}),
|
|
240
|
+
delete: (endpoint, options) => request(endpoint, {
|
|
241
|
+
...options,
|
|
242
|
+
method: "DELETE"
|
|
243
|
+
})
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
//#endregion
|
|
247
|
+
//#region ../../api-clients/fluidos/src/namespaces/fluid_os_v0.ts
|
|
248
|
+
/**
|
|
249
|
+
* List Fluid OS definitions
|
|
250
|
+
* Retrieve a list of Fluid OS definitions for the current company
|
|
251
|
+
*
|
|
252
|
+
* @param client - Fetch client instance
|
|
253
|
+
* @param [params] - params
|
|
254
|
+
*/
|
|
255
|
+
async function fluid_os_v0_list_fluid_osdefinitions(client, params) {
|
|
256
|
+
return client.get(`/api/company/fluid_os/definitions`, params);
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* List navigations for a Fluid OS definition
|
|
260
|
+
* Retrieve a list of navigations for a specific Fluid OS definition
|
|
261
|
+
*
|
|
262
|
+
* @param client - Fetch client instance
|
|
263
|
+
* @param definition_id - definition_id
|
|
264
|
+
* @param [params] - params
|
|
265
|
+
*/
|
|
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);
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Create a navigation for a Fluid OS definition
|
|
271
|
+
* Create a new navigation for a Fluid OS definition
|
|
272
|
+
*
|
|
273
|
+
* @param client - Fetch client instance
|
|
274
|
+
* @param definition_id - definition_id
|
|
275
|
+
* @param body - body
|
|
276
|
+
*/
|
|
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);
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Update a navigation
|
|
282
|
+
* Update an existing navigation
|
|
283
|
+
*
|
|
284
|
+
* @param client - Fetch client instance
|
|
285
|
+
* @param definition_id - definition_id
|
|
286
|
+
* @param id - id
|
|
287
|
+
* @param body - body
|
|
288
|
+
*/
|
|
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);
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Delete a navigation
|
|
294
|
+
* Delete a navigation
|
|
295
|
+
*
|
|
296
|
+
* @param client - Fetch client instance
|
|
297
|
+
* @param definition_id - definition_id
|
|
298
|
+
* @param id - id
|
|
299
|
+
*/
|
|
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}`);
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* List navigation items for a navigation
|
|
305
|
+
* Retrieve a list of navigation items for a specific navigation
|
|
306
|
+
*
|
|
307
|
+
* @param client - Fetch client instance
|
|
308
|
+
* @param definition_id - definition_id
|
|
309
|
+
* @param navigation_id - navigation_id
|
|
310
|
+
*/
|
|
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`);
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Create a navigation item
|
|
316
|
+
* Create a new navigation item for a navigation
|
|
317
|
+
*
|
|
318
|
+
* @param client - Fetch client instance
|
|
319
|
+
* @param definition_id - definition_id
|
|
320
|
+
* @param navigation_id - navigation_id
|
|
321
|
+
* @param body - body
|
|
322
|
+
*/
|
|
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);
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Update a navigation item
|
|
328
|
+
* Update an existing navigation item
|
|
329
|
+
*
|
|
330
|
+
* @param client - Fetch client instance
|
|
331
|
+
* @param definition_id - definition_id
|
|
332
|
+
* @param navigation_id - navigation_id
|
|
333
|
+
* @param id - id
|
|
334
|
+
* @param body - body
|
|
335
|
+
*/
|
|
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);
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Delete a navigation item
|
|
341
|
+
* Delete a navigation item
|
|
342
|
+
*
|
|
343
|
+
* @param client - Fetch client instance
|
|
344
|
+
* @param definition_id - definition_id
|
|
345
|
+
* @param navigation_id - navigation_id
|
|
346
|
+
* @param id - id
|
|
347
|
+
*/
|
|
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}`);
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* List profiles for a Fluid OS definition
|
|
353
|
+
* Retrieve a list of profiles for a specific Fluid OS definition
|
|
354
|
+
*
|
|
355
|
+
* @param client - Fetch client instance
|
|
356
|
+
* @param definition_id - definition_id
|
|
357
|
+
* @param [params] - params
|
|
358
|
+
*/
|
|
359
|
+
async function fluid_os_v0_list_fluid_osprofiles(client, definition_id, params) {
|
|
360
|
+
return client.get(`/api/company/fluid_os/definitions/${definition_id}/profiles`, params);
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Create a profile for a Fluid OS definition
|
|
364
|
+
* Create a new profile for a Fluid OS definition
|
|
365
|
+
*
|
|
366
|
+
* @param client - Fetch client instance
|
|
367
|
+
* @param definition_id - definition_id
|
|
368
|
+
* @param body - body
|
|
369
|
+
*/
|
|
370
|
+
async function fluid_os_v0_create_fluid_osprofile(client, definition_id, body) {
|
|
371
|
+
return client.post(`/api/company/fluid_os/definitions/${definition_id}/profiles`, body);
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Update a profile
|
|
375
|
+
* Update an existing profile
|
|
376
|
+
*
|
|
377
|
+
* @param client - Fetch client instance
|
|
378
|
+
* @param definition_id - definition_id
|
|
379
|
+
* @param id - id
|
|
380
|
+
* @param body - body
|
|
381
|
+
*/
|
|
382
|
+
async function fluid_os_v0_update_fluid_osprofile(client, definition_id, id, body) {
|
|
383
|
+
return client.put(`/api/company/fluid_os/definitions/${definition_id}/profiles/${id}`, body);
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Delete a profile
|
|
387
|
+
* Delete a profile
|
|
388
|
+
*
|
|
389
|
+
* @param client - Fetch client instance
|
|
390
|
+
* @param definition_id - definition_id
|
|
391
|
+
* @param id - id
|
|
392
|
+
*/
|
|
393
|
+
async function fluid_os_v0_delete_fluid_osprofile(client, definition_id, id) {
|
|
394
|
+
return client.delete(`/api/company/fluid_os/definitions/${definition_id}/profiles/${id}`);
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* List screens for a Fluid OS definition
|
|
398
|
+
* Retrieve a list of screens for a specific Fluid OS definition
|
|
399
|
+
*
|
|
400
|
+
* @param client - Fetch client instance
|
|
401
|
+
* @param definition_id - definition_id
|
|
402
|
+
* @param [params] - params
|
|
403
|
+
*/
|
|
404
|
+
async function fluid_os_v0_list_fluid_osscreens(client, definition_id, params) {
|
|
405
|
+
return client.get(`/api/company/fluid_os/definitions/${definition_id}/screens`, params);
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* Create a screen for a Fluid OS definition
|
|
409
|
+
* Create a new screen for a Fluid OS definition
|
|
410
|
+
*
|
|
411
|
+
* @param client - Fetch client instance
|
|
412
|
+
* @param definition_id - definition_id
|
|
413
|
+
* @param body - body
|
|
414
|
+
*/
|
|
415
|
+
async function fluid_os_v0_create_fluid_osscreen(client, definition_id, body) {
|
|
416
|
+
return client.post(`/api/company/fluid_os/definitions/${definition_id}/screens`, body);
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* Get a specific screen
|
|
420
|
+
* Retrieve a specific screen
|
|
421
|
+
*
|
|
422
|
+
* @param client - Fetch client instance
|
|
423
|
+
* @param definition_id - definition_id
|
|
424
|
+
* @param id - id
|
|
425
|
+
*/
|
|
426
|
+
async function fluid_os_v0_get_fluid_osscreen(client, definition_id, id) {
|
|
427
|
+
return client.get(`/api/company/fluid_os/definitions/${definition_id}/screens/${id}`);
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* Update a screen
|
|
431
|
+
* Update an existing screen
|
|
432
|
+
*
|
|
433
|
+
* @param client - Fetch client instance
|
|
434
|
+
* @param definition_id - definition_id
|
|
435
|
+
* @param id - id
|
|
436
|
+
* @param body - body
|
|
437
|
+
*/
|
|
438
|
+
async function fluid_os_v0_update_fluid_osscreen(client, definition_id, id, body) {
|
|
439
|
+
return client.put(`/api/company/fluid_os/definitions/${definition_id}/screens/${id}`, body);
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* Delete a screen
|
|
443
|
+
* Delete a screen
|
|
444
|
+
*
|
|
445
|
+
* @param client - Fetch client instance
|
|
446
|
+
* @param definition_id - definition_id
|
|
447
|
+
* @param id - id
|
|
448
|
+
*/
|
|
449
|
+
async function fluid_os_v0_delete_fluid_osscreen(client, definition_id, id) {
|
|
450
|
+
return client.delete(`/api/company/fluid_os/definitions/${definition_id}/screens/${id}`);
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* List themes for a Fluid OS definition
|
|
454
|
+
* Retrieve a list of themes for a specific Fluid OS definition
|
|
455
|
+
*
|
|
456
|
+
* @param client - Fetch client instance
|
|
457
|
+
* @param definition_id - definition_id
|
|
458
|
+
* @param [params] - params
|
|
459
|
+
*/
|
|
460
|
+
async function fluid_os_v0_list_fluid_osthemes(client, definition_id, params) {
|
|
461
|
+
return client.get(`/api/company/fluid_os/definitions/${definition_id}/themes`, params);
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* Create a theme for a Fluid OS definition
|
|
465
|
+
* Create a new theme for a Fluid OS definition
|
|
466
|
+
*
|
|
467
|
+
* @param client - Fetch client instance
|
|
468
|
+
* @param definition_id - definition_id
|
|
469
|
+
* @param body - body
|
|
470
|
+
*/
|
|
471
|
+
async function fluid_os_v0_create_fluid_ostheme(client, definition_id, body) {
|
|
472
|
+
return client.post(`/api/company/fluid_os/definitions/${definition_id}/themes`, body);
|
|
473
|
+
}
|
|
474
|
+
/**
|
|
475
|
+
* Update a theme
|
|
476
|
+
* Update an existing theme
|
|
477
|
+
*
|
|
478
|
+
* @param client - Fetch client instance
|
|
479
|
+
* @param definition_id - definition_id
|
|
480
|
+
* @param id - id
|
|
481
|
+
* @param body - body
|
|
482
|
+
*/
|
|
483
|
+
async function fluid_os_v0_update_fluid_ostheme(client, definition_id, id, body) {
|
|
484
|
+
return client.put(`/api/company/fluid_os/definitions/${definition_id}/themes/${id}`, body);
|
|
485
|
+
}
|
|
486
|
+
/**
|
|
487
|
+
* Delete a theme
|
|
488
|
+
* Delete a theme
|
|
489
|
+
*
|
|
490
|
+
* @param client - Fetch client instance
|
|
491
|
+
* @param definition_id - definition_id
|
|
492
|
+
* @param id - id
|
|
493
|
+
*/
|
|
494
|
+
async function fluid_os_v0_delete_fluid_ostheme(client, definition_id, id) {
|
|
495
|
+
return client.delete(`/api/company/fluid_os/definitions/${definition_id}/themes/${id}`);
|
|
496
|
+
}
|
|
497
|
+
/**
|
|
498
|
+
* List versions for a Fluid OS definition
|
|
499
|
+
* Retrieve a list of published versions for a specific Fluid OS definition
|
|
500
|
+
*
|
|
501
|
+
* @param client - Fetch client instance
|
|
502
|
+
* @param definition_id - definition_id
|
|
503
|
+
* @param [params] - params
|
|
504
|
+
*/
|
|
505
|
+
async function fluid_os_v0_list_fluid_osversions(client, definition_id, params) {
|
|
506
|
+
return client.get(`/api/company/fluid_os/definitions/${definition_id}/versions`, params);
|
|
507
|
+
}
|
|
508
|
+
/**
|
|
509
|
+
* Publish a new version of a Fluid OS definition
|
|
510
|
+
* Publish a new version of the Fluid OS definition. This creates a snapshot of the current definition state including all screens, profiles, themes, and navigations. No request body is required - the manifest is built automatically from the current definition state.
|
|
511
|
+
*
|
|
512
|
+
* @param client - Fetch client instance
|
|
513
|
+
* @param definition_id - definition_id
|
|
514
|
+
*/
|
|
515
|
+
async function fluid_os_v0_create_fluid_osversion(client, definition_id) {
|
|
516
|
+
return client.post(`/api/company/fluid_os/definitions/${definition_id}/versions`);
|
|
517
|
+
}
|
|
518
|
+
/**
|
|
519
|
+
* Update a version
|
|
520
|
+
* Update a version. Currently only supports activating/deactivating a version.
|
|
521
|
+
*
|
|
522
|
+
* @param client - Fetch client instance
|
|
523
|
+
* @param definition_id - definition_id
|
|
524
|
+
* @param id - id
|
|
525
|
+
* @param body - body
|
|
526
|
+
*/
|
|
527
|
+
async function fluid_os_v0_update_fluid_osversion(client, definition_id, id, body) {
|
|
528
|
+
return client.put(`/api/company/fluid_os/definitions/${definition_id}/versions/${id}`, body);
|
|
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
|
+
}
|
|
551
|
+
//#endregion
|
|
25
552
|
//#region src/utils/atomic-write.ts
|
|
26
553
|
/**
|
|
27
554
|
* Atomic file write utility.
|
|
@@ -423,7 +950,7 @@ async function fetchAllDefinitions(client) {
|
|
|
423
950
|
const all = [];
|
|
424
951
|
let page = 1;
|
|
425
952
|
while (true) {
|
|
426
|
-
const response = await
|
|
953
|
+
const response = await fluid_os_v0_list_fluid_osdefinitions(client, {
|
|
427
954
|
page,
|
|
428
955
|
per_page: PAGE_LIMIT
|
|
429
956
|
});
|
|
@@ -543,10 +1070,10 @@ const pullCommand = new Command("pull").description("Pull a Fluid OS definition'
|
|
|
543
1070
|
const navigationItemsMap = /* @__PURE__ */ new Map();
|
|
544
1071
|
try {
|
|
545
1072
|
const [screensResponse, themesResponse, navigationsResponse, profilesResponse] = await Promise.all([
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
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 })
|
|
550
1077
|
]);
|
|
551
1078
|
screenBasics = screensResponse.screens ?? [];
|
|
552
1079
|
themes = themesResponse.themes ?? [];
|
|
@@ -559,13 +1086,13 @@ const pullCommand = new Command("pull").description("Pull a Fluid OS definition'
|
|
|
559
1086
|
spinner.text = "Fetching screen details...";
|
|
560
1087
|
const limit = pLimit(10);
|
|
561
1088
|
screens = await Promise.all(screenBasics.map((s) => limit(async () => {
|
|
562
|
-
const res = await
|
|
1089
|
+
const res = await fluid_os_v0_get_fluid_osscreen(client, definitionId, s.id);
|
|
563
1090
|
if (!res.screen) throw new Error(`Failed to fetch details for screen ID ${s.id}`);
|
|
564
1091
|
return res.screen;
|
|
565
1092
|
})));
|
|
566
1093
|
spinner.text = "Fetching navigation items...";
|
|
567
1094
|
await Promise.all(navigations.map((nav) => limit(async () => {
|
|
568
|
-
const res = await
|
|
1095
|
+
const res = await fluid_os_v0_list_fluid_osnavigation_items(client, definitionId, nav.id);
|
|
569
1096
|
navigationItemsMap.set(nav.id, res.navigation_items ?? []);
|
|
570
1097
|
})));
|
|
571
1098
|
spinner.succeed(`Fetched ${screens.length} screen(s), ${themes.length} theme(s), ${navigations.length} navigation(s), ${profiles.length} profile(s)`);
|
|
@@ -684,6 +1211,6 @@ const pullCommand = new Command("pull").description("Pull a Fluid OS definition'
|
|
|
684
1211
|
console.log();
|
|
685
1212
|
});
|
|
686
1213
|
//#endregion
|
|
687
|
-
export { writeMappings as C, updateMapping as S, 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, 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, resolveSlugToId as x, removeMapping as y };
|
|
1214
|
+
export { fluid_os_v0_create_fluid_osversion as A, fluid_os_v0_update_fluid_osnavigation 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, fluid_os_v0_update_fluid_osversion as G, fluid_os_v0_update_fluid_osprofile as H, fluid_os_v0_delete_fluid_ostheme as I, createFetchClient as K, fluid_os_v0_list_fluid_osdefinitions 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_osnavigation_items as R, updateMapping as S, fluid_os_v0_create_fluid_osnavigation as T, fluid_os_v0_update_fluid_osscreen as U, fluid_os_v0_update_fluid_osnavigation_item as V, fluid_os_v0_update_fluid_ostheme 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_list_fluid_osversions as z };
|
|
688
1215
|
|
|
689
|
-
//# sourceMappingURL=pull-
|
|
1216
|
+
//# sourceMappingURL=pull-CG5dELOX.mjs.map
|