@tailor-platform/sdk 1.26.0 → 1.27.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 (61) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/application-CBJFUKrU.mjs +4701 -0
  3. package/dist/application-CBJFUKrU.mjs.map +1 -0
  4. package/dist/application-WyZetOky.mjs +11 -0
  5. package/dist/cli/index.mjs +140 -31
  6. package/dist/cli/index.mjs.map +1 -1
  7. package/dist/cli/lib.d.mts +6 -6
  8. package/dist/cli/lib.mjs +10 -8
  9. package/dist/cli/lib.mjs.map +1 -1
  10. package/dist/client-C2_wgujH.mjs +6 -0
  11. package/dist/{application-D9xahQRQ.mjs → client-bTbnbQbB.mjs} +8 -4877
  12. package/dist/{application-D9xahQRQ.mjs.map → client-bTbnbQbB.mjs.map} +1 -1
  13. package/dist/configure/index.d.mts +4 -4
  14. package/dist/crash-report-Cot_9Esm.mjs +6 -0
  15. package/dist/crash-report-Ju8cQF-l.mjs +414 -0
  16. package/dist/crash-report-Ju8cQF-l.mjs.map +1 -0
  17. package/dist/{enum-constants-6uK0VI_s.mjs → enum-constants-D1nfn0qD.mjs} +1 -1
  18. package/dist/{enum-constants-6uK0VI_s.mjs.map → enum-constants-D1nfn0qD.mjs.map} +1 -1
  19. package/dist/{env-CSsVESbH.d.mts → env-BuMbIknz.d.mts} +2 -2
  20. package/dist/{file-utils-2T9w20FP.mjs → file-utils-Bctuzn3x.mjs} +1 -1
  21. package/dist/{file-utils-2T9w20FP.mjs.map → file-utils-Bctuzn3x.mjs.map} +1 -1
  22. package/dist/{index-DgRShBpu.d.mts → index-B0Lrzywd.d.mts} +2 -2
  23. package/dist/{index-BtYPY8ya.d.mts → index-CbnLNm14.d.mts} +2 -2
  24. package/dist/{index-DkJbItB-.d.mts → index-CyapgSFI.d.mts} +2 -2
  25. package/dist/{index-BKy-OC5C.d.mts → index-D1AM_02Y.d.mts} +2 -2
  26. package/dist/{index-BJg0DTbR.d.mts → index-cD9sQLTh.d.mts} +15 -15
  27. package/dist/{interceptor-BPiIBTk_.mjs → interceptor-B0d_GrI5.mjs} +1 -1
  28. package/dist/{interceptor-BPiIBTk_.mjs.map → interceptor-B0d_GrI5.mjs.map} +1 -1
  29. package/dist/{kysely-type-cMNbsQ6k.mjs → kysely-type-B_IecdK9.mjs} +1 -1
  30. package/dist/{kysely-type-cMNbsQ6k.mjs.map → kysely-type-B_IecdK9.mjs.map} +1 -1
  31. package/dist/logger-CqezTedh.mjs +181 -0
  32. package/dist/logger-CqezTedh.mjs.map +1 -0
  33. package/dist/{package-json-CVUv8Y9T.mjs → package-json-D3x2nBPB.mjs} +1 -1
  34. package/dist/{package-json-CVUv8Y9T.mjs.map → package-json-D3x2nBPB.mjs.map} +1 -1
  35. package/dist/package-json-DHfTiUCS.mjs +4 -0
  36. package/dist/plugin/builtin/enum-constants/index.d.mts +1 -1
  37. package/dist/plugin/builtin/enum-constants/index.mjs +1 -1
  38. package/dist/plugin/builtin/file-utils/index.d.mts +1 -1
  39. package/dist/plugin/builtin/file-utils/index.mjs +1 -1
  40. package/dist/plugin/builtin/kysely-type/index.d.mts +1 -1
  41. package/dist/plugin/builtin/kysely-type/index.mjs +1 -1
  42. package/dist/plugin/builtin/seed/index.d.mts +1 -1
  43. package/dist/plugin/builtin/seed/index.mjs +1 -1
  44. package/dist/plugin/index.d.mts +2 -2
  45. package/dist/{plugin-B1hNwcCC.d.mts → plugin-D3a0-qe0.d.mts} +6 -2
  46. package/dist/{query-B8ml6ClT.mjs → query-CgGbAmUg.mjs} +9 -6
  47. package/dist/query-CgGbAmUg.mjs.map +1 -0
  48. package/dist/{seed-CCVRLibh.mjs → seed-CWkIDWMb.mjs} +1 -1
  49. package/dist/{seed-CCVRLibh.mjs.map → seed-CWkIDWMb.mjs.map} +1 -1
  50. package/dist/{telemetry-DDQZRqHK.mjs → telemetry-BevrwWwF.mjs} +1 -1
  51. package/dist/{telemetry-0w8OupuQ.mjs → telemetry-VvNfsyEE.mjs} +2 -2
  52. package/dist/{telemetry-0w8OupuQ.mjs.map → telemetry-VvNfsyEE.mjs.map} +1 -1
  53. package/dist/utils/test/index.d.mts +2 -2
  54. package/dist/{workflow.generated-Bm4b8hEk.d.mts → workflow.generated-BsgIlrH-.d.mts} +2 -2
  55. package/docs/cli/crash-report.md +107 -0
  56. package/docs/cli-reference.md +11 -0
  57. package/docs/services/resolver.md +32 -0
  58. package/package.json +1 -1
  59. package/dist/application-CxH6Yp54.mjs +0 -9
  60. package/dist/package-json-Bj76LPsV.mjs +0 -4
  61. package/dist/query-B8ml6ClT.mjs.map +0 -1
@@ -0,0 +1,11 @@
1
+ import "./chunk-Cz-A8uMR.mjs";
2
+ import "./brand-GZnI4eYb.mjs";
3
+ import "./logger-CqezTedh.mjs";
4
+ import "./client-bTbnbQbB.mjs";
5
+ import "./package-json-D3x2nBPB.mjs";
6
+ import { n as generatePluginFilesIfNeeded, r as loadApplication, t as defineApplication } from "./application-CBJFUKrU.mjs";
7
+ import "./seed-CWkIDWMb.mjs";
8
+ import "./file-utils-Bctuzn3x.mjs";
9
+ import "./kysely-type-B_IecdK9.mjs";
10
+
11
+ export { defineApplication };
@@ -2,13 +2,16 @@
2
2
  import "../chunk-Cz-A8uMR.mjs";
3
3
  import "../schema-BePzTFBV.mjs";
4
4
  import "../brand-GZnI4eYb.mjs";
5
- import { C as fetchAll, D as initOperatorClient, E as initOAuth2Client, S as writePlatformConfig, T as fetchUserInfo, U as FunctionExecution_Type, Y as AuthInvokerSchema, a as loadConfig, b as loadWorkspaceId, c as ExecutorSchema, g as getDistDir, i as resolveInlineSourcemap, mt as styles, nt as PATScope, o as WorkflowJobSchema, pt as logger, u as ResolverSchema, v as fetchLatestToken, x as readPlatformConfig, y as loadAccessToken } from "../application-D9xahQRQ.mjs";
6
- import { C as listCommand$9, E as resumeCommand, F as showCommand, Ft as isValidMigrationNumber, G as listCommand$6, Ht as prompt, I as logBetaWarning, It as loadDiff, Jt as commonArgs, Kt as apiCommand, Mt as getMigrationFilePath, N as generateCommand$1, Nt as getMigrationFiles, O as listCommand$8, Q as listCommand$5, Qt as workspaceArgs, R as removeCommand$1, T as healthCommand, Ut as trnPrefix, V as getCommand$2, Vt as getNamespacesWithMigrations, W as tokenCommand, X as triggerCommand, Xt as deploymentArgs, Y as webhookCommand, Yt as confirmationArgs, Zt as isVerbose, b as createCommand$3, c as listCommand$10, ct as executionsCommand, dt as functionExecutionStatusToString, f as restoreCommand, ft as formatKeyValueTable, g as getCommand$4, gt as executeScript, ht as apply, i as updateCommand$2, it as startCommand, j as truncateCommand, kt as formatMigrationNumber, m as listCommand$11, n as queryCommand, o as removeCommand, ot as getCommand$3, pt as getCommand$1, q as generate, qt as defineAppCommand, r as isCLIError, tt as jobsCommand, u as inviteCommand, v as deleteCommand$3, yt as parseMigrationLabelNumber, z as listCommand$7 } from "../query-B8ml6ClT.mjs";
7
- import { t as readPackageJson } from "../package-json-CVUv8Y9T.mjs";
8
- import "../seed-CCVRLibh.mjs";
9
- import "../file-utils-2T9w20FP.mjs";
10
- import "../kysely-type-cMNbsQ6k.mjs";
11
- import "../telemetry-0w8OupuQ.mjs";
5
+ import { n as logger, r as styles } from "../logger-CqezTedh.mjs";
6
+ import { C as listCommand$10, E as resumeCommand, F as showCommand, Ft as isValidMigrationNumber, G as listCommand$7, Ht as prompt, I as logBetaWarning, It as loadDiff, Jt as commonArgs, Kt as apiCommand, Mt as getMigrationFilePath, N as generateCommand$1, Nt as getMigrationFiles, O as listCommand$9, Q as listCommand$6, Qt as workspaceArgs, R as removeCommand$1, T as healthCommand, Ut as trnPrefix, V as getCommand$2, Vt as getNamespacesWithMigrations, W as tokenCommand, X as triggerCommand, Xt as deploymentArgs, Y as webhookCommand, Yt as confirmationArgs, Zt as isVerbose, b as createCommand$3, c as listCommand$11, ct as executionsCommand, dt as functionExecutionStatusToString, f as restoreCommand, ft as formatKeyValueTable, g as getCommand$4, gt as executeScript, ht as apply, i as updateCommand$2, it as startCommand, j as truncateCommand, kt as formatMigrationNumber, m as listCommand$12, n as queryCommand, o as removeCommand, ot as getCommand$3, pt as getCommand$1, q as generate, qt as defineAppCommand, r as isCLIError, tt as jobsCommand, u as inviteCommand, v as deleteCommand$3, yt as parseMigrationLabelNumber, z as listCommand$8 } from "../query-CgGbAmUg.mjs";
7
+ import { A as AuthInvokerSchema, L as PATScope, d as userAgent, i as fetchUserInfo, n as fetchAll, o as initOAuth2Client, s as initOperatorClient, w as FunctionExecution_Type } from "../client-bTbnbQbB.mjs";
8
+ import { t as readPackageJson } from "../package-json-D3x2nBPB.mjs";
9
+ import { S as writePlatformConfig, a as loadConfig, b as loadWorkspaceId, c as ExecutorSchema, g as getDistDir, i as resolveInlineSourcemap, o as WorkflowJobSchema, u as ResolverSchema, v as fetchLatestToken, x as readPlatformConfig, y as loadAccessToken } from "../application-CBJFUKrU.mjs";
10
+ import "../seed-CWkIDWMb.mjs";
11
+ import "../file-utils-Bctuzn3x.mjs";
12
+ import "../kysely-type-B_IecdK9.mjs";
13
+ import "../telemetry-VvNfsyEE.mjs";
14
+ import { a as JSON_FOOTER_MARKER, i as CRASH_LOG_EXTENSION, o as parseCrashReportConfig, r as sendCrashReport, t as initCrashReporting } from "../crash-report-Ju8cQF-l.mjs";
12
15
  import { createRequire, register } from "node:module";
13
16
  import { arg, defineCommand, runCommand, runMain } from "politty";
14
17
  import { withCompletionCommand } from "politty/completion";
@@ -48,7 +51,7 @@ const applyCommand = defineAppCommand({
48
51
  "clean-cache": arg(z.boolean().optional(), { description: "Clean the bundle cache before building" })
49
52
  }).strict(),
50
53
  run: async (args) => {
51
- const { initTelemetry } = await import("../telemetry-DDQZRqHK.mjs");
54
+ const { initTelemetry } = await import("../telemetry-BevrwWwF.mjs");
52
55
  await initTelemetry();
53
56
  await apply({
54
57
  workspaceId: args["workspace-id"],
@@ -63,20 +66,118 @@ const applyCommand = defineAppCommand({
63
66
  }
64
67
  });
65
68
 
69
+ //#endregion
70
+ //#region src/cli/commands/crash-report/list.ts
71
+ const listCommand$5 = defineAppCommand({
72
+ name: "list",
73
+ description: "List local crash report files.",
74
+ args: z.object({}).strict(),
75
+ run: async () => {
76
+ const config = parseCrashReportConfig();
77
+ if (!config.localDir) {
78
+ logger.info("Crash report directory not available.");
79
+ return;
80
+ }
81
+ let entries;
82
+ try {
83
+ entries = fs$1.readdirSync(config.localDir);
84
+ } catch {
85
+ logger.info("No crash reports found.");
86
+ return;
87
+ }
88
+ const files = entries.filter((f) => f.endsWith(CRASH_LOG_EXTENSION)).sort().reverse();
89
+ if (files.length === 0) {
90
+ logger.info("No crash reports found.");
91
+ return;
92
+ }
93
+ logger.info(`${files.length} crash report(s) in ${config.localDir}:`);
94
+ for (const file of files) logger.log(` ${file}`);
95
+ }
96
+ });
97
+
98
+ //#endregion
99
+ //#region src/cli/commands/crash-report/send.ts
100
+ const sendCommand = defineAppCommand({
101
+ name: "send",
102
+ description: "Submit a crash report to help improve the SDK.",
103
+ args: z.object({ file: arg(z.string(), {
104
+ description: "Path to the crash report file",
105
+ required: true,
106
+ completion: {
107
+ type: "file",
108
+ extensions: ["log"]
109
+ }
110
+ }) }).strict(),
111
+ run: async (args) => {
112
+ let content;
113
+ try {
114
+ content = fs$1.readFileSync(args.file, "utf-8");
115
+ } catch {
116
+ logger.error(`Crash report file not found: ${args.file}`);
117
+ process.exit(1);
118
+ }
119
+ const report = parseCrashLogFile(content);
120
+ if (!report) {
121
+ logger.error("Failed to parse crash report file. The file may be corrupted.");
122
+ process.exit(1);
123
+ }
124
+ const ua = await userAgent();
125
+ logger.info("Sending crash report...");
126
+ if (await sendCrashReport(report, ua)) logger.success("Crash report submitted successfully. Thank you!");
127
+ else {
128
+ logger.error("Failed to submit crash report. The server may be unavailable.");
129
+ process.exit(1);
130
+ }
131
+ }
132
+ });
133
+ /**
134
+ * Parse a crash log file back into a CrashReport object.
135
+ * Reads the embedded JSON footer appended by formatCrashReport.
136
+ * @param content - File content
137
+ * @returns Parsed report or undefined if parsing fails
138
+ */
139
+ function parseCrashLogFile(content) {
140
+ try {
141
+ const normalized = content.replace(/\r\n/g, "\n");
142
+ const marker = `\n${JSON_FOOTER_MARKER}\n`;
143
+ const lastIdx = normalized.lastIndexOf(marker);
144
+ if (lastIdx === -1) return void 0;
145
+ const jsonLine = normalized.slice(lastIdx + marker.length).split("\n")[0];
146
+ if (!jsonLine) return void 0;
147
+ return JSON.parse(jsonLine);
148
+ } catch {
149
+ return;
150
+ }
151
+ }
152
+
153
+ //#endregion
154
+ //#region src/cli/commands/crash-report/index.ts
155
+ const crashReportCommand = defineCommand({
156
+ name: "crash-report",
157
+ description: "Manage crash reports.",
158
+ subCommands: {
159
+ send: sendCommand,
160
+ list: listCommand$5
161
+ },
162
+ async run() {
163
+ await runCommand(listCommand$5, []);
164
+ }
165
+ });
166
+
66
167
  //#endregion
67
168
  //#region src/cli/commands/executor/index.ts
68
169
  const executorCommand = defineCommand({
69
170
  name: "executor",
70
171
  description: "Manage executors",
71
172
  subCommands: {
72
- list: listCommand$5,
173
+ list: listCommand$6,
73
174
  get: getCommand$1,
74
175
  jobs: jobsCommand,
75
176
  trigger: triggerCommand,
76
177
  webhook: webhookCommand
77
178
  },
78
179
  async run() {
79
- await runCommand(listCommand$5, []);
180
+ await runCommand(listCommand$6, []);
80
181
  }
81
182
  });
82
183
 
@@ -707,7 +808,7 @@ const generateCommand = defineAppCommand({
707
808
  })
708
809
  }).strict(),
709
810
  run: async (args) => {
710
- const { initTelemetry } = await import("../telemetry-DDQZRqHK.mjs");
811
+ const { initTelemetry } = await import("../telemetry-BevrwWwF.mjs");
711
812
  await initTelemetry();
712
813
  await generate({
713
814
  configPath: args.config,
@@ -875,11 +976,11 @@ const machineuserCommand = defineCommand({
875
976
  name: "machineuser",
876
977
  description: "Manage machine users in your Tailor Platform application.",
877
978
  subCommands: {
878
- list: listCommand$6,
979
+ list: listCommand$7,
879
980
  token: tokenCommand
880
981
  },
881
982
  async run() {
882
- await runCommand(listCommand$6, []);
983
+ await runCommand(listCommand$7, []);
883
984
  }
884
985
  });
885
986
 
@@ -890,10 +991,10 @@ const oauth2clientCommand = defineCommand({
890
991
  description: "Manage OAuth2 clients in your Tailor Platform application.",
891
992
  subCommands: {
892
993
  get: getCommand$2,
893
- list: listCommand$7
994
+ list: listCommand$8
894
995
  },
895
996
  async run() {
896
- await runCommand(listCommand$7, []);
997
+ await runCommand(listCommand$8, []);
897
998
  }
898
999
  });
899
1000
 
@@ -2873,14 +2974,14 @@ const workflowCommand = defineCommand({
2873
2974
  name: "workflow",
2874
2975
  description: "Manage workflows and workflow executions.",
2875
2976
  subCommands: {
2876
- list: listCommand$8,
2977
+ list: listCommand$9,
2877
2978
  get: getCommand$3,
2878
2979
  start: startCommand,
2879
2980
  executions: executionsCommand,
2880
2981
  resume: resumeCommand
2881
2982
  },
2882
2983
  async run() {
2883
- await runCommand(listCommand$8, []);
2984
+ await runCommand(listCommand$9, []);
2884
2985
  }
2885
2986
  });
2886
2987
 
@@ -2891,10 +2992,10 @@ const appCommand = defineCommand({
2891
2992
  description: "Manage workspace applications",
2892
2993
  subCommands: {
2893
2994
  health: healthCommand,
2894
- list: listCommand$9
2995
+ list: listCommand$10
2895
2996
  },
2896
2997
  async run() {
2897
- await runCommand(listCommand$9, []);
2998
+ await runCommand(listCommand$10, []);
2898
2999
  }
2899
3000
  });
2900
3001
 
@@ -2905,12 +3006,12 @@ const userCommand = defineCommand({
2905
3006
  description: "Manage workspace users",
2906
3007
  subCommands: {
2907
3008
  invite: inviteCommand,
2908
- list: listCommand$10,
3009
+ list: listCommand$11,
2909
3010
  remove: removeCommand,
2910
3011
  update: updateCommand$2
2911
3012
  },
2912
3013
  async run() {
2913
- await runCommand(listCommand$10, []);
3014
+ await runCommand(listCommand$11, []);
2914
3015
  }
2915
3016
  });
2916
3017
 
@@ -2924,18 +3025,19 @@ const workspaceCommand = defineCommand({
2924
3025
  create: createCommand$3,
2925
3026
  delete: deleteCommand$3,
2926
3027
  get: getCommand$4,
2927
- list: listCommand$11,
3028
+ list: listCommand$12,
2928
3029
  restore: restoreCommand,
2929
3030
  user: userCommand
2930
3031
  },
2931
3032
  async run() {
2932
- await runCommand(listCommand$11, []);
3033
+ await runCommand(listCommand$12, []);
2933
3034
  }
2934
3035
  });
2935
3036
 
2936
3037
  //#endregion
2937
3038
  //#region src/cli/index.ts
2938
3039
  register("tsx", import.meta.url, { data: {} });
3040
+ initCrashReporting();
2939
3041
  const packageJson = await readPackageJson();
2940
3042
  const cliName = Object.keys(packageJson.bin ?? {})[0] || "tailor-sdk";
2941
3043
  const mainCommand = withCompletionCommand(defineCommand({
@@ -2944,6 +3046,7 @@ const mainCommand = withCompletionCommand(defineCommand({
2944
3046
  subCommands: {
2945
3047
  api: apiCommand,
2946
3048
  apply: applyCommand,
3049
+ "crash-report": crashReportCommand,
2947
3050
  executor: executorCommand,
2948
3051
  function: functionCommand,
2949
3052
  generate: generateCommand,
@@ -2970,14 +3073,20 @@ runMain(mainCommand, {
2970
3073
  version: packageJson.version,
2971
3074
  globalArgs: z.object(commonArgs),
2972
3075
  cleanup: async ({ error }) => {
2973
- if (error) if (isCLIError(error)) {
2974
- logger.log(error.format());
2975
- if (isVerbose() && error.stack) logger.debug(`\nStack trace:\n${error.stack}`);
2976
- } else if (error instanceof Error) {
2977
- logger.error(error.message);
2978
- if (isVerbose() && error.stack) logger.debug(`\nStack trace:\n${error.stack}`);
2979
- } else logger.error(`Unknown error: ${error}`);
2980
- const { shutdownTelemetry } = await import("../telemetry-DDQZRqHK.mjs");
3076
+ if (error) {
3077
+ if (isCLIError(error)) {
3078
+ logger.log(error.format());
3079
+ if (isVerbose() && error.stack) logger.debug(`\nStack trace:\n${error.stack}`);
3080
+ } else if (error instanceof Error) {
3081
+ logger.error(error.message);
3082
+ if (isVerbose() && error.stack) logger.debug(`\nStack trace:\n${error.stack}`);
3083
+ } else logger.error(`Unknown error: ${error}`);
3084
+ if (!isCLIError(error) && (!(error instanceof Error) || error instanceof TypeError || error instanceof RangeError)) {
3085
+ const { reportCrash } = await import("../crash-report-Cot_9Esm.mjs");
3086
+ await reportCrash(error, "handledError");
3087
+ }
3088
+ }
3089
+ const { shutdownTelemetry } = await import("../telemetry-BevrwWwF.mjs");
2981
3090
  await shutdownTelemetry();
2982
3091
  }
2983
3092
  });