@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.
Files changed (2) hide show
  1. package/dist/bin.mjs +33 -3
  2. 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
- const doc = app.getOpenAPI31Document({ openapi: "3.1.0", info: { title: name, version: "1" } });
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
- const roles = security.flatMap((s) => Object.values(s).flat());
3157
- const access = security.length === 0 ? "public" : roles.length ? roles.join(", ") : "authenticated";
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tatara/cli",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "description": "Create and grow opinionated Hono backends",
5
5
  "type": "module",
6
6
  "license": "MIT",