@tailor-platform/sdk 1.15.0 → 1.15.2

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.
@@ -0,0 +1,4 @@
1
+ import "./chunk-GMkBE123.mjs";
2
+ import { t as defineApplication } from "./application-DLUgR1gv.mjs";
3
+
4
+ export { defineApplication };
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import "../chunk-GMkBE123.mjs";
3
3
  import "../schema-DRYB-nzA.mjs";
4
- import { $ as jobsCommand, $t as initOperatorClient, A as generateCommand, At as getMigrationFiles, C as resumeCommand, Et as formatMigrationNumber, F as removeCommand$1, G as generateCommand$1, Gt as fetchLatestToken, H as listCommand$6, I as listCommand$7, J as triggerCommand, Jt as readPlatformConfig, Kt as loadAccessToken, Mt as isValidMigrationNumber, N as showCommand, Nt as loadDiff, O as truncateCommand, Qt as initOAuth2Client, R as getCommand$2, Rt as getNamespacesWithMigrations, S as healthCommand, T as listCommand$8, V as tokenCommand, Vt as loadConfig, Wt as apiCommand, X as listCommand$5, Xt as fetchAll, Yt as writePlatformConfig, Zt as fetchUserInfo, _ as createCommand$3, a as listCommand$10, an as jsonArgs, b as listCommand$9, d as listCommand$11, en as readPackageJson, ft as applyCommand, gt as parseMigrationLabelNumber, h as deleteCommand$3, in as deploymentArgs, it as getCommand$3, j as logBetaWarning, kt as getMigrationFilePath, l as restoreCommand, lt as getCommand$1, nn as commonArgs, nt as startCommand, on as withCommonArgs, ot as executionsCommand, p as getCommand$4, q as webhookCommand, qt as loadWorkspaceId, r as removeCommand, rn as confirmationArgs, s as inviteCommand, sn as workspaceArgs, t as updateCommand$2, tn as PATScope, zt as trnPrefix } from "../update-C_ZTRB63.mjs";
5
- import { f as logger, p as styles } from "../application-DPunZ4lc.mjs";
4
+ import { $ as jobsCommand, $t as fetchUserInfo, A as generateCommand, Bt as getNamespacesWithMigrations, C as resumeCommand, F as removeCommand$1, Ft as loadDiff, G as generateCommand$1, H as listCommand$6, I as listCommand$7, J as triggerCommand, Jt as loadAccessToken, Kt as apiCommand, Mt as getMigrationFiles, N as showCommand, O as truncateCommand, Ot as formatMigrationNumber, Pt as isValidMigrationNumber, Qt as fetchAll, R as getCommand$2, S as healthCommand, T as listCommand$8, Ut as loadConfig, V as tokenCommand, Vt as trnPrefix, X as listCommand$5, Xt as readPlatformConfig, Yt as loadWorkspaceId, Zt as writePlatformConfig, _ as createCommand$3, a as listCommand$10, an as commonArgs, b as listCommand$9, cn as jsonArgs, d as listCommand$11, dt as getCommand$1, en as initOAuth2Client, h as deleteCommand$3, in as PATScope, it as getCommand$3, j as logBetaWarning, jt as getMigrationFilePath, l as restoreCommand, ln as withCommonArgs, lt as functionExecutionStatusToString, mt as applyCommand, nn as readPackageJson, nt as startCommand, on as confirmationArgs, ot as executionsCommand, p as getCommand$4, q as webhookCommand, qt as fetchLatestToken, r as removeCommand, rn as FunctionExecution_Type, s as inviteCommand, sn as deploymentArgs, t as updateCommand$2, tn as initOperatorClient, un as workspaceArgs, ut as formatKeyValueTable, vt as parseMigrationLabelNumber } from "../update-70uX2TDG.mjs";
5
+ import { f as logger, p as styles } from "../application-DLUgR1gv.mjs";
6
6
  import { createRequire, register } from "node:module";
7
7
  import { arg, defineCommand, runCommand, runMain } from "politty";
8
8
  import { withCompletionCommand } from "politty/completion";
@@ -38,6 +38,139 @@ const executorCommand = defineCommand({
38
38
  }
39
39
  });
40
40
 
41
+ //#endregion
42
+ //#region src/cli/function/logs.ts
43
+ /**
44
+ * Convert function execution type enum to string.
45
+ * @param type - Function execution type enum value
46
+ * @returns Type string representation
47
+ */
48
+ function functionExecutionTypeToString(type) {
49
+ switch (type) {
50
+ case FunctionExecution_Type.STANDARD: return "STANDARD";
51
+ case FunctionExecution_Type.JOB: return "JOB";
52
+ default: return "UNSPECIFIED";
53
+ }
54
+ }
55
+ /**
56
+ * Transform FunctionExecution to FunctionExecutionListInfo for list display.
57
+ * @param execution - FunctionExecution from proto
58
+ * @returns Function execution list info
59
+ */
60
+ function toFunctionExecutionListInfo(execution) {
61
+ return {
62
+ id: execution.id,
63
+ scriptName: execution.scriptName,
64
+ status: functionExecutionStatusToString(execution.status),
65
+ type: functionExecutionTypeToString(execution.type),
66
+ startedAt: execution.startedAt ? timestampDate(execution.startedAt) : null,
67
+ finishedAt: execution.finishedAt ? timestampDate(execution.finishedAt) : null
68
+ };
69
+ }
70
+ /**
71
+ * Transform FunctionExecution to FunctionExecutionDetailInfo for detail display.
72
+ * @param execution - FunctionExecution from proto
73
+ * @returns Function execution detail info
74
+ */
75
+ function toFunctionExecutionDetailInfo(execution) {
76
+ return {
77
+ id: execution.id,
78
+ scriptName: execution.scriptName,
79
+ status: functionExecutionStatusToString(execution.status),
80
+ type: functionExecutionTypeToString(execution.type),
81
+ startedAt: execution.startedAt ? timestampDate(execution.startedAt) : null,
82
+ finishedAt: execution.finishedAt ? timestampDate(execution.finishedAt) : null,
83
+ logs: execution.logs,
84
+ result: execution.result
85
+ };
86
+ }
87
+ /**
88
+ * Print function execution detail in a human-readable format.
89
+ * @param detail - Function execution detail info
90
+ */
91
+ function printFunctionExecutionDetail(detail) {
92
+ const formatDate = (date) => date ? date.toISOString() : "N/A";
93
+ const summaryData = [
94
+ ["id", detail.id],
95
+ ["scriptName", detail.scriptName],
96
+ ["status", detail.status],
97
+ ["type", detail.type],
98
+ ["startedAt", formatDate(detail.startedAt)],
99
+ ["finishedAt", formatDate(detail.finishedAt)]
100
+ ];
101
+ logger.out(formatKeyValueTable(summaryData));
102
+ if (detail.logs) {
103
+ logger.log(styles.bold("\nLogs:"));
104
+ for (const line of detail.logs.split("\n")) logger.log(` ${line}`);
105
+ }
106
+ if (detail.result) {
107
+ logger.log(styles.bold("\nResult:"));
108
+ try {
109
+ const parsed = JSON.parse(detail.result);
110
+ logger.log(` ${JSON.stringify(parsed, null, 2).split("\n").join("\n ")}`);
111
+ } catch {
112
+ logger.log(` ${detail.result}`);
113
+ }
114
+ }
115
+ }
116
+ const logsCommand = defineCommand({
117
+ name: "logs",
118
+ description: "List or get function execution logs.",
119
+ args: z.object({
120
+ ...commonArgs,
121
+ ...jsonArgs,
122
+ ...workspaceArgs,
123
+ executionId: arg(z.string().optional(), {
124
+ positional: true,
125
+ description: "Execution ID (if provided, shows details with logs)"
126
+ })
127
+ }),
128
+ run: withCommonArgs(async (args) => {
129
+ const client = await initOperatorClient(await loadAccessToken({
130
+ useProfile: true,
131
+ profile: args.profile
132
+ }));
133
+ const workspaceId = loadWorkspaceId({
134
+ workspaceId: args["workspace-id"],
135
+ profile: args.profile
136
+ });
137
+ if (args.executionId) {
138
+ const { execution } = await client.getFunctionExecution({
139
+ workspaceId,
140
+ executionId: args.executionId
141
+ });
142
+ if (!execution) throw new Error(`Function execution '${args.executionId}' not found.`);
143
+ const detail = toFunctionExecutionDetailInfo(execution);
144
+ if (args.json) logger.out(detail);
145
+ else printFunctionExecutionDetail(detail);
146
+ } else {
147
+ const logs = (await fetchAll(async (pageToken) => {
148
+ const { executions, nextPageToken } = await client.listFunctionExecutions({
149
+ workspaceId,
150
+ pageToken
151
+ });
152
+ return [executions, nextPageToken];
153
+ })).map(toFunctionExecutionListInfo);
154
+ if (logs.length === 0 && !args.json) {
155
+ logger.info("No function execution logs found.");
156
+ return;
157
+ }
158
+ logger.out(logs);
159
+ }
160
+ })
161
+ });
162
+
163
+ //#endregion
164
+ //#region src/cli/function/index.ts
165
+ const functionCommand = defineCommand({
166
+ name: "function",
167
+ description: "Manage functions",
168
+ subCommands: { logs: logsCommand },
169
+ async run() {
170
+ await runCommand(logsCommand, []);
171
+ }
172
+ });
173
+
41
174
  //#endregion
42
175
  //#region src/cli/init.ts
43
176
  const detectPackageManager = () => {
@@ -2161,6 +2294,7 @@ const mainCommand = withCompletionCommand(defineCommand({
2161
2294
  api: apiCommand,
2162
2295
  apply: applyCommand,
2163
2296
  executor: executorCommand,
2297
+ function: functionCommand,
2164
2298
  generate: generateCommand$1,
2165
2299
  init: initCommand,
2166
2300
  login: loginCommand,