@tailor-platform/sdk 1.40.0 → 1.43.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 (52) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/README.md +23 -0
  3. package/dist/{actor-B2oEmlTc.d.mts → actor-DzCuoMlP.d.mts} +2 -2
  4. package/dist/{application-C_LFXkKJ.mjs → application-DQpD_kHR.mjs} +88 -9
  5. package/dist/application-DQpD_kHR.mjs.map +1 -0
  6. package/dist/application-DUcmoFdc.mjs +4 -0
  7. package/dist/brand-Ll48SMXe.mjs.map +1 -1
  8. package/dist/cli/index.mjs +34 -29
  9. package/dist/cli/index.mjs.map +1 -1
  10. package/dist/cli/lib.d.mts +49 -7
  11. package/dist/cli/lib.mjs +4 -4
  12. package/dist/cli/lib.mjs.map +1 -1
  13. package/dist/{client-DjGFRjH4.mjs → client-CcV6Jjds.mjs} +8 -5
  14. package/dist/{client-DjGFRjH4.mjs.map → client-CcV6Jjds.mjs.map} +1 -1
  15. package/dist/{client-Dtf48x0o.mjs → client-Cn9SqhZT.mjs} +1 -1
  16. package/dist/configure/index.d.mts +5 -5
  17. package/dist/configure/index.mjs +83 -3
  18. package/dist/configure/index.mjs.map +1 -1
  19. package/dist/{crash-report-CEIXtw4D.mjs → crash-report-CSYupJ0T.mjs} +1 -1
  20. package/dist/{crash-report-CSWITsTz.mjs → crash-report-CUbm1ErM.mjs} +2 -2
  21. package/dist/{crash-report-CSWITsTz.mjs.map → crash-report-CUbm1ErM.mjs.map} +1 -1
  22. package/dist/{index-Chvw1Eod.d.mts → index-0Dk-fDWi.d.mts} +2 -2
  23. package/dist/{index-CiNNNpuH.d.mts → index-BEEL1-6Z.d.mts} +2 -2
  24. package/dist/{index-D_ezppY7.d.mts → index-Br4XCvX1.d.mts} +103 -86
  25. package/dist/{index-BtXZdz-F.d.mts → index-DdsUV-aA.d.mts} +2 -2
  26. package/dist/{index-reFAYSX7.d.mts → index-ZZYEd_0R.d.mts} +2 -2
  27. package/dist/{job-p6zf8Qpg.mjs → job-BOvKyNdT.mjs} +15 -9
  28. package/dist/job-BOvKyNdT.mjs.map +1 -0
  29. package/dist/plugin/builtin/enum-constants/index.d.mts +1 -1
  30. package/dist/plugin/builtin/file-utils/index.d.mts +1 -1
  31. package/dist/plugin/builtin/kysely-type/index.d.mts +1 -1
  32. package/dist/plugin/builtin/seed/index.d.mts +1 -1
  33. package/dist/plugin/index.d.mts +2 -2
  34. package/dist/{runtime-im7Sq4jO.mjs → runtime-Bn68JXnL.mjs} +199 -79
  35. package/dist/runtime-Bn68JXnL.mjs.map +1 -0
  36. package/dist/{tailor-db-field-CoFKRCYW.d.mts → tailor-db-field-D_z185oq.d.mts} +36 -6
  37. package/dist/utils/test/index.d.mts +36 -3
  38. package/dist/utils/test/index.mjs +78 -9
  39. package/dist/utils/test/index.mjs.map +1 -1
  40. package/dist/{workflow.generated-Btz6srLR.d.mts → workflow.generated-CDCnZNkH.d.mts} +2 -2
  41. package/docs/cli/function.md +83 -1
  42. package/docs/cli-reference.md +3 -1
  43. package/docs/services/executor.md +4 -0
  44. package/docs/services/idp.md +93 -56
  45. package/docs/services/resolver.md +4 -2
  46. package/docs/services/workflow.md +117 -3
  47. package/docs/testing.md +95 -7
  48. package/package.json +23 -23
  49. package/dist/application-CEeKm4R-.mjs +0 -4
  50. package/dist/application-C_LFXkKJ.mjs.map +0 -1
  51. package/dist/job-p6zf8Qpg.mjs.map +0 -1
  52. package/dist/runtime-im7Sq4jO.mjs.map +0 -1
@@ -0,0 +1,4 @@
1
+
2
+ import { n as generatePluginFilesIfNeeded, r as loadApplication, t as defineApplication } from "./application-DQpD_kHR.mjs";
3
+
4
+ export { defineApplication };
@@ -1 +1 @@
1
- {"version":3,"file":"brand-Ll48SMXe.mjs","names":[],"sources":["../src/utils/brand.ts"],"sourcesContent":["// Symbol.for ensures the same symbol is returned across different ESM module instances,\n// avoiding identity mismatches when multiple copies of the SDK are loaded.\nexport const SDK_BRAND: unique symbol = Symbol.for(\"tailor-platform/sdk\");\n\nexport type SdkBrandKind = \"tailordb-type\" | \"resolver\" | \"executor\" | \"workflow\" | \"workflow-job\";\n\n/**\n * Adds a non-enumerable SDK brand symbol to the given object (in-place).\n * The brand stores the kind so service loaders can distinguish between\n * different SDK object types (e.g. a type loader skips executors).\n * @param value - The object to brand\n * @param kind - The kind of SDK object\n * @returns The same object with the brand applied\n */\nexport function brandValue<T extends object>(value: T, kind: SdkBrandKind): T {\n Object.defineProperty(value, SDK_BRAND, {\n value: kind,\n enumerable: false,\n configurable: false,\n writable: false,\n });\n return value;\n}\n\n/**\n * Checks whether the given value has been branded by the SDK.\n * When kind is specified, only returns true if the brand matches that kind.\n * Accepts a single kind or an array of kinds for multi-kind matching.\n * @param value - The value to check\n * @param kind - Optional kind or kinds to match against\n * @returns True if the value has the SDK brand symbol (and matches kind if specified)\n */\nexport function isSdkBranded(\n value: unknown,\n kind?: SdkBrandKind | readonly SdkBrandKind[],\n): boolean {\n if (value === null || typeof value !== \"object\" || !(SDK_BRAND in value)) return false;\n const stored = (value as Record<symbol, unknown>)[SDK_BRAND];\n // No kind filter → any brand matches. Legacy `true` brand → matches any kind.\n return (\n kind === undefined ||\n stored === true ||\n (Array.isArray(kind) ? kind.includes(stored as SdkBrandKind) : stored === kind)\n );\n}\n"],"mappings":";;AAEA,MAAa,YAA2B,OAAO,IAAI,sBAAsB;;;;;;;;;AAYzE,SAAgB,WAA6B,OAAU,MAAuB;AAC5E,QAAO,eAAe,OAAO,WAAW;EACtC,OAAO;EACP,YAAY;EACZ,cAAc;EACd,UAAU;EACX,CAAC;AACF,QAAO;;;;;;;;;;AAWT,SAAgB,aACd,OACA,MACS;AACT,KAAI,UAAU,QAAQ,OAAO,UAAU,YAAY,EAAE,aAAa,OAAQ,QAAO;CACjF,MAAM,SAAU,MAAkC;AAElD,QACE,SAAS,UACT,WAAW,SACV,MAAM,QAAQ,KAAK,GAAG,KAAK,SAAS,OAAuB,GAAG,WAAW"}
1
+ {"version":3,"file":"brand-Ll48SMXe.mjs","names":[],"sources":["../src/utils/brand.ts"],"sourcesContent":["// Symbol.for ensures the same symbol is returned across different ESM module instances,\n// avoiding identity mismatches when multiple copies of the SDK are loaded.\nexport const SDK_BRAND: unique symbol = Symbol.for(\"tailor-platform/sdk\");\n\nexport type SdkBrandKind =\n | \"tailordb-type\"\n | \"resolver\"\n | \"executor\"\n | \"workflow\"\n | \"workflow-job\"\n | \"wait-point\";\n\n/**\n * Adds a non-enumerable SDK brand symbol to the given object (in-place).\n * The brand stores the kind so service loaders can distinguish between\n * different SDK object types (e.g. a type loader skips executors).\n * @param value - The object to brand\n * @param kind - The kind of SDK object\n * @returns The same object with the brand applied\n */\nexport function brandValue<T extends object>(value: T, kind: SdkBrandKind): T {\n Object.defineProperty(value, SDK_BRAND, {\n value: kind,\n enumerable: false,\n configurable: false,\n writable: false,\n });\n return value;\n}\n\n/**\n * Checks whether the given value has been branded by the SDK.\n * When kind is specified, only returns true if the brand matches that kind.\n * Accepts a single kind or an array of kinds for multi-kind matching.\n * @param value - The value to check\n * @param kind - Optional kind or kinds to match against\n * @returns True if the value has the SDK brand symbol (and matches kind if specified)\n */\nexport function isSdkBranded(\n value: unknown,\n kind?: SdkBrandKind | readonly SdkBrandKind[],\n): boolean {\n if (value === null || typeof value !== \"object\" || !(SDK_BRAND in value)) return false;\n const stored = (value as Record<symbol, unknown>)[SDK_BRAND];\n // No kind filter → any brand matches. Legacy `true` brand → matches any kind.\n return (\n kind === undefined ||\n stored === true ||\n (Array.isArray(kind) ? kind.includes(stored as SdkBrandKind) : stored === kind)\n );\n}\n"],"mappings":";;AAEA,MAAa,YAA2B,OAAO,IAAI,sBAAsB;;;;;;;;;AAkBzE,SAAgB,WAA6B,OAAU,MAAuB;AAC5E,QAAO,eAAe,OAAO,WAAW;EACtC,OAAO;EACP,YAAY;EACZ,cAAc;EACd,UAAU;EACX,CAAC;AACF,QAAO;;;;;;;;;;AAWT,SAAgB,aACd,OACA,MACS;AACT,KAAI,UAAU,QAAQ,OAAO,UAAU,YAAY,EAAE,aAAa,OAAQ,QAAO;CACjF,MAAM,SAAU,MAAkC;AAElD,QACE,SAAS,UACT,WAAW,SACV,MAAM,QAAQ,KAAK,GAAG,KAAK,SAAS,OAAuB,GAAG,WAAW"}
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { G as PATScope, R as AuthInvokerSchema, c as fetchUserInfo, d as initOperatorClient, h as userAgent, i as fetchAll, j as FunctionExecution_Type, n as closeConnectionPool, o as fetchPaged, s as fetchPlatformMachineUserToken, u as initOAuth2Client } from "../client-DjGFRjH4.mjs";
3
+ import { G as PATScope, R as AuthInvokerSchema, c as fetchUserInfo, d as initOperatorClient, h as userAgent, i as fetchAll, j as FunctionExecution_Type, n as closeConnectionPool, o as fetchPaged, s as fetchPlatformMachineUserToken, u as initOAuth2Client } from "../client-CcV6Jjds.mjs";
4
4
  import { n as logger, r as styles } from "../logger-DTNAMYGy.mjs";
5
- import { $ as deleteCommand$3, $t as isValidMigrationNumber, At as formatKeyValueTable, C as listCommand$12, E as resumeCommand, Et as executionsCommand, F as showCommand, G as getCommand$4, H as treeCommand, I as logBetaWarning, Lt as parseMigrationLabelNumber, N as generateCommand$1, Nt as apply, O as listCommand$11, Pt as executeScript, R as removeCommand$1, St as startCommand, T as healthCommand, U as listCommand$10, Xt as getMigrationFilePath, Y as listCommand$9, Z as getCommand$3, Zt as getMigrationFiles, _n as pagedLogArgs, an as getNamespacesWithMigrations, at as getCommand$2, b as createCommand$4, bn as workspaceArgs, c as listCommand$13, cn as trnPrefix, ct as tokenCommand, dn as apiCommand, dt as generate, en as loadDiff, f as restoreCommand, fn as defineAppCommand, g as getCommand$6, gn as isVerbose, gt as listCommand$6, hn as deploymentArgs, i as updateCommand$4, j as truncateCommand, jt as getCommand$1, kt as functionExecutionStatusToString, lt as listCommand$7, m as listCommand$14, mn as confirmationArgs, mt as triggerCommand, o as removeCommand, on as prompt, pn as commonArgs, pt as webhookCommand, q as updateCommand$2, qt as formatMigrationNumber, r as queryCommand, rt as listCommand$8, sn as sdkNameLabelKey, t as isNativeTypeScriptRuntime, tt as createCommand$3, u as inviteCommand, v as deleteCommand$4, vn as paginationArgs, wt as getCommand$5, yn as toPageDirection, yt as jobsCommand, z as updateCommand$3 } from "../runtime-im7Sq4jO.mjs";
5
+ import { $ as deleteCommand$3, At as executionsCommand, C as listCommand$13, Cn as toPageDirection, Ct as jobsCommand, E as resumeCommand, Et as startCommand, F as showCommand, Ft as getCommand$1, G as getCommand$5, H as treeCommand, I as logBetaWarning, Lt as apply, N as generateCommand$1, Nt as functionExecutionStatusToString, O as listCommand$12, Ot as getCommand$6, Pt as formatKeyValueTable, R as removeCommand$1, Rt as executeScript, Sn as paginationArgs, T as healthCommand, U as listCommand$11, Vt as parseMigrationLabelNumber, Y as listCommand$10, Z as getCommand$4, Zt as formatMigrationNumber, _n as commonArgs, _t as webhookCommand, at as getCommand$3, b as createCommand$4, bn as isVerbose, bt as listCommand$6, c as listCommand$14, ct as tokenCommand, dn as sdkNameLabelKey, dt as generate, en as getMigrationFilePath, f as restoreCommand, fn as trnPrefix, ft as listCommand$7, g as getCommand$7, gn as defineAppCommand, hn as apiCommand, i as updateCommand$4, in as loadDiff, j as truncateCommand, ln as getNamespacesWithMigrations, lt as listCommand$8, m as listCommand$15, mt as getCommand$2, o as removeCommand, q as updateCommand$2, r as queryCommand, rn as isValidMigrationNumber, rt as listCommand$9, t as isNativeTypeScriptRuntime, tn as getMigrationFiles, tt as createCommand$3, u as inviteCommand, un as prompt, v as deleteCommand$4, vn as confirmationArgs, vt as triggerCommand, wn as workspaceArgs, xn as pagedLogArgs, yn as deploymentArgs, z as updateCommand$3 } from "../runtime-Bn68JXnL.mjs";
6
6
  import { t as readPackageJson } from "../package-json-CWp8s9dE.mjs";
7
- import { C as resolveTokens, S as readPlatformConfig, T as writePlatformConfig, _ as loadConfig, a as WorkflowJobSchema, b as loadAccessToken, c as ExecutorSchema, h as getDistDir, i as resolveInlineSourcemap, o as ResolverSchema, v as deleteUserTokens, w as saveUserTokens, x as loadWorkspaceId, y as fetchLatestToken } from "../application-C_LFXkKJ.mjs";
8
- import { a as JSON_FOOTER_MARKER, i as CRASH_LOG_EXTENSION, o as parseCrashReportConfig, r as sendCrashReport, t as initCrashReporting } from "../crash-report-CSWITsTz.mjs";
7
+ import { C as loadWorkspaceId, D as writePlatformConfig, E as saveUserTokens, S as loadAccessToken, T as resolveTokens, _ as getDistDir, a as WorkflowJobSchema, b as deleteUserTokens, c as ExecutorSchema, i as resolveInlineSourcemap, l as INVOKER_EXPR, o as ResolverSchema, w as readPlatformConfig, x as fetchLatestToken, y as loadConfig } from "../application-DQpD_kHR.mjs";
8
+ import { a as JSON_FOOTER_MARKER, i as CRASH_LOG_EXTENSION, o as parseCrashReportConfig, r as sendCrashReport, t as initCrashReporting } from "../crash-report-CUbm1ErM.mjs";
9
9
  import { n as isCLIError } from "../errors-ChWX5ZG8.mjs";
10
10
  import { createRequire } from "node:module";
11
11
  import { arg, defineCommand, runCommand, runMain } from "politty";
@@ -1056,6 +1056,7 @@ function generateEntry(detected, sourceFile, env, machineUser, workspaceId) {
1056
1056
  const _user = ${userExpr};
1057
1057
 
1058
1058
  const $tailor_resolver_body = async (context) => {
1059
+ const _invoker = ${INVOKER_EXPR};
1059
1060
  if (_internalResolver.input) {
1060
1061
  const result = t.object(_internalResolver.input).parse({
1061
1062
  value: context,
@@ -1071,7 +1072,7 @@ function generateEntry(detected, sourceFile, env, machineUser, workspaceId) {
1071
1072
  }
1072
1073
  }
1073
1074
 
1074
- const enrichedContext = { input: context, env: _env, user: _user };
1075
+ const enrichedContext = { input: context, env: _env, user: _user, invoker: _invoker };
1075
1076
  return _internalResolver.body(enrichedContext);
1076
1077
  };
1077
1078
 
@@ -1087,7 +1088,8 @@ function generateEntry(detected, sourceFile, env, machineUser, workspaceId) {
1087
1088
  const _actor = ${actorExpr};
1088
1089
 
1089
1090
  const __executor_function = async (args) => {
1090
- return _internalExecutor.operation.body({ ...args, env: _env, actor: _actor });
1091
+ const _invoker = ${INVOKER_EXPR};
1092
+ return _internalExecutor.operation.body({ ...args, env: _env, actor: _actor, invoker: _invoker });
1091
1093
  };
1092
1094
 
1093
1095
  export { __executor_function as main };
@@ -1101,7 +1103,8 @@ function generateEntry(detected, sourceFile, env, machineUser, workspaceId) {
1101
1103
  const env = ${JSON.stringify(env)};
1102
1104
 
1103
1105
  export async function main(input) {
1104
- return await ${exportName}.body(input, { env });
1106
+ const invoker = ${INVOKER_EXPR};
1107
+ return await ${exportName}.body(input, { env, invoker });
1105
1108
  }
1106
1109
  `;
1107
1110
  }
@@ -1506,11 +1509,13 @@ const functionCommand = defineCommand({
1506
1509
  name: "function",
1507
1510
  description: "Manage functions",
1508
1511
  subCommands: {
1512
+ get: getCommand$2,
1513
+ list: listCommand$7,
1509
1514
  logs: logsCommand,
1510
1515
  "test-run": testRunCommand
1511
1516
  },
1512
1517
  async run() {
1513
- await runCommand(logsCommand, []);
1518
+ await runCommand(listCommand$7, []);
1514
1519
  }
1515
1520
  });
1516
1521
 
@@ -1731,11 +1736,11 @@ const machineuserCommand = defineCommand({
1731
1736
  name: "machineuser",
1732
1737
  description: "Manage machine users in your Tailor Platform application.",
1733
1738
  subCommands: {
1734
- list: listCommand$7,
1739
+ list: listCommand$8,
1735
1740
  token: tokenCommand
1736
1741
  },
1737
1742
  async run() {
1738
- await runCommand(listCommand$7, []);
1743
+ await runCommand(listCommand$8, []);
1739
1744
  }
1740
1745
  });
1741
1746
 
@@ -1745,11 +1750,11 @@ const oauth2clientCommand = defineCommand({
1745
1750
  name: "oauth2client",
1746
1751
  description: "Manage OAuth2 clients in your Tailor Platform application.",
1747
1752
  subCommands: {
1748
- list: listCommand$8,
1749
- get: getCommand$2
1753
+ list: listCommand$9,
1754
+ get: getCommand$3
1750
1755
  },
1751
1756
  async run() {
1752
- await runCommand(listCommand$8, []);
1757
+ await runCommand(listCommand$9, []);
1753
1758
  }
1754
1759
  });
1755
1760
 
@@ -1789,8 +1794,8 @@ const folderCommand = defineCommand({
1789
1794
  subCommands: {
1790
1795
  create: createCommand$3,
1791
1796
  delete: deleteCommand$3,
1792
- get: getCommand$3,
1793
- list: listCommand$9,
1797
+ get: getCommand$4,
1798
+ list: listCommand$10,
1794
1799
  update: updateCommand$2
1795
1800
  }
1796
1801
  });
@@ -1802,13 +1807,13 @@ const organizationCommand = defineCommand({
1802
1807
  description: "Manage Tailor Platform organizations.",
1803
1808
  subCommands: {
1804
1809
  folder: folderCommand,
1805
- get: getCommand$4,
1806
- list: listCommand$10,
1810
+ get: getCommand$5,
1811
+ list: listCommand$11,
1807
1812
  tree: treeCommand,
1808
1813
  update: updateCommand$3
1809
1814
  },
1810
1815
  async run() {
1811
- await runCommand(listCommand$10, []);
1816
+ await runCommand(listCommand$11, []);
1812
1817
  }
1813
1818
  });
1814
1819
 
@@ -4020,14 +4025,14 @@ const workflowCommand = defineCommand({
4020
4025
  name: "workflow",
4021
4026
  description: "Manage workflows and workflow executions.",
4022
4027
  subCommands: {
4023
- list: listCommand$11,
4024
- get: getCommand$5,
4028
+ list: listCommand$12,
4029
+ get: getCommand$6,
4025
4030
  start: startCommand,
4026
4031
  executions: executionsCommand,
4027
4032
  resume: resumeCommand
4028
4033
  },
4029
4034
  async run() {
4030
- await runCommand(listCommand$11, []);
4035
+ await runCommand(listCommand$12, []);
4031
4036
  }
4032
4037
  });
4033
4038
 
@@ -4038,10 +4043,10 @@ const appCommand = defineCommand({
4038
4043
  description: "Manage workspace applications",
4039
4044
  subCommands: {
4040
4045
  health: healthCommand,
4041
- list: listCommand$12
4046
+ list: listCommand$13
4042
4047
  },
4043
4048
  async run() {
4044
- await runCommand(listCommand$12, []);
4049
+ await runCommand(listCommand$13, []);
4045
4050
  }
4046
4051
  });
4047
4052
 
@@ -4052,12 +4057,12 @@ const userCommand = defineCommand({
4052
4057
  description: "Manage workspace users",
4053
4058
  subCommands: {
4054
4059
  invite: inviteCommand,
4055
- list: listCommand$13,
4060
+ list: listCommand$14,
4056
4061
  remove: removeCommand,
4057
4062
  update: updateCommand$4
4058
4063
  },
4059
4064
  async run() {
4060
- await runCommand(listCommand$13, []);
4065
+ await runCommand(listCommand$14, []);
4061
4066
  }
4062
4067
  });
4063
4068
 
@@ -4070,13 +4075,13 @@ const workspaceCommand = defineCommand({
4070
4075
  app: appCommand,
4071
4076
  create: createCommand$4,
4072
4077
  delete: deleteCommand$4,
4073
- get: getCommand$6,
4074
- list: listCommand$14,
4078
+ get: getCommand$7,
4079
+ list: listCommand$15,
4075
4080
  restore: restoreCommand,
4076
4081
  user: userCommand
4077
4082
  },
4078
4083
  async run() {
4079
- await runCommand(listCommand$14, []);
4084
+ await runCommand(listCommand$15, []);
4080
4085
  }
4081
4086
  });
4082
4087
 
@@ -4136,7 +4141,7 @@ runMain(mainCommand, {
4136
4141
  if (isVerbose() && error.stack) logger.debug(`\nStack trace:\n${error.stack}`);
4137
4142
  } else logger.error(`Unknown error: ${error}`);
4138
4143
  if (!isCLIError(error) && (!(error instanceof Error) || error instanceof TypeError || error instanceof RangeError)) {
4139
- const { reportCrash } = await import("../crash-report-CEIXtw4D.mjs");
4144
+ const { reportCrash } = await import("../crash-report-CSYupJ0T.mjs");
4140
4145
  await reportCrash(error, "handledError");
4141
4146
  }
4142
4147
  }