@tailor-platform/sdk 1.29.0 → 1.31.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 +64 -0
- package/README.md +3 -1
- package/dist/{application-Dl1d7w-b.mjs → application-B2-PymMz.mjs} +2 -2
- package/dist/{application-Clwpv84E.mjs → application-CASjzt3W.mjs} +341 -107
- package/dist/application-CASjzt3W.mjs.map +1 -0
- package/dist/cli/index.mjs +127 -96
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +210 -45
- package/dist/cli/lib.mjs +29 -29
- package/dist/cli/lib.mjs.map +1 -1
- package/dist/client-B0wrLUVK.mjs +6 -0
- package/dist/{client-CZmQBXAY.mjs → client-DfdgRZlQ.mjs} +25 -13
- package/dist/{client-CZmQBXAY.mjs.map → client-DfdgRZlQ.mjs.map} +1 -1
- package/dist/configure/index.d.mts +4 -4
- package/dist/configure/index.mjs +1 -1
- package/dist/{crash-report-CYrETw1c.mjs → crash-report-BMEhRxeg.mjs} +1 -1
- package/dist/{crash-report-DizNMVnm.mjs → crash-report-wNxS0IUJ.mjs} +2 -2
- package/dist/{crash-report-DizNMVnm.mjs.map → crash-report-wNxS0IUJ.mjs.map} +1 -1
- package/dist/{env-BuMbIknz.d.mts → env-BgdHfWDn.d.mts} +2 -2
- package/dist/{index-D1AM_02Y.d.mts → index-CdDzh-T2.d.mts} +2 -2
- package/dist/{index-CyapgSFI.d.mts → index-CxgBnxKM.d.mts} +2 -2
- package/dist/{index-B0Lrzywd.d.mts → index-D4Y81vh1.d.mts} +2 -2
- package/dist/{index-CbnLNm14.d.mts → index-FZMBoUWm.d.mts} +2 -2
- package/dist/{index-cD9sQLTh.d.mts → index-RXv15__b.d.mts} +4 -4
- package/dist/plugin/builtin/enum-constants/index.d.mts +1 -1
- package/dist/plugin/builtin/file-utils/index.d.mts +1 -1
- package/dist/plugin/builtin/kysely-type/index.d.mts +1 -1
- package/dist/plugin/builtin/seed/index.d.mts +1 -1
- package/dist/plugin/index.d.mts +2 -2
- package/dist/{plugin-D3a0-qe0.d.mts → plugin-DyVYXZWz.d.mts} +8 -8
- package/dist/{query-B1-hq2Hm.mjs → runtime-Ofe7nHEG.mjs} +667 -143
- package/dist/runtime-Ofe7nHEG.mjs.map +1 -0
- package/dist/{schema-BePzTFBV.mjs → schema-CNWt2FKQ.mjs} +3 -14
- package/dist/schema-CNWt2FKQ.mjs.map +1 -0
- package/dist/utils/test/index.d.mts +2 -2
- package/dist/{workflow.generated-BsgIlrH-.d.mts → workflow.generated-DMQ-cjyT.d.mts} +2 -2
- package/docs/cli/function.md +1 -1
- package/docs/cli/organization.md +426 -0
- package/docs/cli-reference.md +20 -2
- package/docs/quickstart.md +12 -0
- package/docs/services/resolver.md +59 -0
- package/docs/services/tailordb.md +78 -6
- package/package.json +15 -12
- package/dist/application-Clwpv84E.mjs.map +0 -1
- package/dist/client-CW4Oh3iz.mjs +0 -6
- package/dist/query-B1-hq2Hm.mjs.map +0 -1
- package/dist/schema-BePzTFBV.mjs.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as db } from "./schema-
|
|
1
|
+
import { t as db } from "./schema-CNWt2FKQ.mjs";
|
|
2
2
|
import { i as symbols, n as logger, r as styles, t as CIPromptError } from "./logger-CqezTedh.mjs";
|
|
3
|
-
import { A as
|
|
3
|
+
import { A as ExecutorTriggerType, C as TailorDBType_PermitAction, E as FunctionExecution_Status, F as AuthOAuth2Client_GrantType, G as Condition_Operator, H as UserProfileProviderConfig_UserProfileProviderType, I as AuthSCIMAttribute_Mutability, J as ApplicationSchemaUpdateAttemptStatus, K as FilterSchema, L as AuthSCIMAttribute_Type, M as AuthIDPConfig_AuthType, N as AuthInvokerSchema, O as ExecutorJobStatus, P as AuthOAuth2Client_ClientType, R as AuthSCIMAttribute_Uniqueness, S as TailorDBType_Permission_Permit, T as IdPLang, U as GetApplicationSchemaHealthResponse_ApplicationSchemaHealthStatus, V as TenantProviderConfig_TenantProviderType, W as ConditionSchema, Y as Subgraph_ServiceType, _ as WorkflowJobExecution_Status, a as fetchMachineUserToken, b as TailorDBGQLPermission_Permit, f as platformBaseUrl, g as WorkflowExecution_Status, h as WorkspacePlatformUserRole, i as fetchAll, j as AuthHookPoint, k as ExecutorTargetType, m as userAgent, p as resolveStaticWebsiteUrls, q as PageDirection, u as initOperatorClient, v as TailorDBGQLPermission_Action, w as PipelineResolver_OperationType, x as TailorDBType_Permission_Operator, y as TailorDBGQLPermission_Operator, z as AuthSCIMConfig_AuthorizationType } from "./client-DfdgRZlQ.mjs";
|
|
4
4
|
import { t as readPackageJson } from "./package-json-D3x2nBPB.mjs";
|
|
5
|
-
import { S as writePlatformConfig, _ as hashFile, a as loadConfig, b as
|
|
5
|
+
import { S as readPlatformConfig, T as writePlatformConfig, _ as hashFile, a as loadConfig, b as loadAccessToken, d as TailorDBTypeSchema, f as stringifyFunction, g as getDistDir, h as createBundleCache, l as OAuth2ClientSchema, m as loadFilesWithIgnores, n as generatePluginFilesIfNeeded, p as tailorUserMap, r as loadApplication, s as createExecutorService, t as defineApplication, x as loadWorkspaceId } from "./application-CASjzt3W.mjs";
|
|
6
6
|
import { r as withSpan } from "./telemetry-BSUlYTs-.mjs";
|
|
7
7
|
import { arg, createDefineCommand, defineCommand, runCommand } from "politty";
|
|
8
8
|
import { z } from "zod";
|
|
@@ -180,6 +180,24 @@ const confirmationArgs = { yes: arg(z.boolean().default(false), {
|
|
|
180
180
|
alias: "y",
|
|
181
181
|
description: "Skip confirmation prompts"
|
|
182
182
|
}) };
|
|
183
|
+
/**
|
|
184
|
+
* Arguments for commands that require organization context
|
|
185
|
+
*/
|
|
186
|
+
const organizationArgs = { "organization-id": arg(z.string(), {
|
|
187
|
+
alias: "o",
|
|
188
|
+
description: "Organization ID",
|
|
189
|
+
env: "TAILOR_PLATFORM_ORGANIZATION_ID",
|
|
190
|
+
completion: { type: "none" }
|
|
191
|
+
}) };
|
|
192
|
+
/**
|
|
193
|
+
* Arguments for commands that require folder context
|
|
194
|
+
*/
|
|
195
|
+
const folderArgs = { "folder-id": arg(z.string(), {
|
|
196
|
+
alias: "f",
|
|
197
|
+
description: "Folder ID",
|
|
198
|
+
env: "TAILOR_PLATFORM_FOLDER_ID",
|
|
199
|
+
completion: { type: "none" }
|
|
200
|
+
}) };
|
|
183
201
|
let verboseMode = false;
|
|
184
202
|
/**
|
|
185
203
|
* Returns whether verbose mode is enabled.
|
|
@@ -351,28 +369,18 @@ function createCacheStore(config) {
|
|
|
351
369
|
const manifest = ensureManifestLoaded();
|
|
352
370
|
delete manifest.entries[key];
|
|
353
371
|
}
|
|
354
|
-
function
|
|
372
|
+
function storeBundleContent(cacheKey, content) {
|
|
355
373
|
const dir = bundlesDir();
|
|
356
374
|
fs$1.mkdirSync(dir, { recursive: true });
|
|
357
|
-
fs$1.
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
if (fs$1.existsSync(mapSource)) fs$1.copyFileSync(mapSource, cachedMapPath);
|
|
361
|
-
else fs$1.rmSync(cachedMapPath, { force: true });
|
|
362
|
-
}
|
|
363
|
-
function restoreBundleOutput(cacheKey, targetPath) {
|
|
364
|
-
const cached = bundlePath(cacheKey);
|
|
365
|
-
const targetDir = path.dirname(targetPath);
|
|
366
|
-
fs$1.mkdirSync(targetDir, { recursive: true });
|
|
375
|
+
fs$1.writeFileSync(bundlePath(cacheKey), content, "utf-8");
|
|
376
|
+
}
|
|
377
|
+
function restoreBundleContent(cacheKey) {
|
|
367
378
|
try {
|
|
368
|
-
fs$1.
|
|
379
|
+
return fs$1.readFileSync(bundlePath(cacheKey), "utf-8");
|
|
369
380
|
} catch (e) {
|
|
370
|
-
if (e.code === "ENOENT") return
|
|
381
|
+
if (e.code === "ENOENT") return void 0;
|
|
371
382
|
throw e;
|
|
372
383
|
}
|
|
373
|
-
const cachedMap = `${cached}.map`;
|
|
374
|
-
if (fs$1.existsSync(cachedMap)) fs$1.copyFileSync(cachedMap, `${targetPath}.map`);
|
|
375
|
-
return true;
|
|
376
384
|
}
|
|
377
385
|
function clean() {
|
|
378
386
|
fs$1.rmSync(config.cacheDir, {
|
|
@@ -388,8 +396,8 @@ function createCacheStore(config) {
|
|
|
388
396
|
getEntry,
|
|
389
397
|
setEntry,
|
|
390
398
|
deleteEntry,
|
|
391
|
-
|
|
392
|
-
|
|
399
|
+
storeBundleContent,
|
|
400
|
+
restoreBundleContent,
|
|
393
401
|
clean
|
|
394
402
|
};
|
|
395
403
|
}
|
|
@@ -405,9 +413,7 @@ function createCacheManager(options) {
|
|
|
405
413
|
if (!(options.enabled ?? true)) return {
|
|
406
414
|
enabled: false,
|
|
407
415
|
bundleCache: {
|
|
408
|
-
tryRestore() {
|
|
409
|
-
return false;
|
|
410
|
-
},
|
|
416
|
+
tryRestore() {},
|
|
411
417
|
save() {}
|
|
412
418
|
},
|
|
413
419
|
finalize() {}
|
|
@@ -1124,74 +1130,70 @@ function authHookFunctionName(authName, hookPoint) {
|
|
|
1124
1130
|
return `auth-hook--${authName}--${hookPoint}`;
|
|
1125
1131
|
}
|
|
1126
1132
|
/**
|
|
1127
|
-
* Collect all function entries from bundled scripts for all services.
|
|
1133
|
+
* Collect all function entries from in-memory bundled scripts for all services.
|
|
1128
1134
|
* @param application - Application definition
|
|
1129
1135
|
* @param workflowJobs - Collected workflow jobs from config
|
|
1136
|
+
* @param bundledScripts - In-memory bundled code organized by kind
|
|
1130
1137
|
* @returns Array of function entries to register
|
|
1131
1138
|
*/
|
|
1132
|
-
function collectFunctionEntries(application, workflowJobs) {
|
|
1139
|
+
function collectFunctionEntries(application, workflowJobs, bundledScripts) {
|
|
1133
1140
|
const entries = [];
|
|
1134
|
-
const distDir = getDistDir();
|
|
1135
1141
|
for (const app of application.applications) for (const pipeline of app.resolverServices) for (const resolver of Object.values(pipeline.resolvers)) {
|
|
1136
|
-
const
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
name: resolverFunctionName(pipeline.namespace, resolver.name),
|
|
1141
|
-
scriptContent: content,
|
|
1142
|
-
contentHash: computeContentHash(content),
|
|
1143
|
-
description: `Resolver: ${pipeline.namespace}/${resolver.name}`
|
|
1144
|
-
});
|
|
1145
|
-
} catch {
|
|
1146
|
-
logger.warn(`Function file not found: ${scriptPath}`);
|
|
1142
|
+
const content = bundledScripts.resolvers.get(resolver.name);
|
|
1143
|
+
if (!content) {
|
|
1144
|
+
logger.warn(`Bundled code not found for resolver: ${resolver.name}`);
|
|
1145
|
+
continue;
|
|
1147
1146
|
}
|
|
1147
|
+
entries.push({
|
|
1148
|
+
name: resolverFunctionName(pipeline.namespace, resolver.name),
|
|
1149
|
+
scriptContent: content,
|
|
1150
|
+
contentHash: computeContentHash(content),
|
|
1151
|
+
description: `Resolver: ${pipeline.namespace}/${resolver.name}`
|
|
1152
|
+
});
|
|
1148
1153
|
}
|
|
1149
1154
|
if (application.executorService) {
|
|
1150
1155
|
const executors = application.executorService.executors;
|
|
1151
1156
|
for (const executor of Object.values(executors)) if (executor.operation.kind === "function" || executor.operation.kind === "jobFunction") {
|
|
1152
|
-
const
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
name: executorFunctionName(executor.name),
|
|
1157
|
-
scriptContent: content,
|
|
1158
|
-
contentHash: computeContentHash(content),
|
|
1159
|
-
description: `Executor: ${executor.name}`
|
|
1160
|
-
});
|
|
1161
|
-
} catch {
|
|
1162
|
-
logger.warn(`Function file not found: ${scriptPath}`);
|
|
1157
|
+
const content = bundledScripts.executors.get(executor.name);
|
|
1158
|
+
if (!content) {
|
|
1159
|
+
logger.warn(`Bundled code not found for executor: ${executor.name}`);
|
|
1160
|
+
continue;
|
|
1163
1161
|
}
|
|
1164
|
-
}
|
|
1165
|
-
}
|
|
1166
|
-
for (const job of workflowJobs) {
|
|
1167
|
-
const scriptPath = path.join(distDir, "workflow-jobs", `${job.name}.js`);
|
|
1168
|
-
try {
|
|
1169
|
-
const content = fs$1.readFileSync(scriptPath, "utf-8");
|
|
1170
1162
|
entries.push({
|
|
1171
|
-
name:
|
|
1163
|
+
name: executorFunctionName(executor.name),
|
|
1172
1164
|
scriptContent: content,
|
|
1173
1165
|
contentHash: computeContentHash(content),
|
|
1174
|
-
description: `
|
|
1166
|
+
description: `Executor: ${executor.name}`
|
|
1175
1167
|
});
|
|
1176
|
-
} catch {
|
|
1177
|
-
logger.warn(`Function file not found: ${scriptPath}`);
|
|
1178
1168
|
}
|
|
1179
1169
|
}
|
|
1170
|
+
for (const job of workflowJobs) {
|
|
1171
|
+
const content = bundledScripts.workflowJobs.get(job.name);
|
|
1172
|
+
if (!content) {
|
|
1173
|
+
logger.warn(`Bundled code not found for workflow job: ${job.name}`);
|
|
1174
|
+
continue;
|
|
1175
|
+
}
|
|
1176
|
+
entries.push({
|
|
1177
|
+
name: workflowJobFunctionName(job.name),
|
|
1178
|
+
scriptContent: content,
|
|
1179
|
+
contentHash: computeContentHash(content),
|
|
1180
|
+
description: `Workflow job: ${job.name}`
|
|
1181
|
+
});
|
|
1182
|
+
}
|
|
1180
1183
|
for (const app of application.applications) if (app.authService?.config.hooks?.beforeLogin) {
|
|
1181
1184
|
const authName = app.authService.config.name;
|
|
1182
1185
|
const funcName = authHookFunctionName(authName, "before-login");
|
|
1183
|
-
const
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
name: funcName,
|
|
1188
|
-
scriptContent: content,
|
|
1189
|
-
contentHash: computeContentHash(content),
|
|
1190
|
-
description: `Auth hook: ${authName}/before-login`
|
|
1191
|
-
});
|
|
1192
|
-
} catch {
|
|
1193
|
-
logger.warn(`Function file not found: ${scriptPath}`);
|
|
1186
|
+
const content = bundledScripts.authHooks.get(funcName);
|
|
1187
|
+
if (!content) {
|
|
1188
|
+
logger.warn(`Bundled code not found for auth hook: ${funcName}`);
|
|
1189
|
+
continue;
|
|
1194
1190
|
}
|
|
1191
|
+
entries.push({
|
|
1192
|
+
name: funcName,
|
|
1193
|
+
scriptContent: content,
|
|
1194
|
+
contentHash: computeContentHash(content),
|
|
1195
|
+
description: `Auth hook: ${authName}/before-login`
|
|
1196
|
+
});
|
|
1195
1197
|
}
|
|
1196
1198
|
return entries;
|
|
1197
1199
|
}
|
|
@@ -5048,7 +5050,6 @@ async function bundleMigrationScript(sourceFile, namespace, migrationNumber) {
|
|
|
5048
5050
|
const outputDir = path.resolve(getDistDir(), "migrations");
|
|
5049
5051
|
fs$1.mkdirSync(outputDir, { recursive: true });
|
|
5050
5052
|
const entryPath = path.join(outputDir, `migration_${namespace}_${migrationNumber}.entry.js`);
|
|
5051
|
-
const outputPath = path.join(outputDir, `migration_${namespace}_${migrationNumber}.js`);
|
|
5052
5053
|
const entryContent = ml`
|
|
5053
5054
|
import { main as _migrationMain } from "${path.resolve(sourceFile).replace(/\\/g, "/")}";
|
|
5054
5055
|
import { Kysely, TailordbDialect } from "@tailor-platform/sdk/kysely";
|
|
@@ -5075,30 +5076,29 @@ async function bundleMigrationScript(sourceFile, namespace, migrationNumber) {
|
|
|
5075
5076
|
} catch {
|
|
5076
5077
|
tsconfig = void 0;
|
|
5077
5078
|
}
|
|
5078
|
-
await rolldown.build(rolldown.defineConfig({
|
|
5079
|
-
input: entryPath,
|
|
5080
|
-
output: {
|
|
5081
|
-
file: outputPath,
|
|
5082
|
-
format: "esm",
|
|
5083
|
-
sourcemap: false,
|
|
5084
|
-
minify: false,
|
|
5085
|
-
codeSplitting: false,
|
|
5086
|
-
globals: { tailordb: "tailordb" }
|
|
5087
|
-
},
|
|
5088
|
-
external: ["tailordb"],
|
|
5089
|
-
resolve: { conditionNames: ["node", "import"] },
|
|
5090
|
-
tsconfig,
|
|
5091
|
-
treeshake: {
|
|
5092
|
-
moduleSideEffects: false,
|
|
5093
|
-
annotations: true,
|
|
5094
|
-
unknownGlobalSideEffects: false
|
|
5095
|
-
},
|
|
5096
|
-
logLevel: "silent"
|
|
5097
|
-
}));
|
|
5098
5079
|
return {
|
|
5099
5080
|
namespace,
|
|
5100
5081
|
migrationNumber,
|
|
5101
|
-
bundledCode:
|
|
5082
|
+
bundledCode: (await rolldown.build({
|
|
5083
|
+
input: entryPath,
|
|
5084
|
+
write: false,
|
|
5085
|
+
output: {
|
|
5086
|
+
format: "esm",
|
|
5087
|
+
sourcemap: false,
|
|
5088
|
+
minify: false,
|
|
5089
|
+
codeSplitting: false,
|
|
5090
|
+
globals: { tailordb: "tailordb" }
|
|
5091
|
+
},
|
|
5092
|
+
external: ["tailordb"],
|
|
5093
|
+
resolve: { conditionNames: ["node", "import"] },
|
|
5094
|
+
tsconfig,
|
|
5095
|
+
treeshake: {
|
|
5096
|
+
moduleSideEffects: false,
|
|
5097
|
+
annotations: true,
|
|
5098
|
+
unknownGlobalSideEffects: false
|
|
5099
|
+
},
|
|
5100
|
+
logLevel: "silent"
|
|
5101
|
+
})).output[0].code
|
|
5102
5102
|
};
|
|
5103
5103
|
}
|
|
5104
5104
|
|
|
@@ -6705,12 +6705,12 @@ async function planWorkflow(client, workspaceId, appName, workflows, mainJobDeps
|
|
|
6705
6705
|
/**
|
|
6706
6706
|
* Apply the configured application to the Tailor platform.
|
|
6707
6707
|
* @param options - Options for apply execution
|
|
6708
|
-
* @returns Promise that resolves when
|
|
6708
|
+
* @returns Promise that resolves to `{ bundledScripts }` when `buildOnly` is true, otherwise void
|
|
6709
6709
|
*/
|
|
6710
6710
|
async function apply(options) {
|
|
6711
6711
|
return withSpan("apply", async (rootSpan) => {
|
|
6712
6712
|
rootSpan.setAttribute("apply.dry_run", options?.dryRun ?? false);
|
|
6713
|
-
const { config, application, workflowBuildResult, buildOnly } = await withSpan("build", async () => {
|
|
6713
|
+
const { config, application, workflowBuildResult, bundledScripts, buildOnly } = await withSpan("build", async () => {
|
|
6714
6714
|
const { config, plugins } = await withSpan("build.loadConfig", () => loadConfig(options?.configPath));
|
|
6715
6715
|
const dryRun = options?.dryRun ?? false;
|
|
6716
6716
|
const buildOnly = options?.buildOnly ?? process.env.TAILOR_PLATFORM_SDK_BUILD_ONLY === "true";
|
|
@@ -6740,6 +6740,7 @@ async function apply(options) {
|
|
|
6740
6740
|
}));
|
|
6741
6741
|
let application;
|
|
6742
6742
|
let workflowBuildResult;
|
|
6743
|
+
let bundledScripts;
|
|
6743
6744
|
try {
|
|
6744
6745
|
const result = await withSpan("build.loadApplication", () => loadApplication({
|
|
6745
6746
|
config,
|
|
@@ -6748,6 +6749,7 @@ async function apply(options) {
|
|
|
6748
6749
|
}));
|
|
6749
6750
|
application = result.application;
|
|
6750
6751
|
workflowBuildResult = result.workflowBuildResult;
|
|
6752
|
+
bundledScripts = result.bundledScripts;
|
|
6751
6753
|
} finally {
|
|
6752
6754
|
cacheManager.finalize();
|
|
6753
6755
|
}
|
|
@@ -6756,23 +6758,24 @@ async function apply(options) {
|
|
|
6756
6758
|
plugins,
|
|
6757
6759
|
application,
|
|
6758
6760
|
workflowBuildResult,
|
|
6761
|
+
bundledScripts,
|
|
6759
6762
|
dryRun,
|
|
6760
6763
|
buildOnly
|
|
6761
6764
|
};
|
|
6762
6765
|
});
|
|
6763
|
-
if (buildOnly) return;
|
|
6766
|
+
if (buildOnly) return { bundledScripts };
|
|
6764
6767
|
const client = await initOperatorClient(await loadAccessToken({
|
|
6765
6768
|
useProfile: true,
|
|
6766
6769
|
profile: options?.profile
|
|
6767
6770
|
}));
|
|
6768
|
-
const workspaceId = loadWorkspaceId({
|
|
6771
|
+
const workspaceId = await loadWorkspaceId({
|
|
6769
6772
|
workspaceId: options?.workspaceId,
|
|
6770
6773
|
profile: options?.profile
|
|
6771
6774
|
});
|
|
6772
6775
|
rootSpan.setAttribute("app.name", application.name);
|
|
6773
6776
|
rootSpan.setAttribute("workspace.id", workspaceId);
|
|
6774
6777
|
const workflowService = application.workflowService;
|
|
6775
|
-
const functionEntries = collectFunctionEntries(application, workflowService?.jobs ?? []);
|
|
6778
|
+
const functionEntries = collectFunctionEntries(application, workflowService?.jobs ?? [], bundledScripts);
|
|
6776
6779
|
const dryRun = options?.dryRun ?? false;
|
|
6777
6780
|
const yes = options?.yes ?? false;
|
|
6778
6781
|
const { functionRegistry, tailorDB, staticWebsite, idp, auth, pipeline, app, executor, workflow, secretManager } = await withSpan("plan", async () => {
|
|
@@ -7204,7 +7207,7 @@ async function getExecutor(options) {
|
|
|
7204
7207
|
useProfile: true,
|
|
7205
7208
|
profile: options.profile
|
|
7206
7209
|
}));
|
|
7207
|
-
const workspaceId = loadWorkspaceId({
|
|
7210
|
+
const workspaceId = await loadWorkspaceId({
|
|
7208
7211
|
workspaceId: options.workspaceId,
|
|
7209
7212
|
profile: options.profile
|
|
7210
7213
|
});
|
|
@@ -7215,7 +7218,7 @@ async function getExecutor(options) {
|
|
|
7215
7218
|
throw error;
|
|
7216
7219
|
}
|
|
7217
7220
|
}
|
|
7218
|
-
const getCommand$
|
|
7221
|
+
const getCommand$5 = defineAppCommand({
|
|
7219
7222
|
name: "get",
|
|
7220
7223
|
description: "Get executor details",
|
|
7221
7224
|
args: z.object({
|
|
@@ -7456,7 +7459,7 @@ async function listWorkflowExecutions(options) {
|
|
|
7456
7459
|
useProfile: true,
|
|
7457
7460
|
profile: options?.profile
|
|
7458
7461
|
}));
|
|
7459
|
-
const workspaceId = loadWorkspaceId({
|
|
7462
|
+
const workspaceId = await loadWorkspaceId({
|
|
7460
7463
|
workspaceId: options?.workspaceId,
|
|
7461
7464
|
profile: options?.profile
|
|
7462
7465
|
});
|
|
@@ -7495,7 +7498,7 @@ async function getWorkflowExecution(options) {
|
|
|
7495
7498
|
useProfile: true,
|
|
7496
7499
|
profile: options.profile
|
|
7497
7500
|
}));
|
|
7498
|
-
const workspaceId = loadWorkspaceId({
|
|
7501
|
+
const workspaceId = await loadWorkspaceId({
|
|
7499
7502
|
workspaceId: options.workspaceId,
|
|
7500
7503
|
profile: options.profile
|
|
7501
7504
|
});
|
|
@@ -7680,7 +7683,7 @@ async function getWorkflow(options) {
|
|
|
7680
7683
|
useProfile: true,
|
|
7681
7684
|
profile: options.profile
|
|
7682
7685
|
}));
|
|
7683
|
-
const workspaceId = loadWorkspaceId({
|
|
7686
|
+
const workspaceId = await loadWorkspaceId({
|
|
7684
7687
|
workspaceId: options.workspaceId,
|
|
7685
7688
|
profile: options.profile
|
|
7686
7689
|
});
|
|
@@ -7691,7 +7694,7 @@ async function getWorkflow(options) {
|
|
|
7691
7694
|
throw error;
|
|
7692
7695
|
}
|
|
7693
7696
|
}
|
|
7694
|
-
const getCommand$
|
|
7697
|
+
const getCommand$4 = defineAppCommand({
|
|
7695
7698
|
name: "get",
|
|
7696
7699
|
description: "Get workflow details.",
|
|
7697
7700
|
args: z.object({
|
|
@@ -7827,7 +7830,7 @@ async function startWorkflowByName(options) {
|
|
|
7827
7830
|
useProfile: true,
|
|
7828
7831
|
profile: options.profile
|
|
7829
7832
|
}));
|
|
7830
|
-
const workspaceId = loadWorkspaceId({
|
|
7833
|
+
const workspaceId = await loadWorkspaceId({
|
|
7831
7834
|
workspaceId: options.workspaceId,
|
|
7832
7835
|
profile: options.profile
|
|
7833
7836
|
});
|
|
@@ -7856,7 +7859,7 @@ async function startWorkflow(options) {
|
|
|
7856
7859
|
useProfile: true,
|
|
7857
7860
|
profile: options.profile
|
|
7858
7861
|
})),
|
|
7859
|
-
workspaceId: loadWorkspaceId({
|
|
7862
|
+
workspaceId: await loadWorkspaceId({
|
|
7860
7863
|
workspaceId: options.workspaceId,
|
|
7861
7864
|
profile: options.profile
|
|
7862
7865
|
}),
|
|
@@ -7919,7 +7922,7 @@ async function listExecutorJobs(options) {
|
|
|
7919
7922
|
useProfile: true,
|
|
7920
7923
|
profile: options.profile
|
|
7921
7924
|
}));
|
|
7922
|
-
const workspaceId = loadWorkspaceId({
|
|
7925
|
+
const workspaceId = await loadWorkspaceId({
|
|
7923
7926
|
workspaceId: options.workspaceId,
|
|
7924
7927
|
profile: options.profile
|
|
7925
7928
|
});
|
|
@@ -7956,7 +7959,7 @@ async function getExecutorJob(options) {
|
|
|
7956
7959
|
useProfile: true,
|
|
7957
7960
|
profile: options.profile
|
|
7958
7961
|
}));
|
|
7959
|
-
const workspaceId = loadWorkspaceId({
|
|
7962
|
+
const workspaceId = await loadWorkspaceId({
|
|
7960
7963
|
workspaceId: options.workspaceId,
|
|
7961
7964
|
profile: options.profile
|
|
7962
7965
|
});
|
|
@@ -7996,7 +7999,7 @@ async function watchExecutorJob(options) {
|
|
|
7996
7999
|
useProfile: true,
|
|
7997
8000
|
profile: options.profile
|
|
7998
8001
|
}));
|
|
7999
|
-
const workspaceId = loadWorkspaceId({
|
|
8002
|
+
const workspaceId = await loadWorkspaceId({
|
|
8000
8003
|
workspaceId: options.workspaceId,
|
|
8001
8004
|
profile: options.profile
|
|
8002
8005
|
});
|
|
@@ -8297,7 +8300,7 @@ async function listExecutors(options) {
|
|
|
8297
8300
|
useProfile: true,
|
|
8298
8301
|
profile: options?.profile
|
|
8299
8302
|
}));
|
|
8300
|
-
const workspaceId = loadWorkspaceId({
|
|
8303
|
+
const workspaceId = await loadWorkspaceId({
|
|
8301
8304
|
workspaceId: options?.workspaceId,
|
|
8302
8305
|
profile: options?.profile
|
|
8303
8306
|
});
|
|
@@ -8310,7 +8313,7 @@ async function listExecutors(options) {
|
|
|
8310
8313
|
return [executors, nextPageToken];
|
|
8311
8314
|
})).map((e) => toExecutorListInfo(e));
|
|
8312
8315
|
}
|
|
8313
|
-
const listCommand$
|
|
8316
|
+
const listCommand$8 = defineAppCommand({
|
|
8314
8317
|
name: "list",
|
|
8315
8318
|
description: "List all executors",
|
|
8316
8319
|
args: z.object({ ...workspaceArgs }).strict(),
|
|
@@ -8364,7 +8367,7 @@ async function triggerExecutorByName(options) {
|
|
|
8364
8367
|
useProfile: true,
|
|
8365
8368
|
profile: options.profile
|
|
8366
8369
|
}));
|
|
8367
|
-
const workspaceId = loadWorkspaceId({
|
|
8370
|
+
const workspaceId = await loadWorkspaceId({
|
|
8368
8371
|
workspaceId: options.workspaceId,
|
|
8369
8372
|
profile: options.profile
|
|
8370
8373
|
});
|
|
@@ -8462,7 +8465,7 @@ The \`--logs\` option displays logs from the downstream execution when available
|
|
|
8462
8465
|
useProfile: true,
|
|
8463
8466
|
profile: args.profile
|
|
8464
8467
|
}));
|
|
8465
|
-
const workspaceId = loadWorkspaceId({
|
|
8468
|
+
const workspaceId = await loadWorkspaceId({
|
|
8466
8469
|
workspaceId: args["workspace-id"],
|
|
8467
8470
|
profile: args.profile
|
|
8468
8471
|
});
|
|
@@ -8562,7 +8565,7 @@ async function listWebhookExecutors(options) {
|
|
|
8562
8565
|
useProfile: true,
|
|
8563
8566
|
profile: options?.profile
|
|
8564
8567
|
}));
|
|
8565
|
-
const workspaceId = loadWorkspaceId({
|
|
8568
|
+
const workspaceId = await loadWorkspaceId({
|
|
8566
8569
|
workspaceId: options?.workspaceId,
|
|
8567
8570
|
profile: options?.profile
|
|
8568
8571
|
});
|
|
@@ -9491,7 +9494,7 @@ async function listMachineUsers(options) {
|
|
|
9491
9494
|
useProfile: true,
|
|
9492
9495
|
profile: options?.profile
|
|
9493
9496
|
}));
|
|
9494
|
-
const workspaceId = loadWorkspaceId({
|
|
9497
|
+
const workspaceId = await loadWorkspaceId({
|
|
9495
9498
|
workspaceId: options?.workspaceId,
|
|
9496
9499
|
profile: options?.profile
|
|
9497
9500
|
});
|
|
@@ -9511,7 +9514,7 @@ async function listMachineUsers(options) {
|
|
|
9511
9514
|
return [machineUsers, nextPageToken];
|
|
9512
9515
|
})).map(machineUserInfo);
|
|
9513
9516
|
}
|
|
9514
|
-
const listCommand$
|
|
9517
|
+
const listCommand$7 = defineAppCommand({
|
|
9515
9518
|
name: "list",
|
|
9516
9519
|
description: "List all machine users in the application.",
|
|
9517
9520
|
args: z.object({ ...deploymentArgs }).strict(),
|
|
@@ -9540,7 +9543,7 @@ async function getMachineUserToken(options) {
|
|
|
9540
9543
|
useProfile: true,
|
|
9541
9544
|
profile: options.profile
|
|
9542
9545
|
}));
|
|
9543
|
-
const workspaceId = loadWorkspaceId({
|
|
9546
|
+
const workspaceId = await loadWorkspaceId({
|
|
9544
9547
|
workspaceId: options.workspaceId,
|
|
9545
9548
|
profile: options.profile
|
|
9546
9549
|
});
|
|
@@ -9644,7 +9647,7 @@ async function getOAuth2Client(options) {
|
|
|
9644
9647
|
useProfile: true,
|
|
9645
9648
|
profile: options.profile
|
|
9646
9649
|
}));
|
|
9647
|
-
const workspaceId = loadWorkspaceId({
|
|
9650
|
+
const workspaceId = await loadWorkspaceId({
|
|
9648
9651
|
workspaceId: options.workspaceId,
|
|
9649
9652
|
profile: options.profile
|
|
9650
9653
|
});
|
|
@@ -9666,7 +9669,7 @@ async function getOAuth2Client(options) {
|
|
|
9666
9669
|
throw error;
|
|
9667
9670
|
}
|
|
9668
9671
|
}
|
|
9669
|
-
const getCommand$
|
|
9672
|
+
const getCommand$3 = defineAppCommand({
|
|
9670
9673
|
name: "get",
|
|
9671
9674
|
description: "Get OAuth2 client credentials (including client secret).",
|
|
9672
9675
|
args: z.object({
|
|
@@ -9699,7 +9702,7 @@ async function listOAuth2Clients(options) {
|
|
|
9699
9702
|
useProfile: true,
|
|
9700
9703
|
profile: options?.profile
|
|
9701
9704
|
}));
|
|
9702
|
-
const workspaceId = loadWorkspaceId({
|
|
9705
|
+
const workspaceId = await loadWorkspaceId({
|
|
9703
9706
|
workspaceId: options?.workspaceId,
|
|
9704
9707
|
profile: options?.profile
|
|
9705
9708
|
});
|
|
@@ -9719,7 +9722,7 @@ async function listOAuth2Clients(options) {
|
|
|
9719
9722
|
return [oauth2Clients, nextPageToken];
|
|
9720
9723
|
})).map(toOAuth2ClientInfo);
|
|
9721
9724
|
}
|
|
9722
|
-
const listCommand$
|
|
9725
|
+
const listCommand$6 = defineAppCommand({
|
|
9723
9726
|
name: "list",
|
|
9724
9727
|
description: "List all OAuth2 clients in the application.",
|
|
9725
9728
|
args: z.object({ ...deploymentArgs }).strict(),
|
|
@@ -9733,6 +9736,501 @@ const listCommand$4 = defineAppCommand({
|
|
|
9733
9736
|
}
|
|
9734
9737
|
});
|
|
9735
9738
|
|
|
9739
|
+
//#endregion
|
|
9740
|
+
//#region src/cli/commands/organization/transform.ts
|
|
9741
|
+
const userOrganizationInfo = (org) => ({
|
|
9742
|
+
organizationId: org.organizationId,
|
|
9743
|
+
organizationName: org.organizationName,
|
|
9744
|
+
rootFolderId: org.rootFolderId,
|
|
9745
|
+
rootFolderName: org.rootFolderName,
|
|
9746
|
+
displayName: org.displayName
|
|
9747
|
+
});
|
|
9748
|
+
const organizationInfo = (org) => ({
|
|
9749
|
+
id: org.id,
|
|
9750
|
+
name: org.name,
|
|
9751
|
+
createdAt: formatTimestamp(org.createTime),
|
|
9752
|
+
updatedAt: formatTimestamp(org.updateTime)
|
|
9753
|
+
});
|
|
9754
|
+
const folderListInfo = (folder) => ({
|
|
9755
|
+
id: folder.id,
|
|
9756
|
+
name: folder.name,
|
|
9757
|
+
organizationId: folder.organizationId,
|
|
9758
|
+
parentFolderId: folder.parentFolderId,
|
|
9759
|
+
hasChildren: folder.hasChildren,
|
|
9760
|
+
createdAt: formatTimestamp(folder.createTime)
|
|
9761
|
+
});
|
|
9762
|
+
const folderInfo = (folder) => ({
|
|
9763
|
+
...folderListInfo(folder),
|
|
9764
|
+
updatedAt: formatTimestamp(folder.updateTime)
|
|
9765
|
+
});
|
|
9766
|
+
|
|
9767
|
+
//#endregion
|
|
9768
|
+
//#region src/cli/commands/organization/folder/create.ts
|
|
9769
|
+
const createFolderOptionsSchema = z.object({
|
|
9770
|
+
organizationId: z.uuid({ message: "organization-id must be a valid UUID" }),
|
|
9771
|
+
parentFolderId: z.string().optional(),
|
|
9772
|
+
name: z.string().min(1, "Name must not be empty")
|
|
9773
|
+
});
|
|
9774
|
+
/**
|
|
9775
|
+
* Create a new folder in an organization.
|
|
9776
|
+
* @param options - Folder creation options
|
|
9777
|
+
* @returns Created folder details
|
|
9778
|
+
*/
|
|
9779
|
+
async function createFolder(options) {
|
|
9780
|
+
const result = createFolderOptionsSchema.safeParse(options);
|
|
9781
|
+
if (!result.success) throw new Error(result.error.issues[0].message);
|
|
9782
|
+
const response = await (await initOperatorClient(await loadAccessToken())).createOrganizationFolder({
|
|
9783
|
+
organizationId: result.data.organizationId,
|
|
9784
|
+
parentFolderId: result.data.parentFolderId ?? "",
|
|
9785
|
+
folderName: result.data.name
|
|
9786
|
+
});
|
|
9787
|
+
if (!response.folder) throw new Error("Failed to create folder.");
|
|
9788
|
+
return folderInfo(response.folder);
|
|
9789
|
+
}
|
|
9790
|
+
const createCommand$1 = defineAppCommand({
|
|
9791
|
+
name: "create",
|
|
9792
|
+
description: "Create a new folder in an organization.",
|
|
9793
|
+
args: z.object({
|
|
9794
|
+
...organizationArgs,
|
|
9795
|
+
"parent-folder-id": arg(z.string().optional(), { description: "Parent folder ID" }),
|
|
9796
|
+
name: arg(z.string(), {
|
|
9797
|
+
alias: "n",
|
|
9798
|
+
description: "Folder name"
|
|
9799
|
+
})
|
|
9800
|
+
}).strict(),
|
|
9801
|
+
run: async (args) => {
|
|
9802
|
+
const folder = await createFolder({
|
|
9803
|
+
organizationId: args["organization-id"],
|
|
9804
|
+
parentFolderId: args["parent-folder-id"],
|
|
9805
|
+
name: args.name
|
|
9806
|
+
});
|
|
9807
|
+
if (!args.json) logger.success(`Folder "${folder.name}" created successfully.`);
|
|
9808
|
+
logger.out(folder);
|
|
9809
|
+
}
|
|
9810
|
+
});
|
|
9811
|
+
|
|
9812
|
+
//#endregion
|
|
9813
|
+
//#region src/cli/commands/organization/folder/delete.ts
|
|
9814
|
+
const deleteFolderOptionsSchema = z.object({
|
|
9815
|
+
organizationId: z.uuid({ message: "organization-id must be a valid UUID" }),
|
|
9816
|
+
folderId: z.uuid({ message: "folder-id must be a valid UUID" })
|
|
9817
|
+
});
|
|
9818
|
+
/**
|
|
9819
|
+
* Delete a folder from an organization.
|
|
9820
|
+
* @param options - Folder deletion options
|
|
9821
|
+
* @returns Promise that resolves when deletion completes
|
|
9822
|
+
*/
|
|
9823
|
+
async function deleteFolder(options) {
|
|
9824
|
+
const result = deleteFolderOptionsSchema.safeParse(options);
|
|
9825
|
+
if (!result.success) throw new Error(result.error.issues[0].message);
|
|
9826
|
+
await (await initOperatorClient(await loadAccessToken())).deleteOrganizationFolder({
|
|
9827
|
+
organizationId: result.data.organizationId,
|
|
9828
|
+
folderId: result.data.folderId
|
|
9829
|
+
});
|
|
9830
|
+
}
|
|
9831
|
+
const deleteCommand$1 = defineAppCommand({
|
|
9832
|
+
name: "delete",
|
|
9833
|
+
description: "Delete a folder from an organization.",
|
|
9834
|
+
args: z.object({
|
|
9835
|
+
...organizationArgs,
|
|
9836
|
+
...folderArgs,
|
|
9837
|
+
...confirmationArgs
|
|
9838
|
+
}).strict(),
|
|
9839
|
+
run: async (args) => {
|
|
9840
|
+
const client = await initOperatorClient(await loadAccessToken());
|
|
9841
|
+
let folderName;
|
|
9842
|
+
try {
|
|
9843
|
+
folderName = (await client.getOrganizationFolder({
|
|
9844
|
+
organizationId: args["organization-id"],
|
|
9845
|
+
folderId: args["folder-id"]
|
|
9846
|
+
})).folder?.name;
|
|
9847
|
+
} catch {
|
|
9848
|
+
throw new Error(`Folder "${args["folder-id"]}" not found.`);
|
|
9849
|
+
}
|
|
9850
|
+
if (!args.yes) {
|
|
9851
|
+
if (!await prompt.confirm({ message: `Are you sure you want to delete folder "${folderName}"?` })) {
|
|
9852
|
+
logger.info("Folder deletion cancelled.");
|
|
9853
|
+
return;
|
|
9854
|
+
}
|
|
9855
|
+
}
|
|
9856
|
+
await client.deleteOrganizationFolder({
|
|
9857
|
+
organizationId: args["organization-id"],
|
|
9858
|
+
folderId: args["folder-id"]
|
|
9859
|
+
});
|
|
9860
|
+
logger.success(`Folder "${folderName}" deleted successfully.`);
|
|
9861
|
+
}
|
|
9862
|
+
});
|
|
9863
|
+
|
|
9864
|
+
//#endregion
|
|
9865
|
+
//#region src/cli/commands/organization/folder/get.ts
|
|
9866
|
+
const getFolderOptionsSchema = z.object({
|
|
9867
|
+
organizationId: z.uuid({ message: "organization-id must be a valid UUID" }),
|
|
9868
|
+
folderId: z.uuid({ message: "folder-id must be a valid UUID" })
|
|
9869
|
+
});
|
|
9870
|
+
/**
|
|
9871
|
+
* Get detailed information about a folder.
|
|
9872
|
+
* @param options - Folder get options
|
|
9873
|
+
* @returns Folder details
|
|
9874
|
+
*/
|
|
9875
|
+
async function getFolder(options) {
|
|
9876
|
+
const result = getFolderOptionsSchema.safeParse(options);
|
|
9877
|
+
if (!result.success) throw new Error(result.error.issues[0].message);
|
|
9878
|
+
const response = await (await initOperatorClient(await loadAccessToken())).getOrganizationFolder({
|
|
9879
|
+
organizationId: result.data.organizationId,
|
|
9880
|
+
folderId: result.data.folderId
|
|
9881
|
+
});
|
|
9882
|
+
if (!response.folder) throw new Error(`Folder "${result.data.folderId}" not found.`);
|
|
9883
|
+
return folderInfo(response.folder);
|
|
9884
|
+
}
|
|
9885
|
+
const getCommand$2 = defineAppCommand({
|
|
9886
|
+
name: "get",
|
|
9887
|
+
description: "Show detailed information about a folder.",
|
|
9888
|
+
args: z.object({
|
|
9889
|
+
...organizationArgs,
|
|
9890
|
+
...folderArgs
|
|
9891
|
+
}).strict(),
|
|
9892
|
+
run: async (args) => {
|
|
9893
|
+
const folder = await getFolder({
|
|
9894
|
+
organizationId: args["organization-id"],
|
|
9895
|
+
folderId: args["folder-id"]
|
|
9896
|
+
});
|
|
9897
|
+
const formattedFolder = args.json ? folder : {
|
|
9898
|
+
...folder,
|
|
9899
|
+
createdAt: humanizeRelativeTime(folder.createdAt),
|
|
9900
|
+
updatedAt: humanizeRelativeTime(folder.updatedAt)
|
|
9901
|
+
};
|
|
9902
|
+
logger.out(formattedFolder);
|
|
9903
|
+
}
|
|
9904
|
+
});
|
|
9905
|
+
|
|
9906
|
+
//#endregion
|
|
9907
|
+
//#region src/cli/commands/organization/folder/list.ts
|
|
9908
|
+
const listFoldersOptionsSchema = z.object({
|
|
9909
|
+
organizationId: z.uuid({ message: "organization-id must be a valid UUID" }),
|
|
9910
|
+
parentFolderId: z.string().optional(),
|
|
9911
|
+
limit: z.number().int().positive().optional()
|
|
9912
|
+
});
|
|
9913
|
+
/**
|
|
9914
|
+
* List folders in an organization.
|
|
9915
|
+
* @param options - Folder listing options
|
|
9916
|
+
* @returns List of folders
|
|
9917
|
+
*/
|
|
9918
|
+
async function listFolders(options) {
|
|
9919
|
+
const result = listFoldersOptionsSchema.safeParse(options);
|
|
9920
|
+
if (!result.success) throw new Error(result.error.issues[0].message);
|
|
9921
|
+
const { organizationId, parentFolderId, limit } = result.data;
|
|
9922
|
+
const hasLimit = limit !== void 0;
|
|
9923
|
+
const client = await initOperatorClient(await loadAccessToken());
|
|
9924
|
+
const results = [];
|
|
9925
|
+
let pageToken = "";
|
|
9926
|
+
while (true) {
|
|
9927
|
+
if (hasLimit && results.length >= limit) break;
|
|
9928
|
+
const remaining = hasLimit ? limit - results.length : void 0;
|
|
9929
|
+
const pageSize = remaining !== void 0 && remaining > 0 ? remaining : void 0;
|
|
9930
|
+
const response = await client.listOrganizationFolders({
|
|
9931
|
+
organizationId,
|
|
9932
|
+
...parentFolderId ? { parentFolderId } : {},
|
|
9933
|
+
pageToken,
|
|
9934
|
+
...pageSize !== void 0 ? { pageSize } : {}
|
|
9935
|
+
});
|
|
9936
|
+
const mapped = response.folders.map(folderListInfo);
|
|
9937
|
+
if (remaining !== void 0 && mapped.length > remaining) results.push(...mapped.slice(0, remaining));
|
|
9938
|
+
else results.push(...mapped);
|
|
9939
|
+
if (!response.nextPageToken) break;
|
|
9940
|
+
pageToken = response.nextPageToken;
|
|
9941
|
+
}
|
|
9942
|
+
return results;
|
|
9943
|
+
}
|
|
9944
|
+
const listCommand$5 = defineAppCommand({
|
|
9945
|
+
name: "list",
|
|
9946
|
+
description: "List folders in an organization.",
|
|
9947
|
+
args: z.object({
|
|
9948
|
+
...organizationArgs,
|
|
9949
|
+
"parent-folder-id": arg(z.string().optional(), { description: "Parent folder ID to list children of" }),
|
|
9950
|
+
limit: arg(positiveIntArg.optional(), {
|
|
9951
|
+
alias: "l",
|
|
9952
|
+
description: "Maximum number of folders to list"
|
|
9953
|
+
})
|
|
9954
|
+
}).strict(),
|
|
9955
|
+
run: async (args) => {
|
|
9956
|
+
const folders = await listFolders({
|
|
9957
|
+
organizationId: args["organization-id"],
|
|
9958
|
+
parentFolderId: args["parent-folder-id"],
|
|
9959
|
+
limit: args.limit
|
|
9960
|
+
});
|
|
9961
|
+
logger.out(folders, { display: { updatedAt: null } });
|
|
9962
|
+
}
|
|
9963
|
+
});
|
|
9964
|
+
|
|
9965
|
+
//#endregion
|
|
9966
|
+
//#region src/cli/commands/organization/folder/update.ts
|
|
9967
|
+
const updateFolderOptionsSchema = z.object({
|
|
9968
|
+
organizationId: z.uuid({ message: "organization-id must be a valid UUID" }),
|
|
9969
|
+
folderId: z.uuid({ message: "folder-id must be a valid UUID" }),
|
|
9970
|
+
name: z.string().min(1, "Name must not be empty")
|
|
9971
|
+
});
|
|
9972
|
+
/**
|
|
9973
|
+
* Update a folder's name.
|
|
9974
|
+
* @param options - Folder update options
|
|
9975
|
+
* @returns Updated folder details
|
|
9976
|
+
*/
|
|
9977
|
+
async function updateFolder(options) {
|
|
9978
|
+
const result = updateFolderOptionsSchema.safeParse(options);
|
|
9979
|
+
if (!result.success) throw new Error(result.error.issues[0].message);
|
|
9980
|
+
const response = await (await initOperatorClient(await loadAccessToken())).updateOrganizationFolder({
|
|
9981
|
+
organizationId: result.data.organizationId,
|
|
9982
|
+
folderId: result.data.folderId,
|
|
9983
|
+
folderName: result.data.name
|
|
9984
|
+
});
|
|
9985
|
+
if (!response.folder) throw new Error(`Failed to update folder "${result.data.folderId}".`);
|
|
9986
|
+
return folderInfo(response.folder);
|
|
9987
|
+
}
|
|
9988
|
+
const updateCommand$2 = defineAppCommand({
|
|
9989
|
+
name: "update",
|
|
9990
|
+
description: "Update a folder's name.",
|
|
9991
|
+
args: z.object({
|
|
9992
|
+
...organizationArgs,
|
|
9993
|
+
...folderArgs,
|
|
9994
|
+
name: arg(z.string(), {
|
|
9995
|
+
alias: "n",
|
|
9996
|
+
description: "New folder name"
|
|
9997
|
+
})
|
|
9998
|
+
}).strict(),
|
|
9999
|
+
run: async (args) => {
|
|
10000
|
+
const folder = await updateFolder({
|
|
10001
|
+
organizationId: args["organization-id"],
|
|
10002
|
+
folderId: args["folder-id"],
|
|
10003
|
+
name: args.name
|
|
10004
|
+
});
|
|
10005
|
+
if (!args.json) logger.success(`Folder "${folder.name}" updated successfully.`);
|
|
10006
|
+
logger.out(folder);
|
|
10007
|
+
}
|
|
10008
|
+
});
|
|
10009
|
+
|
|
10010
|
+
//#endregion
|
|
10011
|
+
//#region src/cli/commands/organization/get.ts
|
|
10012
|
+
const getOrganizationOptionsSchema = z.object({ organizationId: z.uuid({ message: "organization-id must be a valid UUID" }) });
|
|
10013
|
+
/**
|
|
10014
|
+
* Get detailed information about an organization.
|
|
10015
|
+
* @param options - Organization get options
|
|
10016
|
+
* @returns Organization details
|
|
10017
|
+
*/
|
|
10018
|
+
async function getOrganization(options) {
|
|
10019
|
+
const result = getOrganizationOptionsSchema.safeParse(options);
|
|
10020
|
+
if (!result.success) throw new Error(result.error.issues[0].message);
|
|
10021
|
+
const response = await (await initOperatorClient(await loadAccessToken())).getOrganization({ organizationId: result.data.organizationId });
|
|
10022
|
+
if (!response.organization) throw new Error(`Organization "${result.data.organizationId}" not found.`);
|
|
10023
|
+
return organizationInfo(response.organization);
|
|
10024
|
+
}
|
|
10025
|
+
const getCommand$1 = defineAppCommand({
|
|
10026
|
+
name: "get",
|
|
10027
|
+
description: "Show detailed information about an organization.",
|
|
10028
|
+
args: z.object({ ...organizationArgs }).strict(),
|
|
10029
|
+
run: async (args) => {
|
|
10030
|
+
const organization = await getOrganization({ organizationId: args["organization-id"] });
|
|
10031
|
+
const formattedOrganization = args.json ? organization : {
|
|
10032
|
+
...organization,
|
|
10033
|
+
createdAt: humanizeRelativeTime(organization.createdAt),
|
|
10034
|
+
updatedAt: humanizeRelativeTime(organization.updatedAt)
|
|
10035
|
+
};
|
|
10036
|
+
logger.out(formattedOrganization);
|
|
10037
|
+
}
|
|
10038
|
+
});
|
|
10039
|
+
|
|
10040
|
+
//#endregion
|
|
10041
|
+
//#region src/cli/commands/organization/list.ts
|
|
10042
|
+
/**
|
|
10043
|
+
* List organizations the current user belongs to.
|
|
10044
|
+
* @param options - Organization listing options
|
|
10045
|
+
* @returns List of user organizations
|
|
10046
|
+
*/
|
|
10047
|
+
async function listOrganizations(options) {
|
|
10048
|
+
const limit = options?.limit;
|
|
10049
|
+
const { userOrganizations } = await (await initOperatorClient(await loadAccessToken())).listUserOrganizations({});
|
|
10050
|
+
const results = userOrganizations.map(userOrganizationInfo);
|
|
10051
|
+
if (limit !== void 0) return results.slice(0, limit);
|
|
10052
|
+
return results;
|
|
10053
|
+
}
|
|
10054
|
+
const listCommand$4 = defineAppCommand({
|
|
10055
|
+
name: "list",
|
|
10056
|
+
description: "List organizations you belong to.",
|
|
10057
|
+
args: z.object({ limit: arg(positiveIntArg.optional(), {
|
|
10058
|
+
alias: "l",
|
|
10059
|
+
description: "Maximum number of organizations to list"
|
|
10060
|
+
}) }).strict(),
|
|
10061
|
+
run: async (args) => {
|
|
10062
|
+
const organizations = await listOrganizations({ limit: args.limit });
|
|
10063
|
+
logger.out(organizations);
|
|
10064
|
+
}
|
|
10065
|
+
});
|
|
10066
|
+
|
|
10067
|
+
//#endregion
|
|
10068
|
+
//#region src/cli/commands/organization/tree.ts
|
|
10069
|
+
async function fetchChildFolders(client, organizationId, parentFolderId, currentDepth, maxDepth) {
|
|
10070
|
+
if (maxDepth !== void 0 && currentDepth >= maxDepth) return [];
|
|
10071
|
+
const folders = await fetchAll(async (pageToken, maxPageSize) => {
|
|
10072
|
+
const response = await client.listOrganizationFolders({
|
|
10073
|
+
organizationId,
|
|
10074
|
+
parentFolderId,
|
|
10075
|
+
pageToken,
|
|
10076
|
+
pageSize: maxPageSize
|
|
10077
|
+
});
|
|
10078
|
+
return [response.folders, response.nextPageToken];
|
|
10079
|
+
});
|
|
10080
|
+
const nodes = [];
|
|
10081
|
+
for (const folder of folders) {
|
|
10082
|
+
const children = folder.hasChildren ? await fetchChildFolders(client, organizationId, folder.id, currentDepth + 1, maxDepth) : [];
|
|
10083
|
+
nodes.push({
|
|
10084
|
+
name: folder.name,
|
|
10085
|
+
children
|
|
10086
|
+
});
|
|
10087
|
+
}
|
|
10088
|
+
return nodes;
|
|
10089
|
+
}
|
|
10090
|
+
async function buildFolderTreeJson(client, organizationId, parentFolderId, currentDepth, maxDepth) {
|
|
10091
|
+
if (maxDepth !== void 0 && currentDepth >= maxDepth) return [];
|
|
10092
|
+
const folders = await fetchAll(async (pageToken, maxPageSize) => {
|
|
10093
|
+
const response = await client.listOrganizationFolders({
|
|
10094
|
+
organizationId,
|
|
10095
|
+
parentFolderId,
|
|
10096
|
+
pageToken,
|
|
10097
|
+
pageSize: maxPageSize
|
|
10098
|
+
});
|
|
10099
|
+
return [response.folders, response.nextPageToken];
|
|
10100
|
+
});
|
|
10101
|
+
const result = [];
|
|
10102
|
+
for (const folder of folders) {
|
|
10103
|
+
const children = folder.hasChildren ? await buildFolderTreeJson(client, organizationId, folder.id, currentDepth + 1, maxDepth) : [];
|
|
10104
|
+
result.push({
|
|
10105
|
+
id: folder.id,
|
|
10106
|
+
name: folder.name,
|
|
10107
|
+
children
|
|
10108
|
+
});
|
|
10109
|
+
}
|
|
10110
|
+
return result;
|
|
10111
|
+
}
|
|
10112
|
+
function renderTree(nodes, prefix) {
|
|
10113
|
+
let output = "";
|
|
10114
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
10115
|
+
const isLast = i === nodes.length - 1;
|
|
10116
|
+
const connector = isLast ? "└── " : "├── ";
|
|
10117
|
+
const childPrefix = isLast ? " " : "│ ";
|
|
10118
|
+
output += `${prefix}${connector}${nodes[i].name}\n`;
|
|
10119
|
+
if (nodes[i].children.length > 0) output += renderTree(nodes[i].children, prefix + childPrefix);
|
|
10120
|
+
}
|
|
10121
|
+
return output;
|
|
10122
|
+
}
|
|
10123
|
+
async function buildOrgTree(client, org, depth) {
|
|
10124
|
+
const children = await fetchChildFolders(client, org.organizationId, org.rootFolderId, 0, depth);
|
|
10125
|
+
let output = `${org.organizationName}\n`;
|
|
10126
|
+
output += renderTree(children, "");
|
|
10127
|
+
return output;
|
|
10128
|
+
}
|
|
10129
|
+
/**
|
|
10130
|
+
* Display a tree view of organizations and their folder hierarchy.
|
|
10131
|
+
* @param options - Tree display options
|
|
10132
|
+
* @returns Organization tree as structured data
|
|
10133
|
+
*/
|
|
10134
|
+
async function organizationTree(options) {
|
|
10135
|
+
const client = await initOperatorClient(await loadAccessToken());
|
|
10136
|
+
let orgs;
|
|
10137
|
+
if (options?.organizationId) {
|
|
10138
|
+
orgs = (await listOrganizations()).filter((o) => o.organizationId === options.organizationId);
|
|
10139
|
+
if (orgs.length === 0) throw new Error(`Organization "${options.organizationId}" not found.`);
|
|
10140
|
+
} else orgs = await listOrganizations();
|
|
10141
|
+
const depth = options?.depth;
|
|
10142
|
+
const jsonResult = [];
|
|
10143
|
+
for (const org of orgs) {
|
|
10144
|
+
const folders = await buildFolderTreeJson(client, org.organizationId, org.rootFolderId, 0, depth);
|
|
10145
|
+
jsonResult.push({
|
|
10146
|
+
organizationId: org.organizationId,
|
|
10147
|
+
organizationName: org.organizationName,
|
|
10148
|
+
folders
|
|
10149
|
+
});
|
|
10150
|
+
}
|
|
10151
|
+
return jsonResult;
|
|
10152
|
+
}
|
|
10153
|
+
const treeCommand = defineAppCommand({
|
|
10154
|
+
name: "tree",
|
|
10155
|
+
description: "Display organization folder hierarchy as a tree.",
|
|
10156
|
+
args: z.object({
|
|
10157
|
+
"organization-id": arg(z.string().optional(), {
|
|
10158
|
+
alias: "o",
|
|
10159
|
+
description: "Organization ID (show all if omitted)",
|
|
10160
|
+
env: "TAILOR_PLATFORM_ORGANIZATION_ID"
|
|
10161
|
+
}),
|
|
10162
|
+
depth: arg(positiveIntArg.optional(), {
|
|
10163
|
+
alias: "d",
|
|
10164
|
+
description: "Maximum folder depth to display"
|
|
10165
|
+
})
|
|
10166
|
+
}).strict(),
|
|
10167
|
+
run: async (args) => {
|
|
10168
|
+
const client = await initOperatorClient(await loadAccessToken());
|
|
10169
|
+
let orgs;
|
|
10170
|
+
if (args["organization-id"]) {
|
|
10171
|
+
orgs = (await listOrganizations()).filter((o) => o.organizationId === args["organization-id"]);
|
|
10172
|
+
if (orgs.length === 0) throw new Error(`Organization "${args["organization-id"]}" not found.`);
|
|
10173
|
+
} else orgs = await listOrganizations();
|
|
10174
|
+
if (args.json) {
|
|
10175
|
+
const jsonResult = [];
|
|
10176
|
+
for (const org of orgs) {
|
|
10177
|
+
const folders = await buildFolderTreeJson(client, org.organizationId, org.rootFolderId, 0, args.depth);
|
|
10178
|
+
jsonResult.push({
|
|
10179
|
+
organizationId: org.organizationId,
|
|
10180
|
+
organizationName: org.organizationName,
|
|
10181
|
+
folders
|
|
10182
|
+
});
|
|
10183
|
+
}
|
|
10184
|
+
logger.out(jsonResult);
|
|
10185
|
+
return;
|
|
10186
|
+
}
|
|
10187
|
+
const trees = [];
|
|
10188
|
+
for (const org of orgs) trees.push(await buildOrgTree(client, org, args.depth));
|
|
10189
|
+
logger.log(trees.join("\n"));
|
|
10190
|
+
}
|
|
10191
|
+
});
|
|
10192
|
+
|
|
10193
|
+
//#endregion
|
|
10194
|
+
//#region src/cli/commands/organization/update.ts
|
|
10195
|
+
const updateOrganizationOptionsSchema = z.object({
|
|
10196
|
+
organizationId: z.uuid({ message: "organization-id must be a valid UUID" }),
|
|
10197
|
+
name: z.string().min(1, "Name must not be empty")
|
|
10198
|
+
});
|
|
10199
|
+
/**
|
|
10200
|
+
* Update an organization's name.
|
|
10201
|
+
* @param options - Organization update options
|
|
10202
|
+
* @returns Updated organization details
|
|
10203
|
+
*/
|
|
10204
|
+
async function updateOrganization(options) {
|
|
10205
|
+
const result = updateOrganizationOptionsSchema.safeParse(options);
|
|
10206
|
+
if (!result.success) throw new Error(result.error.issues[0].message);
|
|
10207
|
+
const response = await (await initOperatorClient(await loadAccessToken())).updateOrganization({
|
|
10208
|
+
organizationId: result.data.organizationId,
|
|
10209
|
+
organizationName: result.data.name
|
|
10210
|
+
});
|
|
10211
|
+
if (!response.organization) throw new Error(`Failed to update organization "${result.data.organizationId}".`);
|
|
10212
|
+
return organizationInfo(response.organization);
|
|
10213
|
+
}
|
|
10214
|
+
const updateCommand$1 = defineAppCommand({
|
|
10215
|
+
name: "update",
|
|
10216
|
+
description: "Update an organization's name.",
|
|
10217
|
+
args: z.object({
|
|
10218
|
+
...organizationArgs,
|
|
10219
|
+
name: arg(z.string(), {
|
|
10220
|
+
alias: "n",
|
|
10221
|
+
description: "New organization name"
|
|
10222
|
+
})
|
|
10223
|
+
}).strict(),
|
|
10224
|
+
run: async (args) => {
|
|
10225
|
+
const organization = await updateOrganization({
|
|
10226
|
+
organizationId: args["organization-id"],
|
|
10227
|
+
name: args.name
|
|
10228
|
+
});
|
|
10229
|
+
if (!args.json) logger.success(`Organization "${organization.name}" updated successfully.`);
|
|
10230
|
+
logger.out(organization);
|
|
10231
|
+
}
|
|
10232
|
+
});
|
|
10233
|
+
|
|
9736
10234
|
//#endregion
|
|
9737
10235
|
//#region src/cli/commands/remove.ts
|
|
9738
10236
|
async function loadOptions$10(options) {
|
|
@@ -9740,7 +10238,7 @@ async function loadOptions$10(options) {
|
|
|
9740
10238
|
useProfile: true,
|
|
9741
10239
|
profile: options?.profile
|
|
9742
10240
|
}));
|
|
9743
|
-
const workspaceId = loadWorkspaceId({
|
|
10241
|
+
const workspaceId = await loadWorkspaceId({
|
|
9744
10242
|
workspaceId: options?.workspaceId,
|
|
9745
10243
|
profile: options?.profile
|
|
9746
10244
|
});
|
|
@@ -9862,7 +10360,7 @@ async function show(options) {
|
|
|
9862
10360
|
useProfile: true,
|
|
9863
10361
|
profile: options?.profile
|
|
9864
10362
|
}));
|
|
9865
|
-
const workspaceId = loadWorkspaceId({
|
|
10363
|
+
const workspaceId = await loadWorkspaceId({
|
|
9866
10364
|
workspaceId: options?.workspaceId,
|
|
9867
10365
|
profile: options?.profile
|
|
9868
10366
|
});
|
|
@@ -10467,7 +10965,7 @@ async function generate(options) {
|
|
|
10467
10965
|
if (options.init) await handleInitOption(namespacesWithMigrations, options.yes);
|
|
10468
10966
|
let pluginManager;
|
|
10469
10967
|
if (plugins.length > 0) pluginManager = new PluginManager(plugins);
|
|
10470
|
-
const { defineApplication } = await import("./application-
|
|
10968
|
+
const { defineApplication } = await import("./application-B2-PymMz.mjs");
|
|
10471
10969
|
const application = defineApplication({
|
|
10472
10970
|
config,
|
|
10473
10971
|
pluginManager
|
|
@@ -10696,7 +11194,7 @@ async function $truncate(options) {
|
|
|
10696
11194
|
useProfile: true,
|
|
10697
11195
|
profile: options?.profile
|
|
10698
11196
|
}));
|
|
10699
|
-
const workspaceId = loadWorkspaceId({
|
|
11197
|
+
const workspaceId = await loadWorkspaceId({
|
|
10700
11198
|
workspaceId: options?.workspaceId,
|
|
10701
11199
|
profile: options?.profile
|
|
10702
11200
|
});
|
|
@@ -10822,7 +11320,7 @@ async function listWorkflows(options) {
|
|
|
10822
11320
|
useProfile: true,
|
|
10823
11321
|
profile: options?.profile
|
|
10824
11322
|
}));
|
|
10825
|
-
const workspaceId = loadWorkspaceId({
|
|
11323
|
+
const workspaceId = await loadWorkspaceId({
|
|
10826
11324
|
workspaceId: options?.workspaceId,
|
|
10827
11325
|
profile: options?.profile
|
|
10828
11326
|
});
|
|
@@ -10864,7 +11362,7 @@ async function resumeWorkflow(options) {
|
|
|
10864
11362
|
useProfile: true,
|
|
10865
11363
|
profile: options.profile
|
|
10866
11364
|
}));
|
|
10867
|
-
const workspaceId = loadWorkspaceId({
|
|
11365
|
+
const workspaceId = await loadWorkspaceId({
|
|
10868
11366
|
workspaceId: options.workspaceId,
|
|
10869
11367
|
profile: options.profile
|
|
10870
11368
|
});
|
|
@@ -10974,7 +11472,7 @@ async function loadOptions$9(options) {
|
|
|
10974
11472
|
if (!result.success) throw new Error(result.error.issues[0].message);
|
|
10975
11473
|
return {
|
|
10976
11474
|
client: await initOperatorClient(await loadAccessToken()),
|
|
10977
|
-
workspaceId: loadWorkspaceId({
|
|
11475
|
+
workspaceId: await loadWorkspaceId({
|
|
10978
11476
|
workspaceId: result.data.workspaceId,
|
|
10979
11477
|
profile: result.data.profile
|
|
10980
11478
|
}),
|
|
@@ -11030,7 +11528,7 @@ async function loadOptions$8(options) {
|
|
|
11030
11528
|
if (!result.success) throw new Error(result.error.issues[0].message);
|
|
11031
11529
|
return {
|
|
11032
11530
|
client: await initOperatorClient(await loadAccessToken()),
|
|
11033
|
-
workspaceId: loadWorkspaceId({
|
|
11531
|
+
workspaceId: await loadWorkspaceId({
|
|
11034
11532
|
workspaceId: result.data.workspaceId,
|
|
11035
11533
|
profile: result.data.profile
|
|
11036
11534
|
}),
|
|
@@ -11188,7 +11686,7 @@ const createCommand = defineAppCommand({
|
|
|
11188
11686
|
let profileInfo;
|
|
11189
11687
|
const profileName = args["profile-name"];
|
|
11190
11688
|
if (profileName) {
|
|
11191
|
-
const config = readPlatformConfig();
|
|
11689
|
+
const config = await readPlatformConfig();
|
|
11192
11690
|
if (config.profiles[profileName]) throw new Error(`Profile "${profileName}" already exists.`);
|
|
11193
11691
|
const profileUser = args["profile-user"] || config.current_user;
|
|
11194
11692
|
if (!profileUser) throw new Error("Current user not found. Please login or specify --profile-user to create a profile.");
|
|
@@ -11266,7 +11764,7 @@ const deleteCommand = defineAppCommand({
|
|
|
11266
11764
|
}
|
|
11267
11765
|
}
|
|
11268
11766
|
await client.deleteWorkspace({ workspaceId });
|
|
11269
|
-
const pfConfig = readPlatformConfig();
|
|
11767
|
+
const pfConfig = await readPlatformConfig();
|
|
11270
11768
|
const profilesToDelete = Object.entries(pfConfig.profiles).filter(([, profile]) => profile?.workspace_id === workspaceId);
|
|
11271
11769
|
if (profilesToDelete.length > 0) {
|
|
11272
11770
|
for (const [profileName] of profilesToDelete) delete pfConfig.profiles[profileName];
|
|
@@ -11288,7 +11786,7 @@ async function loadOptions$6(options) {
|
|
|
11288
11786
|
if (!result.success) throw new Error(result.error.issues[0].message);
|
|
11289
11787
|
return {
|
|
11290
11788
|
client: await initOperatorClient(await loadAccessToken()),
|
|
11291
|
-
workspaceId: loadWorkspaceId({
|
|
11789
|
+
workspaceId: await loadWorkspaceId({
|
|
11292
11790
|
workspaceId: result.data.workspaceId,
|
|
11293
11791
|
profile: result.data.profile
|
|
11294
11792
|
})
|
|
@@ -11452,7 +11950,7 @@ async function loadOptions$4(options) {
|
|
|
11452
11950
|
if (!result.success) throw new Error(result.error.issues[0].message);
|
|
11453
11951
|
return {
|
|
11454
11952
|
client: await initOperatorClient(await loadAccessToken()),
|
|
11455
|
-
workspaceId: loadWorkspaceId({
|
|
11953
|
+
workspaceId: await loadWorkspaceId({
|
|
11456
11954
|
workspaceId: result.data.workspaceId,
|
|
11457
11955
|
profile: result.data.profile
|
|
11458
11956
|
}),
|
|
@@ -11507,7 +12005,7 @@ async function loadOptions$3(options) {
|
|
|
11507
12005
|
if (!result.success) throw new Error(result.error.issues[0].message);
|
|
11508
12006
|
return {
|
|
11509
12007
|
client: await initOperatorClient(await loadAccessToken()),
|
|
11510
|
-
workspaceId: loadWorkspaceId({
|
|
12008
|
+
workspaceId: await loadWorkspaceId({
|
|
11511
12009
|
workspaceId: result.data.workspaceId,
|
|
11512
12010
|
profile: result.data.profile
|
|
11513
12011
|
}),
|
|
@@ -11573,7 +12071,7 @@ async function loadOptions$2(options) {
|
|
|
11573
12071
|
if (!result.success) throw new Error(result.error.issues[0].message);
|
|
11574
12072
|
return {
|
|
11575
12073
|
client: await initOperatorClient(await loadAccessToken()),
|
|
11576
|
-
workspaceId: loadWorkspaceId({
|
|
12074
|
+
workspaceId: await loadWorkspaceId({
|
|
11577
12075
|
workspaceId: result.data.workspaceId,
|
|
11578
12076
|
profile: result.data.profile
|
|
11579
12077
|
}),
|
|
@@ -11629,7 +12127,7 @@ async function loadOptions$1(options) {
|
|
|
11629
12127
|
if (!result.success) throw new Error(result.error.issues[0].message);
|
|
11630
12128
|
return {
|
|
11631
12129
|
client: await initOperatorClient(await loadAccessToken()),
|
|
11632
|
-
workspaceId: loadWorkspaceId({
|
|
12130
|
+
workspaceId: await loadWorkspaceId({
|
|
11633
12131
|
workspaceId: result.data.workspaceId,
|
|
11634
12132
|
profile: result.data.profile
|
|
11635
12133
|
}),
|
|
@@ -11751,7 +12249,6 @@ async function bundleQueryScript(engine) {
|
|
|
11751
12249
|
const outputDir = path.resolve(getDistDir(), "query");
|
|
11752
12250
|
fs$1.mkdirSync(outputDir, { recursive: true });
|
|
11753
12251
|
const entryPath = path.join(outputDir, `query_${engine}.entry.ts`);
|
|
11754
|
-
const outputPath = path.join(outputDir, `query_${engine}.js`);
|
|
11755
12252
|
const entryContent = engine === "sql" ? createSqlEntry() : createGqlEntry();
|
|
11756
12253
|
fs$1.writeFileSync(entryPath, entryContent);
|
|
11757
12254
|
let tsconfig;
|
|
@@ -11760,10 +12257,10 @@ async function bundleQueryScript(engine) {
|
|
|
11760
12257
|
} catch {
|
|
11761
12258
|
tsconfig = void 0;
|
|
11762
12259
|
}
|
|
11763
|
-
await rolldown.build(
|
|
12260
|
+
return (await rolldown.build({
|
|
11764
12261
|
input: entryPath,
|
|
12262
|
+
write: false,
|
|
11765
12263
|
output: {
|
|
11766
|
-
file: outputPath,
|
|
11767
12264
|
format: "esm",
|
|
11768
12265
|
sourcemap: false,
|
|
11769
12266
|
minify: false,
|
|
@@ -11779,8 +12276,7 @@ async function bundleQueryScript(engine) {
|
|
|
11779
12276
|
unknownGlobalSideEffects: false
|
|
11780
12277
|
},
|
|
11781
12278
|
logLevel: "silent"
|
|
11782
|
-
}));
|
|
11783
|
-
return fs$1.readFileSync(outputPath, "utf-8");
|
|
12279
|
+
})).output[0].code;
|
|
11784
12280
|
}
|
|
11785
12281
|
|
|
11786
12282
|
//#endregion
|
|
@@ -12108,7 +12604,7 @@ async function loadOptions(options) {
|
|
|
12108
12604
|
useProfile: true,
|
|
12109
12605
|
profile: result.data.profile
|
|
12110
12606
|
}));
|
|
12111
|
-
const workspaceId = loadWorkspaceId({
|
|
12607
|
+
const workspaceId = await loadWorkspaceId({
|
|
12112
12608
|
workspaceId: result.data.workspaceId,
|
|
12113
12609
|
profile: result.data.profile
|
|
12114
12610
|
});
|
|
@@ -12645,5 +13141,33 @@ function printGqlResult(result, options = {}) {
|
|
|
12645
13141
|
}
|
|
12646
13142
|
|
|
12647
13143
|
//#endregion
|
|
12648
|
-
|
|
12649
|
-
|
|
13144
|
+
//#region src/cli/shared/runtime.ts
|
|
13145
|
+
/**
|
|
13146
|
+
* Check if the current runtime natively supports TypeScript execution.
|
|
13147
|
+
* Bun and Deno can execute TypeScript without tsx or other loaders.
|
|
13148
|
+
*
|
|
13149
|
+
* Note: Deno is detected here for correct loader/transport selection, but
|
|
13150
|
+
* the CLI is not fully tested on Deno yet. Other dependencies may fail.
|
|
13151
|
+
* @returns true if running on Bun or Deno
|
|
13152
|
+
*/
|
|
13153
|
+
function isNativeTypeScriptRuntime() {
|
|
13154
|
+
return isBun() || isDeno();
|
|
13155
|
+
}
|
|
13156
|
+
/**
|
|
13157
|
+
* Check if the current runtime is Bun.
|
|
13158
|
+
* @returns true if running on Bun
|
|
13159
|
+
*/
|
|
13160
|
+
function isBun() {
|
|
13161
|
+
return "Bun" in globalThis;
|
|
13162
|
+
}
|
|
13163
|
+
/**
|
|
13164
|
+
* Check if the current runtime is Deno.
|
|
13165
|
+
* @returns true if running on Deno
|
|
13166
|
+
*/
|
|
13167
|
+
function isDeno() {
|
|
13168
|
+
return "Deno" in globalThis;
|
|
13169
|
+
}
|
|
13170
|
+
|
|
13171
|
+
//#endregion
|
|
13172
|
+
export { getFolder as $, getNextMigrationNumber as $t, listWorkflows as A, functionExecutionStatusToString as At, updateCommand$1 as B, DB_TYPES_FILE_NAME as Bt, listApps as C, startCommand as Ct, resumeCommand as D, executionsCommand as Dt, healthCommand as E, getWorkflow as Et, show as F, executeScript as Ft, listOrganizations as G, compareLocalTypesWithSnapshot as Gt, organizationTree as H, INITIAL_SCHEMA_NUMBER as Ht, showCommand as I, waitForExecution$1 as It, updateCommand$2 as J, formatMigrationNumber as Jt, getCommand$1 as K, compareSnapshots as Kt, logBetaWarning as L, MIGRATION_LABEL_KEY as Lt, truncateCommand as M, getCommand$5 as Mt, generate as N, getExecutor as Nt, resumeWorkflow as O, getWorkflowExecution as Ot, generateCommand as P, apply as Pt, getCommand$2 as Q, getMigrationFiles as Qt, remove as R, parseMigrationLabelNumber as Rt, createWorkspace as S, watchExecutorJob as St, getAppHealth as T, getCommand$4 as Tt, treeCommand as U, MIGRATE_FILE_NAME as Ut, updateOrganization as V, DIFF_FILE_NAME as Vt, listCommand$4 as W, SCHEMA_FILE_NAME as Wt, listCommand$5 as X, getMigrationDirPath as Xt, updateFolder as Y, getLatestMigrationNumber as Yt, listFolders as Z, getMigrationFilePath as Zt, getCommand as _, isVerbose as _n, listCommand$8 as _t, updateCommand as a, hasChanges as an, listOAuth2Clients as at, deleteWorkspace as b, jobsCommand as bt, removeUser as c, sdkNameLabelKey as cn, getMachineUserToken as ct, inviteCommand as d, apiCall as dn, listMachineUsers as dt, isValidMigrationNumber as en, deleteCommand$1 as et, inviteUser as f, apiCommand as fn, generate$1 as ft, listWorkspaces as g, deploymentArgs as gn, triggerExecutor as gt, listCommand$1 as h, confirmationArgs as hn, triggerCommand as ht, isCLIError as i, formatMigrationDiff as in, listCommand$6 as it, truncate as j, formatKeyValueTable as jt, listCommand$3 as k, listWorkflowExecutions as kt, listCommand as l, trnPrefix as ln, tokenCommand as lt, restoreWorkspace as m, commonArgs as mn, webhookCommand as mt, query as n, reconstructSnapshotFromMigrations as nn, createCommand$1 as nt, updateUser as o, getNamespacesWithMigrations as on, getCommand$3 as ot, restoreCommand as p, defineAppCommand as pn, listWebhookExecutors as pt, getOrganization as q, createSnapshotFromLocalTypes as qt, queryCommand as r, formatDiffSummary as rn, createFolder as rt, removeCommand as s, prompt as sn, getOAuth2Client as st, isNativeTypeScriptRuntime as t, loadDiff as tn, deleteFolder as tt, listUsers as u, generateUserTypes as un, listCommand$7 as ut, getWorkspace as v, workspaceArgs as vn, listExecutors as vt, listCommand$2 as w, startWorkflow as wt, createCommand as x, listExecutorJobs as xt, deleteCommand as y, getExecutorJob as yt, removeCommand$1 as z, bundleMigrationScript as zt };
|
|
13173
|
+
//# sourceMappingURL=runtime-Ofe7nHEG.mjs.map
|