@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,259 @@
|
|
|
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
|
+
getRouteVersions
|
|
9
|
+
} from "./chunk-AHU7WNL2.js";
|
|
10
|
+
import {
|
|
11
|
+
ensureProjectLink,
|
|
12
|
+
getRoutes,
|
|
13
|
+
offerAutoPromote,
|
|
14
|
+
parsePosition,
|
|
15
|
+
parseSubcommandArgs,
|
|
16
|
+
resolveRoute
|
|
17
|
+
} from "./chunk-TNBMKNET.js";
|
|
18
|
+
import {
|
|
19
|
+
reorderSubcommand
|
|
20
|
+
} from "./chunk-U6XOC6E4.js";
|
|
21
|
+
import "./chunk-AQLVWVEN.js";
|
|
22
|
+
import "./chunk-P4I4DMEU.js";
|
|
23
|
+
import {
|
|
24
|
+
stamp_default
|
|
25
|
+
} from "./chunk-SOTR4CXR.js";
|
|
26
|
+
import "./chunk-7EHTK7LP.js";
|
|
27
|
+
import "./chunk-GGP5R3FU.js";
|
|
28
|
+
import {
|
|
29
|
+
getCommandName
|
|
30
|
+
} from "./chunk-ZLCMHY2G.js";
|
|
31
|
+
import "./chunk-3XFFP2BA.js";
|
|
32
|
+
import {
|
|
33
|
+
output_manager_default
|
|
34
|
+
} from "./chunk-FDJURQMQ.js";
|
|
35
|
+
import {
|
|
36
|
+
require_source
|
|
37
|
+
} from "./chunk-S7KYDPEM.js";
|
|
38
|
+
import {
|
|
39
|
+
__toESM
|
|
40
|
+
} from "./chunk-TZ2YI2VH.js";
|
|
41
|
+
|
|
42
|
+
// src/commands/routes/reorder.ts
|
|
43
|
+
var import_chalk = __toESM(require_source(), 1);
|
|
44
|
+
|
|
45
|
+
// src/util/routes/stage-routes.ts
|
|
46
|
+
async function stageRoutes(client, projectId, routes, overwrite, options = {}) {
|
|
47
|
+
const { teamId } = options;
|
|
48
|
+
const query = new URLSearchParams();
|
|
49
|
+
if (teamId)
|
|
50
|
+
query.set("teamId", teamId);
|
|
51
|
+
const queryString = query.toString();
|
|
52
|
+
const url = `/v1/projects/${projectId}/routes${queryString ? `?${queryString}` : ""}`;
|
|
53
|
+
return await client.fetch(url, {
|
|
54
|
+
method: "PUT",
|
|
55
|
+
headers: {
|
|
56
|
+
"Content-Type": "application/json"
|
|
57
|
+
},
|
|
58
|
+
body: JSON.stringify({ routes, overwrite })
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// src/commands/routes/reorder.ts
|
|
63
|
+
async function reorder(client, argv) {
|
|
64
|
+
const parsed = await parseSubcommandArgs(argv, reorderSubcommand);
|
|
65
|
+
if (typeof parsed === "number")
|
|
66
|
+
return parsed;
|
|
67
|
+
const link = await ensureProjectLink(client);
|
|
68
|
+
if (typeof link === "number")
|
|
69
|
+
return link;
|
|
70
|
+
const { project, org } = link;
|
|
71
|
+
const teamId = org.type === "team" ? org.id : void 0;
|
|
72
|
+
const { args, flags } = parsed;
|
|
73
|
+
const skipConfirmation = flags["--yes"];
|
|
74
|
+
const identifier = args[0];
|
|
75
|
+
if (!identifier) {
|
|
76
|
+
output_manager_default.error(
|
|
77
|
+
`Route name or ID is required. Usage: ${getCommandName("routes reorder <name-or-id> --position <pos>")}`
|
|
78
|
+
);
|
|
79
|
+
return 1;
|
|
80
|
+
}
|
|
81
|
+
const { versions } = await getRouteVersions(client, project.id, { teamId });
|
|
82
|
+
const existingStagingVersion = versions.find((v) => v.isStaging);
|
|
83
|
+
output_manager_default.spinner("Fetching routes");
|
|
84
|
+
const { routes } = await getRoutes(client, project.id, { teamId });
|
|
85
|
+
output_manager_default.stopSpinner();
|
|
86
|
+
if (routes.length === 0) {
|
|
87
|
+
output_manager_default.error("No routes found in this project.");
|
|
88
|
+
return 1;
|
|
89
|
+
}
|
|
90
|
+
if (routes.length === 1) {
|
|
91
|
+
output_manager_default.error("Cannot reorder when there is only one route.");
|
|
92
|
+
return 1;
|
|
93
|
+
}
|
|
94
|
+
const route = await resolveRoute(client, routes, identifier);
|
|
95
|
+
if (!route) {
|
|
96
|
+
output_manager_default.error(
|
|
97
|
+
`No route found matching "${identifier}". Run ${import_chalk.default.cyan(
|
|
98
|
+
getCommandName("routes list")
|
|
99
|
+
)} to see all routes.`
|
|
100
|
+
);
|
|
101
|
+
return 1;
|
|
102
|
+
}
|
|
103
|
+
const currentIndex = routes.findIndex((r) => r.id === route.id);
|
|
104
|
+
const currentPosition = currentIndex + 1;
|
|
105
|
+
let targetIndex;
|
|
106
|
+
const positionFlag = flags["--position"];
|
|
107
|
+
const firstFlag = flags["--first"];
|
|
108
|
+
const lastFlag = flags["--last"];
|
|
109
|
+
if (firstFlag) {
|
|
110
|
+
targetIndex = 0;
|
|
111
|
+
} else if (lastFlag) {
|
|
112
|
+
targetIndex = routes.length;
|
|
113
|
+
} else if (positionFlag) {
|
|
114
|
+
if (positionFlag === "first") {
|
|
115
|
+
targetIndex = 0;
|
|
116
|
+
} else if (positionFlag === "last") {
|
|
117
|
+
targetIndex = routes.length;
|
|
118
|
+
} else {
|
|
119
|
+
const num = parseInt(positionFlag, 10);
|
|
120
|
+
if (!isNaN(num) && String(num) === positionFlag) {
|
|
121
|
+
if (num < 1) {
|
|
122
|
+
output_manager_default.error("Position must be 1 or greater.");
|
|
123
|
+
return 1;
|
|
124
|
+
}
|
|
125
|
+
targetIndex = Math.min(num - 1, routes.length);
|
|
126
|
+
} else {
|
|
127
|
+
try {
|
|
128
|
+
const pos = parsePosition(positionFlag);
|
|
129
|
+
if (pos.placement === "start") {
|
|
130
|
+
targetIndex = 0;
|
|
131
|
+
} else if (pos.placement === "end") {
|
|
132
|
+
targetIndex = routes.length;
|
|
133
|
+
} else if (pos.placement === "after" && pos.referenceId) {
|
|
134
|
+
const refIndex = routes.findIndex((r) => r.id === pos.referenceId);
|
|
135
|
+
if (refIndex === -1) {
|
|
136
|
+
output_manager_default.error(
|
|
137
|
+
`Reference route "${pos.referenceId}" not found. Run ${import_chalk.default.cyan(
|
|
138
|
+
getCommandName("routes list")
|
|
139
|
+
)} to see route IDs.`
|
|
140
|
+
);
|
|
141
|
+
return 1;
|
|
142
|
+
}
|
|
143
|
+
targetIndex = refIndex + 1;
|
|
144
|
+
} else if (pos.placement === "before" && pos.referenceId) {
|
|
145
|
+
const refIndex = routes.findIndex((r) => r.id === pos.referenceId);
|
|
146
|
+
if (refIndex === -1) {
|
|
147
|
+
output_manager_default.error(
|
|
148
|
+
`Reference route "${pos.referenceId}" not found. Run ${import_chalk.default.cyan(
|
|
149
|
+
getCommandName("routes list")
|
|
150
|
+
)} to see route IDs.`
|
|
151
|
+
);
|
|
152
|
+
return 1;
|
|
153
|
+
}
|
|
154
|
+
targetIndex = refIndex;
|
|
155
|
+
} else {
|
|
156
|
+
output_manager_default.error("Invalid position specification.");
|
|
157
|
+
return 1;
|
|
158
|
+
}
|
|
159
|
+
} catch (e) {
|
|
160
|
+
output_manager_default.error(
|
|
161
|
+
`${e instanceof Error ? e.message : "Invalid position"}. Usage: ${getCommandName("routes reorder <name-or-id> --position <pos>")}`
|
|
162
|
+
);
|
|
163
|
+
return 1;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
} else {
|
|
168
|
+
output_manager_default.print("\n");
|
|
169
|
+
output_manager_default.log("Current route order:");
|
|
170
|
+
for (let i = 0; i < routes.length; i++) {
|
|
171
|
+
const r = routes[i];
|
|
172
|
+
const isCurrent = r.id === route.id;
|
|
173
|
+
const prefix = isCurrent ? import_chalk.default.cyan("\u2192") : " ";
|
|
174
|
+
const num = import_chalk.default.gray(`${i + 1}.`);
|
|
175
|
+
const name = isCurrent ? import_chalk.default.bold(r.name) : r.name;
|
|
176
|
+
const src = import_chalk.default.gray(`(${r.route.src})`);
|
|
177
|
+
const marker = isCurrent ? import_chalk.default.cyan(" \u2190 current") : "";
|
|
178
|
+
output_manager_default.print(` ${prefix} ${num} ${name} ${src}${marker}
|
|
179
|
+
`);
|
|
180
|
+
}
|
|
181
|
+
output_manager_default.print("\n");
|
|
182
|
+
const input = await client.input.text({
|
|
183
|
+
message: `Move "${route.name}" to position (1-${routes.length}, "first", or "last"):`,
|
|
184
|
+
validate: (val) => {
|
|
185
|
+
if (!val)
|
|
186
|
+
return "Position is required";
|
|
187
|
+
if (val === "first" || val === "last")
|
|
188
|
+
return true;
|
|
189
|
+
const num = parseInt(val, 10);
|
|
190
|
+
if (isNaN(num) || num < 1 || num > routes.length) {
|
|
191
|
+
return `Enter a number between 1 and ${routes.length}, "first", or "last"`;
|
|
192
|
+
}
|
|
193
|
+
return true;
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
if (input === "first") {
|
|
197
|
+
targetIndex = 0;
|
|
198
|
+
} else if (input === "last") {
|
|
199
|
+
targetIndex = routes.length;
|
|
200
|
+
} else {
|
|
201
|
+
targetIndex = parseInt(input, 10) - 1;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
const adjustedTarget = currentIndex < targetIndex ? targetIndex - 1 : targetIndex;
|
|
205
|
+
const clampedTarget = Math.max(
|
|
206
|
+
0,
|
|
207
|
+
Math.min(adjustedTarget, routes.length - 1)
|
|
208
|
+
);
|
|
209
|
+
if (currentIndex === clampedTarget) {
|
|
210
|
+
output_manager_default.log(
|
|
211
|
+
`Route "${route.name}" is already at position ${currentPosition}.`
|
|
212
|
+
);
|
|
213
|
+
return 0;
|
|
214
|
+
}
|
|
215
|
+
const finalPosition = clampedTarget + 1;
|
|
216
|
+
if (!skipConfirmation) {
|
|
217
|
+
const confirmed = await client.input.confirm(
|
|
218
|
+
`Move "${route.name}" from position ${currentPosition} to position ${finalPosition}?`,
|
|
219
|
+
true
|
|
220
|
+
);
|
|
221
|
+
if (!confirmed) {
|
|
222
|
+
output_manager_default.log("Aborted.");
|
|
223
|
+
return 0;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
const reordered = [...routes];
|
|
227
|
+
reordered.splice(currentIndex, 1);
|
|
228
|
+
reordered.splice(clampedTarget, 0, route);
|
|
229
|
+
const reorderStamp = stamp_default();
|
|
230
|
+
output_manager_default.spinner(`Moving route "${route.name}"`);
|
|
231
|
+
try {
|
|
232
|
+
const { version } = await stageRoutes(
|
|
233
|
+
client,
|
|
234
|
+
project.id,
|
|
235
|
+
reordered,
|
|
236
|
+
true,
|
|
237
|
+
// overwrite
|
|
238
|
+
{ teamId }
|
|
239
|
+
);
|
|
240
|
+
output_manager_default.log(
|
|
241
|
+
`${import_chalk.default.cyan("Moved")} "${route.name}" from position ${currentPosition} to ${finalPosition} ${import_chalk.default.gray(reorderStamp())}`
|
|
242
|
+
);
|
|
243
|
+
await offerAutoPromote(
|
|
244
|
+
client,
|
|
245
|
+
project.id,
|
|
246
|
+
version,
|
|
247
|
+
!!existingStagingVersion,
|
|
248
|
+
{ teamId, skipPrompts: skipConfirmation }
|
|
249
|
+
);
|
|
250
|
+
return 0;
|
|
251
|
+
} catch (e) {
|
|
252
|
+
const error = e;
|
|
253
|
+
output_manager_default.error(error.message || "Failed to reorder route");
|
|
254
|
+
return 1;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
export {
|
|
258
|
+
reorder as default
|
|
259
|
+
};
|
|
@@ -0,0 +1,158 @@
|
|
|
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
|
+
findVersionById,
|
|
17
|
+
getRoutes,
|
|
18
|
+
parseSubcommandArgs,
|
|
19
|
+
printDiffSummary,
|
|
20
|
+
validateRequiredArgs
|
|
21
|
+
} from "./chunk-TNBMKNET.js";
|
|
22
|
+
import {
|
|
23
|
+
restoreSubcommand
|
|
24
|
+
} from "./chunk-U6XOC6E4.js";
|
|
25
|
+
import "./chunk-AQLVWVEN.js";
|
|
26
|
+
import "./chunk-P4I4DMEU.js";
|
|
27
|
+
import {
|
|
28
|
+
stamp_default
|
|
29
|
+
} from "./chunk-SOTR4CXR.js";
|
|
30
|
+
import "./chunk-7EHTK7LP.js";
|
|
31
|
+
import "./chunk-GGP5R3FU.js";
|
|
32
|
+
import {
|
|
33
|
+
getCommandName
|
|
34
|
+
} from "./chunk-ZLCMHY2G.js";
|
|
35
|
+
import "./chunk-3XFFP2BA.js";
|
|
36
|
+
import {
|
|
37
|
+
output_manager_default
|
|
38
|
+
} from "./chunk-FDJURQMQ.js";
|
|
39
|
+
import {
|
|
40
|
+
require_source
|
|
41
|
+
} from "./chunk-S7KYDPEM.js";
|
|
42
|
+
import {
|
|
43
|
+
__toESM
|
|
44
|
+
} from "./chunk-TZ2YI2VH.js";
|
|
45
|
+
|
|
46
|
+
// src/commands/routes/restore.ts
|
|
47
|
+
var import_chalk = __toESM(require_source(), 1);
|
|
48
|
+
async function restore(client, argv) {
|
|
49
|
+
const parsed = await parseSubcommandArgs(argv, restoreSubcommand);
|
|
50
|
+
if (typeof parsed === "number")
|
|
51
|
+
return parsed;
|
|
52
|
+
const error = validateRequiredArgs(parsed.args, ["version-id"]);
|
|
53
|
+
if (error) {
|
|
54
|
+
output_manager_default.error(error);
|
|
55
|
+
return 1;
|
|
56
|
+
}
|
|
57
|
+
const link = await ensureProjectLink(client);
|
|
58
|
+
if (typeof link === "number")
|
|
59
|
+
return link;
|
|
60
|
+
const { project, org } = link;
|
|
61
|
+
const teamId = org.type === "team" ? org.id : void 0;
|
|
62
|
+
const [versionIdentifier] = parsed.args;
|
|
63
|
+
output_manager_default.spinner(`Fetching route versions for ${import_chalk.default.bold(project.name)}`);
|
|
64
|
+
const { versions } = await getRouteVersions(client, project.id, { teamId });
|
|
65
|
+
const result = findVersionById(versions, versionIdentifier);
|
|
66
|
+
if (result.error) {
|
|
67
|
+
output_manager_default.error(result.error);
|
|
68
|
+
return 1;
|
|
69
|
+
}
|
|
70
|
+
const version = result.version;
|
|
71
|
+
if (!version) {
|
|
72
|
+
output_manager_default.error("Version not found.");
|
|
73
|
+
return 1;
|
|
74
|
+
}
|
|
75
|
+
if (version.isLive) {
|
|
76
|
+
output_manager_default.error(
|
|
77
|
+
`Version ${import_chalk.default.bold(
|
|
78
|
+
version.id.slice(0, 12)
|
|
79
|
+
)} is currently live. You cannot restore the live version.
|
|
80
|
+
Run ${import_chalk.default.cyan(
|
|
81
|
+
getCommandName("routes list-versions")
|
|
82
|
+
)} to see previous versions you can restore.`
|
|
83
|
+
);
|
|
84
|
+
return 1;
|
|
85
|
+
}
|
|
86
|
+
if (version.isStaging) {
|
|
87
|
+
output_manager_default.error(
|
|
88
|
+
`Version ${import_chalk.default.bold(
|
|
89
|
+
version.id.slice(0, 12)
|
|
90
|
+
)} is staged. Use ${import_chalk.default.cyan(
|
|
91
|
+
getCommandName("routes publish")
|
|
92
|
+
)} to publish it instead.`
|
|
93
|
+
);
|
|
94
|
+
return 1;
|
|
95
|
+
}
|
|
96
|
+
output_manager_default.spinner("Fetching changes");
|
|
97
|
+
const { routes: diffRoutes } = await getRoutes(client, project.id, {
|
|
98
|
+
teamId,
|
|
99
|
+
versionId: version.id,
|
|
100
|
+
diff: true
|
|
101
|
+
});
|
|
102
|
+
const changedRoutes = diffRoutes.filter((r) => r.action !== void 0);
|
|
103
|
+
if (changedRoutes.length > 0) {
|
|
104
|
+
output_manager_default.print(`
|
|
105
|
+
${import_chalk.default.bold("Changes to be restored:")}
|
|
106
|
+
|
|
107
|
+
`);
|
|
108
|
+
printDiffSummary(changedRoutes);
|
|
109
|
+
output_manager_default.print("\n");
|
|
110
|
+
} else {
|
|
111
|
+
output_manager_default.print(
|
|
112
|
+
`
|
|
113
|
+
${import_chalk.default.gray("No changes detected from current production version.")}
|
|
114
|
+
|
|
115
|
+
`
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
const confirmed = await confirmAction(
|
|
119
|
+
client,
|
|
120
|
+
parsed.flags["--yes"],
|
|
121
|
+
`Restore version ${import_chalk.default.bold(version.id.slice(0, 12))} to production?`,
|
|
122
|
+
`This will replace the current live routes for ${import_chalk.default.bold(project.name)}.`
|
|
123
|
+
);
|
|
124
|
+
if (!confirmed) {
|
|
125
|
+
output_manager_default.log("Canceled");
|
|
126
|
+
return 0;
|
|
127
|
+
}
|
|
128
|
+
const updateStamp = stamp_default();
|
|
129
|
+
output_manager_default.spinner(`Restoring version ${import_chalk.default.bold(version.id.slice(0, 12))}`);
|
|
130
|
+
try {
|
|
131
|
+
const { version: newVersion } = await updateRouteVersion(
|
|
132
|
+
client,
|
|
133
|
+
project.id,
|
|
134
|
+
version.id,
|
|
135
|
+
"restore",
|
|
136
|
+
{ teamId }
|
|
137
|
+
);
|
|
138
|
+
output_manager_default.log(
|
|
139
|
+
`${import_chalk.default.cyan("Success!")} Version ${import_chalk.default.bold(
|
|
140
|
+
newVersion.id.slice(0, 12)
|
|
141
|
+
)} restored to production ${import_chalk.default.gray(updateStamp())}`
|
|
142
|
+
);
|
|
143
|
+
if (newVersion.ruleCount !== void 0) {
|
|
144
|
+
output_manager_default.print(
|
|
145
|
+
` ${import_chalk.default.bold("Active routes:")} ${newVersion.ruleCount}
|
|
146
|
+
`
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
return 0;
|
|
150
|
+
} catch (e) {
|
|
151
|
+
const error2 = e;
|
|
152
|
+
output_manager_default.error(error2.message || "Failed to restore version");
|
|
153
|
+
return 1;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
export {
|
|
157
|
+
restore as default
|
|
158
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
RoutesAddTelemetryClient,
|
|
9
|
+
RoutesEditTelemetryClient,
|
|
10
|
+
RoutesTelemetryClient
|
|
11
|
+
} from "./chunk-3FRG2XGZ.js";
|
|
12
|
+
import "./chunk-P4I4DMEU.js";
|
|
13
|
+
import "./chunk-FDJURQMQ.js";
|
|
14
|
+
import "./chunk-S7KYDPEM.js";
|
|
15
|
+
import "./chunk-TZ2YI2VH.js";
|
|
16
|
+
export {
|
|
17
|
+
RoutesAddTelemetryClient,
|
|
18
|
+
RoutesEditTelemetryClient,
|
|
19
|
+
RoutesTelemetryClient
|
|
20
|
+
};
|
|
@@ -0,0 +1,176 @@
|
|
|
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
|
+
formatErrorJson,
|
|
9
|
+
formatSchemaDetailJson,
|
|
10
|
+
formatSchemaListJson,
|
|
11
|
+
getAggregations,
|
|
12
|
+
getEvent,
|
|
13
|
+
getEventNames,
|
|
14
|
+
validateEvent
|
|
15
|
+
} from "./chunk-BQ3DXZNT.js";
|
|
16
|
+
import "./chunk-IE7MNZ56.js";
|
|
17
|
+
import {
|
|
18
|
+
indent_default
|
|
19
|
+
} from "./chunk-A3NYPUKZ.js";
|
|
20
|
+
import {
|
|
21
|
+
formatTable
|
|
22
|
+
} from "./chunk-SGGLJFUZ.js";
|
|
23
|
+
import {
|
|
24
|
+
validateJsonOutput
|
|
25
|
+
} from "./chunk-XPKWKPWA.js";
|
|
26
|
+
import {
|
|
27
|
+
schemaSubcommand
|
|
28
|
+
} from "./chunk-2DLBVZWU.js";
|
|
29
|
+
import "./chunk-LWBSOTJP.js";
|
|
30
|
+
import {
|
|
31
|
+
require_pluralize
|
|
32
|
+
} from "./chunk-7EHTK7LP.js";
|
|
33
|
+
import "./chunk-GGP5R3FU.js";
|
|
34
|
+
import {
|
|
35
|
+
getFlagsSpecification,
|
|
36
|
+
parseArguments,
|
|
37
|
+
printError
|
|
38
|
+
} from "./chunk-ZLCMHY2G.js";
|
|
39
|
+
import "./chunk-3XFFP2BA.js";
|
|
40
|
+
import {
|
|
41
|
+
output_manager_default
|
|
42
|
+
} from "./chunk-FDJURQMQ.js";
|
|
43
|
+
import {
|
|
44
|
+
require_source
|
|
45
|
+
} from "./chunk-S7KYDPEM.js";
|
|
46
|
+
import {
|
|
47
|
+
__toESM
|
|
48
|
+
} from "./chunk-TZ2YI2VH.js";
|
|
49
|
+
|
|
50
|
+
// src/commands/metrics/schema.ts
|
|
51
|
+
var import_chalk = __toESM(require_source(), 1);
|
|
52
|
+
var import_pluralize = __toESM(require_pluralize(), 1);
|
|
53
|
+
async function schema(client, telemetry) {
|
|
54
|
+
let parsedArgs;
|
|
55
|
+
const flagsSpecification = getFlagsSpecification(schemaSubcommand.options);
|
|
56
|
+
try {
|
|
57
|
+
parsedArgs = parseArguments(client.argv.slice(2), flagsSpecification);
|
|
58
|
+
} catch (err) {
|
|
59
|
+
printError(err);
|
|
60
|
+
return 1;
|
|
61
|
+
}
|
|
62
|
+
const flags = parsedArgs.flags;
|
|
63
|
+
const formatResult = validateJsonOutput(flags);
|
|
64
|
+
if (!formatResult.valid) {
|
|
65
|
+
output_manager_default.error(formatResult.error);
|
|
66
|
+
return 1;
|
|
67
|
+
}
|
|
68
|
+
const jsonOutput = formatResult.jsonOutput;
|
|
69
|
+
const event = flags["--event"];
|
|
70
|
+
telemetry.trackCliOptionEvent(event);
|
|
71
|
+
telemetry.trackCliOptionFormat(flags["--format"]);
|
|
72
|
+
if (event) {
|
|
73
|
+
const eventResult = validateEvent(event);
|
|
74
|
+
if (!eventResult.valid) {
|
|
75
|
+
if (jsonOutput) {
|
|
76
|
+
client.stdout.write(
|
|
77
|
+
formatErrorJson(
|
|
78
|
+
eventResult.code,
|
|
79
|
+
eventResult.message,
|
|
80
|
+
eventResult.allowedValues
|
|
81
|
+
)
|
|
82
|
+
);
|
|
83
|
+
} else {
|
|
84
|
+
output_manager_default.error(eventResult.message);
|
|
85
|
+
if (eventResult.allowedValues) {
|
|
86
|
+
output_manager_default.print(
|
|
87
|
+
`
|
|
88
|
+
Available events: ${eventResult.allowedValues.join(", ")}
|
|
89
|
+
`
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return 1;
|
|
94
|
+
}
|
|
95
|
+
const eventData = getEvent(event);
|
|
96
|
+
const eventWithName = { ...eventData, name: event };
|
|
97
|
+
if (jsonOutput) {
|
|
98
|
+
const hasNonCount = eventData.measures.some((m) => m.name !== "count");
|
|
99
|
+
const sampleMeasure = hasNonCount ? eventData.measures.find((m) => m.name !== "count").name : eventData.measures.length > 0 ? "count" : "";
|
|
100
|
+
const aggregations = sampleMeasure ? getAggregations(event, sampleMeasure) : [];
|
|
101
|
+
client.stdout.write(formatSchemaDetailJson(eventWithName, aggregations));
|
|
102
|
+
} else {
|
|
103
|
+
output_manager_default.log(`Event: ${event} - ${eventData.description}`);
|
|
104
|
+
const dimTable = formatDimensionsTable(eventWithName.dimensions);
|
|
105
|
+
if (dimTable) {
|
|
106
|
+
output_manager_default.print(dimTable);
|
|
107
|
+
output_manager_default.print("\n");
|
|
108
|
+
}
|
|
109
|
+
const measTable = formatMeasuresTable(eventWithName.measures);
|
|
110
|
+
if (measTable) {
|
|
111
|
+
output_manager_default.print(measTable);
|
|
112
|
+
output_manager_default.print("\n");
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
} else {
|
|
116
|
+
const events = getEventNames().map((name) => ({
|
|
117
|
+
name,
|
|
118
|
+
description: getEvent(name).description
|
|
119
|
+
}));
|
|
120
|
+
if (jsonOutput) {
|
|
121
|
+
client.stdout.write(formatSchemaListJson(events));
|
|
122
|
+
} else {
|
|
123
|
+
output_manager_default.log(`${(0, import_pluralize.default)("Event", events.length, true)} found`);
|
|
124
|
+
output_manager_default.print(formatEventsTable(events));
|
|
125
|
+
output_manager_default.print("\n");
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return 0;
|
|
129
|
+
}
|
|
130
|
+
function formatEventsTable(events) {
|
|
131
|
+
return indent_default(
|
|
132
|
+
formatTable(
|
|
133
|
+
["Event", "Description"],
|
|
134
|
+
["l", "l"],
|
|
135
|
+
[{ rows: events.map((e) => [e.name, e.description]) }]
|
|
136
|
+
),
|
|
137
|
+
1
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
function formatDimensionsTable(dimensions) {
|
|
141
|
+
if (dimensions.length === 0) {
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
return indent_default(
|
|
145
|
+
formatTable(
|
|
146
|
+
["Dimension", "Label", "Groupable"],
|
|
147
|
+
["l", "l", "l"],
|
|
148
|
+
[
|
|
149
|
+
{
|
|
150
|
+
rows: dimensions.map((d) => [
|
|
151
|
+
d.name,
|
|
152
|
+
d.label,
|
|
153
|
+
d.filterOnly ? import_chalk.default.dim("no") : "yes"
|
|
154
|
+
])
|
|
155
|
+
}
|
|
156
|
+
]
|
|
157
|
+
),
|
|
158
|
+
1
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
function formatMeasuresTable(measures) {
|
|
162
|
+
if (measures.length === 0) {
|
|
163
|
+
return null;
|
|
164
|
+
}
|
|
165
|
+
return indent_default(
|
|
166
|
+
formatTable(
|
|
167
|
+
["Measure", "Label", "Unit"],
|
|
168
|
+
["l", "l", "l"],
|
|
169
|
+
[{ rows: measures.map((m) => [m.name, m.label, m.unit]) }]
|
|
170
|
+
),
|
|
171
|
+
1
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
export {
|
|
175
|
+
schema as default
|
|
176
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
stamp_default
|
|
9
|
+
} from "./chunk-SOTR4CXR.js";
|
|
10
|
+
import "./chunk-GGP5R3FU.js";
|
|
11
|
+
import "./chunk-S7KYDPEM.js";
|
|
12
|
+
import "./chunk-TZ2YI2VH.js";
|
|
13
|
+
export {
|
|
14
|
+
stamp_default as default
|
|
15
|
+
};
|