@tailor-platform/sdk 1.44.1 → 1.44.2

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,11 @@
1
1
  # @tailor-platform/sdk
2
2
 
3
+ ## 1.44.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1096](https://github.com/tailor-platform/sdk/pull/1096) [`53dbbaf`](https://github.com/tailor-platform/sdk/commit/53dbbaf4a6de353f227c3ef57f39580b7e1d9379) Thanks [@k1LoW](https://github.com/k1LoW)! - Fix workflow bundle build failure caused by removing default exports from dependency files during cross-file workflow imports
8
+
3
9
  ## 1.44.1
4
10
 
5
11
  ### Patch Changes
@@ -4360,6 +4360,7 @@ function findWorkflowDefaultExport(program) {
4360
4360
  function transformWorkflowSource(source, targetJobName, targetJobExportName, otherJobExportNames, allJobsMap) {
4361
4361
  const { program } = parseSync("input.ts", source);
4362
4362
  const detectedJobs = findAllJobs(program, source);
4363
+ if (!detectedJobs.some((j) => j.name === targetJobName)) return source;
4363
4364
  const jobNameMap = allJobsMap ?? buildJobNameMap(detectedJobs);
4364
4365
  const allDeclarations = findVariableDeclarationsByName(program);
4365
4366
  const triggerCalls = detectTriggerCalls(program, source);
@@ -4436,6 +4437,15 @@ function transformWorkflowSource(source, targetJobName, targetJobExportName, oth
4436
4437
 
4437
4438
  //#endregion
4438
4439
  //#region src/cli/services/workflow/bundler.ts
4440
+ function safeRealpath(p) {
4441
+ const resolved = path.resolve(p);
4442
+ try {
4443
+ return fs$1.realpathSync(resolved);
4444
+ } catch (e) {
4445
+ logger.debug(`realpathSync failed for ${resolved}: ${e instanceof Error ? e.message : e}`);
4446
+ return resolved;
4447
+ }
4448
+ }
4439
4449
  /**
4440
4450
  * Bundle workflow jobs
4441
4451
  *
@@ -4591,14 +4601,17 @@ async function bundleSingleJob(job, allJobs, outputDir, tsconfig, env, triggerCo
4591
4601
  const otherJobExportNames = allJobs.filter((j) => j.name !== job.name).map((j) => j.exportName);
4592
4602
  const allJobsMap = /* @__PURE__ */ new Map();
4593
4603
  for (const j of allJobs) allJobsMap.set(j.exportName, j.name);
4604
+ const resolvedSourceFile = safeRealpath(job.sourceFile);
4594
4605
  const plugins = [{
4595
4606
  name: "workflow-transform",
4596
4607
  transform: {
4597
4608
  filter: { id: { include: [/\.ts$/, /\.js$/] } },
4598
4609
  handler(code, id) {
4599
4610
  if (!code.includes("createWorkflowJob") && !code.includes("createWorkflow") && !code.includes(".trigger(")) return null;
4600
- let transformed = transformWorkflowSource(code, job.name, job.exportName, otherJobExportNames, allJobsMap);
4611
+ let transformed = code;
4612
+ if (safeRealpath(id) === resolvedSourceFile) transformed = transformWorkflowSource(code, job.name, job.exportName, otherJobExportNames, allJobsMap);
4601
4613
  if (triggerContext && transformed.includes(".trigger(")) transformed = transformFunctionTriggers(transformed, triggerContext.workflowNameMap, triggerContext.jobNameMap, triggerContext.workflowFileMap, id, triggerContext.authNamespace);
4614
+ if (transformed === code) return null;
4602
4615
  return { code: transformed };
4603
4616
  }
4604
4617
  }
@@ -5304,4 +5317,4 @@ async function loadApplication(params) {
5304
5317
 
5305
5318
  //#endregion
5306
5319
  export { loadWorkspaceId as C, writePlatformConfig as D, saveUserTokens as E, loadAccessToken as S, resolveTokens as T, getDistDir as _, WorkflowJobSchema as a, deleteUserTokens as b, ExecutorSchema as c, buildResolverOperationHookExpr as d, OAuth2ClientSchema as f, createBundleCache as g, loadFilesWithIgnores as h, resolveInlineSourcemap as i, INVOKER_EXPR as l, stringifyFunction as m, generatePluginFilesIfNeeded as n, ResolverSchema as o, TailorDBTypeSchema as p, loadApplication as r, createExecutorService as s, defineApplication as t, buildExecutorArgsExpr as u, hashFile as v, readPlatformConfig as w, fetchLatestToken as x, loadConfig as y };
5307
- //# sourceMappingURL=application-vJxYH5LE.mjs.map
5320
+ //# sourceMappingURL=application-7wtQzifE.mjs.map