@tailor-platform/sdk 1.57.0 → 1.58.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 (32) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/{application-CdkoGX27.mjs → application-B59TaTk_.mjs} +4 -3
  3. package/dist/{application-CdkoGX27.mjs.map → application-B59TaTk_.mjs.map} +1 -1
  4. package/dist/application-gO_pa5BO.mjs +4 -0
  5. package/dist/cli/index.mjs +164 -13
  6. package/dist/cli/index.mjs.map +1 -1
  7. package/dist/cli/lib.d.mts +581 -2
  8. package/dist/cli/lib.mjs +3 -3
  9. package/dist/{client-DLPEPJ_s.mjs → client-62B-r3MN.mjs} +39 -10
  10. package/dist/client-62B-r3MN.mjs.map +1 -0
  11. package/dist/{client-DrzwCD1W.mjs → client-BWl3f1XS.mjs} +1 -1
  12. package/dist/configure/index.d.mts +2 -2
  13. package/dist/{crashreport-Bm2mN5tg.mjs → crashreport-CCGpLUlP.mjs} +2 -2
  14. package/dist/{crashreport-Bm2mN5tg.mjs.map → crashreport-CCGpLUlP.mjs.map} +1 -1
  15. package/dist/{crashreport-C5oHvHUC.mjs → crashreport-CXD_Kjk-.mjs} +1 -1
  16. package/dist/{index-B61gFI9a.d.mts → index-BWoHfE-i.d.mts} +3 -2
  17. package/dist/{runtime-1YuaoNr8.mjs → runtime-BC-FbQkg.mjs} +149 -133
  18. package/dist/runtime-BC-FbQkg.mjs.map +1 -0
  19. package/dist/utils/test/index.d.mts +2 -2
  20. package/dist/{workflow.generated-Kz-nQrTf.d.mts → workflow.generated-CV77NlFp.d.mts} +3 -2
  21. package/docs/cli/application.md +5 -5
  22. package/docs/cli/auth.md +55 -6
  23. package/docs/cli/function.md +2 -2
  24. package/docs/cli/staticwebsite.md +137 -0
  25. package/docs/cli-reference.md +17 -14
  26. package/docs/generator/builtin.md +1 -1
  27. package/docs/services/auth.md +0 -11
  28. package/docs/services/staticwebsite.md +13 -0
  29. package/package.json +4 -4
  30. package/dist/application-x_mURdR0.mjs +0 -4
  31. package/dist/client-DLPEPJ_s.mjs.map +0 -1
  32. package/dist/runtime-1YuaoNr8.mjs.map +0 -1
@@ -0,0 +1,4 @@
1
+
2
+ import { n as generatePluginFilesIfNeeded, r as loadApplication, t as defineApplication } from "./application-B59TaTk_.mjs";
3
+
4
+ export { defineApplication };
@@ -1,14 +1,14 @@
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-DLPEPJ_s.mjs";
3
+ import { E as CustomDomainStatus, K as PATScope, M as FunctionExecution_Type, c as fetchUserInfo, d as initOperatorClient, h as userAgent, i as fetchAll, n as closeConnectionPool, o as fetchPaged, s as fetchPlatformMachineUserToken, u as initOAuth2Client, z as AuthInvokerSchema } from "../client-62B-r3MN.mjs";
4
4
  import { n as logger, r as styles } from "../logger-DpJyJvNz.mjs";
5
- import { $ as listCommand$10, An as toPageDirection, At as startCommand, B as logBetaWarning, C as listCommand$13, Cn as commonArgs, Dn as isVerbose, Dt as jobsCommand, E as resumeCommand, En as deploymentArgs, F as writeDbTypesFile, Gt as parseMigrationLabelNumber, H as removeCommand$1, Ht as executeScript, I as getConfiguredEditorCommand, K as treeCommand, L as openInConfiguredEditor, Lt as functionExecutionStatusToString, Mt as getCommand$6, N as generateCommand$1, O as listCommand$12, On as pagedLogArgs, P as generateMigrationScript, Pt as executionsCommand, Rt as formatKeyValueTable, Sn as defineAppCommand, St as triggerCommand, T as healthCommand, Tn as confirmationArgs, U as updateCommand$3, Vt as deploy, Y as getCommand$5, Yt as INITIAL_SCHEMA_NUMBER, Z as updateCommand$2, _n as generateUserTypes, at as createCommand$3, b as createCommand$4, c as listCommand$14, cn as reconstructSnapshotFromMigrations, f as restoreCommand, ft as tokenCommand, g as getCommand$7, gn as PluginManager, gt as listCommand$7, hn as trnPrefix, ht as generate, i as updateCommand$4, in as getMigrationFiles, j as truncateCommand, jn as workspaceArgs, kn as paginationArgs, ln as formatMigrationNumber, lt as getCommand$3, m as listCommand$15, mn as sdkNameLabelKey, o as removeCommand, on as isValidMigrationNumber, pn as getNamespacesWithMigrations, pt as listCommand$8, q as listCommand$11, r as queryCommand, rn as getMigrationFilePath, rt as deleteCommand$3, sn as loadDiff, st as listCommand$9, t as isNativeTypeScriptRuntime, tt as getCommand$4, u as inviteCommand, v as deleteCommand$4, vn as prompt, vt as getCommand$2, wn as configArg, wt as listCommand$6, xn as assertWritable, xt as webhookCommand, yn as apiCommand, z as showCommand, zt as getCommand$1 } from "../runtime-1YuaoNr8.mjs";
6
- import { A as resolveTokens, C as loadConfig, E as loadAccessToken, M as writePlatformConfig, O as loadWorkspaceId, T as fetchLatestToken, _ as createLogLevelTreeshakeOptions, a as WorkflowJobSchema, b as getDistDir, g as composeFunctionTreeshakeOptions, i as resolveInlineSourcemap, j as saveUserTokens, k as readPlatformConfig, l as ExecutorSchema, o as ResolverSchema, t as defineApplication, u as INVOKER_EXPR, v as resolveBundleLogLevel, w as deleteUserTokens, x as hashContent } from "../application-CdkoGX27.mjs";
5
+ import { $ as listCommand$10, An as toPageDirection, At as startCommand, B as logBetaWarning, C as listCommand$13, Cn as commonArgs, Dn as isVerbose, Dt as jobsCommand, E as resumeCommand, En as deploymentArgs, F as writeDbTypesFile, Gt as parseMigrationLabelNumber, H as removeCommand$1, Ht as executeScript, I as getConfiguredEditorCommand, K as treeCommand, L as openInConfiguredEditor, Lt as functionExecutionStatusToString, Mt as getCommand$6, N as generateCommand$1, O as listCommand$12, On as pagedLogArgs, P as generateMigrationScript, Pt as executionsCommand, Rt as formatKeyValueTable, Sn as defineAppCommand, St as triggerCommand, T as healthCommand, Tn as confirmationArgs, U as updateCommand$3, Vt as deploy, Y as getCommand$5, Yt as INITIAL_SCHEMA_NUMBER, Z as updateCommand$2, _n as generateUserTypes, at as createCommand$3, b as createCommand$4, c as listCommand$14, cn as reconstructSnapshotFromMigrations, f as restoreCommand, ft as tokenCommand, g as getCommand$7, gn as PluginManager, gt as listCommand$7, hn as sdkNameLabelKey, ht as generate, i as updateCommand$4, in as getMigrationFiles, j as truncateCommand, jn as workspaceArgs, kn as paginationArgs, ln as formatMigrationNumber, lt as getCommand$3, m as listCommand$15, mn as resourceTrn, o as removeCommand, on as isValidMigrationNumber, pn as getNamespacesWithMigrations, pt as listCommand$8, q as listCommand$11, r as queryCommand, rn as getMigrationFilePath, rt as deleteCommand$3, sn as loadDiff, st as listCommand$9, t as isNativeTypeScriptRuntime, tt as getCommand$4, u as inviteCommand, v as deleteCommand$4, vn as prompt, vt as getCommand$2, wn as configArg, wt as listCommand$6, xn as assertWritable, xt as webhookCommand, yn as apiCommand, z as showCommand, zt as getCommand$1 } from "../runtime-BC-FbQkg.mjs";
6
+ import { A as resolveTokens, C as loadConfig, E as loadAccessToken, M as writePlatformConfig, O as loadWorkspaceId, T as fetchLatestToken, _ as createLogLevelTreeshakeOptions, a as WorkflowJobSchema, b as getDistDir, g as composeFunctionTreeshakeOptions, i as resolveInlineSourcemap, j as saveUserTokens, k as readPlatformConfig, l as ExecutorSchema, o as ResolverSchema, t as defineApplication, u as INVOKER_EXPR, v as resolveBundleLogLevel, w as deleteUserTokens, x as hashContent } from "../application-B59TaTk_.mjs";
7
7
  import { t as multiline } from "../multiline-Cf9ODpr1.mjs";
8
8
  import { r as isPluginGeneratedType } from "../seed-C0fE2sJB.mjs";
9
9
  import { t as readPackageJson } from "../package-json-DcQApfPQ.mjs";
10
10
  import { n as isCLIError } from "../errors-EsY4XO6O.mjs";
11
- import { a as JSON_FOOTER_MARKER, i as CRASH_LOG_EXTENSION, o as parseCrashReportConfig, r as sendCrashReport, t as initCrashReporting } from "../crashreport-Bm2mN5tg.mjs";
11
+ import { a as JSON_FOOTER_MARKER, i as CRASH_LOG_EXTENSION, o as parseCrashReportConfig, r as sendCrashReport, t as initCrashReporting } from "../crashreport-CCGpLUlP.mjs";
12
12
  import { arg, defineCommand, runCommand, runMain } from "politty";
13
13
  import { withCompletionCommand } from "politty/completion";
14
14
  import { z } from "zod";
@@ -161,6 +161,45 @@ const authorizeAuthConnectionCommand = defineAppCommand({
161
161
  }
162
162
  });
163
163
 
164
+ //#endregion
165
+ //#region src/cli/commands/authconnection/delete.ts
166
+ const deleteAuthConnectionCommand = defineAppCommand({
167
+ name: "delete",
168
+ description: "Delete an auth connection entirely.",
169
+ args: z.object({
170
+ ...workspaceArgs,
171
+ ...connectionNameArgs,
172
+ ...confirmationArgs
173
+ }).strict(),
174
+ run: async (args) => {
175
+ await assertWritable({ profile: args.profile });
176
+ const client = await initOperatorClient(await loadAccessToken({
177
+ useProfile: true,
178
+ profile: args.profile
179
+ }));
180
+ const workspaceId = await loadWorkspaceId({
181
+ workspaceId: args["workspace-id"],
182
+ profile: args.profile
183
+ });
184
+ if (!args.yes) {
185
+ if (await prompt.text({ message: `Enter the connection name to confirm deletion ("${args.name}"):` }) !== args.name) {
186
+ logger.info("Auth connection deletion cancelled.");
187
+ return;
188
+ }
189
+ }
190
+ try {
191
+ await client.deleteAuthConnection({
192
+ workspaceId,
193
+ connectionName: args.name
194
+ });
195
+ } catch (error) {
196
+ if (error instanceof ConnectError && error.code === Code.NotFound) throw new Error(`Auth connection "${args.name}" not found.`, { cause: error });
197
+ throw error;
198
+ }
199
+ logger.success(`Auth connection "${args.name}" deleted.`);
200
+ }
201
+ });
202
+
164
203
  //#endregion
165
204
  //#region src/cli/commands/authconnection/list.ts
166
205
  function connectionInfo(connection) {
@@ -218,7 +257,8 @@ const listAuthConnectionCommand = defineAppCommand({
218
257
  //#region src/cli/commands/authconnection/revoke.ts
219
258
  const revokeAuthConnectionCommand = defineAppCommand({
220
259
  name: "revoke",
221
- description: "Revoke an auth connection.",
260
+ description: "Revoke an auth connection's tokens (keeps the connection; use 'delete' to remove it).",
261
+ notes: "Revoke invalidates the connection's active session and tokens but keeps the connection and its stored credentials, so it can be re-authorized later. Use `delete` to remove the connection entirely.",
222
262
  args: z.object({
223
263
  ...workspaceArgs,
224
264
  ...connectionNameArgs,
@@ -261,7 +301,8 @@ const authconnectionCommand = defineCommand({
261
301
  subCommands: {
262
302
  authorize: authorizeAuthConnectionCommand,
263
303
  list: listAuthConnectionCommand,
264
- revoke: revokeAuthConnectionCommand
304
+ revoke: revokeAuthConnectionCommand,
305
+ delete: deleteAuthConnectionCommand
265
306
  },
266
307
  async run() {
267
308
  await runCommand(listAuthConnectionCommand, []);
@@ -947,9 +988,9 @@ async function downloadScriptForMapping(options) {
947
988
  const logsCommand = defineAppCommand({
948
989
  name: "logs",
949
990
  description: "List or get function execution logs.",
950
- 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).
991
+ notes: `When viewing a specific execution that failed, the command displays error details with the stack trace mapped back to your original source files (clickable file links and code snippets, matching \`function test-run\` output).
951
992
 
952
- 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.`,
993
+ Stack traces stay accurate even after later redeploys, because the trace is resolved against the exact build that produced the execution. If that build is no longer available, the command falls back to a plain-text error display.`,
953
994
  examples: [
954
995
  {
955
996
  cmd: "",
@@ -2084,7 +2125,7 @@ const secretValueArgs = {
2084
2125
  */
2085
2126
  async function checkVaultManaged(params) {
2086
2127
  const { client, workspaceId, vaultName } = params;
2087
- const trn = `${trnPrefix(workspaceId)}:vault:${vaultName}`;
2128
+ const trn = resourceTrn(workspaceId, "vault", vaultName);
2088
2129
  const notManaged = {
2089
2130
  isManaged: false,
2090
2131
  trn,
@@ -2984,6 +3025,115 @@ const deployCommand = defineAppCommand({
2984
3025
  }
2985
3026
  });
2986
3027
 
3028
+ //#endregion
3029
+ //#region src/cli/commands/staticwebsite/domain/status.ts
3030
+ const statusLabels = {
3031
+ [CustomDomainStatus.UNSPECIFIED]: "unspecified",
3032
+ [CustomDomainStatus.PENDING]: "pending",
3033
+ [CustomDomainStatus.VERIFYING]: "verifying",
3034
+ [CustomDomainStatus.CERT_ISSUED]: "cert_issued",
3035
+ [CustomDomainStatus.ACTIVE]: "active",
3036
+ [CustomDomainStatus.FAILED]: "failed"
3037
+ };
3038
+
3039
+ //#endregion
3040
+ //#region src/cli/commands/staticwebsite/domain/get.ts
3041
+ const domainGetCommand = defineAppCommand({
3042
+ name: "get",
3043
+ description: "Get details of a custom domain.",
3044
+ args: z.object({
3045
+ ...workspaceArgs,
3046
+ domain: arg(z.string(), {
3047
+ positional: true,
3048
+ description: "Custom domain name"
3049
+ })
3050
+ }).strict(),
3051
+ run: async (args) => {
3052
+ const client = await initOperatorClient(await loadAccessToken({
3053
+ useProfile: true,
3054
+ profile: args.profile
3055
+ }));
3056
+ const workspaceId = await loadWorkspaceId({
3057
+ workspaceId: args["workspace-id"],
3058
+ profile: args.profile
3059
+ });
3060
+ const notFoundErrorMessage = `Custom domain "${args.domain}" not found.`;
3061
+ try {
3062
+ const { customDomain } = await client.getCustomDomain({
3063
+ workspaceId,
3064
+ domain: args.domain
3065
+ });
3066
+ if (!customDomain) throw new Error(notFoundErrorMessage);
3067
+ const info = {
3068
+ domain: customDomain.domain,
3069
+ status: statusLabels[customDomain.status] ?? "unknown",
3070
+ trafficCnameTarget: customDomain.trafficCnameTarget,
3071
+ certificateCnameTarget: customDomain.certificateCnameTarget,
3072
+ errorMessage: customDomain.errorMessage || void 0
3073
+ };
3074
+ logger.out(info);
3075
+ } catch (error) {
3076
+ if (error instanceof ConnectError && error.code === Code.NotFound) throw new Error(notFoundErrorMessage, { cause: error });
3077
+ throw error;
3078
+ }
3079
+ }
3080
+ });
3081
+
3082
+ //#endregion
3083
+ //#region src/cli/commands/staticwebsite/domain/list.ts
3084
+ const domainListCommand = defineAppCommand({
3085
+ name: "list",
3086
+ description: "List custom domains for a static website.",
3087
+ args: z.object({
3088
+ ...workspaceArgs,
3089
+ name: arg(z.string(), {
3090
+ positional: true,
3091
+ description: "Static website name"
3092
+ })
3093
+ }).strict(),
3094
+ run: async (args) => {
3095
+ const client = await initOperatorClient(await loadAccessToken({
3096
+ useProfile: true,
3097
+ profile: args.profile
3098
+ }));
3099
+ const workspaceId = await loadWorkspaceId({
3100
+ workspaceId: args["workspace-id"],
3101
+ profile: args.profile
3102
+ });
3103
+ try {
3104
+ const { customDomains } = await client.listCustomDomains({
3105
+ workspaceId,
3106
+ staticWebsiteName: args.name
3107
+ });
3108
+ if (customDomains.length === 0) {
3109
+ logger.info("No custom domains found.");
3110
+ return;
3111
+ }
3112
+ const formatted = customDomains.map((d) => ({
3113
+ domain: d.domain,
3114
+ status: statusLabels[d.status] ?? "unknown",
3115
+ trafficCnameTarget: d.trafficCnameTarget,
3116
+ certificateCnameTarget: d.certificateCnameTarget
3117
+ }));
3118
+ logger.out(formatted);
3119
+ } catch (error) {
3120
+ if (error instanceof ConnectError && error.code === Code.NotFound) throw new Error(`Static website "${args.name}" not found.`, { cause: error });
3121
+ throw error;
3122
+ }
3123
+ }
3124
+ });
3125
+
3126
+ //#endregion
3127
+ //#region src/cli/commands/staticwebsite/domain/index.ts
3128
+ const domainCommand = defineCommand({
3129
+ name: "domain",
3130
+ description: "Manage custom domains for static websites.",
3131
+ subCommands: {
3132
+ list: domainListCommand,
3133
+ get: domainGetCommand
3134
+ }
3135
+ });
3136
+
2987
3137
  //#endregion
2988
3138
  //#region src/cli/commands/staticwebsite/get.ts
2989
3139
  const getCommand = defineAppCommand({
@@ -3098,6 +3248,7 @@ const staticwebsiteCommand = defineCommand({
3098
3248
  description: "Manage static websites in your workspace.",
3099
3249
  subCommands: {
3100
3250
  deploy: deployCommand,
3251
+ domain: domainCommand,
3101
3252
  list: listCommand$2,
3102
3253
  get: getCommand
3103
3254
  },
@@ -4055,10 +4206,10 @@ async function set(options) {
4055
4206
  useProfile: false,
4056
4207
  profile: options.profile
4057
4208
  }));
4058
- const trn = `${trnPrefix(await loadWorkspaceId({
4209
+ const trn = resourceTrn(await loadWorkspaceId({
4059
4210
  workspaceId: options.workspaceId,
4060
4211
  profile: options.profile
4061
- }))}:tailordb:${targetNamespace}`;
4212
+ }), "tailordb", targetNamespace);
4062
4213
  let currentMigration;
4063
4214
  try {
4064
4215
  const { metadata } = await client.getMetadata({ trn });
@@ -4147,7 +4298,7 @@ async function collectMigrationStatuses(options) {
4147
4298
  });
4148
4299
  const statuses = [];
4149
4300
  for (const { namespace, migrationsDir } of targetNamespaces) {
4150
- const trn = `${trnPrefix(workspaceId)}:tailordb:${namespace}`;
4301
+ const trn = resourceTrn(workspaceId, "tailordb", namespace);
4151
4302
  let currentMigration;
4152
4303
  try {
4153
4304
  const { metadata } = await client.getMetadata({ trn });
@@ -4703,7 +4854,7 @@ runMain(mainCommand, {
4703
4854
  if (isVerbose() && error.stack) logger.debug(`\nStack trace:\n${error.stack}`);
4704
4855
  } else logger.error(`Unknown error: ${error}`);
4705
4856
  if (!isCLIError(error) && (!(error instanceof Error) || error instanceof TypeError || error instanceof RangeError)) {
4706
- const { reportCrash } = await import("../crashreport-C5oHvHUC.mjs");
4857
+ const { reportCrash } = await import("../crashreport-CXD_Kjk-.mjs");
4707
4858
  await reportCrash(error, "handledError");
4708
4859
  }
4709
4860
  }