@tailor-platform/sdk 1.39.1 → 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 +24 -0
- package/README.md +7 -10
- package/dist/{actor-Bb4OVq1j.d.mts → actor-B2oEmlTc.d.mts} +2 -2
- package/dist/application-CEeKm4R-.mjs +4 -0
- package/dist/{application-BHu8YE-g.mjs → application-C_LFXkKJ.mjs} +2 -2
- package/dist/{application-BHu8YE-g.mjs.map → application-C_LFXkKJ.mjs.map} +1 -1
- package/dist/cli/index.mjs +153 -32
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +40 -6
- package/dist/cli/lib.mjs +3 -3
- package/dist/cli/skills.mjs +13 -43
- package/dist/cli/skills.mjs.map +1 -1
- package/dist/{client-B2K45RvK.mjs → client-DjGFRjH4.mjs} +31 -3
- package/dist/{client-B2K45RvK.mjs.map → client-DjGFRjH4.mjs.map} +1 -1
- package/dist/client-Dtf48x0o.mjs +4 -0
- package/dist/configure/index.d.mts +4 -4
- package/dist/{crash-report-CPUF3T5d.mjs → crash-report-CEIXtw4D.mjs} +1 -1
- package/dist/{crash-report-CACiemAr.mjs → crash-report-CSWITsTz.mjs} +2 -2
- package/dist/{crash-report-CACiemAr.mjs.map → crash-report-CSWITsTz.mjs.map} +1 -1
- package/dist/{index-Cx1RYDbu.d.mts → index-BtXZdz-F.d.mts} +2 -2
- package/dist/{index-CeFwhUkX.d.mts → index-Chvw1Eod.d.mts} +2 -2
- package/dist/{index-Ch8Em3nz.d.mts → index-CiNNNpuH.d.mts} +2 -2
- package/dist/{index-BYmdVno1.d.mts → index-D_ezppY7.d.mts} +4 -4
- package/dist/{index-DLO_XvLi.d.mts → index-reFAYSX7.d.mts} +2 -2
- package/dist/{interceptor-B5bKVwgq.mjs → interceptor-4UC-KTno.mjs} +1 -1
- package/dist/{interceptor-B5bKVwgq.mjs.map → interceptor-4UC-KTno.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/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-2xqzvkQv.mjs → runtime-im7Sq4jO.mjs} +231 -171
- package/dist/runtime-im7Sq4jO.mjs.map +1 -0
- package/dist/{tailor-db-field-B99RnR2N.d.mts → tailor-db-field-CoFKRCYW.d.mts} +1 -1
- package/dist/utils/test/index.d.mts +2 -2
- package/dist/{workflow.generated-DSwr-k57.d.mts → workflow.generated-Btz6srLR.d.mts} +2 -2
- 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/workflow.md +1 -1
- package/package.json +11 -8
- package/dist/application-C8Lr37AM.mjs +0 -4
- package/dist/client-CEVmv94H.mjs +0 -4
- package/dist/runtime-2xqzvkQv.mjs.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
import { $ as
|
|
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
3
|
import { t as db } from "./schema-CEcfEyPN.mjs";
|
|
4
4
|
import { a as parseBoolean, i as symbols, n as logger, r as styles, t as CIPromptError } from "./logger-DTNAMYGy.mjs";
|
|
5
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-
|
|
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
7
|
import { r as withSpan } from "./telemetry-BuDto_2q.mjs";
|
|
8
8
|
import { n as isCLIError, t as createCLIError } from "./errors-ChWX5ZG8.mjs";
|
|
9
9
|
import { arg, createDefineCommand, defineCommand, runCommand } from "politty";
|
|
@@ -23,6 +23,7 @@ import { resolveTSConfig } from "pkg-types";
|
|
|
23
23
|
import ml from "multiline-ts";
|
|
24
24
|
import { tmpdir } from "node:os";
|
|
25
25
|
import { findUpSync } from "find-up-simple";
|
|
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(), {
|
|
@@ -9174,17 +9223,18 @@ async function listWorkflowExecutions(options) {
|
|
|
9174
9223
|
}) }));
|
|
9175
9224
|
}
|
|
9176
9225
|
const filter = filters.length > 0 ? create(FilterSchema, { and: filters }) : void 0;
|
|
9177
|
-
|
|
9226
|
+
const pageDirection = toPageDirection(options?.order ?? "desc");
|
|
9227
|
+
return (await fetchPaged(async (pageToken, pageSize) => {
|
|
9178
9228
|
const { executions, nextPageToken } = await client.listWorkflowExecutions({
|
|
9179
9229
|
workspaceId,
|
|
9180
9230
|
workflowName: workflowName ?? "",
|
|
9181
9231
|
pageToken,
|
|
9182
|
-
pageSize
|
|
9183
|
-
pageDirection
|
|
9232
|
+
pageSize,
|
|
9233
|
+
pageDirection,
|
|
9184
9234
|
filter
|
|
9185
9235
|
});
|
|
9186
9236
|
return [executions, nextPageToken];
|
|
9187
|
-
})).map(toWorkflowExecutionInfo);
|
|
9237
|
+
}, { limit: options?.limit })).map(toWorkflowExecutionInfo);
|
|
9188
9238
|
}
|
|
9189
9239
|
/**
|
|
9190
9240
|
* Get a single workflow execution with optional logs.
|
|
@@ -9317,6 +9367,7 @@ const executionsCommand = defineAppCommand({
|
|
|
9317
9367
|
description: "List or get workflow executions.",
|
|
9318
9368
|
args: z.object({
|
|
9319
9369
|
...workspaceArgs,
|
|
9370
|
+
...pagedLogArgs,
|
|
9320
9371
|
executionId: arg(z.string().optional(), {
|
|
9321
9372
|
positional: true,
|
|
9322
9373
|
description: "Execution ID (if provided, shows details)"
|
|
@@ -9351,7 +9402,9 @@ const executionsCommand = defineAppCommand({
|
|
|
9351
9402
|
workspaceId: args["workspace-id"],
|
|
9352
9403
|
profile: args.profile,
|
|
9353
9404
|
workflowName: args["workflow-name"],
|
|
9354
|
-
status: args.status
|
|
9405
|
+
status: args.status,
|
|
9406
|
+
order: args.order,
|
|
9407
|
+
limit: args.limit
|
|
9355
9408
|
});
|
|
9356
9409
|
logger.out(executions);
|
|
9357
9410
|
}
|
|
@@ -9639,15 +9692,19 @@ async function listExecutorJobs(options) {
|
|
|
9639
9692
|
}) }));
|
|
9640
9693
|
}
|
|
9641
9694
|
const filter = filters.length > 0 ? create(FilterSchema, { and: filters }) : void 0;
|
|
9695
|
+
const pageDirection = toPageDirection(options.order ?? "desc");
|
|
9642
9696
|
try {
|
|
9643
|
-
|
|
9644
|
-
|
|
9645
|
-
|
|
9646
|
-
|
|
9647
|
-
|
|
9648
|
-
|
|
9649
|
-
|
|
9650
|
-
|
|
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);
|
|
9651
9708
|
} catch (error) {
|
|
9652
9709
|
if (error instanceof ConnectError && error.code === Code.NotFound) throw new Error(`Executor '${executorName}' not found.`, { cause: error });
|
|
9653
9710
|
throw error;
|
|
@@ -9911,11 +9968,12 @@ const jobsCommand = defineAppCommand({
|
|
|
9911
9968
|
alias: "i",
|
|
9912
9969
|
description: "Polling interval when using --wait (e.g., '3s', '500ms', '1m')"
|
|
9913
9970
|
}),
|
|
9971
|
+
...pagedLogArgs,
|
|
9972
|
+
limit: arg(nonNegativeIntArg.default(50), { description: "Maximum number of jobs to list (0: unlimited, default: 50) (list mode only)" }),
|
|
9914
9973
|
logs: arg(z.boolean().default(false), {
|
|
9915
9974
|
alias: "l",
|
|
9916
9975
|
description: "Display function execution logs after completion (requires --wait)"
|
|
9917
|
-
})
|
|
9918
|
-
limit: arg(positiveIntArg.optional(), { description: "Maximum number of jobs to list (default: 50, max: 1000) (list mode only)" })
|
|
9976
|
+
})
|
|
9919
9977
|
}).strict(),
|
|
9920
9978
|
run: async (args) => {
|
|
9921
9979
|
if (args.jobId) {
|
|
@@ -9979,6 +10037,7 @@ const jobsCommand = defineAppCommand({
|
|
|
9979
10037
|
const jobs = await listExecutorJobs({
|
|
9980
10038
|
executorName: args.executorName,
|
|
9981
10039
|
status: args.status,
|
|
10040
|
+
order: args.order,
|
|
9982
10041
|
limit: args.limit,
|
|
9983
10042
|
workspaceId: args["workspace-id"],
|
|
9984
10043
|
profile: args.profile
|
|
@@ -10004,23 +10063,30 @@ async function listExecutors(options) {
|
|
|
10004
10063
|
workspaceId: options?.workspaceId,
|
|
10005
10064
|
profile: options?.profile
|
|
10006
10065
|
});
|
|
10007
|
-
|
|
10066
|
+
const pageDirection = toPageDirection(options?.order);
|
|
10067
|
+
return (await fetchPaged(async (pageToken, pageSize) => {
|
|
10008
10068
|
const { executors, nextPageToken } = await client.listExecutorExecutors({
|
|
10009
10069
|
workspaceId,
|
|
10010
10070
|
pageToken,
|
|
10011
|
-
pageSize
|
|
10071
|
+
pageSize,
|
|
10072
|
+
pageDirection
|
|
10012
10073
|
});
|
|
10013
10074
|
return [executors, nextPageToken];
|
|
10014
|
-
})).map((e) => toExecutorListInfo(e));
|
|
10075
|
+
}, { limit: options?.limit })).map((e) => toExecutorListInfo(e));
|
|
10015
10076
|
}
|
|
10016
10077
|
const listCommand$8 = defineAppCommand({
|
|
10017
10078
|
name: "list",
|
|
10018
10079
|
description: "List all executors",
|
|
10019
|
-
args: z.object({
|
|
10080
|
+
args: z.object({
|
|
10081
|
+
...workspaceArgs,
|
|
10082
|
+
...paginationArgs()
|
|
10083
|
+
}).strict(),
|
|
10020
10084
|
run: async (args) => {
|
|
10021
10085
|
const executors = await listExecutors({
|
|
10022
10086
|
workspaceId: args["workspace-id"],
|
|
10023
|
-
profile: args.profile
|
|
10087
|
+
profile: args.profile,
|
|
10088
|
+
order: args.order,
|
|
10089
|
+
limit: args.limit
|
|
10024
10090
|
});
|
|
10025
10091
|
if (executors.length === 0) {
|
|
10026
10092
|
logger.info("No executors found.");
|
|
@@ -10247,15 +10313,6 @@ The \`--logs\` option displays logs from the downstream execution when available
|
|
|
10247
10313
|
//#endregion
|
|
10248
10314
|
//#region src/cli/commands/executor/webhook.ts
|
|
10249
10315
|
/**
|
|
10250
|
-
* Build the webhook URL for an executor.
|
|
10251
|
-
* @param workspaceId - Workspace ID
|
|
10252
|
-
* @param executorName - Executor name
|
|
10253
|
-
* @returns Webhook URL
|
|
10254
|
-
*/
|
|
10255
|
-
function buildWebhookUrl(workspaceId, executorName) {
|
|
10256
|
-
return `${platformBaseUrl}/webhook/v1/${workspaceId}/executor/${executorName}`;
|
|
10257
|
-
}
|
|
10258
|
-
/**
|
|
10259
10316
|
* List executors with incoming webhook triggers and return CLI-friendly info.
|
|
10260
10317
|
* @param options - Listing options
|
|
10261
10318
|
* @returns List of webhook executors with URLs
|
|
@@ -10270,16 +10327,16 @@ async function listWebhookExecutors(options) {
|
|
|
10270
10327
|
profile: options?.profile
|
|
10271
10328
|
});
|
|
10272
10329
|
return (await fetchAll(async (pageToken, maxPageSize) => {
|
|
10273
|
-
const {
|
|
10330
|
+
const { webhooks, nextPageToken } = await client.listExecutorIncomingWebhooks({
|
|
10274
10331
|
workspaceId,
|
|
10275
10332
|
pageToken,
|
|
10276
10333
|
pageSize: maxPageSize
|
|
10277
10334
|
});
|
|
10278
|
-
return [
|
|
10279
|
-
})).
|
|
10280
|
-
name:
|
|
10281
|
-
webhookUrl:
|
|
10282
|
-
disabled:
|
|
10335
|
+
return [webhooks, nextPageToken];
|
|
10336
|
+
})).map((w) => ({
|
|
10337
|
+
name: w.executorName,
|
|
10338
|
+
webhookUrl: w.url,
|
|
10339
|
+
disabled: w.disabled
|
|
10283
10340
|
}));
|
|
10284
10341
|
}
|
|
10285
10342
|
const listWebhookCommand = defineAppCommand({
|
|
@@ -11204,25 +11261,32 @@ async function listMachineUsers(options) {
|
|
|
11204
11261
|
applicationName: config.name
|
|
11205
11262
|
});
|
|
11206
11263
|
if (!application?.authNamespace) throw new Error(`Application ${config.name} does not have an auth configuration.`);
|
|
11207
|
-
|
|
11264
|
+
const pageDirection = toPageDirection(options?.order);
|
|
11265
|
+
return (await fetchPaged(async (pageToken, pageSize) => {
|
|
11208
11266
|
const { machineUsers, nextPageToken } = await client.listAuthMachineUsers({
|
|
11209
11267
|
workspaceId,
|
|
11210
11268
|
pageToken,
|
|
11211
|
-
pageSize
|
|
11212
|
-
authNamespace: application.authNamespace
|
|
11269
|
+
pageSize,
|
|
11270
|
+
authNamespace: application.authNamespace,
|
|
11271
|
+
pageDirection
|
|
11213
11272
|
});
|
|
11214
11273
|
return [machineUsers, nextPageToken];
|
|
11215
|
-
})).map(machineUserInfo);
|
|
11274
|
+
}, { limit: options?.limit })).map(machineUserInfo);
|
|
11216
11275
|
}
|
|
11217
11276
|
const listCommand$7 = defineAppCommand({
|
|
11218
11277
|
name: "list",
|
|
11219
11278
|
description: "List all machine users in the application.",
|
|
11220
|
-
args: z.object({
|
|
11279
|
+
args: z.object({
|
|
11280
|
+
...deploymentArgs,
|
|
11281
|
+
...paginationArgs()
|
|
11282
|
+
}).strict(),
|
|
11221
11283
|
run: async (args) => {
|
|
11222
11284
|
const machineUsers = await listMachineUsers({
|
|
11223
11285
|
workspaceId: args["workspace-id"],
|
|
11224
11286
|
profile: args.profile,
|
|
11225
|
-
configPath: args.config
|
|
11287
|
+
configPath: args.config,
|
|
11288
|
+
order: args.order,
|
|
11289
|
+
limit: args.limit
|
|
11226
11290
|
});
|
|
11227
11291
|
logger.out(machineUsers, { display: {
|
|
11228
11292
|
createdAt: null,
|
|
@@ -11412,25 +11476,32 @@ async function listOAuth2Clients(options) {
|
|
|
11412
11476
|
applicationName: config.name
|
|
11413
11477
|
});
|
|
11414
11478
|
if (!application?.authNamespace) throw new Error(`Application ${config.name} does not have an auth configuration.`);
|
|
11415
|
-
|
|
11479
|
+
const pageDirection = toPageDirection(options?.order);
|
|
11480
|
+
return (await fetchPaged(async (pageToken, pageSize) => {
|
|
11416
11481
|
const { oauth2Clients, nextPageToken } = await client.listAuthOAuth2Clients({
|
|
11417
11482
|
workspaceId,
|
|
11418
11483
|
pageToken,
|
|
11419
|
-
pageSize
|
|
11420
|
-
namespaceName: application.authNamespace
|
|
11484
|
+
pageSize,
|
|
11485
|
+
namespaceName: application.authNamespace,
|
|
11486
|
+
pageDirection
|
|
11421
11487
|
});
|
|
11422
11488
|
return [oauth2Clients, nextPageToken];
|
|
11423
|
-
})).map(toOAuth2ClientInfo);
|
|
11489
|
+
}, { limit: options?.limit })).map(toOAuth2ClientInfo);
|
|
11424
11490
|
}
|
|
11425
11491
|
const listCommand$6 = defineAppCommand({
|
|
11426
11492
|
name: "list",
|
|
11427
11493
|
description: "List all OAuth2 clients in the application.",
|
|
11428
|
-
args: z.object({
|
|
11494
|
+
args: z.object({
|
|
11495
|
+
...deploymentArgs,
|
|
11496
|
+
...paginationArgs()
|
|
11497
|
+
}).strict(),
|
|
11429
11498
|
run: async (args) => {
|
|
11430
11499
|
const oauth2Clients = await listOAuth2Clients({
|
|
11431
11500
|
workspaceId: args["workspace-id"],
|
|
11432
11501
|
profile: args.profile,
|
|
11433
|
-
configPath: args.config
|
|
11502
|
+
configPath: args.config,
|
|
11503
|
+
order: args.order,
|
|
11504
|
+
limit: args.limit
|
|
11434
11505
|
});
|
|
11435
11506
|
logger.out(oauth2Clients);
|
|
11436
11507
|
}
|
|
@@ -12689,7 +12760,7 @@ async function generate(options) {
|
|
|
12689
12760
|
if (options.init) await handleInitOption(namespacesWithMigrations, options.yes);
|
|
12690
12761
|
let pluginManager;
|
|
12691
12762
|
if (plugins.length > 0) pluginManager = new PluginManager(plugins);
|
|
12692
|
-
const { defineApplication } = await import("./application-
|
|
12763
|
+
const { defineApplication } = await import("./application-CEeKm4R-.mjs");
|
|
12693
12764
|
const application = defineApplication({
|
|
12694
12765
|
config,
|
|
12695
12766
|
pluginManager
|
|
@@ -13048,23 +13119,30 @@ async function listWorkflows(options) {
|
|
|
13048
13119
|
workspaceId: options?.workspaceId,
|
|
13049
13120
|
profile: options?.profile
|
|
13050
13121
|
});
|
|
13051
|
-
|
|
13122
|
+
const pageDirection = toPageDirection(options?.order);
|
|
13123
|
+
return (await fetchPaged(async (pageToken, pageSize) => {
|
|
13052
13124
|
const { workflows, nextPageToken } = await client.listWorkflows({
|
|
13053
13125
|
workspaceId,
|
|
13054
13126
|
pageToken,
|
|
13055
|
-
pageSize
|
|
13127
|
+
pageSize,
|
|
13128
|
+
pageDirection
|
|
13056
13129
|
});
|
|
13057
13130
|
return [workflows, nextPageToken];
|
|
13058
|
-
})).map(toWorkflowListInfo);
|
|
13131
|
+
}, { limit: options?.limit })).map(toWorkflowListInfo);
|
|
13059
13132
|
}
|
|
13060
13133
|
const listCommand$3 = defineAppCommand({
|
|
13061
13134
|
name: "list",
|
|
13062
13135
|
description: "List all workflows in the workspace.",
|
|
13063
|
-
args: z.object({
|
|
13136
|
+
args: z.object({
|
|
13137
|
+
...workspaceArgs,
|
|
13138
|
+
...paginationArgs()
|
|
13139
|
+
}).strict(),
|
|
13064
13140
|
run: async (args) => {
|
|
13065
13141
|
const workflows = await listWorkflows({
|
|
13066
13142
|
workspaceId: args["workspace-id"],
|
|
13067
|
-
profile: args.profile
|
|
13143
|
+
profile: args.profile,
|
|
13144
|
+
order: args.order,
|
|
13145
|
+
limit: args.limit
|
|
13068
13146
|
});
|
|
13069
13147
|
if (workflows.length === 0 && !args.json) {
|
|
13070
13148
|
logger.info("No workflows found.");
|
|
@@ -14461,10 +14539,6 @@ async function prepareQueryExecutor(options) {
|
|
|
14461
14539
|
}
|
|
14462
14540
|
};
|
|
14463
14541
|
}
|
|
14464
|
-
function isReadlineTerminationError(error) {
|
|
14465
|
-
if (!(error instanceof Error) || !("code" in error)) return false;
|
|
14466
|
-
return error.code === "ABORT_ERR" || error.code === "ERR_USE_AFTER_CLOSE";
|
|
14467
|
-
}
|
|
14468
14542
|
/**
|
|
14469
14543
|
* Resolve a backslash REPL command into its normalized action.
|
|
14470
14544
|
* @param input - Raw user input
|
|
@@ -14479,131 +14553,114 @@ function resolveReplCommand(input) {
|
|
|
14479
14553
|
return "unknown";
|
|
14480
14554
|
}
|
|
14481
14555
|
/**
|
|
14482
|
-
* Decide how REPL should react to Ctrl+C based on current buffered input.
|
|
14483
|
-
* @param bufferedLines - Previously accepted lines in the current statement buffer
|
|
14484
|
-
* @param currentLine - In-progress line currently being edited
|
|
14485
|
-
* @returns Whether to clear the buffer or exit the REPL
|
|
14486
|
-
*/
|
|
14487
|
-
function resolveReplInterruptAction(bufferedLines, currentLine) {
|
|
14488
|
-
if (bufferedLines.length === 0 && currentLine.length === 0) return "exit";
|
|
14489
|
-
return "clear";
|
|
14490
|
-
}
|
|
14491
|
-
/**
|
|
14492
14556
|
* Clear the interactive terminal screen and move the cursor to the top-left.
|
|
14493
14557
|
*/
|
|
14494
14558
|
function clearReplScreen() {
|
|
14495
14559
|
process.stdout.write("\x1Bc");
|
|
14496
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
|
+
}
|
|
14497
14580
|
async function runRepl(options) {
|
|
14498
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.");
|
|
14499
14582
|
const execute = await prepareQueryExecutor(options);
|
|
14500
|
-
const
|
|
14501
|
-
|
|
14502
|
-
|
|
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
|
+
}
|
|
14503
14602
|
});
|
|
14504
14603
|
logger.info(`Entering ${options.engine.toUpperCase()} REPL mode.`);
|
|
14505
14604
|
logger.info("Type \\help for usage, \\q to quit.");
|
|
14506
|
-
|
|
14507
|
-
|
|
14508
|
-
|
|
14509
|
-
|
|
14510
|
-
|
|
14511
|
-
|
|
14512
|
-
|
|
14513
|
-
|
|
14514
|
-
|
|
14515
|
-
|
|
14516
|
-
|
|
14517
|
-
|
|
14518
|
-
|
|
14519
|
-
|
|
14520
|
-
|
|
14521
|
-
|
|
14522
|
-
|
|
14523
|
-
|
|
14524
|
-
|
|
14525
|
-
|
|
14526
|
-
|
|
14527
|
-
|
|
14528
|
-
|
|
14529
|
-
|
|
14530
|
-
|
|
14531
|
-
|
|
14532
|
-
|
|
14533
|
-
|
|
14534
|
-
|
|
14535
|
-
|
|
14536
|
-
|
|
14537
|
-
rl.off("SIGINT", handleSigint);
|
|
14538
|
-
}
|
|
14539
|
-
const trimmed = line.trim();
|
|
14540
|
-
if (lines.length === 0 && trimmed === "") continue;
|
|
14541
|
-
if (lines.length === 0) {
|
|
14542
|
-
const command = resolveReplCommand(trimmed);
|
|
14543
|
-
if (command === "quit") return;
|
|
14544
|
-
if (command === "help") {
|
|
14545
|
-
printReplHelp(options.engine);
|
|
14546
|
-
continue;
|
|
14547
|
-
}
|
|
14548
|
-
if (command === "clear") {
|
|
14549
|
-
clearReplScreen();
|
|
14550
|
-
continue;
|
|
14551
|
-
}
|
|
14552
|
-
if (command === "unknown") {
|
|
14553
|
-
logger.warn(`Unknown command: ${trimmed}`);
|
|
14554
|
-
continue;
|
|
14555
|
-
}
|
|
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;
|
|
14556
14636
|
}
|
|
14557
|
-
|
|
14558
|
-
|
|
14559
|
-
|
|
14560
|
-
} else if (!isGraphQLInputComplete(lines.join("\n"))) continue;
|
|
14561
|
-
const statement = getReplStatement(lines, options.engine);
|
|
14562
|
-
lines.length = 0;
|
|
14563
|
-
if (statement.length === 0) continue;
|
|
14564
|
-
try {
|
|
14565
|
-
if (options.engine === "sql") {
|
|
14566
|
-
const result = await execute(statement);
|
|
14567
|
-
if (result.engine !== "sql") throw new Error(`Expected sql engine result but got: ${result.engine}`);
|
|
14568
|
-
printSqlResult(result, { json: options.json });
|
|
14569
|
-
continue;
|
|
14570
|
-
}
|
|
14571
|
-
const result = await execute(statement);
|
|
14572
|
-
if (result.engine !== "gql") throw new Error(`Expected gql engine result but got: ${result.engine}`);
|
|
14573
|
-
printGqlResult(result, { json: options.json });
|
|
14574
|
-
} catch (error) {
|
|
14575
|
-
if (isCLIError(error)) {
|
|
14576
|
-
logger.log(error.format());
|
|
14577
|
-
continue;
|
|
14578
|
-
}
|
|
14579
|
-
if (error instanceof Error) {
|
|
14580
|
-
logger.error(error.message);
|
|
14581
|
-
continue;
|
|
14582
|
-
}
|
|
14583
|
-
logger.error(String(error));
|
|
14637
|
+
if (error instanceof Error) {
|
|
14638
|
+
logger.error(error.message);
|
|
14639
|
+
continue;
|
|
14584
14640
|
}
|
|
14641
|
+
logger.error(String(error));
|
|
14585
14642
|
}
|
|
14586
|
-
} finally {
|
|
14587
|
-
rl.close();
|
|
14588
14643
|
}
|
|
14589
14644
|
}
|
|
14590
|
-
function getReplStatement(lines, engine) {
|
|
14591
|
-
if (engine === "sql") return lines.join("\n").trim();
|
|
14592
|
-
let end = lines.length;
|
|
14593
|
-
while (end > 0 && lines[end - 1].trim() === "") end -= 1;
|
|
14594
|
-
return lines.slice(0, end).join("\n").trim();
|
|
14595
|
-
}
|
|
14596
14645
|
function printReplHelp(engine) {
|
|
14597
14646
|
logger.log("REPL commands:");
|
|
14598
|
-
logger.log(" \\help, \\h, \\?
|
|
14599
|
-
logger.log("
|
|
14600
|
-
logger.log(" \\
|
|
14601
|
-
logger.log("
|
|
14602
|
-
|
|
14603
|
-
|
|
14604
|
-
|
|
14605
|
-
|
|
14606
|
-
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.");
|
|
14607
14664
|
}
|
|
14608
14665
|
/**
|
|
14609
14666
|
* Execute SQL query directly.
|
|
@@ -14696,7 +14753,8 @@ const queryCommand = defineAppCommand({
|
|
|
14696
14753
|
hiddenAlias: "machineuser",
|
|
14697
14754
|
description: "Machine user name for query execution",
|
|
14698
14755
|
env: "TAILOR_PLATFORM_MACHINE_USER_NAME"
|
|
14699
|
-
})
|
|
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." })
|
|
14700
14758
|
}).superRefine((args, ctx) => {
|
|
14701
14759
|
if (args.query != null && args.file != null) ctx.addIssue({
|
|
14702
14760
|
code: "custom",
|
|
@@ -14733,9 +14791,11 @@ const queryCommand = defineAppCommand({
|
|
|
14733
14791
|
return;
|
|
14734
14792
|
}
|
|
14735
14793
|
if (mode.mode === "repl") {
|
|
14794
|
+
const newlineOnEnter = args["newline-on-enter"] ?? parseBoolean(process.env.TAILOR_PLATFORM_QUERY_NEWLINE_ON_ENTER) ?? true;
|
|
14736
14795
|
await runRepl({
|
|
14737
14796
|
...sharedOptions,
|
|
14738
|
-
json: args.json
|
|
14797
|
+
json: args.json,
|
|
14798
|
+
newlineOnEnter
|
|
14739
14799
|
});
|
|
14740
14800
|
return;
|
|
14741
14801
|
}
|
|
@@ -14855,5 +14915,5 @@ function isDeno() {
|
|
|
14855
14915
|
}
|
|
14856
14916
|
|
|
14857
14917
|
//#endregion
|
|
14858
|
-
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 _,
|
|
14859
|
-
//# 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
|