@tailor-platform/sdk 1.23.0 → 1.24.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 +57 -0
- package/dist/app-config-BNKHurwr.d.mts +174 -0
- package/dist/{application-CTQe2HSB.mjs → application-DThE2HW7.mjs} +200 -215
- package/dist/application-DThE2HW7.mjs.map +1 -0
- package/dist/application-P1by1htu.mjs +8 -0
- package/dist/{brand-DyPrAzpM.mjs → brand-64NrPh_e.mjs} +1 -1
- package/dist/{brand-DyPrAzpM.mjs.map → brand-64NrPh_e.mjs.map} +1 -1
- package/dist/cli/index.mjs +7 -7
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +7 -7
- package/dist/cli/lib.mjs +7 -7
- package/dist/cli/lib.mjs.map +1 -1
- package/dist/configure/index.d.mts +5 -4
- package/dist/configure/index.mjs +3 -3
- package/dist/configure/index.mjs.map +1 -1
- package/dist/enum-constants-B5Nl-yzx.mjs.map +1 -1
- package/dist/env-CHwmMyfF.d.mts +32 -0
- package/dist/file-utils-sEOwAdJ4.mjs.map +1 -1
- package/dist/{index-CO-jsOMb.d.mts → index-BrIZ1rm2.d.mts} +2 -2
- package/dist/{index-CU2kZzKa.d.mts → index-Df0aH5zp.d.mts} +55 -4
- package/dist/{index-BSXclved.d.mts → index-DhtKJmgi.d.mts} +2 -2
- package/dist/{index-DQlsfhpg.d.mts → index-DkRJwNw2.d.mts} +2 -2
- package/dist/{index-lIALNMi_.d.mts → index-zZUL7_2B.d.mts} +2 -2
- package/dist/{interceptor-DiARwPfw.mjs → interceptor-B-0OmiDZ.mjs} +1 -1
- package/dist/{interceptor-DiARwPfw.mjs.map → interceptor-B-0OmiDZ.mjs.map} +1 -1
- package/dist/{job-CRavYLLk.mjs → job-CnqcfVTI.mjs} +2 -2
- package/dist/{job-CRavYLLk.mjs.map → job-CnqcfVTI.mjs.map} +1 -1
- package/dist/kysely-type-CSlcwNFH.mjs.map +1 -1
- package/dist/{package-json-iVBhE5Ef.mjs → package-json-4G3gLWMd.mjs} +1 -1
- package/dist/{package-json-iVBhE5Ef.mjs.map → package-json-4G3gLWMd.mjs.map} +1 -1
- package/dist/package-json-BqvUKPBM.mjs +3 -0
- package/dist/plugin/builtin/enum-constants/index.d.mts +2 -2
- package/dist/plugin/builtin/file-utils/index.d.mts +2 -2
- package/dist/plugin/builtin/kysely-type/index.d.mts +2 -2
- package/dist/plugin/builtin/seed/index.d.mts +2 -2
- package/dist/plugin/builtin/seed/index.mjs +1 -1
- package/dist/plugin/index.d.mts +2 -1
- package/dist/plugin/index.mjs.map +1 -1
- package/dist/{types--G4ilVmx.d.mts → plugin-CE-BZZgX.d.mts} +1068 -1761
- package/dist/{query-BLQBOaAM.mjs → query-CV5n7DRd.mjs} +173 -52
- package/dist/query-CV5n7DRd.mjs.map +1 -0
- package/dist/{schema-Cjm-OvPF.mjs → schema-0ByCZ2Ym.mjs} +2 -2
- package/dist/schema-0ByCZ2Ym.mjs.map +1 -0
- package/dist/{seed-CXvCW3Xc.mjs → seed-Cl5QXYsL.mjs} +13 -3
- package/dist/seed-Cl5QXYsL.mjs.map +1 -0
- package/dist/{telemetry-C46fds1l.mjs → telemetry-BPviAbME.mjs} +2 -2
- package/dist/{telemetry-C46fds1l.mjs.map → telemetry-BPviAbME.mjs.map} +1 -1
- package/dist/telemetry-Dq5FZUH0.mjs +3 -0
- package/dist/utils/test/index.d.mts +3 -3
- package/dist/utils/test/index.mjs +2 -2
- package/docs/cli/tailordb.md +1 -1
- package/docs/cli-reference.md +8 -8
- package/package.json +25 -23
- package/dist/application-CTQe2HSB.mjs.map +0 -1
- package/dist/application-DdSu3baZ.mjs +0 -8
- package/dist/package-json-BI0ng3_5.mjs +0 -3
- package/dist/query-BLQBOaAM.mjs.map +0 -1
- package/dist/schema-Cjm-OvPF.mjs.map +0 -1
- package/dist/seed-CXvCW3Xc.mjs.map +0 -1
- package/dist/telemetry-BAxP8-PR.mjs +0 -3
- package/dist/types-CBTSg-LK.mjs +0 -13
- package/dist/types-CBTSg-LK.mjs.map +0 -1
- package/dist/types-IR-hw0-y.d.mts +0 -245
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as db } from "./schema-
|
|
2
|
-
import { $ as AuthSCIMAttribute_Mutability, A as platformBaseUrl, B as TailorDBType_Permission_Permit, C as readPlatformConfig, E as fetchMachineUserToken, F as WorkflowJobExecution_Status, H as PipelineResolver_OperationType, I as TailorDBGQLPermission_Action, J as ExecutorTriggerType, K as ExecutorJobStatus, L as TailorDBGQLPermission_Operator, M as userAgent, N as WorkspacePlatformUserRole, P as WorkflowExecution_Status, Q as AuthOAuth2Client_GrantType, R as TailorDBGQLPermission_Permit, S as loadWorkspaceId, T as fetchAll, U as IdPLang, V as TailorDBType_PermitAction, W as FunctionExecution_Status, X as AuthInvokerSchema, Y as AuthIDPConfig_AuthType, Z as AuthOAuth2Client_ClientType, _ as hashFile, a as loadConfig, at as UserProfileProviderConfig_UserProfileProviderType, b as loadFolderId, ct as Condition_Operator, d as TailorDBTypeSchema, dt as ApplicationSchemaUpdateAttemptStatus, et as AuthSCIMAttribute_Type, f as stringifyFunction, ft as Subgraph_ServiceType, g as getDistDir, h as createBundleCache, ht as symbols, it as TenantProviderConfig_TenantProviderType, j as resolveStaticWebsiteUrls, k as initOperatorClient, l as OAuth2ClientSchema, lt as FilterSchema, m as loadFilesWithIgnores, mt as styles, n as generatePluginFilesIfNeeded, nt as AuthSCIMConfig_AuthorizationType, ot as GetApplicationSchemaHealthResponse_ApplicationSchemaHealthStatus, p as tailorUserMap, pt as logger, q as ExecutorTargetType, r as loadApplication, s as createExecutorService, st as ConditionSchema, t as defineApplication, tt as AuthSCIMAttribute_Uniqueness, ut as PageDirection, w as writePlatformConfig, x as loadOrganizationId, y as loadAccessToken, z as TailorDBType_Permission_Operator } from "./application-
|
|
3
|
-
import { t as readPackageJson } from "./package-json-
|
|
4
|
-
import { r as withSpan } from "./telemetry-
|
|
1
|
+
import { t as db } from "./schema-0ByCZ2Ym.mjs";
|
|
2
|
+
import { $ as AuthSCIMAttribute_Mutability, A as platformBaseUrl, B as TailorDBType_Permission_Permit, C as readPlatformConfig, E as fetchMachineUserToken, F as WorkflowJobExecution_Status, H as PipelineResolver_OperationType, I as TailorDBGQLPermission_Action, J as ExecutorTriggerType, K as ExecutorJobStatus, L as TailorDBGQLPermission_Operator, M as userAgent, N as WorkspacePlatformUserRole, P as WorkflowExecution_Status, Q as AuthOAuth2Client_GrantType, R as TailorDBGQLPermission_Permit, S as loadWorkspaceId, T as fetchAll, U as IdPLang, V as TailorDBType_PermitAction, W as FunctionExecution_Status, X as AuthInvokerSchema, Y as AuthIDPConfig_AuthType, Z as AuthOAuth2Client_ClientType, _ as hashFile, a as loadConfig, at as UserProfileProviderConfig_UserProfileProviderType, b as loadFolderId, ct as Condition_Operator, d as TailorDBTypeSchema, dt as ApplicationSchemaUpdateAttemptStatus, et as AuthSCIMAttribute_Type, f as stringifyFunction, ft as Subgraph_ServiceType, g as getDistDir, h as createBundleCache, ht as symbols, it as TenantProviderConfig_TenantProviderType, j as resolveStaticWebsiteUrls, k as initOperatorClient, l as OAuth2ClientSchema, lt as FilterSchema, m as loadFilesWithIgnores, mt as styles, n as generatePluginFilesIfNeeded, nt as AuthSCIMConfig_AuthorizationType, ot as GetApplicationSchemaHealthResponse_ApplicationSchemaHealthStatus, p as tailorUserMap, pt as logger, q as ExecutorTargetType, r as loadApplication, s as createExecutorService, st as ConditionSchema, t as defineApplication, tt as AuthSCIMAttribute_Uniqueness, ut as PageDirection, w as writePlatformConfig, x as loadOrganizationId, y as loadAccessToken, z as TailorDBType_Permission_Operator } from "./application-DThE2HW7.mjs";
|
|
3
|
+
import { t as readPackageJson } from "./package-json-4G3gLWMd.mjs";
|
|
4
|
+
import { r as withSpan } from "./telemetry-BPviAbME.mjs";
|
|
5
5
|
import { arg, defineCommand, runCommand } from "politty";
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
import * as fs$1 from "node:fs";
|
|
@@ -13,6 +13,7 @@ import { getBorderCharacters, table } from "table";
|
|
|
13
13
|
import { ValueSchema, timestampDate } from "@bufbuild/protobuf/wkt";
|
|
14
14
|
import { Code, ConnectError } from "@connectrpc/connect";
|
|
15
15
|
import { resolveTSConfig } from "pkg-types";
|
|
16
|
+
import { tmpdir } from "node:os";
|
|
16
17
|
import { findUpSync } from "find-up-simple";
|
|
17
18
|
import ml from "multiline-ts";
|
|
18
19
|
import * as crypto from "node:crypto";
|
|
@@ -212,7 +213,7 @@ const withCommonArgs = (handler) => async (args) => {
|
|
|
212
213
|
try {
|
|
213
214
|
if ("json" in args && typeof args.json === "boolean") logger.jsonMode = args.json;
|
|
214
215
|
loadEnvFiles(args["env-file"], args["env-file-if-exists"]);
|
|
215
|
-
const { initTelemetry } = await import("./telemetry-
|
|
216
|
+
const { initTelemetry } = await import("./telemetry-Dq5FZUH0.mjs");
|
|
216
217
|
await initTelemetry();
|
|
217
218
|
await handler(args);
|
|
218
219
|
} catch (error) {
|
|
@@ -225,7 +226,7 @@ const withCommonArgs = (handler) => async (args) => {
|
|
|
225
226
|
} else logger.error(`Unknown error: ${error}`);
|
|
226
227
|
process.exit(1);
|
|
227
228
|
} finally {
|
|
228
|
-
const { shutdownTelemetry } = await import("./telemetry-
|
|
229
|
+
const { shutdownTelemetry } = await import("./telemetry-Dq5FZUH0.mjs");
|
|
229
230
|
await shutdownTelemetry();
|
|
230
231
|
}
|
|
231
232
|
process.exit(0);
|
|
@@ -592,14 +593,14 @@ async function generateUserTypes(options) {
|
|
|
592
593
|
}
|
|
593
594
|
|
|
594
595
|
//#endregion
|
|
595
|
-
//#region src/
|
|
596
|
+
//#region src/types/plugin-generation.ts
|
|
596
597
|
/**
|
|
597
598
|
* Derives generation-time dependency set from hook presence on a plugin.
|
|
598
|
-
* @param plugin -
|
|
599
|
-
* @param plugin.onTailorDBReady - TailorDB
|
|
600
|
-
* @param plugin.onResolverReady -
|
|
601
|
-
* @param plugin.onExecutorReady -
|
|
602
|
-
* @returns Set of dependency kinds
|
|
599
|
+
* @param plugin - The plugin object to inspect.
|
|
600
|
+
* @param plugin.onTailorDBReady - Hook for TailorDB readiness.
|
|
601
|
+
* @param plugin.onResolverReady - Hook for resolver readiness.
|
|
602
|
+
* @param plugin.onExecutorReady - Hook for executor readiness.
|
|
603
|
+
* @returns Set of dependency kinds required by the plugin.
|
|
603
604
|
*/
|
|
604
605
|
function getPluginGenerationDependencies(plugin) {
|
|
605
606
|
const deps = /* @__PURE__ */ new Set();
|
|
@@ -610,11 +611,11 @@ function getPluginGenerationDependencies(plugin) {
|
|
|
610
611
|
}
|
|
611
612
|
/**
|
|
612
613
|
* Checks if a plugin has any generation-time hooks.
|
|
613
|
-
* @param plugin -
|
|
614
|
-
* @param plugin.onTailorDBReady - TailorDB
|
|
615
|
-
* @param plugin.onResolverReady -
|
|
616
|
-
* @param plugin.onExecutorReady -
|
|
617
|
-
* @returns True if the plugin has at least one generation hook
|
|
614
|
+
* @param plugin - The plugin object to inspect.
|
|
615
|
+
* @param plugin.onTailorDBReady - Hook for TailorDB readiness.
|
|
616
|
+
* @param plugin.onResolverReady - Hook for resolver readiness.
|
|
617
|
+
* @param plugin.onExecutorReady - Hook for executor readiness.
|
|
618
|
+
* @returns True if the plugin has at least one generation hook.
|
|
618
619
|
*/
|
|
619
620
|
function hasGenerationHooks(plugin) {
|
|
620
621
|
return !!(plugin.onTailorDBReady || plugin.onResolverReady || plugin.onExecutorReady);
|
|
@@ -3672,7 +3673,7 @@ function createSnapshotFieldConfig(field) {
|
|
|
3672
3673
|
}
|
|
3673
3674
|
/**
|
|
3674
3675
|
* Create a snapshot field config from an OperatorFieldConfig (for nested fields)
|
|
3675
|
-
* @param {import("@/
|
|
3676
|
+
* @param {import("@/types/tailordb").OperatorFieldConfig} fieldConfig - Field configuration
|
|
3676
3677
|
* @returns {SnapshotFieldConfig} Snapshot field configuration
|
|
3677
3678
|
*/
|
|
3678
3679
|
function createSnapshotFieldConfigFromOperatorConfig(fieldConfig) {
|
|
@@ -9527,6 +9528,70 @@ function logBetaWarning(featureName) {
|
|
|
9527
9528
|
logger.newline();
|
|
9528
9529
|
}
|
|
9529
9530
|
|
|
9531
|
+
//#endregion
|
|
9532
|
+
//#region src/cli/shared/editor.ts
|
|
9533
|
+
const DEFAULT_EDITOR = "editor";
|
|
9534
|
+
function normalizeEditorCommand(editor) {
|
|
9535
|
+
const normalized = editor?.trim();
|
|
9536
|
+
return normalized && normalized.length > 0 ? normalized : void 0;
|
|
9537
|
+
}
|
|
9538
|
+
/**
|
|
9539
|
+
* Resolve an editor command only from explicit environment variables.
|
|
9540
|
+
* @returns Configured editor command, if any
|
|
9541
|
+
*/
|
|
9542
|
+
function getConfiguredEditorCommand() {
|
|
9543
|
+
return normalizeEditorCommand(process.env.VISUAL) ?? normalizeEditorCommand(process.env.EDITOR);
|
|
9544
|
+
}
|
|
9545
|
+
/**
|
|
9546
|
+
* Resolve the editor command used for interactive file editing.
|
|
9547
|
+
* @returns Configured editor command or the system default fallback
|
|
9548
|
+
*/
|
|
9549
|
+
function getEditorCommand() {
|
|
9550
|
+
return getConfiguredEditorCommand() ?? DEFAULT_EDITOR;
|
|
9551
|
+
}
|
|
9552
|
+
function parseEditorCommand(editor) {
|
|
9553
|
+
const [command, ...args] = editor.trim().split(/\s+/);
|
|
9554
|
+
if (!command) throw new Error("Editor command is empty.");
|
|
9555
|
+
return {
|
|
9556
|
+
command,
|
|
9557
|
+
args
|
|
9558
|
+
};
|
|
9559
|
+
}
|
|
9560
|
+
/**
|
|
9561
|
+
* Open a file in the resolved editor and wait for the process to exit.
|
|
9562
|
+
* @param filePath - File path to open
|
|
9563
|
+
* @param editor - Editor command string
|
|
9564
|
+
* @returns Whether an editor process was launched
|
|
9565
|
+
*/
|
|
9566
|
+
async function openInEditor(filePath, editor = getEditorCommand()) {
|
|
9567
|
+
const { command, args } = parseEditorCommand(editor);
|
|
9568
|
+
await new Promise((resolve$1, reject) => {
|
|
9569
|
+
const child = spawn(command, [...args, filePath], {
|
|
9570
|
+
stdio: "inherit",
|
|
9571
|
+
detached: false
|
|
9572
|
+
});
|
|
9573
|
+
child.once("error", (error) => reject(error));
|
|
9574
|
+
child.once("close", (code) => {
|
|
9575
|
+
if (code == null || code === 0) {
|
|
9576
|
+
resolve$1();
|
|
9577
|
+
return;
|
|
9578
|
+
}
|
|
9579
|
+
reject(/* @__PURE__ */ new Error(`Editor exited with code ${code}.`));
|
|
9580
|
+
});
|
|
9581
|
+
});
|
|
9582
|
+
return true;
|
|
9583
|
+
}
|
|
9584
|
+
/**
|
|
9585
|
+
* Open a file only when an editor is explicitly configured in the environment.
|
|
9586
|
+
* @param filePath - File path to open
|
|
9587
|
+
* @returns Whether an editor process was launched
|
|
9588
|
+
*/
|
|
9589
|
+
async function openInConfiguredEditor(filePath) {
|
|
9590
|
+
const editor = getConfiguredEditorCommand();
|
|
9591
|
+
if (!editor) return false;
|
|
9592
|
+
return await openInEditor(filePath, editor);
|
|
9593
|
+
}
|
|
9594
|
+
|
|
9530
9595
|
//#endregion
|
|
9531
9596
|
//#region src/cli/commands/tailordb/migrate/db-types-generator.ts
|
|
9532
9597
|
/**
|
|
@@ -10036,7 +10101,7 @@ async function generate(options) {
|
|
|
10036
10101
|
if (options.init) await handleInitOption(namespacesWithMigrations, options.yes);
|
|
10037
10102
|
let pluginManager;
|
|
10038
10103
|
if (plugins.length > 0) pluginManager = new PluginManager(plugins);
|
|
10039
|
-
const { defineApplication: defineApplication$1 } = await import("./application-
|
|
10104
|
+
const { defineApplication: defineApplication$1 } = await import("./application-P1by1htu.mjs");
|
|
10040
10105
|
const application = defineApplication$1({
|
|
10041
10106
|
config,
|
|
10042
10107
|
pluginManager
|
|
@@ -10135,33 +10200,21 @@ async function generateDiffFromSnapshot(previousSnapshot, currentSnapshot, migra
|
|
|
10135
10200
|
logger.newline();
|
|
10136
10201
|
logger.log("A migration script was generated for breaking changes.");
|
|
10137
10202
|
logger.log("Please review and edit the script before running 'tailor-sdk apply'.");
|
|
10138
|
-
|
|
10139
|
-
|
|
10140
|
-
|
|
10141
|
-
|
|
10142
|
-
|
|
10143
|
-
|
|
10144
|
-
|
|
10145
|
-
|
|
10146
|
-
|
|
10147
|
-
|
|
10148
|
-
|
|
10149
|
-
|
|
10150
|
-
|
|
10151
|
-
|
|
10152
|
-
return;
|
|
10203
|
+
const editor = getConfiguredEditorCommand();
|
|
10204
|
+
if (!editor) return;
|
|
10205
|
+
try {
|
|
10206
|
+
await fs.access(result.migrateFilePath);
|
|
10207
|
+
} catch {
|
|
10208
|
+
return;
|
|
10209
|
+
}
|
|
10210
|
+
logger.newline();
|
|
10211
|
+
logger.info(`Opening ${path.basename(result.migrateFilePath)} in ${editor}...`);
|
|
10212
|
+
try {
|
|
10213
|
+
await openInConfiguredEditor(result.migrateFilePath);
|
|
10214
|
+
} catch {
|
|
10215
|
+
return;
|
|
10216
|
+
}
|
|
10153
10217
|
}
|
|
10154
|
-
const [command, ...args] = editor.trim().split(/\s+/);
|
|
10155
|
-
logger.newline();
|
|
10156
|
-
logger.info(`Opening ${path.basename(filePath)} in ${editor}...`);
|
|
10157
|
-
const child = spawn(command, [...args, filePath], {
|
|
10158
|
-
stdio: "inherit",
|
|
10159
|
-
detached: false
|
|
10160
|
-
});
|
|
10161
|
-
await new Promise((resolve$1) => {
|
|
10162
|
-
child.on("close", () => resolve$1());
|
|
10163
|
-
child.on("error", () => resolve$1());
|
|
10164
|
-
});
|
|
10165
10218
|
}
|
|
10166
10219
|
/**
|
|
10167
10220
|
* CLI command definition for generate
|
|
@@ -11763,11 +11816,49 @@ function parseExecutionResult(result) {
|
|
|
11763
11816
|
* Resolve query input mode from CLI args.
|
|
11764
11817
|
* @param args - Query input flags
|
|
11765
11818
|
* @param args.query - Direct query string
|
|
11819
|
+
* @param args.file - File path containing query text
|
|
11820
|
+
* @param args.edit - Open a query editor instead of REPL
|
|
11821
|
+
* @param args.engine - Query engine used to choose temp file extension
|
|
11766
11822
|
* @returns Normalized input mode
|
|
11767
11823
|
*/
|
|
11768
|
-
function resolveQueryCommandInput(args) {
|
|
11769
|
-
if (args.query != null) return {
|
|
11770
|
-
|
|
11824
|
+
async function resolveQueryCommandInput(args) {
|
|
11825
|
+
if (args.query != null) return {
|
|
11826
|
+
mode: "query",
|
|
11827
|
+
query: args.query
|
|
11828
|
+
};
|
|
11829
|
+
if (args.file != null) return {
|
|
11830
|
+
mode: "query",
|
|
11831
|
+
query: await fs.readFile(args.file, "utf-8")
|
|
11832
|
+
};
|
|
11833
|
+
if (args.edit) return await resolveEditedQueryInput(args.engine);
|
|
11834
|
+
return { mode: "repl" };
|
|
11835
|
+
}
|
|
11836
|
+
async function resolveEditedQueryInput(engine) {
|
|
11837
|
+
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.");
|
|
11838
|
+
const editor = getEditorCommand();
|
|
11839
|
+
const tempDir = await fs.mkdtemp(path.join(tmpdir(), "tailor-query-"));
|
|
11840
|
+
const fileExtension = engine === "sql" ? "sql" : "graphql";
|
|
11841
|
+
const filePath = path.join(tempDir, `query.${fileExtension}`);
|
|
11842
|
+
const initialQuery = "";
|
|
11843
|
+
try {
|
|
11844
|
+
await fs.writeFile(filePath, initialQuery, "utf-8");
|
|
11845
|
+
try {
|
|
11846
|
+
await openInEditor(filePath, editor);
|
|
11847
|
+
} catch (error) {
|
|
11848
|
+
throw new Error(`Failed to open query editor "${editor}": ${error instanceof Error ? error.message : String(error)}`);
|
|
11849
|
+
}
|
|
11850
|
+
const editedQuery = await fs.readFile(filePath, "utf-8");
|
|
11851
|
+
if (editedQuery.trim().length === 0 || editedQuery === initialQuery) return { mode: "abort" };
|
|
11852
|
+
return {
|
|
11853
|
+
mode: "query",
|
|
11854
|
+
query: editedQuery
|
|
11855
|
+
};
|
|
11856
|
+
} finally {
|
|
11857
|
+
await fs.rm(tempDir, {
|
|
11858
|
+
recursive: true,
|
|
11859
|
+
force: true
|
|
11860
|
+
});
|
|
11861
|
+
}
|
|
11771
11862
|
}
|
|
11772
11863
|
/**
|
|
11773
11864
|
* Dispatch query execution.
|
|
@@ -11849,7 +11940,7 @@ function clearReplScreen() {
|
|
|
11849
11940
|
process.stdout.write("\x1Bc");
|
|
11850
11941
|
}
|
|
11851
11942
|
async function runRepl(options) {
|
|
11852
|
-
if (!process.stdin.isTTY || !process.stdout.isTTY) throw new Error("Non-interactive terminals are not supported. Pass -q/--query to run a query.");
|
|
11943
|
+
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.");
|
|
11853
11944
|
const execute = await prepareQueryExecutor(options);
|
|
11854
11945
|
const rl = createInterface({
|
|
11855
11946
|
input: process.stdin,
|
|
@@ -12042,13 +12133,39 @@ const queryCommand = defineCommand({
|
|
|
12042
12133
|
alias: "q",
|
|
12043
12134
|
description: "Query string to execute directly; omit to start REPL mode"
|
|
12044
12135
|
}),
|
|
12136
|
+
file: arg(z.string().optional(), {
|
|
12137
|
+
alias: "f",
|
|
12138
|
+
description: "Read query string from file; omit to start REPL mode"
|
|
12139
|
+
}),
|
|
12140
|
+
edit: arg(z.boolean().default(false), { description: "Open a temporary file in your editor; omit to start REPL mode" }),
|
|
12045
12141
|
machineuser: arg(z.string(), {
|
|
12046
12142
|
alias: "m",
|
|
12047
12143
|
description: "Machine user name for query execution"
|
|
12048
12144
|
})
|
|
12145
|
+
}).superRefine((args, ctx) => {
|
|
12146
|
+
if (args.query != null && args.file != null) ctx.addIssue({
|
|
12147
|
+
code: "custom",
|
|
12148
|
+
path: ["file"],
|
|
12149
|
+
message: "Pass either -q/--query or -f/--file, not both."
|
|
12150
|
+
});
|
|
12151
|
+
if (args.edit && args.query != null) ctx.addIssue({
|
|
12152
|
+
code: "custom",
|
|
12153
|
+
path: ["edit"],
|
|
12154
|
+
message: "Pass only one of --edit, -q/--query, or -f/--file."
|
|
12155
|
+
});
|
|
12156
|
+
if (args.edit && args.file != null) ctx.addIssue({
|
|
12157
|
+
code: "custom",
|
|
12158
|
+
path: ["edit"],
|
|
12159
|
+
message: "Pass only one of --edit, -q/--query, or -f/--file."
|
|
12160
|
+
});
|
|
12049
12161
|
}).strict(),
|
|
12050
12162
|
run: withCommonArgs(async (args) => {
|
|
12051
|
-
const mode = resolveQueryCommandInput({
|
|
12163
|
+
const mode = await resolveQueryCommandInput({
|
|
12164
|
+
query: args.query,
|
|
12165
|
+
file: args.file,
|
|
12166
|
+
edit: args.edit,
|
|
12167
|
+
engine: args.engine
|
|
12168
|
+
});
|
|
12052
12169
|
const sharedOptions = {
|
|
12053
12170
|
workspaceId: args["workspace-id"],
|
|
12054
12171
|
profile: args.profile,
|
|
@@ -12056,7 +12173,11 @@ const queryCommand = defineCommand({
|
|
|
12056
12173
|
engine: args.engine,
|
|
12057
12174
|
machineUser: args.machineuser
|
|
12058
12175
|
};
|
|
12059
|
-
if (mode.
|
|
12176
|
+
if (mode.mode === "abort") {
|
|
12177
|
+
logger.info("Editor closed without a query. Nothing was executed.");
|
|
12178
|
+
return;
|
|
12179
|
+
}
|
|
12180
|
+
if (mode.mode === "repl") {
|
|
12060
12181
|
await runRepl({
|
|
12061
12182
|
...sharedOptions,
|
|
12062
12183
|
json: args.json
|
|
@@ -12154,4 +12275,4 @@ function printGqlResult(result, options = {}) {
|
|
|
12154
12275
|
|
|
12155
12276
|
//#endregion
|
|
12156
12277
|
export { getExecutorJob as $, truncateCommand as A, getMigrationDirPath as At, getCommand$1 as B, getNamespacesWithMigrations as Bt, getAppHealth as C, MIGRATE_FILE_NAME as Ct, listCommand$3 as D, createSnapshotFromLocalTypes as Dt, resumeWorkflow as E, compareSnapshots as Et, showCommand as F, loadDiff as Ft, listMachineUsers as G, commonArgs as Gt, getMachineUserToken as H, generateUserTypes as Ht, remove as I, reconstructSnapshotFromMigrations as It, webhookCommand as J, jsonArgs as Jt, generate$1 as K, confirmationArgs as Kt, removeCommand$1 as L, formatDiffSummary as Lt, generateCommand as M, getMigrationFiles as Mt, logBetaWarning as N, getNextMigrationNumber as Nt, listWorkflows as O, formatMigrationNumber as Ot, show as P, isValidMigrationNumber as Pt, listExecutors as Q, listCommand$4 as R, formatMigrationDiff as Rt, listCommand$2 as S, INITIAL_SCHEMA_NUMBER as St, resumeCommand as T, compareLocalTypesWithSnapshot as Tt, tokenCommand as U, apiCall as Ut, getOAuth2Client as V, trnPrefix as Vt, listCommand$5 as W, apiCommand as Wt, triggerExecutor as X, workspaceArgs as Xt, triggerCommand as Y, withCommonArgs as Yt, listCommand$6 as Z, deleteCommand as _, MIGRATION_LABEL_KEY as _t, removeCommand as a, getCommand$2 as at, createWorkspace as b, DB_TYPES_FILE_NAME as bt, listUsers as c, getWorkflowExecution as ct, restoreCommand as d, formatKeyValueTable as dt, jobsCommand as et, restoreWorkspace as f, getCommand$3 as ft, getWorkspace as g, waitForExecution$1 as gt, getCommand as h, executeScript as ht, updateUser as i, startWorkflow as it, generate as j, getMigrationFilePath as jt, truncate as k, getLatestMigrationNumber as kt, inviteCommand as l, listWorkflowExecutions as lt, listWorkspaces as m, apply as mt, queryCommand as n, watchExecutorJob as nt, removeUser as o, getWorkflow as ot, listCommand$1 as p, getExecutor as pt, listWebhookExecutors as q, deploymentArgs as qt, updateCommand as r, startCommand as rt, listCommand as s, executionsCommand as st, query as t, listExecutorJobs as tt, inviteUser as u, functionExecutionStatusToString as ut, deleteWorkspace as v, parseMigrationLabelNumber as vt, healthCommand as w, SCHEMA_FILE_NAME as wt, listApps as x, DIFF_FILE_NAME as xt, createCommand as y, bundleMigrationScript as yt, listOAuth2Clients as z, hasChanges as zt };
|
|
12157
|
-
//# sourceMappingURL=query-
|
|
12278
|
+
//# sourceMappingURL=query-CV5n7DRd.mjs.map
|