@tailor-platform/sdk 1.45.2 → 1.46.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 (36) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/application-B4zVVNRS.mjs.map +1 -1
  3. package/dist/cli/index.mjs +71 -49
  4. package/dist/cli/index.mjs.map +1 -1
  5. package/dist/cli/lib.d.mts +7 -7
  6. package/dist/cli/lib.mjs +2 -2
  7. package/dist/cli/lib.mjs.map +1 -1
  8. package/dist/configure/index.d.mts +1 -1
  9. package/dist/{crash-report-BUHzuzDn.mjs → crashreport-6mcMyWu4.mjs} +1 -1
  10. package/dist/{crash-report-CtYCva4d.mjs → crashreport-DGeGj9BF.mjs} +8 -8
  11. package/dist/crashreport-DGeGj9BF.mjs.map +1 -0
  12. package/dist/{index-DUKJPEwq.d.mts → index-PB0otrDj.d.mts} +3 -3
  13. package/dist/{runtime-D97Ydu2S.mjs → runtime-B67skpW-.mjs} +64 -64
  14. package/dist/runtime-B67skpW-.mjs.map +1 -0
  15. package/dist/telemetry-21afNV9_.mjs +4 -0
  16. package/dist/{telemetry-DXitz4RH.mjs → telemetry-DcL8Fsm_.mjs} +1 -1
  17. package/dist/{telemetry-DXitz4RH.mjs.map → telemetry-DcL8Fsm_.mjs.map} +1 -1
  18. package/dist/utils/test/index.d.mts +1 -1
  19. package/docs/cli/application.md +19 -17
  20. package/docs/cli/crashreport.md +119 -0
  21. package/docs/cli/executor.md +9 -9
  22. package/docs/cli/function.md +5 -5
  23. package/docs/cli/tailordb.md +1 -1
  24. package/docs/cli/workflow.md +8 -8
  25. package/docs/cli-reference.md +8 -8
  26. package/docs/quickstart.md +2 -2
  27. package/docs/services/auth.md +2 -2
  28. package/docs/services/secret.md +4 -4
  29. package/docs/services/tailordb-migration.md +10 -10
  30. package/docs/services/tailordb.md +1 -1
  31. package/package.json +1 -1
  32. package/dist/crash-report-CtYCva4d.mjs.map +0 -1
  33. package/dist/runtime-D97Ydu2S.mjs.map +0 -1
  34. package/dist/telemetry-BvI1EgMG.mjs +0 -4
  35. package/docs/cli/crash-report.md +0 -118
  36. /package/dist/{application-BIzicxMA.mjs → application-Boa_11Nv.mjs} +0 -0
@@ -2,12 +2,12 @@
2
2
 
3
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-BwXkoiMq.mjs";
4
4
  import { n as logger, r as styles } from "../logger-DTNAMYGy.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, i as updateCommand$4, in as loadDiff, j as truncateCommand, ln as getNamespacesWithMigrations, lt as listCommand$8, m as listCommand$15, mn as apiCommand, 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-D97Ydu2S.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 deploy, 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 trnPrefix, dt as generate, en as getMigrationFilePath, f as restoreCommand, ft as listCommand$7, g as getCommand$7, gn as defineAppCommand, i as updateCommand$4, in as loadDiff, j as truncateCommand, ln as getNamespacesWithMigrations, lt as listCommand$8, m as listCommand$15, mn as apiCommand, mt as getCommand$2, o as removeCommand, pn as prompt, 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 sdkNameLabelKey, 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-B67skpW-.mjs";
6
6
  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-B4zVVNRS.mjs";
7
7
  import { t as multiline } from "../multiline-e3IpANmS.mjs";
8
8
  import { t as readPackageJson } from "../package-json-6Px8bDpG.mjs";
9
9
  import { n as isCLIError } from "../errors-wNQxQQBH.mjs";
10
- import { a as JSON_FOOTER_MARKER, i as CRASH_LOG_EXTENSION, o as parseCrashReportConfig, r as sendCrashReport, t as initCrashReporting } from "../crash-report-CtYCva4d.mjs";
10
+ import { a as JSON_FOOTER_MARKER, i as CRASH_LOG_EXTENSION, o as parseCrashReportConfig, r as sendCrashReport, t as initCrashReporting } from "../crashreport-DGeGj9BF.mjs";
11
11
  import { createRequire } from "node:module";
12
12
  import { arg, defineCommand, runCommand, runMain } from "politty";
13
13
  import { withCompletionCommand } from "politty/completion";
@@ -23,8 +23,8 @@ import * as http from "node:http";
23
23
  import * as crypto from "node:crypto";
24
24
  import { resolvePackageJSON, resolveTSConfig } from "pkg-types";
25
25
  import { create } from "@bufbuild/protobuf";
26
- import * as rolldown from "rolldown";
27
26
  import open from "open";
27
+ import * as rolldown from "rolldown";
28
28
  import { TraceMap, generatedPositionFor, originalPositionFor } from "@jridgewell/trace-mapping";
29
29
  import { spawn, spawnSync } from "node:child_process";
30
30
  import * as fs from "fs";
@@ -32,38 +32,6 @@ import { lookup } from "mime-types";
32
32
  import pLimit from "p-limit";
33
33
  import { setTimeout as setTimeout$1 } from "node:timers/promises";
34
34
 
35
- //#region src/cli/commands/apply/index.ts
36
- const applyCommand = defineAppCommand({
37
- name: "apply",
38
- description: "Apply Tailor configuration to deploy your application.",
39
- args: z.object({
40
- ...deploymentArgs,
41
- ...confirmationArgs,
42
- "dry-run": arg(z.boolean().optional(), {
43
- alias: "d",
44
- description: "Run the command without making any changes"
45
- }),
46
- "no-schema-check": arg(z.boolean().optional(), { description: "Skip schema diff check against migration snapshots" }),
47
- "no-cache": arg(z.boolean().optional(), { description: "Disable bundle caching for this run" }),
48
- "clean-cache": arg(z.boolean().optional(), { description: "Clean the bundle cache before building" })
49
- }).strict(),
50
- run: async (args) => {
51
- const { initTelemetry } = await import("../telemetry-BvI1EgMG.mjs");
52
- await initTelemetry();
53
- await apply({
54
- workspaceId: args["workspace-id"],
55
- profile: args.profile,
56
- configPath: args.config,
57
- dryRun: args["dry-run"],
58
- yes: args.yes,
59
- noSchemaCheck: args["no-schema-check"],
60
- noCache: args["no-cache"],
61
- cleanCache: args["clean-cache"]
62
- });
63
- }
64
- });
65
-
66
- //#endregion
67
35
  //#region src/cli/commands/authconnection/args.ts
68
36
  /**
69
37
  * Arguments for identifying an auth connection
@@ -296,7 +264,7 @@ const authconnectionCommand = defineCommand({
296
264
  });
297
265
 
298
266
  //#endregion
299
- //#region src/cli/commands/crash-report/list.ts
267
+ //#region src/cli/commands/crashreport/list.ts
300
268
  function orderAndLimitCrashReports(entries, options) {
301
269
  const sorted = entries.filter((f) => f.endsWith(CRASH_LOG_EXTENSION)).sort();
302
270
  const ordered = options.order === "asc" ? sorted : sorted.reverse();
@@ -333,7 +301,7 @@ const listCommand$5 = defineAppCommand({
333
301
  });
334
302
 
335
303
  //#endregion
336
- //#region src/cli/commands/crash-report/send.ts
304
+ //#region src/cli/commands/crashreport/send.ts
337
305
  const sendCommand = defineAppCommand({
338
306
  name: "send",
339
307
  description: "Submit a crash report to help improve the SDK.",
@@ -388,9 +356,10 @@ function parseCrashLogFile(content) {
388
356
  }
389
357
 
390
358
  //#endregion
391
- //#region src/cli/commands/crash-report/index.ts
359
+ //#region src/cli/commands/crashreport/index.ts
392
360
  const crashReportCommand = defineCommand({
393
- name: "crash-report",
361
+ name: "crashreport",
362
+ aliases: ["crash-report"],
394
363
  description: "Manage crash reports.",
395
364
  subCommands: {
396
365
  list: listCommand$5,
@@ -401,6 +370,39 @@ const crashReportCommand = defineCommand({
401
370
  }
402
371
  });
403
372
 
373
+ //#endregion
374
+ //#region src/cli/commands/deploy/index.ts
375
+ const deployCommand$1 = defineAppCommand({
376
+ name: "deploy",
377
+ aliases: ["apply"],
378
+ description: "Deploy your application by applying the Tailor configuration.",
379
+ args: z.object({
380
+ ...deploymentArgs,
381
+ ...confirmationArgs,
382
+ "dry-run": arg(z.boolean().optional(), {
383
+ alias: "d",
384
+ description: "Run the command without making any changes"
385
+ }),
386
+ "no-schema-check": arg(z.boolean().optional(), { description: "Skip schema diff check against migration snapshots" }),
387
+ "no-cache": arg(z.boolean().optional(), { description: "Disable bundle caching for this run" }),
388
+ "clean-cache": arg(z.boolean().optional(), { description: "Clean the bundle cache before building" })
389
+ }).strict(),
390
+ run: async (args) => {
391
+ const { initTelemetry } = await import("../telemetry-21afNV9_.mjs");
392
+ await initTelemetry();
393
+ await deploy({
394
+ workspaceId: args["workspace-id"],
395
+ profile: args.profile,
396
+ configPath: args.config,
397
+ dryRun: args["dry-run"],
398
+ yes: args.yes,
399
+ noSchemaCheck: args["no-schema-check"],
400
+ noCache: args["no-cache"],
401
+ cleanCache: args["clean-cache"]
402
+ });
403
+ }
404
+ });
405
+
404
406
  //#endregion
405
407
  //#region src/cli/commands/executor/index.ts
406
408
  const executorCommand = defineCommand({
@@ -870,6 +872,11 @@ function printFunctionExecutionDetail(options) {
870
872
  * to a plain-text format when the script cannot be retrieved or when
871
873
  * the current registry entry is stale relative to the execution.
872
874
  *
875
+ * When `executionContentHash` is non-empty, the download is pinned to
876
+ * that exact bundle so mapping stays correct across redeploys. When
877
+ * empty (older servers), falls back to comparing `registryUpdatedAt`
878
+ * against `executionStartedAt`.
879
+ *
873
880
  * `FunctionExecution.scriptName` does not match the function registry
874
881
  * name directly; `scriptNameToRegistryName` translates between the two
875
882
  * formats.
@@ -878,16 +885,30 @@ function printFunctionExecutionDetail(options) {
878
885
  * @param options.workspaceId - Workspace ID
879
886
  * @param options.scriptName - Script name (matches FunctionExecution.scriptName)
880
887
  * @param options.executionType - Execution type used to discriminate registry name translation
881
- * @param options.executionStartedAt - Execution start timestamp used for staleness check
888
+ * @param options.executionContentHash - Content hash of the bundle that ran; pins the download when non-empty
889
+ * @param options.executionStartedAt - Execution start timestamp used as fallback staleness signal
882
890
  * @returns Bundled script content, or null when unavailable / stale
883
891
  */
884
892
  async function downloadScriptForMapping(options) {
885
- const { client, workspaceId, scriptName, executionType, executionStartedAt } = options;
893
+ const { client, workspaceId, scriptName, executionType, executionContentHash, executionStartedAt } = options;
886
894
  const registryName = scriptNameToRegistryName(scriptName, executionType);
887
895
  if (registryName == null) {
888
896
  logger.debug(`Script "${scriptName}" is not a deployed registry script (e.g. test-run or seed); skipping sourcemap mapping.`);
889
897
  return null;
890
898
  }
899
+ if (executionContentHash !== "") {
900
+ const pinned = await downloadFunctionScript({
901
+ client,
902
+ workspaceId,
903
+ name: registryName,
904
+ contentHash: executionContentHash
905
+ });
906
+ if (pinned == null) {
907
+ logger.debug(`Could not download pinned script "${scriptName}" (registry: "${registryName}", contentHash: "${executionContentHash}") for stack trace mapping; showing raw stack trace.`);
908
+ return null;
909
+ }
910
+ return pinned.code;
911
+ }
891
912
  const result = await downloadFunctionScript({
892
913
  client,
893
914
  workspaceId,
@@ -908,7 +929,7 @@ const logsCommand = defineAppCommand({
908
929
  description: "List or get function execution logs.",
909
930
  notes: `When viewing a specific execution that failed, the command displays error details with the stack trace mapped back to original source files via the inline sourcemap (clickable file links and code snippets, matching \`function test-run\` output).
910
931
 
911
- When the deployed script cannot be downloaded or the function has been redeployed since the execution, the command falls back to a plain-text error display to avoid showing misleading source locations.`,
932
+ The download is pinned to the bundle that actually ran using the execution's content hash, so stack traces stay accurate across redeploys when the server retains old bundles. The command falls back to a plain-text error display when the pinned bundle cannot be retrieved, or when the execution was recorded before content hashes started being tracked and the function was redeployed after it ran.`,
912
933
  examples: [
913
934
  {
914
935
  cmd: "",
@@ -930,7 +951,7 @@ When the deployed script cannot be downloaded or the function has been redeploye
930
951
  args: z.object({
931
952
  ...workspaceArgs,
932
953
  ...pagedLogArgs,
933
- executionId: arg(z.string().optional(), {
954
+ "execution-id": arg(z.string().optional(), {
934
955
  positional: true,
935
956
  description: "Execution ID (if provided, shows details with logs)"
936
957
  })
@@ -959,6 +980,7 @@ When the deployed script cannot be downloaded or the function has been redeploye
959
980
  workspaceId,
960
981
  scriptName: detail.scriptName,
961
982
  executionType: execution.type,
983
+ executionContentHash: execution.contentHash,
962
984
  executionStartedAt: detail.startedAt
963
985
  }) : null
964
986
  });
@@ -1543,7 +1565,7 @@ const generateCommand = defineAppCommand({
1543
1565
  })
1544
1566
  }).strict(),
1545
1567
  run: async (args) => {
1546
- const { initTelemetry } = await import("../telemetry-BvI1EgMG.mjs");
1568
+ const { initTelemetry } = await import("../telemetry-21afNV9_.mjs");
1547
1569
  await initTelemetry();
1548
1570
  await generate({
1549
1571
  configPath: args.config,
@@ -3731,7 +3753,7 @@ const upgradeCommand = defineAppCommand({
3731
3753
  })
3732
3754
  }).strict(),
3733
3755
  run: async (args) => {
3734
- const { initTelemetry } = await import("../telemetry-BvI1EgMG.mjs");
3756
+ const { initTelemetry } = await import("../telemetry-21afNV9_.mjs");
3735
3757
  await initTelemetry();
3736
3758
  const { upgrade } = await import("../service-CCgw66c6.mjs");
3737
3759
  await upgrade({
@@ -4107,9 +4129,9 @@ const mainCommand = withCompletionCommand(defineCommand({
4107
4129
  description: packageJson.description || "Tailor CLI for managing Tailor Platform SDK applications",
4108
4130
  subCommands: {
4109
4131
  api: apiCommand,
4110
- apply: applyCommand,
4111
4132
  authconnection: authconnectionCommand,
4112
- "crash-report": crashReportCommand,
4133
+ crashreport: crashReportCommand,
4134
+ deploy: deployCommand$1,
4113
4135
  executor: executorCommand,
4114
4136
  function: functionCommand,
4115
4137
  generate: generateCommand,
@@ -4149,11 +4171,11 @@ runMain(mainCommand, {
4149
4171
  if (isVerbose() && error.stack) logger.debug(`\nStack trace:\n${error.stack}`);
4150
4172
  } else logger.error(`Unknown error: ${error}`);
4151
4173
  if (!isCLIError(error) && (!(error instanceof Error) || error instanceof TypeError || error instanceof RangeError)) {
4152
- const { reportCrash } = await import("../crash-report-BUHzuzDn.mjs");
4174
+ const { reportCrash } = await import("../crashreport-6mcMyWu4.mjs");
4153
4175
  await reportCrash(error, "handledError");
4154
4176
  }
4155
4177
  }
4156
- const { shutdownTelemetry } = await import("../telemetry-BvI1EgMG.mjs");
4178
+ const { shutdownTelemetry } = await import("../telemetry-21afNV9_.mjs");
4157
4179
  await shutdownTelemetry();
4158
4180
  }
4159
4181
  });