@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
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as writeMappings, S as updateMapping, _ as deriveSlug, a as buildThemeIdToSlugMap, b as resolveIdToSlug, c as transformNavigationItems, d as transformTheme, f as buildSnapshot, g as writeSnapshot, h as readSnapshot, i as buildNavigationIdToSlugMap, l as transformProfile, m as diffAgainstSnapshot, o as deriveScreenSlug, p as computeFileHash, r as buildIdToSlugMap, s as transformNavigation, t as pullCommand, u as transformScreen, v as readMappings, x as resolveSlugToId, y as removeMapping } from "./pull-
|
|
1
|
+
import { A as fluid_os_v0_create_fluid_osversion, B as fluid_os_v0_update_fluid_osnavigation, C as writeMappings, D as fluid_os_v0_create_fluid_osprofile, E as fluid_os_v0_create_fluid_osnavigation_item, F as fluid_os_v0_delete_fluid_osscreen, G as fluid_os_v0_update_fluid_osversion, H as fluid_os_v0_update_fluid_osprofile, I as fluid_os_v0_delete_fluid_ostheme, K as createFetchClient, L as fluid_os_v0_list_fluid_osdefinitions, M as fluid_os_v0_delete_fluid_osnavigation, N as fluid_os_v0_delete_fluid_osnavigation_item, O as fluid_os_v0_create_fluid_osscreen, P as fluid_os_v0_delete_fluid_osprofile, R as fluid_os_v0_list_fluid_osnavigation_items, S as updateMapping, T as fluid_os_v0_create_fluid_osnavigation, U as fluid_os_v0_update_fluid_osscreen, V as fluid_os_v0_update_fluid_osnavigation_item, W as fluid_os_v0_update_fluid_ostheme, _ as deriveSlug, a as buildThemeIdToSlugMap, b as resolveIdToSlug, c as transformNavigationItems, d as transformTheme, f as buildSnapshot, g as writeSnapshot, h as readSnapshot, i as buildNavigationIdToSlugMap, j as fluid_os_v0_create_widget_package_version, k as fluid_os_v0_create_fluid_ostheme, l as transformProfile, m as diffAgainstSnapshot, o as deriveScreenSlug, p as computeFileHash, r as buildIdToSlugMap, s as transformNavigation, t as pullCommand, u as transformScreen, v as readMappings, w as fluid_os_v0_complete_widget_package_version_upload, x as resolveSlugToId, y as removeMapping, z as fluid_os_v0_list_fluid_osversions } from "./pull-CG5dELOX.mjs";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { Command } from "commander";
|
|
4
4
|
import chalk from "chalk";
|
|
@@ -12,7 +12,6 @@ import { chmodSync, existsSync, mkdirSync, readFileSync, readdirSync, writeFileS
|
|
|
12
12
|
import Handlebars from "handlebars";
|
|
13
13
|
import { execa } from "execa";
|
|
14
14
|
import os from "node:os";
|
|
15
|
-
import { createFetchClient, fluidOs } from "@fluid-app/fluidos-api-client";
|
|
16
15
|
import { createHash } from "node:crypto";
|
|
17
16
|
import fs from "fs-extra";
|
|
18
17
|
import { isJsonValue } from "@fluid-app/portal-core/remote-dom-widget-package";
|
|
@@ -1160,7 +1159,7 @@ async function autoPull(cwd) {
|
|
|
1160
1159
|
console.log(chalk.yellow("No portal/ directory found.") + " Attempting to pull content...");
|
|
1161
1160
|
console.log();
|
|
1162
1161
|
try {
|
|
1163
|
-
const { pullCommand } = await import("./pull-
|
|
1162
|
+
const { pullCommand } = await import("./pull-CG5dELOX.mjs").then((n) => n.n);
|
|
1164
1163
|
await pullCommand.parseAsync([], { from: "user" });
|
|
1165
1164
|
return hasPortalContent(cwd);
|
|
1166
1165
|
} catch (err) {
|
|
@@ -1663,7 +1662,7 @@ async function pushScreens(client, defId, portalDir, changes, mappings) {
|
|
|
1663
1662
|
const slug = slugFromPath(file);
|
|
1664
1663
|
try {
|
|
1665
1664
|
const local = await readPortalFile(portalDir, file);
|
|
1666
|
-
const newId = (await
|
|
1665
|
+
const newId = (await fluid_os_v0_create_fluid_osscreen(client, defId, { screen: {
|
|
1667
1666
|
name: local.name,
|
|
1668
1667
|
slug,
|
|
1669
1668
|
component_tree: toApiComponentTree(local.component_tree)
|
|
@@ -1704,7 +1703,7 @@ async function pushScreens(client, defId, portalDir, changes, mappings) {
|
|
|
1704
1703
|
}
|
|
1705
1704
|
try {
|
|
1706
1705
|
const local = await readPortalFile(portalDir, file);
|
|
1707
|
-
await
|
|
1706
|
+
await fluid_os_v0_update_fluid_osscreen(client, defId, screenId, { screen: {
|
|
1708
1707
|
name: local.name,
|
|
1709
1708
|
slug,
|
|
1710
1709
|
component_tree: toApiComponentTree(local.component_tree)
|
|
@@ -1743,7 +1742,7 @@ async function pushScreens(client, defId, portalDir, changes, mappings) {
|
|
|
1743
1742
|
};
|
|
1744
1743
|
}
|
|
1745
1744
|
try {
|
|
1746
|
-
await
|
|
1745
|
+
await fluid_os_v0_delete_fluid_osscreen(client, defId, screenId);
|
|
1747
1746
|
currentMappings = removeMapping(currentMappings, "screens", slug);
|
|
1748
1747
|
results.push({
|
|
1749
1748
|
file,
|
|
@@ -1778,7 +1777,7 @@ async function pushThemes(client, defId, portalDir, changes, mappings) {
|
|
|
1778
1777
|
const slug = slugFromPath(file);
|
|
1779
1778
|
try {
|
|
1780
1779
|
const local = await readPortalFile(portalDir, file);
|
|
1781
|
-
const newId = (await
|
|
1780
|
+
const newId = (await fluid_os_v0_create_fluid_ostheme(client, defId, { theme: {
|
|
1782
1781
|
name: local.name,
|
|
1783
1782
|
active: local.active,
|
|
1784
1783
|
config: local.config
|
|
@@ -1819,7 +1818,7 @@ async function pushThemes(client, defId, portalDir, changes, mappings) {
|
|
|
1819
1818
|
}
|
|
1820
1819
|
try {
|
|
1821
1820
|
const local = await readPortalFile(portalDir, file);
|
|
1822
|
-
await
|
|
1821
|
+
await fluid_os_v0_update_fluid_ostheme(client, defId, themeId, { theme: {
|
|
1823
1822
|
name: local.name,
|
|
1824
1823
|
active: local.active,
|
|
1825
1824
|
config: local.config
|
|
@@ -1858,7 +1857,7 @@ async function pushThemes(client, defId, portalDir, changes, mappings) {
|
|
|
1858
1857
|
};
|
|
1859
1858
|
}
|
|
1860
1859
|
try {
|
|
1861
|
-
await
|
|
1860
|
+
await fluid_os_v0_delete_fluid_ostheme(client, defId, themeId);
|
|
1862
1861
|
currentMappings = removeMapping(currentMappings, "themes", slug);
|
|
1863
1862
|
results.push({
|
|
1864
1863
|
file,
|
|
@@ -1928,7 +1927,7 @@ async function pushNavigations(client, defId, portalDir, changes, mappings) {
|
|
|
1928
1927
|
const slug = slugFromPath(file);
|
|
1929
1928
|
try {
|
|
1930
1929
|
const local = await readPortalFile(portalDir, file);
|
|
1931
|
-
const newId = (await
|
|
1930
|
+
const newId = (await fluid_os_v0_create_fluid_osnavigation(client, defId, { navigation: {
|
|
1932
1931
|
name: local.name,
|
|
1933
1932
|
platform: local.platform
|
|
1934
1933
|
} })).navigation?.id;
|
|
@@ -1938,7 +1937,7 @@ async function pushNavigations(client, defId, portalDir, changes, mappings) {
|
|
|
1938
1937
|
const localToServerId = /* @__PURE__ */ new Map();
|
|
1939
1938
|
for (const item of resolvedItems) {
|
|
1940
1939
|
const resolvedParentId = item.parent_id != null ? localToServerId.get(item.parent_id) ?? item.parent_id : void 0;
|
|
1941
|
-
const created = await
|
|
1940
|
+
const created = await fluid_os_v0_create_fluid_osnavigation_item(client, defId, newId, { navigation_item: {
|
|
1942
1941
|
label: item.label ?? "",
|
|
1943
1942
|
position: item.position ?? 0,
|
|
1944
1943
|
icon: item.icon ?? void 0,
|
|
@@ -1985,15 +1984,15 @@ async function pushNavigations(client, defId, portalDir, changes, mappings) {
|
|
|
1985
1984
|
}
|
|
1986
1985
|
try {
|
|
1987
1986
|
const local = await readPortalFile(portalDir, file);
|
|
1988
|
-
await
|
|
1987
|
+
await fluid_os_v0_update_fluid_osnavigation(client, defId, navId, { navigation: {
|
|
1989
1988
|
name: local.name,
|
|
1990
1989
|
platform: local.platform
|
|
1991
1990
|
} });
|
|
1992
1991
|
const resolvedItems = flattenNavigationItems(resolveNavigationItemScreenIds(local.navigation_items, currentMappings));
|
|
1993
|
-
const serverItems = (await
|
|
1992
|
+
const serverItems = (await fluid_os_v0_list_fluid_osnavigation_items(client, defId, navId)).navigation_items ?? [];
|
|
1994
1993
|
const serverById = new Map(serverItems.map((s) => [s.id, s]));
|
|
1995
1994
|
const localIds = new Set(resolvedItems.filter((i) => i.id).map((i) => i.id));
|
|
1996
|
-
for (const serverItem of serverItems) if (!localIds.has(serverItem.id)) await
|
|
1995
|
+
for (const serverItem of serverItems) if (!localIds.has(serverItem.id)) await fluid_os_v0_delete_fluid_osnavigation_item(client, defId, navId, serverItem.id);
|
|
1997
1996
|
const localToServerId = /* @__PURE__ */ new Map();
|
|
1998
1997
|
for (const item of resolvedItems) {
|
|
1999
1998
|
const resolvedParentId = item.parent_id != null ? localToServerId.get(item.parent_id) ?? item.parent_id : void 0;
|
|
@@ -2006,9 +2005,9 @@ async function pushNavigations(client, defId, portalDir, changes, mappings) {
|
|
|
2006
2005
|
source: item.source ?? void 0,
|
|
2007
2006
|
parent_id: resolvedParentId
|
|
2008
2007
|
};
|
|
2009
|
-
if (item.id && serverById.has(item.id)) await
|
|
2008
|
+
if (item.id && serverById.has(item.id)) await fluid_os_v0_update_fluid_osnavigation_item(client, defId, navId, item.id, { navigation_item: body });
|
|
2010
2009
|
else {
|
|
2011
|
-
const created = await
|
|
2010
|
+
const created = await fluid_os_v0_create_fluid_osnavigation_item(client, defId, navId, { navigation_item: {
|
|
2012
2011
|
...body,
|
|
2013
2012
|
label: body.label ?? "",
|
|
2014
2013
|
position: body.position ?? 0
|
|
@@ -2050,7 +2049,7 @@ async function pushNavigations(client, defId, portalDir, changes, mappings) {
|
|
|
2050
2049
|
};
|
|
2051
2050
|
}
|
|
2052
2051
|
try {
|
|
2053
|
-
await
|
|
2052
|
+
await fluid_os_v0_delete_fluid_osnavigation(client, defId, navId);
|
|
2054
2053
|
currentMappings = removeMapping(currentMappings, "navigations", slug);
|
|
2055
2054
|
results.push({
|
|
2056
2055
|
file,
|
|
@@ -2084,8 +2083,7 @@ async function pushProfiles(client, defId, portalDir, changes, mappings) {
|
|
|
2084
2083
|
for (const file of changes.new) {
|
|
2085
2084
|
const slug = slugFromPath(file);
|
|
2086
2085
|
try {
|
|
2087
|
-
const
|
|
2088
|
-
const newId = (await fluidOs.fluid_os_v0_create_fluid_osprofile(client, defId, { profile: body })).profile?.id;
|
|
2086
|
+
const newId = (await fluid_os_v0_create_fluid_osprofile(client, defId, { profile: resolveProfileBody(await readPortalFile(portalDir, file), currentMappings) })).profile?.id;
|
|
2089
2087
|
if (newId != null) currentMappings = updateMapping(currentMappings, "profiles", slug, newId);
|
|
2090
2088
|
results.push({
|
|
2091
2089
|
file,
|
|
@@ -2121,8 +2119,7 @@ async function pushProfiles(client, defId, portalDir, changes, mappings) {
|
|
|
2121
2119
|
};
|
|
2122
2120
|
}
|
|
2123
2121
|
try {
|
|
2124
|
-
|
|
2125
|
-
await fluidOs.fluid_os_v0_update_fluid_osprofile(client, defId, profileId, { profile: body });
|
|
2122
|
+
await fluid_os_v0_update_fluid_osprofile(client, defId, profileId, { profile: resolveProfileBody(await readPortalFile(portalDir, file), currentMappings) });
|
|
2126
2123
|
results.push({
|
|
2127
2124
|
file,
|
|
2128
2125
|
action: "updated",
|
|
@@ -2157,7 +2154,7 @@ async function pushProfiles(client, defId, portalDir, changes, mappings) {
|
|
|
2157
2154
|
};
|
|
2158
2155
|
}
|
|
2159
2156
|
try {
|
|
2160
|
-
await
|
|
2157
|
+
await fluid_os_v0_delete_fluid_osprofile(client, defId, profileId);
|
|
2161
2158
|
currentMappings = removeMapping(currentMappings, "profiles", slug);
|
|
2162
2159
|
results.push({
|
|
2163
2160
|
file,
|
|
@@ -2414,7 +2411,7 @@ async function selectDefinition(client, appName) {
|
|
|
2414
2411
|
const definitions = [];
|
|
2415
2412
|
let page = 1;
|
|
2416
2413
|
while (true) {
|
|
2417
|
-
const response = await
|
|
2414
|
+
const response = await fluid_os_v0_list_fluid_osdefinitions(client, {
|
|
2418
2415
|
page,
|
|
2419
2416
|
per_page: 500
|
|
2420
2417
|
});
|
|
@@ -3881,7 +3878,7 @@ function getWidgetPackageCompleteUploadRoute(owner, version) {
|
|
|
3881
3878
|
async function requestWidgetPackageUploadSession(client, owner, request) {
|
|
3882
3879
|
const payload = buildWidgetPackageUploadSessionPayload(request);
|
|
3883
3880
|
try {
|
|
3884
|
-
return normalizeWidgetPackageUploadSession(owner.kind === "company" ? await
|
|
3881
|
+
return normalizeWidgetPackageUploadSession(owner.kind === "company" ? await fluid_os_v0_create_widget_package_version(client, payload) : await client.post(getWidgetPackageUploadSessionRoute(owner), payload), request.version, request.artifacts);
|
|
3885
3882
|
} catch (err) {
|
|
3886
3883
|
if (err instanceof WidgetPackageUploadError) throw err;
|
|
3887
3884
|
throw new WidgetPackageUploadError("SESSION_REQUEST_FAILED", `Failed to create widget package upload session: ${formatUnknownError(err)}`);
|
|
@@ -3920,7 +3917,7 @@ async function uploadWidgetPackageArtifacts(session, artifacts, fetchImpl = fetc
|
|
|
3920
3917
|
async function completeWidgetPackageUpload(client, owner, version, packageKey, artifacts) {
|
|
3921
3918
|
const payload = buildWidgetPackageCompleteUploadPayload(packageKey, artifacts);
|
|
3922
3919
|
try {
|
|
3923
|
-
return normalizeWidgetPackageCompleteResponse(owner.kind === "company" ? await
|
|
3920
|
+
return normalizeWidgetPackageCompleteResponse(owner.kind === "company" ? await fluid_os_v0_complete_widget_package_version_upload(client, version, payload) : await client.post(getWidgetPackageCompleteUploadRoute(owner, version), payload), version);
|
|
3924
3921
|
} catch (err) {
|
|
3925
3922
|
if (err instanceof WidgetPackageUploadError) throw err;
|
|
3926
3923
|
throw new WidgetPackageUploadError("COMPLETE_UPLOAD_FAILED", `Failed to complete widget package upload: ${formatUnknownError(err)}`);
|
|
@@ -4537,7 +4534,7 @@ const createVersionCommand = new Command("create").description("Create a new ver
|
|
|
4537
4534
|
console.log(chalk.bold("Creating version..."));
|
|
4538
4535
|
let result;
|
|
4539
4536
|
try {
|
|
4540
|
-
result = await
|
|
4537
|
+
result = await fluid_os_v0_create_fluid_osversion(client, definitionId);
|
|
4541
4538
|
} catch (err) {
|
|
4542
4539
|
console.error(chalk.red("Error:") + " Failed to create version — " + (err instanceof Error ? err.message : String(err)));
|
|
4543
4540
|
process.exit(1);
|
|
@@ -4555,7 +4552,7 @@ const createVersionCommand = new Command("create").description("Create a new ver
|
|
|
4555
4552
|
if (options.activate) {
|
|
4556
4553
|
console.log("Activating version...");
|
|
4557
4554
|
try {
|
|
4558
|
-
await
|
|
4555
|
+
await fluid_os_v0_update_fluid_osversion(client, definitionId, version.id, { version: { active: true } });
|
|
4559
4556
|
} catch (err) {
|
|
4560
4557
|
console.error(chalk.red("Error:") + " Failed to activate version — " + (err instanceof Error ? err.message : String(err)));
|
|
4561
4558
|
process.exit(1);
|
|
@@ -4570,7 +4567,7 @@ const listVersionCommand = new Command("list").description("List all versions of
|
|
|
4570
4567
|
const definitionId = await requireDefinitionId();
|
|
4571
4568
|
let result;
|
|
4572
4569
|
try {
|
|
4573
|
-
result = await
|
|
4570
|
+
result = await fluid_os_v0_list_fluid_osversions(client, definitionId);
|
|
4574
4571
|
} catch (err) {
|
|
4575
4572
|
console.error(chalk.red("Error:") + " Failed to list versions — " + (err instanceof Error ? err.message : String(err)));
|
|
4576
4573
|
process.exit(1);
|
|
@@ -4613,7 +4610,7 @@ const activateVersionCommand = new Command("activate").description("Activate a s
|
|
|
4613
4610
|
console.log();
|
|
4614
4611
|
console.log(chalk.bold("Activating version..."));
|
|
4615
4612
|
try {
|
|
4616
|
-
await
|
|
4613
|
+
await fluid_os_v0_update_fluid_osversion(client, definitionId, versionId, { version: { active: true } });
|
|
4617
4614
|
} catch (err) {
|
|
4618
4615
|
console.error(chalk.red("Error:") + " Failed to activate version — " + (err instanceof Error ? err.message : String(err)));
|
|
4619
4616
|
process.exit(1);
|