@tailor-platform/sdk 1.55.0 → 1.55.1
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 +18 -0
- package/dist/cli/index.mjs +97 -34
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.mjs +1 -1
- package/dist/{runtime-BZsl7Mh9.mjs → runtime-CgGeIoxi.mjs} +48 -11
- package/dist/runtime-CgGeIoxi.mjs.map +1 -0
- package/docs/cli-reference.md +12 -0
- package/package.json +11 -11
- package/dist/runtime-BZsl7Mh9.mjs.map +0 -1
package/dist/cli/lib.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import { d as initOperatorClient } from "../client-DLPEPJ_s.mjs";
|
|
3
|
-
import { $t as compareSnapshots, A as truncate, Bt as getExecutor, Ct as triggerExecutor, D as resumeWorkflow, Et as getExecutorJob, Ft as getWorkflowExecution, G as organizationTree, Ht as executeScript, It as listWorkflowExecutions, J as listOrganizations, Jt as DIFF_FILE_NAME, Kt as bundleMigrationScript, M as generate$1, Nt as getWorkflow, Ot as listExecutorJobs, Q as updateFolder, Qt as compareLocalTypesWithSnapshot, R as show, S as listApps, Tt as listExecutors, Ut as waitForExecution, V as remove, Vt as deploy, W as updateOrganization, Wt as MIGRATION_LABEL_KEY, X as getOrganization, Xt as MIGRATE_FILE_NAME, Yt as INITIAL_SCHEMA_NUMBER, Zt as SCHEMA_FILE_NAME, _ as getWorkspace, _t as listFunctionRegistries, a as updateUser, an as getNextMigrationNumber, bt as listWebhookExecutors, cn as reconstructSnapshotFromMigrations, ct as listOAuth2Clients, d as inviteUser, dn as formatMigrationDiff, dt as getMachineUserToken, en as createSnapshotFromLocalTypes, et as listFolders, fn as hasChanges, gn as generateUserTypes, h as listWorkspaces, ht as generate, in as getMigrationFiles, it as deleteFolder, jt as startWorkflow, k as listWorkflows, kt as watchExecutorJob, l as listUsers, mt as listMachineUsers, n as query, nn as getMigrationDirPath, nt as getFolder, ot as createFolder, p as restoreWorkspace, pn as getNamespacesWithMigrations, qt as DB_TYPES_FILE_NAME, rn as getMigrationFilePath, s as removeUser, t as isNativeTypeScriptRuntime, tn as getLatestMigrationNumber, un as formatDiffSummary, ut as getOAuth2Client, w as getAppHealth, x as createWorkspace, y as deleteWorkspace, yn as apiCall, yt as getFunctionRegistry } from "../runtime-
|
|
3
|
+
import { $t as compareSnapshots, A as truncate, Bt as getExecutor, Ct as triggerExecutor, D as resumeWorkflow, Et as getExecutorJob, Ft as getWorkflowExecution, G as organizationTree, Ht as executeScript, It as listWorkflowExecutions, J as listOrganizations, Jt as DIFF_FILE_NAME, Kt as bundleMigrationScript, M as generate$1, Nt as getWorkflow, Ot as listExecutorJobs, Q as updateFolder, Qt as compareLocalTypesWithSnapshot, R as show, S as listApps, Tt as listExecutors, Ut as waitForExecution, V as remove, Vt as deploy, W as updateOrganization, Wt as MIGRATION_LABEL_KEY, X as getOrganization, Xt as MIGRATE_FILE_NAME, Yt as INITIAL_SCHEMA_NUMBER, Zt as SCHEMA_FILE_NAME, _ as getWorkspace, _t as listFunctionRegistries, a as updateUser, an as getNextMigrationNumber, bt as listWebhookExecutors, cn as reconstructSnapshotFromMigrations, ct as listOAuth2Clients, d as inviteUser, dn as formatMigrationDiff, dt as getMachineUserToken, en as createSnapshotFromLocalTypes, et as listFolders, fn as hasChanges, gn as generateUserTypes, h as listWorkspaces, ht as generate, in as getMigrationFiles, it as deleteFolder, jt as startWorkflow, k as listWorkflows, kt as watchExecutorJob, l as listUsers, mt as listMachineUsers, n as query, nn as getMigrationDirPath, nt as getFolder, ot as createFolder, p as restoreWorkspace, pn as getNamespacesWithMigrations, qt as DB_TYPES_FILE_NAME, rn as getMigrationFilePath, s as removeUser, t as isNativeTypeScriptRuntime, tn as getLatestMigrationNumber, un as formatDiffSummary, ut as getOAuth2Client, w as getAppHealth, x as createWorkspace, y as deleteWorkspace, yn as apiCall, yt as getFunctionRegistry } from "../runtime-CgGeIoxi.mjs";
|
|
4
4
|
import { C as loadAccessToken, T as loadWorkspaceId, b as loadConfig, v as getDistDir } from "../application-DzUlASfA.mjs";
|
|
5
5
|
import { n as enumConstantsPlugin } from "../enum-constants-C7DaWeQo.mjs";
|
|
6
6
|
import { t as multiline } from "../multiline-Cf9ODpr1.mjs";
|
|
@@ -717,6 +717,34 @@ function coerceFieldValue(field, raw) {
|
|
|
717
717
|
}
|
|
718
718
|
return raw;
|
|
719
719
|
}
|
|
720
|
+
/**
|
|
721
|
+
* Collapse top-level body keys that address a known input field by its
|
|
722
|
+
* protobuf name (snake_case) or JSON name to the field's `localName`. protojson
|
|
723
|
+
* accepts every alias, so converging them here lets the presence checks below
|
|
724
|
+
* reason in a single namespace — otherwise a `--body` written as
|
|
725
|
+
* `{"workspace_id": ...}` slips past the camelCase check and we inject a second
|
|
726
|
+
* `workspaceId`, which the server rejects as a duplicate field. When both forms
|
|
727
|
+
* are present the canonical key wins and the alias is dropped.
|
|
728
|
+
* @param body - The parsed body object to mutate
|
|
729
|
+
* @param fields - The target endpoint's input fields
|
|
730
|
+
* @returns Whether any key was rewritten
|
|
731
|
+
*/
|
|
732
|
+
function normalizeBodyFieldKeys(body, fields) {
|
|
733
|
+
const aliasToLocal = /* @__PURE__ */ new Map();
|
|
734
|
+
for (const f of fields) {
|
|
735
|
+
aliasToLocal.set(f.name, f.localName);
|
|
736
|
+
aliasToLocal.set(f.jsonName, f.localName);
|
|
737
|
+
}
|
|
738
|
+
let changed = false;
|
|
739
|
+
for (const key of Object.keys(body)) {
|
|
740
|
+
const local = aliasToLocal.get(key);
|
|
741
|
+
if (!local || local === key) continue;
|
|
742
|
+
if (!Object.hasOwn(body, local)) body[local] = body[key];
|
|
743
|
+
delete body[key];
|
|
744
|
+
changed = true;
|
|
745
|
+
}
|
|
746
|
+
return changed;
|
|
747
|
+
}
|
|
720
748
|
const FORBIDDEN_SEGMENTS = new Set([
|
|
721
749
|
"__proto__",
|
|
722
750
|
"constructor",
|
|
@@ -833,15 +861,16 @@ Use \`--field key=value\` (repeatable) to set request body fields without writin
|
|
|
833
861
|
mutated = true;
|
|
834
862
|
}
|
|
835
863
|
if (parsedBody && method) {
|
|
864
|
+
if (normalizeBodyFieldKeys(parsedBody, method.input.fields)) mutated = true;
|
|
836
865
|
const fieldNames = method.input.fields.map((f) => f.localName);
|
|
837
|
-
if (fieldNames.includes("workspaceId") && !("workspaceId"
|
|
866
|
+
if (fieldNames.includes("workspaceId") && !Object.hasOwn(parsedBody, "workspaceId")) try {
|
|
838
867
|
parsedBody.workspaceId = await loadWorkspaceId({
|
|
839
868
|
workspaceId: args["workspace-id"],
|
|
840
869
|
profile: args.profile
|
|
841
870
|
});
|
|
842
871
|
mutated = true;
|
|
843
872
|
} catch {}
|
|
844
|
-
if (fieldNames.includes("namespaceName") && !("namespaceName"
|
|
873
|
+
if (fieldNames.includes("namespaceName") && !Object.hasOwn(parsedBody, "namespaceName")) try {
|
|
845
874
|
const { config } = await loadConfig(args.config);
|
|
846
875
|
const ns = resolveNamespaceName(methodName, config);
|
|
847
876
|
if (ns) {
|
|
@@ -11135,10 +11164,11 @@ const startCommand = defineAppCommand({
|
|
|
11135
11164
|
configPath: args.config,
|
|
11136
11165
|
interval: parseDuration(args.interval)
|
|
11137
11166
|
});
|
|
11167
|
+
const jsonOutput = logger.jsonMode;
|
|
11138
11168
|
logger.info(`Execution ID: ${executionId}`, { mode: "stream" });
|
|
11139
11169
|
if (args.wait) {
|
|
11140
|
-
const result = await wait({ showProgress:
|
|
11141
|
-
if (args.logs && !
|
|
11170
|
+
const result = await wait({ showProgress: !jsonOutput });
|
|
11171
|
+
if (args.logs && !jsonOutput) {
|
|
11142
11172
|
const { execution } = await getWorkflowExecution({
|
|
11143
11173
|
executionId,
|
|
11144
11174
|
workspaceId: args["workspace-id"],
|
|
@@ -11569,6 +11599,7 @@ const listCommand$9 = defineAppCommand({
|
|
|
11569
11599
|
...paginationArgs()
|
|
11570
11600
|
}).strict(),
|
|
11571
11601
|
run: async (args) => {
|
|
11602
|
+
const jsonOutput = logger.jsonMode;
|
|
11572
11603
|
const executors = await listExecutors({
|
|
11573
11604
|
workspaceId: args["workspace-id"],
|
|
11574
11605
|
profile: args.profile,
|
|
@@ -11577,10 +11608,11 @@ const listCommand$9 = defineAppCommand({
|
|
|
11577
11608
|
});
|
|
11578
11609
|
if (executors.length === 0) {
|
|
11579
11610
|
logger.info("No executors found.");
|
|
11611
|
+
if (jsonOutput) logger.out([]);
|
|
11580
11612
|
return;
|
|
11581
11613
|
}
|
|
11582
11614
|
logger.out(executors, { display: { disabled: (v) => v ? styles.warning("true") : styles.dim("false") } });
|
|
11583
|
-
if (!
|
|
11615
|
+
if (!jsonOutput) {
|
|
11584
11616
|
if (executors.some((e) => e.triggerType === "webhook")) logger.info("To see webhook URLs, run: tailor-sdk executor webhook list");
|
|
11585
11617
|
}
|
|
11586
11618
|
}
|
|
@@ -11837,6 +11869,7 @@ const listWebhookCommand = defineAppCommand({
|
|
|
11837
11869
|
...paginationArgs()
|
|
11838
11870
|
}).strict(),
|
|
11839
11871
|
run: async (args) => {
|
|
11872
|
+
const jsonOutput = logger.jsonMode;
|
|
11840
11873
|
const executors = await listWebhookExecutors({
|
|
11841
11874
|
workspaceId: args["workspace-id"],
|
|
11842
11875
|
profile: args.profile,
|
|
@@ -11845,10 +11878,11 @@ const listWebhookCommand = defineAppCommand({
|
|
|
11845
11878
|
});
|
|
11846
11879
|
if (executors.length === 0) {
|
|
11847
11880
|
logger.info("No webhook executors found.");
|
|
11881
|
+
if (jsonOutput) logger.out([]);
|
|
11848
11882
|
return;
|
|
11849
11883
|
}
|
|
11850
11884
|
logger.out(executors, { display: { disabled: (v) => v ? styles.warning("true") : styles.dim("false") } });
|
|
11851
|
-
if (!
|
|
11885
|
+
if (!jsonOutput) logger.info("To test a webhook, run: tailor-sdk executor trigger <name> -d '{\"key\":\"value\"}'");
|
|
11852
11886
|
}
|
|
11853
11887
|
});
|
|
11854
11888
|
const webhookCommand = defineCommand({
|
|
@@ -11996,13 +12030,14 @@ const listCommand$8 = defineAppCommand({
|
|
|
11996
12030
|
...paginationArgs()
|
|
11997
12031
|
}).strict(),
|
|
11998
12032
|
run: async (args) => {
|
|
12033
|
+
const jsonOutput = logger.jsonMode;
|
|
11999
12034
|
const registries = await listFunctionRegistries({
|
|
12000
12035
|
workspaceId: args["workspace-id"],
|
|
12001
12036
|
profile: args.profile,
|
|
12002
12037
|
order: args.order,
|
|
12003
12038
|
limit: args.limit
|
|
12004
12039
|
});
|
|
12005
|
-
const formatted =
|
|
12040
|
+
const formatted = jsonOutput ? registries : registries.map(({ createdAt, updatedAt, ...rest }) => ({
|
|
12006
12041
|
...rest,
|
|
12007
12042
|
createdAt: humanizeRelativeTime(createdAt),
|
|
12008
12043
|
updatedAt: humanizeRelativeTime(updatedAt)
|
|
@@ -14826,15 +14861,16 @@ const listCommand$3 = defineAppCommand({
|
|
|
14826
14861
|
...paginationArgs()
|
|
14827
14862
|
}).strict(),
|
|
14828
14863
|
run: async (args) => {
|
|
14864
|
+
const jsonOutput = logger.jsonMode;
|
|
14829
14865
|
const workflows = await listWorkflows({
|
|
14830
14866
|
workspaceId: args["workspace-id"],
|
|
14831
14867
|
profile: args.profile,
|
|
14832
14868
|
order: args.order,
|
|
14833
14869
|
limit: args.limit
|
|
14834
14870
|
});
|
|
14835
|
-
if (workflows.length === 0
|
|
14871
|
+
if (workflows.length === 0) {
|
|
14836
14872
|
logger.info("No workflows found.");
|
|
14837
|
-
return;
|
|
14873
|
+
if (!jsonOutput) return;
|
|
14838
14874
|
}
|
|
14839
14875
|
logger.out(workflows);
|
|
14840
14876
|
}
|
|
@@ -15059,13 +15095,14 @@ const listCommand$2 = defineAppCommand({
|
|
|
15059
15095
|
...paginationArgs()
|
|
15060
15096
|
}).strict(),
|
|
15061
15097
|
run: async (args) => {
|
|
15098
|
+
const jsonOutput = logger.jsonMode;
|
|
15062
15099
|
const apps = await listApps({
|
|
15063
15100
|
workspaceId: args["workspace-id"],
|
|
15064
15101
|
profile: args.profile,
|
|
15065
15102
|
order: args.order,
|
|
15066
15103
|
limit: args.limit
|
|
15067
15104
|
});
|
|
15068
|
-
const formattedApps =
|
|
15105
|
+
const formattedApps = jsonOutput ? apps : apps.map(({ updatedAt: _, createdAt, ...rest }) => ({
|
|
15069
15106
|
...rest,
|
|
15070
15107
|
createdAt: humanizeRelativeTime(createdAt)
|
|
15071
15108
|
}));
|
|
@@ -16610,4 +16647,4 @@ function isDeno() {
|
|
|
16610
16647
|
|
|
16611
16648
|
//#endregion
|
|
16612
16649
|
export { listCommand$5 as $, compareSnapshots as $t, truncate as A, workspaceArgs as An, startCommand as At, logBetaWarning as B, getExecutor as Bt, listCommand$2 as C, configArg as Cn, triggerExecutor as Ct, resumeWorkflow as D, pagedLogArgs as Dn, jobsCommand as Dt, resumeCommand as E, isVerbose as En, getExecutorJob as Et, writeDbTypesFile as F, getWorkflowExecution as Ft, organizationTree as G, parseMigrationLabelNumber as Gt, removeCommand$1 as H, executeScript as Ht, getConfiguredEditorCommand as I, listWorkflowExecutions as It, listOrganizations as J, DIFF_FILE_NAME as Jt, treeCommand as K, bundleMigrationScript as Kt, openInConfiguredEditor as L, functionExecutionStatusToString as Lt, generate as M, getCommand$5 as Mt, generateCommand as N, getWorkflow as Nt, listCommand$3 as O, paginationArgs as On, listExecutorJobs as Ot, generateMigrationScript as P, executionsCommand as Pt, updateFolder as Q, compareLocalTypesWithSnapshot as Qt, show as R, formatKeyValueTable as Rt, listApps as S, commonArgs as Sn, triggerCommand as St, healthCommand as T, deploymentArgs as Tn, listExecutors as Tt, updateCommand$1 as U, waitForExecution$1 as Ut, remove as V, deploy as Vt, updateOrganization as W, MIGRATION_LABEL_KEY as Wt, getOrganization as X, MIGRATE_FILE_NAME as Xt, getCommand$1 as Y, INITIAL_SCHEMA_NUMBER as Yt, updateCommand$2 as Z, SCHEMA_FILE_NAME as Zt, getWorkspace as _, prompt as _n, listFunctionRegistries as _t, updateUser as a, getNextMigrationNumber as an, createCommand$1 as at, createCommand as b, assertWritable as bn, listWebhookExecutors as bt, listCommand as c, reconstructSnapshotFromMigrations as cn, listOAuth2Clients as ct, inviteUser as d, formatMigrationDiff as dn, getMachineUserToken as dt, createSnapshotFromLocalTypes as en, listFolders as et, restoreCommand as f, hasChanges as fn, tokenCommand as ft, getCommand as g, generateUserTypes as gn, listCommand$8 as gt, listWorkspaces as h, trnPrefix as hn, generate$1 as ht, updateCommand as i, getMigrationFiles as in, deleteFolder as it, truncateCommand as j, startWorkflow as jt, listWorkflows as k, toPageDirection as kn, watchExecutorJob as kt, listUsers as l, formatMigrationNumber as ln, getCommand$3 as lt, listCommand$1 as m, sdkNameLabelKey as mn, listMachineUsers as mt, query as n, getMigrationDirPath as nn, getFolder as nt, removeCommand as o, isValidMigrationNumber as on, createFolder as ot, restoreWorkspace as p, getNamespacesWithMigrations as pn, listCommand$7 as pt, listCommand$4 as q, DB_TYPES_FILE_NAME as qt, queryCommand as r, getMigrationFilePath as rn, deleteCommand$1 as rt, removeUser as s, loadDiff as sn, listCommand$6 as st, isNativeTypeScriptRuntime as t, getLatestMigrationNumber as tn, getCommand$2 as tt, inviteCommand as u, formatDiffSummary as un, getOAuth2Client as ut, deleteCommand as v, apiCommand as vn, getCommand$4 as vt, getAppHealth as w, confirmationArgs as wn, listCommand$9 as wt, createWorkspace as x, defineAppCommand as xn, webhookCommand as xt, deleteWorkspace as y, apiCall as yn, getFunctionRegistry as yt, showCommand as z, getCommand$6 as zt };
|
|
16613
|
-
//# sourceMappingURL=runtime-
|
|
16650
|
+
//# sourceMappingURL=runtime-CgGeIoxi.mjs.map
|