@tailor-platform/sdk 2.0.0-next.6 → 2.0.0-next.8

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 (62) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/dist/{application-BJXRpQj5.mjs → application-GzW98_Xr.mjs} +199 -172
  3. package/dist/application-GzW98_Xr.mjs.map +1 -0
  4. package/dist/application-OM0taSPn.mjs +3 -0
  5. package/dist/cli/index.mjs +12 -9
  6. package/dist/cli/index.mjs.map +1 -1
  7. package/dist/cli/lib.mjs +2 -2
  8. package/dist/completion/zsh-worker.zsh +1 -1
  9. package/dist/configure/config/types.d.mts +5 -1
  10. package/dist/configure/index.mjs +16 -16
  11. package/dist/configure/index.mjs.map +1 -1
  12. package/dist/configure/services/auth/types.d.mts +18 -23
  13. package/dist/configure/services/executor/operation.d.mts +1 -1
  14. package/dist/configure/services/idp/permission.d.mts +4 -4
  15. package/dist/configure/services/tailordb/permission.d.mts +4 -4
  16. package/dist/configure/services/workflow/job.d.mts +10 -10
  17. package/dist/configure/services/workflow/workflow.d.mts +6 -4
  18. package/dist/{globals-D-YbJKW-.mjs → globals-CBZ0egXT.mjs} +3 -6
  19. package/dist/globals-CBZ0egXT.mjs.map +1 -0
  20. package/dist/{register-ts-hook-DL31O2W9.mjs → register-ts-hook-DvEs6YsL.mjs} +35 -78
  21. package/dist/register-ts-hook-DvEs6YsL.mjs.map +1 -0
  22. package/dist/{registry-CC3CbQiF.mjs → registry-i7EdJ-D5.mjs} +10 -10
  23. package/dist/registry-i7EdJ-D5.mjs.map +1 -0
  24. package/dist/runtime/globals.d.mts +1 -4
  25. package/dist/runtime/index.mjs +1 -1
  26. package/dist/runtime/workflow.d.mts +1 -76
  27. package/dist/runtime/workflow.mjs +1 -1
  28. package/dist/service-BJAQ70e5.mjs +3 -0
  29. package/dist/{service-CnHz9rwz.mjs → service-Dmxa2I4i.mjs} +31 -17
  30. package/dist/service-Dmxa2I4i.mjs.map +1 -0
  31. package/dist/utils/test/index.mjs +11 -11
  32. package/dist/utils/test/index.mjs.map +1 -1
  33. package/dist/utils/test/mock.d.mts +6 -6
  34. package/dist/vitest/environment.mjs +1 -1
  35. package/dist/vitest/index.mjs +67 -99
  36. package/dist/vitest/index.mjs.map +1 -1
  37. package/dist/vitest/mocks/workflow.d.mts +21 -41
  38. package/dist/vitest/setup.mjs +1 -1
  39. package/dist/vitest/workflow-local.d.mts +2 -2
  40. package/dist/workflow-CsBvRE3g.mjs +34 -0
  41. package/dist/workflow-CsBvRE3g.mjs.map +1 -0
  42. package/docs/cli/application.md +2 -0
  43. package/docs/cli/function.md +2 -2
  44. package/docs/cli/tailordb.md +2 -2
  45. package/docs/cli-reference.md +1 -1
  46. package/docs/configuration.md +2 -0
  47. package/docs/github-actions.md +2 -2
  48. package/docs/migration/v2.md +128 -11
  49. package/docs/runtime.md +1 -1
  50. package/docs/services/auth.md +7 -7
  51. package/docs/services/workflow.md +43 -43
  52. package/docs/testing.md +9 -9
  53. package/package.json +2 -2
  54. package/dist/application-BJXRpQj5.mjs.map +0 -1
  55. package/dist/application-BV-AXawv.mjs +0 -3
  56. package/dist/globals-D-YbJKW-.mjs.map +0 -1
  57. package/dist/register-ts-hook-DL31O2W9.mjs.map +0 -1
  58. package/dist/registry-CC3CbQiF.mjs.map +0 -1
  59. package/dist/service-CnHz9rwz.mjs.map +0 -1
  60. package/dist/service-nU6ITOHL.mjs +0 -3
  61. package/dist/workflow-9kHGKxF2.mjs +0 -64
  62. package/dist/workflow-9kHGKxF2.mjs.map +0 -1
package/dist/cli/lib.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { t as assertDefined } from "../assert-DBxo8jPo.mjs";
2
- import { $ as updateFolder, $t as bundleMigrationScript, A as generate$1, At as listExecutorJobs, C as waitWorkflowExecution, D as listWorkflows, Dn as hasChanges, Dt as getExecutorJob, En as formatMigrationDiff, Et as listExecutors, Fn as assertWritable, Ft as getWorkflow, G as updateOrganization, Gt as listWorkspaces, H as remove, Ht as deploy, In as loadConfig, K as organizationTree, L as deployStaticWebsite, Lt as getWorkflowExecution, Mn as generateUserTypes, Nt as startWorkflow, O as truncate, On as getNamespacesWithMigrations, Ot as getExecutorWaitFailureMessage, Pn as apiCall, Qt as waitForExecution, R as show, Rt as listWorkflowExecutions, Sn as reconstructSnapshotFromMigrations, T as resumeWorkflow, Tn as formatDiffSummary, Vn as loadAccessToken, Vt as getExecutor, Y as listOrganizations, Z as getOrganization, Zt as executeScript, _ as deleteWorkspace, _n as getMigrationFilePath, a as updateUser, at as deleteFolder, b as getAppHealth, bt as getFunctionRegistry, cn as INITIAL_SCHEMA_NUMBER, d as inviteUser, dt as getOAuth2Client, en as MIGRATION_LABEL_KEY, fn as compareLocalTypesWithSnapshot, ft as getMachineUserToken, gn as getMigrationDirPath, gt as generate, h as getWorkspace, hn as getLatestMigrationNumber, ht as listMachineUsers, jn as PluginManager, jt as watchExecutorJob, l as listUsers, ln as MIGRATE_FILE_NAME, lt as listOAuth2Clients, mn as createSnapshotFromLocalTypes, n as query, on as DB_TYPES_FILE_NAME, p as restoreWorkspace, pn as compareSnapshots, qn as loadWorkspaceId, qt as createWorkspace, rt as getFolder, s as removeUser, sn as DIFF_FILE_NAME, st as createFolder, t as registerTsHook, tt as listFolders, un as SCHEMA_FILE_NAME, v as listApps, vn as getMigrationFiles, vt as listFunctionRegistries, wt as triggerExecutor, xt as listWebhookExecutors, yn as getNextMigrationNumber } from "../register-ts-hook-DL31O2W9.mjs";
3
- import { B as initOperatorClient, _ as platformBundleDefinePlugin, t as defineApplication, w as getDistDir } from "../application-BJXRpQj5.mjs";
2
+ import { $ as updateFolder, $t as bundleMigrationScript, A as generate$1, At as listExecutorJobs, C as waitWorkflowExecution, D as listWorkflows, Dn as hasChanges, Dt as getExecutorJob, En as formatMigrationDiff, Et as listExecutors, Fn as assertWritable, Ft as getWorkflow, G as updateOrganization, Gt as listWorkspaces, H as remove, Ht as deploy, In as loadConfig, K as organizationTree, L as deployStaticWebsite, Lt as getWorkflowExecution, Mn as generateUserTypes, Nt as startWorkflow, O as truncate, On as getNamespacesWithMigrations, Ot as getExecutorWaitFailureMessage, Pn as apiCall, Qt as waitForExecution, R as show, Rt as listWorkflowExecutions, Sn as reconstructSnapshotFromMigrations, T as resumeWorkflow, Tn as formatDiffSummary, Vn as loadAccessToken, Vt as getExecutor, Y as listOrganizations, Z as getOrganization, Zt as executeScript, _ as deleteWorkspace, _n as getMigrationFilePath, a as updateUser, at as deleteFolder, b as getAppHealth, bt as getFunctionRegistry, cn as INITIAL_SCHEMA_NUMBER, d as inviteUser, dt as getOAuth2Client, en as MIGRATION_LABEL_KEY, fn as compareLocalTypesWithSnapshot, ft as getMachineUserToken, gn as getMigrationDirPath, gt as generate, h as getWorkspace, hn as getLatestMigrationNumber, ht as listMachineUsers, jn as PluginManager, jt as watchExecutorJob, l as listUsers, ln as MIGRATE_FILE_NAME, lt as listOAuth2Clients, mn as createSnapshotFromLocalTypes, n as query, on as DB_TYPES_FILE_NAME, p as restoreWorkspace, pn as compareSnapshots, qn as loadWorkspaceId, qt as createWorkspace, rt as getFolder, s as removeUser, sn as DIFF_FILE_NAME, st as createFolder, t as registerTsHook, tt as listFolders, un as SCHEMA_FILE_NAME, v as listApps, vn as getMigrationFiles, vt as listFunctionRegistries, wt as triggerExecutor, xt as listWebhookExecutors, yn as getNextMigrationNumber } from "../register-ts-hook-DvEs6YsL.mjs";
3
+ import { B as initOperatorClient, _ as platformBundleDefinePlugin, t as defineApplication, w as getDistDir } from "../application-GzW98_Xr.mjs";
4
4
  import { t as multiline } from "../multiline-sfHpTZZK.mjs";
5
5
  import { t as isPluginGeneratedType } from "../type-source-DH_LH20p.mjs";
6
6
  import { n as kyselyTypePlugin } from "../kysely-type-DqIRgDYR.mjs";
@@ -1,5 +1,5 @@
1
1
  # politty-completion-version: 1
2
- # politty-bin-sig: 1784253091
2
+ # politty-bin-sig: 1784446645
3
3
  # politty-bin-path: /home/runner/work/sdk/sdk/node_modules/.bin/tailor
4
4
  # program: tailor
5
5
  # shell: zsh
@@ -9,15 +9,18 @@ import { LogLevelEnum } from "../../types/app-config.generated.mjs";
9
9
  //#region src/configure/config/types.d.ts
10
10
  type LogLevel = LogLevelEnum;
11
11
  type LogLevelInput = LogLevel | (string & {});
12
+ /** `files`/`ignores` patterns are resolved relative to this config's own directory, not the invocation directory. */
12
13
  type ExecutorServiceConfig = {
13
14
  files: string[];
14
15
  ignores?: string[];
15
16
  };
16
17
  type ExecutorServiceInput = ExecutorServiceConfig;
18
+ /** `files`/`ignores` patterns are resolved relative to this config's own directory, not the invocation directory. */
17
19
  type HttpAdapterServiceInput = {
18
20
  files: string[];
19
21
  ignores?: string[];
20
22
  };
23
+ /** `files`/`ignores` patterns are resolved relative to this config's own directory, not the invocation directory. */
21
24
  type ResolverServiceConfig = {
22
25
  files: string[];
23
26
  ignores?: string[];
@@ -29,6 +32,7 @@ type ResolverServiceInput = {
29
32
  [namespace: string]: ResolverServiceConfig | ResolverExternalConfig;
30
33
  };
31
34
  type WorkflowServiceConfig = {
35
+ /** Resolved relative to this config's own directory, not the invocation directory. */
32
36
  files: string[];
33
37
  job_files?: string[];
34
38
  ignores?: string[];
@@ -47,7 +51,7 @@ type WorkflowServiceInput = WorkflowServiceConfig;
47
51
  * - `idp`: Array of IdP configs, e.g. `[myIdp]`
48
52
  * - `staticWebsites`: Array of static website configs, e.g. `[website]`
49
53
  * - `aiGateways`: Array of AI Gateway configs, e.g. `[gateway]`
50
- * - `db`, `resolver`, `executor`, `workflow`: Service configs with file globs
54
+ * - `db`, `resolver`, `executor`, `workflow`, `httpAdapter`: Service configs with file globs (resolved relative to this config file's own directory, not the invocation directory)
51
55
  */
52
56
  interface AppConfig<Auth extends AuthConfig = AuthConfig, Idp extends IdPConfig[] = IdPConfig[], StaticWebsites extends StaticWebsiteConfig[] = StaticWebsiteConfig[], AIGateways extends AIGatewayConfig[] = AIGatewayConfig[], Env extends Record<string, string | number | boolean> = Record<string, string | number | boolean>> {
53
57
  /** Application name (required). */
@@ -1,6 +1,6 @@
1
1
  import { i as parseInternal, n as mapAllowedValues, t as db } from "../schema--xYWRGfe.mjs";
2
2
  import { t as brandValue } from "../brand-Eo4pLXPJ.mjs";
3
- import { a as registerJob, n as dispatchTriggerJob, r as dispatchTriggerWorkflow } from "../registry-CC3CbQiF.mjs";
3
+ import { a as registerJob, n as dispatchStartJob, r as dispatchStartWorkflow } from "../registry-i7EdJ-D5.mjs";
4
4
  import { i as withWorkflowTestInvoker } from "../test-env-key-D7UkZp99.mjs";
5
5
 
6
6
  //#region src/configure/types/type.ts
@@ -664,7 +664,7 @@ function defineWorkflowExecutionPolicies(builder, options) {
664
664
  * @param config - Job configuration with name and body function.
665
665
  * @param config.name - Unique job name across the project.
666
666
  * @param config.body - Function that processes the job input.
667
- * @returns A WorkflowJob that can be triggered from other jobs.
667
+ * @returns A WorkflowJob that can be started from other jobs.
668
668
  * @example
669
669
  * // Simple job with async body:
670
670
  * export const fetchData = createWorkflowJob({
@@ -679,8 +679,8 @@ function defineWorkflowExecutionPolicies(builder, options) {
679
679
  * export const orchestrate = createWorkflowJob({
680
680
  * name: "orchestrate",
681
681
  * body: (input: { orderId: string }) => {
682
- * const inventory = checkInventory.trigger({ orderId: input.orderId });
683
- * const payment = processPayment.trigger({ orderId: input.orderId });
682
+ * const inventory = checkInventory.start({ orderId: input.orderId });
683
+ * const payment = processPayment.start({ orderId: input.orderId });
684
684
  * return { inventory, payment };
685
685
  * },
686
686
  * });
@@ -689,14 +689,14 @@ function createWorkflowJob(config) {
689
689
  const userBody = config.body;
690
690
  const body = process.env.__TAILOR_PLATFORM_BUNDLE ? userBody : (input, context) => withWorkflowTestInvoker(context.invoker, () => userBody(input, context));
691
691
  if (!process.env.__TAILOR_PLATFORM_BUNDLE) registerJob(config.name, body);
692
- const trigger = process.env.__TAILOR_PLATFORM_BUNDLE ? () => {
693
- throw new Error("This workflow job's .trigger() is rewritten at build time and is unavailable in the bundle");
694
- } : function trigger(args, options) {
695
- return arguments.length >= 2 ? dispatchTriggerJob(config.name, args, options) : dispatchTriggerJob(config.name, args);
692
+ const start = process.env.__TAILOR_PLATFORM_BUNDLE ? () => {
693
+ throw new Error("This workflow job's .start() is rewritten at build time and is unavailable in the bundle");
694
+ } : function start(args, options) {
695
+ return arguments.length >= 2 ? dispatchStartJob(config.name, args, options) : dispatchStartJob(config.name, args);
696
696
  };
697
697
  return brandValue({
698
698
  name: config.name,
699
- trigger,
699
+ start,
700
700
  body
701
701
  }, "workflow-job");
702
702
  }
@@ -787,8 +787,8 @@ function createWaitPoints(builder) {
787
787
  //#endregion
788
788
  //#region src/configure/services/workflow/workflow.ts
789
789
  /**
790
- * Create a workflow definition that can be triggered via the Tailor SDK.
791
- * In production, bundler transforms .trigger() calls to tailor.workflow.triggerWorkflow().
790
+ * Create a workflow definition that can be started via the Tailor SDK.
791
+ * In production, the bundler rewrites `.start()` calls into direct platform workflow calls.
792
792
  *
793
793
  * The workflow MUST be the default export of the file.
794
794
  * All jobs referenced by the workflow MUST be named exports.
@@ -800,7 +800,7 @@ function createWaitPoints(builder) {
800
800
  * export const processData = createWorkflowJob({
801
801
  * name: "process-data",
802
802
  * body: (input: { id: string }) => {
803
- * const data = fetchData.trigger({ id: input.id });
803
+ * const data = fetchData.start({ id: input.id });
804
804
  * return { data };
805
805
  * },
806
806
  * });
@@ -814,10 +814,10 @@ function createWaitPoints(builder) {
814
814
  function createWorkflow(config) {
815
815
  return brandValue({
816
816
  ...config,
817
- trigger: process.env.__TAILOR_PLATFORM_BUNDLE ? async () => {
818
- throw new Error("workflow.trigger() is rewritten at build time and unavailable in the bundle");
819
- } : async function trigger(args, options) {
820
- return arguments.length >= 2 ? await dispatchTriggerWorkflow(config.name, args, options) : await dispatchTriggerWorkflow(config.name, args);
817
+ start: process.env.__TAILOR_PLATFORM_BUNDLE ? async () => {
818
+ throw new Error("workflow.start() is rewritten at build time and unavailable in the bundle");
819
+ } : async function start(args, options) {
820
+ return arguments.length >= 2 ? await dispatchStartWorkflow(config.name, args, options) : await dispatchStartWorkflow(config.name, args);
821
821
  }
822
822
  }, "workflow");
823
823
  }