@tailor-platform/sdk 1.57.0 → 1.59.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.
- package/CHANGELOG.md +75 -0
- package/dist/{application-CdkoGX27.mjs → application-FnWOxBk7.mjs} +48 -28
- package/dist/application-FnWOxBk7.mjs.map +1 -0
- package/dist/application-VOdgMtOD.mjs +4 -0
- package/dist/{authconnection-TsdLYaLs.d.mts → authconnection-BIYzEh2p.d.mts} +2 -2
- package/dist/authconnection-D8SJGMpj.mjs.map +1 -1
- package/dist/cli/erd-viewer-assets/app.js +4 -4
- package/dist/cli/index.mjs +172 -20
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +581 -2
- package/dist/cli/lib.mjs +4 -3
- package/dist/cli/lib.mjs.map +1 -1
- package/dist/client-B-jRdlC_.mjs +4 -0
- package/dist/{client-DLPEPJ_s.mjs → client-W5P4NYYX.mjs} +154 -12
- package/dist/client-W5P4NYYX.mjs.map +1 -0
- package/dist/configure/index.d.mts +2 -2
- package/dist/configure/index.mjs +8 -8
- package/dist/configure/index.mjs.map +1 -1
- package/dist/{crashreport-Bm2mN5tg.mjs → crashreport-D3DvAzdg.mjs} +3 -3
- package/dist/crashreport-D3DvAzdg.mjs.map +1 -0
- package/dist/{crashreport-C5oHvHUC.mjs → crashreport-lnVTnbB5.mjs} +1 -1
- package/dist/file-B58Dm-2P.mjs.map +1 -1
- package/dist/{file-VTJbbOL3.d.mts → file-BzK8z3X-.d.mts} +2 -2
- package/dist/globals-ByrCoDip.mjs +109 -0
- package/dist/globals-ByrCoDip.mjs.map +1 -0
- package/dist/iconv-DreIffeM.mjs.map +1 -1
- package/dist/{iconv-Chu6Hit2.d.mts → iconv-kwrmd1U_.d.mts} +2 -2
- package/dist/{idp-Di9N4FSJ.d.mts → idp-BlBPtXJ-.d.mts} +2 -2
- package/dist/idp-Ch95ag8h.mjs.map +1 -1
- package/dist/{index-B61gFI9a.d.mts → index-Cr6ufjZ5.d.mts} +12 -9
- package/dist/{index-DTSQthwF.d.mts → index-DRhMpdnA.d.mts} +7 -7
- package/dist/{job-CEAJLiGp.mjs → job-BpsFXPbi.mjs} +8 -17
- package/dist/job-BpsFXPbi.mjs.map +1 -0
- package/dist/mock-Dpu__UeJ.mjs +805 -0
- package/dist/mock-Dpu__UeJ.mjs.map +1 -0
- package/dist/registry-D0uB0OrK.mjs +178 -0
- package/dist/registry-D0uB0OrK.mjs.map +1 -0
- package/dist/{repl-editor-ihh8koiR.mjs → repl-editor-Y9QJDL0K.mjs} +3 -9
- package/dist/{repl-editor-ihh8koiR.mjs.map → repl-editor-Y9QJDL0K.mjs.map} +1 -1
- package/dist/runtime/authconnection.d.mts +1 -1
- package/dist/runtime/file.d.mts +1 -1
- package/dist/runtime/globals.d.mts +5 -5
- package/dist/runtime/iconv.d.mts +1 -1
- package/dist/runtime/idp.d.mts +1 -1
- package/dist/runtime/index.d.mts +7 -7
- package/dist/runtime/secretmanager.d.mts +1 -1
- package/dist/runtime/workflow.d.mts +1 -1
- package/dist/{runtime-1YuaoNr8.mjs → runtime-CrUa8Z2k.mjs} +383 -402
- package/dist/runtime-CrUa8Z2k.mjs.map +1 -0
- package/dist/secretmanager-B9h-U_8U.mjs.map +1 -1
- package/dist/{secretmanager-BhpDmxwT.d.mts → secretmanager-CKLB3wAQ.d.mts} +2 -2
- package/dist/utils/test/index.d.mts +6 -6
- package/dist/utils/test/index.mjs +7 -7
- package/dist/utils/test/index.mjs.map +1 -1
- package/dist/vitest/environment.mjs +3 -4
- package/dist/vitest/environment.mjs.map +1 -1
- package/dist/vitest/index.d.mts +167 -120
- package/dist/vitest/index.mjs +6 -6
- package/dist/vitest/index.mjs.map +1 -1
- package/dist/vitest/setup.d.mts +1 -1
- package/dist/vitest/setup.mjs +4 -3
- package/dist/vitest/setup.mjs.map +1 -1
- package/dist/workflow--aPbA8Uq.mjs.map +1 -1
- package/dist/{workflow-dYYH7QFa.d.mts → workflow-CMamswkK.d.mts} +2 -2
- package/dist/{workflow.generated-Kz-nQrTf.d.mts → workflow.generated-CV77NlFp.d.mts} +3 -2
- package/docs/cli/application.md +5 -5
- package/docs/cli/auth.md +55 -6
- package/docs/cli/function.md +2 -2
- package/docs/cli/staticwebsite.md +137 -0
- package/docs/cli-reference.md +17 -14
- package/docs/configuration.md +1 -1
- package/docs/generator/builtin.md +1 -1
- package/docs/runtime.md +9 -12
- package/docs/services/auth.md +0 -11
- package/docs/services/staticwebsite.md +13 -0
- package/docs/testing.md +92 -85
- package/package.json +8 -8
- package/dist/application-CdkoGX27.mjs.map +0 -1
- package/dist/application-x_mURdR0.mjs +0 -4
- package/dist/client-DLPEPJ_s.mjs.map +0 -1
- package/dist/client-DrzwCD1W.mjs +0 -4
- package/dist/crashreport-Bm2mN5tg.mjs.map +0 -1
- package/dist/job-CEAJLiGp.mjs.map +0 -1
- package/dist/mock-B6PI49C_.mjs +0 -844
- package/dist/mock-B6PI49C_.mjs.map +0 -1
- package/dist/runtime-1YuaoNr8.mjs.map +0 -1
- package/dist/test-env-key-CSnK4W1Y.mjs +0 -30
- package/dist/test-env-key-CSnK4W1Y.mjs.map +0 -1
|
@@ -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
|
-
* `
|
|
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-
|
|
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 * `
|
|
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].
|
|
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 =
|
|
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()].
|
|
208
|
-
const layerTables = layers.get(rank).
|
|
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);
|
package/dist/cli/index.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import {
|
|
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
|
|
6
|
-
import { A as
|
|
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-
|
|
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";
|
|
@@ -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, []);
|
|
@@ -271,8 +312,8 @@ const authconnectionCommand = defineCommand({
|
|
|
271
312
|
//#endregion
|
|
272
313
|
//#region src/cli/commands/crashreport/list.ts
|
|
273
314
|
function orderAndLimitCrashReports(entries, options) {
|
|
274
|
-
const sorted = entries.filter((f) => f.endsWith(CRASH_LOG_EXTENSION)).
|
|
275
|
-
const ordered = options.order === "asc" ? sorted : sorted.
|
|
315
|
+
const sorted = entries.filter((f) => f.endsWith(CRASH_LOG_EXTENSION)).toSorted();
|
|
316
|
+
const ordered = options.order === "asc" ? sorted : sorted.toReversed();
|
|
276
317
|
return options.limit && options.limit > 0 ? ordered.slice(0, options.limit) : ordered;
|
|
277
318
|
}
|
|
278
319
|
function formatCrashReportFiles(files, localDir) {
|
|
@@ -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
|
|
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
|
-
|
|
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: "",
|
|
@@ -1057,6 +1098,7 @@ async function bundleForTestRun(options) {
|
|
|
1057
1098
|
}
|
|
1058
1099
|
return {
|
|
1059
1100
|
bundledCode: (await rolldown.build({
|
|
1101
|
+
plugins: [platformBundleDefinePlugin],
|
|
1060
1102
|
input: entryPath,
|
|
1061
1103
|
write: false,
|
|
1062
1104
|
output: {
|
|
@@ -2084,7 +2126,7 @@ const secretValueArgs = {
|
|
|
2084
2126
|
*/
|
|
2085
2127
|
async function checkVaultManaged(params) {
|
|
2086
2128
|
const { client, workspaceId, vaultName } = params;
|
|
2087
|
-
const trn =
|
|
2129
|
+
const trn = resourceTrn(workspaceId, "vault", vaultName);
|
|
2088
2130
|
const notManaged = {
|
|
2089
2131
|
isManaged: false,
|
|
2090
2132
|
trn,
|
|
@@ -2984,6 +3026,115 @@ const deployCommand = defineAppCommand({
|
|
|
2984
3026
|
}
|
|
2985
3027
|
});
|
|
2986
3028
|
|
|
3029
|
+
//#endregion
|
|
3030
|
+
//#region src/cli/commands/staticwebsite/domain/status.ts
|
|
3031
|
+
const statusLabels = {
|
|
3032
|
+
[CustomDomainStatus.UNSPECIFIED]: "unspecified",
|
|
3033
|
+
[CustomDomainStatus.PENDING]: "pending",
|
|
3034
|
+
[CustomDomainStatus.VERIFYING]: "verifying",
|
|
3035
|
+
[CustomDomainStatus.CERT_ISSUED]: "cert_issued",
|
|
3036
|
+
[CustomDomainStatus.ACTIVE]: "active",
|
|
3037
|
+
[CustomDomainStatus.FAILED]: "failed"
|
|
3038
|
+
};
|
|
3039
|
+
|
|
3040
|
+
//#endregion
|
|
3041
|
+
//#region src/cli/commands/staticwebsite/domain/get.ts
|
|
3042
|
+
const domainGetCommand = defineAppCommand({
|
|
3043
|
+
name: "get",
|
|
3044
|
+
description: "Get details of a custom domain.",
|
|
3045
|
+
args: z.object({
|
|
3046
|
+
...workspaceArgs,
|
|
3047
|
+
domain: arg(z.string(), {
|
|
3048
|
+
positional: true,
|
|
3049
|
+
description: "Custom domain name"
|
|
3050
|
+
})
|
|
3051
|
+
}).strict(),
|
|
3052
|
+
run: async (args) => {
|
|
3053
|
+
const client = await initOperatorClient(await loadAccessToken({
|
|
3054
|
+
useProfile: true,
|
|
3055
|
+
profile: args.profile
|
|
3056
|
+
}));
|
|
3057
|
+
const workspaceId = await loadWorkspaceId({
|
|
3058
|
+
workspaceId: args["workspace-id"],
|
|
3059
|
+
profile: args.profile
|
|
3060
|
+
});
|
|
3061
|
+
const notFoundErrorMessage = `Custom domain "${args.domain}" not found.`;
|
|
3062
|
+
try {
|
|
3063
|
+
const { customDomain } = await client.getCustomDomain({
|
|
3064
|
+
workspaceId,
|
|
3065
|
+
domain: args.domain
|
|
3066
|
+
});
|
|
3067
|
+
if (!customDomain) throw new Error(notFoundErrorMessage);
|
|
3068
|
+
const info = {
|
|
3069
|
+
domain: customDomain.domain,
|
|
3070
|
+
status: statusLabels[customDomain.status] ?? "unknown",
|
|
3071
|
+
trafficCnameTarget: customDomain.trafficCnameTarget,
|
|
3072
|
+
certificateCnameTarget: customDomain.certificateCnameTarget,
|
|
3073
|
+
errorMessage: customDomain.errorMessage || void 0
|
|
3074
|
+
};
|
|
3075
|
+
logger.out(info);
|
|
3076
|
+
} catch (error) {
|
|
3077
|
+
if (error instanceof ConnectError && error.code === Code.NotFound) throw new Error(notFoundErrorMessage, { cause: error });
|
|
3078
|
+
throw error;
|
|
3079
|
+
}
|
|
3080
|
+
}
|
|
3081
|
+
});
|
|
3082
|
+
|
|
3083
|
+
//#endregion
|
|
3084
|
+
//#region src/cli/commands/staticwebsite/domain/list.ts
|
|
3085
|
+
const domainListCommand = defineAppCommand({
|
|
3086
|
+
name: "list",
|
|
3087
|
+
description: "List custom domains for a static website.",
|
|
3088
|
+
args: z.object({
|
|
3089
|
+
...workspaceArgs,
|
|
3090
|
+
name: arg(z.string(), {
|
|
3091
|
+
positional: true,
|
|
3092
|
+
description: "Static website name"
|
|
3093
|
+
})
|
|
3094
|
+
}).strict(),
|
|
3095
|
+
run: async (args) => {
|
|
3096
|
+
const client = await initOperatorClient(await loadAccessToken({
|
|
3097
|
+
useProfile: true,
|
|
3098
|
+
profile: args.profile
|
|
3099
|
+
}));
|
|
3100
|
+
const workspaceId = await loadWorkspaceId({
|
|
3101
|
+
workspaceId: args["workspace-id"],
|
|
3102
|
+
profile: args.profile
|
|
3103
|
+
});
|
|
3104
|
+
try {
|
|
3105
|
+
const { customDomains } = await client.listCustomDomains({
|
|
3106
|
+
workspaceId,
|
|
3107
|
+
staticWebsiteName: args.name
|
|
3108
|
+
});
|
|
3109
|
+
if (customDomains.length === 0) {
|
|
3110
|
+
logger.info("No custom domains found.");
|
|
3111
|
+
return;
|
|
3112
|
+
}
|
|
3113
|
+
const formatted = customDomains.map((d) => ({
|
|
3114
|
+
domain: d.domain,
|
|
3115
|
+
status: statusLabels[d.status] ?? "unknown",
|
|
3116
|
+
trafficCnameTarget: d.trafficCnameTarget,
|
|
3117
|
+
certificateCnameTarget: d.certificateCnameTarget
|
|
3118
|
+
}));
|
|
3119
|
+
logger.out(formatted);
|
|
3120
|
+
} catch (error) {
|
|
3121
|
+
if (error instanceof ConnectError && error.code === Code.NotFound) throw new Error(`Static website "${args.name}" not found.`, { cause: error });
|
|
3122
|
+
throw error;
|
|
3123
|
+
}
|
|
3124
|
+
}
|
|
3125
|
+
});
|
|
3126
|
+
|
|
3127
|
+
//#endregion
|
|
3128
|
+
//#region src/cli/commands/staticwebsite/domain/index.ts
|
|
3129
|
+
const domainCommand = defineCommand({
|
|
3130
|
+
name: "domain",
|
|
3131
|
+
description: "Manage custom domains for static websites.",
|
|
3132
|
+
subCommands: {
|
|
3133
|
+
list: domainListCommand,
|
|
3134
|
+
get: domainGetCommand
|
|
3135
|
+
}
|
|
3136
|
+
});
|
|
3137
|
+
|
|
2987
3138
|
//#endregion
|
|
2988
3139
|
//#region src/cli/commands/staticwebsite/get.ts
|
|
2989
3140
|
const getCommand = defineAppCommand({
|
|
@@ -3098,6 +3249,7 @@ const staticwebsiteCommand = defineCommand({
|
|
|
3098
3249
|
description: "Manage static websites in your workspace.",
|
|
3099
3250
|
subCommands: {
|
|
3100
3251
|
deploy: deployCommand,
|
|
3252
|
+
domain: domainCommand,
|
|
3101
3253
|
list: listCommand$2,
|
|
3102
3254
|
get: getCommand
|
|
3103
3255
|
},
|
|
@@ -3189,7 +3341,7 @@ function toTypeSource(source) {
|
|
|
3189
3341
|
};
|
|
3190
3342
|
}
|
|
3191
3343
|
function toRelationships(relationships) {
|
|
3192
|
-
return Object.entries(relationships).
|
|
3344
|
+
return Object.entries(relationships).toSorted(([a], [b]) => a.localeCompare(b)).map(([name, relationship]) => ({
|
|
3193
3345
|
name,
|
|
3194
3346
|
targetType: relationship.targetType,
|
|
3195
3347
|
targetField: relationship.targetField,
|
|
@@ -3199,7 +3351,7 @@ function toRelationships(relationships) {
|
|
|
3199
3351
|
}));
|
|
3200
3352
|
}
|
|
3201
3353
|
function toIndexes(type) {
|
|
3202
|
-
return Object.entries(type.indexes ?? {}).
|
|
3354
|
+
return Object.entries(type.indexes ?? {}).toSorted(([a], [b]) => a.localeCompare(b)).map(([name, index]) => ({
|
|
3203
3355
|
name,
|
|
3204
3356
|
fields: [...index.fields],
|
|
3205
3357
|
unique: index.unique === true
|
|
@@ -3312,7 +3464,7 @@ function buildRelations(types) {
|
|
|
3312
3464
|
const relation = toRelation(type.name, field);
|
|
3313
3465
|
if (relation) relations.push(relation);
|
|
3314
3466
|
}
|
|
3315
|
-
return relations.
|
|
3467
|
+
return relations.toSorted((a, b) => a.name.localeCompare(b.name));
|
|
3316
3468
|
}
|
|
3317
3469
|
/**
|
|
3318
3470
|
* Build the TailorDB ERD viewer schema for one namespace.
|
|
@@ -3321,7 +3473,7 @@ function buildRelations(types) {
|
|
|
3321
3473
|
*/
|
|
3322
3474
|
function buildTailorDbErdSchema(options) {
|
|
3323
3475
|
const { namespaceData } = options;
|
|
3324
|
-
const tables = Object.values(namespaceData.types).
|
|
3476
|
+
const tables = Object.values(namespaceData.types).toSorted((a, b) => a.name.localeCompare(b.name)).map((type) => toTable(type, namespaceData.sourceInfo.get(type.name)));
|
|
3325
3477
|
const schemaWithoutRevision = {
|
|
3326
3478
|
version: 1,
|
|
3327
3479
|
namespace: namespaceData.namespace,
|
|
@@ -4055,10 +4207,10 @@ async function set(options) {
|
|
|
4055
4207
|
useProfile: false,
|
|
4056
4208
|
profile: options.profile
|
|
4057
4209
|
}));
|
|
4058
|
-
const trn =
|
|
4210
|
+
const trn = resourceTrn(await loadWorkspaceId({
|
|
4059
4211
|
workspaceId: options.workspaceId,
|
|
4060
4212
|
profile: options.profile
|
|
4061
|
-
})
|
|
4213
|
+
}), "tailordb", targetNamespace);
|
|
4062
4214
|
let currentMigration;
|
|
4063
4215
|
try {
|
|
4064
4216
|
const { metadata } = await client.getMetadata({ trn });
|
|
@@ -4147,7 +4299,7 @@ async function collectMigrationStatuses(options) {
|
|
|
4147
4299
|
});
|
|
4148
4300
|
const statuses = [];
|
|
4149
4301
|
for (const { namespace, migrationsDir } of targetNamespaces) {
|
|
4150
|
-
const trn =
|
|
4302
|
+
const trn = resourceTrn(workspaceId, "tailordb", namespace);
|
|
4151
4303
|
let currentMigration;
|
|
4152
4304
|
try {
|
|
4153
4305
|
const { metadata } = await client.getMetadata({ trn });
|
|
@@ -4156,7 +4308,7 @@ async function collectMigrationStatuses(options) {
|
|
|
4156
4308
|
} catch {
|
|
4157
4309
|
currentMigration = 0;
|
|
4158
4310
|
}
|
|
4159
|
-
const pendingMigrations = getMigrationFiles(migrationsDir).map((f) => f.number).filter((n, i, arr) => arr.indexOf(n) === i).
|
|
4311
|
+
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) => {
|
|
4160
4312
|
const diffPath = getMigrationFilePath(migrationsDir, num, "diff");
|
|
4161
4313
|
let description;
|
|
4162
4314
|
if (fs$1.existsSync(diffPath)) try {
|
|
@@ -4703,7 +4855,7 @@ runMain(mainCommand, {
|
|
|
4703
4855
|
if (isVerbose() && error.stack) logger.debug(`\nStack trace:\n${error.stack}`);
|
|
4704
4856
|
} else logger.error(`Unknown error: ${error}`);
|
|
4705
4857
|
if (!isCLIError(error) && (!(error instanceof Error) || error instanceof TypeError || error instanceof RangeError)) {
|
|
4706
|
-
const { reportCrash } = await import("../crashreport-
|
|
4858
|
+
const { reportCrash } = await import("../crashreport-lnVTnbB5.mjs");
|
|
4707
4859
|
await reportCrash(error, "handledError");
|
|
4708
4860
|
}
|
|
4709
4861
|
}
|