@tailor-platform/sdk 1.58.0 → 1.60.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 (80) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/dist/{application-B59TaTk_.mjs → application-FnWOxBk7.mjs} +46 -27
  3. package/dist/application-FnWOxBk7.mjs.map +1 -0
  4. package/dist/application-VOdgMtOD.mjs +4 -0
  5. package/dist/{authconnection-TsdLYaLs.d.mts → authconnection-BIYzEh2p.d.mts} +2 -2
  6. package/dist/authconnection-D8SJGMpj.mjs.map +1 -1
  7. package/dist/cli/erd-viewer-assets/app.js +4 -4
  8. package/dist/cli/index.mjs +57 -13
  9. package/dist/cli/index.mjs.map +1 -1
  10. package/dist/cli/lib.mjs +4 -3
  11. package/dist/cli/lib.mjs.map +1 -1
  12. package/dist/client-B-jRdlC_.mjs +4 -0
  13. package/dist/{client-62B-r3MN.mjs → client-W5P4NYYX.mjs} +117 -4
  14. package/dist/{client-62B-r3MN.mjs.map → client-W5P4NYYX.mjs.map} +1 -1
  15. package/dist/configure/index.d.mts +1 -1
  16. package/dist/configure/index.mjs +8 -8
  17. package/dist/configure/index.mjs.map +1 -1
  18. package/dist/{crashreport-CCGpLUlP.mjs → crashreport-D3DvAzdg.mjs} +3 -3
  19. package/dist/crashreport-D3DvAzdg.mjs.map +1 -0
  20. package/dist/{crashreport-CXD_Kjk-.mjs → crashreport-lnVTnbB5.mjs} +1 -1
  21. package/dist/file-B58Dm-2P.mjs.map +1 -1
  22. package/dist/{file-VTJbbOL3.d.mts → file-BzK8z3X-.d.mts} +2 -2
  23. package/dist/globals-ByrCoDip.mjs +109 -0
  24. package/dist/globals-ByrCoDip.mjs.map +1 -0
  25. package/dist/iconv-DreIffeM.mjs.map +1 -1
  26. package/dist/{iconv-Chu6Hit2.d.mts → iconv-kwrmd1U_.d.mts} +2 -2
  27. package/dist/{idp-Di9N4FSJ.d.mts → idp-BlBPtXJ-.d.mts} +2 -2
  28. package/dist/idp-Ch95ag8h.mjs.map +1 -1
  29. package/dist/{index-BWoHfE-i.d.mts → index-Cr6ufjZ5.d.mts} +10 -8
  30. package/dist/{index-DTSQthwF.d.mts → index-DRhMpdnA.d.mts} +7 -7
  31. package/dist/{job-CEAJLiGp.mjs → job-BpsFXPbi.mjs} +8 -17
  32. package/dist/job-BpsFXPbi.mjs.map +1 -0
  33. package/dist/mock-Dpu__UeJ.mjs +805 -0
  34. package/dist/mock-Dpu__UeJ.mjs.map +1 -0
  35. package/dist/registry-D0uB0OrK.mjs +178 -0
  36. package/dist/registry-D0uB0OrK.mjs.map +1 -0
  37. package/dist/{repl-editor-ihh8koiR.mjs → repl-editor-Y9QJDL0K.mjs} +3 -9
  38. package/dist/{repl-editor-ihh8koiR.mjs.map → repl-editor-Y9QJDL0K.mjs.map} +1 -1
  39. package/dist/runtime/authconnection.d.mts +1 -1
  40. package/dist/runtime/file.d.mts +1 -1
  41. package/dist/runtime/globals.d.mts +5 -5
  42. package/dist/runtime/iconv.d.mts +1 -1
  43. package/dist/runtime/idp.d.mts +1 -1
  44. package/dist/runtime/index.d.mts +7 -7
  45. package/dist/runtime/secretmanager.d.mts +1 -1
  46. package/dist/runtime/workflow.d.mts +1 -1
  47. package/dist/{runtime-BC-FbQkg.mjs → runtime-CrUa8Z2k.mjs} +238 -273
  48. package/dist/runtime-CrUa8Z2k.mjs.map +1 -0
  49. package/dist/secretmanager-B9h-U_8U.mjs.map +1 -1
  50. package/dist/{secretmanager-BhpDmxwT.d.mts → secretmanager-CKLB3wAQ.d.mts} +2 -2
  51. package/dist/utils/test/index.d.mts +5 -5
  52. package/dist/utils/test/index.mjs +7 -7
  53. package/dist/utils/test/index.mjs.map +1 -1
  54. package/dist/vitest/environment.mjs +3 -4
  55. package/dist/vitest/environment.mjs.map +1 -1
  56. package/dist/vitest/index.d.mts +167 -120
  57. package/dist/vitest/index.mjs +6 -6
  58. package/dist/vitest/index.mjs.map +1 -1
  59. package/dist/vitest/setup.d.mts +1 -1
  60. package/dist/vitest/setup.mjs +4 -3
  61. package/dist/vitest/setup.mjs.map +1 -1
  62. package/dist/workflow--aPbA8Uq.mjs.map +1 -1
  63. package/dist/{workflow-dYYH7QFa.d.mts → workflow-CMamswkK.d.mts} +2 -2
  64. package/docs/cli/auth.md +40 -0
  65. package/docs/cli-reference.md +1 -0
  66. package/docs/configuration.md +1 -1
  67. package/docs/runtime.md +9 -12
  68. package/docs/services/auth.md +19 -1
  69. package/docs/testing.md +92 -85
  70. package/package.json +5 -5
  71. package/dist/application-B59TaTk_.mjs.map +0 -1
  72. package/dist/application-gO_pa5BO.mjs +0 -4
  73. package/dist/client-BWl3f1XS.mjs +0 -4
  74. package/dist/crashreport-CCGpLUlP.mjs.map +0 -1
  75. package/dist/job-CEAJLiGp.mjs.map +0 -1
  76. package/dist/mock-B6PI49C_.mjs +0 -844
  77. package/dist/mock-B6PI49C_.mjs.map +0 -1
  78. package/dist/runtime-BC-FbQkg.mjs.map +0 -1
  79. package/dist/test-env-key-CSnK4W1Y.mjs +0 -30
  80. package/dist/test-env-key-CSnK4W1Y.mjs.map +0 -1
@@ -0,0 +1,4 @@
1
+
2
+ import { n as generatePluginFilesIfNeeded, r as loadApplication, t as defineApplication } from "./application-FnWOxBk7.mjs";
3
+
4
+ export { defineApplication };
@@ -6,7 +6,7 @@ declare namespace authconnection_d_exports {
6
6
  *
7
7
  * Thin typed wrapper around the platform-provided `tailor.authconnection` runtime API.
8
8
  * At runtime this delegates to `globalThis.tailor.authconnection`. Use
9
- * `authconnectionMock` from `@tailor-platform/sdk/vitest` to mock in unit tests.
9
+ * `mockAuthconnection` from `@tailor-platform/sdk/vitest` to mock in unit tests.
10
10
  * @example
11
11
  * import { authconnection } from "@tailor-platform/sdk/runtime";
12
12
  *
@@ -36,4 +36,4 @@ interface TailorAuthconnectionAPI {
36
36
  declare const getConnectionToken: TailorAuthconnectionAPI["getConnectionToken"];
37
37
  //#endregion
38
38
  export { authconnection_d_exports as n, getConnectionToken as r, TailorAuthconnectionAPI as t };
39
- //# sourceMappingURL=authconnection-TsdLYaLs.d.mts.map
39
+ //# sourceMappingURL=authconnection-BIYzEh2p.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"authconnection-D8SJGMpj.mjs","names":[],"sources":["../src/runtime/authconnection.ts"],"sourcesContent":["/**\n * Auth connection utilities.\n *\n * Thin typed wrapper around the platform-provided `tailor.authconnection` runtime API.\n * At runtime this delegates to `globalThis.tailor.authconnection`. Use\n * `authconnectionMock` from `@tailor-platform/sdk/vitest` to mock in unit tests.\n * @example\n * import { authconnection } from \"@tailor-platform/sdk/runtime\";\n *\n * const token = await authconnection.getConnectionToken(\"my-connection\");\n */\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/**\n * Platform API surface for `tailor.authconnection`. Describes the shape the\n * platform runtime injects on `globalThis.tailor.authconnection`.\n *\n * Each method below is also re-exported as a top-level named export from this\n * module so callers can either `import * as authconnection from\n * \"@tailor-platform/sdk/runtime/authconnection\"` or pick individual methods.\n */\nexport interface TailorAuthconnectionAPI {\n /**\n * Returns the access token for the given auth connection.\n * @param connectionName - Auth connection name as defined in tailor.config\n * @returns Token payload (provider-specific shape)\n */\n getConnectionToken(connectionName: string): Promise<any>;\n}\n\nconst api = (): TailorAuthconnectionAPI =>\n (globalThis as { tailor: { authconnection: TailorAuthconnectionAPI } }).tailor.authconnection;\n\n/**\n * See {@link TailorAuthconnectionAPI.getConnectionToken}.\n * @param args - Forwarded to {@link TailorAuthconnectionAPI.getConnectionToken}\n * @returns Token payload (provider-specific shape)\n */\nexport const getConnectionToken: TailorAuthconnectionAPI[\"getConnectionToken\"] = (...args) =>\n api().getConnectionToken(...args);\n"],"mappings":";;;;;AA+BA,MAAM,YACH,WAAuE,OAAO;;;;;;AAOjF,MAAa,sBAAqE,GAAG,SACnF,IAAI,EAAE,mBAAmB,GAAG,IAAI"}
1
+ {"version":3,"file":"authconnection-D8SJGMpj.mjs","names":[],"sources":["../src/runtime/authconnection.ts"],"sourcesContent":["/**\n * Auth connection utilities.\n *\n * Thin typed wrapper around the platform-provided `tailor.authconnection` runtime API.\n * At runtime this delegates to `globalThis.tailor.authconnection`. Use\n * `mockAuthconnection` from `@tailor-platform/sdk/vitest` to mock in unit tests.\n * @example\n * import { authconnection } from \"@tailor-platform/sdk/runtime\";\n *\n * const token = await authconnection.getConnectionToken(\"my-connection\");\n */\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/**\n * Platform API surface for `tailor.authconnection`. Describes the shape the\n * platform runtime injects on `globalThis.tailor.authconnection`.\n *\n * Each method below is also re-exported as a top-level named export from this\n * module so callers can either `import * as authconnection from\n * \"@tailor-platform/sdk/runtime/authconnection\"` or pick individual methods.\n */\nexport interface TailorAuthconnectionAPI {\n /**\n * Returns the access token for the given auth connection.\n * @param connectionName - Auth connection name as defined in tailor.config\n * @returns Token payload (provider-specific shape)\n */\n getConnectionToken(connectionName: string): Promise<any>;\n}\n\nconst api = (): TailorAuthconnectionAPI =>\n (globalThis as { tailor: { authconnection: TailorAuthconnectionAPI } }).tailor.authconnection;\n\n/**\n * See {@link TailorAuthconnectionAPI.getConnectionToken}.\n * @param args - Forwarded to {@link TailorAuthconnectionAPI.getConnectionToken}\n * @returns Token payload (provider-specific shape)\n */\nexport const getConnectionToken: TailorAuthconnectionAPI[\"getConnectionToken\"] = (...args) =>\n api().getConnectionToken(...args);\n"],"mappings":";;;;;AA+BA,MAAM,YACH,WAAuE,OAAO;;;;;;AAOjF,MAAa,sBAAqE,GAAG,SACnF,IAAI,EAAE,mBAAmB,GAAG,IAAI"}
@@ -115,7 +115,7 @@ function writeHashState() {
115
115
  if (selectedTable) params.set("table", selectedTable);
116
116
  if (showMode !== DEFAULT_SHOW_MODE) params.set("show", showMode);
117
117
  if (hiddenTableNames.size > 0) {
118
- params.set("hidden", [...hiddenTableNames].sort((a, b) => a.localeCompare(b)).join(","));
118
+ params.set("hidden", [...hiddenTableNames].toSorted((a, b) => a.localeCompare(b)).join(","));
119
119
  }
120
120
  params.set("z", viewport.z.toFixed(3));
121
121
  try {
@@ -194,7 +194,7 @@ function computeRanks(tables, relations) {
194
194
  }
195
195
 
196
196
  function computeLayout(nextSchema) {
197
- const tables = [...nextSchema.tables].sort((a, b) => a.name.localeCompare(b.name));
197
+ const tables = nextSchema.tables.toSorted((a, b) => a.name.localeCompare(b.name));
198
198
  const ranks = computeRanks(tables, nextSchema.relations);
199
199
  const layers = new Map();
200
200
  for (const table of tables) {
@@ -204,8 +204,8 @@ function computeLayout(nextSchema) {
204
204
  }
205
205
 
206
206
  const nodes = new Map();
207
- for (const rank of [...layers.keys()].sort((a, b) => a - b)) {
208
- const layerTables = layers.get(rank).sort((a, b) => a.name.localeCompare(b.name));
207
+ for (const rank of [...layers.keys()].toSorted((a, b) => a - b)) {
208
+ const layerTables = layers.get(rank).toSorted((a, b) => a.name.localeCompare(b.name));
209
209
  let y = 0;
210
210
  for (const table of layerTables) {
211
211
  const height = cardHeight(table);
@@ -1,14 +1,14 @@
1
1
  #!/usr/bin/env node
2
2
 
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";
3
+ import { J as PATScope, O as CustomDomainStatus, P as FunctionExecution_Type, V as AuthInvokerSchema, _ as userAgent, a as fetchAll, c as fetchPlatformMachineUserToken, d as initOAuth2Client, f as initOperatorClient, l as fetchUserInfo, r as closeConnectionPool, s as fetchPaged } from "../client-W5P4NYYX.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 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";
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-CrUa8Z2k.mjs";
6
+ import { A as readPlatformConfig, D as loadAccessToken, E as fetchLatestToken, M as saveUserTokens, N as writePlatformConfig, S as hashContent, T as deleteUserTokens, _ as composeFunctionTreeshakeOptions, a as WorkflowJobSchema, g as platformBundleDefinePlugin, i as resolveInlineSourcemap, j as resolveTokens, k as loadWorkspaceId, l as ExecutorSchema, o as ResolverSchema, t as defineApplication, u as INVOKER_EXPR, v as createLogLevelTreeshakeOptions, w as loadConfig, x as getDistDir, y as resolveBundleLogLevel } from "../application-FnWOxBk7.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-CCGpLUlP.mjs";
11
+ import { a as JSON_FOOTER_MARKER, i as CRASH_LOG_EXTENSION, o as parseCrashReportConfig, r as sendCrashReport, t as initCrashReporting } from "../crashreport-D3DvAzdg.mjs";
12
12
  import { arg, defineCommand, runCommand, runMain } from "politty";
13
13
  import { withCompletionCommand } from "politty/completion";
14
14
  import { z } from "zod";
@@ -145,11 +145,16 @@ const authorizeAuthConnectionCommand = defineAppCommand({
145
145
  clearTimeout(timeout);
146
146
  });
147
147
  server.on("error", (err) => {
148
+ clearTimeout(timeout);
149
+ const code = err.code;
150
+ const portHint = code === "EADDRINUSE" || code === "EACCES" ? `Try a different port with --port, or authorize via the Console instead:` : `Authorize via the Console instead:`;
151
+ logger.warn(`Could not start the local callback server on port ${args.port}${code ? ` (${code})` : ""}.\n${portHint}\n tailor-sdk authconnection open`);
148
152
  reject(err);
149
153
  });
150
154
  server.listen(args.port, async () => {
151
155
  const authorizeUrl = authUrl.toString();
152
- logger.info(`Opening browser for authorization:\n\n${authorizeUrl}\n`);
156
+ logger.info(args["no-browser"] ? `Open this URL in your browser to authorize:\n\n${authorizeUrl}\n` : `Opening browser for authorization:\n\n${authorizeUrl}\n`);
157
+ logger.info("If this flow doesn't complete, you can authorize via the Console instead:\n tailor-sdk authconnection open");
153
158
  if (!args["no-browser"]) try {
154
159
  await open(authorizeUrl);
155
160
  } catch {
@@ -253,6 +258,43 @@ const listAuthConnectionCommand = defineAppCommand({
253
258
  }
254
259
  });
255
260
 
261
+ //#endregion
262
+ //#region src/cli/commands/authconnection/open.ts
263
+ const consoleBaseUrl$1 = "https://console.tailor.tech";
264
+ const openAuthConnectionCommand = defineAppCommand({
265
+ name: "open",
266
+ description: "Open the auth connections page in the Tailor Platform Console.",
267
+ args: z.object({ ...workspaceArgs }).strict(),
268
+ run: async (args) => {
269
+ const workspaceId = await loadWorkspaceId({
270
+ workspaceId: args["workspace-id"],
271
+ profile: args.profile
272
+ });
273
+ const consolePath = `/workspaces/${workspaceId}/settings/connections`;
274
+ const consoleUrl = new URL(consolePath, consoleBaseUrl$1).toString();
275
+ const jsonOutput = logger.jsonMode;
276
+ logger.info("Opening auth connections page in Tailor Platform Console...");
277
+ let opened = true;
278
+ try {
279
+ await open(consoleUrl);
280
+ } catch {
281
+ opened = false;
282
+ }
283
+ if (jsonOutput) {
284
+ logger.out({
285
+ consoleUrl,
286
+ workspaceId,
287
+ opened
288
+ });
289
+ return;
290
+ }
291
+ if (opened) {
292
+ logger.out(`Console URL: ${consoleUrl}`);
293
+ logger.out(`Workspace ID: ${workspaceId}`);
294
+ } else logger.warn(`Failed to open browser automatically. Please open this URL manually:\n${consoleUrl}`);
295
+ }
296
+ });
297
+
256
298
  //#endregion
257
299
  //#region src/cli/commands/authconnection/revoke.ts
258
300
  const revokeAuthConnectionCommand = defineAppCommand({
@@ -301,6 +343,7 @@ const authconnectionCommand = defineCommand({
301
343
  subCommands: {
302
344
  authorize: authorizeAuthConnectionCommand,
303
345
  list: listAuthConnectionCommand,
346
+ open: openAuthConnectionCommand,
304
347
  revoke: revokeAuthConnectionCommand,
305
348
  delete: deleteAuthConnectionCommand
306
349
  },
@@ -312,8 +355,8 @@ const authconnectionCommand = defineCommand({
312
355
  //#endregion
313
356
  //#region src/cli/commands/crashreport/list.ts
314
357
  function orderAndLimitCrashReports(entries, options) {
315
- const sorted = entries.filter((f) => f.endsWith(CRASH_LOG_EXTENSION)).sort();
316
- const ordered = options.order === "asc" ? sorted : sorted.reverse();
358
+ const sorted = entries.filter((f) => f.endsWith(CRASH_LOG_EXTENSION)).toSorted();
359
+ const ordered = options.order === "asc" ? sorted : sorted.toReversed();
317
360
  return options.limit && options.limit > 0 ? ordered.slice(0, options.limit) : ordered;
318
361
  }
319
362
  function formatCrashReportFiles(files, localDir) {
@@ -1098,6 +1141,7 @@ async function bundleForTestRun(options) {
1098
1141
  }
1099
1142
  return {
1100
1143
  bundledCode: (await rolldown.build({
1144
+ plugins: [platformBundleDefinePlugin],
1101
1145
  input: entryPath,
1102
1146
  write: false,
1103
1147
  output: {
@@ -3340,7 +3384,7 @@ function toTypeSource(source) {
3340
3384
  };
3341
3385
  }
3342
3386
  function toRelationships(relationships) {
3343
- return Object.entries(relationships).sort(([a], [b]) => a.localeCompare(b)).map(([name, relationship]) => ({
3387
+ return Object.entries(relationships).toSorted(([a], [b]) => a.localeCompare(b)).map(([name, relationship]) => ({
3344
3388
  name,
3345
3389
  targetType: relationship.targetType,
3346
3390
  targetField: relationship.targetField,
@@ -3350,7 +3394,7 @@ function toRelationships(relationships) {
3350
3394
  }));
3351
3395
  }
3352
3396
  function toIndexes(type) {
3353
- return Object.entries(type.indexes ?? {}).sort(([a], [b]) => a.localeCompare(b)).map(([name, index]) => ({
3397
+ return Object.entries(type.indexes ?? {}).toSorted(([a], [b]) => a.localeCompare(b)).map(([name, index]) => ({
3354
3398
  name,
3355
3399
  fields: [...index.fields],
3356
3400
  unique: index.unique === true
@@ -3463,7 +3507,7 @@ function buildRelations(types) {
3463
3507
  const relation = toRelation(type.name, field);
3464
3508
  if (relation) relations.push(relation);
3465
3509
  }
3466
- return relations.sort((a, b) => a.name.localeCompare(b.name));
3510
+ return relations.toSorted((a, b) => a.name.localeCompare(b.name));
3467
3511
  }
3468
3512
  /**
3469
3513
  * Build the TailorDB ERD viewer schema for one namespace.
@@ -3472,7 +3516,7 @@ function buildRelations(types) {
3472
3516
  */
3473
3517
  function buildTailorDbErdSchema(options) {
3474
3518
  const { namespaceData } = options;
3475
- const tables = Object.values(namespaceData.types).sort((a, b) => a.name.localeCompare(b.name)).map((type) => toTable(type, namespaceData.sourceInfo.get(type.name)));
3519
+ const tables = Object.values(namespaceData.types).toSorted((a, b) => a.name.localeCompare(b.name)).map((type) => toTable(type, namespaceData.sourceInfo.get(type.name)));
3476
3520
  const schemaWithoutRevision = {
3477
3521
  version: 1,
3478
3522
  namespace: namespaceData.namespace,
@@ -4307,7 +4351,7 @@ async function collectMigrationStatuses(options) {
4307
4351
  } catch {
4308
4352
  currentMigration = 0;
4309
4353
  }
4310
- const pendingMigrations = getMigrationFiles(migrationsDir).map((f) => f.number).filter((n, i, arr) => arr.indexOf(n) === i).sort((a, b) => a - b).filter((n) => n > currentMigration).map((num) => {
4354
+ const pendingMigrations = getMigrationFiles(migrationsDir).map((f) => f.number).filter((n, i, arr) => arr.indexOf(n) === i).toSorted((a, b) => a - b).filter((n) => n > currentMigration).map((num) => {
4311
4355
  const diffPath = getMigrationFilePath(migrationsDir, num, "diff");
4312
4356
  let description;
4313
4357
  if (fs$1.existsSync(diffPath)) try {
@@ -4854,7 +4898,7 @@ runMain(mainCommand, {
4854
4898
  if (isVerbose() && error.stack) logger.debug(`\nStack trace:\n${error.stack}`);
4855
4899
  } else logger.error(`Unknown error: ${error}`);
4856
4900
  if (!isCLIError(error) && (!(error instanceof Error) || error instanceof TypeError || error instanceof RangeError)) {
4857
- const { reportCrash } = await import("../crashreport-CXD_Kjk-.mjs");
4901
+ const { reportCrash } = await import("../crashreport-lnVTnbB5.mjs");
4858
4902
  await reportCrash(error, "handledError");
4859
4903
  }
4860
4904
  }