@tailor-platform/sdk 1.21.0 → 1.22.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 +44 -0
- package/dist/application-CTQe2HSB.mjs +5723 -0
- package/dist/application-CTQe2HSB.mjs.map +1 -0
- package/dist/application-DdSu3baZ.mjs +8 -0
- package/dist/{brand-BZJCv6UY.mjs → brand-DyPrAzpM.mjs} +1 -1
- package/dist/{brand-BZJCv6UY.mjs.map → brand-DyPrAzpM.mjs.map} +1 -1
- package/dist/cli/index.mjs +544 -57
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +49 -8
- package/dist/cli/lib.mjs +15 -16
- package/dist/cli/lib.mjs.map +1 -1
- package/dist/configure/index.d.mts +4 -4
- package/dist/configure/index.mjs +15 -4
- package/dist/configure/index.mjs.map +1 -1
- package/dist/{enum-constants-CGVvu3dd.mjs → enum-constants-B5Nl-yzx.mjs} +1 -1
- package/dist/{enum-constants-CGVvu3dd.mjs.map → enum-constants-B5Nl-yzx.mjs.map} +1 -1
- package/dist/{file-utils-GX_tGWl4.mjs → file-utils-sEOwAdJ4.mjs} +1 -1
- package/dist/{file-utils-GX_tGWl4.mjs.map → file-utils-sEOwAdJ4.mjs.map} +1 -1
- package/dist/{index-Dn61THJK.d.mts → index-BGPX26_D.d.mts} +2 -2
- package/dist/{index-CnHd6BNg.d.mts → index-BiutQT7m.d.mts} +4 -10
- package/dist/{index-DxlmLUag.d.mts → index-ClS0NClx.d.mts} +2 -2
- package/dist/{index-BWVAwea4.d.mts → index-Cwi86SUR.d.mts} +2 -2
- package/dist/{index-oZXVKyfX.d.mts → index-DPN_P0w3.d.mts} +2 -2
- package/dist/{interceptor-D8MeZOxX.mjs → interceptor-DiARwPfw.mjs} +1 -1
- package/dist/{interceptor-D8MeZOxX.mjs.map → interceptor-DiARwPfw.mjs.map} +1 -1
- package/dist/{job-2Q82qQ6N.mjs → job-CRavYLLk.mjs} +4 -24
- package/dist/job-CRavYLLk.mjs.map +1 -0
- package/dist/kysely/index.d.mts +2 -2
- package/dist/kysely/index.mjs +2 -2
- package/dist/kysely/index.mjs.map +1 -1
- package/dist/{kysely-type-Cpq5TNGY.mjs → kysely-type-CSlcwNFH.mjs} +1 -1
- package/dist/{kysely-type-Cpq5TNGY.mjs.map → kysely-type-CSlcwNFH.mjs.map} +1 -1
- package/dist/package-json-BI0ng3_5.mjs +3 -0
- package/dist/{package-json-3H5gfhA4.mjs → package-json-iVBhE5Ef.mjs} +1 -1
- package/dist/{package-json-3H5gfhA4.mjs.map → package-json-iVBhE5Ef.mjs.map} +1 -1
- package/dist/plugin/builtin/enum-constants/index.d.mts +2 -2
- package/dist/plugin/builtin/enum-constants/index.mjs +1 -1
- package/dist/plugin/builtin/file-utils/index.d.mts +2 -2
- package/dist/plugin/builtin/file-utils/index.mjs +1 -1
- package/dist/plugin/builtin/kysely-type/index.d.mts +2 -2
- package/dist/plugin/builtin/kysely-type/index.mjs +1 -1
- 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 +1 -1
- package/dist/plugin/index.mjs +3 -3
- package/dist/plugin/index.mjs.map +1 -1
- package/dist/{update-9MTRN1UA.mjs → query-Bz2oDGhw.mjs} +915 -174
- package/dist/query-Bz2oDGhw.mjs.map +1 -0
- package/dist/{schema-D5Cpd8fQ.mjs → schema-Cjm-OvPF.mjs} +2 -2
- package/dist/{schema-D5Cpd8fQ.mjs.map → schema-Cjm-OvPF.mjs.map} +1 -1
- package/dist/{seed-D-rYCN5F.mjs → seed-CXvCW3Xc.mjs} +2 -2
- package/dist/{seed-D-rYCN5F.mjs.map → seed-CXvCW3Xc.mjs.map} +1 -1
- package/dist/telemetry-BAxP8-PR.mjs +3 -0
- package/dist/{telemetry-DuBhnd0X.mjs → telemetry-C46fds1l.mjs} +2 -2
- package/dist/{telemetry-DuBhnd0X.mjs.map → telemetry-C46fds1l.mjs.map} +1 -1
- package/dist/{types-ClK_HJ0G.mjs → types-CBTSg-LK.mjs} +1 -1
- package/dist/{types-ClK_HJ0G.mjs.map → types-CBTSg-LK.mjs.map} +1 -1
- package/dist/{types-C0o90Cmb.d.mts → types-DVMQNdTs.d.mts} +6 -2
- package/dist/{types-QKq1usl7.d.mts → types-bcuNRo1Y.d.mts} +8 -8
- package/dist/utils/test/index.d.mts +42 -4
- package/dist/utils/test/index.mjs +78 -3
- package/dist/utils/test/index.mjs.map +1 -1
- package/docs/cli/function.md +83 -3
- package/package.json +7 -5
- package/dist/application-CEv5c7TU.mjs +0 -102207
- package/dist/application-CEv5c7TU.mjs.map +0 -1
- package/dist/application-DiCzM9b0.mjs +0 -9
- package/dist/chunk-CqAI0b6X.mjs +0 -47
- package/dist/jiti-DfS9jItj.mjs +0 -4482
- package/dist/jiti-DfS9jItj.mjs.map +0 -1
- package/dist/job-2Q82qQ6N.mjs.map +0 -1
- package/dist/package-json-DTDAqRRJ.mjs +0 -3
- package/dist/src-Bb1UVstT.mjs +0 -1038
- package/dist/src-Bb1UVstT.mjs.map +0 -1
- package/dist/telemetry-Dhzj9Ncm.mjs +0 -3
- package/dist/update-9MTRN1UA.mjs.map +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { t as db } from "./schema-
|
|
2
|
-
import { $ as
|
|
3
|
-
import { t as readPackageJson } from "./package-json-
|
|
4
|
-
import { r as withSpan } from "./telemetry-
|
|
1
|
+
import { t as db } from "./schema-Cjm-OvPF.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-CTQe2HSB.mjs";
|
|
3
|
+
import { t as readPackageJson } from "./package-json-iVBhE5Ef.mjs";
|
|
4
|
+
import { r as withSpan } from "./telemetry-C46fds1l.mjs";
|
|
5
5
|
import { createRequire } from "node:module";
|
|
6
6
|
import { arg, defineCommand, runCommand } from "politty";
|
|
7
7
|
import { z } from "zod";
|
|
8
|
-
import * as fs$
|
|
8
|
+
import * as fs$1 from "node:fs";
|
|
9
9
|
import { parseEnv } from "node:util";
|
|
10
10
|
import * as path from "pathe";
|
|
11
11
|
import chalk from "chalk";
|
|
@@ -17,19 +17,48 @@ import { resolveTSConfig } from "pkg-types";
|
|
|
17
17
|
import { findUpSync } from "find-up-simple";
|
|
18
18
|
import ml from "multiline-ts";
|
|
19
19
|
import * as crypto from "node:crypto";
|
|
20
|
+
import { pathToFileURL } from "node:url";
|
|
20
21
|
import * as inflection from "inflection";
|
|
21
|
-
import * as fs$1 from "node:fs/promises";
|
|
22
|
-
import { glob } from "node:fs/promises";
|
|
23
22
|
import * as rolldown from "rolldown";
|
|
23
|
+
import * as fs from "node:fs/promises";
|
|
24
|
+
import { glob } from "node:fs/promises";
|
|
24
25
|
import { create, fromJson, toJson } from "@bufbuild/protobuf";
|
|
25
26
|
import ora from "ora";
|
|
26
27
|
import { setTimeout as setTimeout$1 } from "timers/promises";
|
|
27
28
|
import { spawn } from "node:child_process";
|
|
28
29
|
import { watch } from "chokidar";
|
|
29
30
|
import * as madgeModule from "madge";
|
|
31
|
+
import { astVisitor, parse, toSql } from "pgsql-ast-parser";
|
|
30
32
|
|
|
31
33
|
//#region src/cli/shared/errors.ts
|
|
32
34
|
/**
|
|
35
|
+
* Format CLI error for output
|
|
36
|
+
* @param error - CLIError instance to format
|
|
37
|
+
* @returns Formatted error message
|
|
38
|
+
*/
|
|
39
|
+
function formatError(error) {
|
|
40
|
+
const parts = [chalk.red(`Error${error.code ? ` [${error.code}]` : ""}: ${error.message}`)];
|
|
41
|
+
if (error.details) parts.push(`\n ${chalk.gray("Details:")} ${error.details}`);
|
|
42
|
+
if (error.suggestion) parts.push(`\n ${chalk.cyan("Suggestion:")} ${error.suggestion}`);
|
|
43
|
+
if (error.command) parts.push(`\n ${chalk.gray("Help:")} Run \`tailor-sdk ${error.command} --help\` for usage information.`);
|
|
44
|
+
return parts.join("");
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Create a CLI error with formatted output
|
|
48
|
+
* @param options - Options to construct a CLIError
|
|
49
|
+
* @returns Constructed CLIError instance
|
|
50
|
+
*/
|
|
51
|
+
function createCLIError(options) {
|
|
52
|
+
const error = new Error(options.message);
|
|
53
|
+
error.name = "CLIError";
|
|
54
|
+
error.code = options.code;
|
|
55
|
+
error.details = options.details;
|
|
56
|
+
error.suggestion = options.suggestion;
|
|
57
|
+
error.command = options.command;
|
|
58
|
+
error.format = () => formatError(error);
|
|
59
|
+
return error;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
33
62
|
* Type guard to check if an error is a CLIError
|
|
34
63
|
* @param error - Error to check
|
|
35
64
|
* @returns True if the error is a CLIError
|
|
@@ -83,11 +112,11 @@ function loadEnvFiles(envFiles, envFilesIfExists) {
|
|
|
83
112
|
const load = (files, required) => {
|
|
84
113
|
for (const file of [files ?? []].flat()) {
|
|
85
114
|
const envPath = path.resolve(process.cwd(), file);
|
|
86
|
-
if (!fs$
|
|
115
|
+
if (!fs$1.existsSync(envPath)) {
|
|
87
116
|
if (required) throw new Error(`Environment file not found: ${envPath}`);
|
|
88
117
|
continue;
|
|
89
118
|
}
|
|
90
|
-
const parsed = parseEnv(fs$
|
|
119
|
+
const parsed = parseEnv(fs$1.readFileSync(envPath, "utf-8"));
|
|
91
120
|
for (const [key, value] of Object.entries(parsed)) {
|
|
92
121
|
if (originalEnvKeys.has(key)) continue;
|
|
93
122
|
process.env[key] = value;
|
|
@@ -107,9 +136,19 @@ function loadEnvFiles(envFiles, envFilesIfExists) {
|
|
|
107
136
|
const commonArgs = {
|
|
108
137
|
"env-file": arg(z.string().optional(), {
|
|
109
138
|
alias: "e",
|
|
110
|
-
description: "Path to the environment file (error if not found)"
|
|
139
|
+
description: "Path to the environment file (error if not found)",
|
|
140
|
+
completion: {
|
|
141
|
+
type: "file",
|
|
142
|
+
matcher: [".env.*", ".env"]
|
|
143
|
+
}
|
|
144
|
+
}),
|
|
145
|
+
"env-file-if-exists": arg(z.string().optional(), {
|
|
146
|
+
description: "Path to the environment file (ignored if not found)",
|
|
147
|
+
completion: {
|
|
148
|
+
type: "file",
|
|
149
|
+
matcher: [".env.*", ".env"]
|
|
150
|
+
}
|
|
111
151
|
}),
|
|
112
|
-
"env-file-if-exists": arg(z.string().optional(), { description: "Path to the environment file (ignored if not found)" }),
|
|
113
152
|
verbose: arg(z.boolean().default(false), { description: "Enable verbose logging" })
|
|
114
153
|
};
|
|
115
154
|
/**
|
|
@@ -118,22 +157,32 @@ const commonArgs = {
|
|
|
118
157
|
const workspaceArgs = {
|
|
119
158
|
"workspace-id": arg(z.string().optional(), {
|
|
120
159
|
alias: "w",
|
|
121
|
-
description: "Workspace ID"
|
|
160
|
+
description: "Workspace ID",
|
|
161
|
+
completion: { type: "none" }
|
|
122
162
|
}),
|
|
123
163
|
profile: arg(z.string().optional(), {
|
|
124
164
|
alias: "p",
|
|
125
|
-
description: "Workspace profile"
|
|
165
|
+
description: "Workspace profile",
|
|
166
|
+
completion: { type: "none" }
|
|
126
167
|
})
|
|
127
168
|
};
|
|
128
169
|
/**
|
|
170
|
+
* Shared config arg for commands that accept a config file path
|
|
171
|
+
*/
|
|
172
|
+
const configArg = { config: arg(z.string().default("tailor.config.ts"), {
|
|
173
|
+
alias: "c",
|
|
174
|
+
description: "Path to SDK config file",
|
|
175
|
+
completion: {
|
|
176
|
+
type: "file",
|
|
177
|
+
extensions: ["ts"]
|
|
178
|
+
}
|
|
179
|
+
}) };
|
|
180
|
+
/**
|
|
129
181
|
* Arguments for commands that interact with deployed resources (includes config)
|
|
130
182
|
*/
|
|
131
183
|
const deploymentArgs = {
|
|
132
184
|
...workspaceArgs,
|
|
133
|
-
|
|
134
|
-
alias: "c",
|
|
135
|
-
description: "Path to SDK config file"
|
|
136
|
-
})
|
|
185
|
+
...configArg
|
|
137
186
|
};
|
|
138
187
|
/**
|
|
139
188
|
* Arguments for commands that require confirmation
|
|
@@ -162,7 +211,7 @@ const withCommonArgs = (handler) => async (args) => {
|
|
|
162
211
|
try {
|
|
163
212
|
if ("json" in args && typeof args.json === "boolean") logger.jsonMode = args.json;
|
|
164
213
|
loadEnvFiles(args["env-file"], args["env-file-if-exists"]);
|
|
165
|
-
const { initTelemetry } = await import("./telemetry-
|
|
214
|
+
const { initTelemetry } = await import("./telemetry-BAxP8-PR.mjs");
|
|
166
215
|
await initTelemetry();
|
|
167
216
|
await handler(args);
|
|
168
217
|
} catch (error) {
|
|
@@ -175,7 +224,7 @@ const withCommonArgs = (handler) => async (args) => {
|
|
|
175
224
|
} else logger.error(`Unknown error: ${error}`);
|
|
176
225
|
process.exit(1);
|
|
177
226
|
} finally {
|
|
178
|
-
const { shutdownTelemetry } = await import("./telemetry-
|
|
227
|
+
const { shutdownTelemetry } = await import("./telemetry-BAxP8-PR.mjs");
|
|
179
228
|
await shutdownTelemetry();
|
|
180
229
|
}
|
|
181
230
|
process.exit(0);
|
|
@@ -229,7 +278,7 @@ const apiCommand = defineCommand({
|
|
|
229
278
|
positional: true,
|
|
230
279
|
description: "API endpoint to call (e.g., 'GetApplication' or 'tailor.v1.OperatorService/GetApplication')"
|
|
231
280
|
})
|
|
232
|
-
}),
|
|
281
|
+
}).strict(),
|
|
233
282
|
run: withCommonArgs(async (args) => {
|
|
234
283
|
const result = await apiCall({
|
|
235
284
|
profile: args.profile,
|
|
@@ -283,7 +332,7 @@ function createCacheStore(config) {
|
|
|
283
332
|
}
|
|
284
333
|
function loadManifest() {
|
|
285
334
|
try {
|
|
286
|
-
const raw = fs$
|
|
335
|
+
const raw = fs$1.readFileSync(manifestPath(), "utf-8");
|
|
287
336
|
const result = cacheManifestSchema.safeParse(JSON.parse(raw));
|
|
288
337
|
if (!result.success) {
|
|
289
338
|
cachedManifest = void 0;
|
|
@@ -310,15 +359,15 @@ function createCacheStore(config) {
|
|
|
310
359
|
return cachedManifest;
|
|
311
360
|
}
|
|
312
361
|
function saveManifest(manifest) {
|
|
313
|
-
fs$
|
|
362
|
+
fs$1.mkdirSync(config.cacheDir, { recursive: true });
|
|
314
363
|
const target = manifestPath();
|
|
315
364
|
const tmpFile = path.join(config.cacheDir, `.manifest.${process.pid}.tmp`);
|
|
316
365
|
try {
|
|
317
|
-
fs$
|
|
318
|
-
fs$
|
|
366
|
+
fs$1.writeFileSync(tmpFile, JSON.stringify(manifest, null, 2), "utf-8");
|
|
367
|
+
fs$1.renameSync(tmpFile, target);
|
|
319
368
|
} catch (e) {
|
|
320
369
|
try {
|
|
321
|
-
fs$
|
|
370
|
+
fs$1.rmSync(tmpFile, { force: true });
|
|
322
371
|
} catch {}
|
|
323
372
|
throw e;
|
|
324
373
|
}
|
|
@@ -337,29 +386,29 @@ function createCacheStore(config) {
|
|
|
337
386
|
}
|
|
338
387
|
function storeBundleOutput(cacheKey, sourcePath) {
|
|
339
388
|
const dir = bundlesDir();
|
|
340
|
-
fs$
|
|
341
|
-
fs$
|
|
389
|
+
fs$1.mkdirSync(dir, { recursive: true });
|
|
390
|
+
fs$1.copyFileSync(sourcePath, bundlePath(cacheKey));
|
|
342
391
|
const mapSource = `${sourcePath}.map`;
|
|
343
392
|
const cachedMapPath = `${bundlePath(cacheKey)}.map`;
|
|
344
|
-
if (fs$
|
|
345
|
-
else fs$
|
|
393
|
+
if (fs$1.existsSync(mapSource)) fs$1.copyFileSync(mapSource, cachedMapPath);
|
|
394
|
+
else fs$1.rmSync(cachedMapPath, { force: true });
|
|
346
395
|
}
|
|
347
396
|
function restoreBundleOutput(cacheKey, targetPath) {
|
|
348
397
|
const cached = bundlePath(cacheKey);
|
|
349
398
|
const targetDir = path.dirname(targetPath);
|
|
350
|
-
fs$
|
|
399
|
+
fs$1.mkdirSync(targetDir, { recursive: true });
|
|
351
400
|
try {
|
|
352
|
-
fs$
|
|
401
|
+
fs$1.copyFileSync(cached, targetPath);
|
|
353
402
|
} catch (e) {
|
|
354
403
|
if (e.code === "ENOENT") return false;
|
|
355
404
|
throw e;
|
|
356
405
|
}
|
|
357
406
|
const cachedMap = `${cached}.map`;
|
|
358
|
-
if (fs$
|
|
407
|
+
if (fs$1.existsSync(cachedMap)) fs$1.copyFileSync(cachedMap, `${targetPath}.map`);
|
|
359
408
|
return true;
|
|
360
409
|
}
|
|
361
410
|
function clean() {
|
|
362
|
-
fs$
|
|
411
|
+
fs$1.rmSync(config.cacheDir, {
|
|
363
412
|
recursive: true,
|
|
364
413
|
force: true
|
|
365
414
|
});
|
|
@@ -536,8 +585,8 @@ async function generateUserTypes(options) {
|
|
|
536
585
|
if (env) logger.debug(`Extracted Env: ${JSON.stringify(env)}`);
|
|
537
586
|
const typeDefContent = generateTypeDefinition(attributeMap, attributeList, env);
|
|
538
587
|
const outputPath = resolveTypeDefinitionPath(configPath);
|
|
539
|
-
fs$
|
|
540
|
-
fs$
|
|
588
|
+
fs$1.mkdirSync(path.dirname(outputPath), { recursive: true });
|
|
589
|
+
fs$1.writeFileSync(outputPath, typeDefContent);
|
|
541
590
|
const relativePath = path.relative(process.cwd(), outputPath);
|
|
542
591
|
logger.newline();
|
|
543
592
|
logger.success(`Generated type definitions: ${relativePath}`, { mode: "plain" });
|
|
@@ -552,7 +601,7 @@ function resolvePackageDirectory(startDir) {
|
|
|
552
601
|
while (true) {
|
|
553
602
|
const candidate = path.join(currentDir, "node_modules", "@tailor-platform", "sdk");
|
|
554
603
|
const packageJsonPath = path.join(candidate, "package.json");
|
|
555
|
-
if (fs$
|
|
604
|
+
if (fs$1.existsSync(packageJsonPath)) return candidate;
|
|
556
605
|
if (currentDir === root) break;
|
|
557
606
|
currentDir = path.dirname(currentDir);
|
|
558
607
|
}
|
|
@@ -999,6 +1048,10 @@ async function planApplication(context) {
|
|
|
999
1048
|
changeSet.print();
|
|
1000
1049
|
return changeSet;
|
|
1001
1050
|
}
|
|
1051
|
+
if (application.subgraphs.length === 0) {
|
|
1052
|
+
changeSet.print();
|
|
1053
|
+
return changeSet;
|
|
1054
|
+
}
|
|
1002
1055
|
let authNamespace;
|
|
1003
1056
|
let authIdpConfigName;
|
|
1004
1057
|
if (application.authService && application.authService.config) {
|
|
@@ -2352,6 +2405,73 @@ async function confirmImportantResourceDeletion(resources, yes) {
|
|
|
2352
2405
|
`);
|
|
2353
2406
|
}
|
|
2354
2407
|
|
|
2408
|
+
//#endregion
|
|
2409
|
+
//#region src/cli/shared/runtime-args.ts
|
|
2410
|
+
/**
|
|
2411
|
+
* Runtime args transformation for all services.
|
|
2412
|
+
*
|
|
2413
|
+
* Each service transforms server-side args/context into SDK-friendly format:
|
|
2414
|
+
* - Executor: server-side expression evaluated by platform before calling function
|
|
2415
|
+
* - Resolver: operationHook expression evaluated by platform before calling function
|
|
2416
|
+
*
|
|
2417
|
+
* The user field mapping (server → SDK) shared across services is defined in
|
|
2418
|
+
* `@/parser/service/tailordb` as `tailorUserMap`.
|
|
2419
|
+
*/
|
|
2420
|
+
/**
|
|
2421
|
+
* Actor field transformation expression.
|
|
2422
|
+
*
|
|
2423
|
+
* Transforms the server's actor object to match the SDK's TailorActor type:
|
|
2424
|
+
* server `attributeMap` → SDK `attributes`
|
|
2425
|
+
* server `attributes` → SDK `attributeList`
|
|
2426
|
+
* other fields → passed through
|
|
2427
|
+
* null/undefined actor → null
|
|
2428
|
+
*/
|
|
2429
|
+
const ACTOR_TRANSFORM_EXPR = "actor: args.actor ? (({ attributeMap, attributes: attrList, ...rest }) => ({ ...rest, attributes: attributeMap, attributeList: attrList }))(args.actor) : null";
|
|
2430
|
+
/**
|
|
2431
|
+
* Build the JavaScript expression that transforms server-format executor event
|
|
2432
|
+
* args into SDK-format args at runtime.
|
|
2433
|
+
*
|
|
2434
|
+
* The Tailor Platform server delivers event args with server-side field names.
|
|
2435
|
+
* The SDK exposes different field names to user code. This function produces a
|
|
2436
|
+
* JavaScript expression string that performs the mapping when evaluated
|
|
2437
|
+
* server-side.
|
|
2438
|
+
* @param triggerKind - The trigger kind discriminant from the parsed executor
|
|
2439
|
+
* @param env - Application env record to embed in the expression
|
|
2440
|
+
* @returns A JavaScript expression string, e.g. `({ ...args, ... })`
|
|
2441
|
+
*/
|
|
2442
|
+
function buildExecutorArgsExpr(triggerKind, env) {
|
|
2443
|
+
const envExpr = `env: ${JSON.stringify(env)}`;
|
|
2444
|
+
switch (triggerKind) {
|
|
2445
|
+
case "schedule":
|
|
2446
|
+
case "recordCreated":
|
|
2447
|
+
case "recordUpdated":
|
|
2448
|
+
case "recordDeleted":
|
|
2449
|
+
case "idpUserCreated":
|
|
2450
|
+
case "idpUserUpdated":
|
|
2451
|
+
case "idpUserDeleted":
|
|
2452
|
+
case "authAccessTokenIssued":
|
|
2453
|
+
case "authAccessTokenRefreshed":
|
|
2454
|
+
case "authAccessTokenRevoked": return `({ ...args, appNamespace: args.namespaceName, ${ACTOR_TRANSFORM_EXPR}, ${envExpr} })`;
|
|
2455
|
+
case "resolverExecuted": return `({ ...args, appNamespace: args.namespaceName, ${ACTOR_TRANSFORM_EXPR}, success: !!args.succeeded, result: args.succeeded?.result.resolver, error: args.failed?.error, ${envExpr} })`;
|
|
2456
|
+
case "incomingWebhook": return `({ ...args, appNamespace: args.namespaceName, rawBody: args.raw_body, ${envExpr} })`;
|
|
2457
|
+
default: throw new Error(`Unknown trigger kind for args expression: ${triggerKind}`);
|
|
2458
|
+
}
|
|
2459
|
+
}
|
|
2460
|
+
/**
|
|
2461
|
+
* Build the operationHook expression for resolver pipelines.
|
|
2462
|
+
*
|
|
2463
|
+
* Transforms server context to SDK resolver context:
|
|
2464
|
+
* context.args → input
|
|
2465
|
+
* context.pipeline → spread into result
|
|
2466
|
+
* user (global var) → TailorUser (via tailorUserMap: workspace_id→workspaceId, attribute_map→attributes, attributes→attributeList)
|
|
2467
|
+
* env → injected as JSON
|
|
2468
|
+
* @param env - Application env record to embed in the expression
|
|
2469
|
+
* @returns A JavaScript expression string for the operationHook
|
|
2470
|
+
*/
|
|
2471
|
+
function buildResolverOperationHookExpr(env) {
|
|
2472
|
+
return `({ ...context.pipeline, input: context.args, user: ${tailorUserMap}, env: ${JSON.stringify(env)} });`;
|
|
2473
|
+
}
|
|
2474
|
+
|
|
2355
2475
|
//#endregion
|
|
2356
2476
|
//#region src/cli/commands/apply/function-registry.ts
|
|
2357
2477
|
const CHUNK_SIZE = 64 * 1024;
|
|
@@ -2403,7 +2523,7 @@ function collectFunctionEntries(application, workflowJobs) {
|
|
|
2403
2523
|
for (const app of application.applications) for (const pipeline of app.resolverServices) for (const resolver of Object.values(pipeline.resolvers)) {
|
|
2404
2524
|
const scriptPath = path.join(distDir, "resolvers", `${resolver.name}.js`);
|
|
2405
2525
|
try {
|
|
2406
|
-
const content = fs$
|
|
2526
|
+
const content = fs$1.readFileSync(scriptPath, "utf-8");
|
|
2407
2527
|
entries.push({
|
|
2408
2528
|
name: resolverFunctionName(pipeline.namespace, resolver.name),
|
|
2409
2529
|
scriptContent: content,
|
|
@@ -2419,7 +2539,7 @@ function collectFunctionEntries(application, workflowJobs) {
|
|
|
2419
2539
|
for (const executor of Object.values(executors)) if (executor.operation.kind === "function" || executor.operation.kind === "jobFunction") {
|
|
2420
2540
|
const scriptPath = path.join(distDir, "executors", `${executor.name}.js`);
|
|
2421
2541
|
try {
|
|
2422
|
-
const content = fs$
|
|
2542
|
+
const content = fs$1.readFileSync(scriptPath, "utf-8");
|
|
2423
2543
|
entries.push({
|
|
2424
2544
|
name: executorFunctionName(executor.name),
|
|
2425
2545
|
scriptContent: content,
|
|
@@ -2434,7 +2554,7 @@ function collectFunctionEntries(application, workflowJobs) {
|
|
|
2434
2554
|
for (const job of workflowJobs) {
|
|
2435
2555
|
const scriptPath = path.join(distDir, "workflow-jobs", `${job.name}.js`);
|
|
2436
2556
|
try {
|
|
2437
|
-
const content = fs$
|
|
2557
|
+
const content = fs$1.readFileSync(scriptPath, "utf-8");
|
|
2438
2558
|
entries.push({
|
|
2439
2559
|
name: workflowJobFunctionName(job.name),
|
|
2440
2560
|
scriptContent: content,
|
|
@@ -3725,7 +3845,7 @@ function createSnapshotFromLocalTypes(types, namespace) {
|
|
|
3725
3845
|
* @returns {SchemaSnapshot} Loaded schema snapshot
|
|
3726
3846
|
*/
|
|
3727
3847
|
function loadSnapshot(filePath) {
|
|
3728
|
-
const content = fs$
|
|
3848
|
+
const content = fs$1.readFileSync(filePath, "utf-8");
|
|
3729
3849
|
return JSON.parse(content);
|
|
3730
3850
|
}
|
|
3731
3851
|
/**
|
|
@@ -3734,7 +3854,7 @@ function loadSnapshot(filePath) {
|
|
|
3734
3854
|
* @returns {MigrationDiff} Loaded migration diff
|
|
3735
3855
|
*/
|
|
3736
3856
|
function loadDiff(filePath) {
|
|
3737
|
-
const content = fs$
|
|
3857
|
+
const content = fs$1.readFileSync(filePath, "utf-8");
|
|
3738
3858
|
return JSON.parse(content);
|
|
3739
3859
|
}
|
|
3740
3860
|
/**
|
|
@@ -3743,8 +3863,8 @@ function loadDiff(filePath) {
|
|
|
3743
3863
|
* @returns {Array<{number: number, type: "schema" | "diff", path: string}>} Migration files sorted by number
|
|
3744
3864
|
*/
|
|
3745
3865
|
function getMigrationFiles(migrationsDir) {
|
|
3746
|
-
if (!fs$
|
|
3747
|
-
const entries = fs$
|
|
3866
|
+
if (!fs$1.existsSync(migrationsDir)) return [];
|
|
3867
|
+
const entries = fs$1.readdirSync(migrationsDir, { withFileTypes: true });
|
|
3748
3868
|
const migrations = [];
|
|
3749
3869
|
for (const entry of entries) {
|
|
3750
3870
|
if (!entry.isDirectory()) continue;
|
|
@@ -3752,13 +3872,13 @@ function getMigrationFiles(migrationsDir) {
|
|
|
3752
3872
|
const num = parseInt(entry.name, 10);
|
|
3753
3873
|
const migrationDir = path.join(migrationsDir, entry.name);
|
|
3754
3874
|
const schemaPath = path.join(migrationDir, SCHEMA_FILE_NAME);
|
|
3755
|
-
if (fs$
|
|
3875
|
+
if (fs$1.existsSync(schemaPath)) migrations.push({
|
|
3756
3876
|
number: num,
|
|
3757
3877
|
type: "schema",
|
|
3758
3878
|
path: schemaPath
|
|
3759
3879
|
});
|
|
3760
3880
|
const diffPath = path.join(migrationDir, DIFF_FILE_NAME);
|
|
3761
|
-
if (fs$
|
|
3881
|
+
if (fs$1.existsSync(diffPath)) migrations.push({
|
|
3762
3882
|
number: num,
|
|
3763
3883
|
type: "diff",
|
|
3764
3884
|
path: diffPath
|
|
@@ -4330,7 +4450,7 @@ function compareLocalTypesWithSnapshot(snapshot, localTypes, namespace) {
|
|
|
4330
4450
|
*/
|
|
4331
4451
|
function validateMigrationFiles(migrationsDir) {
|
|
4332
4452
|
const errors = [];
|
|
4333
|
-
if (!fs$
|
|
4453
|
+
if (!fs$1.existsSync(migrationsDir)) return errors;
|
|
4334
4454
|
const migrationFiles = getMigrationFiles(migrationsDir);
|
|
4335
4455
|
if (migrationFiles.length === 0) return errors;
|
|
4336
4456
|
const schemaFiles = [];
|
|
@@ -4573,7 +4693,7 @@ function formatSchemaDrifts(drifts) {
|
|
|
4573
4693
|
*/
|
|
4574
4694
|
async function bundleMigrationScript(sourceFile, namespace, migrationNumber) {
|
|
4575
4695
|
const outputDir = path.resolve(getDistDir(), "migrations");
|
|
4576
|
-
fs$
|
|
4696
|
+
fs$1.mkdirSync(outputDir, { recursive: true });
|
|
4577
4697
|
const entryPath = path.join(outputDir, `migration_${namespace}_${migrationNumber}.entry.js`);
|
|
4578
4698
|
const outputPath = path.join(outputDir, `migration_${namespace}_${migrationNumber}.js`);
|
|
4579
4699
|
const entryContent = ml`
|
|
@@ -4595,7 +4715,7 @@ async function bundleMigrationScript(sourceFile, namespace, migrationNumber) {
|
|
|
4595
4715
|
return { success: true };
|
|
4596
4716
|
}
|
|
4597
4717
|
`;
|
|
4598
|
-
fs$
|
|
4718
|
+
fs$1.writeFileSync(entryPath, entryContent);
|
|
4599
4719
|
let tsconfig;
|
|
4600
4720
|
try {
|
|
4601
4721
|
tsconfig = await resolveTSConfig();
|
|
@@ -4625,7 +4745,7 @@ async function bundleMigrationScript(sourceFile, namespace, migrationNumber) {
|
|
|
4625
4745
|
return {
|
|
4626
4746
|
namespace,
|
|
4627
4747
|
migrationNumber,
|
|
4628
|
-
bundledCode: fs$
|
|
4748
|
+
bundledCode: fs$1.readFileSync(outputPath, "utf-8")
|
|
4629
4749
|
};
|
|
4630
4750
|
}
|
|
4631
4751
|
|
|
@@ -4687,7 +4807,7 @@ async function waitForExecution$1(client, workspaceId, executionId, pollInterval
|
|
|
4687
4807
|
logs: execution.logs,
|
|
4688
4808
|
result: execution.result
|
|
4689
4809
|
};
|
|
4690
|
-
await new Promise((resolve) => setTimeout(resolve, pollInterval));
|
|
4810
|
+
await new Promise((resolve$1) => setTimeout(resolve$1, pollInterval));
|
|
4691
4811
|
}
|
|
4692
4812
|
}
|
|
4693
4813
|
/**
|
|
@@ -4702,28 +4822,26 @@ async function waitForExecution$1(client, workspaceId, executionId, pollInterval
|
|
|
4702
4822
|
*/
|
|
4703
4823
|
async function executeScript(options) {
|
|
4704
4824
|
const { client, workspaceId, name, code, arg: arg$1, invoker, pollInterval } = options;
|
|
4705
|
-
const
|
|
4825
|
+
const response = await client.testExecScript({
|
|
4706
4826
|
workspaceId,
|
|
4707
4827
|
name,
|
|
4708
4828
|
code,
|
|
4709
4829
|
arg: arg$1 ?? JSON.stringify({}),
|
|
4710
4830
|
invoker
|
|
4711
|
-
})
|
|
4831
|
+
});
|
|
4832
|
+
const executionId = response.executionId;
|
|
4712
4833
|
const result = await waitForExecution$1(client, workspaceId, executionId, pollInterval);
|
|
4713
4834
|
if (result.status === FunctionExecution_Status.SUCCESS) return {
|
|
4714
4835
|
success: true,
|
|
4715
4836
|
logs: result.logs,
|
|
4716
4837
|
result: result.result
|
|
4717
4838
|
};
|
|
4718
|
-
else {
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
error: errorDetails || "Script execution failed with unknown error"
|
|
4725
|
-
};
|
|
4726
|
-
}
|
|
4839
|
+
else return {
|
|
4840
|
+
success: false,
|
|
4841
|
+
logs: result.logs,
|
|
4842
|
+
result: result.result || response.result,
|
|
4843
|
+
error: result.result || response.result || "Script execution failed with unknown error"
|
|
4844
|
+
};
|
|
4727
4845
|
}
|
|
4728
4846
|
|
|
4729
4847
|
//#endregion
|
|
@@ -4766,10 +4884,10 @@ async function detectPendingMigrations(client, workspaceId, namespacesWithMigrat
|
|
|
4766
4884
|
for (const file of migrationFiles) {
|
|
4767
4885
|
if (file.number <= currentMigration) continue;
|
|
4768
4886
|
const diffPath = getMigrationFilePath(migrationsDir, file.number, "diff");
|
|
4769
|
-
if (!fs$
|
|
4887
|
+
if (!fs$1.existsSync(diffPath)) continue;
|
|
4770
4888
|
const diff = loadDiff(diffPath);
|
|
4771
4889
|
const scriptPath = getMigrationFilePath(migrationsDir, file.number, "migrate");
|
|
4772
|
-
if (diff.requiresMigrationScript && !fs$
|
|
4890
|
+
if (diff.requiresMigrationScript && !fs$1.existsSync(scriptPath)) {
|
|
4773
4891
|
logger.warn(`Migration ${namespace}/${file.number} requires a script but migrate.ts not found`);
|
|
4774
4892
|
continue;
|
|
4775
4893
|
}
|
|
@@ -6228,7 +6346,7 @@ async function apply(options) {
|
|
|
6228
6346
|
const packageJson = await readPackageJson();
|
|
6229
6347
|
const cacheDir = path.resolve(getDistDir(), "cache");
|
|
6230
6348
|
if (options?.cleanCache) {
|
|
6231
|
-
fs$
|
|
6349
|
+
fs$1.rmSync(cacheDir, {
|
|
6232
6350
|
recursive: true,
|
|
6233
6351
|
force: true
|
|
6234
6352
|
});
|
|
@@ -6718,7 +6836,7 @@ const getCommand$3 = defineCommand({
|
|
|
6718
6836
|
...jsonArgs,
|
|
6719
6837
|
...workspaceArgs,
|
|
6720
6838
|
...nameArgs$1
|
|
6721
|
-
}),
|
|
6839
|
+
}).strict(),
|
|
6722
6840
|
run: withCommonArgs(async (args) => {
|
|
6723
6841
|
const executor = await getExecutor({
|
|
6724
6842
|
name: args.name,
|
|
@@ -6921,7 +7039,7 @@ function toWorkflowExecutionInfo(execution) {
|
|
|
6921
7039
|
//#endregion
|
|
6922
7040
|
//#region src/cli/commands/workflow/executions.ts
|
|
6923
7041
|
function sleep$1(ms) {
|
|
6924
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
7042
|
+
return new Promise((resolve$1) => setTimeout(resolve$1, ms));
|
|
6925
7043
|
}
|
|
6926
7044
|
function formatTime$2(date) {
|
|
6927
7045
|
return date.toLocaleTimeString("en-US", { hour12: false });
|
|
@@ -7136,7 +7254,7 @@ const executionsCommand = defineCommand({
|
|
|
7136
7254
|
}),
|
|
7137
7255
|
...waitArgs,
|
|
7138
7256
|
logs: arg(z.boolean().default(false), { description: "Display job execution logs (detail mode only)" })
|
|
7139
|
-
}),
|
|
7257
|
+
}).strict(),
|
|
7140
7258
|
run: withCommonArgs(async (args) => {
|
|
7141
7259
|
if (args.executionId) {
|
|
7142
7260
|
const interval = parseDuration(args.interval);
|
|
@@ -7205,7 +7323,7 @@ const getCommand$2 = defineCommand({
|
|
|
7205
7323
|
...jsonArgs,
|
|
7206
7324
|
...workspaceArgs,
|
|
7207
7325
|
...nameArgs
|
|
7208
|
-
}),
|
|
7326
|
+
}).strict(),
|
|
7209
7327
|
run: withCommonArgs(async (args) => {
|
|
7210
7328
|
const workflow = await getWorkflow({
|
|
7211
7329
|
name: args.name,
|
|
@@ -7219,7 +7337,7 @@ const getCommand$2 = defineCommand({
|
|
|
7219
7337
|
//#endregion
|
|
7220
7338
|
//#region src/cli/commands/workflow/start.ts
|
|
7221
7339
|
function sleep(ms) {
|
|
7222
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
7340
|
+
return new Promise((resolve$1) => setTimeout(resolve$1, ms));
|
|
7223
7341
|
}
|
|
7224
7342
|
function formatTime$1(date) {
|
|
7225
7343
|
return date.toLocaleTimeString("en-US", { hour12: false });
|
|
@@ -7391,7 +7509,7 @@ const startCommand = defineCommand({
|
|
|
7391
7509
|
description: "Workflow argument (JSON string)"
|
|
7392
7510
|
}),
|
|
7393
7511
|
...waitArgs
|
|
7394
|
-
}),
|
|
7512
|
+
}).strict(),
|
|
7395
7513
|
run: withCommonArgs(async (args) => {
|
|
7396
7514
|
const { executionId, wait } = await startWorkflowByName({
|
|
7397
7515
|
name: args.name,
|
|
@@ -7725,7 +7843,7 @@ const jobsCommand = defineCommand({
|
|
|
7725
7843
|
description: "Display function execution logs after completion (requires --wait)"
|
|
7726
7844
|
}),
|
|
7727
7845
|
limit: arg(positiveIntArg.optional(), { description: "Maximum number of jobs to list (default: 50, max: 1000) (list mode only)" })
|
|
7728
|
-
}),
|
|
7846
|
+
}).strict(),
|
|
7729
7847
|
run: withCommonArgs(async (args) => {
|
|
7730
7848
|
if (args.jobId) {
|
|
7731
7849
|
if (args.wait) {
|
|
@@ -7829,7 +7947,7 @@ const listCommand$6 = defineCommand({
|
|
|
7829
7947
|
...commonArgs,
|
|
7830
7948
|
...jsonArgs,
|
|
7831
7949
|
...workspaceArgs
|
|
7832
|
-
}),
|
|
7950
|
+
}).strict(),
|
|
7833
7951
|
run: withCommonArgs(async (args) => {
|
|
7834
7952
|
const executors = await listExecutors({
|
|
7835
7953
|
workspaceId: args["workspace-id"],
|
|
@@ -7974,7 +8092,7 @@ The \`--logs\` option displays logs from the downstream execution when available
|
|
|
7974
8092
|
alias: "l",
|
|
7975
8093
|
description: "Display function execution logs after completion (requires --wait)"
|
|
7976
8094
|
})
|
|
7977
|
-
}),
|
|
8095
|
+
}).strict(),
|
|
7978
8096
|
run: withCommonArgs(async (args) => {
|
|
7979
8097
|
const client = await initOperatorClient(await loadAccessToken({
|
|
7980
8098
|
useProfile: true,
|
|
@@ -8104,7 +8222,7 @@ const listWebhookCommand = defineCommand({
|
|
|
8104
8222
|
...commonArgs,
|
|
8105
8223
|
...jsonArgs,
|
|
8106
8224
|
...workspaceArgs
|
|
8107
|
-
}),
|
|
8225
|
+
}).strict(),
|
|
8108
8226
|
run: withCommonArgs(async (args) => {
|
|
8109
8227
|
const executors = await listWebhookExecutors({
|
|
8110
8228
|
workspaceId: args["workspace-id"],
|
|
@@ -8532,7 +8650,7 @@ function createDependencyWatcher(options = {}) {
|
|
|
8532
8650
|
function createGenerationManager(params) {
|
|
8533
8651
|
const { application, config, generators = [], pluginManager } = params;
|
|
8534
8652
|
const baseDir = path.join(getDistDir(), "generated");
|
|
8535
|
-
fs$
|
|
8653
|
+
fs$1.mkdirSync(baseDir, { recursive: true });
|
|
8536
8654
|
const services = {
|
|
8537
8655
|
tailordb: {},
|
|
8538
8656
|
resolver: {},
|
|
@@ -8752,14 +8870,14 @@ function createGenerationManager(params) {
|
|
|
8752
8870
|
*/
|
|
8753
8871
|
async function writeGeneratedFiles(sourceId, result) {
|
|
8754
8872
|
await Promise.all(result.files.map(async (file) => {
|
|
8755
|
-
fs$
|
|
8756
|
-
return new Promise((resolve, reject) => {
|
|
8757
|
-
if (file.skipIfExists && fs$
|
|
8873
|
+
fs$1.mkdirSync(path.dirname(file.path), { recursive: true });
|
|
8874
|
+
return new Promise((resolve$1, reject) => {
|
|
8875
|
+
if (file.skipIfExists && fs$1.existsSync(file.path)) {
|
|
8758
8876
|
const relativePath = path.relative(process.cwd(), file.path);
|
|
8759
8877
|
logger.debug(`${sourceId} | skip existing: ${relativePath}`);
|
|
8760
|
-
return resolve();
|
|
8878
|
+
return resolve$1();
|
|
8761
8879
|
}
|
|
8762
|
-
fs$
|
|
8880
|
+
fs$1.writeFile(file.path, file.content, (err) => {
|
|
8763
8881
|
if (err) {
|
|
8764
8882
|
const relativePath = path.relative(process.cwd(), file.path);
|
|
8765
8883
|
logger.error(`Error writing file ${styles.bold(relativePath)}`);
|
|
@@ -8768,15 +8886,15 @@ function createGenerationManager(params) {
|
|
|
8768
8886
|
} else {
|
|
8769
8887
|
const relativePath = path.relative(process.cwd(), file.path);
|
|
8770
8888
|
logger.log(`${sourceId} | generate: ${styles.success(relativePath)}`);
|
|
8771
|
-
if (file.executable) fs$
|
|
8889
|
+
if (file.executable) fs$1.chmod(file.path, 493, (chmodErr) => {
|
|
8772
8890
|
if (chmodErr) {
|
|
8773
8891
|
const relativePath$1 = path.relative(process.cwd(), file.path);
|
|
8774
8892
|
logger.error(`Error setting executable permission on ${styles.bold(relativePath$1)}`);
|
|
8775
8893
|
logger.error(String(chmodErr));
|
|
8776
8894
|
reject(chmodErr);
|
|
8777
|
-
} else resolve();
|
|
8895
|
+
} else resolve$1();
|
|
8778
8896
|
});
|
|
8779
|
-
else resolve();
|
|
8897
|
+
else resolve$1();
|
|
8780
8898
|
}
|
|
8781
8899
|
});
|
|
8782
8900
|
});
|
|
@@ -9040,7 +9158,7 @@ const listCommand$5 = defineCommand({
|
|
|
9040
9158
|
...commonArgs,
|
|
9041
9159
|
...jsonArgs,
|
|
9042
9160
|
...deploymentArgs
|
|
9043
|
-
}),
|
|
9161
|
+
}).strict(),
|
|
9044
9162
|
run: withCommonArgs(async (args) => {
|
|
9045
9163
|
const machineUsers = await listMachineUsers({
|
|
9046
9164
|
workspaceId: args["workspace-id"],
|
|
@@ -9102,7 +9220,7 @@ const tokenCommand = defineCommand({
|
|
|
9102
9220
|
positional: true,
|
|
9103
9221
|
description: "Machine user name"
|
|
9104
9222
|
})
|
|
9105
|
-
}),
|
|
9223
|
+
}).strict(),
|
|
9106
9224
|
run: withCommonArgs(async (args) => {
|
|
9107
9225
|
const token = await getMachineUserToken({
|
|
9108
9226
|
name: args.name,
|
|
@@ -9205,7 +9323,7 @@ const getCommand$1 = defineCommand({
|
|
|
9205
9323
|
positional: true,
|
|
9206
9324
|
description: "OAuth2 client name"
|
|
9207
9325
|
})
|
|
9208
|
-
}),
|
|
9326
|
+
}).strict(),
|
|
9209
9327
|
run: withCommonArgs(async (args) => {
|
|
9210
9328
|
const credentials = await getOAuth2Client({
|
|
9211
9329
|
name: args.name,
|
|
@@ -9256,7 +9374,7 @@ const listCommand$4 = defineCommand({
|
|
|
9256
9374
|
...commonArgs,
|
|
9257
9375
|
...jsonArgs,
|
|
9258
9376
|
...deploymentArgs
|
|
9259
|
-
}),
|
|
9377
|
+
}).strict(),
|
|
9260
9378
|
run: withCommonArgs(async (args) => {
|
|
9261
9379
|
const oauth2Clients = await listOAuth2Clients({
|
|
9262
9380
|
workspaceId: args["workspace-id"],
|
|
@@ -9269,7 +9387,7 @@ const listCommand$4 = defineCommand({
|
|
|
9269
9387
|
|
|
9270
9388
|
//#endregion
|
|
9271
9389
|
//#region src/cli/commands/remove.ts
|
|
9272
|
-
async function loadOptions$
|
|
9390
|
+
async function loadOptions$10(options) {
|
|
9273
9391
|
const client = await initOperatorClient(await loadAccessToken({
|
|
9274
9392
|
useProfile: true,
|
|
9275
9393
|
profile: options?.profile
|
|
@@ -9325,7 +9443,7 @@ async function execRemove(client, workspaceId, application, config, confirm) {
|
|
|
9325
9443
|
* @returns Promise that resolves when removal completes
|
|
9326
9444
|
*/
|
|
9327
9445
|
async function remove(options) {
|
|
9328
|
-
const { client, workspaceId, application, config } = await loadOptions$
|
|
9446
|
+
const { client, workspaceId, application, config } = await loadOptions$10(options);
|
|
9329
9447
|
await execRemove(client, workspaceId, application, config);
|
|
9330
9448
|
}
|
|
9331
9449
|
const removeCommand$1 = defineCommand({
|
|
@@ -9335,9 +9453,9 @@ const removeCommand$1 = defineCommand({
|
|
|
9335
9453
|
...commonArgs,
|
|
9336
9454
|
...deploymentArgs,
|
|
9337
9455
|
...confirmationArgs
|
|
9338
|
-
}),
|
|
9456
|
+
}).strict(),
|
|
9339
9457
|
run: withCommonArgs(async (args) => {
|
|
9340
|
-
const { client, workspaceId, application, config } = await loadOptions$
|
|
9458
|
+
const { client, workspaceId, application, config } = await loadOptions$10({
|
|
9341
9459
|
workspaceId: args["workspace-id"],
|
|
9342
9460
|
profile: args.profile,
|
|
9343
9461
|
configPath: args.config
|
|
@@ -9409,7 +9527,7 @@ const showCommand = defineCommand({
|
|
|
9409
9527
|
...commonArgs,
|
|
9410
9528
|
...jsonArgs,
|
|
9411
9529
|
...deploymentArgs
|
|
9412
|
-
}),
|
|
9530
|
+
}).strict(),
|
|
9413
9531
|
run: withCommonArgs(async (args) => {
|
|
9414
9532
|
const appInfo$1 = await show({
|
|
9415
9533
|
workspaceId: args["workspace-id"],
|
|
@@ -9670,7 +9788,7 @@ function generateFieldType(config, isOptionalToRequired, enumValueChange) {
|
|
|
9670
9788
|
async function writeDbTypesFile(snapshot, migrationsDir, migrationNumber, diff) {
|
|
9671
9789
|
const content = generateDbTypesFromSnapshot(snapshot, diff);
|
|
9672
9790
|
const filePath = getMigrationFilePath(migrationsDir, migrationNumber, "db");
|
|
9673
|
-
await fs
|
|
9791
|
+
await fs.writeFile(filePath, content);
|
|
9674
9792
|
return filePath;
|
|
9675
9793
|
}
|
|
9676
9794
|
|
|
@@ -9692,7 +9810,7 @@ async function writeDbTypesFile(snapshot, migrationsDir, migrationNumber, diff)
|
|
|
9692
9810
|
*/
|
|
9693
9811
|
async function fileExists(filePath) {
|
|
9694
9812
|
try {
|
|
9695
|
-
await fs
|
|
9813
|
+
await fs.access(filePath);
|
|
9696
9814
|
return true;
|
|
9697
9815
|
} catch {
|
|
9698
9816
|
return false;
|
|
@@ -9715,10 +9833,10 @@ async function ensureFileNotExists(filePath) {
|
|
|
9715
9833
|
*/
|
|
9716
9834
|
async function generateSchemaFile(snapshot, migrationsDir, migrationNumber) {
|
|
9717
9835
|
const migrationDir = getMigrationDirPath(migrationsDir, migrationNumber);
|
|
9718
|
-
await fs
|
|
9836
|
+
await fs.mkdir(migrationDir, { recursive: true });
|
|
9719
9837
|
const filePath = getMigrationFilePath(migrationsDir, migrationNumber, "schema");
|
|
9720
9838
|
await ensureFileNotExists(filePath);
|
|
9721
|
-
await fs
|
|
9839
|
+
await fs.writeFile(filePath, JSON.stringify(snapshot, null, 2));
|
|
9722
9840
|
return {
|
|
9723
9841
|
filePath,
|
|
9724
9842
|
migrationNumber
|
|
@@ -9735,7 +9853,7 @@ async function generateSchemaFile(snapshot, migrationsDir, migrationNumber) {
|
|
|
9735
9853
|
*/
|
|
9736
9854
|
async function generateDiffFiles(diff, migrationsDir, migrationNumber, previousSnapshot, description) {
|
|
9737
9855
|
const migrationDir = getMigrationDirPath(migrationsDir, migrationNumber);
|
|
9738
|
-
await fs
|
|
9856
|
+
await fs.mkdir(migrationDir, { recursive: true });
|
|
9739
9857
|
const diffFilePath = getMigrationFilePath(migrationsDir, migrationNumber, "diff");
|
|
9740
9858
|
const migrateFilePath = getMigrationFilePath(migrationsDir, migrationNumber, "migrate");
|
|
9741
9859
|
const dbTypesFilePath = getMigrationFilePath(migrationsDir, migrationNumber, "db");
|
|
@@ -9748,14 +9866,14 @@ async function generateDiffFiles(diff, migrationsDir, migrationNumber, previousS
|
|
|
9748
9866
|
...diff,
|
|
9749
9867
|
description
|
|
9750
9868
|
};
|
|
9751
|
-
await fs
|
|
9869
|
+
await fs.writeFile(diffFilePath, JSON.stringify(diff, null, 2));
|
|
9752
9870
|
const result = {
|
|
9753
9871
|
diffFilePath,
|
|
9754
9872
|
migrationNumber
|
|
9755
9873
|
};
|
|
9756
9874
|
if (diff.requiresMigrationScript) {
|
|
9757
9875
|
const scriptContent = generateMigrationScript(diff);
|
|
9758
|
-
await fs
|
|
9876
|
+
await fs.writeFile(migrateFilePath, scriptContent);
|
|
9759
9877
|
result.migrateFilePath = migrateFilePath;
|
|
9760
9878
|
await writeDbTypesFile(previousSnapshot, migrationsDir, migrationNumber, diff);
|
|
9761
9879
|
result.dbTypesFilePath = dbTypesFilePath;
|
|
@@ -9890,7 +10008,7 @@ function generateChangeScript(change) {
|
|
|
9890
10008
|
* @returns {Promise<void>}
|
|
9891
10009
|
*/
|
|
9892
10010
|
async function handleInitOption(namespaces, skipConfirmation) {
|
|
9893
|
-
const existingDirs = namespaces.filter(({ migrationsDir }) => fs$
|
|
10011
|
+
const existingDirs = namespaces.filter(({ migrationsDir }) => fs$1.existsSync(migrationsDir));
|
|
9894
10012
|
if (existingDirs.length === 0) {
|
|
9895
10013
|
logger.info("No existing migration directories found.");
|
|
9896
10014
|
return;
|
|
@@ -9910,7 +10028,7 @@ async function handleInitOption(namespaces, skipConfirmation) {
|
|
|
9910
10028
|
logger.newline();
|
|
9911
10029
|
}
|
|
9912
10030
|
for (const { namespace, migrationsDir } of existingDirs) try {
|
|
9913
|
-
await fs
|
|
10031
|
+
await fs.rm(migrationsDir, {
|
|
9914
10032
|
recursive: true,
|
|
9915
10033
|
force: true
|
|
9916
10034
|
});
|
|
@@ -9940,7 +10058,7 @@ async function generate(options) {
|
|
|
9940
10058
|
if (options.init) await handleInitOption(namespacesWithMigrations, options.yes);
|
|
9941
10059
|
let pluginManager;
|
|
9942
10060
|
if (plugins.length > 0) pluginManager = new PluginManager(plugins);
|
|
9943
|
-
const { defineApplication: defineApplication$1 } = await import("./application-
|
|
10061
|
+
const { defineApplication: defineApplication$1 } = await import("./application-DdSu3baZ.mjs");
|
|
9944
10062
|
const application = defineApplication$1({
|
|
9945
10063
|
config,
|
|
9946
10064
|
pluginManager
|
|
@@ -10051,7 +10169,7 @@ async function openInEditor(filePath) {
|
|
|
10051
10169
|
const editor = process.env.EDITOR;
|
|
10052
10170
|
if (!editor) return;
|
|
10053
10171
|
try {
|
|
10054
|
-
await fs
|
|
10172
|
+
await fs.access(filePath);
|
|
10055
10173
|
} catch {
|
|
10056
10174
|
return;
|
|
10057
10175
|
}
|
|
@@ -10062,9 +10180,9 @@ async function openInEditor(filePath) {
|
|
|
10062
10180
|
stdio: "inherit",
|
|
10063
10181
|
detached: false
|
|
10064
10182
|
});
|
|
10065
|
-
await new Promise((resolve) => {
|
|
10066
|
-
child.on("close", () => resolve());
|
|
10067
|
-
child.on("error", () => resolve());
|
|
10183
|
+
await new Promise((resolve$1) => {
|
|
10184
|
+
child.on("close", () => resolve$1());
|
|
10185
|
+
child.on("error", () => resolve$1());
|
|
10068
10186
|
});
|
|
10069
10187
|
}
|
|
10070
10188
|
/**
|
|
@@ -10076,16 +10194,13 @@ const generateCommand = defineCommand({
|
|
|
10076
10194
|
args: z.object({
|
|
10077
10195
|
...commonArgs,
|
|
10078
10196
|
...confirmationArgs,
|
|
10079
|
-
|
|
10080
|
-
alias: "c",
|
|
10081
|
-
description: "Path to SDK config file"
|
|
10082
|
-
}),
|
|
10197
|
+
...configArg,
|
|
10083
10198
|
name: arg(z.string().optional(), {
|
|
10084
10199
|
alias: "n",
|
|
10085
10200
|
description: "Optional description for the migration"
|
|
10086
10201
|
}),
|
|
10087
10202
|
init: arg(z.boolean().default(false), { description: "Delete existing migrations and start fresh" })
|
|
10088
|
-
}),
|
|
10203
|
+
}).strict(),
|
|
10089
10204
|
run: withCommonArgs(async (args) => {
|
|
10090
10205
|
await generate({
|
|
10091
10206
|
configPath: args.config,
|
|
@@ -10096,6 +10211,63 @@ const generateCommand = defineCommand({
|
|
|
10096
10211
|
})
|
|
10097
10212
|
});
|
|
10098
10213
|
|
|
10214
|
+
//#endregion
|
|
10215
|
+
//#region src/cli/shared/config.ts
|
|
10216
|
+
/**
|
|
10217
|
+
* Extracts all configured namespace names from loaded application config.
|
|
10218
|
+
* Currently namespaces are derived from the `db` section.
|
|
10219
|
+
* @param config - Loaded application configuration.
|
|
10220
|
+
* @returns Namespace names in insertion order.
|
|
10221
|
+
*/
|
|
10222
|
+
function extractAllNamespaces(config) {
|
|
10223
|
+
const namespaces = /* @__PURE__ */ new Set();
|
|
10224
|
+
if (config.db) for (const [namespaceName] of Object.entries(config.db)) namespaces.add(namespaceName);
|
|
10225
|
+
return Array.from(namespaces);
|
|
10226
|
+
}
|
|
10227
|
+
|
|
10228
|
+
//#endregion
|
|
10229
|
+
//#region src/cli/shared/tailordb-namespace.ts
|
|
10230
|
+
/**
|
|
10231
|
+
* Resolve TailorDB type names to namespace names.
|
|
10232
|
+
* @param args - Resolution inputs
|
|
10233
|
+
* @returns Type to namespace map for found types
|
|
10234
|
+
*/
|
|
10235
|
+
async function resolveTypeNamespaces(args) {
|
|
10236
|
+
const requestedTypesByLowercase = /* @__PURE__ */ new Map();
|
|
10237
|
+
for (const typeName of args.typeNames) {
|
|
10238
|
+
const key = typeName.toLowerCase();
|
|
10239
|
+
const existing = requestedTypesByLowercase.get(key);
|
|
10240
|
+
if (existing) {
|
|
10241
|
+
existing.push(typeName);
|
|
10242
|
+
continue;
|
|
10243
|
+
}
|
|
10244
|
+
requestedTypesByLowercase.set(key, [typeName]);
|
|
10245
|
+
}
|
|
10246
|
+
const unresolvedTypes = new Set(args.typeNames);
|
|
10247
|
+
const typeNamespaceMap = /* @__PURE__ */ new Map();
|
|
10248
|
+
for (const namespace of args.namespaces) {
|
|
10249
|
+
if (unresolvedTypes.size === 0) break;
|
|
10250
|
+
try {
|
|
10251
|
+
const { tailordbTypes } = await args.client.listTailorDBTypes({
|
|
10252
|
+
workspaceId: args.workspaceId,
|
|
10253
|
+
namespaceName: namespace
|
|
10254
|
+
});
|
|
10255
|
+
for (const type of tailordbTypes) {
|
|
10256
|
+
const matchedRequestedTypes = requestedTypesByLowercase.get(type.name.toLowerCase());
|
|
10257
|
+
if (!matchedRequestedTypes) continue;
|
|
10258
|
+
for (const requestedTypeName of matchedRequestedTypes) {
|
|
10259
|
+
if (typeNamespaceMap.has(requestedTypeName)) continue;
|
|
10260
|
+
typeNamespaceMap.set(requestedTypeName, namespace);
|
|
10261
|
+
unresolvedTypes.delete(requestedTypeName);
|
|
10262
|
+
}
|
|
10263
|
+
}
|
|
10264
|
+
} catch {
|
|
10265
|
+
continue;
|
|
10266
|
+
}
|
|
10267
|
+
}
|
|
10268
|
+
return typeNamespaceMap;
|
|
10269
|
+
}
|
|
10270
|
+
|
|
10099
10271
|
//#endregion
|
|
10100
10272
|
//#region src/cli/commands/tailordb/truncate.ts
|
|
10101
10273
|
async function truncateSingleType(options, client) {
|
|
@@ -10113,25 +10285,6 @@ async function truncateNamespace(workspaceId, namespaceName, client) {
|
|
|
10113
10285
|
});
|
|
10114
10286
|
logger.success(`Truncated all types in namespace "${namespaceName}"`);
|
|
10115
10287
|
}
|
|
10116
|
-
async function getAllNamespaces(configPath) {
|
|
10117
|
-
const { config } = await loadConfig(configPath);
|
|
10118
|
-
const namespaces = /* @__PURE__ */ new Set();
|
|
10119
|
-
if (config.db) for (const [namespaceName] of Object.entries(config.db)) namespaces.add(namespaceName);
|
|
10120
|
-
return Array.from(namespaces);
|
|
10121
|
-
}
|
|
10122
|
-
async function getTypeNamespace(workspaceId, typeName, client, configPath) {
|
|
10123
|
-
const namespaces = await getAllNamespaces(configPath);
|
|
10124
|
-
for (const namespace of namespaces) try {
|
|
10125
|
-
const { tailordbTypes } = await client.listTailorDBTypes({
|
|
10126
|
-
workspaceId,
|
|
10127
|
-
namespaceName: namespace
|
|
10128
|
-
});
|
|
10129
|
-
if (tailordbTypes.some((type) => type.name === typeName)) return namespace;
|
|
10130
|
-
} catch {
|
|
10131
|
-
continue;
|
|
10132
|
-
}
|
|
10133
|
-
return null;
|
|
10134
|
-
}
|
|
10135
10288
|
/**
|
|
10136
10289
|
* Truncate TailorDB data based on the given options.
|
|
10137
10290
|
* @param options - Truncate options (all, namespace, or types)
|
|
@@ -10162,7 +10315,8 @@ async function $truncate(options) {
|
|
|
10162
10315
|
].filter(Boolean).length;
|
|
10163
10316
|
if (optionCount === 0) throw new Error("Please specify one of: --all, --namespace <name>, or type names");
|
|
10164
10317
|
if (optionCount > 1) throw new Error("Options --all, --namespace, and type names are mutually exclusive. Please specify only one.");
|
|
10165
|
-
const
|
|
10318
|
+
const { config } = await loadConfig(options?.configPath);
|
|
10319
|
+
const namespaces = extractAllNamespaces(config);
|
|
10166
10320
|
if (hasAll) {
|
|
10167
10321
|
if (namespaces.length === 0) {
|
|
10168
10322
|
logger.warn("No namespaces found in config file.");
|
|
@@ -10199,13 +10353,13 @@ async function $truncate(options) {
|
|
|
10199
10353
|
}
|
|
10200
10354
|
if (hasTypes && options?.types) {
|
|
10201
10355
|
const typeNames = options.types;
|
|
10202
|
-
const typeNamespaceMap =
|
|
10203
|
-
|
|
10204
|
-
|
|
10205
|
-
|
|
10206
|
-
|
|
10207
|
-
|
|
10208
|
-
|
|
10356
|
+
const typeNamespaceMap = await resolveTypeNamespaces({
|
|
10357
|
+
workspaceId,
|
|
10358
|
+
namespaces,
|
|
10359
|
+
typeNames,
|
|
10360
|
+
client
|
|
10361
|
+
});
|
|
10362
|
+
const notFoundTypes = typeNames.filter((typeName) => !typeNamespaceMap.has(typeName));
|
|
10209
10363
|
if (notFoundTypes.length > 0) throw new Error(`The following types were not found in any namespace: ${notFoundTypes.join(", ")}`);
|
|
10210
10364
|
if (!options.yes) {
|
|
10211
10365
|
const typeList = typeNames.join(", ");
|
|
@@ -10247,7 +10401,7 @@ const truncateCommand = defineCommand({
|
|
|
10247
10401
|
alias: "n",
|
|
10248
10402
|
description: "Truncate all tables in specified namespace"
|
|
10249
10403
|
})
|
|
10250
|
-
}),
|
|
10404
|
+
}).strict(),
|
|
10251
10405
|
run: withCommonArgs(async (args) => {
|
|
10252
10406
|
const types = args.types && args.types.length > 0 ? args.types : void 0;
|
|
10253
10407
|
await $truncate({
|
|
@@ -10294,7 +10448,7 @@ const listCommand$3 = defineCommand({
|
|
|
10294
10448
|
...commonArgs,
|
|
10295
10449
|
...jsonArgs,
|
|
10296
10450
|
...workspaceArgs
|
|
10297
|
-
}),
|
|
10451
|
+
}).strict(),
|
|
10298
10452
|
run: withCommonArgs(async (args) => {
|
|
10299
10453
|
const workflows = await listWorkflows({
|
|
10300
10454
|
workspaceId: args["workspace-id"],
|
|
@@ -10359,7 +10513,7 @@ const resumeCommand = defineCommand({
|
|
|
10359
10513
|
description: "Failed execution ID"
|
|
10360
10514
|
}),
|
|
10361
10515
|
...waitArgs
|
|
10362
|
-
}),
|
|
10516
|
+
}).strict(),
|
|
10363
10517
|
run: withCommonArgs(async (args) => {
|
|
10364
10518
|
const { executionId, wait } = await resumeWorkflow({
|
|
10365
10519
|
executionId: args.executionId,
|
|
@@ -10427,7 +10581,7 @@ const healthOptionsSchema = z.object({
|
|
|
10427
10581
|
profile: z.string().optional(),
|
|
10428
10582
|
name: z.string().min(1, { message: "name is required" })
|
|
10429
10583
|
});
|
|
10430
|
-
async function loadOptions$
|
|
10584
|
+
async function loadOptions$9(options) {
|
|
10431
10585
|
const result = healthOptionsSchema.safeParse(options);
|
|
10432
10586
|
if (!result.success) throw new Error(result.error.issues[0].message);
|
|
10433
10587
|
return {
|
|
@@ -10445,7 +10599,7 @@ async function loadOptions$8(options) {
|
|
|
10445
10599
|
* @returns Application health information
|
|
10446
10600
|
*/
|
|
10447
10601
|
async function getAppHealth(options) {
|
|
10448
|
-
const { client, workspaceId, name } = await loadOptions$
|
|
10602
|
+
const { client, workspaceId, name } = await loadOptions$9(options);
|
|
10449
10603
|
return appHealthInfo(name, await client.getApplicationSchemaHealth({
|
|
10450
10604
|
workspaceId,
|
|
10451
10605
|
applicationName: name
|
|
@@ -10462,7 +10616,7 @@ const healthCommand = defineCommand({
|
|
|
10462
10616
|
description: "Application name",
|
|
10463
10617
|
alias: "n"
|
|
10464
10618
|
})
|
|
10465
|
-
}),
|
|
10619
|
+
}).strict(),
|
|
10466
10620
|
run: withCommonArgs(async (args) => {
|
|
10467
10621
|
const health = await getAppHealth({
|
|
10468
10622
|
workspaceId: args["workspace-id"],
|
|
@@ -10485,7 +10639,7 @@ const listAppsOptionsSchema = z.object({
|
|
|
10485
10639
|
profile: z.string().optional(),
|
|
10486
10640
|
limit: z.coerce.number().int().positive().optional()
|
|
10487
10641
|
});
|
|
10488
|
-
async function loadOptions$
|
|
10642
|
+
async function loadOptions$8(options) {
|
|
10489
10643
|
const result = listAppsOptionsSchema.safeParse(options);
|
|
10490
10644
|
if (!result.success) throw new Error(result.error.issues[0].message);
|
|
10491
10645
|
return {
|
|
@@ -10503,7 +10657,7 @@ async function loadOptions$7(options) {
|
|
|
10503
10657
|
* @returns List of applications
|
|
10504
10658
|
*/
|
|
10505
10659
|
async function listApps(options) {
|
|
10506
|
-
const { client, workspaceId, limit } = await loadOptions$
|
|
10660
|
+
const { client, workspaceId, limit } = await loadOptions$8(options);
|
|
10507
10661
|
const hasLimit = limit !== void 0;
|
|
10508
10662
|
const results = [];
|
|
10509
10663
|
let pageToken = "";
|
|
@@ -10535,7 +10689,7 @@ const listCommand$2 = defineCommand({
|
|
|
10535
10689
|
alias: "l",
|
|
10536
10690
|
description: "Maximum number of applications to list"
|
|
10537
10691
|
})
|
|
10538
|
-
}),
|
|
10692
|
+
}).strict(),
|
|
10539
10693
|
run: withCommonArgs(async (args) => {
|
|
10540
10694
|
const apps = await listApps({
|
|
10541
10695
|
workspaceId: args["workspace-id"],
|
|
@@ -10640,7 +10794,7 @@ const createCommand = defineCommand({
|
|
|
10640
10794
|
description: "Profile name to create"
|
|
10641
10795
|
}),
|
|
10642
10796
|
"profile-user": arg(z.string().optional(), { description: "User email for the profile (defaults to current user)" })
|
|
10643
|
-
}),
|
|
10797
|
+
}).strict(),
|
|
10644
10798
|
run: withCommonArgs(async (args) => {
|
|
10645
10799
|
const workspace = await createWorkspace({
|
|
10646
10800
|
name: args.name,
|
|
@@ -10688,7 +10842,7 @@ const createCommand = defineCommand({
|
|
|
10688
10842
|
//#endregion
|
|
10689
10843
|
//#region src/cli/commands/workspace/delete.ts
|
|
10690
10844
|
const deleteWorkspaceOptionsSchema = z.object({ workspaceId: z.uuid({ message: "workspace-id must be a valid UUID" }) });
|
|
10691
|
-
async function loadOptions$
|
|
10845
|
+
async function loadOptions$7(options) {
|
|
10692
10846
|
const result = deleteWorkspaceOptionsSchema.safeParse(options);
|
|
10693
10847
|
if (!result.success) throw new Error(result.error.issues[0].message);
|
|
10694
10848
|
return {
|
|
@@ -10702,7 +10856,7 @@ async function loadOptions$6(options) {
|
|
|
10702
10856
|
* @returns Promise that resolves when deletion completes
|
|
10703
10857
|
*/
|
|
10704
10858
|
async function deleteWorkspace(options) {
|
|
10705
|
-
const { client, workspaceId } = await loadOptions$
|
|
10859
|
+
const { client, workspaceId } = await loadOptions$7(options);
|
|
10706
10860
|
await client.deleteWorkspace({ workspaceId });
|
|
10707
10861
|
}
|
|
10708
10862
|
const deleteCommand = defineCommand({
|
|
@@ -10715,9 +10869,9 @@ const deleteCommand = defineCommand({
|
|
|
10715
10869
|
description: "Workspace ID"
|
|
10716
10870
|
}),
|
|
10717
10871
|
...confirmationArgs
|
|
10718
|
-
}),
|
|
10872
|
+
}).strict(),
|
|
10719
10873
|
run: withCommonArgs(async (args) => {
|
|
10720
|
-
const { client, workspaceId } = await loadOptions$
|
|
10874
|
+
const { client, workspaceId } = await loadOptions$7({ workspaceId: args["workspace-id"] });
|
|
10721
10875
|
let workspace;
|
|
10722
10876
|
try {
|
|
10723
10877
|
workspace = await client.getWorkspace({ workspaceId });
|
|
@@ -10748,7 +10902,7 @@ const getWorkspaceOptionsSchema = z.object({
|
|
|
10748
10902
|
workspaceId: z.uuid({ message: "workspace-id must be a valid UUID" }).optional(),
|
|
10749
10903
|
profile: z.string().optional()
|
|
10750
10904
|
});
|
|
10751
|
-
async function loadOptions$
|
|
10905
|
+
async function loadOptions$6(options) {
|
|
10752
10906
|
const result = getWorkspaceOptionsSchema.safeParse(options);
|
|
10753
10907
|
if (!result.success) throw new Error(result.error.issues[0].message);
|
|
10754
10908
|
return {
|
|
@@ -10765,7 +10919,7 @@ async function loadOptions$5(options) {
|
|
|
10765
10919
|
* @returns Workspace details
|
|
10766
10920
|
*/
|
|
10767
10921
|
async function getWorkspace(options) {
|
|
10768
|
-
const { client, workspaceId } = await loadOptions$
|
|
10922
|
+
const { client, workspaceId } = await loadOptions$6(options);
|
|
10769
10923
|
const response = await client.getWorkspace({ workspaceId });
|
|
10770
10924
|
if (!response.workspace) throw new Error(`Workspace "${workspaceId}" not found.`);
|
|
10771
10925
|
return workspaceDetails(response.workspace);
|
|
@@ -10777,7 +10931,7 @@ const getCommand = defineCommand({
|
|
|
10777
10931
|
...commonArgs,
|
|
10778
10932
|
...jsonArgs,
|
|
10779
10933
|
...workspaceArgs
|
|
10780
|
-
}),
|
|
10934
|
+
}).strict(),
|
|
10781
10935
|
run: withCommonArgs(async (args) => {
|
|
10782
10936
|
const workspace = await getWorkspace({
|
|
10783
10937
|
workspaceId: args["workspace-id"],
|
|
@@ -10831,7 +10985,7 @@ const listCommand$1 = defineCommand({
|
|
|
10831
10985
|
alias: "l",
|
|
10832
10986
|
description: "Maximum number of workspaces to list"
|
|
10833
10987
|
})
|
|
10834
|
-
}),
|
|
10988
|
+
}).strict(),
|
|
10835
10989
|
run: withCommonArgs(async (args) => {
|
|
10836
10990
|
const workspaces = await listWorkspaces({ limit: args.limit });
|
|
10837
10991
|
logger.out(workspaces, { display: { updatedAt: null } });
|
|
@@ -10841,7 +10995,7 @@ const listCommand$1 = defineCommand({
|
|
|
10841
10995
|
//#endregion
|
|
10842
10996
|
//#region src/cli/commands/workspace/restore.ts
|
|
10843
10997
|
const restoreWorkspaceOptionsSchema = z.object({ workspaceId: z.uuid({ message: "workspace-id must be a valid UUID" }) });
|
|
10844
|
-
async function loadOptions$
|
|
10998
|
+
async function loadOptions$5(options) {
|
|
10845
10999
|
const result = restoreWorkspaceOptionsSchema.safeParse(options);
|
|
10846
11000
|
if (!result.success) throw new Error(result.error.issues[0].message);
|
|
10847
11001
|
return {
|
|
@@ -10855,7 +11009,7 @@ async function loadOptions$4(options) {
|
|
|
10855
11009
|
* @returns Promise that resolves when restoration completes
|
|
10856
11010
|
*/
|
|
10857
11011
|
async function restoreWorkspace(options) {
|
|
10858
|
-
const { client, workspaceId } = await loadOptions$
|
|
11012
|
+
const { client, workspaceId } = await loadOptions$5(options);
|
|
10859
11013
|
await client.restoreWorkspace({ workspaceId });
|
|
10860
11014
|
}
|
|
10861
11015
|
const restoreCommand = defineCommand({
|
|
@@ -10868,9 +11022,9 @@ const restoreCommand = defineCommand({
|
|
|
10868
11022
|
description: "Workspace ID"
|
|
10869
11023
|
}),
|
|
10870
11024
|
...confirmationArgs
|
|
10871
|
-
}),
|
|
11025
|
+
}).strict(),
|
|
10872
11026
|
run: withCommonArgs(async (args) => {
|
|
10873
|
-
const { client, workspaceId } = await loadOptions$
|
|
11027
|
+
const { client, workspaceId } = await loadOptions$5({ workspaceId: args["workspace-id"] });
|
|
10874
11028
|
if (!args.yes) {
|
|
10875
11029
|
if (await logger.prompt(`Are you sure you want to restore workspace "${workspaceId}"? (yes/no):`, { type: "text" }) !== "yes") {
|
|
10876
11030
|
logger.info("Workspace restoration cancelled.");
|
|
@@ -10921,7 +11075,7 @@ const inviteUserOptionsSchema = z.object({
|
|
|
10921
11075
|
email: z.email({ message: "email must be a valid email address" }),
|
|
10922
11076
|
role: z.enum(validRoles, { message: `role must be one of: ${validRoles.join(", ")}` })
|
|
10923
11077
|
});
|
|
10924
|
-
async function loadOptions$
|
|
11078
|
+
async function loadOptions$4(options) {
|
|
10925
11079
|
const result = inviteUserOptionsSchema.safeParse(options);
|
|
10926
11080
|
if (!result.success) throw new Error(result.error.issues[0].message);
|
|
10927
11081
|
return {
|
|
@@ -10940,7 +11094,7 @@ async function loadOptions$3(options) {
|
|
|
10940
11094
|
* @returns Promise that resolves when invitation is sent
|
|
10941
11095
|
*/
|
|
10942
11096
|
async function inviteUser(options) {
|
|
10943
|
-
const { client, workspaceId, email, role } = await loadOptions$
|
|
11097
|
+
const { client, workspaceId, email, role } = await loadOptions$4(options);
|
|
10944
11098
|
await client.inviteWorkspacePlatformUser({
|
|
10945
11099
|
workspaceId,
|
|
10946
11100
|
email,
|
|
@@ -10958,7 +11112,7 @@ const inviteCommand = defineCommand({
|
|
|
10958
11112
|
description: `Role to assign (${validRoles.join(", ")})`,
|
|
10959
11113
|
alias: "r"
|
|
10960
11114
|
})
|
|
10961
|
-
}),
|
|
11115
|
+
}).strict(),
|
|
10962
11116
|
run: withCommonArgs(async (args) => {
|
|
10963
11117
|
await inviteUser({
|
|
10964
11118
|
workspaceId: args["workspace-id"],
|
|
@@ -10977,7 +11131,7 @@ const listUsersOptionsSchema = z.object({
|
|
|
10977
11131
|
profile: z.string().optional(),
|
|
10978
11132
|
limit: z.coerce.number().int().positive().optional()
|
|
10979
11133
|
});
|
|
10980
|
-
async function loadOptions$
|
|
11134
|
+
async function loadOptions$3(options) {
|
|
10981
11135
|
const result = listUsersOptionsSchema.safeParse(options);
|
|
10982
11136
|
if (!result.success) throw new Error(result.error.issues[0].message);
|
|
10983
11137
|
return {
|
|
@@ -10995,7 +11149,7 @@ async function loadOptions$2(options) {
|
|
|
10995
11149
|
* @returns List of workspace users
|
|
10996
11150
|
*/
|
|
10997
11151
|
async function listUsers(options) {
|
|
10998
|
-
const { client, workspaceId, limit } = await loadOptions$
|
|
11152
|
+
const { client, workspaceId, limit } = await loadOptions$3(options);
|
|
10999
11153
|
const hasLimit = limit !== void 0;
|
|
11000
11154
|
const results = [];
|
|
11001
11155
|
let pageToken = "";
|
|
@@ -11027,7 +11181,7 @@ const listCommand = defineCommand({
|
|
|
11027
11181
|
alias: "l",
|
|
11028
11182
|
description: "Maximum number of users to list"
|
|
11029
11183
|
})
|
|
11030
|
-
}),
|
|
11184
|
+
}).strict(),
|
|
11031
11185
|
run: withCommonArgs(async (args) => {
|
|
11032
11186
|
const users = await listUsers({
|
|
11033
11187
|
workspaceId: args["workspace-id"],
|
|
@@ -11045,7 +11199,7 @@ const removeUserOptionsSchema = z.object({
|
|
|
11045
11199
|
profile: z.string().optional(),
|
|
11046
11200
|
email: z.string().email({ message: "email must be a valid email address" })
|
|
11047
11201
|
});
|
|
11048
|
-
async function loadOptions$
|
|
11202
|
+
async function loadOptions$2(options) {
|
|
11049
11203
|
const result = removeUserOptionsSchema.safeParse(options);
|
|
11050
11204
|
if (!result.success) throw new Error(result.error.issues[0].message);
|
|
11051
11205
|
return {
|
|
@@ -11063,7 +11217,7 @@ async function loadOptions$1(options) {
|
|
|
11063
11217
|
* @returns Promise that resolves when removal completes
|
|
11064
11218
|
*/
|
|
11065
11219
|
async function removeUser(options) {
|
|
11066
|
-
const { client, workspaceId, email } = await loadOptions$
|
|
11220
|
+
const { client, workspaceId, email } = await loadOptions$2(options);
|
|
11067
11221
|
await client.removeWorkspacePlatformUser({
|
|
11068
11222
|
workspaceId,
|
|
11069
11223
|
email
|
|
@@ -11077,7 +11231,7 @@ const removeCommand = defineCommand({
|
|
|
11077
11231
|
...workspaceArgs,
|
|
11078
11232
|
email: arg(z.email(), { description: "Email address of the user to remove" }),
|
|
11079
11233
|
...confirmationArgs
|
|
11080
|
-
}),
|
|
11234
|
+
}).strict(),
|
|
11081
11235
|
run: withCommonArgs(async (args) => {
|
|
11082
11236
|
if (!args.yes) {
|
|
11083
11237
|
if (await logger.prompt(`Are you sure you want to remove user "${args.email}" from the workspace? (yes/no):`, { type: "text" }) !== "yes") {
|
|
@@ -11102,7 +11256,7 @@ const updateUserOptionsSchema = z.object({
|
|
|
11102
11256
|
email: z.string().email({ message: "email must be a valid email address" }),
|
|
11103
11257
|
role: z.enum(validRoles, { message: `role must be one of: ${validRoles.join(", ")}` })
|
|
11104
11258
|
});
|
|
11105
|
-
async function loadOptions(options) {
|
|
11259
|
+
async function loadOptions$1(options) {
|
|
11106
11260
|
const result = updateUserOptionsSchema.safeParse(options);
|
|
11107
11261
|
if (!result.success) throw new Error(result.error.issues[0].message);
|
|
11108
11262
|
return {
|
|
@@ -11121,7 +11275,7 @@ async function loadOptions(options) {
|
|
|
11121
11275
|
* @returns Promise that resolves when update completes
|
|
11122
11276
|
*/
|
|
11123
11277
|
async function updateUser(options) {
|
|
11124
|
-
const { client, workspaceId, email, role } = await loadOptions(options);
|
|
11278
|
+
const { client, workspaceId, email, role } = await loadOptions$1(options);
|
|
11125
11279
|
await client.updateWorkspacePlatformUser({
|
|
11126
11280
|
workspaceId,
|
|
11127
11281
|
email,
|
|
@@ -11139,7 +11293,7 @@ const updateCommand = defineCommand({
|
|
|
11139
11293
|
description: `New role to assign (${validRoles.join(", ")})`,
|
|
11140
11294
|
alias: "r"
|
|
11141
11295
|
})
|
|
11142
|
-
}),
|
|
11296
|
+
}).strict(),
|
|
11143
11297
|
run: withCommonArgs(async (args) => {
|
|
11144
11298
|
await updateUser({
|
|
11145
11299
|
workspaceId: args["workspace-id"],
|
|
@@ -11152,5 +11306,592 @@ const updateCommand = defineCommand({
|
|
|
11152
11306
|
});
|
|
11153
11307
|
|
|
11154
11308
|
//#endregion
|
|
11155
|
-
|
|
11156
|
-
|
|
11309
|
+
//#region src/cli/bundler/query/query-bundler.ts
|
|
11310
|
+
function createSqlEntry() {
|
|
11311
|
+
return ml`
|
|
11312
|
+
import { Kysely, sql } from "@tailor-platform/sdk/kysely";
|
|
11313
|
+
import { TailordbDialect } from "@tailor-platform/function-kysely-tailordb";
|
|
11314
|
+
|
|
11315
|
+
type QueryInput = {
|
|
11316
|
+
namespace: string;
|
|
11317
|
+
queries: string[];
|
|
11318
|
+
};
|
|
11319
|
+
|
|
11320
|
+
function getDB(namespace: string) {
|
|
11321
|
+
const client = new tailordb.Client({ namespace });
|
|
11322
|
+
return new Kysely<Record<string, Record<string, unknown>>>({
|
|
11323
|
+
dialect: new TailordbDialect(client),
|
|
11324
|
+
});
|
|
11325
|
+
}
|
|
11326
|
+
|
|
11327
|
+
export async function main(input: QueryInput) {
|
|
11328
|
+
const db = getDB(input.namespace);
|
|
11329
|
+
const results = [];
|
|
11330
|
+
for (const query of input.queries) {
|
|
11331
|
+
const result = await sql.raw(query).execute(db);
|
|
11332
|
+
const rows = result.rows ?? [];
|
|
11333
|
+
results.push({ rows, rowCount: rows.length });
|
|
11334
|
+
}
|
|
11335
|
+
if (results.length === 1) {
|
|
11336
|
+
return results[0];
|
|
11337
|
+
}
|
|
11338
|
+
return results;
|
|
11339
|
+
}
|
|
11340
|
+
`;
|
|
11341
|
+
}
|
|
11342
|
+
function createGqlEntry() {
|
|
11343
|
+
return ml`
|
|
11344
|
+
type QueryInput = {
|
|
11345
|
+
endpoint: string;
|
|
11346
|
+
accessToken: string;
|
|
11347
|
+
query: string;
|
|
11348
|
+
};
|
|
11349
|
+
|
|
11350
|
+
export async function main(input: QueryInput) {
|
|
11351
|
+
const response = await fetch(input.endpoint, {
|
|
11352
|
+
method: "POST",
|
|
11353
|
+
headers: {
|
|
11354
|
+
"Content-Type": "application/json",
|
|
11355
|
+
Authorization: \`Bearer \${input.accessToken}\`,
|
|
11356
|
+
},
|
|
11357
|
+
body: JSON.stringify({
|
|
11358
|
+
query: input.query,
|
|
11359
|
+
}),
|
|
11360
|
+
});
|
|
11361
|
+
if (!response.ok) {
|
|
11362
|
+
let message = \`HTTP \${response.status}\`;
|
|
11363
|
+
try {
|
|
11364
|
+
const errorJson = await response.json();
|
|
11365
|
+
if (errorJson && typeof errorJson === "object" && "message" in errorJson) {
|
|
11366
|
+
message = String(errorJson.message);
|
|
11367
|
+
}
|
|
11368
|
+
} catch {
|
|
11369
|
+
// Keep default HTTP status message when response body is not JSON.
|
|
11370
|
+
}
|
|
11371
|
+
throw new Error(\`GraphQL request failed: \${message}\`);
|
|
11372
|
+
}
|
|
11373
|
+
|
|
11374
|
+
const json = await response.json();
|
|
11375
|
+
return json;
|
|
11376
|
+
}
|
|
11377
|
+
`;
|
|
11378
|
+
}
|
|
11379
|
+
/**
|
|
11380
|
+
* Bundle a query executor script for TestExecScript.
|
|
11381
|
+
* @param engine - Query engine type
|
|
11382
|
+
* @returns Bundled code
|
|
11383
|
+
*/
|
|
11384
|
+
async function bundleQueryScript(engine) {
|
|
11385
|
+
const outputDir = path.resolve(getDistDir(), "query");
|
|
11386
|
+
fs$1.mkdirSync(outputDir, { recursive: true });
|
|
11387
|
+
const entryPath = path.join(outputDir, `query_${engine}.entry.ts`);
|
|
11388
|
+
const outputPath = path.join(outputDir, `query_${engine}.js`);
|
|
11389
|
+
const entryContent = engine === "sql" ? createSqlEntry() : createGqlEntry();
|
|
11390
|
+
fs$1.writeFileSync(entryPath, entryContent);
|
|
11391
|
+
let tsconfig;
|
|
11392
|
+
try {
|
|
11393
|
+
tsconfig = await resolveTSConfig();
|
|
11394
|
+
} catch {
|
|
11395
|
+
tsconfig = void 0;
|
|
11396
|
+
}
|
|
11397
|
+
await rolldown.build(rolldown.defineConfig({
|
|
11398
|
+
input: entryPath,
|
|
11399
|
+
output: {
|
|
11400
|
+
file: outputPath,
|
|
11401
|
+
format: "esm",
|
|
11402
|
+
sourcemap: false,
|
|
11403
|
+
minify: false,
|
|
11404
|
+
inlineDynamicImports: true,
|
|
11405
|
+
globals: { tailordb: "tailordb" }
|
|
11406
|
+
},
|
|
11407
|
+
external: engine === "sql" ? ["tailordb"] : [],
|
|
11408
|
+
resolve: { conditionNames: ["node", "import"] },
|
|
11409
|
+
tsconfig,
|
|
11410
|
+
treeshake: {
|
|
11411
|
+
moduleSideEffects: false,
|
|
11412
|
+
annotations: true,
|
|
11413
|
+
unknownGlobalSideEffects: false
|
|
11414
|
+
},
|
|
11415
|
+
logLevel: "silent"
|
|
11416
|
+
}));
|
|
11417
|
+
return fs$1.readFileSync(outputPath, "utf-8");
|
|
11418
|
+
}
|
|
11419
|
+
|
|
11420
|
+
//#endregion
|
|
11421
|
+
//#region src/cli/query/errors.ts
|
|
11422
|
+
function toErrorMessage(error) {
|
|
11423
|
+
if (error instanceof Error) return error.message;
|
|
11424
|
+
return String(error);
|
|
11425
|
+
}
|
|
11426
|
+
/**
|
|
11427
|
+
* Maps errors from query execution to user-friendly CLI errors with suggestions when possible.
|
|
11428
|
+
* @param args - The error and context information for mapping
|
|
11429
|
+
* @returns A CLIError with a user-friendly message
|
|
11430
|
+
*/
|
|
11431
|
+
function mapQueryExecutionError(args) {
|
|
11432
|
+
const message = toErrorMessage(args.error);
|
|
11433
|
+
if (message.includes("machine user does not exist")) return createCLIError({
|
|
11434
|
+
code: "not_found",
|
|
11435
|
+
message: `Machine user '${args.machineUser ?? "unknown"}' was not found.`,
|
|
11436
|
+
suggestion: "Run `tailor-sdk machineuser list` and use an existing name."
|
|
11437
|
+
});
|
|
11438
|
+
if (args.engine === "sql" && message.includes("sqlaccess error: failed to fetch schema: query returned an unexpected number of rows")) return createCLIError({
|
|
11439
|
+
code: "invalid_namespace",
|
|
11440
|
+
message: `Failed to load TailorDB schema for namespace '${args.namespace}'.`,
|
|
11441
|
+
suggestion: "Ensure the query references TailorDB types from a single namespace and re-apply if needed."
|
|
11442
|
+
});
|
|
11443
|
+
if (args.engine === "sql" && message.includes("sqlaccess error: failed to parse:")) {
|
|
11444
|
+
const parserReason = message.split("sqlaccess error: failed to parse:").at(1)?.split("\n").at(0)?.trim();
|
|
11445
|
+
return createCLIError({
|
|
11446
|
+
code: "invalid_sql",
|
|
11447
|
+
message: "SQL parse error.",
|
|
11448
|
+
suggestion: parserReason ?? "The SQL query contains unsupported syntax."
|
|
11449
|
+
});
|
|
11450
|
+
}
|
|
11451
|
+
return args.error instanceof Error ? args.error : new Error(message);
|
|
11452
|
+
}
|
|
11453
|
+
|
|
11454
|
+
//#endregion
|
|
11455
|
+
//#region src/cli/query/sql-type-extractor.ts
|
|
11456
|
+
/**
|
|
11457
|
+
* Extract TailorDB type names from SQL query.
|
|
11458
|
+
* @param query - SQL query
|
|
11459
|
+
* @returns Type names referenced by query
|
|
11460
|
+
*/
|
|
11461
|
+
function extractTypeNamesFromSql(query$1) {
|
|
11462
|
+
let statements;
|
|
11463
|
+
try {
|
|
11464
|
+
statements = parse(query$1);
|
|
11465
|
+
} catch (error) {
|
|
11466
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
11467
|
+
throw new Error(`SQL parse error: ${message}\nIf your table name is a reserved keyword (e.g. User), wrap it in double quotes: SELECT * FROM "User"`);
|
|
11468
|
+
}
|
|
11469
|
+
const typeNames = /* @__PURE__ */ new Set();
|
|
11470
|
+
const visitor = astVisitor((mapper) => ({ tableRef: (tableRef) => {
|
|
11471
|
+
typeNames.add(tableRef.name);
|
|
11472
|
+
mapper.super().tableRef(tableRef);
|
|
11473
|
+
return tableRef;
|
|
11474
|
+
} }));
|
|
11475
|
+
for (const statement of statements) visitor.statement(statement);
|
|
11476
|
+
return [...typeNames];
|
|
11477
|
+
}
|
|
11478
|
+
function collectAliasMap(fromClauses) {
|
|
11479
|
+
const aliasMap = /* @__PURE__ */ new Map();
|
|
11480
|
+
for (const from of fromClauses) if (from.type === "table") {
|
|
11481
|
+
const tableName = from.name.name;
|
|
11482
|
+
const alias = from.name.alias ?? tableName;
|
|
11483
|
+
aliasMap.set(alias, tableName);
|
|
11484
|
+
}
|
|
11485
|
+
return aliasMap;
|
|
11486
|
+
}
|
|
11487
|
+
/**
|
|
11488
|
+
* Extract the column template from a SQL query's SELECT clause.
|
|
11489
|
+
* Returns an ordered list of column slots representing explicit columns
|
|
11490
|
+
* and wildcard expansions with their resolved type names.
|
|
11491
|
+
*
|
|
11492
|
+
* Only inspects the top-level SELECT statement, not subqueries.
|
|
11493
|
+
* TailorDB's sqlaccess does not currently support subqueries in FROM clauses,
|
|
11494
|
+
* but we intentionally avoid recursing into nested SELECTs to prevent
|
|
11495
|
+
* false positives if the parser accepts such queries.
|
|
11496
|
+
* @param query - SQL query
|
|
11497
|
+
* @returns Column slots if wildcards are present, null otherwise
|
|
11498
|
+
*/
|
|
11499
|
+
function extractColumnTemplate(query$1) {
|
|
11500
|
+
try {
|
|
11501
|
+
const statements = parse(query$1);
|
|
11502
|
+
for (const statement of statements) {
|
|
11503
|
+
if (statement.type !== "select" || !statement.columns) continue;
|
|
11504
|
+
const aliasMap = collectAliasMap(statement.from ?? []);
|
|
11505
|
+
const slots = [];
|
|
11506
|
+
let hasWildcard = false;
|
|
11507
|
+
for (const column of statement.columns) if (column.expr.type === "ref" && column.expr.name === "*") {
|
|
11508
|
+
hasWildcard = true;
|
|
11509
|
+
if (column.expr.table) {
|
|
11510
|
+
const typeName = aliasMap.get(column.expr.table.name);
|
|
11511
|
+
slots.push({
|
|
11512
|
+
type: "wildcard",
|
|
11513
|
+
typeNames: typeName ? [typeName] : []
|
|
11514
|
+
});
|
|
11515
|
+
} else slots.push({
|
|
11516
|
+
type: "wildcard",
|
|
11517
|
+
typeNames: [...new Set(aliasMap.values())]
|
|
11518
|
+
});
|
|
11519
|
+
} else {
|
|
11520
|
+
const name = column.alias?.name ?? (column.expr.type === "ref" ? column.expr.name : null);
|
|
11521
|
+
if (name) slots.push({
|
|
11522
|
+
type: "explicit",
|
|
11523
|
+
name
|
|
11524
|
+
});
|
|
11525
|
+
}
|
|
11526
|
+
return hasWildcard ? slots : null;
|
|
11527
|
+
}
|
|
11528
|
+
return null;
|
|
11529
|
+
} catch {
|
|
11530
|
+
return null;
|
|
11531
|
+
}
|
|
11532
|
+
}
|
|
11533
|
+
|
|
11534
|
+
//#endregion
|
|
11535
|
+
//#region src/cli/query/type-field-order.ts
|
|
11536
|
+
/**
|
|
11537
|
+
* Load field definition order for all TailorDB types in a namespace.
|
|
11538
|
+
* @param config - Loaded application configuration
|
|
11539
|
+
* @param namespace - TailorDB namespace name
|
|
11540
|
+
* @returns Map of type name to field names in definition order
|
|
11541
|
+
*/
|
|
11542
|
+
async function loadTypeFieldOrder(config, namespace) {
|
|
11543
|
+
const fieldOrder = /* @__PURE__ */ new Map();
|
|
11544
|
+
const dbConfig = config.db?.[namespace];
|
|
11545
|
+
if (!dbConfig || !("files" in dbConfig) || dbConfig.files.length === 0) return fieldOrder;
|
|
11546
|
+
const typeFiles = loadFilesWithIgnores(dbConfig);
|
|
11547
|
+
await Promise.all(typeFiles.map(async (typeFile) => {
|
|
11548
|
+
try {
|
|
11549
|
+
const module = await import(pathToFileURL(typeFile).href);
|
|
11550
|
+
for (const exportedValue of Object.values(module)) {
|
|
11551
|
+
const result = TailorDBTypeSchema.safeParse(exportedValue);
|
|
11552
|
+
if (!result.success) continue;
|
|
11553
|
+
fieldOrder.set(result.data.name, Object.keys(result.data.fields));
|
|
11554
|
+
}
|
|
11555
|
+
} catch {}
|
|
11556
|
+
}));
|
|
11557
|
+
return fieldOrder;
|
|
11558
|
+
}
|
|
11559
|
+
|
|
11560
|
+
//#endregion
|
|
11561
|
+
//#region src/cli/query/index.ts
|
|
11562
|
+
const queryEngineSchema = z.enum(["sql", "gql"]);
|
|
11563
|
+
const queryOptionsSchema = z.object({
|
|
11564
|
+
workspaceId: z.string().optional(),
|
|
11565
|
+
profile: z.string().optional(),
|
|
11566
|
+
configPath: z.string().optional(),
|
|
11567
|
+
engine: queryEngineSchema,
|
|
11568
|
+
query: z.string(),
|
|
11569
|
+
machineUser: z.string()
|
|
11570
|
+
});
|
|
11571
|
+
async function getNamespaceFromSqlQuery(workspaceId, query$1, client, namespaces) {
|
|
11572
|
+
if (namespaces.length === 0) throw new Error("No namespaces found in configuration.");
|
|
11573
|
+
if (namespaces.length === 1) return namespaces[0];
|
|
11574
|
+
const typeNames = extractTypeNamesFromSql(query$1);
|
|
11575
|
+
if (typeNames.length === 0) throw new Error(`Could not infer namespace from query. Detected namespaces: ${namespaces.join(", ")}.`);
|
|
11576
|
+
const typeNamespaceMap = await resolveTypeNamespaces({
|
|
11577
|
+
workspaceId,
|
|
11578
|
+
namespaces,
|
|
11579
|
+
typeNames,
|
|
11580
|
+
client
|
|
11581
|
+
});
|
|
11582
|
+
const notFoundTypes = typeNames.filter((typeName) => !typeNamespaceMap.has(typeName));
|
|
11583
|
+
if (notFoundTypes.length > 0) throw new Error(`Could not find namespace for types in query: ${notFoundTypes.join(", ")}.`);
|
|
11584
|
+
const namespacesFromTypes = new Set(typeNamespaceMap.values());
|
|
11585
|
+
if (namespacesFromTypes.size === 1) return [...namespacesFromTypes][0];
|
|
11586
|
+
throw new Error(`Query references types from multiple namespaces: ${[...namespacesFromTypes].join(", ")}.`);
|
|
11587
|
+
}
|
|
11588
|
+
async function loadOptions(options) {
|
|
11589
|
+
const result = queryOptionsSchema.safeParse(options);
|
|
11590
|
+
if (!result.success) throw new Error(result.error.issues[0].message);
|
|
11591
|
+
const client = await initOperatorClient(await loadAccessToken({
|
|
11592
|
+
useProfile: true,
|
|
11593
|
+
profile: result.data.profile
|
|
11594
|
+
}));
|
|
11595
|
+
const workspaceId = loadWorkspaceId({
|
|
11596
|
+
workspaceId: result.data.workspaceId,
|
|
11597
|
+
profile: result.data.profile
|
|
11598
|
+
});
|
|
11599
|
+
const { config } = await loadConfig(options.configPath);
|
|
11600
|
+
const namespaces = extractAllNamespaces(config);
|
|
11601
|
+
const { application } = await client.getApplication({
|
|
11602
|
+
workspaceId,
|
|
11603
|
+
applicationName: config.name
|
|
11604
|
+
});
|
|
11605
|
+
if (!application?.authNamespace) throw new Error(`Application ${config.name} does not have an auth configuration.`);
|
|
11606
|
+
const { machineUser: machineUserResource } = await client.getAuthMachineUser({
|
|
11607
|
+
workspaceId,
|
|
11608
|
+
authNamespace: application.authNamespace,
|
|
11609
|
+
name: result.data.machineUser
|
|
11610
|
+
});
|
|
11611
|
+
if (!machineUserResource) throw new Error(`Machine user ${result.data.machineUser} not found.`);
|
|
11612
|
+
if (options.engine === "gql") return {
|
|
11613
|
+
engine: options.engine,
|
|
11614
|
+
client,
|
|
11615
|
+
workspaceId,
|
|
11616
|
+
config,
|
|
11617
|
+
application,
|
|
11618
|
+
machineUserResource
|
|
11619
|
+
};
|
|
11620
|
+
const namespace = await getNamespaceFromSqlQuery(workspaceId, result.data.query, client, namespaces);
|
|
11621
|
+
return {
|
|
11622
|
+
engine: options.engine,
|
|
11623
|
+
client,
|
|
11624
|
+
workspaceId,
|
|
11625
|
+
config,
|
|
11626
|
+
application,
|
|
11627
|
+
machineUserResource,
|
|
11628
|
+
namespace
|
|
11629
|
+
};
|
|
11630
|
+
}
|
|
11631
|
+
async function sqlQuery(client, invoker, args) {
|
|
11632
|
+
const queries = splitSqlStatements(args.query);
|
|
11633
|
+
const executed = await executeScript({
|
|
11634
|
+
client,
|
|
11635
|
+
workspaceId: args.workspaceId,
|
|
11636
|
+
name: `query-sql-${args.namespace}.js`,
|
|
11637
|
+
code: args.bundledCode,
|
|
11638
|
+
arg: JSON.stringify({
|
|
11639
|
+
namespace: args.namespace,
|
|
11640
|
+
queries
|
|
11641
|
+
}),
|
|
11642
|
+
invoker
|
|
11643
|
+
});
|
|
11644
|
+
if (!executed.success) throw new Error(executed.error);
|
|
11645
|
+
return {
|
|
11646
|
+
engine: "sql",
|
|
11647
|
+
namespace: args.namespace,
|
|
11648
|
+
query: args.query,
|
|
11649
|
+
result: parseExecutionResult(executed.result)
|
|
11650
|
+
};
|
|
11651
|
+
}
|
|
11652
|
+
async function gqlQuery(client, invoker, application, machineUser, args) {
|
|
11653
|
+
const { access_token: accessToken } = await fetchMachineUserToken(application.url, machineUser.clientId, machineUser.clientSecret);
|
|
11654
|
+
const executed = await executeScript({
|
|
11655
|
+
client,
|
|
11656
|
+
workspaceId: args.workspaceId,
|
|
11657
|
+
name: `query-gql.js`,
|
|
11658
|
+
code: args.bundledCode,
|
|
11659
|
+
arg: JSON.stringify({
|
|
11660
|
+
endpoint: `${application.url}/query`,
|
|
11661
|
+
accessToken,
|
|
11662
|
+
query: args.query
|
|
11663
|
+
}),
|
|
11664
|
+
invoker
|
|
11665
|
+
});
|
|
11666
|
+
if (!executed.success) throw new Error(executed.error);
|
|
11667
|
+
return {
|
|
11668
|
+
engine: "gql",
|
|
11669
|
+
query: args.query,
|
|
11670
|
+
result: parseExecutionResult(executed.result)
|
|
11671
|
+
};
|
|
11672
|
+
}
|
|
11673
|
+
function parseExecutionResult(result) {
|
|
11674
|
+
if (!result) return null;
|
|
11675
|
+
try {
|
|
11676
|
+
return JSON.parse(result);
|
|
11677
|
+
} catch {
|
|
11678
|
+
return result;
|
|
11679
|
+
}
|
|
11680
|
+
}
|
|
11681
|
+
/**
|
|
11682
|
+
* Dispatch query execution.
|
|
11683
|
+
* @param options - Query command options
|
|
11684
|
+
* @returns Dispatch result
|
|
11685
|
+
*/
|
|
11686
|
+
async function query(options) {
|
|
11687
|
+
const { client, workspaceId, config, application, machineUserResource, engine, namespace } = await loadOptions(options);
|
|
11688
|
+
try {
|
|
11689
|
+
const bundledCode = await bundleQueryScript(engine);
|
|
11690
|
+
const invoker = create(AuthInvokerSchema, {
|
|
11691
|
+
namespace: application.authNamespace,
|
|
11692
|
+
machineUserName: machineUserResource.name
|
|
11693
|
+
});
|
|
11694
|
+
switch (engine) {
|
|
11695
|
+
case "sql": return reorderSqlColumns(await sqlQuery(client, invoker, {
|
|
11696
|
+
workspaceId,
|
|
11697
|
+
namespace,
|
|
11698
|
+
bundledCode,
|
|
11699
|
+
query: options.query
|
|
11700
|
+
}), config, namespace, options.query);
|
|
11701
|
+
case "gql": return await gqlQuery(client, invoker, application, machineUserResource, {
|
|
11702
|
+
workspaceId,
|
|
11703
|
+
bundledCode,
|
|
11704
|
+
query: options.query
|
|
11705
|
+
});
|
|
11706
|
+
default: throw new Error(`Unsupported query engine: ${engine}`);
|
|
11707
|
+
}
|
|
11708
|
+
} catch (error) {
|
|
11709
|
+
throw mapQueryExecutionError({
|
|
11710
|
+
error,
|
|
11711
|
+
engine,
|
|
11712
|
+
namespace,
|
|
11713
|
+
machineUser: options.machineUser
|
|
11714
|
+
});
|
|
11715
|
+
}
|
|
11716
|
+
}
|
|
11717
|
+
/**
|
|
11718
|
+
* Execute SQL query directly.
|
|
11719
|
+
* @param options - Shared query options
|
|
11720
|
+
* @returns SQL query result
|
|
11721
|
+
*/
|
|
11722
|
+
async function querySql(options) {
|
|
11723
|
+
const result = await query({
|
|
11724
|
+
...options,
|
|
11725
|
+
engine: "sql"
|
|
11726
|
+
});
|
|
11727
|
+
if (result.engine !== "sql") throw new Error(`Expected sql engine result but got: ${result.engine}`);
|
|
11728
|
+
return result;
|
|
11729
|
+
}
|
|
11730
|
+
/**
|
|
11731
|
+
* Execute GraphQL query directly.
|
|
11732
|
+
* @param options - Shared query options
|
|
11733
|
+
* @returns GraphQL query result
|
|
11734
|
+
*/
|
|
11735
|
+
async function queryGql(options) {
|
|
11736
|
+
const result = await query({
|
|
11737
|
+
...options,
|
|
11738
|
+
engine: "gql"
|
|
11739
|
+
});
|
|
11740
|
+
if (result.engine !== "gql") throw new Error(`Expected gql engine result but got: ${result.engine}`);
|
|
11741
|
+
return result;
|
|
11742
|
+
}
|
|
11743
|
+
async function reorderSqlColumns(result, config, namespace, sqlQuery$1) {
|
|
11744
|
+
if (!isSQLExecutionResult(result.result) || result.result.rows.length === 0) return result;
|
|
11745
|
+
const template = extractColumnTemplate(sqlQuery$1);
|
|
11746
|
+
if (!template) return result;
|
|
11747
|
+
try {
|
|
11748
|
+
const expectedOrder = buildExpectedColumnOrder(template, await loadTypeFieldOrder(config, namespace));
|
|
11749
|
+
if (expectedOrder.length === 0) return result;
|
|
11750
|
+
const orderedRows = result.result.rows.map((row) => reorderRowByTemplate(row, expectedOrder));
|
|
11751
|
+
return {
|
|
11752
|
+
...result,
|
|
11753
|
+
result: {
|
|
11754
|
+
...result.result,
|
|
11755
|
+
rows: orderedRows
|
|
11756
|
+
}
|
|
11757
|
+
};
|
|
11758
|
+
} catch {
|
|
11759
|
+
return result;
|
|
11760
|
+
}
|
|
11761
|
+
}
|
|
11762
|
+
const SYSTEM_FIELD_ORDER = ["id"];
|
|
11763
|
+
function buildExpectedColumnOrder(template, fieldOrder) {
|
|
11764
|
+
const order = [];
|
|
11765
|
+
for (const slot of template) if (slot.type === "explicit") order.push(slot.name);
|
|
11766
|
+
else for (const typeName of slot.typeNames) {
|
|
11767
|
+
order.push(...SYSTEM_FIELD_ORDER);
|
|
11768
|
+
order.push(...fieldOrder.get(typeName) ?? []);
|
|
11769
|
+
}
|
|
11770
|
+
return order;
|
|
11771
|
+
}
|
|
11772
|
+
function reorderRowByTemplate(row, expectedOrder) {
|
|
11773
|
+
const ordered = {};
|
|
11774
|
+
const rowKeys = new Set(Object.keys(row));
|
|
11775
|
+
const lowerToOriginal = /* @__PURE__ */ new Map();
|
|
11776
|
+
for (const key of rowKeys) lowerToOriginal.set(key.toLowerCase(), key);
|
|
11777
|
+
for (const key of expectedOrder) {
|
|
11778
|
+
const original = lowerToOriginal.get(key.toLowerCase());
|
|
11779
|
+
if (original != null && rowKeys.has(original)) {
|
|
11780
|
+
ordered[original] = row[original];
|
|
11781
|
+
rowKeys.delete(original);
|
|
11782
|
+
lowerToOriginal.delete(key.toLowerCase());
|
|
11783
|
+
}
|
|
11784
|
+
}
|
|
11785
|
+
for (const key of rowKeys) ordered[key] = row[key];
|
|
11786
|
+
return ordered;
|
|
11787
|
+
}
|
|
11788
|
+
const queryCommand = defineCommand({
|
|
11789
|
+
name: "query",
|
|
11790
|
+
description: "Run SQL/GraphQL query.",
|
|
11791
|
+
args: z.object({
|
|
11792
|
+
...commonArgs,
|
|
11793
|
+
...jsonArgs,
|
|
11794
|
+
...deploymentArgs,
|
|
11795
|
+
engine: arg(queryEngineSchema, { description: "Query engine (sql or gql)" }),
|
|
11796
|
+
query: arg(z.string(), {
|
|
11797
|
+
alias: "q",
|
|
11798
|
+
description: "Query string to execute directly"
|
|
11799
|
+
}),
|
|
11800
|
+
machineuser: arg(z.string(), {
|
|
11801
|
+
alias: "m",
|
|
11802
|
+
description: "Machine user name for query execution"
|
|
11803
|
+
})
|
|
11804
|
+
}).strict(),
|
|
11805
|
+
run: withCommonArgs(async (args) => {
|
|
11806
|
+
const sharedOptions = {
|
|
11807
|
+
workspaceId: args["workspace-id"],
|
|
11808
|
+
profile: args.profile,
|
|
11809
|
+
configPath: args.config,
|
|
11810
|
+
query: args.query,
|
|
11811
|
+
machineUser: args.machineuser
|
|
11812
|
+
};
|
|
11813
|
+
if (args.engine === "sql") {
|
|
11814
|
+
printSqlResult(await querySql(sharedOptions), { json: args.json });
|
|
11815
|
+
return;
|
|
11816
|
+
}
|
|
11817
|
+
printGqlResult(await queryGql(sharedOptions), { json: args.json });
|
|
11818
|
+
})
|
|
11819
|
+
});
|
|
11820
|
+
function isSQLExecutionResult(value) {
|
|
11821
|
+
if (!value || typeof value !== "object") return false;
|
|
11822
|
+
const candidate = value;
|
|
11823
|
+
return Array.isArray(candidate.rows) && typeof candidate.rowCount === "number";
|
|
11824
|
+
}
|
|
11825
|
+
function printSingleSqlResult(execResult, options = {}) {
|
|
11826
|
+
if (execResult.rows.length === 0) {
|
|
11827
|
+
if (options.json) {
|
|
11828
|
+
logger.out({
|
|
11829
|
+
results: [],
|
|
11830
|
+
rowCount: 0
|
|
11831
|
+
});
|
|
11832
|
+
return;
|
|
11833
|
+
}
|
|
11834
|
+
logger.info("No rows returned.");
|
|
11835
|
+
return;
|
|
11836
|
+
}
|
|
11837
|
+
if (options.json) {
|
|
11838
|
+
logger.out({
|
|
11839
|
+
results: execResult.rows,
|
|
11840
|
+
rowCount: execResult.rowCount
|
|
11841
|
+
});
|
|
11842
|
+
return;
|
|
11843
|
+
}
|
|
11844
|
+
logger.out(execResult.rows, { showNull: true });
|
|
11845
|
+
logger.out(`rows: ${execResult.rowCount}`);
|
|
11846
|
+
}
|
|
11847
|
+
function splitSqlStatements(query$1) {
|
|
11848
|
+
try {
|
|
11849
|
+
const statements = parse(query$1);
|
|
11850
|
+
if (statements.length === 0) return [];
|
|
11851
|
+
return statements.map((s) => toSql.statement(s));
|
|
11852
|
+
} catch {
|
|
11853
|
+
const trimmed = query$1.trim();
|
|
11854
|
+
return trimmed.length > 0 ? [trimmed] : [];
|
|
11855
|
+
}
|
|
11856
|
+
}
|
|
11857
|
+
function isSQLExecutionResultArray(value) {
|
|
11858
|
+
return Array.isArray(value) && value.length > 0 && value.every(isSQLExecutionResult);
|
|
11859
|
+
}
|
|
11860
|
+
function printSqlResult(result, options = {}) {
|
|
11861
|
+
if (isSQLExecutionResultArray(result.result)) {
|
|
11862
|
+
if (options.json) {
|
|
11863
|
+
logger.out(result.result.map((r) => ({
|
|
11864
|
+
results: r.rows,
|
|
11865
|
+
rowCount: r.rowCount
|
|
11866
|
+
})));
|
|
11867
|
+
return;
|
|
11868
|
+
}
|
|
11869
|
+
const queries = splitSqlStatements(result.query);
|
|
11870
|
+
for (let i = 0; i < result.result.length; i++) {
|
|
11871
|
+
if (i > 0) logger.log("");
|
|
11872
|
+
logger.info(queries[i] ?? `Statement ${i + 1}`);
|
|
11873
|
+
printSingleSqlResult(result.result[i], options);
|
|
11874
|
+
}
|
|
11875
|
+
return;
|
|
11876
|
+
}
|
|
11877
|
+
if (isSQLExecutionResult(result.result)) {
|
|
11878
|
+
printSingleSqlResult(result.result, options);
|
|
11879
|
+
return;
|
|
11880
|
+
}
|
|
11881
|
+
logger.out({
|
|
11882
|
+
engine: result.engine,
|
|
11883
|
+
query: result.query,
|
|
11884
|
+
result: result.result
|
|
11885
|
+
});
|
|
11886
|
+
}
|
|
11887
|
+
function printGqlResult(result, options = {}) {
|
|
11888
|
+
if (options.json) {
|
|
11889
|
+
logger.out({ result: result.result });
|
|
11890
|
+
return;
|
|
11891
|
+
}
|
|
11892
|
+
logger.out(JSON.stringify(result.result, null, 2));
|
|
11893
|
+
}
|
|
11894
|
+
|
|
11895
|
+
//#endregion
|
|
11896
|
+
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 };
|
|
11897
|
+
//# sourceMappingURL=query-Bz2oDGhw.mjs.map
|