@tailor-platform/sdk 1.18.0 → 1.20.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 +53 -0
- package/dist/{application-gWUyKuzv.mjs → application-Bli2ieqY.mjs} +2704 -2394
- package/dist/application-Bli2ieqY.mjs.map +1 -0
- package/dist/application-CZdieD3K.mjs +9 -0
- package/dist/cli/index.mjs +121 -64
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +122 -58
- package/dist/cli/lib.mjs +11 -9
- package/dist/cli/lib.mjs.map +1 -1
- package/dist/cli/skills.mjs +1 -1
- package/dist/cli/skills.mjs.map +1 -1
- package/dist/configure/index.d.mts +4 -4
- package/dist/configure/index.mjs +1 -1
- package/dist/configure/index.mjs.map +1 -1
- package/dist/{enum-constants-Cwd4qdpa.mjs → enum-constants-CGVvu3dd.mjs} +1 -1
- package/dist/{enum-constants-Cwd4qdpa.mjs.map → enum-constants-CGVvu3dd.mjs.map} +1 -1
- package/dist/{file-utils-cqcpFk87.mjs → file-utils-GX_tGWl4.mjs} +1 -1
- package/dist/{file-utils-cqcpFk87.mjs.map → file-utils-GX_tGWl4.mjs.map} +1 -1
- package/dist/{index-sSDpuVQY.d.mts → index-B86CIKCW.d.mts} +2 -2
- package/dist/{index-SqWgrTnF.d.mts → index-CGjiOz_W.d.mts} +2 -2
- package/dist/{index-BKXch-td.d.mts → index-CIXOwe6g.d.mts} +2 -2
- package/dist/{index-DP8EB9FK.d.mts → index-DcY0e3S5.d.mts} +10 -43
- package/dist/{index-C3Ib7pFc.d.mts → index-i6QUsr5p.d.mts} +2 -2
- package/dist/interceptor-D8MeZOxX.mjs +33 -0
- package/dist/interceptor-D8MeZOxX.mjs.map +1 -0
- package/dist/{jiti-DHlauMCo.mjs → jiti-DfS9jItj.mjs} +1 -1
- package/dist/{jiti-DHlauMCo.mjs.map → jiti-DfS9jItj.mjs.map} +1 -1
- package/dist/{kysely-type-DtUUoAi3.mjs → kysely-type-Cpq5TNGY.mjs} +2 -1
- package/dist/kysely-type-Cpq5TNGY.mjs.map +1 -0
- package/dist/package-json-3H5gfhA4.mjs +17 -0
- package/dist/package-json-3H5gfhA4.mjs.map +1 -0
- package/dist/package-json-DTDAqRRJ.mjs +3 -0
- 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/{schema-WDvc7Zel.mjs → schema-D5Cpd8fQ.mjs} +45 -3
- package/dist/schema-D5Cpd8fQ.mjs.map +1 -0
- package/dist/{seed-Dm7lrGZ3.mjs → seed-CeUEANfQ.mjs} +1 -1
- package/dist/{seed-Dm7lrGZ3.mjs.map → seed-CeUEANfQ.mjs.map} +1 -1
- package/dist/{src-i4uqS1G4.mjs → src-Bb1UVstT.mjs} +1 -1
- package/dist/{src-i4uqS1G4.mjs.map → src-Bb1UVstT.mjs.map} +1 -1
- package/dist/telemetry-Dhzj9Ncm.mjs +3 -0
- package/dist/telemetry-DuBhnd0X.mjs +84 -0
- package/dist/telemetry-DuBhnd0X.mjs.map +1 -0
- package/dist/{types-Bhl_wAM2.d.mts → types-C14GuyPI.d.mts} +94 -3
- package/dist/{types-DdvTxFiD.d.mts → types-CNw4p8V7.d.mts} +34 -10
- package/dist/types-ClK_HJ0G.mjs.map +1 -1
- package/dist/{update-BoNKMti-.mjs → update-DkpWgrzL.mjs} +548 -300
- package/dist/update-DkpWgrzL.mjs.map +1 -0
- package/dist/utils/test/index.d.mts +3 -3
- package/docs/cli/application.md +2 -0
- package/package.json +7 -1
- package/dist/application-Csj7Ow5Q.mjs +0 -8
- package/dist/application-gWUyKuzv.mjs.map +0 -1
- package/dist/kysely-type-DtUUoAi3.mjs.map +0 -1
- package/dist/schema-WDvc7Zel.mjs.map +0 -1
- package/dist/update-BoNKMti-.mjs.map +0 -1
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { t as db } from "./schema-
|
|
2
|
-
import { $ as
|
|
1
|
+
import { t as db } from "./schema-D5Cpd8fQ.mjs";
|
|
2
|
+
import { $ as TenantProviderConfig_TenantProviderType, A as WorkflowJobExecution_Status, D as userAgent, E as resolveStaticWebsiteUrls, F as TailorDBType_Permission_Permit, G as AuthInvokerSchema, H as ExecutorTargetType, I as TailorDBType_PermitAction, J as AuthSCIMAttribute_Mutability, K as AuthOAuth2Client_ClientType, L as PipelineResolver_OperationType, M as TailorDBGQLPermission_Operator, N as TailorDBGQLPermission_Permit, O as WorkspacePlatformUserRole, P as TailorDBType_Permission_Operator, R as IdPLang, T as platformBaseUrl, U as ExecutorTriggerType, V as ExecutorJobStatus, W as AuthIDPConfig_AuthType, X as AuthSCIMAttribute_Uniqueness, Y as AuthSCIMAttribute_Type, Z as AuthSCIMConfig_AuthorizationType, _ as loadWorkspaceId, a as buildExecutorArgsExpr, at as PageDirection, b as fetchAll, c as OAuth2ClientSchema, ct as logger, d as getDistDir, et as UserProfileProviderConfig_UserProfileProviderType, f as hashFile, g as loadOrganizationId, h as loadFolderId, i as loadConfig, it as FilterSchema, j as TailorDBGQLPermission_Action, k as WorkflowExecution_Status, l as stringifyFunction, lt as styles, m as loadAccessToken, n as generatePluginFilesIfNeeded, nt as ConditionSchema, o as buildResolverOperationHookExpr, ot as ApplicationSchemaUpdateAttemptStatus, q as AuthOAuth2Client_GrantType, r as loadApplication, rt as Condition_Operator, s as createExecutorService, st as Subgraph_ServiceType, t as defineApplication, tt as GetApplicationSchemaHealthResponse_ApplicationSchemaHealthStatus, u as createBundleCache, ut as symbols, v as readPlatformConfig, w as initOperatorClient, x as fetchMachineUserToken, y as writePlatformConfig, z as FunctionExecution_Status } from "./application-Bli2ieqY.mjs";
|
|
3
|
+
import { t as readPackageJson } from "./package-json-3H5gfhA4.mjs";
|
|
4
|
+
import { r as withSpan } from "./telemetry-DuBhnd0X.mjs";
|
|
3
5
|
import { createRequire } from "node:module";
|
|
4
6
|
import { arg, defineCommand, runCommand } from "politty";
|
|
5
7
|
import { z } from "zod";
|
|
@@ -12,20 +14,21 @@ import { getBorderCharacters, table } from "table";
|
|
|
12
14
|
import { ValueSchema, timestampDate } from "@bufbuild/protobuf/wkt";
|
|
13
15
|
import { Code, ConnectError } from "@connectrpc/connect";
|
|
14
16
|
import { resolveTSConfig } from "pkg-types";
|
|
17
|
+
import { findUpSync } from "find-up-simple";
|
|
15
18
|
import ml from "multiline-ts";
|
|
19
|
+
import * as crypto from "node:crypto";
|
|
16
20
|
import * as inflection from "inflection";
|
|
17
21
|
import * as fs$1 from "node:fs/promises";
|
|
18
22
|
import { glob } from "node:fs/promises";
|
|
19
23
|
import * as rolldown from "rolldown";
|
|
20
24
|
import { create, fromJson, toJson } from "@bufbuild/protobuf";
|
|
21
|
-
import * as crypto from "node:crypto";
|
|
22
25
|
import ora from "ora";
|
|
23
26
|
import { setTimeout as setTimeout$1 } from "timers/promises";
|
|
24
27
|
import { spawn } from "node:child_process";
|
|
25
28
|
import { watch } from "chokidar";
|
|
26
29
|
import * as madgeModule from "madge";
|
|
27
30
|
|
|
28
|
-
//#region src/cli/
|
|
31
|
+
//#region src/cli/shared/errors.ts
|
|
29
32
|
/**
|
|
30
33
|
* Type guard to check if an error is a CLIError
|
|
31
34
|
* @param error - Error to check
|
|
@@ -36,7 +39,7 @@ function isCLIError(error) {
|
|
|
36
39
|
}
|
|
37
40
|
|
|
38
41
|
//#endregion
|
|
39
|
-
//#region src/cli/args.ts
|
|
42
|
+
//#region src/cli/shared/args.ts
|
|
40
43
|
const unitToMs = {
|
|
41
44
|
ms: 1,
|
|
42
45
|
s: 1e3,
|
|
@@ -159,6 +162,8 @@ const withCommonArgs = (handler) => async (args) => {
|
|
|
159
162
|
try {
|
|
160
163
|
if ("json" in args && typeof args.json === "boolean") logger.jsonMode = args.json;
|
|
161
164
|
loadEnvFiles(args["env-file"], args["env-file-if-exists"]);
|
|
165
|
+
const { initTelemetry } = await import("./telemetry-Dhzj9Ncm.mjs");
|
|
166
|
+
await initTelemetry();
|
|
162
167
|
await handler(args);
|
|
163
168
|
} catch (error) {
|
|
164
169
|
if (isCLIError(error)) {
|
|
@@ -169,12 +174,15 @@ const withCommonArgs = (handler) => async (args) => {
|
|
|
169
174
|
if (args.verbose && error.stack) logger.debug(`\nStack trace:\n${error.stack}`);
|
|
170
175
|
} else logger.error(`Unknown error: ${error}`);
|
|
171
176
|
process.exit(1);
|
|
177
|
+
} finally {
|
|
178
|
+
const { shutdownTelemetry } = await import("./telemetry-Dhzj9Ncm.mjs");
|
|
179
|
+
await shutdownTelemetry();
|
|
172
180
|
}
|
|
173
181
|
process.exit(0);
|
|
174
182
|
};
|
|
175
183
|
|
|
176
184
|
//#endregion
|
|
177
|
-
//#region src/cli/api.ts
|
|
185
|
+
//#region src/cli/commands/api.ts
|
|
178
186
|
/**
|
|
179
187
|
* Call Tailor Platform API endpoints directly.
|
|
180
188
|
* If the endpoint doesn't contain "/", it defaults to `tailor.v1.OperatorService/{endpoint}`.
|
|
@@ -234,7 +242,190 @@ const apiCommand = defineCommand({
|
|
|
234
242
|
});
|
|
235
243
|
|
|
236
244
|
//#endregion
|
|
237
|
-
//#region src/cli/
|
|
245
|
+
//#region src/cli/cache/types.ts
|
|
246
|
+
const cacheOutputFileSchema = z.object({
|
|
247
|
+
outputPath: z.string(),
|
|
248
|
+
contentHash: z.string()
|
|
249
|
+
});
|
|
250
|
+
const cacheEntrySchema = z.object({
|
|
251
|
+
kind: z.literal("bundle"),
|
|
252
|
+
inputHash: z.string(),
|
|
253
|
+
dependencyPaths: z.array(z.string()),
|
|
254
|
+
outputFiles: z.array(cacheOutputFileSchema),
|
|
255
|
+
createdAt: z.string()
|
|
256
|
+
});
|
|
257
|
+
const cacheManifestSchema = z.object({
|
|
258
|
+
version: z.literal(1),
|
|
259
|
+
sdkVersion: z.string(),
|
|
260
|
+
lockfileHash: z.string().optional(),
|
|
261
|
+
entries: z.record(z.string(), cacheEntrySchema)
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
//#endregion
|
|
265
|
+
//#region src/cli/cache/store.ts
|
|
266
|
+
const MANIFEST_FILENAME = "manifest.json";
|
|
267
|
+
const BUNDLES_DIR = "bundles";
|
|
268
|
+
/**
|
|
269
|
+
* Create a cache store for manifest persistence and bundle output storage.
|
|
270
|
+
* @param config - Cache configuration specifying the cache directory
|
|
271
|
+
* @returns A CacheStore instance
|
|
272
|
+
*/
|
|
273
|
+
function createCacheStore(config) {
|
|
274
|
+
let cachedManifest = null;
|
|
275
|
+
function manifestPath() {
|
|
276
|
+
return path.join(config.cacheDir, MANIFEST_FILENAME);
|
|
277
|
+
}
|
|
278
|
+
function bundlesDir() {
|
|
279
|
+
return path.join(config.cacheDir, BUNDLES_DIR);
|
|
280
|
+
}
|
|
281
|
+
function bundlePath(cacheKey) {
|
|
282
|
+
return path.join(bundlesDir(), `${cacheKey.replaceAll(":", "_")}.js`);
|
|
283
|
+
}
|
|
284
|
+
function loadManifest() {
|
|
285
|
+
try {
|
|
286
|
+
const raw = fs$2.readFileSync(manifestPath(), "utf-8");
|
|
287
|
+
const result = cacheManifestSchema.safeParse(JSON.parse(raw));
|
|
288
|
+
if (!result.success) {
|
|
289
|
+
cachedManifest = void 0;
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
cachedManifest = result.data;
|
|
293
|
+
return cachedManifest;
|
|
294
|
+
} catch {
|
|
295
|
+
cachedManifest = void 0;
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
function getCurrentManifest() {
|
|
300
|
+
if (cachedManifest === null) loadManifest();
|
|
301
|
+
return cachedManifest ?? void 0;
|
|
302
|
+
}
|
|
303
|
+
function ensureManifestLoaded() {
|
|
304
|
+
if (cachedManifest === null) loadManifest();
|
|
305
|
+
if (cachedManifest == null) cachedManifest = {
|
|
306
|
+
version: 1,
|
|
307
|
+
sdkVersion: "",
|
|
308
|
+
entries: {}
|
|
309
|
+
};
|
|
310
|
+
return cachedManifest;
|
|
311
|
+
}
|
|
312
|
+
function saveManifest(manifest) {
|
|
313
|
+
fs$2.mkdirSync(config.cacheDir, { recursive: true });
|
|
314
|
+
const target = manifestPath();
|
|
315
|
+
const tmpFile = path.join(config.cacheDir, `.manifest.${process.pid}.tmp`);
|
|
316
|
+
try {
|
|
317
|
+
fs$2.writeFileSync(tmpFile, JSON.stringify(manifest, null, 2), "utf-8");
|
|
318
|
+
fs$2.renameSync(tmpFile, target);
|
|
319
|
+
} catch (e) {
|
|
320
|
+
try {
|
|
321
|
+
fs$2.rmSync(tmpFile, { force: true });
|
|
322
|
+
} catch {}
|
|
323
|
+
throw e;
|
|
324
|
+
}
|
|
325
|
+
cachedManifest = manifest;
|
|
326
|
+
}
|
|
327
|
+
function getEntry(key) {
|
|
328
|
+
return ensureManifestLoaded().entries[key];
|
|
329
|
+
}
|
|
330
|
+
function setEntry(key, entry) {
|
|
331
|
+
const manifest = ensureManifestLoaded();
|
|
332
|
+
manifest.entries[key] = entry;
|
|
333
|
+
}
|
|
334
|
+
function deleteEntry(key) {
|
|
335
|
+
const manifest = ensureManifestLoaded();
|
|
336
|
+
delete manifest.entries[key];
|
|
337
|
+
}
|
|
338
|
+
function storeBundleOutput(cacheKey, sourcePath) {
|
|
339
|
+
const dir = bundlesDir();
|
|
340
|
+
fs$2.mkdirSync(dir, { recursive: true });
|
|
341
|
+
fs$2.copyFileSync(sourcePath, bundlePath(cacheKey));
|
|
342
|
+
const mapSource = `${sourcePath}.map`;
|
|
343
|
+
const cachedMapPath = `${bundlePath(cacheKey)}.map`;
|
|
344
|
+
if (fs$2.existsSync(mapSource)) fs$2.copyFileSync(mapSource, cachedMapPath);
|
|
345
|
+
else fs$2.rmSync(cachedMapPath, { force: true });
|
|
346
|
+
}
|
|
347
|
+
function restoreBundleOutput(cacheKey, targetPath) {
|
|
348
|
+
const cached = bundlePath(cacheKey);
|
|
349
|
+
const targetDir = path.dirname(targetPath);
|
|
350
|
+
fs$2.mkdirSync(targetDir, { recursive: true });
|
|
351
|
+
try {
|
|
352
|
+
fs$2.copyFileSync(cached, targetPath);
|
|
353
|
+
} catch (e) {
|
|
354
|
+
if (e.code === "ENOENT") return false;
|
|
355
|
+
throw e;
|
|
356
|
+
}
|
|
357
|
+
const cachedMap = `${cached}.map`;
|
|
358
|
+
if (fs$2.existsSync(cachedMap)) fs$2.copyFileSync(cachedMap, `${targetPath}.map`);
|
|
359
|
+
return true;
|
|
360
|
+
}
|
|
361
|
+
function clean() {
|
|
362
|
+
fs$2.rmSync(config.cacheDir, {
|
|
363
|
+
recursive: true,
|
|
364
|
+
force: true
|
|
365
|
+
});
|
|
366
|
+
cachedManifest = null;
|
|
367
|
+
}
|
|
368
|
+
return {
|
|
369
|
+
loadManifest,
|
|
370
|
+
getCurrentManifest,
|
|
371
|
+
saveManifest,
|
|
372
|
+
getEntry,
|
|
373
|
+
setEntry,
|
|
374
|
+
deleteEntry,
|
|
375
|
+
storeBundleOutput,
|
|
376
|
+
restoreBundleOutput,
|
|
377
|
+
clean
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
//#endregion
|
|
382
|
+
//#region src/cli/cache/manager.ts
|
|
383
|
+
/**
|
|
384
|
+
* Create a CacheManager that orchestrates cache operations.
|
|
385
|
+
* @param options - Configuration for the cache manager
|
|
386
|
+
* @returns A CacheManager instance
|
|
387
|
+
*/
|
|
388
|
+
function createCacheManager(options) {
|
|
389
|
+
if (!(options.enabled ?? true)) return {
|
|
390
|
+
enabled: false,
|
|
391
|
+
bundleCache: {
|
|
392
|
+
tryRestore() {
|
|
393
|
+
return false;
|
|
394
|
+
},
|
|
395
|
+
save() {}
|
|
396
|
+
},
|
|
397
|
+
finalize() {}
|
|
398
|
+
};
|
|
399
|
+
const store = createCacheStore({ cacheDir: options.cacheDir ?? path.resolve(getDistDir(), "cache") });
|
|
400
|
+
const existingManifest = store.loadManifest();
|
|
401
|
+
if (existingManifest) {
|
|
402
|
+
if (existingManifest.sdkVersion !== options.sdkVersion) {
|
|
403
|
+
logger.debug(`Cache invalidated: SDK version changed from ${existingManifest.sdkVersion} to ${options.sdkVersion}`);
|
|
404
|
+
store.clean();
|
|
405
|
+
} else if (existingManifest.lockfileHash !== options.lockfileHash) {
|
|
406
|
+
logger.debug("Cache invalidated: lockfile changed");
|
|
407
|
+
store.clean();
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
return {
|
|
411
|
+
enabled: true,
|
|
412
|
+
bundleCache: createBundleCache(store),
|
|
413
|
+
finalize() {
|
|
414
|
+
const manifest = store.getCurrentManifest() ?? {
|
|
415
|
+
version: 1,
|
|
416
|
+
sdkVersion: options.sdkVersion,
|
|
417
|
+
lockfileHash: options.lockfileHash,
|
|
418
|
+
entries: {}
|
|
419
|
+
};
|
|
420
|
+
manifest.sdkVersion = options.sdkVersion;
|
|
421
|
+
manifest.lockfileHash = options.lockfileHash;
|
|
422
|
+
store.saveManifest(manifest);
|
|
423
|
+
}
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
//#endregion
|
|
428
|
+
//#region src/cli/shared/type-generator.ts
|
|
238
429
|
/**
|
|
239
430
|
* Extract attribute definitions from the app config for user-defined typing.
|
|
240
431
|
* @param config - Application config to inspect
|
|
@@ -689,38 +880,7 @@ function copyMetadataToExtendedType(original, extended) {
|
|
|
689
880
|
}
|
|
690
881
|
|
|
691
882
|
//#endregion
|
|
692
|
-
//#region src/cli/apply/
|
|
693
|
-
/**
|
|
694
|
-
* Build TRN prefix for a workspace.
|
|
695
|
-
* @param workspaceId - Workspace ID
|
|
696
|
-
* @returns TRN prefix string
|
|
697
|
-
*/
|
|
698
|
-
function trnPrefix(workspaceId) {
|
|
699
|
-
return `trn:v1:workspace:${workspaceId}`;
|
|
700
|
-
}
|
|
701
|
-
const sdkNameLabelKey = "sdk-name";
|
|
702
|
-
/**
|
|
703
|
-
* Build metadata request with SDK labels.
|
|
704
|
-
* @param trn - Target TRN
|
|
705
|
-
* @param appName - Application name label
|
|
706
|
-
* @param existingLabels - Existing labels to preserve (optional)
|
|
707
|
-
* @returns Metadata request
|
|
708
|
-
*/
|
|
709
|
-
async function buildMetaRequest(trn$7, appName, existingLabels) {
|
|
710
|
-
const packageJson = await readPackageJson();
|
|
711
|
-
const sdkVersion = packageJson.version ? `v${packageJson.version.replace(/\./g, "-")}` : "unknown";
|
|
712
|
-
return {
|
|
713
|
-
trn: trn$7,
|
|
714
|
-
labels: {
|
|
715
|
-
...existingLabels ?? {},
|
|
716
|
-
[sdkNameLabelKey]: appName,
|
|
717
|
-
"sdk-version": sdkVersion
|
|
718
|
-
}
|
|
719
|
-
};
|
|
720
|
-
}
|
|
721
|
-
|
|
722
|
-
//#endregion
|
|
723
|
-
//#region src/cli/apply/services/index.ts
|
|
883
|
+
//#region src/cli/commands/apply/change-set.ts
|
|
724
884
|
/**
|
|
725
885
|
* Create a new ChangeSet for tracking resource changes.
|
|
726
886
|
* @param title - Title for the change set
|
|
@@ -751,7 +911,38 @@ function createChangeSet(title) {
|
|
|
751
911
|
}
|
|
752
912
|
|
|
753
913
|
//#endregion
|
|
754
|
-
//#region src/cli/apply/
|
|
914
|
+
//#region src/cli/commands/apply/label.ts
|
|
915
|
+
/**
|
|
916
|
+
* Build TRN prefix for a workspace.
|
|
917
|
+
* @param workspaceId - Workspace ID
|
|
918
|
+
* @returns TRN prefix string
|
|
919
|
+
*/
|
|
920
|
+
function trnPrefix(workspaceId) {
|
|
921
|
+
return `trn:v1:workspace:${workspaceId}`;
|
|
922
|
+
}
|
|
923
|
+
const sdkNameLabelKey = "sdk-name";
|
|
924
|
+
/**
|
|
925
|
+
* Build metadata request with SDK labels.
|
|
926
|
+
* @param trn - Target TRN
|
|
927
|
+
* @param appName - Application name label
|
|
928
|
+
* @param existingLabels - Existing labels to preserve (optional)
|
|
929
|
+
* @returns Metadata request
|
|
930
|
+
*/
|
|
931
|
+
async function buildMetaRequest(trn$7, appName, existingLabels) {
|
|
932
|
+
const packageJson = await readPackageJson();
|
|
933
|
+
const sdkVersion = packageJson.version ? `v${packageJson.version.replace(/\./g, "-")}` : "unknown";
|
|
934
|
+
return {
|
|
935
|
+
trn: trn$7,
|
|
936
|
+
labels: {
|
|
937
|
+
...existingLabels ?? {},
|
|
938
|
+
[sdkNameLabelKey]: appName,
|
|
939
|
+
"sdk-version": sdkVersion
|
|
940
|
+
}
|
|
941
|
+
};
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
//#endregion
|
|
945
|
+
//#region src/cli/commands/apply/application.ts
|
|
755
946
|
/**
|
|
756
947
|
* Apply application changes for the given phase.
|
|
757
948
|
* @param client - Operator client instance
|
|
@@ -888,7 +1079,7 @@ function protoSubgraph(subgraph) {
|
|
|
888
1079
|
}
|
|
889
1080
|
|
|
890
1081
|
//#endregion
|
|
891
|
-
//#region src/cli/apply/
|
|
1082
|
+
//#region src/cli/commands/apply/idp.ts
|
|
892
1083
|
/**
|
|
893
1084
|
* Build the vault name for an IdP client.
|
|
894
1085
|
* @param namespaceName - IdP namespace name
|
|
@@ -1059,7 +1250,8 @@ async function planServices$3(client, workspaceId, appName, idps) {
|
|
|
1059
1250
|
authorization,
|
|
1060
1251
|
lang,
|
|
1061
1252
|
userAuthPolicy,
|
|
1062
|
-
publishUserEvents: idp.publishUserEvents
|
|
1253
|
+
publishUserEvents: idp.publishUserEvents,
|
|
1254
|
+
disableGqlOperations: convertGqlOperationsToDisable(idp.gqlOperations)
|
|
1063
1255
|
},
|
|
1064
1256
|
metaRequest
|
|
1065
1257
|
});
|
|
@@ -1072,7 +1264,8 @@ async function planServices$3(client, workspaceId, appName, idps) {
|
|
|
1072
1264
|
authorization,
|
|
1073
1265
|
lang,
|
|
1074
1266
|
userAuthPolicy,
|
|
1075
|
-
publishUserEvents: idp.publishUserEvents
|
|
1267
|
+
publishUserEvents: idp.publishUserEvents,
|
|
1268
|
+
disableGqlOperations: convertGqlOperationsToDisable(idp.gqlOperations)
|
|
1076
1269
|
},
|
|
1077
1270
|
metaRequest
|
|
1078
1271
|
});
|
|
@@ -1113,9 +1306,11 @@ async function planClients(client, workspaceId, idps, deletedServices) {
|
|
|
1113
1306
|
}
|
|
1114
1307
|
});
|
|
1115
1308
|
};
|
|
1116
|
-
|
|
1309
|
+
const clientsByIdp = await Promise.all(idps.map((idp) => fetchClients(idp.name)));
|
|
1310
|
+
for (let i = 0; i < idps.length; i++) {
|
|
1311
|
+
const idp = idps[i];
|
|
1117
1312
|
const namespaceName = idp.name;
|
|
1118
|
-
const existingClients =
|
|
1313
|
+
const existingClients = clientsByIdp[i];
|
|
1119
1314
|
const existingNameMap = /* @__PURE__ */ new Map();
|
|
1120
1315
|
existingClients.forEach((client$1) => {
|
|
1121
1316
|
existingNameMap.set(client$1.name, client$1.clientSecret);
|
|
@@ -1147,16 +1342,20 @@ async function planClients(client, workspaceId, idps, deletedServices) {
|
|
|
1147
1342
|
});
|
|
1148
1343
|
});
|
|
1149
1344
|
}
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1345
|
+
const deletedClientsByService = await Promise.all(deletedServices.map((namespaceName) => fetchClients(namespaceName)));
|
|
1346
|
+
for (let i = 0; i < deletedServices.length; i++) {
|
|
1347
|
+
const namespaceName = deletedServices[i];
|
|
1348
|
+
deletedClientsByService[i].forEach((client$1) => {
|
|
1349
|
+
changeSet.deletes.push({
|
|
1350
|
+
name: client$1.name,
|
|
1351
|
+
request: {
|
|
1352
|
+
workspaceId,
|
|
1353
|
+
namespaceName,
|
|
1354
|
+
name: client$1.name
|
|
1355
|
+
}
|
|
1356
|
+
});
|
|
1158
1357
|
});
|
|
1159
|
-
}
|
|
1358
|
+
}
|
|
1160
1359
|
return changeSet;
|
|
1161
1360
|
}
|
|
1162
1361
|
function convertLang(lang) {
|
|
@@ -1166,9 +1365,19 @@ function convertLang(lang) {
|
|
|
1166
1365
|
default: return IdPLang.UNSPECIFIED;
|
|
1167
1366
|
}
|
|
1168
1367
|
}
|
|
1368
|
+
function convertGqlOperationsToDisable(gqlOperations) {
|
|
1369
|
+
if (!gqlOperations) return;
|
|
1370
|
+
return {
|
|
1371
|
+
create: gqlOperations.create === false,
|
|
1372
|
+
update: gqlOperations.update === false,
|
|
1373
|
+
delete: gqlOperations.delete === false,
|
|
1374
|
+
read: gqlOperations.read === false,
|
|
1375
|
+
sendPasswordResetEmail: gqlOperations.sendPasswordResetEmail === false
|
|
1376
|
+
};
|
|
1377
|
+
}
|
|
1169
1378
|
|
|
1170
1379
|
//#endregion
|
|
1171
|
-
//#region src/cli/apply/
|
|
1380
|
+
//#region src/cli/commands/apply/auth.ts
|
|
1172
1381
|
/**
|
|
1173
1382
|
* Apply auth-related changes for the given phase.
|
|
1174
1383
|
* @param client - Operator client instance
|
|
@@ -1234,13 +1443,15 @@ async function planAuth(context) {
|
|
|
1234
1443
|
}
|
|
1235
1444
|
const { changeSet: serviceChangeSet, conflicts, unmanaged, resourceOwners } = await planServices$2(client, workspaceId, application.name, auths);
|
|
1236
1445
|
const deletedServices = serviceChangeSet.deletes.map((del) => del.name);
|
|
1237
|
-
const idpConfigChangeSet
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1446
|
+
const [idpConfigChangeSet, userProfileConfigChangeSet, tenantConfigChangeSet, machineUserChangeSet, oauth2ClientChangeSet, scimChangeSet, scimResourceChangeSet] = await Promise.all([
|
|
1447
|
+
planIdPConfigs(client, workspaceId, auths, deletedServices),
|
|
1448
|
+
planUserProfileConfigs(client, workspaceId, auths, deletedServices),
|
|
1449
|
+
planTenantConfigs(client, workspaceId, auths, deletedServices),
|
|
1450
|
+
planMachineUsers(client, workspaceId, auths, deletedServices),
|
|
1451
|
+
planOAuth2Clients(client, workspaceId, auths, deletedServices),
|
|
1452
|
+
planSCIMConfigs(client, workspaceId, auths, deletedServices),
|
|
1453
|
+
planSCIMResources(client, workspaceId, auths, deletedServices)
|
|
1454
|
+
]);
|
|
1244
1455
|
serviceChangeSet.print();
|
|
1245
1456
|
idpConfigChangeSet.print();
|
|
1246
1457
|
userProfileConfigChangeSet.print();
|
|
@@ -2057,7 +2268,7 @@ function protoSCIMAttribute(attr) {
|
|
|
2057
2268
|
}
|
|
2058
2269
|
|
|
2059
2270
|
//#endregion
|
|
2060
|
-
//#region src/cli/apply/
|
|
2271
|
+
//#region src/cli/commands/apply/confirm.ts
|
|
2061
2272
|
/**
|
|
2062
2273
|
* Confirm reassignment of resources when owner conflicts are detected.
|
|
2063
2274
|
* @param conflicts - Detected owner conflicts
|
|
@@ -2142,7 +2353,7 @@ async function confirmImportantResourceDeletion(resources, yes) {
|
|
|
2142
2353
|
}
|
|
2143
2354
|
|
|
2144
2355
|
//#endregion
|
|
2145
|
-
//#region src/cli/apply/
|
|
2356
|
+
//#region src/cli/commands/apply/function-registry.ts
|
|
2146
2357
|
const CHUNK_SIZE = 64 * 1024;
|
|
2147
2358
|
/**
|
|
2148
2359
|
* Compute SHA-256 content hash for a script string.
|
|
@@ -2384,7 +2595,7 @@ async function applyFunctionRegistry(client, workspaceId, result, phase = "creat
|
|
|
2384
2595
|
}
|
|
2385
2596
|
|
|
2386
2597
|
//#endregion
|
|
2387
|
-
//#region src/cli/apply/
|
|
2598
|
+
//#region src/cli/commands/apply/executor.ts
|
|
2388
2599
|
/**
|
|
2389
2600
|
* Apply executor-related changes for the given phase.
|
|
2390
2601
|
* @param client - Operator client instance
|
|
@@ -2643,7 +2854,7 @@ function protoExecutor(appName, executor, env) {
|
|
|
2643
2854
|
}
|
|
2644
2855
|
|
|
2645
2856
|
//#endregion
|
|
2646
|
-
//#region src/cli/apply/
|
|
2857
|
+
//#region src/cli/commands/apply/resolver.ts
|
|
2647
2858
|
const SCALAR_TYPE_MAP = {
|
|
2648
2859
|
uuid: {
|
|
2649
2860
|
kind: "ScalarType",
|
|
@@ -2661,6 +2872,10 @@ const SCALAR_TYPE_MAP = {
|
|
|
2661
2872
|
kind: "ScalarType",
|
|
2662
2873
|
name: "Float"
|
|
2663
2874
|
},
|
|
2875
|
+
decimal: {
|
|
2876
|
+
kind: "CustomScalarType",
|
|
2877
|
+
name: "Decimal"
|
|
2878
|
+
},
|
|
2664
2879
|
boolean: {
|
|
2665
2880
|
kind: "ScalarType",
|
|
2666
2881
|
name: "Boolean"
|
|
@@ -2933,7 +3148,7 @@ function protoFields(fields, baseName, isInput) {
|
|
|
2933
3148
|
}
|
|
2934
3149
|
|
|
2935
3150
|
//#endregion
|
|
2936
|
-
//#region src/cli/apply/
|
|
3151
|
+
//#region src/cli/commands/apply/staticwebsite.ts
|
|
2937
3152
|
/**
|
|
2938
3153
|
* Apply static website changes for the given phase.
|
|
2939
3154
|
* @param client - Operator client instance
|
|
@@ -3050,7 +3265,7 @@ async function planStaticWebsite(context) {
|
|
|
3050
3265
|
}
|
|
3051
3266
|
|
|
3052
3267
|
//#endregion
|
|
3053
|
-
//#region src/cli/tailordb/migrate/config.ts
|
|
3268
|
+
//#region src/cli/commands/tailordb/migrate/config.ts
|
|
3054
3269
|
/**
|
|
3055
3270
|
* Migration configuration utilities
|
|
3056
3271
|
*/
|
|
@@ -3083,7 +3298,7 @@ function getNamespacesWithMigrations(config, configDir) {
|
|
|
3083
3298
|
}
|
|
3084
3299
|
|
|
3085
3300
|
//#endregion
|
|
3086
|
-
//#region src/cli/tailordb/migrate/diff-calculator.ts
|
|
3301
|
+
//#region src/cli/commands/tailordb/migrate/diff-calculator.ts
|
|
3087
3302
|
/**
|
|
3088
3303
|
* Current schema snapshot format version
|
|
3089
3304
|
*/
|
|
@@ -3241,7 +3456,7 @@ function formatDiffSummary(diff) {
|
|
|
3241
3456
|
}
|
|
3242
3457
|
|
|
3243
3458
|
//#endregion
|
|
3244
|
-
//#region src/cli/tailordb/migrate/snapshot.ts
|
|
3459
|
+
//#region src/cli/commands/tailordb/migrate/snapshot.ts
|
|
3245
3460
|
/**
|
|
3246
3461
|
* Schema snapshot management for TailorDB migrations
|
|
3247
3462
|
*/
|
|
@@ -3345,6 +3560,7 @@ function createSnapshotFieldConfig(field) {
|
|
|
3345
3560
|
...field.config.serial.maxValue !== void 0 && { maxValue: field.config.serial.maxValue },
|
|
3346
3561
|
...field.config.serial.format && { format: field.config.serial.format }
|
|
3347
3562
|
};
|
|
3563
|
+
if (field.config.scale !== void 0) config.scale = field.config.scale;
|
|
3348
3564
|
if (field.config.fields && Object.keys(field.config.fields).length > 0) {
|
|
3349
3565
|
config.fields = {};
|
|
3350
3566
|
for (const [nestedName, nestedConfig] of Object.entries(field.config.fields)) config.fields[nestedName] = createSnapshotFieldConfigFromOperatorConfig(nestedConfig);
|
|
@@ -3389,6 +3605,7 @@ function createSnapshotFieldConfigFromOperatorConfig(fieldConfig) {
|
|
|
3389
3605
|
...fieldConfig.serial.maxValue !== void 0 && { maxValue: fieldConfig.serial.maxValue },
|
|
3390
3606
|
...fieldConfig.serial.format && { format: fieldConfig.serial.format }
|
|
3391
3607
|
};
|
|
3608
|
+
if (fieldConfig.scale !== void 0) config.scale = fieldConfig.scale;
|
|
3392
3609
|
if (fieldConfig.fields && Object.keys(fieldConfig.fields).length > 0) {
|
|
3393
3610
|
config.fields = {};
|
|
3394
3611
|
for (const [nestedName, nestedConfig] of Object.entries(fieldConfig.fields)) config.fields[nestedName] = createSnapshotFieldConfigFromOperatorConfig(nestedConfig);
|
|
@@ -3775,6 +3992,7 @@ function areFieldsDifferent(oldField, newField) {
|
|
|
3775
3992
|
if (oldSerial.maxValue !== newSerial.maxValue) return true;
|
|
3776
3993
|
if ((oldSerial.format ?? "") !== (newSerial.format ?? "")) return true;
|
|
3777
3994
|
}
|
|
3995
|
+
if (oldField.scale !== newField.scale) return true;
|
|
3778
3996
|
const oldFields = oldField.fields ?? {};
|
|
3779
3997
|
const newFields = newField.fields ?? {};
|
|
3780
3998
|
const oldFieldNames = Object.keys(oldFields);
|
|
@@ -4197,6 +4415,7 @@ function convertRemoteFieldsToSnapshot(remoteType) {
|
|
|
4197
4415
|
...remoteField.serial.maxValue && { maxValue: Number(remoteField.serial.maxValue) },
|
|
4198
4416
|
...remoteField.serial.format && { format: remoteField.serial.format }
|
|
4199
4417
|
};
|
|
4418
|
+
if (remoteField.scale !== void 0) config.scale = remoteField.scale;
|
|
4200
4419
|
fields[fieldName] = config;
|
|
4201
4420
|
}
|
|
4202
4421
|
return fields;
|
|
@@ -4241,6 +4460,7 @@ function compareFields(typeName, fieldName, remoteField, snapshotField) {
|
|
|
4241
4460
|
const remoteVector = remoteField.vector ?? false;
|
|
4242
4461
|
const snapshotVector = snapshotField.vector ?? false;
|
|
4243
4462
|
if (remoteVector !== snapshotVector) differences.push(`vector: remote=${remoteVector}, expected=${snapshotVector}`);
|
|
4463
|
+
if (remoteField.scale !== snapshotField.scale) differences.push(`scale: remote=${remoteField.scale}, expected=${snapshotField.scale}`);
|
|
4244
4464
|
if (differences.length > 0) return {
|
|
4245
4465
|
typeName,
|
|
4246
4466
|
kind: "field_mismatch",
|
|
@@ -4326,7 +4546,7 @@ function formatSchemaDrifts(drifts) {
|
|
|
4326
4546
|
}
|
|
4327
4547
|
|
|
4328
4548
|
//#endregion
|
|
4329
|
-
//#region src/cli/
|
|
4549
|
+
//#region src/cli/commands/tailordb/migrate/bundler.ts
|
|
4330
4550
|
/**
|
|
4331
4551
|
* Migration script bundler for TailorDB migrations
|
|
4332
4552
|
*
|
|
@@ -4404,7 +4624,7 @@ async function bundleMigrationScript(sourceFile, namespace, migrationNumber) {
|
|
|
4404
4624
|
}
|
|
4405
4625
|
|
|
4406
4626
|
//#endregion
|
|
4407
|
-
//#region src/cli/tailordb/migrate/types.ts
|
|
4627
|
+
//#region src/cli/commands/tailordb/migrate/types.ts
|
|
4408
4628
|
/**
|
|
4409
4629
|
* Prefix added to migration numbers in labels (required because migration names start with numbers)
|
|
4410
4630
|
*/
|
|
@@ -4426,7 +4646,7 @@ function parseMigrationLabelNumber(label) {
|
|
|
4426
4646
|
}
|
|
4427
4647
|
|
|
4428
4648
|
//#endregion
|
|
4429
|
-
//#region src/cli/
|
|
4649
|
+
//#region src/cli/shared/script-executor.ts
|
|
4430
4650
|
/**
|
|
4431
4651
|
* Script execution service for TestExecScript API
|
|
4432
4652
|
*
|
|
@@ -4501,7 +4721,7 @@ async function executeScript(options) {
|
|
|
4501
4721
|
}
|
|
4502
4722
|
|
|
4503
4723
|
//#endregion
|
|
4504
|
-
//#region src/cli/apply/
|
|
4724
|
+
//#region src/cli/commands/apply/tailordb/migration.ts
|
|
4505
4725
|
/**
|
|
4506
4726
|
* Migration execution service for TailorDB migrations
|
|
4507
4727
|
*
|
|
@@ -4679,7 +4899,7 @@ function groupMigrationsByNamespace(migrations) {
|
|
|
4679
4899
|
}
|
|
4680
4900
|
|
|
4681
4901
|
//#endregion
|
|
4682
|
-
//#region src/cli/apply/
|
|
4902
|
+
//#region src/cli/commands/apply/tailordb/index.ts
|
|
4683
4903
|
/**
|
|
4684
4904
|
* Fetch all TailorDB types from remote for a namespace
|
|
4685
4905
|
* @param {OperatorClient} client - Operator client instance
|
|
@@ -5160,8 +5380,7 @@ async function planTailorDB(context) {
|
|
|
5160
5380
|
const executors = forRemoval ? [] : Object.values(await application.executorService?.loadExecutors() ?? {});
|
|
5161
5381
|
const { changeSet: serviceChangeSet, conflicts, unmanaged, resourceOwners } = await planServices(client, workspaceId, application.name, tailordbs);
|
|
5162
5382
|
const deletedServices = serviceChangeSet.deletes.map((del) => del.name);
|
|
5163
|
-
const typeChangeSet = await planTypes(client, workspaceId, tailordbs, executors, deletedServices);
|
|
5164
|
-
const gqlPermissionChangeSet = await planGqlPermissions(client, workspaceId, tailordbs, deletedServices);
|
|
5383
|
+
const [typeChangeSet, gqlPermissionChangeSet] = await Promise.all([planTypes(client, workspaceId, tailordbs, executors, deletedServices), planGqlPermissions(client, workspaceId, tailordbs, deletedServices)]);
|
|
5165
5384
|
serviceChangeSet.print();
|
|
5166
5385
|
typeChangeSet.print();
|
|
5167
5386
|
gqlPermissionChangeSet.print();
|
|
@@ -5376,7 +5595,8 @@ function generateTailorDBTypeManifest(type, executorUsedTypes, namespaceGqlOpera
|
|
|
5376
5595
|
start: fieldConfig.serial.start,
|
|
5377
5596
|
...fieldConfig.serial.maxValue && { maxValue: fieldConfig.serial.maxValue },
|
|
5378
5597
|
...fieldConfig.serial.format && { format: fieldConfig.serial.format }
|
|
5379
|
-
} }
|
|
5598
|
+
} },
|
|
5599
|
+
...fieldConfig.scale !== void 0 && { scale: fieldConfig.scale }
|
|
5380
5600
|
};
|
|
5381
5601
|
if (fieldConfig.type === "nested" && fieldConfig.fields) fieldEntry.fields = processNestedFields(fieldConfig.fields);
|
|
5382
5602
|
fields[fieldName] = fieldEntry;
|
|
@@ -5460,7 +5680,8 @@ function processNestedFields(fields) {
|
|
|
5460
5680
|
foreignKey: false,
|
|
5461
5681
|
vector: false,
|
|
5462
5682
|
...toProtoFieldHooks(nestedFieldConfig),
|
|
5463
|
-
fields: deepNestedFields
|
|
5683
|
+
fields: deepNestedFields,
|
|
5684
|
+
...nestedFieldConfig.scale !== void 0 && { scale: nestedFieldConfig.scale }
|
|
5464
5685
|
};
|
|
5465
5686
|
} else nestedFields[nestedFieldName] = {
|
|
5466
5687
|
type: nestedType,
|
|
@@ -5478,7 +5699,8 @@ function processNestedFields(fields) {
|
|
|
5478
5699
|
start: nestedFieldConfig.serial.start,
|
|
5479
5700
|
...nestedFieldConfig.serial.maxValue && { maxValue: nestedFieldConfig.serial.maxValue },
|
|
5480
5701
|
...nestedFieldConfig.serial.format && { format: nestedFieldConfig.serial.format }
|
|
5481
|
-
} }
|
|
5702
|
+
} },
|
|
5703
|
+
...nestedFieldConfig.scale !== void 0 && { scale: nestedFieldConfig.scale }
|
|
5482
5704
|
};
|
|
5483
5705
|
});
|
|
5484
5706
|
return nestedFields;
|
|
@@ -5785,7 +6007,7 @@ function formatMigrationCheckResults(results) {
|
|
|
5785
6007
|
}
|
|
5786
6008
|
|
|
5787
6009
|
//#endregion
|
|
5788
|
-
//#region src/cli/apply/
|
|
6010
|
+
//#region src/cli/commands/apply/workflow.ts
|
|
5789
6011
|
/**
|
|
5790
6012
|
* Apply workflow changes for the given phase.
|
|
5791
6013
|
* @param client - Operator client instance
|
|
@@ -5975,166 +6197,212 @@ async function planWorkflow(client, workspaceId, appName, workflows, mainJobDeps
|
|
|
5975
6197
|
}
|
|
5976
6198
|
|
|
5977
6199
|
//#endregion
|
|
5978
|
-
//#region src/cli/apply/
|
|
6200
|
+
//#region src/cli/commands/apply/apply.ts
|
|
5979
6201
|
/**
|
|
5980
6202
|
* Apply the configured application to the Tailor platform.
|
|
5981
6203
|
* @param options - Options for apply execution
|
|
5982
6204
|
* @returns Promise that resolves when apply completes
|
|
5983
6205
|
*/
|
|
5984
6206
|
async function apply(options) {
|
|
5985
|
-
|
|
5986
|
-
|
|
5987
|
-
|
|
5988
|
-
|
|
5989
|
-
|
|
5990
|
-
|
|
5991
|
-
|
|
5992
|
-
|
|
5993
|
-
|
|
5994
|
-
|
|
5995
|
-
|
|
5996
|
-
|
|
5997
|
-
|
|
5998
|
-
|
|
5999
|
-
|
|
6000
|
-
|
|
6001
|
-
|
|
6002
|
-
|
|
6003
|
-
|
|
6004
|
-
|
|
6005
|
-
|
|
6006
|
-
|
|
6007
|
-
|
|
6008
|
-
|
|
6009
|
-
|
|
6010
|
-
|
|
6011
|
-
|
|
6012
|
-
|
|
6013
|
-
|
|
6014
|
-
|
|
6015
|
-
|
|
6016
|
-
|
|
6017
|
-
|
|
6018
|
-
|
|
6019
|
-
|
|
6020
|
-
|
|
6021
|
-
|
|
6022
|
-
|
|
6023
|
-
|
|
6024
|
-
|
|
6025
|
-
|
|
6026
|
-
|
|
6027
|
-
|
|
6028
|
-
|
|
6029
|
-
|
|
6030
|
-
|
|
6031
|
-
|
|
6032
|
-
|
|
6033
|
-
|
|
6034
|
-
|
|
6035
|
-
|
|
6036
|
-
|
|
6037
|
-
|
|
6038
|
-
|
|
6039
|
-
|
|
6040
|
-
|
|
6041
|
-
|
|
6042
|
-
|
|
6043
|
-
|
|
6044
|
-
|
|
6045
|
-
|
|
6046
|
-
|
|
6047
|
-
|
|
6048
|
-
|
|
6049
|
-
|
|
6050
|
-
|
|
6051
|
-
|
|
6052
|
-
|
|
6053
|
-
|
|
6054
|
-
|
|
6055
|
-
|
|
6056
|
-
|
|
6057
|
-
|
|
6058
|
-
|
|
6059
|
-
|
|
6060
|
-
|
|
6061
|
-
|
|
6062
|
-
|
|
6063
|
-
|
|
6064
|
-
|
|
6065
|
-
|
|
6066
|
-
|
|
6067
|
-
|
|
6068
|
-
|
|
6069
|
-
|
|
6070
|
-
|
|
6071
|
-
|
|
6072
|
-
|
|
6073
|
-
|
|
6074
|
-
|
|
6075
|
-
|
|
6076
|
-
|
|
6077
|
-
|
|
6078
|
-
|
|
6079
|
-
|
|
6080
|
-
|
|
6081
|
-
|
|
6207
|
+
return withSpan("apply", async (rootSpan) => {
|
|
6208
|
+
rootSpan.setAttribute("apply.dry_run", options?.dryRun ?? false);
|
|
6209
|
+
const { config, application, workflowBuildResult, buildOnly } = await withSpan("build", async () => {
|
|
6210
|
+
const { config: config$1, plugins } = await withSpan("build.loadConfig", () => loadConfig(options?.configPath));
|
|
6211
|
+
const dryRun$1 = options?.dryRun ?? false;
|
|
6212
|
+
const buildOnly$1 = options?.buildOnly ?? process.env.TAILOR_PLATFORM_SDK_BUILD_ONLY === "true";
|
|
6213
|
+
const noCache = options?.noCache ?? false;
|
|
6214
|
+
const packageJson = await readPackageJson();
|
|
6215
|
+
const cacheDir = path.resolve(getDistDir(), "cache");
|
|
6216
|
+
if (options?.cleanCache) {
|
|
6217
|
+
fs$2.rmSync(cacheDir, {
|
|
6218
|
+
recursive: true,
|
|
6219
|
+
force: true
|
|
6220
|
+
});
|
|
6221
|
+
logger.info("Bundle cache cleaned");
|
|
6222
|
+
}
|
|
6223
|
+
const configDir = path.dirname(config$1.path);
|
|
6224
|
+
const lockfilePath = findUpSync("pnpm-lock.yaml", { cwd: configDir }) ?? findUpSync("package-lock.json", { cwd: configDir }) ?? findUpSync("yarn.lock", { cwd: configDir }) ?? findUpSync("bun.lock", { cwd: configDir });
|
|
6225
|
+
const cacheManager = createCacheManager({
|
|
6226
|
+
enabled: !noCache,
|
|
6227
|
+
cacheDir,
|
|
6228
|
+
sdkVersion: packageJson.version ?? "unknown",
|
|
6229
|
+
lockfileHash: lockfilePath ? hashFile(lockfilePath) : void 0
|
|
6230
|
+
});
|
|
6231
|
+
let pluginManager;
|
|
6232
|
+
if (plugins.length > 0) pluginManager = new PluginManager(plugins);
|
|
6233
|
+
await withSpan("build.generateUserTypes", () => generateUserTypes({
|
|
6234
|
+
config: config$1,
|
|
6235
|
+
configPath: config$1.path
|
|
6236
|
+
}));
|
|
6237
|
+
let application$1;
|
|
6238
|
+
let workflowBuildResult$1;
|
|
6239
|
+
try {
|
|
6240
|
+
const result = await withSpan("build.loadApplication", () => loadApplication({
|
|
6241
|
+
config: config$1,
|
|
6242
|
+
pluginManager,
|
|
6243
|
+
bundleCache: cacheManager.bundleCache
|
|
6244
|
+
}));
|
|
6245
|
+
application$1 = result.application;
|
|
6246
|
+
workflowBuildResult$1 = result.workflowBuildResult;
|
|
6247
|
+
} finally {
|
|
6248
|
+
cacheManager.finalize();
|
|
6249
|
+
}
|
|
6250
|
+
return {
|
|
6251
|
+
config: config$1,
|
|
6252
|
+
plugins,
|
|
6253
|
+
application: application$1,
|
|
6254
|
+
workflowBuildResult: workflowBuildResult$1,
|
|
6255
|
+
dryRun: dryRun$1,
|
|
6256
|
+
buildOnly: buildOnly$1
|
|
6257
|
+
};
|
|
6258
|
+
});
|
|
6259
|
+
if (buildOnly) return;
|
|
6260
|
+
const client = await initOperatorClient(await loadAccessToken({
|
|
6261
|
+
useProfile: true,
|
|
6262
|
+
profile: options?.profile
|
|
6263
|
+
}));
|
|
6264
|
+
const workspaceId = loadWorkspaceId({
|
|
6265
|
+
workspaceId: options?.workspaceId,
|
|
6266
|
+
profile: options?.profile
|
|
6267
|
+
});
|
|
6268
|
+
rootSpan.setAttribute("app.name", application.name);
|
|
6269
|
+
rootSpan.setAttribute("workspace.id", workspaceId);
|
|
6270
|
+
const workflowService = application.workflowService;
|
|
6271
|
+
const functionEntries = collectFunctionEntries(application, workflowService?.jobs ?? []);
|
|
6272
|
+
const dryRun = options?.dryRun ?? false;
|
|
6273
|
+
const yes = options?.yes ?? false;
|
|
6274
|
+
const { functionRegistry, tailorDB, staticWebsite, idp, auth, pipeline, app, executor, workflow } = await withSpan("plan", async () => {
|
|
6275
|
+
const ctx = {
|
|
6276
|
+
client,
|
|
6277
|
+
workspaceId,
|
|
6278
|
+
application,
|
|
6279
|
+
forRemoval: false,
|
|
6280
|
+
config,
|
|
6281
|
+
noSchemaCheck: options?.noSchemaCheck
|
|
6282
|
+
};
|
|
6283
|
+
const [functionRegistry$1, tailorDB$1, staticWebsite$1, idp$1, auth$1, pipeline$1, app$1, executor$1, workflow$1] = await Promise.all([
|
|
6284
|
+
withSpan("plan.functionRegistry", () => planFunctionRegistry(client, workspaceId, application.name, functionEntries)),
|
|
6285
|
+
withSpan("plan.tailorDB", () => planTailorDB(ctx)),
|
|
6286
|
+
withSpan("plan.staticWebsite", () => planStaticWebsite(ctx)),
|
|
6287
|
+
withSpan("plan.idp", () => planIdP(ctx)),
|
|
6288
|
+
withSpan("plan.auth", () => planAuth(ctx)),
|
|
6289
|
+
withSpan("plan.pipeline", () => planPipeline(ctx)),
|
|
6290
|
+
withSpan("plan.application", () => planApplication(ctx)),
|
|
6291
|
+
withSpan("plan.executor", () => planExecutor(ctx)),
|
|
6292
|
+
withSpan("plan.workflow", () => planWorkflow(client, workspaceId, application.name, workflowService?.workflows ?? {}, workflowBuildResult?.mainJobDeps ?? {}))
|
|
6293
|
+
]);
|
|
6294
|
+
return {
|
|
6295
|
+
functionRegistry: functionRegistry$1,
|
|
6296
|
+
tailorDB: tailorDB$1,
|
|
6297
|
+
staticWebsite: staticWebsite$1,
|
|
6298
|
+
idp: idp$1,
|
|
6299
|
+
auth: auth$1,
|
|
6300
|
+
pipeline: pipeline$1,
|
|
6301
|
+
app: app$1,
|
|
6302
|
+
executor: executor$1,
|
|
6303
|
+
workflow: workflow$1
|
|
6304
|
+
};
|
|
6305
|
+
});
|
|
6306
|
+
await withSpan("confirm", async () => {
|
|
6307
|
+
const allConflicts = [
|
|
6308
|
+
...functionRegistry.conflicts,
|
|
6309
|
+
...tailorDB.conflicts,
|
|
6310
|
+
...staticWebsite.conflicts,
|
|
6311
|
+
...idp.conflicts,
|
|
6312
|
+
...auth.conflicts,
|
|
6313
|
+
...pipeline.conflicts,
|
|
6314
|
+
...executor.conflicts,
|
|
6315
|
+
...workflow.conflicts
|
|
6316
|
+
];
|
|
6317
|
+
await confirmOwnerConflict(allConflicts, application.name, yes);
|
|
6318
|
+
await confirmUnmanagedResources([
|
|
6319
|
+
...functionRegistry.unmanaged,
|
|
6320
|
+
...tailorDB.unmanaged,
|
|
6321
|
+
...staticWebsite.unmanaged,
|
|
6322
|
+
...idp.unmanaged,
|
|
6323
|
+
...auth.unmanaged,
|
|
6324
|
+
...pipeline.unmanaged,
|
|
6325
|
+
...executor.unmanaged,
|
|
6326
|
+
...workflow.unmanaged
|
|
6327
|
+
], application.name, yes);
|
|
6328
|
+
const importantDeletions = [];
|
|
6329
|
+
for (const del of tailorDB.changeSet.type.deletes) importantDeletions.push({
|
|
6330
|
+
resourceType: "TailorDB type",
|
|
6331
|
+
resourceName: del.name
|
|
6332
|
+
});
|
|
6333
|
+
for (const del of staticWebsite.changeSet.deletes) importantDeletions.push({
|
|
6334
|
+
resourceType: "StaticWebsite",
|
|
6335
|
+
resourceName: del.name
|
|
6336
|
+
});
|
|
6337
|
+
for (const del of auth.changeSet.oauth2Client.deletes) importantDeletions.push({
|
|
6338
|
+
resourceType: "OAuth2 client",
|
|
6339
|
+
resourceName: del.name
|
|
6340
|
+
});
|
|
6341
|
+
for (const replace of auth.changeSet.oauth2Client.replaces) importantDeletions.push({
|
|
6342
|
+
resourceType: "OAuth2 client (client type change)",
|
|
6343
|
+
resourceName: replace.name
|
|
6344
|
+
});
|
|
6345
|
+
await confirmImportantResourceDeletion(importantDeletions, yes);
|
|
6346
|
+
const resourceOwners = new Set([
|
|
6347
|
+
...functionRegistry.resourceOwners,
|
|
6348
|
+
...tailorDB.resourceOwners,
|
|
6349
|
+
...staticWebsite.resourceOwners,
|
|
6350
|
+
...idp.resourceOwners,
|
|
6351
|
+
...auth.resourceOwners,
|
|
6352
|
+
...pipeline.resourceOwners,
|
|
6353
|
+
...executor.resourceOwners,
|
|
6354
|
+
...workflow.resourceOwners
|
|
6355
|
+
]);
|
|
6356
|
+
const emptyApps = [...new Set(allConflicts.map((c) => c.currentOwner))].filter((owner) => !resourceOwners.has(owner));
|
|
6357
|
+
for (const emptyApp of emptyApps) app.deletes.push({
|
|
6358
|
+
name: emptyApp,
|
|
6359
|
+
request: {
|
|
6360
|
+
workspaceId,
|
|
6361
|
+
applicationName: emptyApp
|
|
6362
|
+
}
|
|
6363
|
+
});
|
|
6364
|
+
});
|
|
6365
|
+
if (dryRun) {
|
|
6366
|
+
logger.info("Dry run enabled. No changes applied.");
|
|
6367
|
+
return;
|
|
6082
6368
|
}
|
|
6369
|
+
await withSpan("apply.createUpdateServices", async () => {
|
|
6370
|
+
await applyFunctionRegistry(client, workspaceId, functionRegistry, "create-update");
|
|
6371
|
+
await applyStaticWebsite(client, staticWebsite, "create-update");
|
|
6372
|
+
await applyIdP(client, idp, "create-update");
|
|
6373
|
+
await applyAuth(client, auth, "create-update");
|
|
6374
|
+
await applyTailorDB(client, tailorDB, "create-update");
|
|
6375
|
+
await applyPipeline(client, pipeline, "create-update");
|
|
6376
|
+
});
|
|
6377
|
+
await withSpan("apply.deleteSubgraphResources", async () => {
|
|
6378
|
+
await applyPipeline(client, pipeline, "delete-resources");
|
|
6379
|
+
await applyAuth(client, auth, "delete-resources");
|
|
6380
|
+
await applyIdP(client, idp, "delete-resources");
|
|
6381
|
+
});
|
|
6382
|
+
await withSpan("apply.createUpdateApplication", () => applyApplication(client, app, "create-update"));
|
|
6383
|
+
await withSpan("apply.createUpdateDependentServices", async () => {
|
|
6384
|
+
await applyExecutor(client, executor, "create-update");
|
|
6385
|
+
await applyWorkflow(client, workflow, "create-update");
|
|
6386
|
+
});
|
|
6387
|
+
await withSpan("apply.deleteDependentServices", async () => {
|
|
6388
|
+
await applyWorkflow(client, workflow, "delete");
|
|
6389
|
+
await applyExecutor(client, executor, "delete");
|
|
6390
|
+
await applyStaticWebsite(client, staticWebsite, "delete");
|
|
6391
|
+
});
|
|
6392
|
+
await withSpan("apply.deleteApplication", () => applyApplication(client, app, "delete"));
|
|
6393
|
+
await withSpan("apply.deleteSubgraphServices", async () => {
|
|
6394
|
+
await applyPipeline(client, pipeline, "delete-services");
|
|
6395
|
+
await applyAuth(client, auth, "delete-services");
|
|
6396
|
+
await applyIdP(client, idp, "delete-services");
|
|
6397
|
+
await applyTailorDB(client, tailorDB, "delete-services");
|
|
6398
|
+
});
|
|
6399
|
+
await withSpan("apply.cleanup", () => applyFunctionRegistry(client, workspaceId, functionRegistry, "delete"));
|
|
6400
|
+
logger.success("Successfully applied changes.");
|
|
6083
6401
|
});
|
|
6084
|
-
if (dryRun) {
|
|
6085
|
-
logger.info("Dry run enabled. No changes applied.");
|
|
6086
|
-
return;
|
|
6087
|
-
}
|
|
6088
|
-
await applyFunctionRegistry(client, workspaceId, functionRegistry, "create-update");
|
|
6089
|
-
await applyStaticWebsite(client, staticWebsite, "create-update");
|
|
6090
|
-
await applyIdP(client, idp, "create-update");
|
|
6091
|
-
await applyAuth(client, auth, "create-update");
|
|
6092
|
-
await applyTailorDB(client, tailorDB, "create-update");
|
|
6093
|
-
await applyPipeline(client, pipeline, "create-update");
|
|
6094
|
-
await applyPipeline(client, pipeline, "delete-resources");
|
|
6095
|
-
await applyAuth(client, auth, "delete-resources");
|
|
6096
|
-
await applyIdP(client, idp, "delete-resources");
|
|
6097
|
-
await applyApplication(client, app, "create-update");
|
|
6098
|
-
await applyExecutor(client, executor, "create-update");
|
|
6099
|
-
await applyWorkflow(client, workflow, "create-update");
|
|
6100
|
-
await applyWorkflow(client, workflow, "delete");
|
|
6101
|
-
await applyExecutor(client, executor, "delete");
|
|
6102
|
-
await applyStaticWebsite(client, staticWebsite, "delete");
|
|
6103
|
-
await applyApplication(client, app, "delete");
|
|
6104
|
-
await applyPipeline(client, pipeline, "delete-services");
|
|
6105
|
-
await applyAuth(client, auth, "delete-services");
|
|
6106
|
-
await applyIdP(client, idp, "delete-services");
|
|
6107
|
-
await applyTailorDB(client, tailorDB, "delete-services");
|
|
6108
|
-
await applyFunctionRegistry(client, workspaceId, functionRegistry, "delete");
|
|
6109
|
-
logger.success("Successfully applied changes.");
|
|
6110
6402
|
}
|
|
6111
|
-
const applyCommand = defineCommand({
|
|
6112
|
-
name: "apply",
|
|
6113
|
-
description: "Apply Tailor configuration to deploy your application.",
|
|
6114
|
-
args: z.object({
|
|
6115
|
-
...commonArgs,
|
|
6116
|
-
...deploymentArgs,
|
|
6117
|
-
...confirmationArgs,
|
|
6118
|
-
"dry-run": arg(z.boolean().optional(), {
|
|
6119
|
-
alias: "d",
|
|
6120
|
-
description: "Run the command without making any changes"
|
|
6121
|
-
}),
|
|
6122
|
-
"no-schema-check": arg(z.boolean().optional(), { description: "Skip schema diff check against migration snapshots" })
|
|
6123
|
-
}),
|
|
6124
|
-
run: withCommonArgs(async (args) => {
|
|
6125
|
-
await apply({
|
|
6126
|
-
workspaceId: args["workspace-id"],
|
|
6127
|
-
profile: args.profile,
|
|
6128
|
-
configPath: args.config,
|
|
6129
|
-
dryRun: args["dry-run"],
|
|
6130
|
-
yes: args.yes,
|
|
6131
|
-
noSchemaCheck: args["no-schema-check"]
|
|
6132
|
-
});
|
|
6133
|
-
})
|
|
6134
|
-
});
|
|
6135
6403
|
|
|
6136
6404
|
//#endregion
|
|
6137
|
-
//#region src/cli/executor/status.ts
|
|
6405
|
+
//#region src/cli/commands/executor/status.ts
|
|
6138
6406
|
/**
|
|
6139
6407
|
* Colorize executor job status string.
|
|
6140
6408
|
* @param status - Executor job status string
|
|
@@ -6224,7 +6492,7 @@ function executorTriggerTypeToString(triggerType) {
|
|
|
6224
6492
|
}
|
|
6225
6493
|
|
|
6226
6494
|
//#endregion
|
|
6227
|
-
//#region src/cli/executor/transform.ts
|
|
6495
|
+
//#region src/cli/commands/executor/transform.ts
|
|
6228
6496
|
function executorJobStatusToString(status) {
|
|
6229
6497
|
switch (status) {
|
|
6230
6498
|
case ExecutorJobStatus.PENDING: return "PENDING";
|
|
@@ -6391,7 +6659,7 @@ function toExecutorInfo(executor) {
|
|
|
6391
6659
|
}
|
|
6392
6660
|
|
|
6393
6661
|
//#endregion
|
|
6394
|
-
//#region src/cli/executor/get.ts
|
|
6662
|
+
//#region src/cli/commands/executor/get.ts
|
|
6395
6663
|
const nameArgs$1 = { name: arg(z.string(), {
|
|
6396
6664
|
positional: true,
|
|
6397
6665
|
description: "Executor name"
|
|
@@ -6451,7 +6719,7 @@ const getCommand$3 = defineCommand({
|
|
|
6451
6719
|
});
|
|
6452
6720
|
|
|
6453
6721
|
//#endregion
|
|
6454
|
-
//#region src/cli/
|
|
6722
|
+
//#region src/cli/shared/format.ts
|
|
6455
6723
|
/**
|
|
6456
6724
|
* Format a protobuf Timestamp to ISO string.
|
|
6457
6725
|
* @param timestamp - Protobuf timestamp
|
|
@@ -6497,7 +6765,7 @@ function humanizeRelativeTime(value) {
|
|
|
6497
6765
|
}
|
|
6498
6766
|
|
|
6499
6767
|
//#endregion
|
|
6500
|
-
//#region src/cli/
|
|
6768
|
+
//#region src/cli/shared/function-execution.ts
|
|
6501
6769
|
/**
|
|
6502
6770
|
* Convert function execution status enum to string.
|
|
6503
6771
|
* @param status - Function execution status enum value
|
|
@@ -6513,7 +6781,7 @@ function functionExecutionStatusToString(status) {
|
|
|
6513
6781
|
}
|
|
6514
6782
|
|
|
6515
6783
|
//#endregion
|
|
6516
|
-
//#region src/cli/workflow/args.ts
|
|
6784
|
+
//#region src/cli/commands/workflow/args.ts
|
|
6517
6785
|
const nameArgs = { name: arg(z.string(), {
|
|
6518
6786
|
positional: true,
|
|
6519
6787
|
description: "Workflow name"
|
|
@@ -6534,7 +6802,7 @@ const waitArgs = {
|
|
|
6534
6802
|
};
|
|
6535
6803
|
|
|
6536
6804
|
//#endregion
|
|
6537
|
-
//#region src/cli/workflow/status.ts
|
|
6805
|
+
//#region src/cli/commands/workflow/status.ts
|
|
6538
6806
|
/**
|
|
6539
6807
|
* Check if workflow execution status is terminal.
|
|
6540
6808
|
* @param status - Workflow execution status enum value
|
|
@@ -6545,7 +6813,7 @@ function isWorkflowExecutionTerminalStatus(status) {
|
|
|
6545
6813
|
}
|
|
6546
6814
|
|
|
6547
6815
|
//#endregion
|
|
6548
|
-
//#region src/cli/workflow/transform.ts
|
|
6816
|
+
//#region src/cli/commands/workflow/transform.ts
|
|
6549
6817
|
/**
|
|
6550
6818
|
* Convert a workflow execution status enum to a string.
|
|
6551
6819
|
* @param status - Workflow execution status
|
|
@@ -6637,7 +6905,7 @@ function toWorkflowExecutionInfo(execution) {
|
|
|
6637
6905
|
}
|
|
6638
6906
|
|
|
6639
6907
|
//#endregion
|
|
6640
|
-
//#region src/cli/workflow/executions.ts
|
|
6908
|
+
//#region src/cli/commands/workflow/executions.ts
|
|
6641
6909
|
function sleep$1(ms) {
|
|
6642
6910
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
6643
6911
|
}
|
|
@@ -6882,7 +7150,7 @@ const executionsCommand = defineCommand({
|
|
|
6882
7150
|
});
|
|
6883
7151
|
|
|
6884
7152
|
//#endregion
|
|
6885
|
-
//#region src/cli/workflow/get.ts
|
|
7153
|
+
//#region src/cli/commands/workflow/get.ts
|
|
6886
7154
|
/**
|
|
6887
7155
|
* Resolve a workflow definition by name.
|
|
6888
7156
|
* @param client - Operator client
|
|
@@ -6935,7 +7203,7 @@ const getCommand$2 = defineCommand({
|
|
|
6935
7203
|
});
|
|
6936
7204
|
|
|
6937
7205
|
//#endregion
|
|
6938
|
-
//#region src/cli/workflow/start.ts
|
|
7206
|
+
//#region src/cli/commands/workflow/start.ts
|
|
6939
7207
|
function sleep(ms) {
|
|
6940
7208
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
6941
7209
|
}
|
|
@@ -7137,7 +7405,7 @@ const startCommand = defineCommand({
|
|
|
7137
7405
|
});
|
|
7138
7406
|
|
|
7139
7407
|
//#endregion
|
|
7140
|
-
//#region src/cli/executor/jobs.ts
|
|
7408
|
+
//#region src/cli/commands/executor/jobs.ts
|
|
7141
7409
|
function formatTime(date) {
|
|
7142
7410
|
return date.toLocaleTimeString("en-US", { hour12: false });
|
|
7143
7411
|
}
|
|
@@ -7516,7 +7784,7 @@ const jobsCommand = defineCommand({
|
|
|
7516
7784
|
});
|
|
7517
7785
|
|
|
7518
7786
|
//#endregion
|
|
7519
|
-
//#region src/cli/executor/list.ts
|
|
7787
|
+
//#region src/cli/commands/executor/list.ts
|
|
7520
7788
|
/**
|
|
7521
7789
|
* List executors in the workspace and return CLI-friendly info.
|
|
7522
7790
|
* @param options - Executor listing options
|
|
@@ -7565,7 +7833,7 @@ const listCommand$6 = defineCommand({
|
|
|
7565
7833
|
});
|
|
7566
7834
|
|
|
7567
7835
|
//#endregion
|
|
7568
|
-
//#region src/cli/executor/trigger.ts
|
|
7836
|
+
//#region src/cli/commands/executor/trigger.ts
|
|
7569
7837
|
/**
|
|
7570
7838
|
* Schema for JSON string validation (object only)
|
|
7571
7839
|
* Transforms the string to a parsed object
|
|
@@ -7778,7 +8046,7 @@ The \`--logs\` option displays logs from the downstream execution when available
|
|
|
7778
8046
|
});
|
|
7779
8047
|
|
|
7780
8048
|
//#endregion
|
|
7781
|
-
//#region src/cli/executor/webhook.ts
|
|
8049
|
+
//#region src/cli/commands/executor/webhook.ts
|
|
7782
8050
|
/**
|
|
7783
8051
|
* Build the webhook URL for an executor.
|
|
7784
8052
|
* @param workspaceId - Workspace ID
|
|
@@ -7846,7 +8114,7 @@ const webhookCommand = defineCommand({
|
|
|
7846
8114
|
});
|
|
7847
8115
|
|
|
7848
8116
|
//#endregion
|
|
7849
|
-
//#region src/cli/
|
|
8117
|
+
//#region src/cli/commands/generate/types.ts
|
|
7850
8118
|
/**
|
|
7851
8119
|
* Type guard to check if a generator has a specific dependency.
|
|
7852
8120
|
* @template D
|
|
@@ -7859,7 +8127,7 @@ function hasDependency(generator, dependency) {
|
|
|
7859
8127
|
}
|
|
7860
8128
|
|
|
7861
8129
|
//#endregion
|
|
7862
|
-
//#region src/cli/
|
|
8130
|
+
//#region src/cli/commands/generate/watch/index.ts
|
|
7863
8131
|
/**
|
|
7864
8132
|
* Error codes.
|
|
7865
8133
|
*/
|
|
@@ -8237,7 +8505,7 @@ function createDependencyWatcher(options = {}) {
|
|
|
8237
8505
|
}
|
|
8238
8506
|
|
|
8239
8507
|
//#endregion
|
|
8240
|
-
//#region src/cli/
|
|
8508
|
+
//#region src/cli/commands/generate/service.ts
|
|
8241
8509
|
/**
|
|
8242
8510
|
* Creates a generation manager.
|
|
8243
8511
|
* @param params - Parameters for creating the generation manager
|
|
@@ -8683,30 +8951,9 @@ async function generate$1(options) {
|
|
|
8683
8951
|
await manager.generate(watch$1);
|
|
8684
8952
|
if (watch$1) await manager.watch();
|
|
8685
8953
|
}
|
|
8686
|
-
const generateCommand$1 = defineCommand({
|
|
8687
|
-
name: "generate",
|
|
8688
|
-
description: "Generate files using Tailor configuration.",
|
|
8689
|
-
args: z.object({
|
|
8690
|
-
...commonArgs,
|
|
8691
|
-
config: arg(z.string().default("tailor.config.ts"), {
|
|
8692
|
-
alias: "c",
|
|
8693
|
-
description: "Path to SDK config file"
|
|
8694
|
-
}),
|
|
8695
|
-
watch: arg(z.boolean().default(false), {
|
|
8696
|
-
alias: "W",
|
|
8697
|
-
description: "Watch for type/resolver changes and regenerate"
|
|
8698
|
-
})
|
|
8699
|
-
}),
|
|
8700
|
-
run: withCommonArgs(async (args) => {
|
|
8701
|
-
await generate$1({
|
|
8702
|
-
configPath: args.config,
|
|
8703
|
-
watch: args.watch
|
|
8704
|
-
});
|
|
8705
|
-
})
|
|
8706
|
-
});
|
|
8707
8954
|
|
|
8708
8955
|
//#endregion
|
|
8709
|
-
//#region src/cli/machineuser/list.ts
|
|
8956
|
+
//#region src/cli/commands/machineuser/list.ts
|
|
8710
8957
|
/**
|
|
8711
8958
|
* Map a MachineUser protobuf message to CLI-friendly info.
|
|
8712
8959
|
* @param user - Machine user resource
|
|
@@ -8774,7 +9021,7 @@ const listCommand$5 = defineCommand({
|
|
|
8774
9021
|
});
|
|
8775
9022
|
|
|
8776
9023
|
//#endregion
|
|
8777
|
-
//#region src/cli/machineuser/token.ts
|
|
9024
|
+
//#region src/cli/commands/machineuser/token.ts
|
|
8778
9025
|
/**
|
|
8779
9026
|
* Get a machine user access token for the current application.
|
|
8780
9027
|
* @param options - Token retrieval options
|
|
@@ -8839,7 +9086,7 @@ const tokenCommand = defineCommand({
|
|
|
8839
9086
|
});
|
|
8840
9087
|
|
|
8841
9088
|
//#endregion
|
|
8842
|
-
//#region src/cli/oauth2client/transform.ts
|
|
9089
|
+
//#region src/cli/commands/oauth2client/transform.ts
|
|
8843
9090
|
const grantTypeToString = (grantType) => {
|
|
8844
9091
|
switch (grantType) {
|
|
8845
9092
|
case AuthOAuth2Client_GrantType.AUTHORIZATION_CODE: return "authorization_code";
|
|
@@ -8880,7 +9127,7 @@ function toOAuth2ClientCredentials(client) {
|
|
|
8880
9127
|
}
|
|
8881
9128
|
|
|
8882
9129
|
//#endregion
|
|
8883
|
-
//#region src/cli/oauth2client/get.ts
|
|
9130
|
+
//#region src/cli/commands/oauth2client/get.ts
|
|
8884
9131
|
/**
|
|
8885
9132
|
* Get OAuth2 client credentials for the current application.
|
|
8886
9133
|
* @param options - OAuth2 client lookup options
|
|
@@ -8937,7 +9184,7 @@ const getCommand$1 = defineCommand({
|
|
|
8937
9184
|
});
|
|
8938
9185
|
|
|
8939
9186
|
//#endregion
|
|
8940
|
-
//#region src/cli/oauth2client/list.ts
|
|
9187
|
+
//#region src/cli/commands/oauth2client/list.ts
|
|
8941
9188
|
/**
|
|
8942
9189
|
* List OAuth2 clients for the current application.
|
|
8943
9190
|
* @param options - OAuth2 client listing options
|
|
@@ -8987,7 +9234,7 @@ const listCommand$4 = defineCommand({
|
|
|
8987
9234
|
});
|
|
8988
9235
|
|
|
8989
9236
|
//#endregion
|
|
8990
|
-
//#region src/cli/remove.ts
|
|
9237
|
+
//#region src/cli/commands/remove.ts
|
|
8991
9238
|
async function loadOptions$9(options) {
|
|
8992
9239
|
const client = await initOperatorClient(await loadAccessToken({
|
|
8993
9240
|
useProfile: true,
|
|
@@ -9079,7 +9326,7 @@ const removeCommand$1 = defineCommand({
|
|
|
9079
9326
|
});
|
|
9080
9327
|
|
|
9081
9328
|
//#endregion
|
|
9082
|
-
//#region src/cli/show.ts
|
|
9329
|
+
//#region src/cli/commands/show.ts
|
|
9083
9330
|
function applicationInfo(app) {
|
|
9084
9331
|
return {
|
|
9085
9332
|
name: app.name,
|
|
@@ -9140,7 +9387,7 @@ const showCommand = defineCommand({
|
|
|
9140
9387
|
});
|
|
9141
9388
|
|
|
9142
9389
|
//#endregion
|
|
9143
|
-
//#region src/cli/
|
|
9390
|
+
//#region src/cli/shared/beta.ts
|
|
9144
9391
|
/**
|
|
9145
9392
|
* Warn that a feature is in beta.
|
|
9146
9393
|
* @param {string} featureName - Name of the beta feature (e.g., "tailordb erd", "tailordb migration")
|
|
@@ -9151,7 +9398,7 @@ function logBetaWarning(featureName) {
|
|
|
9151
9398
|
}
|
|
9152
9399
|
|
|
9153
9400
|
//#endregion
|
|
9154
|
-
//#region src/cli/tailordb/migrate/db-types-generator.ts
|
|
9401
|
+
//#region src/cli/commands/tailordb/migrate/db-types-generator.ts
|
|
9155
9402
|
/**
|
|
9156
9403
|
* DB types generator for TailorDB migrations
|
|
9157
9404
|
*
|
|
@@ -9303,7 +9550,8 @@ function generateTableType(type, breakingChangeFields) {
|
|
|
9303
9550
|
function mapToTsType(fieldType) {
|
|
9304
9551
|
switch (fieldType) {
|
|
9305
9552
|
case "uuid":
|
|
9306
|
-
case "string":
|
|
9553
|
+
case "string":
|
|
9554
|
+
case "decimal": return {
|
|
9307
9555
|
type: "string",
|
|
9308
9556
|
usedTimestamp: false
|
|
9309
9557
|
};
|
|
@@ -9393,7 +9641,7 @@ async function writeDbTypesFile(snapshot, migrationsDir, migrationNumber, diff)
|
|
|
9393
9641
|
}
|
|
9394
9642
|
|
|
9395
9643
|
//#endregion
|
|
9396
|
-
//#region src/cli/tailordb/migrate/template-generator.ts
|
|
9644
|
+
//#region src/cli/commands/tailordb/migrate/template-generator.ts
|
|
9397
9645
|
/**
|
|
9398
9646
|
* Template generator for TailorDB migrations
|
|
9399
9647
|
*
|
|
@@ -9593,7 +9841,7 @@ function generateChangeScript(change) {
|
|
|
9593
9841
|
}
|
|
9594
9842
|
|
|
9595
9843
|
//#endregion
|
|
9596
|
-
//#region src/cli/tailordb/migrate/generate.ts
|
|
9844
|
+
//#region src/cli/commands/tailordb/migrate/generate.ts
|
|
9597
9845
|
/**
|
|
9598
9846
|
* Generate command for TailorDB migrations
|
|
9599
9847
|
*
|
|
@@ -9658,7 +9906,7 @@ async function generate(options) {
|
|
|
9658
9906
|
if (options.init) await handleInitOption(namespacesWithMigrations, options.yes);
|
|
9659
9907
|
let pluginManager;
|
|
9660
9908
|
if (plugins.length > 0) pluginManager = new PluginManager(plugins);
|
|
9661
|
-
const { defineApplication: defineApplication$1 } = await import("./application-
|
|
9909
|
+
const { defineApplication: defineApplication$1 } = await import("./application-CZdieD3K.mjs");
|
|
9662
9910
|
const application = defineApplication$1({
|
|
9663
9911
|
config,
|
|
9664
9912
|
pluginManager
|
|
@@ -9815,7 +10063,7 @@ const generateCommand = defineCommand({
|
|
|
9815
10063
|
});
|
|
9816
10064
|
|
|
9817
10065
|
//#endregion
|
|
9818
|
-
//#region src/cli/tailordb/truncate.ts
|
|
10066
|
+
//#region src/cli/commands/tailordb/truncate.ts
|
|
9819
10067
|
async function truncateSingleType(options, client) {
|
|
9820
10068
|
await client.truncateTailorDBType({
|
|
9821
10069
|
workspaceId: options.workspaceId,
|
|
@@ -9981,7 +10229,7 @@ const truncateCommand = defineCommand({
|
|
|
9981
10229
|
});
|
|
9982
10230
|
|
|
9983
10231
|
//#endregion
|
|
9984
|
-
//#region src/cli/workflow/list.ts
|
|
10232
|
+
//#region src/cli/commands/workflow/list.ts
|
|
9985
10233
|
/**
|
|
9986
10234
|
* List workflows in the workspace and return CLI-friendly info.
|
|
9987
10235
|
* @param options - Workflow listing options
|
|
@@ -10027,7 +10275,7 @@ const listCommand$3 = defineCommand({
|
|
|
10027
10275
|
});
|
|
10028
10276
|
|
|
10029
10277
|
//#endregion
|
|
10030
|
-
//#region src/cli/workflow/resume.ts
|
|
10278
|
+
//#region src/cli/commands/workflow/resume.ts
|
|
10031
10279
|
/**
|
|
10032
10280
|
* Resume a suspended workflow execution and return a handle to wait for completion.
|
|
10033
10281
|
* @param options - Resume options
|
|
@@ -10102,7 +10350,7 @@ const resumeCommand = defineCommand({
|
|
|
10102
10350
|
});
|
|
10103
10351
|
|
|
10104
10352
|
//#endregion
|
|
10105
|
-
//#region src/cli/workspace/app/transform.ts
|
|
10353
|
+
//#region src/cli/commands/workspace/app/transform.ts
|
|
10106
10354
|
const statusToString = (status) => {
|
|
10107
10355
|
switch (status) {
|
|
10108
10356
|
case GetApplicationSchemaHealthResponse_ApplicationSchemaHealthStatus.OK: return "ok";
|
|
@@ -10139,7 +10387,7 @@ const appHealthInfo = (name, health) => {
|
|
|
10139
10387
|
};
|
|
10140
10388
|
|
|
10141
10389
|
//#endregion
|
|
10142
|
-
//#region src/cli/workspace/app/health.ts
|
|
10390
|
+
//#region src/cli/commands/workspace/app/health.ts
|
|
10143
10391
|
const healthOptionsSchema = z.object({
|
|
10144
10392
|
workspaceId: z.uuid({ message: "workspace-id must be a valid UUID" }).optional(),
|
|
10145
10393
|
profile: z.string().optional(),
|
|
@@ -10197,7 +10445,7 @@ const healthCommand = defineCommand({
|
|
|
10197
10445
|
});
|
|
10198
10446
|
|
|
10199
10447
|
//#endregion
|
|
10200
|
-
//#region src/cli/workspace/app/list.ts
|
|
10448
|
+
//#region src/cli/commands/workspace/app/list.ts
|
|
10201
10449
|
const listAppsOptionsSchema = z.object({
|
|
10202
10450
|
workspaceId: z.uuid({ message: "workspace-id must be a valid UUID" }).optional(),
|
|
10203
10451
|
profile: z.string().optional(),
|
|
@@ -10269,7 +10517,7 @@ const listCommand$2 = defineCommand({
|
|
|
10269
10517
|
});
|
|
10270
10518
|
|
|
10271
10519
|
//#endregion
|
|
10272
|
-
//#region src/cli/workspace/transform.ts
|
|
10520
|
+
//#region src/cli/commands/workspace/transform.ts
|
|
10273
10521
|
const workspaceInfo = (workspace) => {
|
|
10274
10522
|
return {
|
|
10275
10523
|
id: workspace.id,
|
|
@@ -10289,7 +10537,7 @@ const workspaceDetails = (workspace) => {
|
|
|
10289
10537
|
};
|
|
10290
10538
|
|
|
10291
10539
|
//#endregion
|
|
10292
|
-
//#region src/cli/workspace/create.ts
|
|
10540
|
+
//#region src/cli/commands/workspace/create.ts
|
|
10293
10541
|
/**
|
|
10294
10542
|
* Schema for workspace creation options
|
|
10295
10543
|
* - name: 3-63 chars, lowercase alphanumeric and hyphens, cannot start/end with hyphen
|
|
@@ -10404,7 +10652,7 @@ const createCommand = defineCommand({
|
|
|
10404
10652
|
});
|
|
10405
10653
|
|
|
10406
10654
|
//#endregion
|
|
10407
|
-
//#region src/cli/workspace/delete.ts
|
|
10655
|
+
//#region src/cli/commands/workspace/delete.ts
|
|
10408
10656
|
const deleteWorkspaceOptionsSchema = z.object({ workspaceId: z.uuid({ message: "workspace-id must be a valid UUID" }) });
|
|
10409
10657
|
async function loadOptions$6(options) {
|
|
10410
10658
|
const result = deleteWorkspaceOptionsSchema.safeParse(options);
|
|
@@ -10461,7 +10709,7 @@ const deleteCommand = defineCommand({
|
|
|
10461
10709
|
});
|
|
10462
10710
|
|
|
10463
10711
|
//#endregion
|
|
10464
|
-
//#region src/cli/workspace/get.ts
|
|
10712
|
+
//#region src/cli/commands/workspace/get.ts
|
|
10465
10713
|
const getWorkspaceOptionsSchema = z.object({
|
|
10466
10714
|
workspaceId: z.uuid({ message: "workspace-id must be a valid UUID" }).optional(),
|
|
10467
10715
|
profile: z.string().optional()
|
|
@@ -10511,7 +10759,7 @@ const getCommand = defineCommand({
|
|
|
10511
10759
|
});
|
|
10512
10760
|
|
|
10513
10761
|
//#endregion
|
|
10514
|
-
//#region src/cli/workspace/list.ts
|
|
10762
|
+
//#region src/cli/commands/workspace/list.ts
|
|
10515
10763
|
/**
|
|
10516
10764
|
* List workspaces with an optional limit.
|
|
10517
10765
|
* @param options - Workspace listing options
|
|
@@ -10557,7 +10805,7 @@ const listCommand$1 = defineCommand({
|
|
|
10557
10805
|
});
|
|
10558
10806
|
|
|
10559
10807
|
//#endregion
|
|
10560
|
-
//#region src/cli/workspace/restore.ts
|
|
10808
|
+
//#region src/cli/commands/workspace/restore.ts
|
|
10561
10809
|
const restoreWorkspaceOptionsSchema = z.object({ workspaceId: z.uuid({ message: "workspace-id must be a valid UUID" }) });
|
|
10562
10810
|
async function loadOptions$4(options) {
|
|
10563
10811
|
const result = restoreWorkspaceOptionsSchema.safeParse(options);
|
|
@@ -10601,7 +10849,7 @@ const restoreCommand = defineCommand({
|
|
|
10601
10849
|
});
|
|
10602
10850
|
|
|
10603
10851
|
//#endregion
|
|
10604
|
-
//#region src/cli/workspace/user/transform.ts
|
|
10852
|
+
//#region src/cli/commands/workspace/user/transform.ts
|
|
10605
10853
|
const roleToString = (role) => {
|
|
10606
10854
|
switch (role) {
|
|
10607
10855
|
case WorkspacePlatformUserRole.ADMIN: return "admin";
|
|
@@ -10632,7 +10880,7 @@ const validRoles = [
|
|
|
10632
10880
|
];
|
|
10633
10881
|
|
|
10634
10882
|
//#endregion
|
|
10635
|
-
//#region src/cli/workspace/user/invite.ts
|
|
10883
|
+
//#region src/cli/commands/workspace/user/invite.ts
|
|
10636
10884
|
const inviteUserOptionsSchema = z.object({
|
|
10637
10885
|
workspaceId: z.uuid({ message: "workspace-id must be a valid UUID" }).optional(),
|
|
10638
10886
|
profile: z.string().optional(),
|
|
@@ -10689,7 +10937,7 @@ const inviteCommand = defineCommand({
|
|
|
10689
10937
|
});
|
|
10690
10938
|
|
|
10691
10939
|
//#endregion
|
|
10692
|
-
//#region src/cli/workspace/user/list.ts
|
|
10940
|
+
//#region src/cli/commands/workspace/user/list.ts
|
|
10693
10941
|
const listUsersOptionsSchema = z.object({
|
|
10694
10942
|
workspaceId: z.uuid({ message: "workspace-id must be a valid UUID" }).optional(),
|
|
10695
10943
|
profile: z.string().optional(),
|
|
@@ -10757,7 +11005,7 @@ const listCommand = defineCommand({
|
|
|
10757
11005
|
});
|
|
10758
11006
|
|
|
10759
11007
|
//#endregion
|
|
10760
|
-
//#region src/cli/workspace/user/remove.ts
|
|
11008
|
+
//#region src/cli/commands/workspace/user/remove.ts
|
|
10761
11009
|
const removeUserOptionsSchema = z.object({
|
|
10762
11010
|
workspaceId: z.uuid({ message: "workspace-id must be a valid UUID" }).optional(),
|
|
10763
11011
|
profile: z.string().optional(),
|
|
@@ -10813,7 +11061,7 @@ const removeCommand = defineCommand({
|
|
|
10813
11061
|
});
|
|
10814
11062
|
|
|
10815
11063
|
//#endregion
|
|
10816
|
-
//#region src/cli/workspace/user/update.ts
|
|
11064
|
+
//#region src/cli/commands/workspace/user/update.ts
|
|
10817
11065
|
const updateUserOptionsSchema = z.object({
|
|
10818
11066
|
workspaceId: z.uuid({ message: "workspace-id must be a valid UUID" }).optional(),
|
|
10819
11067
|
profile: z.string().optional(),
|
|
@@ -10870,5 +11118,5 @@ const updateCommand = defineCommand({
|
|
|
10870
11118
|
});
|
|
10871
11119
|
|
|
10872
11120
|
//#endregion
|
|
10873
|
-
export {
|
|
10874
|
-
//# sourceMappingURL=update-
|
|
11121
|
+
export { listExecutorJobs as $, generateCommand as A, getMigrationFiles as At, getMachineUserToken as B, generateUserTypes as Bt, resumeCommand as C, compareLocalTypesWithSnapshot as Ct, truncate as D, getLatestMigrationNumber as Dt, listWorkflows as E, formatMigrationNumber as Et, removeCommand$1 as F, formatDiffSummary as Ft, listWebhookExecutors as G, deploymentArgs as Gt, listCommand$5 as H, apiCommand as Ht, listCommand$4 as I, formatMigrationDiff as It, triggerExecutor as J, workspaceArgs as Jt, webhookCommand as K, jsonArgs as Kt, listOAuth2Clients as L, hasChanges as Lt, show as M, isValidMigrationNumber as Mt, showCommand as N, loadDiff as Nt, truncateCommand as O, getMigrationDirPath as Ot, remove as P, reconstructSnapshotFromMigrations as Pt, jobsCommand as Q, getCommand$1 as R, getNamespacesWithMigrations as Rt, healthCommand as S, SCHEMA_FILE_NAME as St, listCommand$3 as T, createSnapshotFromLocalTypes as Tt, listMachineUsers as U, commonArgs as Ut, tokenCommand as V, apiCall as Vt, generate$1 as W, confirmationArgs as Wt, listExecutors as X, listCommand$6 as Y, getExecutorJob as Z, createCommand as _, bundleMigrationScript as _t, listCommand as a, executionsCommand as at, listCommand$2 as b, INITIAL_SCHEMA_NUMBER as bt, inviteUser as c, functionExecutionStatusToString as ct, listCommand$1 as d, getExecutor as dt, watchExecutorJob as et, listWorkspaces as f, apply as ft, deleteWorkspace as g, parseMigrationLabelNumber as gt, deleteCommand as h, MIGRATION_LABEL_KEY as ht, removeUser as i, getWorkflow as it, logBetaWarning as j, getNextMigrationNumber as jt, generate as k, getMigrationFilePath as kt, restoreCommand as l, formatKeyValueTable as lt, getWorkspace as m, waitForExecution$1 as mt, updateUser as n, startWorkflow as nt, listUsers as o, getWorkflowExecution as ot, getCommand as p, executeScript as pt, triggerCommand as q, withCommonArgs as qt, removeCommand as r, getCommand$2 as rt, inviteCommand as s, listWorkflowExecutions as st, updateCommand as t, startCommand as tt, restoreWorkspace as u, getCommand$3 as ut, createWorkspace as v, DB_TYPES_FILE_NAME as vt, resumeWorkflow as w, compareSnapshots as wt, getAppHealth as x, MIGRATE_FILE_NAME as xt, listApps as y, DIFF_FILE_NAME as yt, getOAuth2Client as z, trnPrefix as zt };
|
|
11122
|
+
//# sourceMappingURL=update-DkpWgrzL.mjs.map
|