@softr/cli 0.1.2-se21873.13 → 0.1.2
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.mjs +25 -27
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -14471,6 +14471,9 @@ function authorizeUrl(target, redirectUri, state, challenge) {
|
|
|
14471
14471
|
}).toString();
|
|
14472
14472
|
return url.toString();
|
|
14473
14473
|
}
|
|
14474
|
+
function refreshFailureHint(status) {
|
|
14475
|
+
return status === 401 ? "The OAuth grant is gone (revoked or older than 30 days). Run: softr login" : "The studio could not renew the login right now; try again in a moment.";
|
|
14476
|
+
}
|
|
14474
14477
|
async function tokenRequest(target, form) {
|
|
14475
14478
|
const path13 = "/v1/oauth/token";
|
|
14476
14479
|
const response = await fetch(`${target.studioApiUrl}${path13}`, {
|
|
@@ -14484,7 +14487,7 @@ async function tokenRequest(target, form) {
|
|
|
14484
14487
|
`POST ${path13} failed with status ${response.status}${text ? `: ${text}` : ""}`,
|
|
14485
14488
|
response.status,
|
|
14486
14489
|
text,
|
|
14487
|
-
form["grant_type"] === "refresh_token" ?
|
|
14490
|
+
form["grant_type"] === "refresh_token" ? refreshFailureHint(response.status) : void 0
|
|
14488
14491
|
);
|
|
14489
14492
|
}
|
|
14490
14493
|
const tokens = await response.json();
|
|
@@ -14768,7 +14771,8 @@ var TITLE_WIDTH = 34;
|
|
|
14768
14771
|
function workflowTable(rows) {
|
|
14769
14772
|
const table = new import_cli_table3.default({
|
|
14770
14773
|
head: ["ID", "Title", "Triggers", "Status", "Version", "Draft"],
|
|
14771
|
-
|
|
14774
|
+
// Only the free-text title wraps; the other columns size to their content, so trigger types are never cut off.
|
|
14775
|
+
colWidths: [null, TITLE_WIDTH, null, null, null, null],
|
|
14772
14776
|
wordWrap: true,
|
|
14773
14777
|
style: { head: [], border: [], "padding-left": 1, "padding-right": 1 }
|
|
14774
14778
|
});
|
|
@@ -14776,7 +14780,7 @@ function workflowTable(rows) {
|
|
|
14776
14780
|
table.push([
|
|
14777
14781
|
row.id,
|
|
14778
14782
|
row.title,
|
|
14779
|
-
row.triggers.map((trigger) => trigger.type).join("\n"),
|
|
14783
|
+
row.triggers.map((trigger) => trigger.type).join("\n") || "-",
|
|
14780
14784
|
row.live === null ? "not enabled" : `live v${row.live}`,
|
|
14781
14785
|
row.version,
|
|
14782
14786
|
row.draft
|
|
@@ -16085,6 +16089,18 @@ type: ${type}${example3} (${status})`, {
|
|
|
16085
16089
|
import { stdin as stdin2, stdout } from "node:process";
|
|
16086
16090
|
import { createInterface as createInterface2 } from "node:readline/promises";
|
|
16087
16091
|
|
|
16092
|
+
// src/project/open-workflow.ts
|
|
16093
|
+
async function openWorkflow(dir, missingIdHint = "Pull an existing workflow or create one with init first.") {
|
|
16094
|
+
const config = await readConfig(dir);
|
|
16095
|
+
if (!config.id) {
|
|
16096
|
+
throw new CliError('softr-workflows.jsonc has no "id".', missingIdHint);
|
|
16097
|
+
}
|
|
16098
|
+
const state = await readState(dir);
|
|
16099
|
+
const target = resolveTarget(state);
|
|
16100
|
+
const client = await authenticatedClient(target);
|
|
16101
|
+
return { config, id: config.id, state, target, client };
|
|
16102
|
+
}
|
|
16103
|
+
|
|
16088
16104
|
// src/project/readiness.ts
|
|
16089
16105
|
var REASONS = {
|
|
16090
16106
|
REFERENCED_NODE_UNKNOWN: "no node with that id",
|
|
@@ -16142,19 +16158,6 @@ async function assess(client, workflowId) {
|
|
|
16142
16158
|
}
|
|
16143
16159
|
|
|
16144
16160
|
// src/commands/publish.ts
|
|
16145
|
-
async function openWorkflow(dir) {
|
|
16146
|
-
const config = await readConfig(dir);
|
|
16147
|
-
if (!config.id) {
|
|
16148
|
-
throw new CliError(
|
|
16149
|
-
'softr-workflows.jsonc has no "id".',
|
|
16150
|
-
"Pull an existing workflow or create one with init first."
|
|
16151
|
-
);
|
|
16152
|
-
}
|
|
16153
|
-
const state = await readState(dir);
|
|
16154
|
-
const target = resolveTarget(state);
|
|
16155
|
-
const client = await authenticatedClient(target);
|
|
16156
|
-
return { config, id: config.id, state, target, client };
|
|
16157
|
-
}
|
|
16158
16161
|
function issuesOf(assessment, config) {
|
|
16159
16162
|
return [
|
|
16160
16163
|
...assessment.testIssues,
|
|
@@ -16284,16 +16287,11 @@ async function pinTarget(opts) {
|
|
|
16284
16287
|
if (opts.id) {
|
|
16285
16288
|
return { applicationId, workflowId: opts.id, client: await authenticatedClient(resolveTarget()) };
|
|
16286
16289
|
}
|
|
16287
|
-
const
|
|
16288
|
-
|
|
16289
|
-
|
|
16290
|
-
|
|
16291
|
-
|
|
16292
|
-
"Pass --id <workflowId>, or pull or init the workflow first."
|
|
16293
|
-
);
|
|
16294
|
-
}
|
|
16295
|
-
const target = resolveTarget(await readState(dir));
|
|
16296
|
-
return { applicationId, workflowId: config.id, client: await authenticatedClient(target) };
|
|
16290
|
+
const { id, client } = await openWorkflow(
|
|
16291
|
+
await findWorkflowDir(process.cwd(), opts.dir),
|
|
16292
|
+
"Pass --id <workflowId>, or pull or init the workflow first."
|
|
16293
|
+
);
|
|
16294
|
+
return { applicationId, workflowId: id, client };
|
|
16297
16295
|
}
|
|
16298
16296
|
function withPinOptions(command) {
|
|
16299
16297
|
return command.option("--app <applicationId>", "the application (default: $SOFTR_PINNED_APP_ID)").option("--id <workflowId>", "the workflow (default: the one in the workflow directory)").option("--dir <path>", "workflow directory (default: the current directory)");
|
|
@@ -16768,7 +16766,7 @@ Pass --workspace <id> to a command, or set SOFTR_WORKSPACE_ID, to work in one of
|
|
|
16768
16766
|
// package.json
|
|
16769
16767
|
var package_default = {
|
|
16770
16768
|
name: "@softr/cli",
|
|
16771
|
-
version: "0.1.2
|
|
16769
|
+
version: "0.1.2",
|
|
16772
16770
|
description: "The Softr command line: build, test and publish Softr workflows from local files; more Softr APIs to come",
|
|
16773
16771
|
keywords: [
|
|
16774
16772
|
"softr",
|