@base44-preview/cli 0.1.4-pr.567.1d0df8b → 0.1.4-pr.567.6b2480e
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/cli/index.js +46 -13
- package/dist/cli/index.js.map +7 -6
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -251572,6 +251572,10 @@ async function listWorkspaces() {
|
|
|
251572
251572
|
isPersonal: index === 0
|
|
251573
251573
|
}));
|
|
251574
251574
|
}
|
|
251575
|
+
async function getWorkspace(id) {
|
|
251576
|
+
const workspaces = await listWorkspaces();
|
|
251577
|
+
return workspaces.find((w) => w.id === id);
|
|
251578
|
+
}
|
|
251575
251579
|
async function moveAppToWorkspace(appId, targetWorkspaceId, options = {}) {
|
|
251576
251580
|
let response;
|
|
251577
251581
|
try {
|
|
@@ -254781,16 +254785,47 @@ function workspaceTag(workspace2) {
|
|
|
254781
254785
|
return workspace2.isPersonal ? `personal, ${role}` : role;
|
|
254782
254786
|
}
|
|
254783
254787
|
|
|
254788
|
+
// src/cli/commands/workspace/get.ts
|
|
254789
|
+
async function getWorkspaceAction({ runTask: runTask2, log, jsonMode }, workspaceId) {
|
|
254790
|
+
const workspace2 = await runTask2("Fetching workspace...", () => getWorkspace(workspaceId), { errorMessage: "Failed to fetch workspace" });
|
|
254791
|
+
if (!workspace2) {
|
|
254792
|
+
throw new InvalidInputError(`Workspace "${workspaceId}" not found, or you are not a member of it.`, {
|
|
254793
|
+
hints: [
|
|
254794
|
+
{ message: "Run 'base44 workspace list' to see your workspaces" }
|
|
254795
|
+
]
|
|
254796
|
+
});
|
|
254797
|
+
}
|
|
254798
|
+
if (jsonMode) {
|
|
254799
|
+
return {
|
|
254800
|
+
outroMessage: workspace2.name,
|
|
254801
|
+
stdout: toJsonStdout2(workspace2)
|
|
254802
|
+
};
|
|
254803
|
+
}
|
|
254804
|
+
log.message(` ${theme.styles.bold(workspace2.name)} ${theme.styles.dim(`[${workspaceTag(workspace2)}]`)}
|
|
254805
|
+
${theme.styles.dim(workspace2.id)}${workspace2.subscriptionTier ? theme.styles.dim(`
|
|
254806
|
+
tier: ${workspace2.subscriptionTier}`) : ""}`);
|
|
254807
|
+
return { outroMessage: workspace2.name };
|
|
254808
|
+
}
|
|
254809
|
+
function getWorkspaceGetCommand() {
|
|
254810
|
+
return new Base44Command("get", { requireAppContext: false }).description("Show details for a single workspace by ID").argument("<workspace-id>", "Workspace (organization) ID").action(getWorkspaceAction);
|
|
254811
|
+
}
|
|
254812
|
+
|
|
254784
254813
|
// src/cli/commands/workspace/list.ts
|
|
254785
|
-
|
|
254786
|
-
|
|
254787
|
-
|
|
254788
|
-
|
|
254789
|
-
|
|
254790
|
-
|
|
254814
|
+
function pluralize2(n5) {
|
|
254815
|
+
return `${n5} workspace${n5 !== 1 ? "s" : ""}`;
|
|
254816
|
+
}
|
|
254817
|
+
async function listWorkspacesAction({ log, runTask: runTask2, jsonMode }, options8) {
|
|
254818
|
+
let workspaces = await runTask2("Fetching workspaces...", () => listWorkspaces(), { errorMessage: "Failed to fetch workspaces" });
|
|
254819
|
+
if (options8.canCreate) {
|
|
254820
|
+
workspaces = workspaces.filter((w8) => canCreateAppsInWorkspace(w8.userRole));
|
|
254821
|
+
}
|
|
254822
|
+
if (options8.role) {
|
|
254823
|
+
const role = options8.role.toLowerCase();
|
|
254824
|
+
workspaces = workspaces.filter((w8) => w8.userRole?.toLowerCase() === role);
|
|
254825
|
+
}
|
|
254791
254826
|
if (jsonMode) {
|
|
254792
254827
|
return {
|
|
254793
|
-
outroMessage:
|
|
254828
|
+
outroMessage: pluralize2(workspaces.length),
|
|
254794
254829
|
stdout: toJsonStdout2(workspaces)
|
|
254795
254830
|
};
|
|
254796
254831
|
}
|
|
@@ -254798,12 +254833,10 @@ async function listWorkspacesAction({
|
|
|
254798
254833
|
log.message(` ${theme.styles.bold(workspace2.name)} ${theme.styles.dim(`[${workspaceTag(workspace2)}]`)}
|
|
254799
254834
|
${theme.styles.dim(workspace2.id)}`);
|
|
254800
254835
|
}
|
|
254801
|
-
return {
|
|
254802
|
-
outroMessage: `${workspaces.length} workspace${workspaces.length !== 1 ? "s" : ""}`
|
|
254803
|
-
};
|
|
254836
|
+
return { outroMessage: pluralize2(workspaces.length) };
|
|
254804
254837
|
}
|
|
254805
254838
|
function getWorkspaceListCommand() {
|
|
254806
|
-
return new Base44Command("list", { requireAppContext: false }).description("List the workspaces you belong to").action(listWorkspacesAction);
|
|
254839
|
+
return new Base44Command("list", { requireAppContext: false }).description("List the workspaces you belong to").option("--can-create", "Only workspaces you can create or move apps into (owner/admin/editor)").option("--role <role>", "Only workspaces where your role matches (owner, admin, editor, viewer)").action(listWorkspacesAction);
|
|
254807
254840
|
}
|
|
254808
254841
|
|
|
254809
254842
|
// src/cli/commands/workspace/move.ts
|
|
@@ -254899,7 +254932,7 @@ Examples:
|
|
|
254899
254932
|
|
|
254900
254933
|
// src/cli/commands/workspace/index.ts
|
|
254901
254934
|
function getWorkspaceCommand() {
|
|
254902
|
-
return new Command("workspace").description("List workspaces and move apps between them").addCommand(getWorkspaceListCommand()).addCommand(getWorkspaceMoveCommand());
|
|
254935
|
+
return new Command("workspace").description("List workspaces, inspect one, and move apps between them").addCommand(getWorkspaceListCommand()).addCommand(getWorkspaceGetCommand()).addCommand(getWorkspaceMoveCommand());
|
|
254903
254936
|
}
|
|
254904
254937
|
|
|
254905
254938
|
// src/cli/dev/dev-server/main.ts
|
|
@@ -262932,4 +262965,4 @@ export {
|
|
|
262932
262965
|
CLIExitError
|
|
262933
262966
|
};
|
|
262934
262967
|
|
|
262935
|
-
//# debugId=
|
|
262968
|
+
//# debugId=B9D4F09248278B0364756E2164756E21
|