@tailor-platform/sdk 1.55.2 → 1.56.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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @tailor-platform/sdk
2
2
 
3
+ ## 1.56.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#1341](https://github.com/tailor-platform/sdk/pull/1341) [`64b07b4`](https://github.com/tailor-platform/sdk/commit/64b07b4c6f1db868abf2e1ebb9097e0e2f2f3cc6) Thanks [@dqn](https://github.com/dqn)! - Add a `logLevel` config option to remove lower-level `console.*` calls from bundled deployment functions.
8
+
9
+ ### Patch Changes
10
+
11
+ - [#1345](https://github.com/tailor-platform/sdk/pull/1345) [`ec863f1`](https://github.com/tailor-platform/sdk/commit/ec863f13e7a3ca43e40ad413c1bbe47cd5567c95) Thanks [@dqn](https://github.com/dqn)! - Fix `seed --truncate` deleting only the first page of Built-In IdP `_User` records. The generated truncation script used incorrect pagination keys, so projects with more than one page of users were left with the remaining pages while the command still reported success. All pages are now deleted.
12
+
13
+ - [#1344](https://github.com/tailor-platform/sdk/pull/1344) [`d3f22da`](https://github.com/tailor-platform/sdk/commit/d3f22da5a9bcd44ca9659ac35a68a20a2cbc1c2a) Thanks [@dqn](https://github.com/dqn)! - Fix CLI auth config losing keyring-stored logins. Running any command without `TAILOR_USE_KEYRING` no longer downgrades `config.yaml` in a way that drops `storage: keyring` users (and dangles their `current_user` reference), which previously logged keyring users out. Configs containing keyring users now stay in V2 format; file-only configs still downgrade to V1 for backward compatibility.
14
+
3
15
  ## 1.55.2
4
16
 
5
17
  ### Patch Changes
@@ -0,0 +1,4 @@
1
+
2
+ import { n as generatePluginFilesIfNeeded, r as loadApplication, t as defineApplication } from "./application-YHZIkjdy.mjs";
3
+
4
+ export { defineApplication };
@@ -6,7 +6,7 @@ import { n as enumConstantsPlugin, t as EnumConstantsGeneratorID } from "./enum-
6
6
  import { t as multiline } from "./multiline-Cf9ODpr1.mjs";
7
7
  import { n as fileUtilsPlugin, t as FileUtilsGeneratorID } from "./file-utils-BHPxPXmn.mjs";
8
8
  import { n as kyselyTypePlugin, t as KyselyGeneratorID } from "./kysely-type-D1e0Vwkd.mjs";
9
- import { n as seedPlugin, r as isPluginGeneratedType, t as SeedGeneratorID } from "./seed-DfLyRh63.mjs";
9
+ import { n as seedPlugin, r as isPluginGeneratedType, t as SeedGeneratorID } from "./seed-C0fE2sJB.mjs";
10
10
  import { t as readPackageJson } from "./package-json-DcQApfPQ.mjs";
11
11
  import { n as tightenSecretFilePermissions, r as writeSecretFile } from "./secret-file-CWzF8rry.mjs";
12
12
  import { builtinModules, createRequire } from "node:module";
@@ -30,12 +30,27 @@ import * as inflection from "inflection";
30
30
  import * as globals from "globals";
31
31
  import pLimit from "p-limit";
32
32
 
33
+ //#region src/parser/app-config/log-level.ts
34
+ const LOG_LEVELS = [
35
+ "DEBUG",
36
+ "INFO",
37
+ "WARN",
38
+ "ERROR",
39
+ "SILENT"
40
+ ];
41
+ function isLogLevel(value) {
42
+ return LOG_LEVELS.includes(value);
43
+ }
44
+
45
+ //#endregion
33
46
  //#region src/parser/app-config/schema.ts
34
47
  const envValueSchema = z.union([
35
48
  z.string(),
36
49
  z.number(),
37
50
  z.boolean()
38
51
  ]);
52
+ const LogLevelSchema = z.enum(LOG_LEVELS);
53
+ const logLevelSchema = z.string().refine((value) => LogLevelSchema.safeParse(value.trim().toUpperCase()).success, { message: `'logLevel' must be one of: ${LOG_LEVELS.join(", ")}.` });
39
54
  /**
40
55
  * Structural validation schema for `defineConfig({...})`. Validates only
41
56
  * top-level fields with platform-side constraints (notably `id`); fields
@@ -55,6 +70,7 @@ const AppConfigSchema = z.object({
55
70
  allowedIpAddresses: z.array(z.string()).optional(),
56
71
  disableIntrospection: z.boolean().optional(),
57
72
  inlineSourcemap: z.boolean().optional(),
73
+ logLevel: logLevelSchema.optional(),
58
74
  db: z.unknown().optional(),
59
75
  resolver: z.unknown().optional(),
60
76
  idp: z.unknown().optional(),
@@ -329,17 +345,23 @@ function toV1ForDisk(config) {
329
345
  token_expires_at: entry.token_expires_at
330
346
  };
331
347
  }
348
+ const currentUser = config.current_user && users[config.current_user] ? config.current_user : null;
332
349
  return {
333
350
  version: 1,
334
351
  users,
335
352
  profiles: config.profiles,
336
- current_user: config.current_user
353
+ current_user: currentUser
337
354
  };
338
355
  }
339
356
  /**
340
357
  * Write Tailor Platform CLI configuration to disk.
341
- * By default, V2 configs are converted to V1 for backward compatibility.
342
- * Set TAILOR_USE_KEYRING to write V2 format (required for keyring storage).
358
+ * By default, V2 configs are converted to V1 for backward compatibility, so an
359
+ * older SDK can still read the file. Configs containing a keyring user are kept
360
+ * as V2 regardless, because the keyring storage variant is not representable in
361
+ * V1 and downgrading it would silently drop the user's login. Such configs are
362
+ * already V2 on disk (a keyring entry is only ever persisted with
363
+ * TAILOR_USE_KEYRING set), so keeping V2 does not regress backward compatibility.
364
+ * Set TAILOR_USE_KEYRING to write V2 format unconditionally.
343
365
  *
344
366
  * The config file may contain access/refresh tokens when the OS keyring is
345
367
  * unavailable, so it is written via {@link writeSecretFile} so other users
@@ -347,7 +369,9 @@ function toV1ForDisk(config) {
347
369
  * @param config - Platform configuration to write
348
370
  */
349
371
  function writePlatformConfig(config) {
350
- writeSecretFile(platformConfigPath(), stringifyYAML(config.version === 2 && !process.env.TAILOR_USE_KEYRING ? toV1ForDisk(config) : config));
372
+ const configPath = platformConfigPath();
373
+ const hasKeyringUser = config.version === 2 && Object.values(config.users).some((u) => u?.storage === "keyring");
374
+ writeSecretFile(configPath, stringifyYAML(config.version === 2 && !process.env.TAILOR_USE_KEYRING && !hasKeyringUser ? toV1ForDisk(config) : config));
351
375
  }
352
376
  const tcContextConfigSchema = z.object({
353
377
  username: z.string().optional(),
@@ -733,14 +757,14 @@ function combineHash(fileHash, contextHash) {
733
757
  * Compute a context hash for cache invalidation across bundlers.
734
758
  *
735
759
  * Combines the source file path, serialized trigger context, tsconfig hash,
736
- * sourcemap mode, and an optional prefix (e.g., serialized env variables)
737
- * into a single SHA-256 hash.
760
+ * sourcemap mode, bundle log level, and an optional prefix (e.g., serialized
761
+ * env variables) into a single SHA-256 hash.
738
762
  * @param params - Context hash computation parameters
739
763
  * @returns SHA-256 hex digest of the combined context
740
764
  */
741
765
  function computeBundlerContextHash(params) {
742
- const { sourceFile, serializedTriggerContext, tsconfig, inlineSourcemap, prefix } = params;
743
- return hashContent((prefix ?? "") + path.resolve(sourceFile) + serializedTriggerContext + (tsconfig ? hashFile(tsconfig) : "") + String(inlineSourcemap ?? false));
766
+ const { sourceFile, serializedTriggerContext, tsconfig, inlineSourcemap, bundleLogLevel, prefix } = params;
767
+ return hashContent((prefix ?? "") + path.resolve(sourceFile) + serializedTriggerContext + (tsconfig ? hashFile(tsconfig) : "") + String(inlineSourcemap ?? false) + (bundleLogLevel ?? ""));
744
768
  }
745
769
  /**
746
770
  * Run a build with optional cache restore/save around it.
@@ -1359,6 +1383,83 @@ async function removeStaleEntryFiles(outputDir) {
1359
1383
  await Promise.all(files.filter((file) => file.endsWith(".entry.js")).map((file) => fs.rm(path.join(outputDir, file), { force: true })));
1360
1384
  }
1361
1385
 
1386
+ //#endregion
1387
+ //#region src/cli/shared/bundle-log-level.ts
1388
+ const INFO_LEVEL_CONSOLE_METHODS = [
1389
+ "console.log",
1390
+ "console.info",
1391
+ "console.table",
1392
+ "console.dir",
1393
+ "console.dirxml",
1394
+ "console.count",
1395
+ "console.countReset",
1396
+ "console.time",
1397
+ "console.timeLog",
1398
+ "console.timeEnd",
1399
+ "console.group",
1400
+ "console.groupCollapsed",
1401
+ "console.groupEnd",
1402
+ "console.clear"
1403
+ ];
1404
+ const DEBUG_LEVEL_CONSOLE_METHODS = ["console.debug", "console.trace"];
1405
+ const WARN_LEVEL_CONSOLE_METHODS = ["console.warn"];
1406
+ const ERROR_LEVEL_CONSOLE_METHODS = ["console.error"];
1407
+ const MANUAL_PURE_FUNCTIONS_BY_LOG_LEVEL = {
1408
+ DEBUG: [],
1409
+ INFO: DEBUG_LEVEL_CONSOLE_METHODS,
1410
+ WARN: [...DEBUG_LEVEL_CONSOLE_METHODS, ...INFO_LEVEL_CONSOLE_METHODS],
1411
+ ERROR: [
1412
+ ...DEBUG_LEVEL_CONSOLE_METHODS,
1413
+ ...INFO_LEVEL_CONSOLE_METHODS,
1414
+ ...WARN_LEVEL_CONSOLE_METHODS
1415
+ ],
1416
+ SILENT: [
1417
+ ...DEBUG_LEVEL_CONSOLE_METHODS,
1418
+ ...INFO_LEVEL_CONSOLE_METHODS,
1419
+ ...WARN_LEVEL_CONSOLE_METHODS,
1420
+ ...ERROR_LEVEL_CONSOLE_METHODS
1421
+ ]
1422
+ };
1423
+ function normalizeBundleLogLevel(value) {
1424
+ const normalized = value.trim().toUpperCase();
1425
+ return isLogLevel(normalized) ? normalized : void 0;
1426
+ }
1427
+ function resolveBundleLogLevel(configValue) {
1428
+ if (configValue === void 0) return "DEBUG";
1429
+ const resolved = normalizeBundleLogLevel(configValue);
1430
+ if (resolved) return resolved;
1431
+ throw new Error(`Invalid logLevel "${configValue}". Expected one of: ${LOG_LEVELS.join(", ")}`);
1432
+ }
1433
+ function manualPureFunctionsForLogLevel(logLevel) {
1434
+ return MANUAL_PURE_FUNCTIONS_BY_LOG_LEVEL[logLevel];
1435
+ }
1436
+ function createLogLevelTreeshakeOptions(logLevel) {
1437
+ const manualPureFunctions = manualPureFunctionsForLogLevel(logLevel);
1438
+ return manualPureFunctions.length > 0 ? { manualPureFunctions } : {};
1439
+ }
1440
+
1441
+ //#endregion
1442
+ //#region src/cli/shared/function-treeshake.ts
1443
+ const BASE_FUNCTION_TREESHAKE_OPTIONS = {
1444
+ moduleSideEffects: false,
1445
+ annotations: true,
1446
+ unknownGlobalSideEffects: false
1447
+ };
1448
+ function mergeFunctionTreeshakeOptions(fragments) {
1449
+ const merged = {};
1450
+ const manualPureFunctions = /* @__PURE__ */ new Set();
1451
+ for (const fragment of fragments) {
1452
+ Object.assign(merged, fragment);
1453
+ for (const name of fragment.manualPureFunctions ?? []) manualPureFunctions.add(name);
1454
+ }
1455
+ if (manualPureFunctions.size > 0) merged.manualPureFunctions = [...manualPureFunctions];
1456
+ else delete merged.manualPureFunctions;
1457
+ return merged;
1458
+ }
1459
+ function composeFunctionTreeshakeOptions(fragments = []) {
1460
+ return mergeFunctionTreeshakeOptions([BASE_FUNCTION_TREESHAKE_OPTIONS, ...fragments]);
1461
+ }
1462
+
1362
1463
  //#endregion
1363
1464
  //#region src/cli/services/file-loader.ts
1364
1465
  const DEFAULT_IGNORE_PATTERNS = ["**/*.test.ts", "**/*.spec.ts"];
@@ -2193,7 +2294,7 @@ function createTriggerTransformPlugin(triggerContext) {
2193
2294
  * @returns Map of function name to bundled code
2194
2295
  */
2195
2296
  async function bundleAuthHooks(options) {
2196
- const { configPath, authName, handlerAccessPath, env = {}, triggerContext, cache, inlineSourcemap } = options;
2297
+ const { configPath, authName, handlerAccessPath, env = {}, triggerContext, cache, inlineSourcemap, bundleLogLevel = "DEBUG" } = options;
2197
2298
  logger.newline();
2198
2299
  logger.log(`Bundling auth hook for ${styles.info(`"${authName}"`)}`);
2199
2300
  const outputDir = path.resolve(getDistDir(), "auth-hooks");
@@ -2219,6 +2320,7 @@ async function bundleAuthHooks(options) {
2219
2320
  serializedTriggerContext,
2220
2321
  tsconfig,
2221
2322
  inlineSourcemap,
2323
+ bundleLogLevel,
2222
2324
  prefix: sortedEnvPrefix
2223
2325
  }),
2224
2326
  async build(cachePlugins) {
@@ -2246,11 +2348,8 @@ async function bundleAuthHooks(options) {
2246
2348
  },
2247
2349
  tsconfig,
2248
2350
  plugins,
2249
- treeshake: {
2250
- moduleSideEffects: false,
2251
- annotations: true,
2252
- unknownGlobalSideEffects: false
2253
- },
2351
+ transform: { define: { "process.env.LOG_LEVEL": JSON.stringify(bundleLogLevel) } },
2352
+ treeshake: composeFunctionTreeshakeOptions([createLogLevelTreeshakeOptions(bundleLogLevel)]),
2254
2353
  logLevel: "silent"
2255
2354
  })).output[0].code;
2256
2355
  }
@@ -3996,7 +4095,7 @@ async function loadExecutor(executorFilePath) {
3996
4095
  */
3997
4096
  async function bundleExecutors(options) {
3998
4097
  const bundledCode = /* @__PURE__ */ new Map();
3999
- const { config, triggerContext, additionalFiles = [], cache, inlineSourcemap } = options;
4098
+ const { config, triggerContext, additionalFiles = [], cache, inlineSourcemap, bundleLogLevel = "DEBUG" } = options;
4000
4099
  const files = [...loadFilesWithIgnores(config), ...additionalFiles];
4001
4100
  if (files.length === 0) {
4002
4101
  logger.warn(`No executor files found for patterns: ${config.files?.join(", ") ?? "(none)"}`);
@@ -4033,18 +4132,19 @@ async function bundleExecutors(options) {
4033
4132
  } catch {
4034
4133
  tsconfig = void 0;
4035
4134
  }
4036
- const results = await withBundleConcurrency(executors, (executor) => bundleSingleExecutor(executor, outputDir, tsconfig, triggerContext, cache, inlineSourcemap));
4135
+ const results = await withBundleConcurrency(executors, (executor) => bundleSingleExecutor(executor, outputDir, tsconfig, triggerContext, cache, inlineSourcemap, bundleLogLevel));
4037
4136
  for (const [name, code] of results) bundledCode.set(name, code);
4038
4137
  logger.log(`${styles.success("Bundled")} ${styles.info("\"executor\"")}`);
4039
4138
  return bundledCode;
4040
4139
  }
4041
- async function bundleSingleExecutor(executor, outputDir, tsconfig, triggerContext, cache, inlineSourcemap) {
4140
+ async function bundleSingleExecutor(executor, outputDir, tsconfig, triggerContext, cache, inlineSourcemap, bundleLogLevel = "DEBUG") {
4042
4141
  const serializedTriggerContext = serializeTriggerContext(triggerContext);
4043
4142
  const contextHash = computeBundlerContextHash({
4044
4143
  sourceFile: executor.sourceFile,
4045
4144
  serializedTriggerContext,
4046
4145
  tsconfig,
4047
- inlineSourcemap
4146
+ inlineSourcemap,
4147
+ bundleLogLevel
4048
4148
  });
4049
4149
  const code = await withCache({
4050
4150
  cache,
@@ -4079,11 +4179,7 @@ async function bundleSingleExecutor(executor, outputDir, tsconfig, triggerContex
4079
4179
  },
4080
4180
  tsconfig,
4081
4181
  plugins,
4082
- treeshake: {
4083
- moduleSideEffects: false,
4084
- annotations: true,
4085
- unknownGlobalSideEffects: false
4086
- },
4182
+ treeshake: composeFunctionTreeshakeOptions([createLogLevelTreeshakeOptions(bundleLogLevel)]),
4087
4183
  logLevel: "silent"
4088
4184
  })).output[0].code;
4089
4185
  }
@@ -4210,9 +4306,10 @@ const ADAPTER_BUNDLE_ERROR_BYTES = 256 * 1024;
4210
4306
  * generated dispatcher that routes by `req.method`; `output` is used as is.
4211
4307
  * @param adapters - Detected adapters to bundle
4212
4308
  * @param cache - Optional bundle cache for skipping unchanged builds
4309
+ * @param bundleLogLevel - Controls which console calls are kept in bundled code
4213
4310
  * @returns Bundled scripts keyed by adapter name
4214
4311
  */
4215
- async function bundleHttpAdapters(adapters, cache) {
4312
+ async function bundleHttpAdapters(adapters, cache, bundleLogLevel = "DEBUG") {
4216
4313
  if (adapters.length === 0) return {
4217
4314
  bundledInputs: /* @__PURE__ */ new Map(),
4218
4315
  bundledOutputs: /* @__PURE__ */ new Map()
@@ -4232,7 +4329,7 @@ async function bundleHttpAdapters(adapters, cache) {
4232
4329
  adapter,
4233
4330
  kind
4234
4331
  }));
4235
- }), ({ adapter, kind }) => bundleAdapterScript(adapter, kind, outputDir, tsconfig, cache));
4332
+ }), ({ adapter, kind }) => bundleAdapterScript(adapter, kind, outputDir, tsconfig, cache, bundleLogLevel));
4236
4333
  const bundledInputs = /* @__PURE__ */ new Map();
4237
4334
  const bundledOutputs = /* @__PURE__ */ new Map();
4238
4335
  for (const [name, kind, code] of results) if (kind === "input") bundledInputs.set(name, code);
@@ -4243,12 +4340,13 @@ async function bundleHttpAdapters(adapters, cache) {
4243
4340
  bundledOutputs
4244
4341
  };
4245
4342
  }
4246
- async function bundleAdapterScript(adapter, kind, outputDir, tsconfig, cache) {
4343
+ async function bundleAdapterScript(adapter, kind, outputDir, tsconfig, cache, bundleLogLevel = "DEBUG") {
4247
4344
  const contextHash = computeBundlerContextHash({
4248
4345
  sourceFile: adapter.sourceFile,
4249
4346
  serializedTriggerContext: kind === "input" ? adapter.methods.join(",") : "",
4250
4347
  tsconfig,
4251
4348
  inlineSourcemap: false,
4349
+ bundleLogLevel,
4252
4350
  prefix: kind
4253
4351
  });
4254
4352
  const code = await withCache({
@@ -4300,11 +4398,7 @@ async function bundleAdapterScript(adapter, kind, outputDir, tsconfig, cache) {
4300
4398
  tsconfig,
4301
4399
  plugins,
4302
4400
  transform: { target: "es2017" },
4303
- treeshake: {
4304
- moduleSideEffects: false,
4305
- annotations: true,
4306
- unknownGlobalSideEffects: false
4307
- },
4401
+ treeshake: composeFunctionTreeshakeOptions([createLogLevelTreeshakeOptions(bundleLogLevel)]),
4308
4402
  logLevel: "silent"
4309
4403
  })).output[0].code;
4310
4404
  } finally {
@@ -4507,9 +4601,10 @@ async function loadResolver(resolverFilePath) {
4507
4601
  * @param triggerContext - Trigger context for workflow/job transformations
4508
4602
  * @param cache - Optional bundle cache for skipping unchanged builds
4509
4603
  * @param inlineSourcemap - Whether to enable inline sourcemaps
4604
+ * @param bundleLogLevel - Controls which console calls are kept in bundled code
4510
4605
  * @returns Map of resolver name to bundled code
4511
4606
  */
4512
- async function bundleResolvers(namespace, config, triggerContext, cache, inlineSourcemap) {
4607
+ async function bundleResolvers(namespace, config, triggerContext, cache, inlineSourcemap, bundleLogLevel = "DEBUG") {
4513
4608
  const bundledCode = /* @__PURE__ */ new Map();
4514
4609
  const files = loadFilesWithIgnores(config);
4515
4610
  if (files.length === 0) {
@@ -4539,18 +4634,19 @@ async function bundleResolvers(namespace, config, triggerContext, cache, inlineS
4539
4634
  } catch {
4540
4635
  tsconfig = void 0;
4541
4636
  }
4542
- const results = await withBundleConcurrency(resolvers, (resolver) => bundleSingleResolver(resolver, outputDir, tsconfig, triggerContext, cache, inlineSourcemap));
4637
+ const results = await withBundleConcurrency(resolvers, (resolver) => bundleSingleResolver(resolver, outputDir, tsconfig, triggerContext, cache, inlineSourcemap, bundleLogLevel));
4543
4638
  for (const [name, code] of results) bundledCode.set(name, code);
4544
4639
  logger.log(`${styles.success("Bundled")} ${styles.info(`"${namespace}"`)}`);
4545
4640
  return bundledCode;
4546
4641
  }
4547
- async function bundleSingleResolver(resolver, outputDir, tsconfig, triggerContext, cache, inlineSourcemap) {
4642
+ async function bundleSingleResolver(resolver, outputDir, tsconfig, triggerContext, cache, inlineSourcemap, bundleLogLevel = "DEBUG") {
4548
4643
  const serializedTriggerContext = serializeTriggerContext(triggerContext);
4549
4644
  const contextHash = computeBundlerContextHash({
4550
4645
  sourceFile: resolver.sourceFile,
4551
4646
  serializedTriggerContext,
4552
4647
  tsconfig,
4553
- inlineSourcemap
4648
+ inlineSourcemap,
4649
+ bundleLogLevel
4554
4650
  });
4555
4651
  const code = await withCache({
4556
4652
  cache,
@@ -4601,11 +4697,7 @@ async function bundleSingleResolver(resolver, outputDir, tsconfig, triggerContex
4601
4697
  },
4602
4698
  tsconfig,
4603
4699
  plugins,
4604
- treeshake: {
4605
- moduleSideEffects: false,
4606
- annotations: true,
4607
- unknownGlobalSideEffects: false
4608
- },
4700
+ treeshake: composeFunctionTreeshakeOptions([createLogLevelTreeshakeOptions(bundleLogLevel)]),
4609
4701
  logLevel: "silent"
4610
4702
  })).output[0].code;
4611
4703
  }
@@ -4836,9 +4928,10 @@ function safeRealpath(p) {
4836
4928
  * @param triggerContext - Trigger context for transformations
4837
4929
  * @param cache - Optional bundle cache for skipping unchanged builds
4838
4930
  * @param inlineSourcemap - Whether to enable inline sourcemaps
4931
+ * @param bundleLogLevel - Controls which console calls are kept in bundled code
4839
4932
  * @returns Workflow job bundling result
4840
4933
  */
4841
- async function bundleWorkflowJobs(allJobs, mainJobNames, env = {}, triggerContext, cache, inlineSourcemap) {
4934
+ async function bundleWorkflowJobs(allJobs, mainJobNames, env = {}, triggerContext, cache, inlineSourcemap, bundleLogLevel = "DEBUG") {
4842
4935
  if (allJobs.length === 0) {
4843
4936
  logger.warn("No workflow jobs to bundle");
4844
4937
  return {
@@ -4862,7 +4955,7 @@ async function bundleWorkflowJobs(allJobs, mainJobNames, env = {}, triggerContex
4862
4955
  } catch {
4863
4956
  tsconfig = void 0;
4864
4957
  }
4865
- const results = await withBundleConcurrency(usedJobs, (job) => bundleSingleJob(job, usedJobs, outputDir, tsconfig, env, triggerContext, cache, inlineSourcemap));
4958
+ const results = await withBundleConcurrency(usedJobs, (job) => bundleSingleJob(job, usedJobs, outputDir, tsconfig, env, triggerContext, cache, inlineSourcemap, bundleLogLevel));
4866
4959
  const bundledCode = /* @__PURE__ */ new Map();
4867
4960
  for (const [name, code] of results) bundledCode.set(name, code);
4868
4961
  logger.log(`${styles.success("Bundled")} ${styles.info("\"workflow-job\"")}`);
@@ -4944,7 +5037,7 @@ async function filterUsedJobs(allJobs, mainJobNames) {
4944
5037
  mainJobDeps
4945
5038
  };
4946
5039
  }
4947
- async function bundleSingleJob(job, allJobs, outputDir, tsconfig, env, triggerContext, cache, inlineSourcemap) {
5040
+ async function bundleSingleJob(job, allJobs, outputDir, tsconfig, env, triggerContext, cache, inlineSourcemap, bundleLogLevel = "DEBUG") {
4948
5041
  const serializedTriggerContext = serializeTriggerContext(triggerContext);
4949
5042
  const sortedEnvPrefix = JSON.stringify(Object.fromEntries(Object.entries(env).sort(([a], [b]) => a.localeCompare(b))));
4950
5043
  const contextHash = computeBundlerContextHash({
@@ -4952,6 +5045,7 @@ async function bundleSingleJob(job, allJobs, outputDir, tsconfig, env, triggerCo
4952
5045
  serializedTriggerContext,
4953
5046
  tsconfig,
4954
5047
  inlineSourcemap,
5048
+ bundleLogLevel,
4955
5049
  prefix: sortedEnvPrefix
4956
5050
  });
4957
5051
  const code = await withCache({
@@ -5002,11 +5096,7 @@ async function bundleSingleJob(job, allJobs, outputDir, tsconfig, env, triggerCo
5002
5096
  },
5003
5097
  tsconfig,
5004
5098
  plugins,
5005
- treeshake: {
5006
- moduleSideEffects: false,
5007
- annotations: true,
5008
- unknownGlobalSideEffects: false
5009
- },
5099
+ treeshake: composeFunctionTreeshakeOptions([createLogLevelTreeshakeOptions(bundleLogLevel)]),
5010
5100
  logLevel: "silent"
5011
5101
  })).output[0].code;
5012
5102
  }
@@ -5640,6 +5730,7 @@ async function loadApplication(params) {
5640
5730
  if (httpAdapterService) await httpAdapterService.loadAdapters();
5641
5731
  const triggerContext = await buildTriggerContext(config.workflow, authResult.authService?.config.name);
5642
5732
  const inlineSourcemap = resolveInlineSourcemap(config.inlineSourcemap);
5733
+ const bundleLogLevel = resolveBundleLogLevel(config.logLevel);
5643
5734
  const bundledScripts = {
5644
5735
  resolvers: /* @__PURE__ */ new Map(),
5645
5736
  executors: /* @__PURE__ */ new Map(),
@@ -5647,7 +5738,7 @@ async function loadApplication(params) {
5647
5738
  authHooks: /* @__PURE__ */ new Map()
5648
5739
  };
5649
5740
  for (const pipeline of resolverResult.resolverServices) {
5650
- const resolverBundles = await bundleResolvers(pipeline.namespace, pipeline.config, triggerContext, bundleCache, inlineSourcemap);
5741
+ const resolverBundles = await bundleResolvers(pipeline.namespace, pipeline.config, triggerContext, bundleCache, inlineSourcemap, bundleLogLevel);
5651
5742
  for (const [name, code] of resolverBundles) bundledScripts.resolvers.set(name, code);
5652
5743
  }
5653
5744
  if (executorService) bundledScripts.executors = await bundleExecutors({
@@ -5655,12 +5746,13 @@ async function loadApplication(params) {
5655
5746
  triggerContext,
5656
5747
  additionalFiles: [...pluginExecutorFiles],
5657
5748
  cache: bundleCache,
5658
- inlineSourcemap
5749
+ inlineSourcemap,
5750
+ bundleLogLevel
5659
5751
  });
5660
5752
  let workflowBuildResult;
5661
5753
  if (workflowService && workflowService.jobs.length > 0) {
5662
5754
  const mainJobNames = workflowService.workflowSources.map((ws) => ws.workflow.mainJob.name);
5663
- workflowBuildResult = await bundleWorkflowJobs(workflowService.jobs, mainJobNames, config.env ?? {}, triggerContext, bundleCache, inlineSourcemap);
5755
+ workflowBuildResult = await bundleWorkflowJobs(workflowService.jobs, mainJobNames, config.env ?? {}, triggerContext, bundleCache, inlineSourcemap, bundleLogLevel);
5664
5756
  bundledScripts.workflowJobs = workflowBuildResult.bundledCode;
5665
5757
  }
5666
5758
  let httpAdapterBuildResult;
@@ -5669,7 +5761,7 @@ async function loadApplication(params) {
5669
5761
  sourceFile: a.sourceFile,
5670
5762
  methods: a.methods,
5671
5763
  hasOutput: a.hasOutput
5672
- })), bundleCache);
5764
+ })), bundleCache, bundleLogLevel);
5673
5765
  if (authResult.authService?.config.hooks?.beforeLogin) {
5674
5766
  const authName = authResult.authService.config.name;
5675
5767
  bundledScripts.authHooks = await bundleAuthHooks({
@@ -5679,7 +5771,8 @@ async function loadApplication(params) {
5679
5771
  env: config.env ?? {},
5680
5772
  triggerContext,
5681
5773
  cache: bundleCache,
5682
- inlineSourcemap
5774
+ inlineSourcemap,
5775
+ bundleLogLevel
5683
5776
  });
5684
5777
  }
5685
5778
  for (const pipeline of resolverResult.resolverServices) await pipeline.loadResolvers();
@@ -5712,5 +5805,5 @@ async function loadApplication(params) {
5712
5805
  }
5713
5806
 
5714
5807
  //#endregion
5715
- export { loadConfigPath as C, saveUserTokens as D, resolveTokens as E, writePlatformConfig as O, loadAccessToken as S, readPlatformConfig as T, getDistDir as _, WorkflowJobSchema as a, deleteUserTokens as b, createExecutorService as c, buildExecutorArgsExpr as d, buildResolverOperationHookExpr as f, createBundleCache as g, loadFilesWithIgnores as h, resolveInlineSourcemap as i, ExecutorSchema as l, stringifyFunction as m, generatePluginFilesIfNeeded as n, ResolverSchema as o, TailorDBTypeSchema as p, loadApplication as r, HTTP_METHODS as s, defineApplication as t, INVOKER_EXPR as u, hashFile as v, loadWorkspaceId as w, fetchLatestToken as x, loadConfig as y };
5716
- //# sourceMappingURL=application-MY7YJJ-C.mjs.map
5808
+ export { saveUserTokens as A, deleteUserTokens as C, loadWorkspaceId as D, loadConfigPath as E, readPlatformConfig as O, loadConfig as S, loadAccessToken as T, createLogLevelTreeshakeOptions as _, WorkflowJobSchema as a, getDistDir as b, createExecutorService as c, buildExecutorArgsExpr as d, buildResolverOperationHookExpr as f, composeFunctionTreeshakeOptions as g, loadFilesWithIgnores as h, resolveInlineSourcemap as i, writePlatformConfig as j, resolveTokens as k, ExecutorSchema as l, stringifyFunction as m, generatePluginFilesIfNeeded as n, ResolverSchema as o, TailorDBTypeSchema as p, loadApplication as r, HTTP_METHODS as s, defineApplication as t, INVOKER_EXPR as u, resolveBundleLogLevel as v, fetchLatestToken as w, hashFile as x, createBundleCache as y };
5809
+ //# sourceMappingURL=application-YHZIkjdy.mjs.map