@scalar/cli 2.12.3 → 2.13.1
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/README.md +221 -2
- package/chunks/{action-JXCU2JKC.js → action-27BJMHFD.js} +38 -6
- package/chunks/{action-5BJL72JE.js → action-2BZ3AFBR.js} +10 -7
- package/chunks/{action-RPTLQBMK.js → action-3DBOUHKS.js} +8 -6
- package/chunks/{action-6I2PWENU.js → action-3R3MVTP3.js} +67 -88
- package/chunks/{action-T4MM4OUS.js → action-5HWPNWVU.js} +52 -29
- package/chunks/{action-EWZLVN45.js → action-5JTBIUPZ.js} +47 -27
- package/chunks/{action-4ESHWOAM.js → action-5QDBZTBF.js} +9 -8
- package/chunks/{action-D7L757PX.js → action-7HHTD65O.js} +13 -12
- package/chunks/{action-Y7EBKCUU.js → action-ASBFLTOA.js} +1 -1
- package/chunks/{action-H4GW3KAI.js → action-CXQ3HLVC.js} +15 -15
- package/chunks/{action-EPGS3U3T.js → action-EGF7LXVA.js} +63 -48
- package/chunks/{action-7CUPRYNA.js → action-F5LSDVJA.js} +36 -23
- package/chunks/{action-6A4NM5WS.js → action-FR6UPGZP.js} +9 -8
- package/chunks/{action-KIOYSVKX.js → action-FZZ2VLNA.js} +23 -6
- package/chunks/{action-ZOYQBWGD.js → action-GIKW67JB.js} +13 -13
- package/chunks/{action-ED4TSPRZ.js → action-GLC54N3F.js} +11 -11
- package/chunks/{action-FBOTIFVC.js → action-GRAMP3QD.js} +12 -10
- package/chunks/{action-BYYKW4S6.js → action-IUG6MPST.js} +25 -10
- package/chunks/{action-ZBEOLJJR.js → action-JCBTINNL.js} +9 -6
- package/chunks/{action-VVKMUOKR.js → action-JEI24ZNE.js} +13 -5
- package/chunks/{action-EWDQOX5B.js → action-JFNK5UCV.js} +6 -4
- package/chunks/action-JRPGHJGA.js +48 -0
- package/chunks/{action-Q3DI54OW.js → action-KRXJWRCE.js} +15 -15
- package/chunks/{action-B74PPGKB.js → action-PBJFNJMY.js} +34 -16
- package/chunks/{action-O7ROX6NF.js → action-PDOW5JS2.js} +12 -11
- package/chunks/{action-GMJJMZXY.js → action-RYLO75IN.js} +11 -11
- package/chunks/{action-HAKFAXTQ.js → action-VEXFHEQR.js} +6 -6
- package/chunks/{action-YXRCGKCK.js → action-W3AGGZ42.js} +6 -4
- package/chunks/action-W5VD63XO.js +55 -0
- package/chunks/{action-M5OUEDV2.js → action-WEDLKGDY.js} +4 -4
- package/chunks/{action-FBQAU5LV.js → action-WI6UW2AL.js} +12 -12
- package/chunks/{action-AYKKHH7A.js → action-WQPMJZXL.js} +51 -24
- package/chunks/{action-GJHOZ6Q5.js → action-WY4GOD2Y.js} +10 -8
- package/chunks/{action-I2IV4VLL.js → action-XXIRB2F6.js} +32 -16
- package/chunks/{actions-EXQNVV4T.js → actions-I4HS6ASR.js} +20 -18
- package/chunks/{agent-XAHNA4MB.js → agent-E6PYTXAU.js} +3 -3
- package/chunks/{asyncapi-FNOWXSKB.js → asyncapi-VQ7CCUCY.js} +9 -7
- package/chunks/{build.action-TIKRZPQ5.js → build.action-LIAREWUF.js} +36 -19
- package/chunks/chunk-2XWUFFEZ.js +133 -0
- package/chunks/{chunk-2GKXAGSH.js → chunk-6VAEDMCP.js} +7 -7
- package/chunks/{chunk-EUFK4MVX.js → chunk-6YDIOXF7.js} +2 -2
- package/chunks/{chunk-EBNFCIKS.js → chunk-APX65SRT.js} +2 -1
- package/chunks/{chunk-WKW5W2ZP.js → chunk-DWN6JOF2.js} +1 -1
- package/chunks/{chunk-EXJUFF6G.js → chunk-FXELV3AW.js} +8 -3
- package/chunks/{chunk-IOW726L2.js → chunk-GARUDDWI.js} +1 -1
- package/chunks/{chunk-JWNWOK2M.js → chunk-HZ4UKLOE.js} +12 -5
- package/chunks/{chunk-2AK5O3NQ.js → chunk-IDWF5L45.js} +28 -28
- package/chunks/chunk-IRQJDPZE.js +34 -0
- package/chunks/{chunk-TYNF7ROW.js → chunk-JHJDLZSM.js} +1 -1
- package/chunks/{chunk-TI4NDKQC.js → chunk-KTI65ZVY.js} +5 -5
- package/chunks/chunk-LK2ZIDHH.js +32 -0
- package/chunks/{chunk-I7ZVWF57.js → chunk-LUR7BA3W.js} +15 -9
- package/chunks/{chunk-AOZQPCWI.js → chunk-M4QTWCJ7.js} +2 -0
- package/chunks/{chunk-7S34K2P3.js → chunk-NOD4CBF7.js} +1 -1
- package/chunks/{chunk-KPLWZIOV.js → chunk-P4EPNS46.js} +3 -3
- package/chunks/{chunk-CUHVXHIV.js → chunk-PWFA23M2.js} +1 -1
- package/chunks/{chunk-KWIY2QZY.js → chunk-QRYMQPFT.js} +2 -2
- package/chunks/{chunk-FI7UKPRF.js → chunk-QS2T7JAK.js} +1 -1
- package/chunks/{chunk-OZQPMMTA.js → chunk-QUUBUPAW.js} +5 -5
- package/chunks/{chunk-FYMDIB7J.js → chunk-R3NDJICA.js} +1 -1
- package/chunks/{chunk-V7RTDFHK.js → chunk-RAJM56L7.js} +5 -1
- package/chunks/{chunk-Y2OQOAY7.js → chunk-RQNLEGMQ.js} +1 -1
- package/chunks/chunk-RZDLPTXV.js +167 -0
- package/chunks/chunk-SIPBGEVT.js +16 -0
- package/chunks/chunk-SNQFFEYH.js +11 -0
- package/chunks/{chunk-62OOT7FY.js → chunk-SNSJW2JT.js} +2 -2
- package/chunks/{chunk-LEECPQZN.js → chunk-UNV7BZD3.js} +2 -2
- package/chunks/{chunk-IRA5BW2J.js → chunk-X62ZTOQF.js} +31 -4
- package/chunks/{chunk-UN2AAVO5.js → chunk-XFBCZL7J.js} +2 -2
- package/chunks/chunk-XUX6JXU5.js +58 -0
- package/chunks/{create.action-K7GTWYST.js → create.action-PZMCTYGS.js} +31 -22
- package/chunks/{delete.action-JKLXBYRD.js → delete.action-J57JIFG3.js} +35 -21
- package/chunks/{delete.action-E4XRGKQW.js → delete.action-VDSTPSWG.js} +37 -21
- package/chunks/{get.action-IY7WSJMX.js → get.action-KUP32QJT.js} +13 -13
- package/chunks/{get.action-2AKMD4W3.js → get.action-ZOSML6XG.js} +12 -10
- package/chunks/{list.action-NRL2DDL5.js → list.action-Q5MPDR42.js} +15 -15
- package/chunks/{list.action-44YVCWKN.js → list.action-VYENIC5L.js} +13 -13
- package/chunks/{publish.action-E76MHLCN.js → publish.action-MBAZHQ2J.js} +48 -28
- package/chunks/{update.action-LZCAHAWW.js → update.action-BWMCXWQ5.js} +35 -21
- package/chunks/{update.action-FTTVWVAB.js → update.action-IEXVMUKG.js} +46 -26
- package/index.js +212 -127
- package/package.json +1 -1
- package/skills/scalar-cli/SKILL.md +4 -2
- package/template.md +220 -1
- package/chunks/action-BDDXF4YV.js +0 -38
- package/chunks/chunk-BOPEAS7H.js +0 -38
- package/chunks/chunk-EGOXR5FB.js +0 -15
- package/chunks/{action-UHXBY3RD.js → action-3P66ZSL3.js} +1 -1
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
getPublishDeploymentUrl
|
|
4
|
+
} from "./chunk-NOD4CBF7.js";
|
|
5
|
+
import {
|
|
6
|
+
writeJson
|
|
7
|
+
} from "./chunk-SNQFFEYH.js";
|
|
8
|
+
import {
|
|
9
|
+
createDatabaseClient
|
|
10
|
+
} from "./chunk-HZ4UKLOE.js";
|
|
11
|
+
import {
|
|
12
|
+
publishRecordSchema
|
|
13
|
+
} from "./chunk-VRZSDUZK.js";
|
|
14
|
+
import {
|
|
15
|
+
output
|
|
16
|
+
} from "./chunk-T5HJUAWB.js";
|
|
17
|
+
import {
|
|
18
|
+
external_exports
|
|
19
|
+
} from "./chunk-I57ID5K7.js";
|
|
20
|
+
|
|
21
|
+
// src/domains/project/deployments/observe.ts
|
|
22
|
+
import { performance } from "node:perf_hooks";
|
|
23
|
+
import { setTimeout as sleep } from "node:timers/promises";
|
|
24
|
+
var timeoutSchema = external_exports.coerce.number().positive().finite().max(2147483);
|
|
25
|
+
var defaultWaitSeconds = 600;
|
|
26
|
+
function recoveryCommand(publishUid) {
|
|
27
|
+
return `scalar project deployments get ${publishUid} --wait`;
|
|
28
|
+
}
|
|
29
|
+
function printRecord(record) {
|
|
30
|
+
console.log(`Build ID: ${record.uid}`);
|
|
31
|
+
console.log(`Status: ${record.status}`);
|
|
32
|
+
if (record.message) console.log(record.message);
|
|
33
|
+
if (record.status !== "deployed") return;
|
|
34
|
+
const url = getPublishDeploymentUrl(record);
|
|
35
|
+
if (url)
|
|
36
|
+
console.log(`${record.preview ? "Preview URL" : "Deployment URL"}: ${url}`);
|
|
37
|
+
if (record.hasWarnings) {
|
|
38
|
+
output.warn().title("The build finished with warnings").line("Check the build log in the Scalar Dashboard for details.").print();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
async function observePublish({
|
|
42
|
+
teamUid,
|
|
43
|
+
accessToken,
|
|
44
|
+
publishUid,
|
|
45
|
+
wait = true,
|
|
46
|
+
timeout = defaultWaitSeconds,
|
|
47
|
+
json = false
|
|
48
|
+
}) {
|
|
49
|
+
const controller = new AbortController();
|
|
50
|
+
const deadline = performance.now() + timeout * 1e3;
|
|
51
|
+
const timer = setTimeout(() => controller.abort(), timeout * 1e3);
|
|
52
|
+
const interruption = { code: 0 };
|
|
53
|
+
const interrupt = (code) => {
|
|
54
|
+
interruption.code = code;
|
|
55
|
+
controller.abort();
|
|
56
|
+
};
|
|
57
|
+
const onInterrupt = () => interrupt(130);
|
|
58
|
+
const onTerminate = () => interrupt(143);
|
|
59
|
+
process.once("SIGINT", onInterrupt);
|
|
60
|
+
process.once("SIGTERM", onTerminate);
|
|
61
|
+
function visibilityError(message) {
|
|
62
|
+
console.error(`${message}
|
|
63
|
+
Build ID: ${publishUid}
|
|
64
|
+
Stopping local waiting does not cancel the remote build; deployment may continue.
|
|
65
|
+
Inspect with the original team selected: ${recoveryCommand(publishUid)}`);
|
|
66
|
+
process.exitCode = interruption.code || 1;
|
|
67
|
+
}
|
|
68
|
+
try {
|
|
69
|
+
const client = createDatabaseClient(accessToken);
|
|
70
|
+
const progress = { message: "" };
|
|
71
|
+
while (!controller.signal.aborted) {
|
|
72
|
+
const response = await client.getOne({
|
|
73
|
+
collectionPath: `team/${teamUid}/publish`,
|
|
74
|
+
query: { uid: publishUid },
|
|
75
|
+
schema: publishRecordSchema,
|
|
76
|
+
signal: controller.signal
|
|
77
|
+
});
|
|
78
|
+
if (controller.signal.aborted) break;
|
|
79
|
+
if (response.error) {
|
|
80
|
+
visibilityError(
|
|
81
|
+
"Could not load deployment status. The build outcome is unknown."
|
|
82
|
+
);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const parsed = publishRecordSchema.safeParse(response.data);
|
|
86
|
+
if (!parsed.success || parsed.data.uid !== publishUid) {
|
|
87
|
+
visibilityError(
|
|
88
|
+
"Could not read the requested build record. The build outcome is unknown."
|
|
89
|
+
);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
const record = parsed.data;
|
|
93
|
+
if (!wait || record.status !== "pending" && record.status !== "building") {
|
|
94
|
+
if (json && record.status === "deployed") {
|
|
95
|
+
writeJson({
|
|
96
|
+
uid: record.uid,
|
|
97
|
+
status: "deployed",
|
|
98
|
+
url: getPublishDeploymentUrl(record) ?? null,
|
|
99
|
+
preview: record.preview,
|
|
100
|
+
hasWarnings: record.hasWarnings ?? false
|
|
101
|
+
});
|
|
102
|
+
} else if (!json) {
|
|
103
|
+
printRecord(record);
|
|
104
|
+
}
|
|
105
|
+
if (wait && record.status !== "deployed") {
|
|
106
|
+
console.error(
|
|
107
|
+
`Build ${publishUid} has status ${record.status}; it is not a confirmed deployment. ${record.message}`
|
|
108
|
+
);
|
|
109
|
+
process.exitCode = 1;
|
|
110
|
+
}
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
const message = `${record.status}: ${record.message}`;
|
|
114
|
+
if (!json && message !== progress.message) {
|
|
115
|
+
console.error(message);
|
|
116
|
+
progress.message = message;
|
|
117
|
+
}
|
|
118
|
+
await sleep(
|
|
119
|
+
Math.max(0, Math.min(3e3, deadline - performance.now())),
|
|
120
|
+
void 0,
|
|
121
|
+
{ signal: controller.signal }
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
visibilityError(
|
|
125
|
+
interruption.code ? "Operation cancelled." : "Timed out waiting for deployment status."
|
|
126
|
+
);
|
|
127
|
+
} catch {
|
|
128
|
+
visibilityError(
|
|
129
|
+
interruption.code ? "Operation cancelled." : controller.signal.aborted ? "Timed out waiting for deployment status." : "Could not load deployment status. The build outcome is unknown."
|
|
130
|
+
);
|
|
131
|
+
} finally {
|
|
132
|
+
clearTimeout(timer);
|
|
133
|
+
process.removeListener("SIGINT", onInterrupt);
|
|
134
|
+
process.removeListener("SIGTERM", onTerminate);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
async function finishPublish(args) {
|
|
138
|
+
if (args.json) {
|
|
139
|
+
if (!args.wait) {
|
|
140
|
+
writeJson({
|
|
141
|
+
uid: args.publishUid,
|
|
142
|
+
status: "accepted"
|
|
143
|
+
});
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
await observePublish(args);
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
console.log(`Build ID: ${args.publishUid}`);
|
|
150
|
+
console.log(
|
|
151
|
+
`Inspect with the original team selected: ${recoveryCommand(args.publishUid)}`
|
|
152
|
+
);
|
|
153
|
+
if (!args.wait) {
|
|
154
|
+
console.log(
|
|
155
|
+
"Publish accepted. Deployment is not yet confirmed; the remote build continues."
|
|
156
|
+
);
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
await observePublish(args);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export {
|
|
163
|
+
timeoutSchema,
|
|
164
|
+
defaultWaitSeconds,
|
|
165
|
+
observePublish,
|
|
166
|
+
finishPublish
|
|
167
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
registryUrl
|
|
4
|
+
} from "./chunk-UNV7BZD3.js";
|
|
5
|
+
import {
|
|
6
|
+
readUrl
|
|
7
|
+
} from "./chunk-2XWUFFEZ.js";
|
|
8
|
+
|
|
9
|
+
// src/domains/registry/helpers/fetch.ts
|
|
10
|
+
async function fetchFromRegistry(path, accessToken) {
|
|
11
|
+
return readUrl(registryUrl(path), { accessToken });
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export {
|
|
15
|
+
fetchFromRegistry
|
|
16
|
+
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
RegistryAsset
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-JHJDLZSM.js";
|
|
5
5
|
import {
|
|
6
6
|
MCP_DOWNLOAD_PATH_PREFIX,
|
|
7
7
|
contentShaSchema
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-M4QTWCJ7.js";
|
|
9
9
|
import {
|
|
10
10
|
docVersionSchema,
|
|
11
11
|
external_exports,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
config
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-R3NDJICA.js";
|
|
5
5
|
import {
|
|
6
6
|
RegistryAsset
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-JHJDLZSM.js";
|
|
8
8
|
|
|
9
9
|
// src/domains/registry/helpers/links.ts
|
|
10
10
|
function registryUrl(path) {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
2
|
import {
|
|
3
|
-
mcpEnvironmentSchema
|
|
4
|
-
|
|
3
|
+
mcpEnvironmentSchema,
|
|
4
|
+
mcpGroupSecretMappingSchema,
|
|
5
|
+
mcpGroupSecretsSchema
|
|
6
|
+
} from "./chunk-FXELV3AW.js";
|
|
5
7
|
import {
|
|
6
8
|
billingPlanSchema
|
|
7
9
|
} from "./chunk-F3TQHNSQ.js";
|
|
@@ -26,7 +28,7 @@ import {
|
|
|
26
28
|
mcpServerSchema,
|
|
27
29
|
mcpServerVersionSchema,
|
|
28
30
|
monthlyUsageSchema
|
|
29
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-M4QTWCJ7.js";
|
|
30
32
|
import {
|
|
31
33
|
environmentSlugSchema
|
|
32
34
|
} from "./chunk-Q26DFKTY.js";
|
|
@@ -714,7 +716,13 @@ var mcpInstallationRoutes = {
|
|
|
714
716
|
* install snippets offer. Null while no version serves the environment,
|
|
715
717
|
* and defaulted so a not-yet-redeployed agent service still parses.
|
|
716
718
|
*/
|
|
717
|
-
clientCredential: mcpClientCredentialSchema.nullish().default(null)
|
|
719
|
+
clientCredential: mcpClientCredentialSchema.nullish().default(null),
|
|
720
|
+
/**
|
|
721
|
+
* The environment's secret mapping per access group uid, as the record
|
|
722
|
+
* resolves it; names only. Defaulted so a not-yet-redeployed agent
|
|
723
|
+
* service still parses.
|
|
724
|
+
*/
|
|
725
|
+
groupSecrets: mcpGroupSecretsSchema.default({})
|
|
718
726
|
}),
|
|
719
727
|
responses: { 400: agentApiErrorSchema, 404: agentApiErrorSchema },
|
|
720
728
|
summary: "Get an MCP installation"
|
|
@@ -769,6 +777,25 @@ var mcpInstallationRoutes = {
|
|
|
769
777
|
responses: { 400: agentApiErrorSchema },
|
|
770
778
|
summary: "Remove an access group from an installation"
|
|
771
779
|
},
|
|
780
|
+
setInstallationGroupSecrets: {
|
|
781
|
+
method: "PUT",
|
|
782
|
+
path: (p) => `/mcp/servers/${p.id}/installations/${p.installationId}/access-groups/${p.groupUid}/secrets`,
|
|
783
|
+
params: installationParams.extend({ groupUid: external_exports.string().min(1) }),
|
|
784
|
+
body: external_exports.object({
|
|
785
|
+
/** Null drops the group's mapping. */
|
|
786
|
+
secrets: mcpGroupSecretMappingSchema.nullable()
|
|
787
|
+
}),
|
|
788
|
+
response: external_exports.object({
|
|
789
|
+
/** The environment's mapping per access group uid, as the record resolves it. */
|
|
790
|
+
groupSecrets: mcpGroupSecretsSchema
|
|
791
|
+
}),
|
|
792
|
+
responses: {
|
|
793
|
+
404: agentApiErrorSchema,
|
|
794
|
+
409: agentApiErrorSchema,
|
|
795
|
+
422: mcpEnvironmentsRefusedSchema
|
|
796
|
+
},
|
|
797
|
+
summary: "Set an access group's secrets in an environment"
|
|
798
|
+
},
|
|
772
799
|
getDefinition: {
|
|
773
800
|
method: "GET",
|
|
774
801
|
path: (p) => `/mcp/${p.installationId}`,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
BaseCollections
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-KTI65ZVY.js";
|
|
5
5
|
import {
|
|
6
6
|
getDatabaseClient
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-HZ4UKLOE.js";
|
|
8
8
|
import {
|
|
9
9
|
publishRecordSchema
|
|
10
10
|
} from "./chunk-VRZSDUZK.js";
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
isInputDisabled
|
|
4
|
+
} from "./chunk-IRQJDPZE.js";
|
|
5
|
+
import {
|
|
6
|
+
output
|
|
7
|
+
} from "./chunk-T5HJUAWB.js";
|
|
8
|
+
|
|
9
|
+
// src/helpers/interactive.ts
|
|
10
|
+
function requireInteractive(message, json = false) {
|
|
11
|
+
if (json || !canPrompt()) {
|
|
12
|
+
output.error().title("Missing input").message(message).exit("error");
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
var canPrompt = () => !isInputDisabled() && Boolean(process.stdin.isTTY);
|
|
16
|
+
|
|
17
|
+
// src/helpers/prompts.ts
|
|
18
|
+
import {
|
|
19
|
+
confirm as clackConfirm,
|
|
20
|
+
select as clackSelect,
|
|
21
|
+
text as clackText
|
|
22
|
+
} from "@clack/prompts";
|
|
23
|
+
var cancelOperation = () => output.error().message("Operation cancelled.").exit("error");
|
|
24
|
+
async function runPrompt(start) {
|
|
25
|
+
requireInteractive("Provide all required command arguments and options.");
|
|
26
|
+
const onEof = () => {
|
|
27
|
+
if (process.stdin.isTTY) process.stdin.setRawMode(false);
|
|
28
|
+
process.stdout.write("\x1B[?25h");
|
|
29
|
+
return cancelOperation();
|
|
30
|
+
};
|
|
31
|
+
const onKeypress = (sequence) => {
|
|
32
|
+
if (sequence === "") onEof();
|
|
33
|
+
};
|
|
34
|
+
process.stdin.once?.("end", onEof);
|
|
35
|
+
process.stdin.once?.("close", onEof);
|
|
36
|
+
process.stdin.on?.("keypress", onKeypress);
|
|
37
|
+
try {
|
|
38
|
+
const value = await start();
|
|
39
|
+
if (typeof value === "symbol") return cancelOperation();
|
|
40
|
+
return value;
|
|
41
|
+
} finally {
|
|
42
|
+
process.stdin.off?.("end", onEof);
|
|
43
|
+
process.stdin.off?.("close", onEof);
|
|
44
|
+
process.stdin.off?.("keypress", onKeypress);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
var text = (options) => runPrompt(() => clackText(options));
|
|
48
|
+
var confirm = (options) => runPrompt(() => clackConfirm(options));
|
|
49
|
+
var select = (options) => runPrompt(() => clackSelect(options));
|
|
50
|
+
|
|
51
|
+
export {
|
|
52
|
+
requireInteractive,
|
|
53
|
+
canPrompt,
|
|
54
|
+
cancelOperation,
|
|
55
|
+
text,
|
|
56
|
+
confirm,
|
|
57
|
+
select
|
|
58
|
+
};
|
|
@@ -1,44 +1,50 @@
|
|
|
1
1
|
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
writeJson
|
|
4
|
+
} from "./chunk-SNQFFEYH.js";
|
|
2
5
|
import {
|
|
3
6
|
BaseCollections
|
|
4
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-KTI65ZVY.js";
|
|
5
8
|
import {
|
|
6
9
|
getDatabaseClient
|
|
7
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-HZ4UKLOE.js";
|
|
8
11
|
import {
|
|
9
12
|
apiService
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
+
} from "./chunk-6VAEDMCP.js";
|
|
14
|
+
import "./chunk-IDWF5L45.js";
|
|
15
|
+
import "./chunk-P4EPNS46.js";
|
|
13
16
|
import "./chunk-YTTDYTVB.js";
|
|
14
17
|
import {
|
|
15
18
|
SdkLanguage
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-EXJUFF6G.js";
|
|
19
|
+
} from "./chunk-RQNLEGMQ.js";
|
|
20
|
+
import "./chunk-X62ZTOQF.js";
|
|
21
|
+
import "./chunk-FXELV3AW.js";
|
|
20
22
|
import "./chunk-RE5Z56QD.js";
|
|
21
23
|
import "./chunk-VUXPDHTQ.js";
|
|
22
24
|
import {
|
|
23
25
|
getAuthData
|
|
24
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-QS2T7JAK.js";
|
|
25
27
|
import {
|
|
26
28
|
config
|
|
27
|
-
} from "./chunk-
|
|
28
|
-
import "./chunk-
|
|
29
|
+
} from "./chunk-R3NDJICA.js";
|
|
30
|
+
import "./chunk-GARUDDWI.js";
|
|
29
31
|
import {
|
|
30
32
|
teamSchema
|
|
31
33
|
} from "./chunk-F3TQHNSQ.js";
|
|
32
34
|
import "./chunk-VRZSDUZK.js";
|
|
33
35
|
import {
|
|
34
|
-
requireInteractive
|
|
35
|
-
|
|
36
|
+
requireInteractive,
|
|
37
|
+
select,
|
|
38
|
+
text
|
|
39
|
+
} from "./chunk-XUX6JXU5.js";
|
|
40
|
+
import "./chunk-IRQJDPZE.js";
|
|
36
41
|
import "./chunk-4ORL4MST.js";
|
|
37
|
-
import "./chunk-
|
|
42
|
+
import "./chunk-JHJDLZSM.js";
|
|
38
43
|
import {
|
|
39
44
|
output
|
|
40
45
|
} from "./chunk-T5HJUAWB.js";
|
|
41
|
-
import "./chunk-
|
|
46
|
+
import "./chunk-5ENKYZA4.js";
|
|
47
|
+
import "./chunk-M4QTWCJ7.js";
|
|
42
48
|
import "./chunk-Q26DFKTY.js";
|
|
43
49
|
import {
|
|
44
50
|
external_exports,
|
|
@@ -48,7 +54,6 @@ import {
|
|
|
48
54
|
import "./chunk-3MZYUBJ6.js";
|
|
49
55
|
|
|
50
56
|
// src/domains/sdk/create.action.ts
|
|
51
|
-
import { select, text } from "@clack/prompts";
|
|
52
57
|
import as from "ansis";
|
|
53
58
|
async function createAction(opts) {
|
|
54
59
|
const { error, data } = external_exports.object({
|
|
@@ -63,7 +68,7 @@ async function createAction(opts) {
|
|
|
63
68
|
const db = await getDatabaseClient();
|
|
64
69
|
const client = await apiService();
|
|
65
70
|
if (!data.language) {
|
|
66
|
-
requireInteractive("Provide --language.");
|
|
71
|
+
requireInteractive("Provide --language.", opts.json);
|
|
67
72
|
}
|
|
68
73
|
const language = opts.language || await text({
|
|
69
74
|
message: "Select the SDK language",
|
|
@@ -95,7 +100,7 @@ async function createAction(opts) {
|
|
|
95
100
|
return output.error().title("API description not found").message("Provide a valid API slug.").exit("error");
|
|
96
101
|
}
|
|
97
102
|
if (!data.api) {
|
|
98
|
-
requireInteractive("Provide --api.");
|
|
103
|
+
requireInteractive("Provide --api.", opts.json);
|
|
99
104
|
}
|
|
100
105
|
const apiUid = namespaceApisRes.data.find((api) => api.slug === data.api)?.uid || await select({
|
|
101
106
|
message: "Select an API",
|
|
@@ -107,7 +112,7 @@ async function createAction(opts) {
|
|
|
107
112
|
if (!apiUid) {
|
|
108
113
|
return output.error().title("API description not found").message("Provide a valid API slug.").exit("error");
|
|
109
114
|
}
|
|
110
|
-
const logger = output.info().loader("Creating SDK\u2026");
|
|
115
|
+
const logger = opts.json ? void 0 : output.info().loader("Creating SDK\u2026");
|
|
111
116
|
const response = await client.sdks.create({
|
|
112
117
|
apiUid,
|
|
113
118
|
languages: [language]
|
|
@@ -115,9 +120,13 @@ async function createAction(opts) {
|
|
|
115
120
|
if (response.error) {
|
|
116
121
|
return output.error().title("Could not create the SDK").message(response.message).exit("error");
|
|
117
122
|
}
|
|
118
|
-
|
|
123
|
+
if (opts.json) {
|
|
124
|
+
writeJson({ uid: response.data });
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
logger?.update("loader", 0, { content: "SDK created." });
|
|
119
128
|
const dashboardUrl = `${config.projects.dashboard}/sdk/${response.data}`;
|
|
120
|
-
logger
|
|
129
|
+
logger?.message(`View your SDK in the Scalar Dashboard: ${as.cyan(dashboardUrl)}`).exit("success");
|
|
121
130
|
}
|
|
122
131
|
export {
|
|
123
132
|
createAction
|
|
@@ -1,42 +1,47 @@
|
|
|
1
1
|
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
writeJson
|
|
4
|
+
} from "./chunk-SNQFFEYH.js";
|
|
2
5
|
import {
|
|
3
6
|
BaseCollections
|
|
4
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-KTI65ZVY.js";
|
|
5
8
|
import {
|
|
6
9
|
getDatabaseClient
|
|
7
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-HZ4UKLOE.js";
|
|
8
11
|
import {
|
|
9
12
|
apiService
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
+
} from "./chunk-6VAEDMCP.js";
|
|
14
|
+
import "./chunk-IDWF5L45.js";
|
|
15
|
+
import "./chunk-P4EPNS46.js";
|
|
13
16
|
import "./chunk-YTTDYTVB.js";
|
|
14
17
|
import {
|
|
15
18
|
sdkSchema
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-EXJUFF6G.js";
|
|
19
|
+
} from "./chunk-RQNLEGMQ.js";
|
|
20
|
+
import "./chunk-X62ZTOQF.js";
|
|
21
|
+
import "./chunk-FXELV3AW.js";
|
|
20
22
|
import "./chunk-RE5Z56QD.js";
|
|
21
23
|
import "./chunk-VUXPDHTQ.js";
|
|
22
24
|
import {
|
|
23
25
|
getAuthData
|
|
24
|
-
} from "./chunk-
|
|
25
|
-
import "./chunk-
|
|
26
|
-
import "./chunk-
|
|
26
|
+
} from "./chunk-QS2T7JAK.js";
|
|
27
|
+
import "./chunk-R3NDJICA.js";
|
|
28
|
+
import "./chunk-GARUDDWI.js";
|
|
27
29
|
import {
|
|
28
30
|
teamSchema
|
|
29
31
|
} from "./chunk-F3TQHNSQ.js";
|
|
30
32
|
import "./chunk-VRZSDUZK.js";
|
|
31
33
|
import {
|
|
32
|
-
requireInteractive
|
|
33
|
-
|
|
34
|
+
requireInteractive,
|
|
35
|
+
select
|
|
36
|
+
} from "./chunk-XUX6JXU5.js";
|
|
37
|
+
import "./chunk-IRQJDPZE.js";
|
|
34
38
|
import "./chunk-4ORL4MST.js";
|
|
35
|
-
import "./chunk-
|
|
39
|
+
import "./chunk-JHJDLZSM.js";
|
|
36
40
|
import {
|
|
37
41
|
output
|
|
38
42
|
} from "./chunk-T5HJUAWB.js";
|
|
39
|
-
import "./chunk-
|
|
43
|
+
import "./chunk-5ENKYZA4.js";
|
|
44
|
+
import "./chunk-M4QTWCJ7.js";
|
|
40
45
|
import "./chunk-Q26DFKTY.js";
|
|
41
46
|
import {
|
|
42
47
|
external_exports,
|
|
@@ -46,7 +51,6 @@ import {
|
|
|
46
51
|
import "./chunk-3MZYUBJ6.js";
|
|
47
52
|
|
|
48
53
|
// src/domains/sdk/delete.action.ts
|
|
49
|
-
import { select } from "@clack/prompts";
|
|
50
54
|
async function deleteAction(opts) {
|
|
51
55
|
const { error, data } = external_exports.object({
|
|
52
56
|
slug: slugSchema.optional(),
|
|
@@ -85,7 +89,7 @@ async function deleteAction(opts) {
|
|
|
85
89
|
return output.error().title("SDK not found").message("Provide a valid SDK slug.").exit("error");
|
|
86
90
|
}
|
|
87
91
|
if (!data.slug) {
|
|
88
|
-
requireInteractive("Provide --slug.");
|
|
92
|
+
requireInteractive("Provide --slug.", opts.json);
|
|
89
93
|
}
|
|
90
94
|
const sdkUid = sdks.data.find((sdk) => sdk.slug === data.slug)?.uid || await select({
|
|
91
95
|
message: "Select an SDK to delete",
|
|
@@ -94,15 +98,25 @@ async function deleteAction(opts) {
|
|
|
94
98
|
label: sdk.slug
|
|
95
99
|
}))
|
|
96
100
|
});
|
|
97
|
-
|
|
101
|
+
const matchingSdk = sdks.data.find((sdk) => sdk.uid === sdkUid);
|
|
102
|
+
if (!matchingSdk) {
|
|
98
103
|
return output.error().title("SDK not found").message("Provide a valid SDK slug.").exit("error");
|
|
99
104
|
}
|
|
100
|
-
const logger = output.info().loader("Deleting SDK\u2026");
|
|
105
|
+
const logger = opts.json ? void 0 : output.info().loader("Deleting SDK\u2026");
|
|
101
106
|
const response = await client.sdks.delete(sdkUid);
|
|
102
107
|
if (response.error) {
|
|
103
108
|
return output.error().title("Could not delete the SDK").message(response.message).exit("error");
|
|
104
109
|
}
|
|
105
|
-
|
|
110
|
+
if (opts.json) {
|
|
111
|
+
writeJson({
|
|
112
|
+
uid: sdkUid,
|
|
113
|
+
namespace,
|
|
114
|
+
slug: matchingSdk.slug,
|
|
115
|
+
deleted: true
|
|
116
|
+
});
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
logger?.update("loader", 0, { content: "SDK deleted." }).exit("success");
|
|
106
120
|
}
|
|
107
121
|
export {
|
|
108
122
|
deleteAction
|