@tatara/cli 0.9.0 → 0.9.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/dist/bin.mjs +33 -3
- package/package.json +1 -1
package/dist/bin.mjs
CHANGED
|
@@ -3149,12 +3149,42 @@ async function listRoutes(project) {
|
|
|
3149
3149
|
const out = [];
|
|
3150
3150
|
for (const [name, spec] of ${JSON.stringify(apps)}) {
|
|
3151
3151
|
const { app } = await import(spec);
|
|
3152
|
-
|
|
3152
|
+
// Fetch from /openapi.json endpoint to get the document with all extensions applied
|
|
3153
|
+
const res = await app.request("/openapi.json");
|
|
3154
|
+
const doc = await res.json();
|
|
3155
|
+
const securitySchemes = doc.components?.securitySchemes ?? {};
|
|
3156
|
+
|
|
3153
3157
|
for (const [path, item] of Object.entries(doc.paths ?? {})) {
|
|
3154
3158
|
for (const [method, op] of Object.entries(item)) {
|
|
3155
3159
|
const security = op.security ?? [];
|
|
3156
|
-
|
|
3157
|
-
|
|
3160
|
+
|
|
3161
|
+
// Parse access label based on security schemes
|
|
3162
|
+
let access = "public";
|
|
3163
|
+
if (security.length > 0) {
|
|
3164
|
+
const labels = [];
|
|
3165
|
+
for (const requirement of security) {
|
|
3166
|
+
const schemes = Object.keys(requirement);
|
|
3167
|
+
if (schemes.length === 0) continue;
|
|
3168
|
+
|
|
3169
|
+
const schemeName = schemes[0];
|
|
3170
|
+
const roles = requirement[schemeName] ?? [];
|
|
3171
|
+
|
|
3172
|
+
// For bearer auth with specific roles, show the roles
|
|
3173
|
+
if (schemeName === "bearerAuth" && roles.length > 0) {
|
|
3174
|
+
labels.push(roles.join(", "));
|
|
3175
|
+
}
|
|
3176
|
+
// For bearer auth without roles, show "authenticated"
|
|
3177
|
+
else if (schemeName === "bearerAuth") {
|
|
3178
|
+
labels.push("authenticated");
|
|
3179
|
+
}
|
|
3180
|
+
// For other schemes (API keys, etc.), show the scheme name
|
|
3181
|
+
else {
|
|
3182
|
+
labels.push(schemeName);
|
|
3183
|
+
}
|
|
3184
|
+
}
|
|
3185
|
+
access = labels.length > 1 ? labels.join(" OR ") : (labels[0] ?? "authenticated");
|
|
3186
|
+
}
|
|
3187
|
+
|
|
3158
3188
|
out.push({ app: name, method: method.toUpperCase(), path, summary: op.summary ?? "", access });
|
|
3159
3189
|
}
|
|
3160
3190
|
}
|