@tailor-platform/sdk 1.35.0 → 1.35.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,75 @@
1
1
  # @tailor-platform/sdk
2
2
 
3
+ ## 1.35.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#925](https://github.com/tailor-platform/sdk/pull/925) [`ce5b766`](https://github.com/tailor-platform/sdk/commit/ce5b76662951cbe89779d45512a57c80cf4a2984) Thanks [@toiroakr](https://github.com/toiroakr)! - `function test-run` resolver arg no longer requires the `input` wrapper key — pass input fields directly (e.g. `-a '{"a":1}'`). The old `{"input":{...}}` format is detected via schema validation and emits a deprecation warning. When no input schema is defined, `--arg` is ignored with a warning.
8
+
9
+ - [#945](https://github.com/tailor-platform/sdk/pull/945) [`4d9892e`](https://github.com/tailor-platform/sdk/commit/4d9892e6e40c6eb4852714b8437339080e935189) Thanks [@anukiransolur](https://github.com/anukiransolur)! - chore(docs): added requirements for deterministic execution that the workflow must satisfy
10
+
11
+ - [#890](https://github.com/tailor-platform/sdk/pull/890) [`f0e03f2`](https://github.com/tailor-platform/sdk/commit/f0e03f267435094e88ec3cedd0af22bb4655264c) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update dependency oxfmt to v0.43.0
12
+
13
+ - [#927](https://github.com/tailor-platform/sdk/pull/927) [`dc699f3`](https://github.com/tailor-platform/sdk/commit/dc699f386b68d9647a77961f5ff34910f1b67939) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update dependency @typescript/native-preview to v7.0.0-dev.20260406.1
14
+
15
+ - [#936](https://github.com/tailor-platform/sdk/pull/936) [`7a1f37b`](https://github.com/tailor-platform/sdk/commit/7a1f37bd376736a47f367ac06fdbb3fbb5fa1446) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency oxc-parser to v0.123.0
16
+
17
+ - [#943](https://github.com/tailor-platform/sdk/pull/943) [`14af922`](https://github.com/tailor-platform/sdk/commit/14af922e82d945c76b8c864d1bb177eb9fae26f6) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update anthropics/claude-code-action action to v1.0.92
18
+
19
+ - [#944](https://github.com/tailor-platform/sdk/pull/944) [`f0070a9`](https://github.com/tailor-platform/sdk/commit/f0070a9f41a15c9802b9c5caf201cf802e19a589) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency @inquirer/core to v11.1.8
20
+
21
+ - [#946](https://github.com/tailor-platform/sdk/pull/946) [`c06dd0e`](https://github.com/tailor-platform/sdk/commit/c06dd0e16688b7863a4c85e569ed4e2e60bba971) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update dependency oxfmt to v0.44.0
22
+
23
+ - [#948](https://github.com/tailor-platform/sdk/pull/948) [`d5f365f`](https://github.com/tailor-platform/sdk/commit/d5f365ff1153d34362b743d8d9019183f67b668a) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency @inquirer/prompts to v8.4.0
24
+
25
+ - [#950](https://github.com/tailor-platform/sdk/pull/950) [`0dc96f9`](https://github.com/tailor-platform/sdk/commit/0dc96f9e2fde7088cef29142ce7917694dee5fca) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency oxc-parser to v0.124.0
26
+
27
+ ## 1.35.1
28
+
29
+ ### Patch Changes
30
+
31
+ - [#896](https://github.com/tailor-platform/sdk/pull/896) [`a57164c`](https://github.com/tailor-platform/sdk/commit/a57164cc7887d2f68600d6dfcb0c38c99dc534cb) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update dependency @typescript/native-preview to v7.0.0-dev.20260403.1
32
+
33
+ - [#897](https://github.com/tailor-platform/sdk/pull/897) [`0846e5d`](https://github.com/tailor-platform/sdk/commit/0846e5d951ec0a30778376ad798ed970b80a1656) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update anthropics/claude-code-action action to v1.0.89
34
+
35
+ - [#898](https://github.com/tailor-platform/sdk/pull/898) [`58dc091`](https://github.com/tailor-platform/sdk/commit/58dc09166e37dd5a7b29fdb5c05a409e242f66dc) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update dependency turbo to v2.9.3
36
+
37
+ - [#901](https://github.com/tailor-platform/sdk/pull/901) [`fe02730`](https://github.com/tailor-platform/sdk/commit/fe027300a149c924dc04281e076eaaf9e8f16145) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency kysely to v0.28.15
38
+
39
+ - [#902](https://github.com/tailor-platform/sdk/pull/902) [`a6cd48e`](https://github.com/tailor-platform/sdk/commit/a6cd48e7789e36b9eca30879ec8da945f603bbf7) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update dependency typescript-eslint to v8.58.0
40
+
41
+ - [#904](https://github.com/tailor-platform/sdk/pull/904) [`435b2e3`](https://github.com/tailor-platform/sdk/commit/435b2e31bb5cabe62878932c371623d2fa6284da) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency @oxc-project/types to v0.123.0
42
+
43
+ - [#906](https://github.com/tailor-platform/sdk/pull/906) [`a81eea5`](https://github.com/tailor-platform/sdk/commit/a81eea534b756696fa3c33adc70c20fc5986af72) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update dependency knip to v6.3.0
44
+
45
+ - [#908](https://github.com/tailor-platform/sdk/pull/908) [`b3f2a03`](https://github.com/tailor-platform/sdk/commit/b3f2a03b4700e87c4ab1391b03ef2d824dc6072f) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update oxlint monorepo to v1.58.0
46
+
47
+ - [#910](https://github.com/tailor-platform/sdk/pull/910) [`cf80512`](https://github.com/tailor-platform/sdk/commit/cf805128342ae21b9eeff81704eac789876accd2) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency @tailor-platform/function-types to v0.8.4
48
+
49
+ - [#915](https://github.com/tailor-platform/sdk/pull/915) [`ad28036`](https://github.com/tailor-platform/sdk/commit/ad2803663a5687c89237d831b28caf8d5fa18bb0) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update dependency @types/node to v24.12.2
50
+
51
+ - [#916](https://github.com/tailor-platform/sdk/pull/916) [`5b20cbd`](https://github.com/tailor-platform/sdk/commit/5b20cbd3749e180a00f70c251f37a2853cdd115b) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency rolldown to v1.0.0-rc.13
52
+
53
+ - [#917](https://github.com/tailor-platform/sdk/pull/917) [`9a835e8`](https://github.com/tailor-platform/sdk/commit/9a835e801e7409acd2a2c1fbd14bc6553144c3eb) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update anthropics/claude-code-action action to v1.0.90
54
+
55
+ - [#918](https://github.com/tailor-platform/sdk/pull/918) [`a2b9002`](https://github.com/tailor-platform/sdk/commit/a2b9002a411c07af944bca1cafc8ba80fddc4e9b) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update dependency aquaproj/aqua-registry to v4.492.0
56
+
57
+ - [#921](https://github.com/tailor-platform/sdk/pull/921) [`6796c00`](https://github.com/tailor-platform/sdk/commit/6796c0040c1ea3f635a5473dceb4ce7e0cd2eaaa) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update flatt-security/setup-takumi-guard-npm digest to 3c4ad0e
58
+
59
+ - [#922](https://github.com/tailor-platform/sdk/pull/922) [`44644a9`](https://github.com/tailor-platform/sdk/commit/44644a9c75badb5b659f855900564bf0a202f51e) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update marocchino/sticky-pull-request-comment action to v3.0.3
60
+
61
+ - [#923](https://github.com/tailor-platform/sdk/pull/923) [`b82bb95`](https://github.com/tailor-platform/sdk/commit/b82bb95779056de8dfa2ccc22da1ffac37e16b14) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update dependency eslint to v10.2.0
62
+
63
+ - [#924](https://github.com/tailor-platform/sdk/pull/924) [`cdd21da`](https://github.com/tailor-platform/sdk/commit/cdd21da0fabfb0cdabb22ba6ace696e1f2482915) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update dependency eslint-plugin-jsdoc to v62.9.0
64
+
65
+ - [#932](https://github.com/tailor-platform/sdk/pull/932) [`d50d40d`](https://github.com/tailor-platform/sdk/commit/d50d40dac22646232a8855119cb682ca83fd8603) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update dependency turbo to v2.9.4
66
+
67
+ - [#933](https://github.com/tailor-platform/sdk/pull/933) [`36e9c50`](https://github.com/tailor-platform/sdk/commit/36e9c50ecf3c916eb411f6919fbc7a0338d5c37a) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update dependency oxlint-tsgolint to v0.20.0
68
+
69
+ - [#935](https://github.com/tailor-platform/sdk/pull/935) [`3cd9fa0`](https://github.com/tailor-platform/sdk/commit/3cd9fa0870efed639f413a7d58ff26ddb11bd834) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency @clack/prompts to v1.2.0
70
+
71
+ - [#937](https://github.com/tailor-platform/sdk/pull/937) [`1399b34`](https://github.com/tailor-platform/sdk/commit/1399b340640dc1a9e3f7033c6e01990e65372f8b) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update dependency lefthook to v2.1.5
72
+
3
73
  ## 1.35.0
4
74
 
5
75
  ### Minor Changes
@@ -604,13 +604,11 @@ function generateEntry(detected, sourceFile, env, machineUser, workspaceId) {
604
604
  const _user = ${userExpr};
605
605
 
606
606
  const $tailor_resolver_body = async (context) => {
607
- const enrichedContext = { ...context, env: _env, user: _user };
608
-
609
607
  if (_internalResolver.input) {
610
608
  const result = t.object(_internalResolver.input).parse({
611
- value: enrichedContext.input,
612
- data: enrichedContext.input,
613
- user: enrichedContext.user,
609
+ value: context,
610
+ data: context,
611
+ user: _user,
614
612
  });
615
613
 
616
614
  if (result.issues) {
@@ -621,6 +619,7 @@ function generateEntry(detected, sourceFile, env, machineUser, workspaceId) {
621
619
  }
622
620
  }
623
621
 
622
+ const enrichedContext = { input: context, env: _env, user: _user };
624
623
  return _internalResolver.body(enrichedContext);
625
624
  };
626
625
 
@@ -704,10 +703,20 @@ async function detectFunctionType(options) {
704
703
  const { filePath, jobName } = options;
705
704
  const module = await import(pathToFileURL(filePath).href);
706
705
  const resolverResult = ResolverSchema.safeParse(module.default);
707
- if (resolverResult.success) return {
708
- type: "resolver",
709
- name: resolverResult.data.name
710
- };
706
+ if (resolverResult.success) {
707
+ const rawInput = module.default.input;
708
+ let inputSchema;
709
+ if (rawInput) {
710
+ const { t } = await import("@tailor-platform/sdk");
711
+ inputSchema = t.object(rawInput);
712
+ }
713
+ return {
714
+ type: "resolver",
715
+ name: resolverResult.data.name,
716
+ hasInput: rawInput != null,
717
+ inputSchema
718
+ };
719
+ }
711
720
  const executorResult = ExecutorSchema.safeParse(module.default);
712
721
  if (executorResult.success) {
713
722
  const { operation } = executorResult.data;
@@ -825,7 +834,7 @@ When a \`.js\` file is provided, detection and bundling are skipped and the file
825
834
  > Triggered jobs are not executed; only the target job's \`body\` function runs in isolation.`,
826
835
  examples: [
827
836
  {
828
- cmd: "resolvers/add.ts --arg '{\"input\":{\"a\":1,\"b\":2}}'",
837
+ cmd: "resolvers/add.ts --arg '{\"a\":1,\"b\":2}'",
829
838
  desc: "Run a resolver with input arguments"
830
839
  },
831
840
  {
@@ -833,7 +842,7 @@ When a \`.js\` file is provided, detection and bundling are skipped and the file
833
842
  desc: "Run a specific workflow job by name"
834
843
  },
835
844
  {
836
- cmd: "build/resolvers/add.js --arg '{\"input\":{\"a\":1,\"b\":2}}'",
845
+ cmd: "build/resolvers/add.js --arg '{\"a\":1,\"b\":2}'",
837
846
  desc: "Run a pre-bundled .js file directly"
838
847
  }
839
848
  ],
@@ -877,6 +886,12 @@ When a \`.js\` file is provided, detection and bundling are skipped and the file
877
886
  functionType = detected.type;
878
887
  functionName = detected.name;
879
888
  logger.info(`Detected: ${styles.bold(detected.type)} ${styles.info(`"${detected.name}"`)}`);
889
+ if (detected.type === "resolver" && args.arg) {
890
+ if (!detected.hasInput) {
891
+ logger.warn("--arg is ignored because this resolver has no input schema. Define \"input\" in your resolver to use --arg.");
892
+ args.arg = void 0;
893
+ } else if (detected.inputSchema) args.arg = resolveResolverArg(args.arg, detected.inputSchema, machineUser, workspaceId);
894
+ }
880
895
  logger.info("Bundling...");
881
896
  ({bundledCode, scriptName} = await bundleForTestRun({
882
897
  detected,
@@ -993,6 +1008,42 @@ async function resolveMachineUser(options) {
993
1008
  attributeList
994
1009
  };
995
1010
  }
1011
+ /**
1012
+ * Resolve resolver arg format: detect and unwrap deprecated {"input":{...}} wrapper.
1013
+ * Tries new format (arg = input fields) first via schema parse.
1014
+ * If that fails and arg looks like old format, tries unwrapping.
1015
+ * @param argStr - JSON string of the arg
1016
+ * @param inputSchema - Pre-built schema object from detect (has .parse())
1017
+ * @param machineUser - Resolved machine user info
1018
+ * @param workspaceId - Workspace ID
1019
+ * @returns Resolved JSON string (unwrapped if old format)
1020
+ */
1021
+ function resolveResolverArg(argStr, inputSchema, machineUser, workspaceId) {
1022
+ const parsed = JSON.parse(argStr);
1023
+ const user = {
1024
+ id: machineUser.id,
1025
+ type: "machine_user",
1026
+ workspaceId,
1027
+ attributes: machineUser.attributes ?? null,
1028
+ attributeList: machineUser.attributeList ?? []
1029
+ };
1030
+ if (!inputSchema.parse({
1031
+ value: parsed,
1032
+ data: parsed,
1033
+ user
1034
+ }).issues) return argStr;
1035
+ if (Object.keys(parsed).length === 1 && parsed.input != null && typeof parsed.input === "object" && !Array.isArray(parsed.input)) {
1036
+ if (!inputSchema.parse({
1037
+ value: parsed.input,
1038
+ data: parsed.input,
1039
+ user
1040
+ }).issues) {
1041
+ logger.warn("[DEPRECATED] Wrapping args with \"input\" key (e.g. {\"input\":{...}}) is deprecated. Pass input fields directly (e.g. {\"a\":1}). The \"input\" wrapper will be removed in v2.");
1042
+ return JSON.stringify(parsed.input);
1043
+ }
1044
+ }
1045
+ return argStr;
1046
+ }
996
1047
 
997
1048
  //#endregion
998
1049
  //#region src/cli/commands/function/index.ts