@tailor-platform/sdk 1.29.0 → 1.30.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.
Files changed (33) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/{application-Clwpv84E.mjs → application-Bf8SUAtR.mjs} +89 -73
  3. package/dist/application-Bf8SUAtR.mjs.map +1 -0
  4. package/dist/{application-Dl1d7w-b.mjs → application-DAQVP9CS.mjs} +1 -1
  5. package/dist/cli/index.mjs +66 -35
  6. package/dist/cli/index.mjs.map +1 -1
  7. package/dist/cli/lib.d.mts +208 -43
  8. package/dist/cli/lib.mjs +23 -25
  9. package/dist/cli/lib.mjs.map +1 -1
  10. package/dist/configure/index.d.mts +4 -4
  11. package/dist/{env-BuMbIknz.d.mts → env-DiWYe80_.d.mts} +2 -2
  12. package/dist/{index-CbnLNm14.d.mts → index-2WQbf_LH.d.mts} +2 -2
  13. package/dist/{index-cD9sQLTh.d.mts → index-BU7Cd5I4.d.mts} +4 -4
  14. package/dist/{index-B0Lrzywd.d.mts → index-DCEMVfJA.d.mts} +2 -2
  15. package/dist/{index-D1AM_02Y.d.mts → index-HvMUWjvV.d.mts} +2 -2
  16. package/dist/{index-CyapgSFI.d.mts → index-rH_De6hM.d.mts} +2 -2
  17. package/dist/plugin/builtin/enum-constants/index.d.mts +1 -1
  18. package/dist/plugin/builtin/file-utils/index.d.mts +1 -1
  19. package/dist/plugin/builtin/kysely-type/index.d.mts +1 -1
  20. package/dist/plugin/builtin/seed/index.d.mts +1 -1
  21. package/dist/plugin/index.d.mts +2 -2
  22. package/dist/{plugin-D3a0-qe0.d.mts → plugin-C-UdAM8C.d.mts} +2 -2
  23. package/dist/{query-B1-hq2Hm.mjs → query-C3oQTLvb.mjs} +604 -108
  24. package/dist/query-C3oQTLvb.mjs.map +1 -0
  25. package/dist/schema-BePzTFBV.mjs.map +1 -1
  26. package/dist/utils/test/index.d.mts +2 -2
  27. package/dist/{workflow.generated-BsgIlrH-.d.mts → workflow.generated-C5wMcCjB.d.mts} +2 -2
  28. package/docs/cli/function.md +1 -1
  29. package/docs/cli/organization.md +426 -0
  30. package/docs/cli-reference.md +20 -2
  31. package/package.json +2 -2
  32. package/dist/application-Clwpv84E.mjs.map +0 -1
  33. package/dist/query-B1-hq2Hm.mjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @tailor-platform/sdk
2
2
 
3
+ ## 1.30.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#765](https://github.com/tailor-platform/sdk/pull/765) [`afe6f6f`](https://github.com/tailor-platform/sdk/commit/afe6f6fb968271d5bb7f2aff7317c089b9f7fd6e) Thanks [@toiroakr](https://github.com/toiroakr)! - Add organization and folder management CLI commands: `organization list/get/update/tree` and `organization folder list/get/create/update/delete` with programmatic API exports
8
+
9
+ ### Patch Changes
10
+
11
+ - [#800](https://github.com/tailor-platform/sdk/pull/800) [`3c60fdf`](https://github.com/tailor-platform/sdk/commit/3c60fdf63212a307be3380b63a9fd29582419919) Thanks [@dqn](https://github.com/dqn)! - Use rolldown `write: false` to keep bundle output in memory, eliminating unnecessary disk I/O in all bundlers
12
+
13
+ - [#804](https://github.com/tailor-platform/sdk/pull/804) [`ee915c1`](https://github.com/tailor-platform/sdk/commit/ee915c121b25b7c14794fccb2fd6de79d0c3f604) Thanks [@toiroakr](https://github.com/toiroakr)! - Allow `as const` readonly arrays to be passed directly to `db.enum()` and `t.enum()` without requiring a spread workaround
14
+
3
15
  ## 1.29.0
4
16
 
5
17
  ### Minor Changes
@@ -324,32 +324,31 @@ function computeBundlerContextHash(params) {
324
324
  * When caching is active, attempts to restore from cache first,
325
325
  * and saves the build result (with collected dependencies) on a cache miss.
326
326
  * @param params - Cache and build parameters
327
+ * @returns The bundled code string
327
328
  */
328
329
  async function withCache(params) {
329
- const { cache, kind, name, sourceFile, outputPath, contextHash, build } = params;
330
- if (!cache) {
331
- await build([]);
332
- return;
333
- }
334
- if (cache.tryRestore({
330
+ const { cache, kind, name, sourceFile, contextHash, build } = params;
331
+ if (!cache) return await build([]);
332
+ const content = cache.tryRestore({
335
333
  kind,
336
334
  name,
337
- outputPath,
338
335
  contextHash
339
- })) {
336
+ });
337
+ if (content !== void 0) {
340
338
  logger.debug(` ${styles.dim("cached")}: ${name}`);
341
- return;
339
+ return content;
342
340
  }
343
341
  const { plugin, getResult } = createDepCollectorPlugin();
344
- await build([plugin]);
342
+ const code = await build([plugin]);
345
343
  cache.save({
346
344
  kind,
347
345
  name,
348
346
  sourceFile,
349
- outputPath,
347
+ content: code,
350
348
  dependencyPaths: getResult(),
351
349
  contextHash
352
350
  });
351
+ return code;
353
352
  }
354
353
  /**
355
354
  * Create a bundle cache backed by the given store.
@@ -360,37 +359,31 @@ function createBundleCache(store) {
360
359
  function tryRestore(params) {
361
360
  const cacheKey = buildCacheKey(params.kind, params.name);
362
361
  const entry = store.getEntry(cacheKey);
363
- if (!entry) return false;
362
+ if (!entry) return;
364
363
  let currentHash;
365
364
  try {
366
365
  currentHash = combineHash(hashFiles(entry.dependencyPaths), params.contextHash);
367
366
  } catch {
368
- return false;
367
+ return;
369
368
  }
370
- if (currentHash !== entry.inputHash) return false;
371
- return store.restoreBundleOutput(cacheKey, params.outputPath);
369
+ if (currentHash !== entry.inputHash) return;
370
+ return store.restoreBundleContent(cacheKey);
372
371
  }
373
372
  function save(params) {
374
- const { kind, name, sourceFile, outputPath, dependencyPaths, contextHash } = params;
373
+ const { kind, name, sourceFile, content, dependencyPaths, contextHash } = params;
375
374
  const cacheKey = buildCacheKey(kind, name);
376
375
  const allDeps = dependencyPaths.includes(sourceFile) ? dependencyPaths : [sourceFile, ...dependencyPaths];
377
376
  const inputHash = combineHash(hashFiles(allDeps), contextHash);
378
- const contentHash = hashFile(outputPath);
379
- store.storeBundleOutput(cacheKey, outputPath);
380
- const outputFiles = [{
381
- outputPath,
382
- contentHash
383
- }];
384
- const mapPath = `${outputPath}.map`;
385
- if (fs$1.existsSync(mapPath)) outputFiles.push({
386
- outputPath: mapPath,
387
- contentHash: hashFile(mapPath)
388
- });
377
+ const contentHash = hashContent(content);
378
+ store.storeBundleContent(cacheKey, content);
389
379
  store.setEntry(cacheKey, {
390
380
  kind: "bundle",
391
381
  inputHash,
392
382
  dependencyPaths: allDeps,
393
- outputFiles,
383
+ outputFiles: [{
384
+ outputPath: cacheKey,
385
+ contentHash
386
+ }],
394
387
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
395
388
  });
396
389
  }
@@ -1622,12 +1615,13 @@ function createTriggerTransformPlugin(triggerContext) {
1622
1615
  //#endregion
1623
1616
  //#region src/cli/services/auth/bundler.ts
1624
1617
  /**
1625
- * Bundle a single auth hook handler into dist/auth-hooks/.
1618
+ * Bundle a single auth hook handler.
1626
1619
  *
1627
1620
  * Follows the same pattern as the executor bundler:
1628
1621
  * 1. Generate an entry file that re-exports the handler as `main`
1629
1622
  * 2. Bundle with rolldown + tree-shaking
1630
1623
  * @param options - Bundle options
1624
+ * @returns Map of function name to bundled code
1631
1625
  */
1632
1626
  async function bundleAuthHooks(options) {
1633
1627
  const { configPath, authName, handlerAccessPath, triggerContext, cache, inlineSourcemap } = options;
@@ -1643,14 +1637,12 @@ async function bundleAuthHooks(options) {
1643
1637
  tsconfig = void 0;
1644
1638
  }
1645
1639
  const functionName = `auth-hook--${authName}--before-login`;
1646
- const outputPath = path.join(outputDir, `${functionName}.js`);
1647
1640
  const absoluteConfigPath = path.resolve(configPath);
1648
- await withCache({
1641
+ const code = await withCache({
1649
1642
  cache,
1650
1643
  kind: "auth-hook",
1651
1644
  name: functionName,
1652
1645
  sourceFile: absoluteConfigPath,
1653
- outputPath,
1654
1646
  contextHash: computeBundlerContextHash({
1655
1647
  sourceFile: absoluteConfigPath,
1656
1648
  serializedTriggerContext: serializeTriggerContext(triggerContext),
@@ -1668,10 +1660,10 @@ async function bundleAuthHooks(options) {
1668
1660
  const triggerPlugin = createTriggerTransformPlugin(triggerContext);
1669
1661
  const plugins = triggerPlugin ? [triggerPlugin] : [];
1670
1662
  plugins.push(...cachePlugins);
1671
- await rolldown.build(rolldown.defineConfig({
1663
+ return (await rolldown.build({
1672
1664
  input: entryPath,
1665
+ write: false,
1673
1666
  output: {
1674
- file: outputPath,
1675
1667
  format: "esm",
1676
1668
  sourcemap: inlineSourcemap ? "inline" : true,
1677
1669
  minify: inlineSourcemap ? { mangle: { keepNames: true } } : true,
@@ -1685,10 +1677,13 @@ async function bundleAuthHooks(options) {
1685
1677
  unknownGlobalSideEffects: false
1686
1678
  },
1687
1679
  logLevel: "silent"
1688
- }));
1680
+ })).output[0].code;
1689
1681
  }
1690
1682
  });
1691
1683
  logger.log(`${styles.success("Bundled")} auth hook for ${styles.info(`"${authName}"`)}`);
1684
+ const bundledCode = /* @__PURE__ */ new Map();
1685
+ bundledCode.set(functionName, code);
1686
+ return bundledCode;
1692
1687
  }
1693
1688
 
1694
1689
  //#endregion
@@ -2692,12 +2687,11 @@ async function bundleScriptTarget(args) {
2692
2687
  ${kind}: ${fnSource}`);
2693
2688
  const entryContent = buildMinimalEntryFromResolved(imports, declarations, fnSource, sourceFilePath);
2694
2689
  const entryPath = join(tempDir, `tailordb-script-${targetIndex}.entry.ts`);
2695
- const outputPath = join(tempDir, `tailordb-script-${targetIndex}.bundle.cjs`);
2696
2690
  writeFileSync(entryPath, entryContent);
2697
- await rolldown.build(rolldown.defineConfig({
2691
+ const bundledCode = (await rolldown.build({
2698
2692
  input: entryPath,
2693
+ write: false,
2699
2694
  output: {
2700
- file: outputPath,
2701
2695
  format: "cjs",
2702
2696
  sourcemap: false,
2703
2697
  minify: true,
@@ -2710,8 +2704,8 @@ async function bundleScriptTarget(args) {
2710
2704
  unknownGlobalSideEffects: false
2711
2705
  },
2712
2706
  logLevel: "silent"
2713
- }));
2714
- return buildPrecompiledExpr(readFileSync(outputPath, "utf-8"));
2707
+ })).output[0].code;
2708
+ return buildPrecompiledExpr(bundledCode);
2715
2709
  }
2716
2710
  /**
2717
2711
  * Precompile TailorDB hooks/validators into self-contained script expressions using rolldown.
@@ -3322,14 +3316,15 @@ async function loadExecutor(executorFilePath) {
3322
3316
  * 1. Creates entry file that extracts operation.body
3323
3317
  * 2. Bundles in a single step with tree-shaking
3324
3318
  * @param options - Bundle executor options
3325
- * @returns Promise that resolves when bundling completes
3319
+ * @returns Map of executor name to bundled code
3326
3320
  */
3327
3321
  async function bundleExecutors(options) {
3322
+ const bundledCode = /* @__PURE__ */ new Map();
3328
3323
  const { config, triggerContext, additionalFiles = [], cache, inlineSourcemap } = options;
3329
3324
  const files = [...loadFilesWithIgnores(config), ...additionalFiles];
3330
3325
  if (files.length === 0) {
3331
3326
  logger.warn(`No executor files found for patterns: ${config.files?.join(", ") ?? "(none)"}`);
3332
- return;
3327
+ return bundledCode;
3333
3328
  }
3334
3329
  logger.newline();
3335
3330
  logger.log(`Bundling ${styles.highlight(files.length.toString())} files for ${styles.info("\"executor\"")}`);
@@ -3351,7 +3346,7 @@ async function bundleExecutors(options) {
3351
3346
  }
3352
3347
  if (executors.length === 0) {
3353
3348
  logger.debug(" No function executors to bundle");
3354
- return;
3349
+ return bundledCode;
3355
3350
  }
3356
3351
  const outputDir = path.resolve(getDistDir(), "executors");
3357
3352
  fs$1.mkdirSync(outputDir, { recursive: true });
@@ -3362,11 +3357,12 @@ async function bundleExecutors(options) {
3362
3357
  } catch {
3363
3358
  tsconfig = void 0;
3364
3359
  }
3365
- await Promise.all(executors.map((executor) => bundleSingleExecutor(executor, outputDir, tsconfig, triggerContext, cache, inlineSourcemap)));
3360
+ const results = await Promise.all(executors.map((executor) => bundleSingleExecutor(executor, outputDir, tsconfig, triggerContext, cache, inlineSourcemap)));
3361
+ for (const [name, code] of results) bundledCode.set(name, code);
3366
3362
  logger.log(`${styles.success("Bundled")} ${styles.info("\"executor\"")}`);
3363
+ return bundledCode;
3367
3364
  }
3368
3365
  async function bundleSingleExecutor(executor, outputDir, tsconfig, triggerContext, cache, inlineSourcemap) {
3369
- const outputPath = path.join(outputDir, `${executor.name}.js`);
3370
3366
  const serializedTriggerContext = serializeTriggerContext(triggerContext);
3371
3367
  const contextHash = computeBundlerContextHash({
3372
3368
  sourceFile: executor.sourceFile,
@@ -3374,12 +3370,11 @@ async function bundleSingleExecutor(executor, outputDir, tsconfig, triggerContex
3374
3370
  tsconfig,
3375
3371
  inlineSourcemap
3376
3372
  });
3377
- await withCache({
3373
+ const code = await withCache({
3378
3374
  cache,
3379
3375
  kind: "executor",
3380
3376
  name: executor.name,
3381
3377
  sourceFile: executor.sourceFile,
3382
- outputPath,
3383
3378
  contextHash,
3384
3379
  async build(cachePlugins) {
3385
3380
  const entryPath = path.join(outputDir, `${executor.name}.entry.js`);
@@ -3394,10 +3389,10 @@ async function bundleSingleExecutor(executor, outputDir, tsconfig, triggerContex
3394
3389
  const triggerPlugin = createTriggerTransformPlugin(triggerContext);
3395
3390
  const plugins = triggerPlugin ? [triggerPlugin] : [];
3396
3391
  plugins.push(...cachePlugins);
3397
- await rolldown.build(rolldown.defineConfig({
3392
+ return (await rolldown.build({
3398
3393
  input: entryPath,
3394
+ write: false,
3399
3395
  output: {
3400
- file: outputPath,
3401
3396
  format: "esm",
3402
3397
  sourcemap: inlineSourcemap ? "inline" : true,
3403
3398
  minify: inlineSourcemap ? { mangle: { keepNames: true } } : true,
@@ -3411,9 +3406,10 @@ async function bundleSingleExecutor(executor, outputDir, tsconfig, triggerContex
3411
3406
  unknownGlobalSideEffects: false
3412
3407
  },
3413
3408
  logLevel: "silent"
3414
- }));
3409
+ })).output[0].code;
3415
3410
  }
3416
3411
  });
3412
+ return [executor.name, code];
3417
3413
  }
3418
3414
 
3419
3415
  //#endregion
@@ -3509,13 +3505,14 @@ async function loadResolver(resolverFilePath) {
3509
3505
  * @param triggerContext - Trigger context for workflow/job transformations
3510
3506
  * @param cache - Optional bundle cache for skipping unchanged builds
3511
3507
  * @param inlineSourcemap - Whether to enable inline sourcemaps
3512
- * @returns Promise that resolves when bundling completes
3508
+ * @returns Map of resolver name to bundled code
3513
3509
  */
3514
3510
  async function bundleResolvers(namespace, config, triggerContext, cache, inlineSourcemap) {
3511
+ const bundledCode = /* @__PURE__ */ new Map();
3515
3512
  const files = loadFilesWithIgnores(config);
3516
3513
  if (files.length === 0) {
3517
3514
  logger.warn(`No resolver files found for patterns: ${config.files?.join(", ") ?? "(none)"}`);
3518
- return;
3515
+ return bundledCode;
3519
3516
  }
3520
3517
  logger.newline();
3521
3518
  logger.log(`Bundling ${styles.highlight(files.length.toString())} files for ${styles.info(`"${namespace}"`)}`);
@@ -3540,11 +3537,12 @@ async function bundleResolvers(namespace, config, triggerContext, cache, inlineS
3540
3537
  } catch {
3541
3538
  tsconfig = void 0;
3542
3539
  }
3543
- await Promise.all(resolvers.map((resolver) => bundleSingleResolver(resolver, outputDir, tsconfig, triggerContext, cache, inlineSourcemap)));
3540
+ const results = await Promise.all(resolvers.map((resolver) => bundleSingleResolver(resolver, outputDir, tsconfig, triggerContext, cache, inlineSourcemap)));
3541
+ for (const [name, code] of results) bundledCode.set(name, code);
3544
3542
  logger.log(`${styles.success("Bundled")} ${styles.info(`"${namespace}"`)}`);
3543
+ return bundledCode;
3545
3544
  }
3546
3545
  async function bundleSingleResolver(resolver, outputDir, tsconfig, triggerContext, cache, inlineSourcemap) {
3547
- const outputPath = path.join(outputDir, `${resolver.name}.js`);
3548
3546
  const serializedTriggerContext = serializeTriggerContext(triggerContext);
3549
3547
  const contextHash = computeBundlerContextHash({
3550
3548
  sourceFile: resolver.sourceFile,
@@ -3552,12 +3550,11 @@ async function bundleSingleResolver(resolver, outputDir, tsconfig, triggerContex
3552
3550
  tsconfig,
3553
3551
  inlineSourcemap
3554
3552
  });
3555
- await withCache({
3553
+ const code = await withCache({
3556
3554
  cache,
3557
3555
  kind: "resolver",
3558
3556
  name: resolver.name,
3559
3557
  sourceFile: resolver.sourceFile,
3560
- outputPath,
3561
3558
  contextHash,
3562
3559
  async build(cachePlugins) {
3563
3560
  const entryPath = path.join(outputDir, `${resolver.name}.entry.js`);
@@ -3593,10 +3590,10 @@ async function bundleSingleResolver(resolver, outputDir, tsconfig, triggerContex
3593
3590
  const triggerPlugin = createTriggerTransformPlugin(triggerContext);
3594
3591
  const plugins = triggerPlugin ? [triggerPlugin] : [];
3595
3592
  plugins.push(...cachePlugins);
3596
- await rolldown.build(rolldown.defineConfig({
3593
+ return (await rolldown.build({
3597
3594
  input: entryPath,
3595
+ write: false,
3598
3596
  output: {
3599
- file: outputPath,
3600
3597
  format: "esm",
3601
3598
  sourcemap: inlineSourcemap ? "inline" : true,
3602
3599
  minify: inlineSourcemap ? { mangle: { keepNames: true } } : true,
@@ -3610,9 +3607,10 @@ async function bundleSingleResolver(resolver, outputDir, tsconfig, triggerContex
3610
3607
  unknownGlobalSideEffects: false
3611
3608
  },
3612
3609
  logLevel: "silent"
3613
- }));
3610
+ })).output[0].code;
3614
3611
  }
3615
3612
  });
3613
+ return [resolver.name, code];
3616
3614
  }
3617
3615
 
3618
3616
  //#endregion
@@ -3833,7 +3831,10 @@ function transformWorkflowSource(source, targetJobName, targetJobExportName, oth
3833
3831
  async function bundleWorkflowJobs(allJobs, mainJobNames, env = {}, triggerContext, cache, inlineSourcemap) {
3834
3832
  if (allJobs.length === 0) {
3835
3833
  logger.warn("No workflow jobs to bundle");
3836
- return { mainJobDeps: {} };
3834
+ return {
3835
+ mainJobDeps: {},
3836
+ bundledCode: /* @__PURE__ */ new Map()
3837
+ };
3837
3838
  }
3838
3839
  const { usedJobs, mainJobDeps } = await filterUsedJobs(allJobs, mainJobNames);
3839
3840
  logger.newline();
@@ -3850,9 +3851,14 @@ async function bundleWorkflowJobs(allJobs, mainJobNames, env = {}, triggerContex
3850
3851
  } catch {
3851
3852
  tsconfig = void 0;
3852
3853
  }
3853
- await Promise.all(usedJobs.map((job) => bundleSingleJob(job, usedJobs, outputDir, tsconfig, env, triggerContext, cache, inlineSourcemap)));
3854
+ const results = await Promise.all(usedJobs.map((job) => bundleSingleJob(job, usedJobs, outputDir, tsconfig, env, triggerContext, cache, inlineSourcemap)));
3855
+ const bundledCode = /* @__PURE__ */ new Map();
3856
+ for (const [name, code] of results) bundledCode.set(name, code);
3854
3857
  logger.log(`${styles.success("Bundled")} ${styles.info("\"workflow-job\"")}`);
3855
- return { mainJobDeps };
3858
+ return {
3859
+ mainJobDeps,
3860
+ bundledCode
3861
+ };
3856
3862
  }
3857
3863
  /**
3858
3864
  * Filter jobs to only include those that are actually used.
@@ -3927,7 +3933,6 @@ async function filterUsedJobs(allJobs, mainJobNames) {
3927
3933
  };
3928
3934
  }
3929
3935
  async function bundleSingleJob(job, allJobs, outputDir, tsconfig, env, triggerContext, cache, inlineSourcemap) {
3930
- const outputPath = path.join(outputDir, `${job.name}.js`);
3931
3936
  const serializedTriggerContext = serializeTriggerContext(triggerContext);
3932
3937
  const sortedEnvPrefix = JSON.stringify(Object.fromEntries(Object.entries(env).sort(([a], [b]) => a.localeCompare(b))));
3933
3938
  const contextHash = computeBundlerContextHash({
@@ -3937,12 +3942,11 @@ async function bundleSingleJob(job, allJobs, outputDir, tsconfig, env, triggerCo
3937
3942
  inlineSourcemap,
3938
3943
  prefix: sortedEnvPrefix
3939
3944
  });
3940
- await withCache({
3945
+ const code = await withCache({
3941
3946
  cache,
3942
3947
  kind: "workflow-job",
3943
3948
  name: job.name,
3944
3949
  sourceFile: job.sourceFile,
3945
- outputPath,
3946
3950
  contextHash,
3947
3951
  async build(cachePlugins) {
3948
3952
  const entryPath = path.join(outputDir, `${job.name}.entry.js`);
@@ -3971,10 +3975,10 @@ async function bundleSingleJob(job, allJobs, outputDir, tsconfig, env, triggerCo
3971
3975
  }
3972
3976
  }
3973
3977
  }, ...cachePlugins];
3974
- await rolldown.build(rolldown.defineConfig({
3978
+ return (await rolldown.build({
3975
3979
  input: entryPath,
3980
+ write: false,
3976
3981
  output: {
3977
- file: outputPath,
3978
3982
  format: "esm",
3979
3983
  sourcemap: inlineSourcemap ? "inline" : true,
3980
3984
  minify: inlineSourcemap ? { mangle: { keepNames: true } } : true,
@@ -3988,9 +3992,10 @@ async function bundleSingleJob(job, allJobs, outputDir, tsconfig, env, triggerCo
3988
3992
  unknownGlobalSideEffects: false
3989
3993
  },
3990
3994
  logLevel: "silent"
3991
- }));
3995
+ })).output[0].code;
3992
3996
  }
3993
3997
  });
3998
+ return [job.name, code];
3994
3999
  }
3995
4000
 
3996
4001
  //#endregion
@@ -4652,8 +4657,17 @@ async function loadApplication(params) {
4652
4657
  if (workflowService) await workflowService.loadWorkflows();
4653
4658
  const triggerContext = await buildTriggerContext(config.workflow);
4654
4659
  const inlineSourcemap = resolveInlineSourcemap(config.inlineSourcemap);
4655
- for (const pipeline of resolverResult.resolverServices) await bundleResolvers(pipeline.namespace, pipeline.config, triggerContext, bundleCache, inlineSourcemap);
4656
- if (executorService) await bundleExecutors({
4660
+ const bundledScripts = {
4661
+ resolvers: /* @__PURE__ */ new Map(),
4662
+ executors: /* @__PURE__ */ new Map(),
4663
+ workflowJobs: /* @__PURE__ */ new Map(),
4664
+ authHooks: /* @__PURE__ */ new Map()
4665
+ };
4666
+ for (const pipeline of resolverResult.resolverServices) {
4667
+ const resolverBundles = await bundleResolvers(pipeline.namespace, pipeline.config, triggerContext, bundleCache, inlineSourcemap);
4668
+ for (const [name, code] of resolverBundles) bundledScripts.resolvers.set(name, code);
4669
+ }
4670
+ if (executorService) bundledScripts.executors = await bundleExecutors({
4657
4671
  config: executorService.config,
4658
4672
  triggerContext,
4659
4673
  additionalFiles: [...pluginExecutorFiles],
@@ -4664,10 +4678,11 @@ async function loadApplication(params) {
4664
4678
  if (workflowService && workflowService.jobs.length > 0) {
4665
4679
  const mainJobNames = workflowService.workflowSources.map((ws) => ws.workflow.mainJob.name);
4666
4680
  workflowBuildResult = await bundleWorkflowJobs(workflowService.jobs, mainJobNames, config.env ?? {}, triggerContext, bundleCache, inlineSourcemap);
4681
+ bundledScripts.workflowJobs = workflowBuildResult.bundledCode;
4667
4682
  }
4668
4683
  if (authResult.authService?.config.hooks?.beforeLogin) {
4669
4684
  const authName = authResult.authService.config.name;
4670
- await bundleAuthHooks({
4685
+ bundledScripts.authHooks = await bundleAuthHooks({
4671
4686
  configPath: config.path,
4672
4687
  authName,
4673
4688
  handlerAccessPath: `auth.hooks.beforeLogin.handler`,
@@ -4696,10 +4711,11 @@ async function loadApplication(params) {
4696
4711
  secrets,
4697
4712
  env: config.env ?? {}
4698
4713
  }),
4699
- workflowBuildResult
4714
+ workflowBuildResult,
4715
+ bundledScripts
4700
4716
  };
4701
4717
  }
4702
4718
 
4703
4719
  //#endregion
4704
4720
  export { writePlatformConfig as S, hashFile as _, loadConfig as a, loadWorkspaceId as b, ExecutorSchema as c, TailorDBTypeSchema as d, stringifyFunction as f, getDistDir as g, createBundleCache as h, resolveInlineSourcemap as i, OAuth2ClientSchema as l, loadFilesWithIgnores as m, generatePluginFilesIfNeeded as n, WorkflowJobSchema as o, tailorUserMap as p, loadApplication as r, createExecutorService as s, defineApplication as t, ResolverSchema as u, fetchLatestToken as v, readPlatformConfig as x, loadAccessToken as y };
4705
- //# sourceMappingURL=application-Clwpv84E.mjs.map
4721
+ //# sourceMappingURL=application-Bf8SUAtR.mjs.map