@tailor-platform/sdk 1.28.0 → 1.29.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 +18 -0
- package/dist/{application-CBJFUKrU.mjs → application-Clwpv84E.mjs} +9 -5
- package/dist/application-Clwpv84E.mjs.map +1 -0
- package/dist/{application-WyZetOky.mjs → application-Dl1d7w-b.mjs} +3 -3
- package/dist/chunk-DEt8GZDa.mjs +8 -0
- package/dist/cli/index.mjs +54 -19
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.mjs +5 -5
- package/dist/cli/skills.mjs +1 -1
- package/dist/client-CW4Oh3iz.mjs +6 -0
- package/dist/client-CZmQBXAY.mjs +16294 -0
- package/dist/client-CZmQBXAY.mjs.map +1 -0
- package/dist/configure/index.mjs +1 -1
- package/dist/{crash-report-Cot_9Esm.mjs → crash-report-CYrETw1c.mjs} +2 -2
- package/dist/{crash-report-Ju8cQF-l.mjs → crash-report-DizNMVnm.mjs} +3 -3
- package/dist/{crash-report-Ju8cQF-l.mjs.map → crash-report-DizNMVnm.mjs.map} +1 -1
- package/dist/{interceptor-B0d_GrI5.mjs → interceptor-DgQNmwWJ.mjs} +2 -2
- package/dist/{interceptor-B0d_GrI5.mjs.map → interceptor-DgQNmwWJ.mjs.map} +1 -1
- package/dist/kysely/index.mjs +1 -1
- package/dist/{package-json-DHfTiUCS.mjs → package-json-DiZWrkIA.mjs} +1 -1
- package/dist/plugin/builtin/enum-constants/index.mjs +1 -1
- package/dist/plugin/builtin/file-utils/index.mjs +1 -1
- package/dist/plugin/builtin/kysely-type/index.mjs +1 -1
- package/dist/plugin/builtin/seed/index.mjs +1 -1
- package/dist/plugin/index.mjs +1 -1
- package/dist/{query-WYq8RvYp.mjs → query-B1-hq2Hm.mjs} +69 -27
- package/dist/query-B1-hq2Hm.mjs.map +1 -0
- package/dist/seed/index.mjs +1 -1
- package/dist/{telemetry-VvNfsyEE.mjs → telemetry-BSUlYTs-.mjs} +2 -2
- package/dist/{telemetry-VvNfsyEE.mjs.map → telemetry-BSUlYTs-.mjs.map} +1 -1
- package/dist/telemetry-BtN2l0f1.mjs +4 -0
- package/dist/utils/test/index.mjs +1 -1
- package/docs/cli/user.md +21 -22
- package/docs/cli/workspace.md +0 -7
- package/docs/cli-reference.md +12 -10
- package/docs/services/executor.md +46 -0
- package/package.json +8 -8
- package/dist/application-CBJFUKrU.mjs.map +0 -1
- package/dist/chunk-Cz-A8uMR.mjs +0 -3
- package/dist/client-C2_wgujH.mjs +0 -6
- package/dist/client-bTbnbQbB.mjs +0 -957
- package/dist/client-bTbnbQbB.mjs.map +0 -1
- package/dist/query-WYq8RvYp.mjs.map +0 -1
- package/dist/telemetry-BevrwWwF.mjs +0 -4
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import "./chunk-
|
|
1
|
+
import "./chunk-DEt8GZDa.mjs";
|
|
2
2
|
import "./brand-GZnI4eYb.mjs";
|
|
3
3
|
import "./logger-CqezTedh.mjs";
|
|
4
|
-
import "./client-
|
|
4
|
+
import "./client-CZmQBXAY.mjs";
|
|
5
5
|
import "./package-json-D3x2nBPB.mjs";
|
|
6
|
-
import { n as generatePluginFilesIfNeeded, r as loadApplication, t as defineApplication } from "./application-
|
|
6
|
+
import { n as generatePluginFilesIfNeeded, r as loadApplication, t as defineApplication } from "./application-Clwpv84E.mjs";
|
|
7
7
|
import "./seed-CWkIDWMb.mjs";
|
|
8
8
|
import "./file-utils-Bctuzn3x.mjs";
|
|
9
9
|
import "./kysely-type-B_IecdK9.mjs";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
|
|
3
|
+
//#region \0rolldown/runtime.js
|
|
4
|
+
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
5
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
6
|
+
|
|
7
|
+
//#endregion
|
|
8
|
+
export { __require as n, __commonJSMin as t };
|
package/dist/cli/index.mjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import "../chunk-
|
|
2
|
+
import "../chunk-DEt8GZDa.mjs";
|
|
3
3
|
import "../schema-BePzTFBV.mjs";
|
|
4
4
|
import "../brand-GZnI4eYb.mjs";
|
|
5
5
|
import { n as logger, r as styles } from "../logger-CqezTedh.mjs";
|
|
6
|
-
import { $t as workspaceArgs, 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 defineAppCommand, Mt as getMigrationFilePath, N as generateCommand$1, Nt as getMigrationFiles, O as listCommand$9, Q as listCommand$6, Qt as isVerbose, R as removeCommand$1, T as healthCommand, Ut as sdkNameLabelKey, V as getCommand$2, Vt as getNamespacesWithMigrations, W as tokenCommand, Wt as trnPrefix, X as triggerCommand, Xt as confirmationArgs, Y as webhookCommand, Yt as commonArgs, Zt as deploymentArgs, 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 apiCommand, r as isCLIError, tt as jobsCommand, u as inviteCommand, v as deleteCommand$3, yt as parseMigrationLabelNumber, z as listCommand$8 } from "../query-
|
|
7
|
-
import {
|
|
6
|
+
import { $t as workspaceArgs, 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 defineAppCommand, Mt as getMigrationFilePath, N as generateCommand$1, Nt as getMigrationFiles, O as listCommand$9, Q as listCommand$6, Qt as isVerbose, R as removeCommand$1, T as healthCommand, Ut as sdkNameLabelKey, V as getCommand$2, Vt as getNamespacesWithMigrations, W as tokenCommand, Wt as trnPrefix, X as triggerCommand, Xt as confirmationArgs, Y as webhookCommand, Yt as commonArgs, Zt as deploymentArgs, 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 apiCommand, r as isCLIError, tt as jobsCommand, u as inviteCommand, v as deleteCommand$3, yt as parseMigrationLabelNumber, z as listCommand$8 } from "../query-B1-hq2Hm.mjs";
|
|
7
|
+
import { E as FunctionExecution_Type, M as AuthInvokerSchema, a as fetchPlatformMachineUserToken, c as initOAuth2Client, l as initOperatorClient, n as closeConnectionPool, o as fetchUserInfo, p as userAgent, r as fetchAll, z as PATScope } from "../client-CZmQBXAY.mjs";
|
|
8
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-
|
|
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-Clwpv84E.mjs";
|
|
10
10
|
import "../seed-CWkIDWMb.mjs";
|
|
11
11
|
import "../file-utils-Bctuzn3x.mjs";
|
|
12
12
|
import "../kysely-type-B_IecdK9.mjs";
|
|
13
|
-
import "../telemetry-
|
|
14
|
-
import { a as JSON_FOOTER_MARKER, i as CRASH_LOG_EXTENSION, o as parseCrashReportConfig, r as sendCrashReport, t as initCrashReporting } from "../crash-report-
|
|
13
|
+
import "../telemetry-BSUlYTs-.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-DizNMVnm.mjs";
|
|
15
15
|
import { createRequire, register } from "node:module";
|
|
16
16
|
import { arg, defineCommand, runCommand, runMain } from "politty";
|
|
17
17
|
import { withCompletionCommand } from "politty/completion";
|
|
@@ -21,14 +21,14 @@ import * as path from "pathe";
|
|
|
21
21
|
import { generateCodeVerifier } from "@badgateway/oauth2-client";
|
|
22
22
|
import { timestampDate } from "@bufbuild/protobuf/wkt";
|
|
23
23
|
import { Code, ConnectError } from "@connectrpc/connect";
|
|
24
|
+
import * as http from "node:http";
|
|
25
|
+
import * as crypto from "node:crypto";
|
|
26
|
+
import { pathToFileURL } from "node:url";
|
|
24
27
|
import { resolveTSConfig } from "pkg-types";
|
|
25
28
|
import ml from "multiline-ts";
|
|
26
|
-
import * as crypto from "node:crypto";
|
|
27
29
|
import * as rolldown from "rolldown";
|
|
28
|
-
import { pathToFileURL } from "node:url";
|
|
29
30
|
import { create } from "@bufbuild/protobuf";
|
|
30
31
|
import { spawn, spawnSync } from "node:child_process";
|
|
31
|
-
import * as http from "node:http";
|
|
32
32
|
import open from "open";
|
|
33
33
|
import * as fs from "fs";
|
|
34
34
|
import { lookup } from "mime-types";
|
|
@@ -51,7 +51,7 @@ const applyCommand = defineAppCommand({
|
|
|
51
51
|
"clean-cache": arg(z.boolean().optional(), { description: "Clean the bundle cache before building" })
|
|
52
52
|
}).strict(),
|
|
53
53
|
run: async (args) => {
|
|
54
|
-
const { initTelemetry } = await import("../telemetry-
|
|
54
|
+
const { initTelemetry } = await import("../telemetry-BtN2l0f1.mjs");
|
|
55
55
|
await initTelemetry();
|
|
56
56
|
await apply({
|
|
57
57
|
workspaceId: args["workspace-id"],
|
|
@@ -808,7 +808,7 @@ const generateCommand = defineAppCommand({
|
|
|
808
808
|
})
|
|
809
809
|
}).strict(),
|
|
810
810
|
run: async (args) => {
|
|
811
|
-
const { initTelemetry } = await import("../telemetry-
|
|
811
|
+
const { initTelemetry } = await import("../telemetry-BtN2l0f1.mjs");
|
|
812
812
|
await initTelemetry();
|
|
813
813
|
await generate({
|
|
814
814
|
configPath: args.config,
|
|
@@ -935,13 +935,46 @@ const startAuthServer = async () => {
|
|
|
935
935
|
});
|
|
936
936
|
});
|
|
937
937
|
};
|
|
938
|
+
async function loginAsMachineUser(args) {
|
|
939
|
+
const clientSecret = args.clientSecret ?? await prompt.password({ message: "Client secret" });
|
|
940
|
+
const tokens = await fetchPlatformMachineUserToken(args.clientId, clientSecret);
|
|
941
|
+
const pfConfig = readPlatformConfig();
|
|
942
|
+
pfConfig.users = {
|
|
943
|
+
...pfConfig.users,
|
|
944
|
+
[args.clientId]: {
|
|
945
|
+
access_token: tokens.accessToken,
|
|
946
|
+
token_expires_at: new Date(tokens.expiresAt).toISOString()
|
|
947
|
+
}
|
|
948
|
+
};
|
|
949
|
+
pfConfig.current_user = args.clientId;
|
|
950
|
+
writePlatformConfig(pfConfig);
|
|
951
|
+
}
|
|
938
952
|
const loginCommand = defineAppCommand({
|
|
939
953
|
name: "login",
|
|
940
954
|
description: "Login to Tailor Platform.",
|
|
941
|
-
args: z.object({}).strict(),
|
|
942
|
-
|
|
943
|
-
|
|
955
|
+
args: z.xor([z.object({}).strict().describe("User Login"), z.object({
|
|
956
|
+
machineuser: arg(z.literal(true), {
|
|
957
|
+
description: "Login as a platform machine user.",
|
|
958
|
+
required: true
|
|
959
|
+
}),
|
|
960
|
+
"client-id": arg(z.string(), {
|
|
961
|
+
description: "Client ID",
|
|
962
|
+
env: "TAILOR_PLATFORM_MACHINE_USER_CLIENT_ID",
|
|
963
|
+
required: true
|
|
964
|
+
}),
|
|
965
|
+
"client-secret": arg(z.string().optional(), {
|
|
966
|
+
description: "Client secret",
|
|
967
|
+
env: "TAILOR_PLATFORM_MACHINE_USER_CLIENT_SECRET"
|
|
968
|
+
})
|
|
969
|
+
}).strict().describe("Machine User Login")]),
|
|
970
|
+
run: async (args) => {
|
|
971
|
+
if ("machineuser" in args && args.machineuser) await loginAsMachineUser({
|
|
972
|
+
clientId: args.clientId,
|
|
973
|
+
clientSecret: args.clientSecret
|
|
974
|
+
});
|
|
975
|
+
else await startAuthServer();
|
|
944
976
|
logger.success("Successfully logged in to Tailor Platform.");
|
|
977
|
+
await closeConnectionPool();
|
|
945
978
|
}
|
|
946
979
|
});
|
|
947
980
|
|
|
@@ -958,11 +991,13 @@ const logoutCommand = defineAppCommand({
|
|
|
958
991
|
logger.info("You are not logged in.");
|
|
959
992
|
return;
|
|
960
993
|
}
|
|
961
|
-
initOAuth2Client()
|
|
994
|
+
const client = initOAuth2Client();
|
|
995
|
+
const tokenTypeHint = tokens.refresh_token ? "refresh_token" : "access_token";
|
|
996
|
+
client.revoke({
|
|
962
997
|
accessToken: tokens.access_token,
|
|
963
|
-
refreshToken: tokens.refresh_token,
|
|
998
|
+
refreshToken: tokens.refresh_token ?? null,
|
|
964
999
|
expiresAt: Date.parse(tokens.token_expires_at)
|
|
965
|
-
},
|
|
1000
|
+
}, tokenTypeHint);
|
|
966
1001
|
delete pfConfig.users[pfConfig.current_user];
|
|
967
1002
|
pfConfig.current_user = null;
|
|
968
1003
|
writePlatformConfig(pfConfig);
|
|
@@ -3180,11 +3215,11 @@ runMain(mainCommand, {
|
|
|
3180
3215
|
if (isVerbose() && error.stack) logger.debug(`\nStack trace:\n${error.stack}`);
|
|
3181
3216
|
} else logger.error(`Unknown error: ${error}`);
|
|
3182
3217
|
if (!isCLIError(error) && (!(error instanceof Error) || error instanceof TypeError || error instanceof RangeError)) {
|
|
3183
|
-
const { reportCrash } = await import("../crash-report-
|
|
3218
|
+
const { reportCrash } = await import("../crash-report-CYrETw1c.mjs");
|
|
3184
3219
|
await reportCrash(error, "handledError");
|
|
3185
3220
|
}
|
|
3186
3221
|
}
|
|
3187
|
-
const { shutdownTelemetry } = await import("../telemetry-
|
|
3222
|
+
const { shutdownTelemetry } = await import("../telemetry-BtN2l0f1.mjs");
|
|
3188
3223
|
await shutdownTelemetry();
|
|
3189
3224
|
}
|
|
3190
3225
|
});
|