@tailor-platform/sdk 1.39.0 → 1.40.0
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 +36 -0
- package/README.md +7 -10
- package/dist/{env-CgI46oPS.d.mts → actor-B2oEmlTc.d.mts} +9 -9
- package/dist/application-CEeKm4R-.mjs +4 -0
- package/dist/{application-DhQrXEld.mjs → application-C_LFXkKJ.mjs} +148 -148
- package/dist/application-C_LFXkKJ.mjs.map +1 -0
- package/dist/{brand-D-d15jx3.mjs → brand-Ll48SMXe.mjs} +1 -1
- package/dist/{brand-D-d15jx3.mjs.map → brand-Ll48SMXe.mjs.map} +1 -1
- package/dist/cli/index.mjs +163 -42
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +43 -9
- package/dist/cli/lib.mjs +4 -4
- package/dist/cli/skills.mjs +13 -43
- package/dist/cli/skills.mjs.map +1 -1
- package/dist/{client-xzPXtc_e.mjs → client-DjGFRjH4.mjs} +105 -47
- package/dist/client-DjGFRjH4.mjs.map +1 -0
- package/dist/client-Dtf48x0o.mjs +4 -0
- package/dist/configure/index.d.mts +4 -4
- package/dist/configure/index.mjs +55 -4
- package/dist/configure/index.mjs.map +1 -1
- package/dist/{crash-report-BEAiCSCl.mjs → crash-report-CEIXtw4D.mjs} +1 -1
- package/dist/{crash-report-DXhPL8Ue.mjs → crash-report-CSWITsTz.mjs} +4 -4
- package/dist/{crash-report-DXhPL8Ue.mjs.map → crash-report-CSWITsTz.mjs.map} +1 -1
- package/dist/{errors-D9f2UJpT.mjs → errors-ChWX5ZG8.mjs} +1 -1
- package/dist/{errors-D9f2UJpT.mjs.map → errors-ChWX5ZG8.mjs.map} +1 -1
- package/dist/field-BY2vbJ8f.mjs +23 -0
- package/dist/field-BY2vbJ8f.mjs.map +1 -0
- package/dist/{index-DbzopC7M.d.mts → index-BtXZdz-F.d.mts} +2 -2
- package/dist/{index-y5790SX_.d.mts → index-Chvw1Eod.d.mts} +2 -2
- package/dist/{index-B2tsEXdh.d.mts → index-CiNNNpuH.d.mts} +2 -2
- package/dist/{index-31hm0Fq7.d.mts → index-D_ezppY7.d.mts} +133 -30
- package/dist/{index-DeBFa7oc.d.mts → index-reFAYSX7.d.mts} +2 -2
- package/dist/{interceptor-CzaH2Ur6.mjs → interceptor-4UC-KTno.mjs} +1 -1
- package/dist/{interceptor-CzaH2Ur6.mjs.map → interceptor-4UC-KTno.mjs.map} +1 -1
- package/dist/{job-DkAklmE4.mjs → job-p6zf8Qpg.mjs} +2 -2
- package/dist/job-p6zf8Qpg.mjs.map +1 -0
- package/dist/{logger-5_JMzHmw.mjs → logger-DTNAMYGy.mjs} +1 -1
- package/dist/{logger-5_JMzHmw.mjs.map → logger-DTNAMYGy.mjs.map} +1 -1
- package/dist/package-json-CPR7s5hf.mjs +4 -0
- package/dist/{package-json-BHViVisJ.mjs → package-json-CWp8s9dE.mjs} +1 -1
- package/dist/{package-json-BHViVisJ.mjs.map → package-json-CWp8s9dE.mjs.map} +1 -1
- package/dist/plugin/builtin/enum-constants/index.d.mts +1 -1
- package/dist/plugin/builtin/file-utils/index.d.mts +1 -1
- package/dist/plugin/builtin/kysely-type/index.d.mts +1 -1
- package/dist/plugin/builtin/seed/index.d.mts +1 -1
- package/dist/plugin/builtin/seed/index.mjs +1 -1
- package/dist/plugin/index.d.mts +2 -2
- package/dist/repl-editor-DjycioU-.mjs +255 -0
- package/dist/repl-editor-DjycioU-.mjs.map +1 -0
- package/dist/{runtime-DtSOnOHh.mjs → runtime-im7Sq4jO.mjs} +313 -182
- package/dist/runtime-im7Sq4jO.mjs.map +1 -0
- package/dist/{schema-CnwUqPyM.mjs → schema-CEcfEyPN.mjs} +4 -44
- package/dist/schema-CEcfEyPN.mjs.map +1 -0
- package/dist/{seed-DrbB1VXd.mjs → seed-CyYPhvNL.mjs} +12 -12
- package/dist/seed-CyYPhvNL.mjs.map +1 -0
- package/dist/{service-Bcp6JB3w.mjs → service-SrG26B9T.mjs} +3 -3
- package/dist/{service-Bcp6JB3w.mjs.map → service-SrG26B9T.mjs.map} +1 -1
- package/dist/{plugin-_K3ZfP8B.d.mts → tailor-db-field-CoFKRCYW.d.mts} +695 -1187
- package/dist/{telemetry-DwHuiNiR.mjs → telemetry-BuDto_2q.mjs} +2 -2
- package/dist/{telemetry-DwHuiNiR.mjs.map → telemetry-BuDto_2q.mjs.map} +1 -1
- package/dist/telemetry-C1hzFaiV.mjs +4 -0
- package/dist/types-BnphjkIJ.mjs +5 -0
- package/dist/{types-B9ZMosul.mjs → types-Duhhsx3R.mjs} +3 -32
- package/dist/types-Duhhsx3R.mjs.map +1 -0
- package/dist/utils/test/index.d.mts +2 -2
- package/dist/utils/test/index.mjs +1 -1
- package/dist/workflow.generated-Btz6srLR.d.mts +1207 -0
- package/docs/cli/application.md +21 -5
- package/docs/cli/auth.md +20 -14
- package/docs/cli/executor.md +17 -14
- package/docs/cli/function.md +6 -4
- package/docs/cli/query.md +45 -0
- package/docs/cli/secret.md +13 -9
- package/docs/cli/skills.md +75 -0
- package/docs/cli/staticwebsite.md +6 -4
- package/docs/cli/user.md +9 -1
- package/docs/cli/workflow.md +17 -13
- package/docs/cli-reference.md +16 -0
- package/docs/services/idp.md +4 -4
- package/docs/services/workflow.md +1 -1
- package/package.json +12 -9
- package/dist/application-C1ipG5Q6.mjs +0 -4
- package/dist/application-DhQrXEld.mjs.map +0 -1
- package/dist/client-BWAbbA1C.mjs +0 -4
- package/dist/client-xzPXtc_e.mjs.map +0 -1
- package/dist/job-DkAklmE4.mjs.map +0 -1
- package/dist/package-json--6dmp6-h.mjs +0 -4
- package/dist/runtime-DtSOnOHh.mjs.map +0 -1
- package/dist/schema-CnwUqPyM.mjs.map +0 -1
- package/dist/seed-DrbB1VXd.mjs.map +0 -1
- package/dist/telemetry-4IOPW6wE.mjs +0 -4
- package/dist/types-B9ZMosul.mjs.map +0 -1
- package/dist/types-C45jRrCM.mjs +0 -4
- package/dist/workflow.generated-BxbnuzAE.d.mts +0 -414
|
@@ -1,28 +1,29 @@
|
|
|
1
1
|
|
|
2
|
-
import { A as
|
|
3
|
-
import { t as db } from "./schema-
|
|
4
|
-
import { a as parseBoolean, i as symbols, n as logger, r as styles, t as CIPromptError } from "./logger-
|
|
5
|
-
import { t as readPackageJson } from "./package-json-
|
|
6
|
-
import { S as readPlatformConfig, T as writePlatformConfig, _ as
|
|
7
|
-
import { r as withSpan } from "./telemetry-
|
|
8
|
-
import { n as isCLIError, t as createCLIError } from "./errors-
|
|
2
|
+
import { $ as ApplicationSchemaUpdateAttemptStatus, A as FunctionExecution_Status, B as AuthOAuth2Client_GrantType, C as TailorDBType_Permission_Operator, D as IdPLang, E as PipelineResolver_OperationType, F as AuthConnection_Type, H as AuthSCIMAttribute_Type, I as AuthHookPoint, J as GetApplicationSchemaHealthResponse_ApplicationSchemaHealthStatus, K as TenantProviderConfig_TenantProviderType, L as AuthIDPConfig_AuthType, M as ExecutorJobStatus, N as ExecutorTargetType, O as IdPPermissionOperator, P as ExecutorTriggerType, Q as PageDirection, R as AuthInvokerSchema, S as TailorDBGQLPermission_Permit, T as TailorDBType_PermitAction, U as AuthSCIMAttribute_Uniqueness, V as AuthSCIMAttribute_Mutability, W as AuthSCIMConfig_AuthorizationType, X as Condition_Operator, Y as ConditionSchema, Z as FilterSchema, _ as WorkspacePlatformUserRole, a as fetchMachineUserToken, b as TailorDBGQLPermission_Action, d as initOperatorClient, et as Subgraph_ServiceType, g as OperatorService, h as userAgent, i as fetchAll, k as IdPPermissionPermit, m as resolveStaticWebsiteUrls, o as fetchPaged, p as platformBaseUrl, q as UserProfileProviderConfig_UserProfileProviderType, v as WorkflowExecution_Status, w as TailorDBType_Permission_Permit, x as TailorDBGQLPermission_Operator, y as WorkflowJobExecution_Status, z as AuthOAuth2Client_ClientType } from "./client-DjGFRjH4.mjs";
|
|
3
|
+
import { t as db } from "./schema-CEcfEyPN.mjs";
|
|
4
|
+
import { a as parseBoolean, i as symbols, n as logger, r as styles, t as CIPromptError } from "./logger-DTNAMYGy.mjs";
|
|
5
|
+
import { t as readPackageJson } from "./package-json-CWp8s9dE.mjs";
|
|
6
|
+
import { S as readPlatformConfig, T as writePlatformConfig, _ as loadConfig, b as loadAccessToken, d as stringifyFunction, f as tailorUserMap, g as hashFile, h as getDistDir, l as OAuth2ClientSchema, m as createBundleCache, n as generatePluginFilesIfNeeded, p as loadFilesWithIgnores, r as loadApplication, s as createExecutorService, t as defineApplication, u as TailorDBTypeSchema, x as loadWorkspaceId } from "./application-C_LFXkKJ.mjs";
|
|
7
|
+
import { r as withSpan } from "./telemetry-BuDto_2q.mjs";
|
|
8
|
+
import { n as isCLIError, t as createCLIError } from "./errors-ChWX5ZG8.mjs";
|
|
9
9
|
import { arg, createDefineCommand, defineCommand, runCommand } from "politty";
|
|
10
10
|
import { z } from "zod";
|
|
11
|
+
import { ValueSchema, timestampDate } from "@bufbuild/protobuf/wkt";
|
|
11
12
|
import * as fs$1 from "node:fs";
|
|
12
13
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
13
14
|
import { parseEnv } from "node:util";
|
|
14
15
|
import * as path from "pathe";
|
|
15
16
|
import { formatDistanceToNowStrict } from "date-fns";
|
|
16
17
|
import { getBorderCharacters, table } from "table";
|
|
17
|
-
import { ValueSchema, timestampDate } from "@bufbuild/protobuf/wkt";
|
|
18
18
|
import { Code, ConnectError } from "@connectrpc/connect";
|
|
19
19
|
import * as crypto from "node:crypto";
|
|
20
20
|
import { createHash } from "node:crypto";
|
|
21
21
|
import { pathToFileURL } from "node:url";
|
|
22
22
|
import { resolveTSConfig } from "pkg-types";
|
|
23
|
+
import ml from "multiline-ts";
|
|
23
24
|
import { tmpdir } from "node:os";
|
|
24
25
|
import { findUpSync } from "find-up-simple";
|
|
25
|
-
import
|
|
26
|
+
import { xdgConfig } from "xdg-basedir";
|
|
26
27
|
import * as rolldown from "rolldown";
|
|
27
28
|
import * as fs from "node:fs/promises";
|
|
28
29
|
import { glob } from "node:fs/promises";
|
|
@@ -36,7 +37,7 @@ import { setTimeout as setTimeout$1 } from "timers/promises";
|
|
|
36
37
|
import { spawn } from "node:child_process";
|
|
37
38
|
import { watch } from "chokidar";
|
|
38
39
|
import * as madgeModule from "madge";
|
|
39
|
-
import {
|
|
40
|
+
import { createPrompt } from "@toiroakr/read-multiline";
|
|
40
41
|
import { astVisitor, parse } from "pgsql-ast-parser";
|
|
41
42
|
import { parse as parse$1 } from "@0no-co/graphql.web";
|
|
42
43
|
|
|
@@ -70,6 +71,26 @@ function parseDuration(duration) {
|
|
|
70
71
|
*/
|
|
71
72
|
const positiveIntArg = z.coerce.number().int().positive();
|
|
72
73
|
/**
|
|
74
|
+
* Schema for non-negative integer validation (from string input).
|
|
75
|
+
* Accepts 0 (used for `--limit 0` to disable the limit).
|
|
76
|
+
*/
|
|
77
|
+
const nonNegativeIntArg = z.coerce.number().int().nonnegative();
|
|
78
|
+
/**
|
|
79
|
+
* Schema for sort order (`asc` or `desc`).
|
|
80
|
+
*/
|
|
81
|
+
const orderArg = z.enum(["asc", "desc"]);
|
|
82
|
+
/**
|
|
83
|
+
* Translate a CLI `--order` value into the proto `PageDirection` enum.
|
|
84
|
+
* Returns `undefined` when the user did not specify an order so that
|
|
85
|
+
* callers can omit the field and fall back to the server default.
|
|
86
|
+
* @param order - Order string from CLI args (`"asc"` | `"desc"` | undefined)
|
|
87
|
+
* @returns PageDirection, or undefined when `order` is undefined
|
|
88
|
+
*/
|
|
89
|
+
function toPageDirection(order) {
|
|
90
|
+
if (order === void 0) return void 0;
|
|
91
|
+
return order === "asc" ? PageDirection.ASC : PageDirection.DESC;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
73
94
|
* Load env files from parsed arguments.
|
|
74
95
|
* Processes --env-file first, then --env-file-if-exists.
|
|
75
96
|
*
|
|
@@ -191,6 +212,34 @@ const organizationArgs = { "organization-id": arg(z.string(), {
|
|
|
191
212
|
completion: { type: "none" }
|
|
192
213
|
}) };
|
|
193
214
|
/**
|
|
215
|
+
* Arguments for list commands that accept `--order` / `--limit`. Sort
|
|
216
|
+
* order defaults to `desc` (newest first) because most callers want the
|
|
217
|
+
* latest items; pass `--order asc` to opt in to ascending order. The
|
|
218
|
+
* limit is unbounded by default so existing invocations keep returning
|
|
219
|
+
* every item; pass `--limit N` to cap the result size.
|
|
220
|
+
* @param defaultOrder - Default value for `--order` (defaults to `"desc"`)
|
|
221
|
+
* @returns Argument shape suitable for spreading into a command schema
|
|
222
|
+
*/
|
|
223
|
+
const paginationArgs = (defaultOrder = "desc") => ({
|
|
224
|
+
order: arg(orderArg.default(defaultOrder), { description: "Sort order (asc or desc)" }),
|
|
225
|
+
limit: arg(nonNegativeIntArg.optional(), {
|
|
226
|
+
alias: "l",
|
|
227
|
+
description: "Maximum number of items to return (0 or omit: unlimited)"
|
|
228
|
+
})
|
|
229
|
+
});
|
|
230
|
+
/**
|
|
231
|
+
* Arguments for time-series log list commands. Defaults to newest-first
|
|
232
|
+
* (`desc`) and a 50-item cap so that listing stays responsive on busy
|
|
233
|
+
* workspaces. Pass `--limit 0` to disable the cap and fetch all entries.
|
|
234
|
+
*/
|
|
235
|
+
const pagedLogArgs = {
|
|
236
|
+
order: arg(orderArg.default("desc"), { description: "Sort order (asc or desc)" }),
|
|
237
|
+
limit: arg(nonNegativeIntArg.default(50), {
|
|
238
|
+
alias: "l",
|
|
239
|
+
description: "Maximum number of items to return (0: unlimited)"
|
|
240
|
+
})
|
|
241
|
+
};
|
|
242
|
+
/**
|
|
194
243
|
* Arguments for commands that require folder context
|
|
195
244
|
*/
|
|
196
245
|
const folderArgs = { "folder-id": arg(z.string(), {
|
|
@@ -251,11 +300,59 @@ async function apiCall(options) {
|
|
|
251
300
|
data
|
|
252
301
|
};
|
|
253
302
|
}
|
|
303
|
+
function getEndpointFieldNames(methodName) {
|
|
304
|
+
const method = OperatorService.methods.find((m) => m.name === methodName);
|
|
305
|
+
if (!method) return [];
|
|
306
|
+
return method.input.fields.map((f) => f.jsonName);
|
|
307
|
+
}
|
|
308
|
+
function resolveNamespaceName(methodName, config) {
|
|
309
|
+
if (/Auth|Tenant|UserProfile/.test(methodName)) return config.auth?.name;
|
|
310
|
+
if (/IdP/.test(methodName)) {
|
|
311
|
+
if (config.idp?.length === 1) return config.idp[0].name;
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
if (/TailorDB/.test(methodName)) {
|
|
315
|
+
const keys = Object.keys(config.db ?? {});
|
|
316
|
+
if (keys.length === 1) return keys[0];
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
if (/Pipeline/.test(methodName)) {
|
|
320
|
+
const keys = Object.keys(config.resolver ?? {});
|
|
321
|
+
if (keys.length === 1) return keys[0];
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Parse a JSON body string as a plain object for field injection.
|
|
327
|
+
* Returns undefined for invalid JSON or non-object values (null, arrays, primitives),
|
|
328
|
+
* so callers can fall back to sending the raw string unchanged.
|
|
329
|
+
* @param body - Raw body string
|
|
330
|
+
* @returns Parsed object or undefined
|
|
331
|
+
*/
|
|
332
|
+
function parseBodyAsObject(body) {
|
|
333
|
+
let parsed;
|
|
334
|
+
try {
|
|
335
|
+
parsed = JSON.parse(body);
|
|
336
|
+
} catch {
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return;
|
|
340
|
+
return parsed;
|
|
341
|
+
}
|
|
254
342
|
const apiCommand = defineAppCommand({
|
|
255
343
|
name: "api",
|
|
256
344
|
description: "Call Tailor Platform API endpoints directly.",
|
|
345
|
+
notes: `The request body is inferred from the proto definition of the target endpoint, and commonly required fields are auto-injected so they can be omitted from \`--body\`:
|
|
346
|
+
|
|
347
|
+
- \`workspaceId\` — resolved from \`-w\` / \`TAILOR_PLATFORM_WORKSPACE_ID\` / the selected profile.
|
|
348
|
+
- \`namespaceName\` — resolved from \`tailor.config.ts\` based on the endpoint's service:
|
|
349
|
+
- Auth / Tenant / UserProfile endpoints use \`auth.name\`.
|
|
350
|
+
- IdP / TailorDB / Pipeline endpoints use the sole configured namespace when exactly one is defined.
|
|
351
|
+
|
|
352
|
+
Values already present in \`--body\` are never overridden. If a value cannot be resolved (e.g. no config found), injection is silently skipped and the server-side validation error takes precedence.`,
|
|
257
353
|
args: z.object({
|
|
258
354
|
...workspaceArgs,
|
|
355
|
+
...configArg,
|
|
259
356
|
body: arg(z.string().default("{}"), {
|
|
260
357
|
alias: "b",
|
|
261
358
|
description: "Request body as JSON"
|
|
@@ -266,13 +363,33 @@ const apiCommand = defineAppCommand({
|
|
|
266
363
|
})
|
|
267
364
|
}).strict(),
|
|
268
365
|
run: async (args) => {
|
|
366
|
+
const methodName = args.endpoint.includes("/") ? args.endpoint.split("/").pop() : args.endpoint;
|
|
367
|
+
const parsedBody = parseBodyAsObject(args.body);
|
|
368
|
+
let mutated = false;
|
|
369
|
+
if (parsedBody) {
|
|
370
|
+
const fieldNames = getEndpointFieldNames(methodName);
|
|
371
|
+
if (fieldNames.includes("workspaceId") && !("workspaceId" in parsedBody)) try {
|
|
372
|
+
parsedBody.workspaceId = await loadWorkspaceId({
|
|
373
|
+
workspaceId: args["workspace-id"],
|
|
374
|
+
profile: args.profile
|
|
375
|
+
});
|
|
376
|
+
mutated = true;
|
|
377
|
+
} catch {}
|
|
378
|
+
if (fieldNames.includes("namespaceName") && !("namespaceName" in parsedBody)) try {
|
|
379
|
+
const { config } = await loadConfig(args.config);
|
|
380
|
+
const ns = resolveNamespaceName(methodName, config);
|
|
381
|
+
if (ns) {
|
|
382
|
+
parsedBody.namespaceName = ns;
|
|
383
|
+
mutated = true;
|
|
384
|
+
}
|
|
385
|
+
} catch {}
|
|
386
|
+
}
|
|
269
387
|
const result = await apiCall({
|
|
270
388
|
profile: args.profile,
|
|
271
389
|
endpoint: args.endpoint,
|
|
272
|
-
body: args.body
|
|
390
|
+
body: mutated ? JSON.stringify(parsedBody) : args.body
|
|
273
391
|
});
|
|
274
|
-
|
|
275
|
-
else logger.log(JSON.stringify(result.data, null, 2));
|
|
392
|
+
logger.log(JSON.stringify(result.data, null, 2));
|
|
276
393
|
}
|
|
277
394
|
});
|
|
278
395
|
|
|
@@ -2282,7 +2399,7 @@ function normalizeComparableEmailConfig(value) {
|
|
|
2282
2399
|
}
|
|
2283
2400
|
function normalizeComparableIdPService(input) {
|
|
2284
2401
|
return {
|
|
2285
|
-
authorization: input.authorization,
|
|
2402
|
+
authorization: input.authorization || void 0,
|
|
2286
2403
|
lang: input.lang === IdPLang.UNSPECIFIED ? IdPLang.EN : input.lang,
|
|
2287
2404
|
userAuthPolicy: input.userAuthPolicy,
|
|
2288
2405
|
publishUserEvents: input.publishUserEvents,
|
|
@@ -2361,6 +2478,9 @@ async function planServices$3(client, workspaceId, appName, idps) {
|
|
|
2361
2478
|
case "loggedIn":
|
|
2362
2479
|
authorization = "user != null && size(user.id) > 0";
|
|
2363
2480
|
break;
|
|
2481
|
+
case void 0:
|
|
2482
|
+
authorization = void 0;
|
|
2483
|
+
break;
|
|
2364
2484
|
default:
|
|
2365
2485
|
authorization = idp.authorization.cel;
|
|
2366
2486
|
break;
|
|
@@ -9103,17 +9223,18 @@ async function listWorkflowExecutions(options) {
|
|
|
9103
9223
|
}) }));
|
|
9104
9224
|
}
|
|
9105
9225
|
const filter = filters.length > 0 ? create(FilterSchema, { and: filters }) : void 0;
|
|
9106
|
-
|
|
9226
|
+
const pageDirection = toPageDirection(options?.order ?? "desc");
|
|
9227
|
+
return (await fetchPaged(async (pageToken, pageSize) => {
|
|
9107
9228
|
const { executions, nextPageToken } = await client.listWorkflowExecutions({
|
|
9108
9229
|
workspaceId,
|
|
9109
9230
|
workflowName: workflowName ?? "",
|
|
9110
9231
|
pageToken,
|
|
9111
|
-
pageSize
|
|
9112
|
-
pageDirection
|
|
9232
|
+
pageSize,
|
|
9233
|
+
pageDirection,
|
|
9113
9234
|
filter
|
|
9114
9235
|
});
|
|
9115
9236
|
return [executions, nextPageToken];
|
|
9116
|
-
})).map(toWorkflowExecutionInfo);
|
|
9237
|
+
}, { limit: options?.limit })).map(toWorkflowExecutionInfo);
|
|
9117
9238
|
}
|
|
9118
9239
|
/**
|
|
9119
9240
|
* Get a single workflow execution with optional logs.
|
|
@@ -9246,6 +9367,7 @@ const executionsCommand = defineAppCommand({
|
|
|
9246
9367
|
description: "List or get workflow executions.",
|
|
9247
9368
|
args: z.object({
|
|
9248
9369
|
...workspaceArgs,
|
|
9370
|
+
...pagedLogArgs,
|
|
9249
9371
|
executionId: arg(z.string().optional(), {
|
|
9250
9372
|
positional: true,
|
|
9251
9373
|
description: "Execution ID (if provided, shows details)"
|
|
@@ -9280,7 +9402,9 @@ const executionsCommand = defineAppCommand({
|
|
|
9280
9402
|
workspaceId: args["workspace-id"],
|
|
9281
9403
|
profile: args.profile,
|
|
9282
9404
|
workflowName: args["workflow-name"],
|
|
9283
|
-
status: args.status
|
|
9405
|
+
status: args.status,
|
|
9406
|
+
order: args.order,
|
|
9407
|
+
limit: args.limit
|
|
9284
9408
|
});
|
|
9285
9409
|
logger.out(executions);
|
|
9286
9410
|
}
|
|
@@ -9568,15 +9692,19 @@ async function listExecutorJobs(options) {
|
|
|
9568
9692
|
}) }));
|
|
9569
9693
|
}
|
|
9570
9694
|
const filter = filters.length > 0 ? create(FilterSchema, { and: filters }) : void 0;
|
|
9695
|
+
const pageDirection = toPageDirection(options.order ?? "desc");
|
|
9571
9696
|
try {
|
|
9572
|
-
|
|
9573
|
-
|
|
9574
|
-
|
|
9575
|
-
|
|
9576
|
-
|
|
9577
|
-
|
|
9578
|
-
|
|
9579
|
-
|
|
9697
|
+
return (await fetchPaged(async (pageToken, pageSize) => {
|
|
9698
|
+
const { jobs, nextPageToken } = await client.listExecutorJobs({
|
|
9699
|
+
workspaceId,
|
|
9700
|
+
executorName,
|
|
9701
|
+
pageToken,
|
|
9702
|
+
pageSize,
|
|
9703
|
+
pageDirection,
|
|
9704
|
+
filter
|
|
9705
|
+
});
|
|
9706
|
+
return [jobs, nextPageToken];
|
|
9707
|
+
}, { limit: options.limit })).map(toExecutorJobListInfo);
|
|
9580
9708
|
} catch (error) {
|
|
9581
9709
|
if (error instanceof ConnectError && error.code === Code.NotFound) throw new Error(`Executor '${executorName}' not found.`, { cause: error });
|
|
9582
9710
|
throw error;
|
|
@@ -9840,11 +9968,12 @@ const jobsCommand = defineAppCommand({
|
|
|
9840
9968
|
alias: "i",
|
|
9841
9969
|
description: "Polling interval when using --wait (e.g., '3s', '500ms', '1m')"
|
|
9842
9970
|
}),
|
|
9971
|
+
...pagedLogArgs,
|
|
9972
|
+
limit: arg(nonNegativeIntArg.default(50), { description: "Maximum number of jobs to list (0: unlimited, default: 50) (list mode only)" }),
|
|
9843
9973
|
logs: arg(z.boolean().default(false), {
|
|
9844
9974
|
alias: "l",
|
|
9845
9975
|
description: "Display function execution logs after completion (requires --wait)"
|
|
9846
|
-
})
|
|
9847
|
-
limit: arg(positiveIntArg.optional(), { description: "Maximum number of jobs to list (default: 50, max: 1000) (list mode only)" })
|
|
9976
|
+
})
|
|
9848
9977
|
}).strict(),
|
|
9849
9978
|
run: async (args) => {
|
|
9850
9979
|
if (args.jobId) {
|
|
@@ -9908,6 +10037,7 @@ const jobsCommand = defineAppCommand({
|
|
|
9908
10037
|
const jobs = await listExecutorJobs({
|
|
9909
10038
|
executorName: args.executorName,
|
|
9910
10039
|
status: args.status,
|
|
10040
|
+
order: args.order,
|
|
9911
10041
|
limit: args.limit,
|
|
9912
10042
|
workspaceId: args["workspace-id"],
|
|
9913
10043
|
profile: args.profile
|
|
@@ -9933,23 +10063,30 @@ async function listExecutors(options) {
|
|
|
9933
10063
|
workspaceId: options?.workspaceId,
|
|
9934
10064
|
profile: options?.profile
|
|
9935
10065
|
});
|
|
9936
|
-
|
|
10066
|
+
const pageDirection = toPageDirection(options?.order);
|
|
10067
|
+
return (await fetchPaged(async (pageToken, pageSize) => {
|
|
9937
10068
|
const { executors, nextPageToken } = await client.listExecutorExecutors({
|
|
9938
10069
|
workspaceId,
|
|
9939
10070
|
pageToken,
|
|
9940
|
-
pageSize
|
|
10071
|
+
pageSize,
|
|
10072
|
+
pageDirection
|
|
9941
10073
|
});
|
|
9942
10074
|
return [executors, nextPageToken];
|
|
9943
|
-
})).map((e) => toExecutorListInfo(e));
|
|
10075
|
+
}, { limit: options?.limit })).map((e) => toExecutorListInfo(e));
|
|
9944
10076
|
}
|
|
9945
10077
|
const listCommand$8 = defineAppCommand({
|
|
9946
10078
|
name: "list",
|
|
9947
10079
|
description: "List all executors",
|
|
9948
|
-
args: z.object({
|
|
10080
|
+
args: z.object({
|
|
10081
|
+
...workspaceArgs,
|
|
10082
|
+
...paginationArgs()
|
|
10083
|
+
}).strict(),
|
|
9949
10084
|
run: async (args) => {
|
|
9950
10085
|
const executors = await listExecutors({
|
|
9951
10086
|
workspaceId: args["workspace-id"],
|
|
9952
|
-
profile: args.profile
|
|
10087
|
+
profile: args.profile,
|
|
10088
|
+
order: args.order,
|
|
10089
|
+
limit: args.limit
|
|
9953
10090
|
});
|
|
9954
10091
|
if (executors.length === 0) {
|
|
9955
10092
|
logger.info("No executors found.");
|
|
@@ -10176,15 +10313,6 @@ The \`--logs\` option displays logs from the downstream execution when available
|
|
|
10176
10313
|
//#endregion
|
|
10177
10314
|
//#region src/cli/commands/executor/webhook.ts
|
|
10178
10315
|
/**
|
|
10179
|
-
* Build the webhook URL for an executor.
|
|
10180
|
-
* @param workspaceId - Workspace ID
|
|
10181
|
-
* @param executorName - Executor name
|
|
10182
|
-
* @returns Webhook URL
|
|
10183
|
-
*/
|
|
10184
|
-
function buildWebhookUrl(workspaceId, executorName) {
|
|
10185
|
-
return `${platformBaseUrl}/webhook/v1/${workspaceId}/executor/${executorName}`;
|
|
10186
|
-
}
|
|
10187
|
-
/**
|
|
10188
10316
|
* List executors with incoming webhook triggers and return CLI-friendly info.
|
|
10189
10317
|
* @param options - Listing options
|
|
10190
10318
|
* @returns List of webhook executors with URLs
|
|
@@ -10199,16 +10327,16 @@ async function listWebhookExecutors(options) {
|
|
|
10199
10327
|
profile: options?.profile
|
|
10200
10328
|
});
|
|
10201
10329
|
return (await fetchAll(async (pageToken, maxPageSize) => {
|
|
10202
|
-
const {
|
|
10330
|
+
const { webhooks, nextPageToken } = await client.listExecutorIncomingWebhooks({
|
|
10203
10331
|
workspaceId,
|
|
10204
10332
|
pageToken,
|
|
10205
10333
|
pageSize: maxPageSize
|
|
10206
10334
|
});
|
|
10207
|
-
return [
|
|
10208
|
-
})).
|
|
10209
|
-
name:
|
|
10210
|
-
webhookUrl:
|
|
10211
|
-
disabled:
|
|
10335
|
+
return [webhooks, nextPageToken];
|
|
10336
|
+
})).map((w) => ({
|
|
10337
|
+
name: w.executorName,
|
|
10338
|
+
webhookUrl: w.url,
|
|
10339
|
+
disabled: w.disabled
|
|
10212
10340
|
}));
|
|
10213
10341
|
}
|
|
10214
10342
|
const listWebhookCommand = defineAppCommand({
|
|
@@ -11133,25 +11261,32 @@ async function listMachineUsers(options) {
|
|
|
11133
11261
|
applicationName: config.name
|
|
11134
11262
|
});
|
|
11135
11263
|
if (!application?.authNamespace) throw new Error(`Application ${config.name} does not have an auth configuration.`);
|
|
11136
|
-
|
|
11264
|
+
const pageDirection = toPageDirection(options?.order);
|
|
11265
|
+
return (await fetchPaged(async (pageToken, pageSize) => {
|
|
11137
11266
|
const { machineUsers, nextPageToken } = await client.listAuthMachineUsers({
|
|
11138
11267
|
workspaceId,
|
|
11139
11268
|
pageToken,
|
|
11140
|
-
pageSize
|
|
11141
|
-
authNamespace: application.authNamespace
|
|
11269
|
+
pageSize,
|
|
11270
|
+
authNamespace: application.authNamespace,
|
|
11271
|
+
pageDirection
|
|
11142
11272
|
});
|
|
11143
11273
|
return [machineUsers, nextPageToken];
|
|
11144
|
-
})).map(machineUserInfo);
|
|
11274
|
+
}, { limit: options?.limit })).map(machineUserInfo);
|
|
11145
11275
|
}
|
|
11146
11276
|
const listCommand$7 = defineAppCommand({
|
|
11147
11277
|
name: "list",
|
|
11148
11278
|
description: "List all machine users in the application.",
|
|
11149
|
-
args: z.object({
|
|
11279
|
+
args: z.object({
|
|
11280
|
+
...deploymentArgs,
|
|
11281
|
+
...paginationArgs()
|
|
11282
|
+
}).strict(),
|
|
11150
11283
|
run: async (args) => {
|
|
11151
11284
|
const machineUsers = await listMachineUsers({
|
|
11152
11285
|
workspaceId: args["workspace-id"],
|
|
11153
11286
|
profile: args.profile,
|
|
11154
|
-
configPath: args.config
|
|
11287
|
+
configPath: args.config,
|
|
11288
|
+
order: args.order,
|
|
11289
|
+
limit: args.limit
|
|
11155
11290
|
});
|
|
11156
11291
|
logger.out(machineUsers, { display: {
|
|
11157
11292
|
createdAt: null,
|
|
@@ -11341,25 +11476,32 @@ async function listOAuth2Clients(options) {
|
|
|
11341
11476
|
applicationName: config.name
|
|
11342
11477
|
});
|
|
11343
11478
|
if (!application?.authNamespace) throw new Error(`Application ${config.name} does not have an auth configuration.`);
|
|
11344
|
-
|
|
11479
|
+
const pageDirection = toPageDirection(options?.order);
|
|
11480
|
+
return (await fetchPaged(async (pageToken, pageSize) => {
|
|
11345
11481
|
const { oauth2Clients, nextPageToken } = await client.listAuthOAuth2Clients({
|
|
11346
11482
|
workspaceId,
|
|
11347
11483
|
pageToken,
|
|
11348
|
-
pageSize
|
|
11349
|
-
namespaceName: application.authNamespace
|
|
11484
|
+
pageSize,
|
|
11485
|
+
namespaceName: application.authNamespace,
|
|
11486
|
+
pageDirection
|
|
11350
11487
|
});
|
|
11351
11488
|
return [oauth2Clients, nextPageToken];
|
|
11352
|
-
})).map(toOAuth2ClientInfo);
|
|
11489
|
+
}, { limit: options?.limit })).map(toOAuth2ClientInfo);
|
|
11353
11490
|
}
|
|
11354
11491
|
const listCommand$6 = defineAppCommand({
|
|
11355
11492
|
name: "list",
|
|
11356
11493
|
description: "List all OAuth2 clients in the application.",
|
|
11357
|
-
args: z.object({
|
|
11494
|
+
args: z.object({
|
|
11495
|
+
...deploymentArgs,
|
|
11496
|
+
...paginationArgs()
|
|
11497
|
+
}).strict(),
|
|
11358
11498
|
run: async (args) => {
|
|
11359
11499
|
const oauth2Clients = await listOAuth2Clients({
|
|
11360
11500
|
workspaceId: args["workspace-id"],
|
|
11361
11501
|
profile: args.profile,
|
|
11362
|
-
configPath: args.config
|
|
11502
|
+
configPath: args.config,
|
|
11503
|
+
order: args.order,
|
|
11504
|
+
limit: args.limit
|
|
11363
11505
|
});
|
|
11364
11506
|
logger.out(oauth2Clients);
|
|
11365
11507
|
}
|
|
@@ -12618,7 +12760,7 @@ async function generate(options) {
|
|
|
12618
12760
|
if (options.init) await handleInitOption(namespacesWithMigrations, options.yes);
|
|
12619
12761
|
let pluginManager;
|
|
12620
12762
|
if (plugins.length > 0) pluginManager = new PluginManager(plugins);
|
|
12621
|
-
const { defineApplication } = await import("./application-
|
|
12763
|
+
const { defineApplication } = await import("./application-CEeKm4R-.mjs");
|
|
12622
12764
|
const application = defineApplication({
|
|
12623
12765
|
config,
|
|
12624
12766
|
pluginManager
|
|
@@ -12977,23 +13119,30 @@ async function listWorkflows(options) {
|
|
|
12977
13119
|
workspaceId: options?.workspaceId,
|
|
12978
13120
|
profile: options?.profile
|
|
12979
13121
|
});
|
|
12980
|
-
|
|
13122
|
+
const pageDirection = toPageDirection(options?.order);
|
|
13123
|
+
return (await fetchPaged(async (pageToken, pageSize) => {
|
|
12981
13124
|
const { workflows, nextPageToken } = await client.listWorkflows({
|
|
12982
13125
|
workspaceId,
|
|
12983
13126
|
pageToken,
|
|
12984
|
-
pageSize
|
|
13127
|
+
pageSize,
|
|
13128
|
+
pageDirection
|
|
12985
13129
|
});
|
|
12986
13130
|
return [workflows, nextPageToken];
|
|
12987
|
-
})).map(toWorkflowListInfo);
|
|
13131
|
+
}, { limit: options?.limit })).map(toWorkflowListInfo);
|
|
12988
13132
|
}
|
|
12989
13133
|
const listCommand$3 = defineAppCommand({
|
|
12990
13134
|
name: "list",
|
|
12991
13135
|
description: "List all workflows in the workspace.",
|
|
12992
|
-
args: z.object({
|
|
13136
|
+
args: z.object({
|
|
13137
|
+
...workspaceArgs,
|
|
13138
|
+
...paginationArgs()
|
|
13139
|
+
}).strict(),
|
|
12993
13140
|
run: async (args) => {
|
|
12994
13141
|
const workflows = await listWorkflows({
|
|
12995
13142
|
workspaceId: args["workspace-id"],
|
|
12996
|
-
profile: args.profile
|
|
13143
|
+
profile: args.profile,
|
|
13144
|
+
order: args.order,
|
|
13145
|
+
limit: args.limit
|
|
12997
13146
|
});
|
|
12998
13147
|
if (workflows.length === 0 && !args.json) {
|
|
12999
13148
|
logger.info("No workflows found.");
|
|
@@ -14390,10 +14539,6 @@ async function prepareQueryExecutor(options) {
|
|
|
14390
14539
|
}
|
|
14391
14540
|
};
|
|
14392
14541
|
}
|
|
14393
|
-
function isReadlineTerminationError(error) {
|
|
14394
|
-
if (!(error instanceof Error) || !("code" in error)) return false;
|
|
14395
|
-
return error.code === "ABORT_ERR" || error.code === "ERR_USE_AFTER_CLOSE";
|
|
14396
|
-
}
|
|
14397
14542
|
/**
|
|
14398
14543
|
* Resolve a backslash REPL command into its normalized action.
|
|
14399
14544
|
* @param input - Raw user input
|
|
@@ -14408,131 +14553,114 @@ function resolveReplCommand(input) {
|
|
|
14408
14553
|
return "unknown";
|
|
14409
14554
|
}
|
|
14410
14555
|
/**
|
|
14411
|
-
* Decide how REPL should react to Ctrl+C based on current buffered input.
|
|
14412
|
-
* @param bufferedLines - Previously accepted lines in the current statement buffer
|
|
14413
|
-
* @param currentLine - In-progress line currently being edited
|
|
14414
|
-
* @returns Whether to clear the buffer or exit the REPL
|
|
14415
|
-
*/
|
|
14416
|
-
function resolveReplInterruptAction(bufferedLines, currentLine) {
|
|
14417
|
-
if (bufferedLines.length === 0 && currentLine.length === 0) return "exit";
|
|
14418
|
-
return "clear";
|
|
14419
|
-
}
|
|
14420
|
-
/**
|
|
14421
14556
|
* Clear the interactive terminal screen and move the cursor to the top-left.
|
|
14422
14557
|
*/
|
|
14423
14558
|
function clearReplScreen() {
|
|
14424
14559
|
process.stdout.write("\x1Bc");
|
|
14425
14560
|
}
|
|
14561
|
+
function sanitizeHistoryScope(value) {
|
|
14562
|
+
return value.replace(/[^a-zA-Z0-9._-]/g, "_");
|
|
14563
|
+
}
|
|
14564
|
+
function getReplHistoryPath(engine, profile, workspaceId) {
|
|
14565
|
+
if (!xdgConfig) return;
|
|
14566
|
+
const scope = [profile, workspaceId].filter((value) => Boolean(value)).map(sanitizeHistoryScope).join("-");
|
|
14567
|
+
const engineSlug = engine === "sql" ? "sql" : "gql";
|
|
14568
|
+
const suffix = scope ? `-${scope}` : "";
|
|
14569
|
+
return path.join(xdgConfig, "tailor-platform", `query-history-${engineSlug}${suffix}.json`);
|
|
14570
|
+
}
|
|
14571
|
+
function createReplValidator(engine) {
|
|
14572
|
+
return (value) => {
|
|
14573
|
+
const trimmed = value.trim();
|
|
14574
|
+
if (trimmed === "") return;
|
|
14575
|
+
if (resolveReplCommand(trimmed) !== null) return;
|
|
14576
|
+
if (engine === "sql") return isSqlInputComplete(value) ? void 0 : "SQL statement is incomplete (missing ';').";
|
|
14577
|
+
return isGraphQLInputComplete(value) ? void 0 : "GraphQL document is incomplete.";
|
|
14578
|
+
};
|
|
14579
|
+
}
|
|
14426
14580
|
async function runRepl(options) {
|
|
14427
14581
|
if (!process.stdin.isTTY || !process.stdout.isTTY) throw new Error("Non-interactive terminals are not supported. Pass -q/--query or -f/--file to run a query.");
|
|
14428
14582
|
const execute = await prepareQueryExecutor(options);
|
|
14429
|
-
const
|
|
14430
|
-
|
|
14431
|
-
|
|
14583
|
+
const historyPath = getReplHistoryPath(options.engine, options.profile, options.workspaceId);
|
|
14584
|
+
const validate = createReplValidator(options.engine);
|
|
14585
|
+
const { highlightSqlLine, highlightGraphqlLine, replTransform } = await import("./repl-editor-DjycioU-.mjs");
|
|
14586
|
+
const highlight = options.engine === "sql" ? highlightSqlLine : highlightGraphqlLine;
|
|
14587
|
+
const prompt = createPrompt({
|
|
14588
|
+
prefix: "",
|
|
14589
|
+
preferNewlineOnEnter: options.newlineOnEnter,
|
|
14590
|
+
validate,
|
|
14591
|
+
highlight,
|
|
14592
|
+
transform: replTransform,
|
|
14593
|
+
clearAfterSubmit: false,
|
|
14594
|
+
history: historyPath ? {
|
|
14595
|
+
filePath: historyPath,
|
|
14596
|
+
maxEntries: 100
|
|
14597
|
+
} : [],
|
|
14598
|
+
helpFooter: {
|
|
14599
|
+
items: ["submit", "newline"],
|
|
14600
|
+
maxLines: 1
|
|
14601
|
+
}
|
|
14432
14602
|
});
|
|
14433
14603
|
logger.info(`Entering ${options.engine.toUpperCase()} REPL mode.`);
|
|
14434
14604
|
logger.info("Type \\help for usage, \\q to quit.");
|
|
14435
|
-
|
|
14436
|
-
|
|
14437
|
-
|
|
14438
|
-
|
|
14439
|
-
|
|
14440
|
-
|
|
14441
|
-
|
|
14442
|
-
|
|
14443
|
-
|
|
14444
|
-
|
|
14445
|
-
|
|
14446
|
-
|
|
14447
|
-
|
|
14448
|
-
|
|
14449
|
-
|
|
14450
|
-
|
|
14451
|
-
|
|
14452
|
-
|
|
14453
|
-
|
|
14454
|
-
|
|
14455
|
-
|
|
14456
|
-
|
|
14457
|
-
|
|
14458
|
-
|
|
14459
|
-
|
|
14460
|
-
|
|
14461
|
-
|
|
14462
|
-
|
|
14463
|
-
|
|
14464
|
-
|
|
14465
|
-
|
|
14466
|
-
rl.off("SIGINT", handleSigint);
|
|
14467
|
-
}
|
|
14468
|
-
const trimmed = line.trim();
|
|
14469
|
-
if (lines.length === 0 && trimmed === "") continue;
|
|
14470
|
-
if (lines.length === 0) {
|
|
14471
|
-
const command = resolveReplCommand(trimmed);
|
|
14472
|
-
if (command === "quit") return;
|
|
14473
|
-
if (command === "help") {
|
|
14474
|
-
printReplHelp(options.engine);
|
|
14475
|
-
continue;
|
|
14476
|
-
}
|
|
14477
|
-
if (command === "clear") {
|
|
14478
|
-
clearReplScreen();
|
|
14479
|
-
continue;
|
|
14480
|
-
}
|
|
14481
|
-
if (command === "unknown") {
|
|
14482
|
-
logger.warn(`Unknown command: ${trimmed}`);
|
|
14483
|
-
continue;
|
|
14484
|
-
}
|
|
14605
|
+
while (true) {
|
|
14606
|
+
const [value, error] = await prompt(`${options.engine}> `);
|
|
14607
|
+
if (error?.kind === "cancel") {
|
|
14608
|
+
if (value.length === 0) return;
|
|
14609
|
+
continue;
|
|
14610
|
+
}
|
|
14611
|
+
if (error?.kind === "eof") return;
|
|
14612
|
+
const trimmed = value.trim();
|
|
14613
|
+
if (trimmed === "") continue;
|
|
14614
|
+
const command = resolveReplCommand(trimmed);
|
|
14615
|
+
if (command === "quit") return;
|
|
14616
|
+
if (command === "help") {
|
|
14617
|
+
printReplHelp(options.engine);
|
|
14618
|
+
continue;
|
|
14619
|
+
}
|
|
14620
|
+
if (command === "clear") {
|
|
14621
|
+
clearReplScreen();
|
|
14622
|
+
continue;
|
|
14623
|
+
}
|
|
14624
|
+
if (command === "unknown") {
|
|
14625
|
+
logger.warn(`Unknown command: ${trimmed}`);
|
|
14626
|
+
continue;
|
|
14627
|
+
}
|
|
14628
|
+
try {
|
|
14629
|
+
const result = await execute(trimmed);
|
|
14630
|
+
if (result.engine === "sql") printSqlResult(result, { json: options.json });
|
|
14631
|
+
else printGqlResult(result, { json: options.json });
|
|
14632
|
+
} catch (error) {
|
|
14633
|
+
if (isCLIError(error)) {
|
|
14634
|
+
logger.log(error.format());
|
|
14635
|
+
continue;
|
|
14485
14636
|
}
|
|
14486
|
-
|
|
14487
|
-
|
|
14488
|
-
|
|
14489
|
-
} else if (!isGraphQLInputComplete(lines.join("\n"))) continue;
|
|
14490
|
-
const statement = getReplStatement(lines, options.engine);
|
|
14491
|
-
lines.length = 0;
|
|
14492
|
-
if (statement.length === 0) continue;
|
|
14493
|
-
try {
|
|
14494
|
-
if (options.engine === "sql") {
|
|
14495
|
-
const result = await execute(statement);
|
|
14496
|
-
if (result.engine !== "sql") throw new Error(`Expected sql engine result but got: ${result.engine}`);
|
|
14497
|
-
printSqlResult(result, { json: options.json });
|
|
14498
|
-
continue;
|
|
14499
|
-
}
|
|
14500
|
-
const result = await execute(statement);
|
|
14501
|
-
if (result.engine !== "gql") throw new Error(`Expected gql engine result but got: ${result.engine}`);
|
|
14502
|
-
printGqlResult(result, { json: options.json });
|
|
14503
|
-
} catch (error) {
|
|
14504
|
-
if (isCLIError(error)) {
|
|
14505
|
-
logger.log(error.format());
|
|
14506
|
-
continue;
|
|
14507
|
-
}
|
|
14508
|
-
if (error instanceof Error) {
|
|
14509
|
-
logger.error(error.message);
|
|
14510
|
-
continue;
|
|
14511
|
-
}
|
|
14512
|
-
logger.error(String(error));
|
|
14637
|
+
if (error instanceof Error) {
|
|
14638
|
+
logger.error(error.message);
|
|
14639
|
+
continue;
|
|
14513
14640
|
}
|
|
14641
|
+
logger.error(String(error));
|
|
14514
14642
|
}
|
|
14515
|
-
} finally {
|
|
14516
|
-
rl.close();
|
|
14517
14643
|
}
|
|
14518
14644
|
}
|
|
14519
|
-
function getReplStatement(lines, engine) {
|
|
14520
|
-
if (engine === "sql") return lines.join("\n").trim();
|
|
14521
|
-
let end = lines.length;
|
|
14522
|
-
while (end > 0 && lines[end - 1].trim() === "") end -= 1;
|
|
14523
|
-
return lines.slice(0, end).join("\n").trim();
|
|
14524
|
-
}
|
|
14525
14645
|
function printReplHelp(engine) {
|
|
14526
14646
|
logger.log("REPL commands:");
|
|
14527
|
-
logger.log(" \\help, \\h, \\?
|
|
14528
|
-
logger.log("
|
|
14529
|
-
logger.log(" \\
|
|
14530
|
-
logger.log("
|
|
14531
|
-
|
|
14532
|
-
|
|
14533
|
-
|
|
14534
|
-
|
|
14535
|
-
logger.log("
|
|
14647
|
+
logger.log(" \\help, \\h, \\? Show this help");
|
|
14648
|
+
logger.log(" \\q, \\quit Exit REPL");
|
|
14649
|
+
logger.log(" \\clear, \\c Clear the screen");
|
|
14650
|
+
logger.log("");
|
|
14651
|
+
logger.log("Key bindings (see footer for terminal-specific submit/newline keys):");
|
|
14652
|
+
logger.log(" Ctrl+J Insert newline (always available)");
|
|
14653
|
+
logger.log(" Ctrl+C Cancel current input");
|
|
14654
|
+
logger.log(" Ctrl+D Exit REPL (on empty input)");
|
|
14655
|
+
logger.log(" Ctrl+Z / Ctrl+Y Undo / Redo");
|
|
14656
|
+
logger.log(" Up/Down (first/last line) Navigate history");
|
|
14657
|
+
logger.log("");
|
|
14658
|
+
logger.log("Editing aids:");
|
|
14659
|
+
logger.log(" Syntax highlighting Enabled for the current engine");
|
|
14660
|
+
logger.log(" ( [ { Auto-inserts the matching closing bracket");
|
|
14661
|
+
logger.log(" Enter after open bracket Adds one indent level and closes the block");
|
|
14662
|
+
logger.log("");
|
|
14663
|
+
logger.log(engine === "sql" ? "Input must end with ';' to submit." : "Input must be a complete GraphQL document to submit.");
|
|
14536
14664
|
}
|
|
14537
14665
|
/**
|
|
14538
14666
|
* Execute SQL query directly.
|
|
@@ -14625,7 +14753,8 @@ const queryCommand = defineAppCommand({
|
|
|
14625
14753
|
hiddenAlias: "machineuser",
|
|
14626
14754
|
description: "Machine user name for query execution",
|
|
14627
14755
|
env: "TAILOR_PLATFORM_MACHINE_USER_NAME"
|
|
14628
|
-
})
|
|
14756
|
+
}),
|
|
14757
|
+
"newline-on-enter": arg(z.boolean().optional(), { description: "REPL: when true, Enter inserts a newline and Shift+Enter submits. Use --no-newline-on-enter to swap." })
|
|
14629
14758
|
}).superRefine((args, ctx) => {
|
|
14630
14759
|
if (args.query != null && args.file != null) ctx.addIssue({
|
|
14631
14760
|
code: "custom",
|
|
@@ -14662,9 +14791,11 @@ const queryCommand = defineAppCommand({
|
|
|
14662
14791
|
return;
|
|
14663
14792
|
}
|
|
14664
14793
|
if (mode.mode === "repl") {
|
|
14794
|
+
const newlineOnEnter = args["newline-on-enter"] ?? parseBoolean(process.env.TAILOR_PLATFORM_QUERY_NEWLINE_ON_ENTER) ?? true;
|
|
14665
14795
|
await runRepl({
|
|
14666
14796
|
...sharedOptions,
|
|
14667
|
-
json: args.json
|
|
14797
|
+
json: args.json,
|
|
14798
|
+
newlineOnEnter
|
|
14668
14799
|
});
|
|
14669
14800
|
return;
|
|
14670
14801
|
}
|
|
@@ -14784,5 +14915,5 @@ function isDeno() {
|
|
|
14784
14915
|
}
|
|
14785
14916
|
|
|
14786
14917
|
//#endregion
|
|
14787
|
-
export { deleteCommand$1 as $, isValidMigrationNumber as $t, truncate as A, formatKeyValueTable as At, updateOrganization as B, DIFF_FILE_NAME as Bt, listCommand$2 as C, startWorkflow as Ct, resumeWorkflow as D, getWorkflowExecution as Dt, resumeCommand as E, executionsCommand as Et, showCommand as F, waitForExecution$1 as Ft, getCommand$1 as G, compareSnapshots as Gt, treeCommand as H, MIGRATE_FILE_NAME as Ht, logBetaWarning as I, MIGRATION_LABEL_KEY as It, updateFolder as J, getLatestMigrationNumber as Jt, getOrganization as K, createSnapshotFromLocalTypes as Kt, remove as L, parseMigrationLabelNumber as Lt, generate as M, getExecutor as Mt, generateCommand as N, apply as Nt, listCommand$3 as O, listWorkflowExecutions as Ot, show as P, executeScript as Pt, getFolder as Q, getNextMigrationNumber as Qt, removeCommand$1 as R, bundleMigrationScript as Rt, listApps as S, startCommand as St, healthCommand as T, getWorkflow as Tt, listCommand$4 as U, SCHEMA_FILE_NAME as Ut, organizationTree as V, INITIAL_SCHEMA_NUMBER as Vt, listOrganizations as W, compareLocalTypesWithSnapshot as Wt, listFolders as X, getMigrationFilePath as Xt, listCommand$5 as Y, getMigrationDirPath as Yt, getCommand$2 as Z, getMigrationFiles as Zt, getWorkspace as _,
|
|
14788
|
-
//# sourceMappingURL=runtime-
|
|
14918
|
+
export { deleteCommand$1 as $, isValidMigrationNumber as $t, truncate as A, formatKeyValueTable as At, updateOrganization as B, DIFF_FILE_NAME as Bt, listCommand$2 as C, startWorkflow as Ct, resumeWorkflow as D, getWorkflowExecution as Dt, resumeCommand as E, executionsCommand as Et, showCommand as F, waitForExecution$1 as Ft, getCommand$1 as G, compareSnapshots as Gt, treeCommand as H, MIGRATE_FILE_NAME as Ht, logBetaWarning as I, MIGRATION_LABEL_KEY as It, updateFolder as J, getLatestMigrationNumber as Jt, getOrganization as K, createSnapshotFromLocalTypes as Kt, remove as L, parseMigrationLabelNumber as Lt, generate as M, getExecutor as Mt, generateCommand as N, apply as Nt, listCommand$3 as O, listWorkflowExecutions as Ot, show as P, executeScript as Pt, getFolder as Q, getNextMigrationNumber as Qt, removeCommand$1 as R, bundleMigrationScript as Rt, listApps as S, startCommand as St, healthCommand as T, getWorkflow as Tt, listCommand$4 as U, SCHEMA_FILE_NAME as Ut, organizationTree as V, INITIAL_SCHEMA_NUMBER as Vt, listOrganizations as W, compareLocalTypesWithSnapshot as Wt, listFolders as X, getMigrationFilePath as Xt, listCommand$5 as Y, getMigrationDirPath as Yt, getCommand$2 as Z, getMigrationFiles as Zt, getWorkspace as _, pagedLogArgs as _n, listExecutors as _t, updateUser as a, getNamespacesWithMigrations as an, getCommand$3 as at, createCommand as b, workspaceArgs as bn, listExecutorJobs as bt, listCommand as c, trnPrefix as cn, tokenCommand as ct, inviteUser as d, apiCommand as dn, generate$1 as dt, loadDiff as en, deleteFolder as et, restoreCommand as f, defineAppCommand as fn, listWebhookExecutors as ft, getCommand as g, isVerbose as gn, listCommand$8 as gt, listWorkspaces as h, deploymentArgs as hn, triggerExecutor as ht, updateCommand as i, hasChanges as in, listOAuth2Clients as it, truncateCommand as j, getCommand$5 as jt, listWorkflows as k, functionExecutionStatusToString as kt, listUsers as l, generateUserTypes as ln, listCommand$7 as lt, listCommand$1 as m, confirmationArgs as mn, triggerCommand as mt, query as n, formatDiffSummary as nn, createFolder as nt, removeCommand as o, prompt as on, getOAuth2Client as ot, restoreWorkspace as p, commonArgs as pn, webhookCommand as pt, updateCommand$2 as q, formatMigrationNumber as qt, queryCommand as r, formatMigrationDiff as rn, listCommand$6 as rt, removeUser as s, sdkNameLabelKey as sn, getMachineUserToken as st, isNativeTypeScriptRuntime as t, reconstructSnapshotFromMigrations as tn, createCommand$1 as tt, inviteCommand as u, apiCall as un, listMachineUsers as ut, deleteCommand as v, paginationArgs as vn, getExecutorJob as vt, getAppHealth as w, getCommand$4 as wt, createWorkspace as x, watchExecutorJob as xt, deleteWorkspace as y, toPageDirection as yn, jobsCommand as yt, updateCommand$1 as z, DB_TYPES_FILE_NAME as zt };
|
|
14919
|
+
//# sourceMappingURL=runtime-im7Sq4jO.mjs.map
|