@tailor-platform/sdk 1.45.1 → 1.45.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/CHANGELOG.md +16 -0
- package/dist/cli/index.mjs +1 -1
- package/dist/cli/lib.mjs +1 -1
- package/dist/{runtime-D5AJYWnF.mjs → runtime-D97Ydu2S.mjs} +195 -35
- package/dist/runtime-D97Ydu2S.mjs.map +1 -0
- package/docs/generator/builtin.md +36 -0
- package/package.json +9 -10
- package/dist/runtime-D5AJYWnF.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @tailor-platform/sdk
|
|
2
2
|
|
|
3
|
+
## 1.45.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1108](https://github.com/tailor-platform/sdk/pull/1108) [`430cba0`](https://github.com/tailor-platform/sdk/commit/430cba050400af0ef673035791fe4132b5323b90) Thanks [@toiroakr](https://github.com/toiroakr)! - Document how to use the re-exported Kysely `sql` tag from `@tailor-platform/sdk/kysely` to write raw SQL queries against the Kysely instance returned by `getDB()`. This was already supported; only documentation is added.
|
|
8
|
+
|
|
9
|
+
- [#1133](https://github.com/tailor-platform/sdk/pull/1133) [`3457fe7`](https://github.com/tailor-platform/sdk/commit/3457fe77efa90b5443b51c0cbb2fb6d1942b346f) Thanks [@toiroakr](https://github.com/toiroakr)! - Fix `workflow executions --wait`, `workflow start --wait`, and `executor jobs --wait` not responding to Ctrl+C in some terminals.
|
|
10
|
+
|
|
11
|
+
- [#1124](https://github.com/tailor-platform/sdk/pull/1124) [`82152a9`](https://github.com/tailor-platform/sdk/commit/82152a96753c8719472387e6d79f8454211074c7) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency es-toolkit to v1.46.1
|
|
12
|
+
|
|
13
|
+
- [#1125](https://github.com/tailor-platform/sdk/pull/1125) [`15a0023`](https://github.com/tailor-platform/sdk/commit/15a0023018ca67d53220e82281d51d633b16b0d5) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency kysely to v0.28.17
|
|
14
|
+
|
|
15
|
+
- [#1127](https://github.com/tailor-platform/sdk/pull/1127) [`79050d4`](https://github.com/tailor-platform/sdk/commit/79050d4606dc695522f2eaa65a0079b20c3d51c8) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency pkg-types to v2.3.1
|
|
16
|
+
|
|
17
|
+
- [#1128](https://github.com/tailor-platform/sdk/pull/1128) [`5596283`](https://github.com/tailor-platform/sdk/commit/5596283bd09cddee10488606122ddebe57c58a75) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency rolldown to v1.0.0-rc.18
|
|
18
|
+
|
|
3
19
|
## 1.45.1
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/cli/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { G as PATScope, R as AuthInvokerSchema, c as fetchUserInfo, d as initOperatorClient, h as userAgent, i as fetchAll, j as FunctionExecution_Type, n as closeConnectionPool, o as fetchPaged, s as fetchPlatformMachineUserToken, u as initOAuth2Client } from "../client-BwXkoiMq.mjs";
|
|
4
4
|
import { n as logger, r as styles } from "../logger-DTNAMYGy.mjs";
|
|
5
|
-
import { $ as deleteCommand$3, At as executionsCommand, C as listCommand$13, Cn as toPageDirection, Ct as jobsCommand, E as resumeCommand, Et as startCommand, F as showCommand, Ft as getCommand$1, G as getCommand$5, H as treeCommand, I as logBetaWarning, Lt as apply, N as generateCommand$1, Nt as functionExecutionStatusToString, O as listCommand$12, Ot as getCommand$6, Pt as formatKeyValueTable, R as removeCommand$1, Rt as executeScript, Sn as paginationArgs, T as healthCommand, U as listCommand$11, Vt as parseMigrationLabelNumber, Y as listCommand$10, Z as getCommand$4, Zt as formatMigrationNumber, _n as commonArgs, _t as webhookCommand, at as getCommand$3, b as createCommand$4, bn as isVerbose, bt as listCommand$6, c as listCommand$14, ct as tokenCommand, dn as sdkNameLabelKey, dt as generate, en as getMigrationFilePath, f as restoreCommand, fn as trnPrefix, ft as listCommand$7, g as getCommand$7, gn as defineAppCommand, i as updateCommand$4, in as loadDiff, j as truncateCommand, ln as getNamespacesWithMigrations, lt as listCommand$8, m as listCommand$15, mn as apiCommand, mt as getCommand$2, o as removeCommand, q as updateCommand$2, r as queryCommand, rn as isValidMigrationNumber, rt as listCommand$9, t as isNativeTypeScriptRuntime, tn as getMigrationFiles, tt as createCommand$3, u as inviteCommand, un as prompt, v as deleteCommand$4, vn as confirmationArgs, vt as triggerCommand, wn as workspaceArgs, xn as pagedLogArgs, yn as deploymentArgs, z as updateCommand$3 } from "../runtime-
|
|
5
|
+
import { $ as deleteCommand$3, At as executionsCommand, C as listCommand$13, Cn as toPageDirection, Ct as jobsCommand, E as resumeCommand, Et as startCommand, F as showCommand, Ft as getCommand$1, G as getCommand$5, H as treeCommand, I as logBetaWarning, Lt as apply, N as generateCommand$1, Nt as functionExecutionStatusToString, O as listCommand$12, Ot as getCommand$6, Pt as formatKeyValueTable, R as removeCommand$1, Rt as executeScript, Sn as paginationArgs, T as healthCommand, U as listCommand$11, Vt as parseMigrationLabelNumber, Y as listCommand$10, Z as getCommand$4, Zt as formatMigrationNumber, _n as commonArgs, _t as webhookCommand, at as getCommand$3, b as createCommand$4, bn as isVerbose, bt as listCommand$6, c as listCommand$14, ct as tokenCommand, dn as sdkNameLabelKey, dt as generate, en as getMigrationFilePath, f as restoreCommand, fn as trnPrefix, ft as listCommand$7, g as getCommand$7, gn as defineAppCommand, i as updateCommand$4, in as loadDiff, j as truncateCommand, ln as getNamespacesWithMigrations, lt as listCommand$8, m as listCommand$15, mn as apiCommand, mt as getCommand$2, o as removeCommand, q as updateCommand$2, r as queryCommand, rn as isValidMigrationNumber, rt as listCommand$9, t as isNativeTypeScriptRuntime, tn as getMigrationFiles, tt as createCommand$3, u as inviteCommand, un as prompt, v as deleteCommand$4, vn as confirmationArgs, vt as triggerCommand, wn as workspaceArgs, xn as pagedLogArgs, yn as deploymentArgs, z as updateCommand$3 } from "../runtime-D97Ydu2S.mjs";
|
|
6
6
|
import { C as loadWorkspaceId, D as writePlatformConfig, E as saveUserTokens, S as loadAccessToken, T as resolveTokens, _ as getDistDir, a as WorkflowJobSchema, b as deleteUserTokens, c as ExecutorSchema, i as resolveInlineSourcemap, l as INVOKER_EXPR, o as ResolverSchema, w as readPlatformConfig, x as fetchLatestToken, y as loadConfig } from "../application-B4zVVNRS.mjs";
|
|
7
7
|
import { t as multiline } from "../multiline-e3IpANmS.mjs";
|
|
8
8
|
import { t as readPackageJson } from "../package-json-6Px8bDpG.mjs";
|
package/dist/cli/lib.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import { d as initOperatorClient } from "../client-BwXkoiMq.mjs";
|
|
3
|
-
import { $t as getMigrationDirPath, A as truncate, B as updateOrganization, Bt as MIGRATION_LABEL_KEY, D as resumeWorkflow, Dt as startWorkflow, Gt as INITIAL_SCHEMA_NUMBER, Ht as bundleMigrationScript, It as getExecutor, J as updateFolder, Jt as compareLocalTypesWithSnapshot, K as getOrganization, Kt as MIGRATE_FILE_NAME, L as remove, Lt as apply, M as generate$1, Mt as listWorkflowExecutions, P as show, Q as getFolder, Qt as getLatestMigrationNumber, Rt as executeScript, S as listApps, St as getExecutorJob, Tt as watchExecutorJob, Ut as DB_TYPES_FILE_NAME, V as organizationTree, W as listOrganizations, Wt as DIFF_FILE_NAME, X as listFolders, Xt as createSnapshotFromLocalTypes, Yt as compareSnapshots, _ as getWorkspace, a as updateUser, an as reconstructSnapshotFromMigrations, cn as hasChanges, d as inviteUser, dt as generate, en as getMigrationFilePath, et as deleteFolder, gt as listWebhookExecutors, h as listWorkspaces, hn as apiCall, ht as getFunctionRegistry, it as listOAuth2Clients, jt as getWorkflowExecution, k as listWorkflows, kt as getWorkflow, l as listUsers, ln as getNamespacesWithMigrations, n as query, nn as getNextMigrationNumber, nt as createFolder, on as formatDiffSummary, ot as getOAuth2Client, p as restoreWorkspace, pn as generateUserTypes, pt as listFunctionRegistries, qt as SCHEMA_FILE_NAME, s as removeUser, sn as formatMigrationDiff, st as getMachineUserToken, t as isNativeTypeScriptRuntime, tn as getMigrationFiles, ut as listMachineUsers, w as getAppHealth, wt as listExecutorJobs, x as createWorkspace, xt as listExecutors, y as deleteWorkspace, yt as triggerExecutor, zt as waitForExecution } from "../runtime-
|
|
3
|
+
import { $t as getMigrationDirPath, A as truncate, B as updateOrganization, Bt as MIGRATION_LABEL_KEY, D as resumeWorkflow, Dt as startWorkflow, Gt as INITIAL_SCHEMA_NUMBER, Ht as bundleMigrationScript, It as getExecutor, J as updateFolder, Jt as compareLocalTypesWithSnapshot, K as getOrganization, Kt as MIGRATE_FILE_NAME, L as remove, Lt as apply, M as generate$1, Mt as listWorkflowExecutions, P as show, Q as getFolder, Qt as getLatestMigrationNumber, Rt as executeScript, S as listApps, St as getExecutorJob, Tt as watchExecutorJob, Ut as DB_TYPES_FILE_NAME, V as organizationTree, W as listOrganizations, Wt as DIFF_FILE_NAME, X as listFolders, Xt as createSnapshotFromLocalTypes, Yt as compareSnapshots, _ as getWorkspace, a as updateUser, an as reconstructSnapshotFromMigrations, cn as hasChanges, d as inviteUser, dt as generate, en as getMigrationFilePath, et as deleteFolder, gt as listWebhookExecutors, h as listWorkspaces, hn as apiCall, ht as getFunctionRegistry, it as listOAuth2Clients, jt as getWorkflowExecution, k as listWorkflows, kt as getWorkflow, l as listUsers, ln as getNamespacesWithMigrations, n as query, nn as getNextMigrationNumber, nt as createFolder, on as formatDiffSummary, ot as getOAuth2Client, p as restoreWorkspace, pn as generateUserTypes, pt as listFunctionRegistries, qt as SCHEMA_FILE_NAME, s as removeUser, sn as formatMigrationDiff, st as getMachineUserToken, t as isNativeTypeScriptRuntime, tn as getMigrationFiles, ut as listMachineUsers, w as getAppHealth, wt as listExecutorJobs, x as createWorkspace, xt as listExecutors, y as deleteWorkspace, yt as triggerExecutor, zt as waitForExecution } from "../runtime-D97Ydu2S.mjs";
|
|
4
4
|
import { C as loadWorkspaceId, S as loadAccessToken, _ as getDistDir, y as loadConfig } from "../application-B4zVVNRS.mjs";
|
|
5
5
|
import { n as enumConstantsPlugin } from "../enum-constants-C3KSpsYj.mjs";
|
|
6
6
|
import { t as multiline } from "../multiline-e3IpANmS.mjs";
|
|
@@ -32,7 +32,6 @@ import * as inflection from "inflection";
|
|
|
32
32
|
import { ExitPromptError } from "@inquirer/core";
|
|
33
33
|
import { confirm, input, password } from "@inquirer/prompts";
|
|
34
34
|
import { isCI } from "std-env";
|
|
35
|
-
import ora from "ora";
|
|
36
35
|
import { setTimeout as setTimeout$1 } from "timers/promises";
|
|
37
36
|
import { spawn } from "node:child_process";
|
|
38
37
|
import { watch } from "chokidar";
|
|
@@ -6762,6 +6761,170 @@ async function executeScript(options) {
|
|
|
6762
6761
|
};
|
|
6763
6762
|
}
|
|
6764
6763
|
|
|
6764
|
+
//#endregion
|
|
6765
|
+
//#region src/cli/shared/spinner.ts
|
|
6766
|
+
const FRAMES = [
|
|
6767
|
+
"⠋",
|
|
6768
|
+
"⠙",
|
|
6769
|
+
"⠹",
|
|
6770
|
+
"⠸",
|
|
6771
|
+
"⠼",
|
|
6772
|
+
"⠴",
|
|
6773
|
+
"⠦",
|
|
6774
|
+
"⠧",
|
|
6775
|
+
"⠇",
|
|
6776
|
+
"⠏"
|
|
6777
|
+
];
|
|
6778
|
+
const FRAME_INTERVAL_MS = 80;
|
|
6779
|
+
const CURSOR_HIDE = "\x1B[?25l";
|
|
6780
|
+
const CURSOR_SHOW = "\x1B[?25h";
|
|
6781
|
+
const CLEAR_LINE = "\x1B[2K";
|
|
6782
|
+
const CURSOR_TO_START = "\r";
|
|
6783
|
+
const CURSOR_UP = "\x1B[1A";
|
|
6784
|
+
const SYNC_BEGIN = "\x1B[?2026h";
|
|
6785
|
+
const SYNC_END = "\x1B[?2026l";
|
|
6786
|
+
const ANSI_RE = /\u001B\[[0-9;]*[a-zA-Z]/g;
|
|
6787
|
+
function visibleLength(s) {
|
|
6788
|
+
return s.replace(ANSI_RE, "").length;
|
|
6789
|
+
}
|
|
6790
|
+
const activeSpinners = /* @__PURE__ */ new Set();
|
|
6791
|
+
let exitHookInstalled = false;
|
|
6792
|
+
let signalHookInstalled = false;
|
|
6793
|
+
function installExitHook() {
|
|
6794
|
+
if (exitHookInstalled) return;
|
|
6795
|
+
exitHookInstalled = true;
|
|
6796
|
+
process.on("exit", () => {
|
|
6797
|
+
for (const s of activeSpinners) s.cleanupOnExit();
|
|
6798
|
+
});
|
|
6799
|
+
}
|
|
6800
|
+
function installSignalHook() {
|
|
6801
|
+
if (signalHookInstalled) return;
|
|
6802
|
+
signalHookInstalled = true;
|
|
6803
|
+
const handler = () => {
|
|
6804
|
+
for (const s of [...activeSpinners]) s.stop();
|
|
6805
|
+
};
|
|
6806
|
+
process.prependListener("SIGINT", handler);
|
|
6807
|
+
process.prependListener("SIGTERM", handler);
|
|
6808
|
+
}
|
|
6809
|
+
var Spinner = class {
|
|
6810
|
+
text;
|
|
6811
|
+
#indent;
|
|
6812
|
+
#stream;
|
|
6813
|
+
#isEnabled;
|
|
6814
|
+
#frame = 0;
|
|
6815
|
+
#timer;
|
|
6816
|
+
#linesDrawn = 0;
|
|
6817
|
+
#started = false;
|
|
6818
|
+
constructor(options = {}) {
|
|
6819
|
+
this.text = "";
|
|
6820
|
+
this.#indent = options.indent ?? 0;
|
|
6821
|
+
this.#stream = options.stream ?? process.stderr;
|
|
6822
|
+
this.#isEnabled = Boolean(this.#stream.isTTY);
|
|
6823
|
+
}
|
|
6824
|
+
start(text) {
|
|
6825
|
+
if (text !== void 0) this.text = text;
|
|
6826
|
+
if (!this.#isEnabled) {
|
|
6827
|
+
this.#writeLine(`- ${this.text}`);
|
|
6828
|
+
return this;
|
|
6829
|
+
}
|
|
6830
|
+
if (this.#started) return this;
|
|
6831
|
+
installExitHook();
|
|
6832
|
+
installSignalHook();
|
|
6833
|
+
activeSpinners.add(this);
|
|
6834
|
+
this.#started = true;
|
|
6835
|
+
this.#stream.write(CURSOR_HIDE);
|
|
6836
|
+
this.#renderFrame();
|
|
6837
|
+
this.#timer = setInterval(() => this.#renderFrame(), FRAME_INTERVAL_MS);
|
|
6838
|
+
if (typeof this.#timer.unref === "function") this.#timer.unref();
|
|
6839
|
+
return this;
|
|
6840
|
+
}
|
|
6841
|
+
stop() {
|
|
6842
|
+
if (!this.#started) return this;
|
|
6843
|
+
this.#started = false;
|
|
6844
|
+
if (this.#timer) {
|
|
6845
|
+
clearInterval(this.#timer);
|
|
6846
|
+
this.#timer = void 0;
|
|
6847
|
+
}
|
|
6848
|
+
if (this.#isEnabled) {
|
|
6849
|
+
this.#clearDrawn();
|
|
6850
|
+
this.#stream.write(CURSOR_SHOW);
|
|
6851
|
+
}
|
|
6852
|
+
activeSpinners.delete(this);
|
|
6853
|
+
return this;
|
|
6854
|
+
}
|
|
6855
|
+
succeed(text) {
|
|
6856
|
+
return this.#stopAndPersist(symbols.success, text);
|
|
6857
|
+
}
|
|
6858
|
+
fail(text) {
|
|
6859
|
+
return this.#stopAndPersist(symbols.error, text);
|
|
6860
|
+
}
|
|
6861
|
+
warn(text) {
|
|
6862
|
+
return this.#stopAndPersist(symbols.warning, text);
|
|
6863
|
+
}
|
|
6864
|
+
/**
|
|
6865
|
+
* Called by the global exit hook to restore the cursor.
|
|
6866
|
+
* @internal
|
|
6867
|
+
*/
|
|
6868
|
+
cleanupOnExit() {
|
|
6869
|
+
if (this.#timer) {
|
|
6870
|
+
clearInterval(this.#timer);
|
|
6871
|
+
this.#timer = void 0;
|
|
6872
|
+
}
|
|
6873
|
+
if (this.#isEnabled) this.#stream.write(CURSOR_SHOW);
|
|
6874
|
+
}
|
|
6875
|
+
#stopAndPersist(symbol, text) {
|
|
6876
|
+
if (text !== void 0) this.text = text;
|
|
6877
|
+
if (this.#started) {
|
|
6878
|
+
this.#started = false;
|
|
6879
|
+
if (this.#timer) {
|
|
6880
|
+
clearInterval(this.#timer);
|
|
6881
|
+
this.#timer = void 0;
|
|
6882
|
+
}
|
|
6883
|
+
if (this.#isEnabled) {
|
|
6884
|
+
this.#clearDrawn();
|
|
6885
|
+
this.#stream.write(CURSOR_SHOW);
|
|
6886
|
+
}
|
|
6887
|
+
activeSpinners.delete(this);
|
|
6888
|
+
}
|
|
6889
|
+
this.#writeLine(`${symbol} ${this.text}`);
|
|
6890
|
+
return this;
|
|
6891
|
+
}
|
|
6892
|
+
#renderFrame() {
|
|
6893
|
+
this.#stream.write(SYNC_BEGIN);
|
|
6894
|
+
this.#clearDrawn();
|
|
6895
|
+
const frame = styles.info(FRAMES[this.#frame] ?? FRAMES[0]);
|
|
6896
|
+
this.#frame = (this.#frame + 1) % FRAMES.length;
|
|
6897
|
+
const line = `${" ".repeat(this.#indent)}${frame} ${this.text}`;
|
|
6898
|
+
this.#stream.write(line);
|
|
6899
|
+
this.#stream.write(SYNC_END);
|
|
6900
|
+
const cols = this.#stream.columns || 80;
|
|
6901
|
+
this.#linesDrawn = Math.max(1, Math.ceil(visibleLength(line) / cols));
|
|
6902
|
+
}
|
|
6903
|
+
#clearDrawn() {
|
|
6904
|
+
if (this.#linesDrawn === 0) return;
|
|
6905
|
+
this.#stream.write(CURSOR_TO_START);
|
|
6906
|
+
this.#stream.write(CLEAR_LINE);
|
|
6907
|
+
for (let i = 1; i < this.#linesDrawn; i++) {
|
|
6908
|
+
this.#stream.write(CURSOR_UP);
|
|
6909
|
+
this.#stream.write(CLEAR_LINE);
|
|
6910
|
+
}
|
|
6911
|
+
this.#linesDrawn = 0;
|
|
6912
|
+
}
|
|
6913
|
+
#writeLine(content) {
|
|
6914
|
+
const indent = " ".repeat(this.#indent);
|
|
6915
|
+
this.#stream.write(`${indent}${content}\n`);
|
|
6916
|
+
}
|
|
6917
|
+
};
|
|
6918
|
+
/**
|
|
6919
|
+
* Create a terminal spinner. Falls back to a single line write in non-TTY
|
|
6920
|
+
* environments so output stays useful in CI logs.
|
|
6921
|
+
* @param options - Spinner options
|
|
6922
|
+
* @returns A Spinner instance
|
|
6923
|
+
*/
|
|
6924
|
+
function spinner(options) {
|
|
6925
|
+
return new Spinner(options);
|
|
6926
|
+
}
|
|
6927
|
+
|
|
6765
6928
|
//#endregion
|
|
6766
6929
|
//#region src/cli/commands/apply/tailordb/migration.ts
|
|
6767
6930
|
/**
|
|
@@ -6895,16 +7058,13 @@ async function executeMigrations(context, migrations) {
|
|
|
6895
7058
|
logger.info(`Using machine user: ${styles.bold(machineUserName)} for namespace '${namespace}'`);
|
|
6896
7059
|
for (const migration of namespaceMigrations) {
|
|
6897
7060
|
const migrationLabel = `${migration.namespace}/${formatMigrationNumber(migration.number)}`;
|
|
6898
|
-
const
|
|
6899
|
-
text: `Executing migration ${migrationLabel}...`,
|
|
6900
|
-
prefixText: ""
|
|
6901
|
-
}).start();
|
|
7061
|
+
const sp = spinner().start(`Executing migration ${migrationLabel}...`);
|
|
6902
7062
|
const result = await executeSingleMigration(options, migration);
|
|
6903
7063
|
if (result.success) {
|
|
6904
|
-
|
|
7064
|
+
sp.succeed(`Migration ${migrationLabel} completed successfully`);
|
|
6905
7065
|
if (result.logs && result.logs.trim()) logger.log(`Logs:\n${result.logs}`);
|
|
6906
7066
|
} else {
|
|
6907
|
-
|
|
7067
|
+
sp.fail(`Migration ${migrationLabel} failed`);
|
|
6908
7068
|
if (result.logs) logger.error(`Logs:\n${result.logs}`);
|
|
6909
7069
|
throw new Error(result.error ?? "Migration failed");
|
|
6910
7070
|
}
|
|
@@ -9531,19 +9691,19 @@ async function getWorkflowExecution(options) {
|
|
|
9531
9691
|
};
|
|
9532
9692
|
}
|
|
9533
9693
|
async function waitWithSpinner(waitFn, interval, json) {
|
|
9534
|
-
const
|
|
9694
|
+
const sp = !json ? spinner().start("Waiting for workflow to complete...") : null;
|
|
9535
9695
|
const updateInterval = setInterval(() => {
|
|
9536
|
-
if (
|
|
9696
|
+
if (sp) sp.text = `Waiting for workflow to complete... (${formatTime$2(/* @__PURE__ */ new Date())})`;
|
|
9537
9697
|
}, interval);
|
|
9538
9698
|
try {
|
|
9539
9699
|
const result = await waitFn();
|
|
9540
9700
|
const coloredStatus = colorizeStatus$1(WorkflowExecution_Status[result.status]);
|
|
9541
|
-
if (result.status === "SUCCESS")
|
|
9542
|
-
else
|
|
9701
|
+
if (result.status === "SUCCESS") sp?.succeed(`Completed: ${coloredStatus}`);
|
|
9702
|
+
else sp?.fail(`Completed: ${coloredStatus}`);
|
|
9543
9703
|
return result;
|
|
9544
9704
|
} finally {
|
|
9545
9705
|
clearInterval(updateInterval);
|
|
9546
|
-
|
|
9706
|
+
sp?.stop();
|
|
9547
9707
|
}
|
|
9548
9708
|
}
|
|
9549
9709
|
/**
|
|
@@ -9713,7 +9873,7 @@ async function waitForExecution(options) {
|
|
|
9713
9873
|
const { client, workspaceId, executionId, interval, showProgress, trackJobs } = options;
|
|
9714
9874
|
let lastStatus;
|
|
9715
9875
|
let lastRunningJobs;
|
|
9716
|
-
const
|
|
9876
|
+
const sp = showProgress ? spinner({ indent: 2 }).start("Waiting for workflow to complete...") : null;
|
|
9717
9877
|
try {
|
|
9718
9878
|
while (true) {
|
|
9719
9879
|
const { execution } = await client.getWorkflowExecution({
|
|
@@ -9721,19 +9881,19 @@ async function waitForExecution(options) {
|
|
|
9721
9881
|
executionId
|
|
9722
9882
|
});
|
|
9723
9883
|
if (!execution) {
|
|
9724
|
-
|
|
9884
|
+
sp?.fail(`Execution '${executionId}' not found.`);
|
|
9725
9885
|
throw new Error(`Execution '${executionId}' not found.`);
|
|
9726
9886
|
}
|
|
9727
9887
|
const now = formatTime$1(/* @__PURE__ */ new Date());
|
|
9728
9888
|
const coloredStatus = colorizeStatus(execution.status);
|
|
9729
9889
|
if (execution.status !== lastStatus) {
|
|
9730
9890
|
if (showProgress) {
|
|
9731
|
-
|
|
9891
|
+
sp?.stop();
|
|
9732
9892
|
logger.info(`Status: ${coloredStatus}`, {
|
|
9733
9893
|
mode: "stream",
|
|
9734
9894
|
indent: 2
|
|
9735
9895
|
});
|
|
9736
|
-
|
|
9896
|
+
sp?.start(`Waiting for workflow to complete...`);
|
|
9737
9897
|
}
|
|
9738
9898
|
lastStatus = execution.status;
|
|
9739
9899
|
}
|
|
@@ -9741,27 +9901,27 @@ async function waitForExecution(options) {
|
|
|
9741
9901
|
const runningJobs = getRunningJobs(execution);
|
|
9742
9902
|
if (runningJobs && runningJobs !== lastRunningJobs) {
|
|
9743
9903
|
if (showProgress) {
|
|
9744
|
-
|
|
9904
|
+
sp?.stop();
|
|
9745
9905
|
logger.info(`Job | ${runningJobs}: ${coloredStatus}`, {
|
|
9746
9906
|
mode: "stream",
|
|
9747
9907
|
indent: 2
|
|
9748
9908
|
});
|
|
9749
|
-
|
|
9909
|
+
sp?.start(`Waiting for workflow to complete...`);
|
|
9750
9910
|
}
|
|
9751
9911
|
lastRunningJobs = runningJobs;
|
|
9752
9912
|
}
|
|
9753
9913
|
}
|
|
9754
|
-
if (
|
|
9914
|
+
if (sp) sp.text = `Waiting for workflow to complete... (${now})`;
|
|
9755
9915
|
if (isTerminalStatus(execution.status)) {
|
|
9756
|
-
if (execution.status === WorkflowExecution_Status.SUCCESS)
|
|
9757
|
-
else if (execution.status === WorkflowExecution_Status.FAILED)
|
|
9758
|
-
else
|
|
9916
|
+
if (execution.status === WorkflowExecution_Status.SUCCESS) sp?.succeed(`Completed: ${coloredStatus}`);
|
|
9917
|
+
else if (execution.status === WorkflowExecution_Status.FAILED) sp?.fail(`Completed: ${coloredStatus}`);
|
|
9918
|
+
else sp?.warn(`Completed: ${coloredStatus}`);
|
|
9759
9919
|
return toWorkflowExecutionInfo(execution);
|
|
9760
9920
|
}
|
|
9761
9921
|
await sleep(interval);
|
|
9762
9922
|
}
|
|
9763
9923
|
} catch (error) {
|
|
9764
|
-
|
|
9924
|
+
sp?.stop();
|
|
9765
9925
|
throw error;
|
|
9766
9926
|
}
|
|
9767
9927
|
}
|
|
@@ -9984,7 +10144,7 @@ async function watchExecutorJob(options) {
|
|
|
9984
10144
|
profile: options.profile
|
|
9985
10145
|
});
|
|
9986
10146
|
const interval = options.interval ?? 3e3;
|
|
9987
|
-
const
|
|
10147
|
+
const sp = spinner().start("Waiting for executor job to complete...");
|
|
9988
10148
|
try {
|
|
9989
10149
|
const { executor } = await client.getExecutorExecutor({
|
|
9990
10150
|
workspaceId,
|
|
@@ -10002,13 +10162,13 @@ async function watchExecutorJob(options) {
|
|
|
10002
10162
|
})).job;
|
|
10003
10163
|
if (!job) throw new Error(`Job '${options.jobId}' not found.`);
|
|
10004
10164
|
if (isExecutorJobTerminalStatus(job.status)) break;
|
|
10005
|
-
|
|
10165
|
+
sp.text = `Waiting for executor job... (${formatTime(/* @__PURE__ */ new Date())})`;
|
|
10006
10166
|
await setTimeout$1(interval);
|
|
10007
10167
|
}
|
|
10008
10168
|
const jobInfo = toExecutorJobInfo(job);
|
|
10009
10169
|
const coloredStatus = colorizeExecutorJobStatus(jobInfo.status);
|
|
10010
|
-
if (job.status === ExecutorJobStatus.SUCCESS)
|
|
10011
|
-
else
|
|
10170
|
+
if (job.status === ExecutorJobStatus.SUCCESS) sp.succeed(`Executor job completed: ${coloredStatus}`);
|
|
10171
|
+
else sp.fail(`Executor job completed: ${coloredStatus}`);
|
|
10012
10172
|
const attemptInfos = (await fetchAll(async (pageToken, maxPageSize) => {
|
|
10013
10173
|
const { attempts, nextPageToken } = await client.listExecutorJobAttempts({
|
|
10014
10174
|
workspaceId,
|
|
@@ -10026,7 +10186,7 @@ async function watchExecutorJob(options) {
|
|
|
10026
10186
|
const operationReference = attemptInfos[0]?.operationReference;
|
|
10027
10187
|
if (operationReference) switch (targetType) {
|
|
10028
10188
|
case ExecutorTargetType.WORKFLOW:
|
|
10029
|
-
|
|
10189
|
+
sp.stop();
|
|
10030
10190
|
try {
|
|
10031
10191
|
const executionResult = await waitForExecution({
|
|
10032
10192
|
client,
|
|
@@ -10067,7 +10227,7 @@ async function watchExecutorJob(options) {
|
|
|
10067
10227
|
}
|
|
10068
10228
|
case ExecutorTargetType.FUNCTION:
|
|
10069
10229
|
case ExecutorTargetType.JOB_FUNCTION:
|
|
10070
|
-
|
|
10230
|
+
sp.start(`Waiting for function execution ${operationReference}...`);
|
|
10071
10231
|
try {
|
|
10072
10232
|
while (true) {
|
|
10073
10233
|
const { execution } = await client.getFunctionExecution({
|
|
@@ -10078,8 +10238,8 @@ async function watchExecutorJob(options) {
|
|
|
10078
10238
|
if (isFunctionExecutionTerminalStatus(execution.status)) {
|
|
10079
10239
|
const statusStr = functionExecutionStatusToString(execution.status);
|
|
10080
10240
|
const coloredFnStatus = colorizeFunctionExecutionStatus(statusStr);
|
|
10081
|
-
if (execution.status === FunctionExecution_Status.SUCCESS)
|
|
10082
|
-
else
|
|
10241
|
+
if (execution.status === FunctionExecution_Status.SUCCESS) sp.succeed(`Function execution completed: ${coloredFnStatus}`);
|
|
10242
|
+
else sp.fail(`Function execution completed: ${coloredFnStatus}`);
|
|
10083
10243
|
return {
|
|
10084
10244
|
job: jobDetail,
|
|
10085
10245
|
targetType: targetTypeStr,
|
|
@@ -10088,11 +10248,11 @@ async function watchExecutorJob(options) {
|
|
|
10088
10248
|
functionLogs: options.logs ? execution.logs || void 0 : void 0
|
|
10089
10249
|
};
|
|
10090
10250
|
}
|
|
10091
|
-
|
|
10251
|
+
sp.text = `Waiting for function execution... (${formatTime(/* @__PURE__ */ new Date())})`;
|
|
10092
10252
|
await setTimeout$1(interval);
|
|
10093
10253
|
}
|
|
10094
10254
|
} catch (error) {
|
|
10095
|
-
|
|
10255
|
+
sp.warn(`Could not track function execution: ${error instanceof Error ? error.message : error}`);
|
|
10096
10256
|
return {
|
|
10097
10257
|
job: jobDetail,
|
|
10098
10258
|
targetType: targetTypeStr,
|
|
@@ -10107,7 +10267,7 @@ async function watchExecutorJob(options) {
|
|
|
10107
10267
|
targetType: targetTypeStr
|
|
10108
10268
|
};
|
|
10109
10269
|
} finally {
|
|
10110
|
-
|
|
10270
|
+
sp.stop();
|
|
10111
10271
|
}
|
|
10112
10272
|
}
|
|
10113
10273
|
function printJobWithAttempts(job) {
|
|
@@ -15280,4 +15440,4 @@ function isDeno() {
|
|
|
15280
15440
|
|
|
15281
15441
|
//#endregion
|
|
15282
15442
|
export { deleteCommand$1 as $, getMigrationDirPath as $t, truncate as A, executionsCommand as At, updateOrganization as B, MIGRATION_LABEL_KEY as Bt, listCommand$2 as C, toPageDirection as Cn, jobsCommand as Ct, resumeWorkflow as D, startWorkflow as Dt, resumeCommand as E, startCommand as Et, showCommand as F, getCommand$6 as Ft, getCommand$1 as G, INITIAL_SCHEMA_NUMBER as Gt, treeCommand as H, bundleMigrationScript as Ht, logBetaWarning as I, getExecutor as It, updateFolder as J, compareLocalTypesWithSnapshot as Jt, getOrganization as K, MIGRATE_FILE_NAME as Kt, remove as L, apply as Lt, generate as M, listWorkflowExecutions as Mt, generateCommand as N, functionExecutionStatusToString as Nt, listCommand$3 as O, getCommand$5 as Ot, show as P, formatKeyValueTable as Pt, getFolder as Q, getLatestMigrationNumber as Qt, removeCommand$1 as R, executeScript as Rt, listApps as S, paginationArgs as Sn, getExecutorJob as St, healthCommand as T, watchExecutorJob as Tt, listCommand$4 as U, DB_TYPES_FILE_NAME as Ut, organizationTree as V, parseMigrationLabelNumber as Vt, listOrganizations as W, DIFF_FILE_NAME as Wt, listFolders as X, createSnapshotFromLocalTypes as Xt, listCommand$5 as Y, compareSnapshots as Yt, getCommand$2 as Z, formatMigrationNumber as Zt, getWorkspace as _, commonArgs as _n, webhookCommand as _t, updateUser as a, reconstructSnapshotFromMigrations as an, getCommand$3 as at, createCommand as b, isVerbose as bn, listCommand$9 as bt, listCommand as c, hasChanges as cn, tokenCommand as ct, inviteUser as d, sdkNameLabelKey as dn, generate$1 as dt, getMigrationFilePath as en, deleteFolder as et, restoreCommand as f, trnPrefix as fn, listCommand$8 as ft, getCommand as g, defineAppCommand as gn, listWebhookExecutors as gt, listWorkspaces as h, apiCall as hn, getFunctionRegistry as ht, updateCommand as i, loadDiff as in, listOAuth2Clients as it, truncateCommand as j, getWorkflowExecution as jt, listWorkflows as k, getWorkflow as kt, listUsers as l, getNamespacesWithMigrations as ln, listCommand$7 as lt, listCommand$1 as m, apiCommand as mn, getCommand$4 as mt, query as n, getNextMigrationNumber as nn, createFolder as nt, removeCommand as o, formatDiffSummary as on, getOAuth2Client as ot, restoreWorkspace as p, generateUserTypes as pn, listFunctionRegistries as pt, updateCommand$2 as q, SCHEMA_FILE_NAME as qt, queryCommand as r, isValidMigrationNumber as rn, listCommand$6 as rt, removeUser as s, formatMigrationDiff as sn, getMachineUserToken as st, isNativeTypeScriptRuntime as t, getMigrationFiles as tn, createCommand$1 as tt, inviteCommand as u, prompt as un, listMachineUsers as ut, deleteCommand as v, confirmationArgs as vn, triggerCommand as vt, getAppHealth as w, workspaceArgs as wn, listExecutorJobs as wt, createWorkspace as x, pagedLogArgs as xn, listExecutors as xt, deleteWorkspace as y, deploymentArgs as yn, triggerExecutor as yt, updateCommand$1 as z, waitForExecution$1 as zt };
|
|
15283
|
-
//# sourceMappingURL=runtime-
|
|
15443
|
+
//# sourceMappingURL=runtime-D97Ydu2S.mjs.map
|