@tailor-platform/sdk 1.44.1 → 1.45.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 (35) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/{actor-DzCuoMlP.d.mts → actor-CzX_hVOP.d.mts} +2 -2
  3. package/dist/{application-vJxYH5LE.mjs → application-BsSJZRCq.mjs} +17 -3
  4. package/dist/application-BsSJZRCq.mjs.map +1 -0
  5. package/dist/application-C0O80PUX.mjs +4 -0
  6. package/dist/cli/index.mjs +2 -2
  7. package/dist/cli/lib.d.mts +6 -6
  8. package/dist/cli/lib.mjs +2 -2
  9. package/dist/configure/index.d.mts +5 -5
  10. package/dist/configure/index.mjs +16 -4
  11. package/dist/configure/index.mjs.map +1 -1
  12. package/dist/{index-DdsUV-aA.d.mts → index-Bd-0JRjy.d.mts} +2 -2
  13. package/dist/{index-ZZYEd_0R.d.mts → index-C_f357K2.d.mts} +2 -2
  14. package/dist/{index-BOfTiouP.d.mts → index-CemBzf4z.d.mts} +41 -8
  15. package/dist/{index-BEEL1-6Z.d.mts → index-DIz-15Cx.d.mts} +2 -2
  16. package/dist/{index-0Dk-fDWi.d.mts → index-SnYVi8ww.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/{runtime-DQqulWPm.mjs → runtime-Bmq4L9pj.mjs} +71 -25
  23. package/dist/runtime-Bmq4L9pj.mjs.map +1 -0
  24. package/dist/{tailor-db-field-D_z185oq.d.mts → tailor-db-field-CY1D1PtT.d.mts} +5 -2
  25. package/dist/utils/test/index.d.mts +3 -3
  26. package/dist/{workflow.generated-B7Mupf5V.d.mts → workflow.generated--YammZcl.d.mts} +2 -2
  27. package/docs/cli/tailordb.md +35 -415
  28. package/docs/services/executor.md +15 -1
  29. package/docs/services/idp.md +2 -2
  30. package/docs/services/tailordb-migration.md +418 -0
  31. package/docs/services/tailordb.md +6 -0
  32. package/package.json +3 -3
  33. package/dist/application-Cot5-3g3.mjs +0 -4
  34. package/dist/application-vJxYH5LE.mjs.map +0 -1
  35. package/dist/runtime-DQqulWPm.mjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @tailor-platform/sdk
2
2
 
3
+ ## 1.45.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#1080](https://github.com/tailor-platform/sdk/pull/1080) [`52823be`](https://github.com/tailor-platform/sdk/commit/52823be3ab8ac4efd3b9621db60d3a6fb9033d12) Thanks [@toiroakr](https://github.com/toiroakr)! - Add an `idp` option to IdP user triggers (`idpUserCreatedTrigger`, `idpUserUpdatedTrigger`, `idpUserDeletedTrigger`, `idpUserTrigger`) so executors can subscribe to a specific IdP namespace. Previously, projects with multiple IdPs failed `apply` because the SDK could not decide which IdP an executor targeted; specify `idp: "my-idp"` to disambiguate, or omit it when the project defines a single IdP. The auto-configuration of `publishUserEvents` now applies only to IdPs that are actually targeted, and `publishUserEvents: false` on a targeted IdP is rejected with a clear error instead of a warning. The new `IdpName` type is narrowed to defined IdP names via the generated `tailor.d.ts` for compile-time validation.
8
+
9
+ ### Patch Changes
10
+
11
+ - [#1094](https://github.com/tailor-platform/sdk/pull/1094) [`a872d26`](https://github.com/tailor-platform/sdk/commit/a872d26feb81266b27d0415d36b412f12e81fb42) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency ora to v9.4.0
12
+
13
+ - [#1092](https://github.com/tailor-platform/sdk/pull/1092) [`0687372`](https://github.com/tailor-platform/sdk/commit/0687372075bb8694505b2f0d0199e732606fd758) Thanks [@toiroakr](https://github.com/toiroakr)! - Restructure TailorDB migration documentation. The migration concepts, configuration, supported schema changes, automatic execution flow, and troubleshooting have moved from the CLI reference (`docs/cli/tailordb.md`) into a dedicated guide (`docs/services/tailordb-migration.md`). The CLI reference now keeps only the command tables and links to the guide. The guide also adds previously missing operational guidance: exact `migration set` semantics (label-only, not a DB rollback), team workflow and CI/CD coordination, failure recovery, machine user permissions, multi-namespace ordering, performance for large tables, local testing, rollback strategy, observability, and a beta notice. Minor wording corrections for the pre-migration phase and foreign key change classification.
14
+
15
+ ## 1.44.2
16
+
17
+ ### Patch Changes
18
+
19
+ - [#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
20
+
3
21
  ## 1.44.1
4
22
 
5
23
  ### Patch Changes
@@ -1,5 +1,5 @@
1
1
  /// <reference types="@tailor-platform/function-types" />
2
- import { Bt as InferredAttributeMap, zt as InferredAttributeList } from "./tailor-db-field-D_z185oq.mjs";
2
+ import { Bt as InferredAttributeMap, zt as InferredAttributeList } from "./tailor-db-field-CY1D1PtT.mjs";
3
3
 
4
4
  //#region src/types/env.d.ts
5
5
  interface Env {}
@@ -27,4 +27,4 @@ type TailorActor = {
27
27
  };
28
28
  //#endregion
29
29
  export { Env as n, TailorEnv as r, TailorActor as t };
30
- //# sourceMappingURL=actor-DzCuoMlP.d.mts.map
30
+ //# sourceMappingURL=actor-CzX_hVOP.d.mts.map
@@ -3837,7 +3837,8 @@ const IdpUserTriggerSchema = z.object({
3837
3837
  "idp.user.created",
3838
3838
  "idp.user.updated",
3839
3839
  "idp.user.deleted"
3840
- ])).min(1).transform((arr) => [...new Set(arr)]).describe("IdP user event types to trigger on")
3840
+ ])).min(1).transform((arr) => [...new Set(arr)]).describe("IdP user event types to trigger on"),
3841
+ idp: z.string().optional().describe("IdP namespace name to subscribe to. If omitted, the project's only IdP is used; throws when multiple IdPs exist.")
3841
3842
  });
3842
3843
  const AuthAccessTokenTriggerSchema = z.object({
3843
3844
  kind: z.literal("authAccessToken").describe("Auth access token event trigger"),
@@ -4360,6 +4361,7 @@ function findWorkflowDefaultExport(program) {
4360
4361
  function transformWorkflowSource(source, targetJobName, targetJobExportName, otherJobExportNames, allJobsMap) {
4361
4362
  const { program } = parseSync("input.ts", source);
4362
4363
  const detectedJobs = findAllJobs(program, source);
4364
+ if (!detectedJobs.some((j) => j.name === targetJobName)) return source;
4363
4365
  const jobNameMap = allJobsMap ?? buildJobNameMap(detectedJobs);
4364
4366
  const allDeclarations = findVariableDeclarationsByName(program);
4365
4367
  const triggerCalls = detectTriggerCalls(program, source);
@@ -4436,6 +4438,15 @@ function transformWorkflowSource(source, targetJobName, targetJobExportName, oth
4436
4438
 
4437
4439
  //#endregion
4438
4440
  //#region src/cli/services/workflow/bundler.ts
4441
+ function safeRealpath(p) {
4442
+ const resolved = path.resolve(p);
4443
+ try {
4444
+ return fs$1.realpathSync(resolved);
4445
+ } catch (e) {
4446
+ logger.debug(`realpathSync failed for ${resolved}: ${e instanceof Error ? e.message : e}`);
4447
+ return resolved;
4448
+ }
4449
+ }
4439
4450
  /**
4440
4451
  * Bundle workflow jobs
4441
4452
  *
@@ -4591,14 +4602,17 @@ async function bundleSingleJob(job, allJobs, outputDir, tsconfig, env, triggerCo
4591
4602
  const otherJobExportNames = allJobs.filter((j) => j.name !== job.name).map((j) => j.exportName);
4592
4603
  const allJobsMap = /* @__PURE__ */ new Map();
4593
4604
  for (const j of allJobs) allJobsMap.set(j.exportName, j.name);
4605
+ const resolvedSourceFile = safeRealpath(job.sourceFile);
4594
4606
  const plugins = [{
4595
4607
  name: "workflow-transform",
4596
4608
  transform: {
4597
4609
  filter: { id: { include: [/\.ts$/, /\.js$/] } },
4598
4610
  handler(code, id) {
4599
4611
  if (!code.includes("createWorkflowJob") && !code.includes("createWorkflow") && !code.includes(".trigger(")) return null;
4600
- let transformed = transformWorkflowSource(code, job.name, job.exportName, otherJobExportNames, allJobsMap);
4612
+ let transformed = code;
4613
+ if (safeRealpath(id) === resolvedSourceFile) transformed = transformWorkflowSource(code, job.name, job.exportName, otherJobExportNames, allJobsMap);
4601
4614
  if (triggerContext && transformed.includes(".trigger(")) transformed = transformFunctionTriggers(transformed, triggerContext.workflowNameMap, triggerContext.jobNameMap, triggerContext.workflowFileMap, id, triggerContext.authNamespace);
4615
+ if (transformed === code) return null;
4602
4616
  return { code: transformed };
4603
4617
  }
4604
4618
  }
@@ -5304,4 +5318,4 @@ async function loadApplication(params) {
5304
5318
 
5305
5319
  //#endregion
5306
5320
  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
5321
+ //# sourceMappingURL=application-BsSJZRCq.mjs.map