@depup/vercel 50.32.5-depup.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/LICENSE +202 -0
- package/README.md +38 -0
- package/changes.json +38 -0
- package/dist/chunks/chunk-2DLBVZWU.js +197 -0
- package/dist/chunks/chunk-2HSQ7YUK.js +93 -0
- package/dist/chunks/chunk-2IQTNMUG.js +86 -0
- package/dist/chunks/chunk-3FRG2XGZ.js +466 -0
- package/dist/chunks/chunk-3KMKI2FP.js +34 -0
- package/dist/chunks/chunk-3XFFP2BA.js +110 -0
- package/dist/chunks/chunk-4S3Y3ATR.js +5383 -0
- package/dist/chunks/chunk-7EHTK7LP.js +359 -0
- package/dist/chunks/chunk-7YHZDJ4G.js +116 -0
- package/dist/chunks/chunk-A3NYPUKZ.js +17 -0
- package/dist/chunks/chunk-AA7QEJFB.js +5204 -0
- package/dist/chunks/chunk-AHU7WNL2.js +24 -0
- package/dist/chunks/chunk-AKQZ7KG3.js +4172 -0
- package/dist/chunks/chunk-AQLVWVEN.js +39155 -0
- package/dist/chunks/chunk-BQ3DXZNT.js +968 -0
- package/dist/chunks/chunk-E65JE2CC.js +102 -0
- package/dist/chunks/chunk-EKPSCRJZ.js +26 -0
- package/dist/chunks/chunk-EOZFDJSY.js +18 -0
- package/dist/chunks/chunk-FDJURQMQ.js +4676 -0
- package/dist/chunks/chunk-FLKHKWZV.js +1854 -0
- package/dist/chunks/chunk-G6BUEBF5.js +192 -0
- package/dist/chunks/chunk-GBNIO3KP.js +771 -0
- package/dist/chunks/chunk-GGP5R3FU.js +129 -0
- package/dist/chunks/chunk-H5XJSH37.js +91 -0
- package/dist/chunks/chunk-IB5L4LKZ.js +1082 -0
- package/dist/chunks/chunk-IE7MNZ56.js +149 -0
- package/dist/chunks/chunk-IK7DLK2T.js +16112 -0
- package/dist/chunks/chunk-IUGPWINM.js +104 -0
- package/dist/chunks/chunk-J7HDA5GH.js +54 -0
- package/dist/chunks/chunk-JLYZNGYY.js +293 -0
- package/dist/chunks/chunk-JQ4NA5MX.js +250 -0
- package/dist/chunks/chunk-LL26LVRR.js +81 -0
- package/dist/chunks/chunk-LW5ZNGW7.js +127 -0
- package/dist/chunks/chunk-LWBSOTJP.js +1772 -0
- package/dist/chunks/chunk-MBGJBHYD.js +388 -0
- package/dist/chunks/chunk-NUKAG3YM.js +168 -0
- package/dist/chunks/chunk-O7I4ZOCC.js +58 -0
- package/dist/chunks/chunk-OWR3XNE3.js +48 -0
- package/dist/chunks/chunk-P3SKP5WM.js +27 -0
- package/dist/chunks/chunk-P4I4DMEU.js +342 -0
- package/dist/chunks/chunk-P5Q6F5IA.js +107 -0
- package/dist/chunks/chunk-PMSMUMUO.js +30 -0
- package/dist/chunks/chunk-QXRJ52T4.js +2977 -0
- package/dist/chunks/chunk-RQXPRFRM.js +90 -0
- package/dist/chunks/chunk-S7KYDPEM.js +1564 -0
- package/dist/chunks/chunk-SGGLJFUZ.js +68 -0
- package/dist/chunks/chunk-SOTR4CXR.js +34 -0
- package/dist/chunks/chunk-TEVP63TU.js +1717 -0
- package/dist/chunks/chunk-TNBMKNET.js +323 -0
- package/dist/chunks/chunk-TZ2YI2VH.js +87 -0
- package/dist/chunks/chunk-U6XOC6E4.js +903 -0
- package/dist/chunks/chunk-V5P25P7F.js +22 -0
- package/dist/chunks/chunk-WQ5CUZWR.js +333 -0
- package/dist/chunks/chunk-WU2BPWRP.js +12237 -0
- package/dist/chunks/chunk-XPKWKPWA.js +44 -0
- package/dist/chunks/chunk-XR53KVJD.js +33 -0
- package/dist/chunks/chunk-Y4JJYHUG.js +16 -0
- package/dist/chunks/chunk-YPQSDAEW.js +29 -0
- package/dist/chunks/chunk-ZB2UO4V2.js +135 -0
- package/dist/chunks/chunk-ZLCMHY2G.js +1528 -0
- package/dist/chunks/compile-vercel-config-XU3YY2CZ.js +32 -0
- package/dist/chunks/delete-EJ2V7KQO.js +144 -0
- package/dist/chunks/disable-BKRFMX4U.js +122 -0
- package/dist/chunks/discard-4WF34DXK.js +118 -0
- package/dist/chunks/edit-FQE7JGU3.js +509 -0
- package/dist/chunks/emit-flags-datafiles-QYKPNWPX.js +17 -0
- package/dist/chunks/enable-VCNMX63U.js +122 -0
- package/dist/chunks/export-3KNVJCQR.js +133 -0
- package/dist/chunks/list-43XQCGKH.js +382 -0
- package/dist/chunks/list-DUL6PHUR.js +394 -0
- package/dist/chunks/publish-CF7GVZK3.js +128 -0
- package/dist/chunks/query-KWKO7VWO.js +954 -0
- package/dist/chunks/reorder-GU65YMIN.js +259 -0
- package/dist/chunks/restore-Q7ENGWVJ.js +158 -0
- package/dist/chunks/routes-Q5CWG44T.js +20 -0
- package/dist/chunks/schema-PJKLO2K2.js +176 -0
- package/dist/chunks/stamp-RTPE2EBB.js +15 -0
- package/dist/chunks/types-563KUQRV.js +108 -0
- package/dist/chunks/update-route-version-E3V47KNI.js +13 -0
- package/dist/commands/build/index.js +1597 -0
- package/dist/commands/deploy/index.js +1711 -0
- package/dist/commands/dev/builder-worker.cjs +95 -0
- package/dist/commands/dev/index.js +20810 -0
- package/dist/commands/env/index.js +2154 -0
- package/dist/commands/link/index.js +225 -0
- package/dist/commands/list/index.js +528 -0
- package/dist/commands-bulk.js +29627 -0
- package/dist/get-latest-worker.cjs +272 -0
- package/dist/help.js +14 -0
- package/dist/index.js +24274 -0
- package/dist/vc.js +36 -0
- package/dist/version.mjs +1 -0
- package/package.json +254 -0
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
import {
|
|
8
|
+
handleValidationError,
|
|
9
|
+
normalizeRepeatableStringFilters,
|
|
10
|
+
outputError,
|
|
11
|
+
validateAllProjectMutualExclusivity,
|
|
12
|
+
validateIntegerRangeWithDefault,
|
|
13
|
+
validateTimeBound,
|
|
14
|
+
validateTimeOrder
|
|
15
|
+
} from "./chunk-IE7MNZ56.js";
|
|
16
|
+
import {
|
|
17
|
+
getCommandFlags
|
|
18
|
+
} from "./chunk-EOZFDJSY.js";
|
|
19
|
+
import {
|
|
20
|
+
getScope
|
|
21
|
+
} from "./chunk-3KMKI2FP.js";
|
|
22
|
+
import {
|
|
23
|
+
validateJsonOutput
|
|
24
|
+
} from "./chunk-XPKWKPWA.js";
|
|
25
|
+
import {
|
|
26
|
+
activityCommand
|
|
27
|
+
} from "./chunk-LW5ZNGW7.js";
|
|
28
|
+
import {
|
|
29
|
+
getLinkedProject,
|
|
30
|
+
getProjectByNameOrId
|
|
31
|
+
} from "./chunk-AQLVWVEN.js";
|
|
32
|
+
import "./chunk-P4I4DMEU.js";
|
|
33
|
+
import "./chunk-SOTR4CXR.js";
|
|
34
|
+
import "./chunk-7EHTK7LP.js";
|
|
35
|
+
import "./chunk-GGP5R3FU.js";
|
|
36
|
+
import {
|
|
37
|
+
ProjectNotFound,
|
|
38
|
+
getCommandName,
|
|
39
|
+
getFlagsSpecification,
|
|
40
|
+
isAPIError,
|
|
41
|
+
parseArguments,
|
|
42
|
+
printError
|
|
43
|
+
} from "./chunk-ZLCMHY2G.js";
|
|
44
|
+
import "./chunk-3XFFP2BA.js";
|
|
45
|
+
import {
|
|
46
|
+
output_manager_default
|
|
47
|
+
} from "./chunk-FDJURQMQ.js";
|
|
48
|
+
import {
|
|
49
|
+
require_source
|
|
50
|
+
} from "./chunk-S7KYDPEM.js";
|
|
51
|
+
import {
|
|
52
|
+
__toESM
|
|
53
|
+
} from "./chunk-TZ2YI2VH.js";
|
|
54
|
+
|
|
55
|
+
// src/commands/activity/list.ts
|
|
56
|
+
var import_chalk = __toESM(require_source(), 1);
|
|
57
|
+
function validateNext(next) {
|
|
58
|
+
if (next === void 0) {
|
|
59
|
+
return { valid: true, value: void 0 };
|
|
60
|
+
}
|
|
61
|
+
if (Number.isNaN(next)) {
|
|
62
|
+
return {
|
|
63
|
+
valid: false,
|
|
64
|
+
code: "INVALID_NEXT",
|
|
65
|
+
message: "Please provide a number for flag `--next`."
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
const date = new Date(next);
|
|
69
|
+
if (Number.isNaN(date.getTime())) {
|
|
70
|
+
return {
|
|
71
|
+
valid: false,
|
|
72
|
+
code: "INVALID_NEXT",
|
|
73
|
+
message: "Please provide a valid unix timestamp in milliseconds for `--next`."
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
return { valid: true, value: date };
|
|
77
|
+
}
|
|
78
|
+
function handleApiError(err, jsonOutput, client) {
|
|
79
|
+
if (err.status === 403) {
|
|
80
|
+
return outputError(
|
|
81
|
+
client,
|
|
82
|
+
jsonOutput,
|
|
83
|
+
"FORBIDDEN",
|
|
84
|
+
"You do not have permission to list activity events. Required permissions: Event: List or OwnEvent: List."
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
return outputError(
|
|
88
|
+
client,
|
|
89
|
+
jsonOutput,
|
|
90
|
+
err.code || "API_ERROR",
|
|
91
|
+
err.serverMessage || `API error (${err.status}).`
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
function formatActor(event) {
|
|
95
|
+
const principal = event.principal;
|
|
96
|
+
if (!principal) {
|
|
97
|
+
return event.principalId || "-";
|
|
98
|
+
}
|
|
99
|
+
if (principal.type === "system") {
|
|
100
|
+
return "system";
|
|
101
|
+
}
|
|
102
|
+
if (principal.username) {
|
|
103
|
+
return principal.username;
|
|
104
|
+
}
|
|
105
|
+
if (principal.name) {
|
|
106
|
+
return principal.name;
|
|
107
|
+
}
|
|
108
|
+
if (principal.slug) {
|
|
109
|
+
return principal.slug;
|
|
110
|
+
}
|
|
111
|
+
if (principal.email) {
|
|
112
|
+
return principal.email;
|
|
113
|
+
}
|
|
114
|
+
return event.principalId || "-";
|
|
115
|
+
}
|
|
116
|
+
function formatTimestamp(createdAt) {
|
|
117
|
+
if (!Number.isFinite(createdAt) || createdAt <= 0) {
|
|
118
|
+
return "-";
|
|
119
|
+
}
|
|
120
|
+
const date = new Date(createdAt);
|
|
121
|
+
if (Number.isNaN(date.getTime())) {
|
|
122
|
+
return "-";
|
|
123
|
+
}
|
|
124
|
+
return date.toISOString();
|
|
125
|
+
}
|
|
126
|
+
function formatEventText(text) {
|
|
127
|
+
return text.replace(/\s+/g, " ").trim();
|
|
128
|
+
}
|
|
129
|
+
function printExpandedEvents(events) {
|
|
130
|
+
const lines = [""];
|
|
131
|
+
events.forEach((event) => {
|
|
132
|
+
lines.push(import_chalk.default.bold(formatEventText(event.text)));
|
|
133
|
+
lines.push(` ${import_chalk.default.cyan("Type:")} ${event.type ?? "-"}`);
|
|
134
|
+
lines.push(` ${import_chalk.default.cyan("Actor:")} ${formatActor(event)}`);
|
|
135
|
+
lines.push(
|
|
136
|
+
` ${import_chalk.default.cyan("Timestamp:")} ${formatTimestamp(event.createdAt)}`
|
|
137
|
+
);
|
|
138
|
+
lines.push(` ${import_chalk.default.cyan("ID:")} ${event.id}`);
|
|
139
|
+
lines.push("");
|
|
140
|
+
});
|
|
141
|
+
output_manager_default.print(`${lines.join("\n")}
|
|
142
|
+
`);
|
|
143
|
+
}
|
|
144
|
+
function trackTelemetry(flags, types, telemetry) {
|
|
145
|
+
telemetry.trackCliOptionType(types.length > 0 ? types : void 0);
|
|
146
|
+
telemetry.trackCliOptionSince(flags["--since"]);
|
|
147
|
+
telemetry.trackCliOptionUntil(flags["--until"]);
|
|
148
|
+
telemetry.trackCliOptionProject(flags["--project"]);
|
|
149
|
+
telemetry.trackCliFlagAll(flags["--all"]);
|
|
150
|
+
telemetry.trackCliOptionLimit(flags["--limit"]);
|
|
151
|
+
telemetry.trackCliOptionNext(flags["--next"]);
|
|
152
|
+
telemetry.trackCliOptionFormat(flags["--format"]);
|
|
153
|
+
}
|
|
154
|
+
function parseFlags(client) {
|
|
155
|
+
const flagsSpecification = getFlagsSpecification(activityCommand.options);
|
|
156
|
+
try {
|
|
157
|
+
const parsedArgs = parseArguments(client.argv.slice(2), flagsSpecification);
|
|
158
|
+
return parsedArgs.flags;
|
|
159
|
+
} catch (err) {
|
|
160
|
+
printError(err);
|
|
161
|
+
return 1;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
function resolveValidatedInputs(flags, jsonOutput, client, normalizedTypes) {
|
|
165
|
+
const limitResult = validateIntegerRangeWithDefault(flags["--limit"], {
|
|
166
|
+
flag: "--limit",
|
|
167
|
+
min: 1,
|
|
168
|
+
max: 100,
|
|
169
|
+
defaultValue: 20
|
|
170
|
+
});
|
|
171
|
+
if (!limitResult.valid) {
|
|
172
|
+
return handleValidationError(limitResult, jsonOutput, client);
|
|
173
|
+
}
|
|
174
|
+
const mutualResult = validateAllProjectMutualExclusivity(
|
|
175
|
+
flags["--all"],
|
|
176
|
+
flags["--project"]
|
|
177
|
+
);
|
|
178
|
+
if (!mutualResult.valid) {
|
|
179
|
+
return handleValidationError(mutualResult, jsonOutput, client);
|
|
180
|
+
}
|
|
181
|
+
const sinceResult = validateTimeBound(flags["--since"]);
|
|
182
|
+
if (!sinceResult.valid) {
|
|
183
|
+
return handleValidationError(sinceResult, jsonOutput, client);
|
|
184
|
+
}
|
|
185
|
+
const nextResult = validateNext(flags["--next"]);
|
|
186
|
+
if (!nextResult.valid) {
|
|
187
|
+
return handleValidationError(nextResult, jsonOutput, client);
|
|
188
|
+
}
|
|
189
|
+
let until = nextResult.value;
|
|
190
|
+
if (!until) {
|
|
191
|
+
const untilResult = validateTimeBound(flags["--until"]);
|
|
192
|
+
if (!untilResult.valid) {
|
|
193
|
+
return handleValidationError(untilResult, jsonOutput, client);
|
|
194
|
+
}
|
|
195
|
+
until = untilResult.value;
|
|
196
|
+
}
|
|
197
|
+
const since = sinceResult.value;
|
|
198
|
+
const timeOrderResult = validateTimeOrder(since, until);
|
|
199
|
+
if (!timeOrderResult.valid) {
|
|
200
|
+
return handleValidationError(timeOrderResult, jsonOutput, client);
|
|
201
|
+
}
|
|
202
|
+
return {
|
|
203
|
+
limit: limitResult.value,
|
|
204
|
+
types: normalizedTypes,
|
|
205
|
+
since,
|
|
206
|
+
until
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
async function resolveScope(client, opts) {
|
|
210
|
+
if (opts.all || opts.project) {
|
|
211
|
+
const { team } = await getScope(client);
|
|
212
|
+
if (!team) {
|
|
213
|
+
return outputError(
|
|
214
|
+
client,
|
|
215
|
+
opts.jsonOutput,
|
|
216
|
+
"NO_TEAM",
|
|
217
|
+
"No team context found. Run `vercel switch` to select a team, or use `vercel link` in a project directory."
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
if (opts.all) {
|
|
221
|
+
return {
|
|
222
|
+
teamId: team.id,
|
|
223
|
+
teamSlug: team.slug
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
let projectResult;
|
|
227
|
+
try {
|
|
228
|
+
projectResult = await getProjectByNameOrId(
|
|
229
|
+
client,
|
|
230
|
+
opts.project,
|
|
231
|
+
team.id
|
|
232
|
+
);
|
|
233
|
+
} catch (err) {
|
|
234
|
+
if (isAPIError(err)) {
|
|
235
|
+
return outputError(
|
|
236
|
+
client,
|
|
237
|
+
opts.jsonOutput,
|
|
238
|
+
err.code || "API_ERROR",
|
|
239
|
+
err.serverMessage || (err.status === 403 ? `You do not have permission to access project "${opts.project}" in team "${team.slug}".` : `API error (${err.status}).`)
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
throw err;
|
|
243
|
+
}
|
|
244
|
+
if (projectResult instanceof ProjectNotFound) {
|
|
245
|
+
return outputError(
|
|
246
|
+
client,
|
|
247
|
+
opts.jsonOutput,
|
|
248
|
+
"PROJECT_NOT_FOUND",
|
|
249
|
+
`Project "${opts.project}" was not found in team "${team.slug}".`
|
|
250
|
+
);
|
|
251
|
+
}
|
|
252
|
+
return {
|
|
253
|
+
teamId: team.id,
|
|
254
|
+
teamSlug: team.slug,
|
|
255
|
+
projectIds: [projectResult.id]
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
const linkedProject = await getLinkedProject(client);
|
|
259
|
+
if (linkedProject.status === "error") {
|
|
260
|
+
return linkedProject.exitCode;
|
|
261
|
+
}
|
|
262
|
+
if (linkedProject.status === "not_linked") {
|
|
263
|
+
return outputError(
|
|
264
|
+
client,
|
|
265
|
+
opts.jsonOutput,
|
|
266
|
+
"NOT_LINKED",
|
|
267
|
+
"No linked project found. Run `vercel link` to link a project, or use --project <name> or --all."
|
|
268
|
+
);
|
|
269
|
+
}
|
|
270
|
+
const isTeamProject = linkedProject.org.type === "team";
|
|
271
|
+
return {
|
|
272
|
+
projectIds: [linkedProject.project.id],
|
|
273
|
+
teamId: isTeamProject ? linkedProject.org.id : void 0,
|
|
274
|
+
teamSlug: isTeamProject ? linkedProject.org.slug : void 0
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
function buildEventsQuery(params) {
|
|
278
|
+
const query = new URLSearchParams({
|
|
279
|
+
limit: String(params.limit + 1)
|
|
280
|
+
});
|
|
281
|
+
if (params.types.length > 0) {
|
|
282
|
+
query.set("types", params.types.join(","));
|
|
283
|
+
}
|
|
284
|
+
if (params.since) {
|
|
285
|
+
query.set("since", params.since.toISOString());
|
|
286
|
+
}
|
|
287
|
+
if (params.until) {
|
|
288
|
+
query.set("until", params.until.toISOString());
|
|
289
|
+
}
|
|
290
|
+
if (params.scope.projectIds && params.scope.projectIds.length > 0) {
|
|
291
|
+
query.set("projectIds", params.scope.projectIds.join(","));
|
|
292
|
+
}
|
|
293
|
+
if (params.scope.teamId) {
|
|
294
|
+
query.set("teamId", params.scope.teamId);
|
|
295
|
+
}
|
|
296
|
+
if (params.scope.teamSlug) {
|
|
297
|
+
query.set("slug", params.scope.teamSlug);
|
|
298
|
+
}
|
|
299
|
+
if (params.jsonOutput) {
|
|
300
|
+
query.set("withPayload", "true");
|
|
301
|
+
}
|
|
302
|
+
return query;
|
|
303
|
+
}
|
|
304
|
+
function paginateEvents(allEvents, limit) {
|
|
305
|
+
const events = allEvents.slice(0, limit);
|
|
306
|
+
const hasMore = allEvents.length > limit;
|
|
307
|
+
const lastVisibleEvent = events[events.length - 1];
|
|
308
|
+
const next = hasMore && typeof lastVisibleEvent?.createdAt === "number" ? lastVisibleEvent.createdAt - 1 : null;
|
|
309
|
+
return { events, next };
|
|
310
|
+
}
|
|
311
|
+
function printNextPageHint(flags, next) {
|
|
312
|
+
const commandFlags = getCommandFlags(flags, ["--next"]);
|
|
313
|
+
output_manager_default.log(
|
|
314
|
+
`To display the next page, run ${getCommandName(
|
|
315
|
+
`activity${commandFlags} --next ${next}`
|
|
316
|
+
)}`
|
|
317
|
+
);
|
|
318
|
+
}
|
|
319
|
+
async function list(client, telemetry) {
|
|
320
|
+
const flags = parseFlags(client);
|
|
321
|
+
if (typeof flags === "number") {
|
|
322
|
+
return flags;
|
|
323
|
+
}
|
|
324
|
+
const formatResult = validateJsonOutput(flags);
|
|
325
|
+
if (!formatResult.valid) {
|
|
326
|
+
output_manager_default.error(formatResult.error);
|
|
327
|
+
return 1;
|
|
328
|
+
}
|
|
329
|
+
const jsonOutput = formatResult.jsonOutput;
|
|
330
|
+
const normalizedTypes = normalizeRepeatableStringFilters(flags["--type"]);
|
|
331
|
+
trackTelemetry(flags, normalizedTypes, telemetry);
|
|
332
|
+
const validatedInputs = resolveValidatedInputs(
|
|
333
|
+
flags,
|
|
334
|
+
jsonOutput,
|
|
335
|
+
client,
|
|
336
|
+
normalizedTypes
|
|
337
|
+
);
|
|
338
|
+
if (typeof validatedInputs === "number") {
|
|
339
|
+
return validatedInputs;
|
|
340
|
+
}
|
|
341
|
+
const scope = await resolveScope(client, {
|
|
342
|
+
project: flags["--project"],
|
|
343
|
+
all: flags["--all"],
|
|
344
|
+
jsonOutput
|
|
345
|
+
});
|
|
346
|
+
if (typeof scope === "number") {
|
|
347
|
+
return scope;
|
|
348
|
+
}
|
|
349
|
+
const query = buildEventsQuery({
|
|
350
|
+
limit: validatedInputs.limit,
|
|
351
|
+
types: validatedInputs.types,
|
|
352
|
+
since: validatedInputs.since,
|
|
353
|
+
until: validatedInputs.until,
|
|
354
|
+
scope,
|
|
355
|
+
jsonOutput
|
|
356
|
+
});
|
|
357
|
+
output_manager_default.spinner("Fetching activity...");
|
|
358
|
+
try {
|
|
359
|
+
const response = await client.fetch(
|
|
360
|
+
`/v3/events?${query.toString()}`,
|
|
361
|
+
{
|
|
362
|
+
useCurrentTeam: false
|
|
363
|
+
}
|
|
364
|
+
);
|
|
365
|
+
const allEvents = Array.isArray(response.events) ? response.events : [];
|
|
366
|
+
const { events, next } = paginateEvents(allEvents, validatedInputs.limit);
|
|
367
|
+
if (jsonOutput) {
|
|
368
|
+
client.stdout.write(
|
|
369
|
+
`${JSON.stringify({ events, pagination: { next } }, null, 2)}
|
|
370
|
+
`
|
|
371
|
+
);
|
|
372
|
+
return 0;
|
|
373
|
+
}
|
|
374
|
+
if (events.length === 0) {
|
|
375
|
+
output_manager_default.log("No activity events found.");
|
|
376
|
+
return 0;
|
|
377
|
+
}
|
|
378
|
+
printExpandedEvents(events);
|
|
379
|
+
if (next !== null) {
|
|
380
|
+
printNextPageHint(flags, next);
|
|
381
|
+
}
|
|
382
|
+
return 0;
|
|
383
|
+
} catch (err) {
|
|
384
|
+
if (isAPIError(err)) {
|
|
385
|
+
return handleApiError(err, jsonOutput, client);
|
|
386
|
+
}
|
|
387
|
+
throw err;
|
|
388
|
+
} finally {
|
|
389
|
+
output_manager_default.stopSpinner();
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
export {
|
|
393
|
+
list as default
|
|
394
|
+
};
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
import {
|
|
8
|
+
updateRouteVersion
|
|
9
|
+
} from "./chunk-PMSMUMUO.js";
|
|
10
|
+
import {
|
|
11
|
+
getRouteVersions
|
|
12
|
+
} from "./chunk-AHU7WNL2.js";
|
|
13
|
+
import {
|
|
14
|
+
confirmAction,
|
|
15
|
+
ensureProjectLink,
|
|
16
|
+
getRoutes,
|
|
17
|
+
parseSubcommandArgs,
|
|
18
|
+
printDiffSummary
|
|
19
|
+
} from "./chunk-TNBMKNET.js";
|
|
20
|
+
import {
|
|
21
|
+
publishSubcommand
|
|
22
|
+
} from "./chunk-U6XOC6E4.js";
|
|
23
|
+
import "./chunk-AQLVWVEN.js";
|
|
24
|
+
import "./chunk-P4I4DMEU.js";
|
|
25
|
+
import {
|
|
26
|
+
stamp_default
|
|
27
|
+
} from "./chunk-SOTR4CXR.js";
|
|
28
|
+
import "./chunk-7EHTK7LP.js";
|
|
29
|
+
import "./chunk-GGP5R3FU.js";
|
|
30
|
+
import {
|
|
31
|
+
getCommandName
|
|
32
|
+
} from "./chunk-ZLCMHY2G.js";
|
|
33
|
+
import "./chunk-3XFFP2BA.js";
|
|
34
|
+
import {
|
|
35
|
+
output_manager_default
|
|
36
|
+
} from "./chunk-FDJURQMQ.js";
|
|
37
|
+
import {
|
|
38
|
+
require_source
|
|
39
|
+
} from "./chunk-S7KYDPEM.js";
|
|
40
|
+
import {
|
|
41
|
+
__toESM
|
|
42
|
+
} from "./chunk-TZ2YI2VH.js";
|
|
43
|
+
|
|
44
|
+
// src/commands/routes/publish.ts
|
|
45
|
+
var import_chalk = __toESM(require_source(), 1);
|
|
46
|
+
async function publish(client, argv) {
|
|
47
|
+
const parsed = await parseSubcommandArgs(argv, publishSubcommand);
|
|
48
|
+
if (typeof parsed === "number")
|
|
49
|
+
return parsed;
|
|
50
|
+
const link = await ensureProjectLink(client);
|
|
51
|
+
if (typeof link === "number")
|
|
52
|
+
return link;
|
|
53
|
+
const { project, org } = link;
|
|
54
|
+
const teamId = org.type === "team" ? org.id : void 0;
|
|
55
|
+
output_manager_default.spinner(`Fetching route versions for ${import_chalk.default.bold(project.name)}`);
|
|
56
|
+
const { versions } = await getRouteVersions(client, project.id, { teamId });
|
|
57
|
+
const version = versions.find((v) => v.isStaging);
|
|
58
|
+
if (!version) {
|
|
59
|
+
output_manager_default.warn(
|
|
60
|
+
`No staged changes to publish. Make changes first with ${import_chalk.default.cyan(
|
|
61
|
+
getCommandName("routes add")
|
|
62
|
+
)}.`
|
|
63
|
+
);
|
|
64
|
+
return 0;
|
|
65
|
+
}
|
|
66
|
+
output_manager_default.spinner("Fetching changes");
|
|
67
|
+
const { routes: diffRoutes } = await getRoutes(client, project.id, {
|
|
68
|
+
teamId,
|
|
69
|
+
versionId: version.id,
|
|
70
|
+
diff: true
|
|
71
|
+
});
|
|
72
|
+
const changedRoutes = diffRoutes.filter((r) => r.action !== void 0);
|
|
73
|
+
if (changedRoutes.length > 0) {
|
|
74
|
+
output_manager_default.print(`
|
|
75
|
+
${import_chalk.default.bold("Changes to be published:")}
|
|
76
|
+
|
|
77
|
+
`);
|
|
78
|
+
printDiffSummary(changedRoutes);
|
|
79
|
+
output_manager_default.print("\n");
|
|
80
|
+
} else {
|
|
81
|
+
output_manager_default.print(
|
|
82
|
+
`
|
|
83
|
+
${import_chalk.default.gray("No changes detected from current production version.")}
|
|
84
|
+
|
|
85
|
+
`
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
const confirmed = await confirmAction(
|
|
89
|
+
client,
|
|
90
|
+
parsed.flags["--yes"],
|
|
91
|
+
"Publish these changes to production?",
|
|
92
|
+
`This will make them live for ${import_chalk.default.bold(project.name)}.`
|
|
93
|
+
);
|
|
94
|
+
if (!confirmed) {
|
|
95
|
+
output_manager_default.log("Canceled");
|
|
96
|
+
return 0;
|
|
97
|
+
}
|
|
98
|
+
const updateStamp = stamp_default();
|
|
99
|
+
output_manager_default.spinner("Publishing to production");
|
|
100
|
+
try {
|
|
101
|
+
const { version: newVersion } = await updateRouteVersion(
|
|
102
|
+
client,
|
|
103
|
+
project.id,
|
|
104
|
+
version.id,
|
|
105
|
+
"promote",
|
|
106
|
+
{ teamId }
|
|
107
|
+
);
|
|
108
|
+
output_manager_default.log(
|
|
109
|
+
`${import_chalk.default.cyan("Success!")} Routes published to production ${import_chalk.default.gray(
|
|
110
|
+
updateStamp()
|
|
111
|
+
)}`
|
|
112
|
+
);
|
|
113
|
+
if (newVersion.ruleCount !== void 0) {
|
|
114
|
+
output_manager_default.print(
|
|
115
|
+
` ${import_chalk.default.bold("Active routes:")} ${newVersion.ruleCount}
|
|
116
|
+
`
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
return 0;
|
|
120
|
+
} catch (e) {
|
|
121
|
+
const error = e;
|
|
122
|
+
output_manager_default.error(error.message || "Failed to publish routes");
|
|
123
|
+
return 1;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
export {
|
|
127
|
+
publish as default
|
|
128
|
+
};
|