specli 0.0.4 → 0.0.7
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/cli.ts +13 -4
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +2331 -0
- package/dist/cli.js.map +53 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2032 -0
- package/dist/index.js.map +48 -0
- package/dist/src/ai/tools.d.ts +139 -0
- package/dist/src/ai/tools.d.ts.map +1 -0
- package/dist/src/ai/tools.js +1656 -0
- package/dist/src/ai/tools.js.map +45 -0
- package/dist/src/cli/auth-requirements.d.ts +10 -0
- package/dist/src/cli/auth-requirements.d.ts.map +1 -0
- package/dist/src/cli/auth-requirements.js +66 -0
- package/dist/src/cli/auth-requirements.js.map +10 -0
- package/dist/src/cli/auth-schemes.d.ts +22 -0
- package/dist/src/cli/auth-schemes.d.ts.map +1 -0
- package/dist/src/cli/auth-schemes.js +116 -0
- package/dist/src/cli/auth-schemes.js.map +11 -0
- package/dist/src/cli/capabilities.d.ts +32 -0
- package/dist/src/cli/capabilities.d.ts.map +1 -0
- package/dist/src/cli/capabilities.js +45 -0
- package/dist/src/cli/capabilities.js.map +10 -0
- package/dist/src/cli/command-id.d.ts +8 -0
- package/dist/src/cli/command-id.d.ts.map +1 -0
- package/dist/src/cli/command-id.js +18 -0
- package/dist/src/cli/command-id.js.map +11 -0
- package/dist/src/cli/command-index.d.ts +6 -0
- package/dist/src/cli/command-index.d.ts.map +1 -0
- package/dist/src/cli/command-index.js +15 -0
- package/dist/src/cli/command-index.js.map +10 -0
- package/dist/src/cli/command-model.d.ts +40 -0
- package/dist/src/cli/command-model.d.ts.map +1 -0
- package/dist/src/cli/command-model.js +274 -0
- package/dist/src/cli/command-model.js.map +18 -0
- package/dist/src/cli/compile.d.ts +15 -0
- package/dist/src/cli/compile.d.ts.map +1 -0
- package/dist/src/cli/compile.js +146 -0
- package/dist/src/cli/compile.js.map +11 -0
- package/dist/src/cli/crypto.d.ts +2 -0
- package/dist/src/cli/crypto.d.ts.map +1 -0
- package/dist/src/cli/crypto.js +15 -0
- package/dist/src/cli/crypto.js.map +10 -0
- package/dist/src/cli/derive-name.d.ts +9 -0
- package/dist/src/cli/derive-name.d.ts.map +1 -0
- package/dist/src/cli/derive-name.js +70 -0
- package/dist/src/cli/derive-name.js.map +10 -0
- package/dist/src/cli/exec.d.ts +14 -0
- package/dist/src/cli/exec.d.ts.map +1 -0
- package/dist/src/cli/exec.js +2077 -0
- package/dist/src/cli/exec.js.map +49 -0
- package/dist/src/cli/main.d.ts +10 -0
- package/dist/src/cli/main.d.ts.map +1 -0
- package/dist/src/cli/main.js +2032 -0
- package/dist/src/cli/main.js.map +48 -0
- package/dist/src/cli/naming.d.ts +12 -0
- package/dist/src/cli/naming.d.ts.map +1 -0
- package/dist/src/cli/naming.js +216 -0
- package/dist/src/cli/naming.js.map +12 -0
- package/dist/src/cli/operations.d.ts +3 -0
- package/dist/src/cli/operations.d.ts.map +1 -0
- package/dist/src/cli/operations.js +103 -0
- package/dist/src/cli/operations.js.map +10 -0
- package/dist/src/cli/params.d.ts +19 -0
- package/dist/src/cli/params.d.ts.map +1 -0
- package/dist/src/cli/params.js +79 -0
- package/dist/src/cli/params.js.map +12 -0
- package/dist/src/cli/pluralize.d.ts +2 -0
- package/dist/src/cli/pluralize.d.ts.map +1 -0
- package/dist/src/cli/pluralize.js +43 -0
- package/dist/src/cli/pluralize.js.map +10 -0
- package/dist/src/cli/positional.d.ts +19 -0
- package/dist/src/cli/positional.d.ts.map +1 -0
- package/dist/src/cli/positional.js +39 -0
- package/dist/src/cli/positional.js.map +10 -0
- package/dist/src/cli/request-body.d.ts +20 -0
- package/dist/src/cli/request-body.d.ts.map +1 -0
- package/dist/src/cli/request-body.js +82 -0
- package/dist/src/cli/request-body.js.map +12 -0
- package/dist/src/cli/runtime/argv.d.ts +3 -0
- package/dist/src/cli/runtime/argv.d.ts.map +1 -0
- package/dist/src/cli/runtime/argv.js +22 -0
- package/dist/src/cli/runtime/argv.js.map +10 -0
- package/dist/src/cli/runtime/auth/resolve.d.ts +9 -0
- package/dist/src/cli/runtime/auth/resolve.d.ts.map +1 -0
- package/dist/src/cli/runtime/auth/resolve.js +38 -0
- package/dist/src/cli/runtime/auth/resolve.js.map +10 -0
- package/dist/src/cli/runtime/body-flags.d.ts +41 -0
- package/dist/src/cli/runtime/body-flags.d.ts.map +1 -0
- package/dist/src/cli/runtime/body-flags.js +86 -0
- package/dist/src/cli/runtime/body-flags.js.map +10 -0
- package/dist/src/cli/runtime/body.d.ts +15 -0
- package/dist/src/cli/runtime/body.d.ts.map +1 -0
- package/dist/src/cli/runtime/body.js +40 -0
- package/dist/src/cli/runtime/body.js.map +11 -0
- package/dist/src/cli/runtime/collect.d.ts +2 -0
- package/dist/src/cli/runtime/collect.d.ts.map +1 -0
- package/dist/src/cli/runtime/collect.js +9 -0
- package/dist/src/cli/runtime/collect.js.map +10 -0
- package/dist/src/cli/runtime/compat.d.ts +35 -0
- package/dist/src/cli/runtime/compat.d.ts.map +1 -0
- package/dist/src/cli/runtime/compat.js +62 -0
- package/dist/src/cli/runtime/compat.js.map +10 -0
- package/dist/src/cli/runtime/context.d.ts +16 -0
- package/dist/src/cli/runtime/context.d.ts.map +1 -0
- package/dist/src/cli/runtime/context.js +936 -0
- package/dist/src/cli/runtime/context.js.map +32 -0
- package/dist/src/cli/runtime/execute.d.ts +33 -0
- package/dist/src/cli/runtime/execute.d.ts.map +1 -0
- package/dist/src/cli/runtime/execute.js +670 -0
- package/dist/src/cli/runtime/execute.js.map +22 -0
- package/dist/src/cli/runtime/generated.d.ts +14 -0
- package/dist/src/cli/runtime/generated.d.ts.map +1 -0
- package/dist/src/cli/runtime/generated.js +869 -0
- package/dist/src/cli/runtime/generated.js.map +23 -0
- package/dist/src/cli/runtime/headers.d.ts +9 -0
- package/dist/src/cli/runtime/headers.d.ts.map +1 -0
- package/dist/src/cli/runtime/headers.js +36 -0
- package/dist/src/cli/runtime/headers.js.map +10 -0
- package/dist/src/cli/runtime/index.d.ts +4 -0
- package/dist/src/cli/runtime/index.d.ts.map +1 -0
- package/dist/src/cli/runtime/index.js +1808 -0
- package/dist/src/cli/runtime/index.js.map +46 -0
- package/dist/src/cli/runtime/profile/secrets.d.ts +25 -0
- package/dist/src/cli/runtime/profile/secrets.d.ts.map +1 -0
- package/dist/src/cli/runtime/profile/secrets.js +51 -0
- package/dist/src/cli/runtime/profile/secrets.js.map +11 -0
- package/dist/src/cli/runtime/profile/store.d.ts +15 -0
- package/dist/src/cli/runtime/profile/store.d.ts.map +1 -0
- package/dist/src/cli/runtime/profile/store.js +102 -0
- package/dist/src/cli/runtime/profile/store.js.map +11 -0
- package/dist/src/cli/runtime/request.d.ts +36 -0
- package/dist/src/cli/runtime/request.d.ts.map +1 -0
- package/dist/src/cli/runtime/request.js +571 -0
- package/dist/src/cli/runtime/request.js.map +21 -0
- package/dist/src/cli/runtime/server-url.d.ts +8 -0
- package/dist/src/cli/runtime/server-url.d.ts.map +1 -0
- package/dist/src/cli/runtime/server-url.js +55 -0
- package/dist/src/cli/runtime/server-url.js.map +11 -0
- package/dist/src/cli/runtime/template.d.ts +5 -0
- package/dist/src/cli/runtime/template.d.ts.map +1 -0
- package/dist/src/cli/runtime/template.js +29 -0
- package/dist/src/cli/runtime/template.js.map +10 -0
- package/dist/src/cli/runtime/validate/ajv.d.ts +3 -0
- package/dist/src/cli/runtime/validate/ajv.d.ts.map +1 -0
- package/dist/src/cli/runtime/validate/ajv.js +17 -0
- package/dist/src/cli/runtime/validate/ajv.js.map +10 -0
- package/dist/src/cli/runtime/validate/coerce.d.ts +4 -0
- package/dist/src/cli/runtime/validate/coerce.d.ts.map +1 -0
- package/dist/src/cli/runtime/validate/coerce.js +60 -0
- package/dist/src/cli/runtime/validate/coerce.js.map +10 -0
- package/dist/src/cli/runtime/validate/error.d.ts +3 -0
- package/dist/src/cli/runtime/validate/error.d.ts.map +1 -0
- package/dist/src/cli/runtime/validate/error.js +21 -0
- package/dist/src/cli/runtime/validate/error.js.map +10 -0
- package/dist/src/cli/runtime/validate/index.d.ts +5 -0
- package/dist/src/cli/runtime/validate/index.d.ts.map +1 -0
- package/dist/src/cli/runtime/validate/index.js +122 -0
- package/dist/src/cli/runtime/validate/index.js.map +13 -0
- package/dist/src/cli/runtime/validate/schema.d.ts +9 -0
- package/dist/src/cli/runtime/validate/schema.d.ts.map +1 -0
- package/dist/src/cli/runtime/validate/schema.js +36 -0
- package/dist/src/cli/runtime/validate/schema.js.map +10 -0
- package/dist/src/cli/schema-shape.d.ts +5 -0
- package/dist/src/cli/schema-shape.d.ts.map +1 -0
- package/dist/src/cli/schema-shape.js +41 -0
- package/dist/src/cli/schema-shape.js.map +10 -0
- package/dist/src/cli/schema.d.ts +30 -0
- package/dist/src/cli/schema.d.ts.map +1 -0
- package/dist/src/cli/schema.js +38 -0
- package/dist/src/cli/schema.js.map +10 -0
- package/dist/src/cli/server.d.ts +16 -0
- package/dist/src/cli/server.d.ts.map +1 -0
- package/dist/src/cli/server.js +64 -0
- package/dist/src/cli/server.js.map +11 -0
- package/dist/src/cli/spec-id.d.ts +3 -0
- package/dist/src/cli/spec-id.d.ts.map +1 -0
- package/dist/src/cli/spec-id.js +21 -0
- package/dist/src/cli/spec-id.js.map +11 -0
- package/dist/src/cli/spec-loader.d.ts +7 -0
- package/dist/src/cli/spec-loader.d.ts.map +1 -0
- package/dist/src/cli/spec-loader.js +110 -0
- package/dist/src/cli/spec-loader.js.map +15 -0
- package/dist/src/cli/stable-json.d.ts +4 -0
- package/dist/src/cli/stable-json.d.ts.map +1 -0
- package/dist/src/cli/stable-json.js +35 -0
- package/dist/src/cli/stable-json.js.map +10 -0
- package/dist/src/cli/strings.d.ts +3 -0
- package/dist/src/cli/strings.d.ts.map +1 -0
- package/dist/src/cli/strings.js +16 -0
- package/dist/src/cli/strings.js.map +10 -0
- package/dist/src/cli/types.d.ts +53 -0
- package/dist/src/cli/types.d.ts.map +1 -0
- package/dist/src/cli/types.js +9 -0
- package/dist/src/cli/types.js.map +10 -0
- package/package.json +31 -4
- package/src/ai/tools.ts +211 -0
- package/src/cli/main.ts +73 -163
- package/src/cli/runtime/auth/resolve.ts +20 -0
- package/src/cli/runtime/body.ts +3 -3
- package/src/cli/runtime/compat.ts +89 -0
- package/src/cli/runtime/execute.ts +98 -39
- package/src/cli/runtime/generated.ts +111 -4
- package/src/cli/runtime/profile/secrets.ts +42 -1
- package/src/cli/runtime/profile/store.ts +15 -13
- package/src/cli/runtime/request.ts +22 -11
- package/src/cli/spec-loader.ts +2 -2
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/cli/strings.ts", "../../../src/cli/auth-schemes.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"export function kebabCase(input: string): string {\n\tconst trimmed = input.trim();\n\tif (!trimmed) return \"\";\n\n\t// Convert spaces/underscores/dots to dashes, split camelCase.\n\treturn trimmed\n\t\t.replace(/([a-z0-9])([A-Z])/g, \"$1-$2\")\n\t\t.replace(/[\\s_.:/]+/g, \"-\")\n\t\t.replace(/[^a-zA-Z0-9-]/g, \"-\")\n\t\t.replace(/-+/g, \"-\")\n\t\t.replace(/^-|-$/g, \"\")\n\t\t.toLowerCase();\n}\n\nexport function titleCase(input: string): string {\n\treturn input\n\t\t.split(/\\s+/g)\n\t\t.filter(Boolean)\n\t\t.map((w) => w[0]?.toUpperCase() + w.slice(1))\n\t\t.join(\" \");\n}\n",
|
|
6
|
+
"import { kebabCase } from \"./strings.ts\";\nimport type { OpenApiDoc } from \"./types.ts\";\n\nexport type AuthSchemeKind =\n\t| \"http-bearer\"\n\t| \"http-basic\"\n\t| \"api-key\"\n\t| \"oauth2\"\n\t| \"openIdConnect\"\n\t| \"unknown\";\n\nexport type AuthScheme = {\n\tkey: string;\n\tkind: AuthSchemeKind;\n\tname?: string;\n\tin?: \"header\" | \"query\" | \"cookie\";\n\tscheme?: string;\n\tbearerFormat?: string;\n\tdescription?: string;\n\n\t// oauth2/openid only (subset of spec, enough to derive flags + docs)\n\toauthFlows?: OAuthFlows;\n\topenIdConnectUrl?: string;\n};\n\nexport type OAuthFlow = {\n\tauthorizationUrl?: string;\n\ttokenUrl?: string;\n\trefreshUrl?: string;\n\tscopes: string[];\n};\n\nexport type OAuthFlows = Partial<\n\tRecord<\n\t\t\"implicit\" | \"password\" | \"clientCredentials\" | \"authorizationCode\",\n\t\tOAuthFlow\n\t>\n>;\n\ntype RawOAuthFlow = {\n\tauthorizationUrl?: unknown;\n\ttokenUrl?: unknown;\n\trefreshUrl?: unknown;\n\tscopes?: unknown;\n};\n\ntype RawOAuthFlows = {\n\timplicit?: RawOAuthFlow;\n\tpassword?: RawOAuthFlow;\n\tclientCredentials?: RawOAuthFlow;\n\tauthorizationCode?: RawOAuthFlow;\n};\n\ntype RawSecurityScheme = {\n\ttype?: string;\n\tdescription?: string;\n\tname?: string;\n\tin?: string;\n\tscheme?: string;\n\tbearerFormat?: string;\n\tflows?: RawOAuthFlows;\n\topenIdConnectUrl?: string;\n};\n\nfunction parseOAuthFlow(flow: RawOAuthFlow | undefined): OAuthFlow | undefined {\n\tif (!flow) return undefined;\n\tconst scopesObj = flow.scopes;\n\tconst scopes =\n\t\tscopesObj && typeof scopesObj === \"object\" && !Array.isArray(scopesObj)\n\t\t\t? Object.keys(scopesObj as Record<string, unknown>)\n\t\t\t: [];\n\n\treturn {\n\t\tauthorizationUrl:\n\t\t\ttypeof flow.authorizationUrl === \"string\"\n\t\t\t\t? flow.authorizationUrl\n\t\t\t\t: undefined,\n\t\ttokenUrl: typeof flow.tokenUrl === \"string\" ? flow.tokenUrl : undefined,\n\t\trefreshUrl:\n\t\t\ttypeof flow.refreshUrl === \"string\" ? flow.refreshUrl : undefined,\n\t\tscopes: scopes.sort(),\n\t};\n}\n\nfunction parseOAuthFlows(\n\tflows: RawOAuthFlows | undefined,\n): OAuthFlows | undefined {\n\tif (!flows) return undefined;\n\tconst out: OAuthFlows = {};\n\n\tconst implicit = parseOAuthFlow(flows.implicit);\n\tif (implicit) out.implicit = implicit;\n\n\tconst password = parseOAuthFlow(flows.password);\n\tif (password) out.password = password;\n\n\tconst clientCredentials = parseOAuthFlow(flows.clientCredentials);\n\tif (clientCredentials) out.clientCredentials = clientCredentials;\n\n\tconst authorizationCode = parseOAuthFlow(flows.authorizationCode);\n\tif (authorizationCode) out.authorizationCode = authorizationCode;\n\n\treturn Object.keys(out).length ? out : undefined;\n}\n\nexport function listAuthSchemes(doc: OpenApiDoc): AuthScheme[] {\n\tconst schemes = doc.components?.securitySchemes;\n\tif (!schemes || typeof schemes !== \"object\") return [];\n\n\tconst out: AuthScheme[] = [];\n\n\tfor (const [key, raw] of Object.entries(schemes)) {\n\t\tif (!raw || typeof raw !== \"object\") continue;\n\t\tconst s = raw as RawSecurityScheme;\n\n\t\tconst type = s.type;\n\t\tif (type === \"http\") {\n\t\t\tconst scheme = (s.scheme ?? \"\").toLowerCase();\n\t\t\tif (scheme === \"bearer\") {\n\t\t\t\tout.push({\n\t\t\t\t\tkey,\n\t\t\t\t\tkind: \"http-bearer\",\n\t\t\t\t\tscheme: scheme,\n\t\t\t\t\tbearerFormat: s.bearerFormat,\n\t\t\t\t\tdescription: s.description,\n\t\t\t\t});\n\t\t\t} else if (scheme === \"basic\") {\n\t\t\t\tout.push({\n\t\t\t\t\tkey,\n\t\t\t\t\tkind: \"http-basic\",\n\t\t\t\t\tscheme: scheme,\n\t\t\t\t\tdescription: s.description,\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tout.push({\n\t\t\t\t\tkey,\n\t\t\t\t\tkind: \"unknown\",\n\t\t\t\t\tscheme: s.scheme,\n\t\t\t\t\tdescription: s.description,\n\t\t\t\t});\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (type === \"apiKey\") {\n\t\t\tconst where = s.in;\n\t\t\tconst loc =\n\t\t\t\twhere === \"header\" || where === \"query\" || where === \"cookie\"\n\t\t\t\t\t? where\n\t\t\t\t\t: undefined;\n\t\t\tout.push({\n\t\t\t\tkey,\n\t\t\t\tkind: \"api-key\",\n\t\t\t\tname: s.name,\n\t\t\t\tin: loc,\n\t\t\t\tdescription: s.description,\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (type === \"oauth2\") {\n\t\t\tout.push({\n\t\t\t\tkey,\n\t\t\t\tkind: \"oauth2\",\n\t\t\t\tdescription: s.description,\n\t\t\t\toauthFlows: parseOAuthFlows(s.flows),\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (type === \"openIdConnect\") {\n\t\t\tout.push({\n\t\t\t\tkey,\n\t\t\t\tkind: \"openIdConnect\",\n\t\t\t\tdescription: s.description,\n\t\t\t\topenIdConnectUrl: s.openIdConnectUrl,\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\n\t\tout.push({ key, kind: \"unknown\", description: s.description });\n\t}\n\n\t// Stable order.\n\tout.sort((a, b) => kebabCase(a.key).localeCompare(kebabCase(b.key)));\n\treturn out;\n}\n"
|
|
7
|
+
],
|
|
8
|
+
"mappings": ";AAAO,SAAS,SAAS,CAAC,OAAuB;AAAA,EAChD,MAAM,UAAU,MAAM,KAAK;AAAA,EAC3B,IAAI,CAAC;AAAA,IAAS,OAAO;AAAA,EAGrB,OAAO,QACL,QAAQ,sBAAsB,OAAO,EACrC,QAAQ,cAAc,GAAG,EACzB,QAAQ,kBAAkB,GAAG,EAC7B,QAAQ,OAAO,GAAG,EAClB,QAAQ,UAAU,EAAE,EACpB,YAAY;AAAA;;;ACqDf,SAAS,cAAc,CAAC,MAAuD;AAAA,EAC9E,IAAI,CAAC;AAAA,IAAM;AAAA,EACX,MAAM,YAAY,KAAK;AAAA,EACvB,MAAM,SACL,aAAa,OAAO,cAAc,YAAY,CAAC,MAAM,QAAQ,SAAS,IACnE,OAAO,KAAK,SAAoC,IA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,EACnE,OAAO;AAAA;",
|
|
9
|
+
"debugId": "1E05C79C42F036E864756E2164756E21",
|
|
10
|
+
"names": []
|
|
11
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { AuthScheme, AuthSchemeKind } from "./auth-schemes.js";
|
|
2
|
+
import type { CommandModel } from "./command-model.js";
|
|
3
|
+
import type { ServerInfo } from "./server.js";
|
|
4
|
+
import type { NormalizedOperation, OpenApiDoc } from "./types.js";
|
|
5
|
+
export type Capabilities = {
|
|
6
|
+
servers: {
|
|
7
|
+
count: number;
|
|
8
|
+
hasVariables: boolean;
|
|
9
|
+
};
|
|
10
|
+
auth: {
|
|
11
|
+
count: number;
|
|
12
|
+
kinds: AuthSchemeKind[];
|
|
13
|
+
hasSecurityRequirements: boolean;
|
|
14
|
+
};
|
|
15
|
+
operations: {
|
|
16
|
+
count: number;
|
|
17
|
+
hasRequestBodies: boolean;
|
|
18
|
+
};
|
|
19
|
+
commands: {
|
|
20
|
+
countResources: number;
|
|
21
|
+
countActions: number;
|
|
22
|
+
hasRequestBodies: boolean;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export declare function deriveCapabilities(input: {
|
|
26
|
+
doc: OpenApiDoc;
|
|
27
|
+
servers: ServerInfo[];
|
|
28
|
+
authSchemes: AuthScheme[];
|
|
29
|
+
operations: NormalizedOperation[];
|
|
30
|
+
commands?: CommandModel;
|
|
31
|
+
}): Capabilities;
|
|
32
|
+
//# sourceMappingURL=capabilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../../../src/cli/capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EACX,mBAAmB,EACnB,UAAU,EAEV,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,YAAY,GAAG;IAC1B,OAAO,EAAE;QACR,KAAK,EAAE,MAAM,CAAC;QACd,YAAY,EAAE,OAAO,CAAC;KACtB,CAAC;IACF,IAAI,EAAE;QACL,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,cAAc,EAAE,CAAC;QACxB,uBAAuB,EAAE,OAAO,CAAC;KACjC,CAAC;IACF,UAAU,EAAE;QACX,KAAK,EAAE,MAAM,CAAC;QACd,gBAAgB,EAAE,OAAO,CAAC;KAC1B,CAAC;IACF,QAAQ,EAAE;QACT,cAAc,EAAE,MAAM,CAAC;QACvB,YAAY,EAAE,MAAM,CAAC;QACrB,gBAAgB,EAAE,OAAO,CAAC;KAC1B,CAAC;CACF,CAAC;AAeF,wBAAgB,kBAAkB,CAAC,KAAK,EAAE;IACzC,GAAG,EAAE,UAAU,CAAC;IAChB,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,WAAW,EAAE,UAAU,EAAE,CAAC;IAC1B,UAAU,EAAE,mBAAmB,EAAE,CAAC;IAClC,QAAQ,CAAC,EAAE,YAAY,CAAC;CACxB,GAAG,YAAY,CAsCf"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// src/cli/capabilities.ts
|
|
2
|
+
function uniqueSorted(items, compare) {
|
|
3
|
+
const out = [...items];
|
|
4
|
+
out.sort(compare);
|
|
5
|
+
return out.filter((v, i) => i === 0 || compare(out[i - 1], v) !== 0);
|
|
6
|
+
}
|
|
7
|
+
function hasSecurity(requirements) {
|
|
8
|
+
if (!requirements?.length)
|
|
9
|
+
return false;
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
function deriveCapabilities(input) {
|
|
13
|
+
const serverHasVars = input.servers.some((s) => s.variableNames.length > 0);
|
|
14
|
+
const authKinds = uniqueSorted(input.authSchemes.map((s) => s.kind), (a, b) => a.localeCompare(b));
|
|
15
|
+
const hasSecurityRequirements = hasSecurity(input.doc.security) || input.operations.some((op) => hasSecurity(op.security));
|
|
16
|
+
const opHasBodies = input.operations.some((op) => Boolean(op.requestBody));
|
|
17
|
+
const cmdResources = input.commands?.resources ?? [];
|
|
18
|
+
const cmdActions = cmdResources.flatMap((r) => r.actions);
|
|
19
|
+
const cmdHasBodies = cmdActions.some((a) => Boolean(a.requestBody));
|
|
20
|
+
return {
|
|
21
|
+
servers: {
|
|
22
|
+
count: input.servers.length,
|
|
23
|
+
hasVariables: serverHasVars
|
|
24
|
+
},
|
|
25
|
+
auth: {
|
|
26
|
+
count: input.authSchemes.length,
|
|
27
|
+
kinds: authKinds,
|
|
28
|
+
hasSecurityRequirements
|
|
29
|
+
},
|
|
30
|
+
operations: {
|
|
31
|
+
count: input.operations.length,
|
|
32
|
+
hasRequestBodies: opHasBodies
|
|
33
|
+
},
|
|
34
|
+
commands: {
|
|
35
|
+
countResources: cmdResources.length,
|
|
36
|
+
countActions: cmdActions.length,
|
|
37
|
+
hasRequestBodies: cmdHasBodies
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export {
|
|
42
|
+
deriveCapabilities
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
//# debugId=59EB25C5C8336ED764756E2164756E21
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/cli/capabilities.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import type { AuthScheme, AuthSchemeKind } from \"./auth-schemes.ts\";\nimport type { CommandModel } from \"./command-model.ts\";\nimport type { ServerInfo } from \"./server.ts\";\nimport type {\n\tNormalizedOperation,\n\tOpenApiDoc,\n\tSecurityRequirement,\n} from \"./types.ts\";\n\nexport type Capabilities = {\n\tservers: {\n\t\tcount: number;\n\t\thasVariables: boolean;\n\t};\n\tauth: {\n\t\tcount: number;\n\t\tkinds: AuthSchemeKind[];\n\t\thasSecurityRequirements: boolean;\n\t};\n\toperations: {\n\t\tcount: number;\n\t\thasRequestBodies: boolean;\n\t};\n\tcommands: {\n\t\tcountResources: number;\n\t\tcountActions: number;\n\t\thasRequestBodies: boolean;\n\t};\n};\n\nfunction uniqueSorted<T>(items: T[], compare: (a: T, b: T) => number): T[] {\n\tconst out = [...items];\n\tout.sort(compare);\n\treturn out.filter((v, i) => i === 0 || compare(out[i - 1] as T, v) !== 0);\n}\n\nfunction hasSecurity(requirements: SecurityRequirement[] | undefined): boolean {\n\tif (!requirements?.length) return false;\n\n\t// Treat any non-empty array as \"auth exists\", even if it contains `{}` to mean optional.\n\treturn true;\n}\n\nexport function deriveCapabilities(input: {\n\tdoc: OpenApiDoc;\n\tservers: ServerInfo[];\n\tauthSchemes: AuthScheme[];\n\toperations: NormalizedOperation[];\n\tcommands?: CommandModel;\n}): Capabilities {\n\tconst serverHasVars = input.servers.some((s) => s.variableNames.length > 0);\n\n\tconst authKinds = uniqueSorted(\n\t\tinput.authSchemes.map((s) => s.kind),\n\t\t(a, b) => a.localeCompare(b),\n\t);\n\n\tconst hasSecurityRequirements =\n\t\thasSecurity(input.doc.security) ||\n\t\tinput.operations.some((op) => hasSecurity(op.security));\n\n\tconst opHasBodies = input.operations.some((op) => Boolean(op.requestBody));\n\n\tconst cmdResources = input.commands?.resources ?? [];\n\tconst cmdActions = cmdResources.flatMap((r) => r.actions);\n\tconst cmdHasBodies = cmdActions.some((a) => Boolean(a.requestBody));\n\n\treturn {\n\t\tservers: {\n\t\t\tcount: input.servers.length,\n\t\t\thasVariables: serverHasVars,\n\t\t},\n\t\tauth: {\n\t\t\tcount: input.authSchemes.length,\n\t\t\tkinds: authKinds,\n\t\t\thasSecurityRequirements,\n\t\t},\n\t\toperations: {\n\t\t\tcount: input.operations.length,\n\t\t\thasRequestBodies: opHasBodies,\n\t\t},\n\t\tcommands: {\n\t\t\tcountResources: cmdResources.length,\n\t\t\tcountActions: cmdActions.length,\n\t\t\thasRequestBodies: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WAAW;AAAA,MACxB,kBAAkB;AAAA,IACnB;AAAA,IACA,UAAU;AAAA,MACT,gBAAgB,aAAa;AAAA,MAC7B,cAAc,WAAW;AAAA,MACzB,kBAAkB;AAAA,IACnB;AAAA,EACD;AAAA;",
|
|
8
|
+
"debugId": "59EB25C5C8336ED764756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-id.d.ts","sourceRoot":"","sources":["../../../src/cli/command-id.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,cAAc,GAAG;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,wBAAgB,cAAc,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,CAM5D"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// src/cli/strings.ts
|
|
2
|
+
function kebabCase(input) {
|
|
3
|
+
const trimmed = input.trim();
|
|
4
|
+
if (!trimmed)
|
|
5
|
+
return "";
|
|
6
|
+
return trimmed.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/[\s_.:/]+/g, "-").replace(/[^a-zA-Z0-9-]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "").toLowerCase();
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
// src/cli/command-id.ts
|
|
10
|
+
function buildCommandId(parts) {
|
|
11
|
+
const op = kebabCase(parts.operationKey.replace(/\s+/g, "-"));
|
|
12
|
+
return `${parts.specId}:${kebabCase(parts.resource)}:${kebabCase(parts.action)}:${op}`;
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
buildCommandId
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
//# debugId=B762E82FE5939FE664756E2164756E21
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/cli/strings.ts", "../../../src/cli/command-id.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"export function kebabCase(input: string): string {\n\tconst trimmed = input.trim();\n\tif (!trimmed) return \"\";\n\n\t// Convert spaces/underscores/dots to dashes, split camelCase.\n\treturn trimmed\n\t\t.replace(/([a-z0-9])([A-Z])/g, \"$1-$2\")\n\t\t.replace(/[\\s_.:/]+/g, \"-\")\n\t\t.replace(/[^a-zA-Z0-9-]/g, \"-\")\n\t\t.replace(/-+/g, \"-\")\n\t\t.replace(/^-|-$/g, \"\")\n\t\t.toLowerCase();\n}\n\nexport function titleCase(input: string): string {\n\treturn input\n\t\t.split(/\\s+/g)\n\t\t.filter(Boolean)\n\t\t.map((w) => w[0]?.toUpperCase() + w.slice(1))\n\t\t.join(\" \");\n}\n",
|
|
6
|
+
"import { kebabCase } from \"./strings.ts\";\n\nexport type CommandIdParts = {\n\tspecId: string;\n\tresource: string;\n\taction: string;\n\toperationKey: string;\n};\n\nexport function buildCommandId(parts: CommandIdParts): string {\n\t// operationKey is the ultimate disambiguator, but we keep the id readable.\n\t// Example:\n\t// contacts-api:contacts:get:GET-/contacts/{id}\n\tconst op = kebabCase(parts.operationKey.replace(/\\s+/g, \"-\"));\n\treturn `${parts.specId}:${kebabCase(parts.resource)}:${kebabCase(parts.action)}:${op}`;\n}\n"
|
|
7
|
+
],
|
|
8
|
+
"mappings": ";AAAO,SAAS,SAAS,CAAC,OAAuB;AAAA,EAChD,MAAM,UAAU,MAAM,KAAK;AAAA,EAC3B,IAAI,CAAC;AAAA,IAAS,OAAO;AAAA,EAGrB,OAAO,QACL,QAAQ,sBAAsB,OAAO,EACrC,QAAQ,cAAc,GAAG,EACzB,QAAQ,kBAAkB,GAAG,EAC7B,QAAQ,OAAO,GAAG,EAClB,QAAQ,UAAU,EAAE,EACpB,YAAY;AAAA;;;ACFR,SAAS,cAAc,CAAC,OAA+B;AAAA,EAI7D,MAAM,KAAK,UAAU,MAAM,aAAa,QAAQ,QAAQ,GAAG,CAAC;AAAA,EAC5D,OAAO,GAAG,MAAM,UAAU,UAAU,MAAM,QAAQ,KAAK,UAAU,MAAM,MAAM,KAAK;AAAA;",
|
|
9
|
+
"debugId": "B762E82FE5939FE664756E2164756E21",
|
|
10
|
+
"names": []
|
|
11
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CommandAction, CommandModel } from "./command-model.js";
|
|
2
|
+
export type CommandsIndex = {
|
|
3
|
+
byId: Record<string, CommandAction>;
|
|
4
|
+
};
|
|
5
|
+
export declare function buildCommandsIndex(commands: CommandModel | undefined): CommandsIndex;
|
|
6
|
+
//# sourceMappingURL=command-index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-index.d.ts","sourceRoot":"","sources":["../../../src/cli/command-index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEtE,MAAM,MAAM,aAAa,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;CACpC,CAAC;AAEF,wBAAgB,kBAAkB,CACjC,QAAQ,EAAE,YAAY,GAAG,SAAS,GAChC,aAAa,CAUf"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// src/cli/command-index.ts
|
|
2
|
+
function buildCommandsIndex(commands) {
|
|
3
|
+
const byId = {};
|
|
4
|
+
for (const resource of commands?.resources ?? []) {
|
|
5
|
+
for (const action of resource.actions) {
|
|
6
|
+
byId[action.id] = action;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return { byId };
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
buildCommandsIndex
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
//# debugId=F2735E1A1DCFEBCF64756E2164756E21
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/cli/command-index.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import type { CommandAction, CommandModel } from \"./command-model.ts\";\n\nexport type CommandsIndex = {\n\tbyId: Record<string, CommandAction>;\n};\n\nexport function buildCommandsIndex(\n\tcommands: CommandModel | undefined,\n): CommandsIndex {\n\tconst byId: Record<string, CommandAction> = {};\n\n\tfor (const resource of commands?.resources ?? []) {\n\t\tfor (const action of resource.actions) {\n\t\t\tbyId[action.id] = action;\n\t\t}\n\t}\n\n\treturn { byId };\n}\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";AAMO,SAAS,kBAAkB,CACjC,UACgB;AAAA,EAChB,MAAM,OAAsC,CAAC;AAAA,EAE7C,WAAW,YAAY,UAAU,aAAa,CAAC,GAAG;AAAA,IACjD,WAAW,UAAU,SAAS,SAAS;AAAA,MACtC,KAAK,OAAO,MAAM;AAAA,IACnB;AAAA,EACD;AAAA,EAEA,OAAO,EAAE,KAAK;AAAA;",
|
|
8
|
+
"debugId": "F2735E1A1DCFEBCF64756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { AuthSummary } from "./auth-requirements.js";
|
|
2
|
+
import type { AuthScheme } from "./auth-schemes.js";
|
|
3
|
+
import type { PlannedOperation } from "./naming.js";
|
|
4
|
+
import type { ParamSpec } from "./params.js";
|
|
5
|
+
import type { RequestBodyInfo } from "./request-body.js";
|
|
6
|
+
import type { SecurityRequirement } from "./types.js";
|
|
7
|
+
export type CommandAction = {
|
|
8
|
+
id: string;
|
|
9
|
+
key: string;
|
|
10
|
+
action: string;
|
|
11
|
+
pathArgs: string[];
|
|
12
|
+
method: string;
|
|
13
|
+
path: string;
|
|
14
|
+
operationId?: string;
|
|
15
|
+
tags: string[];
|
|
16
|
+
summary?: string;
|
|
17
|
+
description?: string;
|
|
18
|
+
deprecated?: boolean;
|
|
19
|
+
style: PlannedOperation["style"];
|
|
20
|
+
positionals: Array<import("./positional.js").PositionalArg>;
|
|
21
|
+
flags: Array<Pick<import("./params.js").ParamSpec, "in" | "name" | "flag" | "required" | "description" | "type" | "format" | "enum" | "itemType" | "itemFormat" | "itemEnum">>;
|
|
22
|
+
params: ParamSpec[];
|
|
23
|
+
auth: AuthSummary;
|
|
24
|
+
requestBody?: RequestBodyInfo;
|
|
25
|
+
requestBodySchema?: import("./types.js").JsonSchema;
|
|
26
|
+
};
|
|
27
|
+
export type CommandResource = {
|
|
28
|
+
resource: string;
|
|
29
|
+
actions: CommandAction[];
|
|
30
|
+
};
|
|
31
|
+
export type CommandModel = {
|
|
32
|
+
resources: CommandResource[];
|
|
33
|
+
};
|
|
34
|
+
export type BuildCommandModelOptions = {
|
|
35
|
+
specId: string;
|
|
36
|
+
globalSecurity?: SecurityRequirement[];
|
|
37
|
+
authSchemes?: AuthScheme[];
|
|
38
|
+
};
|
|
39
|
+
export declare function buildCommandModel(planned: PlannedOperation[], options: BuildCommandModelOptions): CommandModel;
|
|
40
|
+
//# sourceMappingURL=command-model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-model.d.ts","sourceRoot":"","sources":["../../../src/cli/command-model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAG7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtD,MAAM,MAAM,aAAa,GAAG;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IAC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AAwB,GAC/B,YAAY,CAuDd"}
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
// src/cli/auth-requirements.ts
|
|
2
|
+
function isSecurityRequirement(value) {
|
|
3
|
+
if (!value || typeof value !== "object")
|
|
4
|
+
return false;
|
|
5
|
+
if (Array.isArray(value))
|
|
6
|
+
return false;
|
|
7
|
+
for (const [k, v] of Object.entries(value)) {
|
|
8
|
+
if (typeof k !== "string")
|
|
9
|
+
return false;
|
|
10
|
+
if (!Array.isArray(v))
|
|
11
|
+
return false;
|
|
12
|
+
if (!v.every((s) => typeof s === "string"))
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
function normalizeSecurity(value) {
|
|
18
|
+
if (value == null)
|
|
19
|
+
return { requirements: [], source: "none" };
|
|
20
|
+
if (!Array.isArray(value))
|
|
21
|
+
return { requirements: [], source: "none" };
|
|
22
|
+
const reqs = value.filter(isSecurityRequirement);
|
|
23
|
+
if (reqs.length === 0)
|
|
24
|
+
return { requirements: [], source: "empty" };
|
|
25
|
+
return { requirements: reqs, source: "non-empty" };
|
|
26
|
+
}
|
|
27
|
+
function summarizeAuth(operationSecurity, globalSecurity, knownSchemes) {
|
|
28
|
+
const op = normalizeSecurity(operationSecurity);
|
|
29
|
+
if (op.source === "non-empty") {
|
|
30
|
+
return { alternatives: toAlternatives(op.requirements, knownSchemes) };
|
|
31
|
+
}
|
|
32
|
+
if (op.source === "empty") {
|
|
33
|
+
return { alternatives: [] };
|
|
34
|
+
}
|
|
35
|
+
const global = normalizeSecurity(globalSecurity);
|
|
36
|
+
if (global.source === "non-empty") {
|
|
37
|
+
return { alternatives: toAlternatives(global.requirements, knownSchemes) };
|
|
38
|
+
}
|
|
39
|
+
return { alternatives: [] };
|
|
40
|
+
}
|
|
41
|
+
function toAlternatives(requirements, knownSchemes) {
|
|
42
|
+
const known = new Set(knownSchemes.map((s) => s.key));
|
|
43
|
+
return requirements.map((req) => {
|
|
44
|
+
const out = [];
|
|
45
|
+
for (const [key, scopes] of Object.entries(req)) {
|
|
46
|
+
out.push({
|
|
47
|
+
key,
|
|
48
|
+
scopes: Array.isArray(scopes) ? scopes : []
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
out.sort((a, b) => a.key.localeCompare(b.key));
|
|
52
|
+
out.sort((a, b) => {
|
|
53
|
+
const ak = known.has(a.key) ? 0 : 1;
|
|
54
|
+
const bk = known.has(b.key) ? 0 : 1;
|
|
55
|
+
if (ak !== bk)
|
|
56
|
+
return ak - bk;
|
|
57
|
+
return a.key.localeCompare(b.key);
|
|
58
|
+
});
|
|
59
|
+
return out;
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// src/cli/strings.ts
|
|
64
|
+
function kebabCase(input) {
|
|
65
|
+
const trimmed = input.trim();
|
|
66
|
+
if (!trimmed)
|
|
67
|
+
return "";
|
|
68
|
+
return trimmed.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/[\s_.:/]+/g, "-").replace(/[^a-zA-Z0-9-]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "").toLowerCase();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// src/cli/command-id.ts
|
|
72
|
+
function buildCommandId(parts) {
|
|
73
|
+
const op = kebabCase(parts.operationKey.replace(/\s+/g, "-"));
|
|
74
|
+
return `${parts.specId}:${kebabCase(parts.resource)}:${kebabCase(parts.action)}:${op}`;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// src/cli/schema-shape.ts
|
|
78
|
+
function getSchemaType(schema) {
|
|
79
|
+
if (!schema || typeof schema !== "object")
|
|
80
|
+
return "unknown";
|
|
81
|
+
const t = schema.type;
|
|
82
|
+
if (t === "string")
|
|
83
|
+
return "string";
|
|
84
|
+
if (t === "number")
|
|
85
|
+
return "number";
|
|
86
|
+
if (t === "integer")
|
|
87
|
+
return "integer";
|
|
88
|
+
if (t === "boolean")
|
|
89
|
+
return "boolean";
|
|
90
|
+
if (t === "array")
|
|
91
|
+
return "array";
|
|
92
|
+
if (t === "object")
|
|
93
|
+
return "object";
|
|
94
|
+
return "unknown";
|
|
95
|
+
}
|
|
96
|
+
function getSchemaFormat(schema) {
|
|
97
|
+
if (!schema || typeof schema !== "object")
|
|
98
|
+
return;
|
|
99
|
+
const f = schema.format;
|
|
100
|
+
return typeof f === "string" ? f : undefined;
|
|
101
|
+
}
|
|
102
|
+
function getSchemaEnumStrings(schema) {
|
|
103
|
+
if (!schema || typeof schema !== "object")
|
|
104
|
+
return;
|
|
105
|
+
const e = schema.enum;
|
|
106
|
+
if (!Array.isArray(e))
|
|
107
|
+
return;
|
|
108
|
+
const values = e.filter((v) => typeof v === "string");
|
|
109
|
+
return values.length ? values : undefined;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// src/cli/params.ts
|
|
113
|
+
function deriveParamSpecs(op) {
|
|
114
|
+
const out = [];
|
|
115
|
+
for (const p of op.parameters) {
|
|
116
|
+
const flag = `--${kebabCase(p.name)}`;
|
|
117
|
+
const type = getSchemaType(p.schema);
|
|
118
|
+
const schemaObj = p.schema && typeof p.schema === "object" ? p.schema : undefined;
|
|
119
|
+
const itemsSchema = schemaObj && type === "array" && typeof schemaObj.items === "object" ? schemaObj.items : undefined;
|
|
120
|
+
out.push({
|
|
121
|
+
kind: p.in === "path" ? "positional" : "flag",
|
|
122
|
+
in: p.in,
|
|
123
|
+
name: p.name,
|
|
124
|
+
flag,
|
|
125
|
+
required: p.required,
|
|
126
|
+
description: p.description,
|
|
127
|
+
type,
|
|
128
|
+
format: getSchemaFormat(p.schema),
|
|
129
|
+
enum: getSchemaEnumStrings(p.schema),
|
|
130
|
+
itemType: type === "array" ? getSchemaType(itemsSchema) : undefined,
|
|
131
|
+
itemFormat: type === "array" ? getSchemaFormat(itemsSchema) : undefined,
|
|
132
|
+
itemEnum: type === "array" ? getSchemaEnumStrings(itemsSchema) : undefined,
|
|
133
|
+
schema: schemaObj
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
out.sort((a, b) => {
|
|
137
|
+
if (a.in !== b.in)
|
|
138
|
+
return a.in.localeCompare(b.in);
|
|
139
|
+
return a.name.localeCompare(b.name);
|
|
140
|
+
});
|
|
141
|
+
return out;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// src/cli/positional.ts
|
|
145
|
+
function derivePositionals(action) {
|
|
146
|
+
const byName = new Map;
|
|
147
|
+
for (const name of action.pathArgs) {
|
|
148
|
+
const p = action.params.find((x) => x.in === "path" && x.name === name);
|
|
149
|
+
byName.set(name, {
|
|
150
|
+
name,
|
|
151
|
+
required: true,
|
|
152
|
+
description: p?.description,
|
|
153
|
+
type: p?.type ?? "unknown",
|
|
154
|
+
format: p?.format,
|
|
155
|
+
enum: p?.enum
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
return [...byName.values()];
|
|
159
|
+
}
|
|
160
|
+
function deriveFlags(action) {
|
|
161
|
+
return {
|
|
162
|
+
flags: action.params.filter((p) => p.kind === "flag").map((p) => ({
|
|
163
|
+
in: p.in,
|
|
164
|
+
name: p.name,
|
|
165
|
+
flag: p.flag,
|
|
166
|
+
required: p.required,
|
|
167
|
+
description: p.description,
|
|
168
|
+
type: p.type,
|
|
169
|
+
format: p.format,
|
|
170
|
+
enum: p.enum,
|
|
171
|
+
itemType: p.itemType,
|
|
172
|
+
itemFormat: p.itemFormat,
|
|
173
|
+
itemEnum: p.itemEnum
|
|
174
|
+
}))
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// src/cli/types.ts
|
|
179
|
+
function isJsonSchema(value) {
|
|
180
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// src/cli/request-body.ts
|
|
184
|
+
function getRequestBody(op) {
|
|
185
|
+
return op.requestBody;
|
|
186
|
+
}
|
|
187
|
+
function deriveRequestBodyInfo(op) {
|
|
188
|
+
const rb = getRequestBody(op);
|
|
189
|
+
if (!rb)
|
|
190
|
+
return;
|
|
191
|
+
const content = [];
|
|
192
|
+
for (const contentType of rb.contentTypes) {
|
|
193
|
+
const schema = rb.schemasByContentType[contentType];
|
|
194
|
+
content.push({
|
|
195
|
+
contentType,
|
|
196
|
+
required: rb.required,
|
|
197
|
+
schemaType: getSchemaType(schema),
|
|
198
|
+
schemaFormat: getSchemaFormat(schema),
|
|
199
|
+
schemaEnum: getSchemaEnumStrings(schema)
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
content.sort((a, b) => a.contentType.localeCompare(b.contentType));
|
|
203
|
+
const hasJson = content.some((c) => c.contentType.includes("json"));
|
|
204
|
+
const hasFormUrlEncoded = content.some((c) => c.contentType === "application/x-www-form-urlencoded");
|
|
205
|
+
const hasMultipart = content.some((c) => c.contentType.startsWith("multipart/"));
|
|
206
|
+
const bodyFlags = ["--data", "--file"];
|
|
207
|
+
const preferredContentType = content.find((c) => c.contentType === "application/json")?.contentType ?? content.find((c) => c.contentType.includes("json"))?.contentType ?? content[0]?.contentType;
|
|
208
|
+
const preferredSchema = preferredContentType ? rb.schemasByContentType[preferredContentType] : undefined;
|
|
209
|
+
return {
|
|
210
|
+
required: rb.required,
|
|
211
|
+
content,
|
|
212
|
+
hasJson,
|
|
213
|
+
hasFormUrlEncoded,
|
|
214
|
+
hasMultipart,
|
|
215
|
+
bodyFlags,
|
|
216
|
+
preferredContentType,
|
|
217
|
+
preferredSchema: isJsonSchema(preferredSchema) ? preferredSchema : undefined
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// src/cli/command-model.ts
|
|
222
|
+
function buildCommandModel(planned, options) {
|
|
223
|
+
const byResource = new Map;
|
|
224
|
+
for (const op of planned) {
|
|
225
|
+
const list = byResource.get(op.resource) ?? [];
|
|
226
|
+
const params = deriveParamSpecs(op);
|
|
227
|
+
const positionals = derivePositionals({ pathArgs: op.pathArgs, params });
|
|
228
|
+
const flags = deriveFlags({ pathArgs: op.pathArgs, params });
|
|
229
|
+
list.push({
|
|
230
|
+
id: buildCommandId({
|
|
231
|
+
specId: options.specId,
|
|
232
|
+
resource: op.resource,
|
|
233
|
+
action: op.action,
|
|
234
|
+
operationKey: op.key
|
|
235
|
+
}),
|
|
236
|
+
key: op.key,
|
|
237
|
+
action: op.action,
|
|
238
|
+
pathArgs: op.pathArgs,
|
|
239
|
+
method: op.method,
|
|
240
|
+
path: op.path,
|
|
241
|
+
operationId: op.operationId,
|
|
242
|
+
tags: op.tags,
|
|
243
|
+
summary: op.summary,
|
|
244
|
+
description: op.description,
|
|
245
|
+
deprecated: op.deprecated,
|
|
246
|
+
style: op.style,
|
|
247
|
+
params,
|
|
248
|
+
positionals,
|
|
249
|
+
flags: flags.flags,
|
|
250
|
+
auth: summarizeAuth(op.security, options.globalSecurity, options.authSchemes ?? []),
|
|
251
|
+
requestBody: deriveRequestBodyInfo(op),
|
|
252
|
+
requestBodySchema: deriveRequestBodyInfo(op)?.preferredSchema
|
|
253
|
+
});
|
|
254
|
+
byResource.set(op.resource, list);
|
|
255
|
+
}
|
|
256
|
+
const resources = [];
|
|
257
|
+
for (const [resource, actions] of byResource.entries()) {
|
|
258
|
+
actions.sort((a, b) => {
|
|
259
|
+
if (a.action !== b.action)
|
|
260
|
+
return a.action.localeCompare(b.action);
|
|
261
|
+
if (a.path !== b.path)
|
|
262
|
+
return a.path.localeCompare(b.path);
|
|
263
|
+
return a.method.localeCompare(b.method);
|
|
264
|
+
});
|
|
265
|
+
resources.push({ resource, actions });
|
|
266
|
+
}
|
|
267
|
+
resources.sort((a, b) => a.resource.localeCompare(b.resource));
|
|
268
|
+
return { resources };
|
|
269
|
+
}
|
|
270
|
+
export {
|
|
271
|
+
buildCommandModel
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
//# debugId=45780225ADBA9F6E64756E2164756E21
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/cli/auth-requirements.ts", "../../../src/cli/strings.ts", "../../../src/cli/command-id.ts", "../../../src/cli/schema-shape.ts", "../../../src/cli/params.ts", "../../../src/cli/positional.ts", "../../../src/cli/types.ts", "../../../src/cli/request-body.ts", "../../../src/cli/command-model.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import type { AuthScheme } from \"./auth-schemes.ts\";\nimport type { SecurityRequirement } from \"./types.ts\";\n\nexport type AuthRequirement = {\n\tkey: string;\n\tscopes: string[];\n};\n\nexport type AuthSummary = {\n\t// Alternatives: any one of these sets is sufficient.\n\talternatives: AuthRequirement[][];\n};\n\nfunction isSecurityRequirement(value: unknown): value is SecurityRequirement {\n\tif (!value || typeof value !== \"object\") return false;\n\tif (Array.isArray(value)) return false;\n\n\tfor (const [k, v] of Object.entries(value)) {\n\t\tif (typeof k !== \"string\") return false;\n\t\tif (!Array.isArray(v)) return false;\n\t\tif (!v.every((s) => typeof s === \"string\")) return false;\n\t}\n\n\treturn true;\n}\n\nfunction normalizeSecurity(value: unknown): {\n\trequirements: SecurityRequirement[];\n\tsource: \"none\" | \"empty\" | \"non-empty\";\n} {\n\tif (value == null) return { requirements: [], source: \"none\" };\n\tif (!Array.isArray(value)) return { requirements: [], source: \"none\" };\n\n\tconst reqs = value.filter(isSecurityRequirement);\n\tif (reqs.length === 0) return { requirements: [], source: \"empty\" };\n\treturn { requirements: reqs, source: \"non-empty\" };\n}\n\nexport function summarizeAuth(\n\toperationSecurity: unknown,\n\tglobalSecurity: unknown,\n\tknownSchemes: AuthScheme[],\n): AuthSummary {\n\t// Per spec:\n\t// - operation security overrides root\n\t// - empty array [] means \"no auth\"\n\tconst op = normalizeSecurity(operationSecurity);\n\tif (op.source === \"non-empty\") {\n\t\treturn { alternatives: toAlternatives(op.requirements, knownSchemes) };\n\t}\n\tif (op.source === \"empty\") {\n\t\treturn { alternatives: [] };\n\t}\n\n\tconst global = normalizeSecurity(globalSecurity);\n\tif (global.source === \"non-empty\") {\n\t\treturn { alternatives: toAlternatives(global.requirements, knownSchemes) };\n\t}\n\n\treturn { alternatives: [] };\n}\n\nfunction toAlternatives(\n\trequirements: SecurityRequirement[],\n\tknownSchemes: AuthScheme[],\n): AuthRequirement[][] {\n\tconst known = new Set(knownSchemes.map((s) => s.key));\n\n\treturn requirements.map((req) => {\n\t\tconst out: AuthRequirement[] = [];\n\t\tfor (const [key, scopes] of Object.entries(req)) {\n\t\t\tout.push({\n\t\t\t\tkey,\n\t\t\t\tscopes: Array.isArray(scopes) ? scopes : [],\n\t\t\t});\n\t\t}\n\n\t\t// Stable order.\n\t\tout.sort((a, b) => a.key.localeCompare(b.key));\n\n\t\t// Prefer known schemes first.\n\t\tout.sort((a, b) => {\n\t\t\tconst ak = known.has(a.key) ? 0 : 1;\n\t\t\tconst bk = known.has(b.key) ? 0 : 1;\n\t\t\tif (ak !== bk) return ak - bk;\n\t\t\treturn a.key.localeCompare(b.key);\n\t\t});\n\n\t\treturn out;\n\t});\n}\n",
|
|
6
|
+
"export function kebabCase(input: string): string {\n\tconst trimmed = input.trim();\n\tif (!trimmed) return \"\";\n\n\t// Convert spaces/underscores/dots to dashes, split camelCase.\n\treturn trimmed\n\t\t.replace(/([a-z0-9])([A-Z])/g, \"$1-$2\")\n\t\t.replace(/[\\s_.:/]+/g, \"-\")\n\t\t.replace(/[^a-zA-Z0-9-]/g, \"-\")\n\t\t.replace(/-+/g, \"-\")\n\t\t.replace(/^-|-$/g, \"\")\n\t\t.toLowerCase();\n}\n\nexport function titleCase(input: string): string {\n\treturn input\n\t\t.split(/\\s+/g)\n\t\t.filter(Boolean)\n\t\t.map((w) => w[0]?.toUpperCase() + w.slice(1))\n\t\t.join(\" \");\n}\n",
|
|
7
|
+
"import { kebabCase } from \"./strings.ts\";\n\nexport type CommandIdParts = {\n\tspecId: string;\n\tresource: string;\n\taction: string;\n\toperationKey: string;\n};\n\nexport function buildCommandId(parts: CommandIdParts): string {\n\t// operationKey is the ultimate disambiguator, but we keep the id readable.\n\t// Example:\n\t// contacts-api:contacts:get:GET-/contacts/{id}\n\tconst op = kebabCase(parts.operationKey.replace(/\\s+/g, \"-\"));\n\treturn `${parts.specId}:${kebabCase(parts.resource)}:${kebabCase(parts.action)}:${op}`;\n}\n",
|
|
8
|
+
"export type ParamType =\n\t| \"string\"\n\t| \"number\"\n\t| \"integer\"\n\t| \"boolean\"\n\t| \"array\"\n\t| \"object\"\n\t| \"unknown\";\n\nexport function getSchemaType(schema: unknown): ParamType {\n\tif (!schema || typeof schema !== \"object\") return \"unknown\";\n\tconst t = (schema as { type?: unknown }).type;\n\tif (t === \"string\") return \"string\";\n\tif (t === \"number\") return \"number\";\n\tif (t === \"integer\") return \"integer\";\n\tif (t === \"boolean\") return \"boolean\";\n\tif (t === \"array\") return \"array\";\n\tif (t === \"object\") return \"object\";\n\treturn \"unknown\";\n}\n\nexport function getSchemaFormat(schema: unknown): string | undefined {\n\tif (!schema || typeof schema !== \"object\") return undefined;\n\tconst f = (schema as { format?: unknown }).format;\n\treturn typeof f === \"string\" ? f : undefined;\n}\n\nexport function getSchemaEnumStrings(schema: unknown): string[] | undefined {\n\tif (!schema || typeof schema !== \"object\") return undefined;\n\tconst e = (schema as { enum?: unknown }).enum;\n\tif (!Array.isArray(e)) return undefined;\n\n\t// We only surface string enums for now (enough for flag docs + completion).\n\tconst values = e.filter((v) => typeof v === \"string\") as string[];\n\treturn values.length ? values : undefined;\n}\n",
|
|
9
|
+
"import {\n\tgetSchemaEnumStrings,\n\tgetSchemaFormat,\n\tgetSchemaType,\n} from \"./schema-shape.ts\";\nimport { kebabCase } from \"./strings.ts\";\nimport type { NormalizedOperation, NormalizedParameter } from \"./types.ts\";\n\nexport type ParamType = import(\"./schema-shape.ts\").ParamType;\n\nexport type ParamSpec = {\n\tkind: \"positional\" | \"flag\";\n\tin: NormalizedParameter[\"in\"];\n\tname: string;\n\tflag: string;\n\trequired: boolean;\n\tdescription?: string;\n\ttype: ParamType;\n\tformat?: string;\n\tenum?: string[];\n\n\t// Arrays\n\titemType?: ParamType;\n\titemFormat?: string;\n\titemEnum?: string[];\n\n\t// Original schema for Ajv validation and future advanced flag expansion.\n\tschema?: import(\"./types.ts\").JsonSchema;\n};\n\nexport function deriveParamSpecs(op: NormalizedOperation): ParamSpec[] {\n\tconst out: ParamSpec[] = [];\n\n\tfor (const p of op.parameters) {\n\t\tconst flag = `--${kebabCase(p.name)}`;\n\t\tconst type = getSchemaType(p.schema);\n\t\tconst schemaObj =\n\t\t\tp.schema && typeof p.schema === \"object\"\n\t\t\t\t? (p.schema as import(\"./types.ts\").JsonSchema)\n\t\t\t\t: undefined;\n\n\t\tconst itemsSchema =\n\t\t\tschemaObj && type === \"array\" && typeof schemaObj.items === \"object\"\n\t\t\t\t? (schemaObj.items as unknown)\n\t\t\t\t: undefined;\n\n\t\tout.push({\n\t\t\tkind: p.in === \"path\" ? \"positional\" : \"flag\",\n\t\t\tin: p.in,\n\t\t\tname: p.name,\n\t\t\tflag,\n\t\t\trequired: p.required,\n\t\t\tdescription: p.description,\n\t\t\ttype,\n\t\t\tformat: getSchemaFormat(p.schema),\n\t\t\tenum: getSchemaEnumStrings(p.schema),\n\t\t\titemType: type === \"array\" ? getSchemaType(itemsSchema) : undefined,\n\t\t\titemFormat: type === \"array\" ? getSchemaFormat(itemsSchema) : undefined,\n\t\t\titemEnum:\n\t\t\t\ttype === \"array\" ? getSchemaEnumStrings(itemsSchema) : undefined,\n\t\t\tschema: schemaObj,\n\t\t});\n\t}\n\n\tout.sort((a, b) => {\n\t\tif (a.in !== b.in) return a.in.localeCompare(b.in);\n\t\treturn a.name.localeCompare(b.name);\n\t});\n\n\treturn out;\n}\n",
|
|
10
|
+
"import type { ParamSpec } from \"./params.ts\";\n\nexport type ActionShapeForCli = {\n\tpathArgs: string[];\n\tparams: ParamSpec[];\n};\n\nexport type PositionalArg = {\n\tname: string;\n\trequired: boolean;\n\tdescription?: string;\n\ttype: import(\"./schema-shape.ts\").ParamType;\n\tformat?: string;\n\tenum?: string[];\n};\n\nexport type FlagsIndex = {\n\tflags: Array<\n\t\tPick<\n\t\t\timport(\"./params.ts\").ParamSpec,\n\t\t\t| \"in\"\n\t\t\t| \"name\"\n\t\t\t| \"flag\"\n\t\t\t| \"required\"\n\t\t\t| \"description\"\n\t\t\t| \"type\"\n\t\t\t| \"format\"\n\t\t\t| \"enum\"\n\t\t\t| \"itemType\"\n\t\t\t| \"itemFormat\"\n\t\t\t| \"itemEnum\"\n\t\t>\n\t>;\n};\n\nexport function derivePositionals(action: ActionShapeForCli): PositionalArg[] {\n\tconst byName = new Map<string, PositionalArg>();\n\n\t// Use pathArgs order; match metadata from params when available.\n\tfor (const name of action.pathArgs) {\n\t\tconst p = action.params.find(\n\t\t\t(x: ParamSpec) => x.in === \"path\" && x.name === name,\n\t\t);\n\t\tbyName.set(name, {\n\t\t\tname,\n\t\t\trequired: true,\n\t\t\tdescription: p?.description,\n\t\t\ttype: p?.type ?? \"unknown\",\n\t\t\tformat: p?.format,\n\t\t\tenum: p?.enum,\n\t\t});\n\t}\n\n\treturn [...byName.values()];\n}\n\nexport function deriveFlags(action: ActionShapeForCli): FlagsIndex {\n\treturn {\n\t\tflags: action.params\n\t\t\t.filter((p: ParamSpec) => p.kind === \"flag\")\n\t\t\t.map((p: ParamSpec) => ({\n\t\t\t\tin: p.in,\n\t\t\t\tname: p.name,\n\t\t\t\tflag: p.flag,\n\t\t\t\trequired: p.required,\n\t\t\t\tdescription: p.description,\n\t\t\t\ttype: p.type,\n\t\t\t\tformat: p.format,\n\t\t\t\tenum: p.enum,\n\t\t\t\titemType: p.itemType,\n\t\t\t\titemFormat: p.itemFormat,\n\t\t\t\titemEnum: p.itemEnum,\n\t\t\t})),\n\t};\n}\n",
|
|
11
|
+
"export type SpecSource = \"embedded\" | \"file\" | \"url\";\n\nexport type SecurityRequirement = Record<string, string[]>;\n\nexport type OpenApiDoc = {\n\topenapi: string;\n\tinfo?: {\n\t\ttitle?: string;\n\t\tversion?: string;\n\t};\n\tservers?: Array<{ url: string; description?: string; variables?: unknown }>;\n\tsecurity?: SecurityRequirement[];\n\tcomponents?: {\n\t\tsecuritySchemes?: Record<string, unknown>;\n\t};\n\tpaths?: Record<string, unknown>;\n};\n\nexport type NormalizedParameter = {\n\tin: \"path\" | \"query\" | \"header\" | \"cookie\";\n\tname: string;\n\trequired: boolean;\n\tdescription?: string;\n\tschema?: unknown;\n};\n\n// Minimal JSON Schema-like shape for validation and flag expansion.\nexport type JsonSchema = Record<string, unknown>;\n\nexport function isJsonSchema(value: unknown): value is JsonSchema {\n\treturn Boolean(value) && typeof value === \"object\" && !Array.isArray(value);\n}\n\nexport type NormalizedRequestBody = {\n\trequired: boolean;\n\tcontentTypes: string[];\n\tschemasByContentType: Record<string, unknown | undefined>;\n};\n\nexport type NormalizedOperation = {\n\tkey: string;\n\tmethod: string;\n\tpath: string;\n\toperationId?: string;\n\ttags: string[];\n\tsummary?: string;\n\tdescription?: string;\n\tdeprecated?: boolean;\n\tsecurity?: SecurityRequirement[];\n\tparameters: NormalizedParameter[];\n\trequestBody?: NormalizedRequestBody;\n};\n\nexport type LoadedSpec = {\n\tsource: SpecSource;\n\tid: string;\n\tfingerprint: string;\n\tdoc: OpenApiDoc;\n};\n",
|
|
12
|
+
"import {\n\tgetSchemaEnumStrings,\n\tgetSchemaFormat,\n\tgetSchemaType,\n} from \"./schema-shape.ts\";\nimport type {\n\tJsonSchema,\n\tNormalizedOperation,\n\tNormalizedRequestBody,\n} from \"./types.ts\";\nimport { isJsonSchema } from \"./types.ts\";\n\nexport type RequestBodyContent = {\n\tcontentType: string;\n\trequired: boolean;\n\tschemaType: import(\"./schema-shape.ts\").ParamType;\n\tschemaFormat?: string;\n\tschemaEnum?: string[];\n};\n\nexport type RequestBodyInfo = {\n\trequired: boolean;\n\tcontent: RequestBodyContent[];\n\t// Convenience flags for later arg generation.\n\thasJson: boolean;\n\thasFormUrlEncoded: boolean;\n\thasMultipart: boolean;\n\n\t// Phase 1 planning: supported generic body inputs.\n\tbodyFlags: string[];\n\tpreferredContentType?: string;\n\n\t// Original JSON Schema (for expanded flags + validation)\n\tpreferredSchema?: JsonSchema;\n};\n\nfunction getRequestBody(\n\top: NormalizedOperation,\n): NormalizedRequestBody | undefined {\n\treturn op.requestBody;\n}\n\nexport function deriveRequestBodyInfo(\n\top: NormalizedOperation,\n): RequestBodyInfo | undefined {\n\tconst rb = getRequestBody(op);\n\tif (!rb) return undefined;\n\n\tconst content: RequestBodyContent[] = [];\n\tfor (const contentType of rb.contentTypes) {\n\t\tconst schema = rb.schemasByContentType[contentType];\n\t\tcontent.push({\n\t\t\tcontentType,\n\t\t\trequired: rb.required,\n\t\t\tschemaType: getSchemaType(schema),\n\t\t\tschemaFormat: getSchemaFormat(schema),\n\t\t\tschemaEnum: getSchemaEnumStrings(schema),\n\t\t});\n\t}\n\n\tcontent.sort((a, b) => a.contentType.localeCompare(b.contentType));\n\n\tconst hasJson = content.some((c) => c.contentType.includes(\"json\"));\n\tconst hasFormUrlEncoded = content.some(\n\t\t(c) => c.contentType === \"application/x-www-form-urlencoded\",\n\t);\n\tconst hasMultipart = content.some((c) =>\n\t\tc.contentType.startsWith(\"multipart/\"),\n\t);\n\n\tconst bodyFlags = [\"--data\", \"--file\"]; // always available when requestBody exists\n\n\tconst preferredContentType =\n\t\tcontent.find((c) => c.contentType === \"application/json\")?.contentType ??\n\t\tcontent.find((c) => c.contentType.includes(\"json\"))?.contentType ??\n\t\tcontent[0]?.contentType;\n\n\tconst preferredSchema = preferredContentType\n\t\t? rb.schemasByContentType[preferredContentType]\n\t\t: undefined;\n\n\treturn {\n\t\trequired: rb.required,\n\t\tcontent,\n\t\thasJson,\n\t\thasFormUrlEncoded,\n\t\thasMultipart,\n\t\tbodyFlags,\n\t\tpreferredContentType,\n\t\tpreferredSchema: isJsonSchema(preferredSchema)\n\t\t\t? preferredSchema\n\t\t\t: undefined,\n\t};\n}\n",
|
|
13
|
+
"import type { AuthSummary } from \"./auth-requirements.ts\";\nimport { summarizeAuth } from \"./auth-requirements.ts\";\nimport type { AuthScheme } from \"./auth-schemes.ts\";\nimport { buildCommandId } from \"./command-id.ts\";\nimport type { PlannedOperation } from \"./naming.ts\";\nimport type { ParamSpec } from \"./params.ts\";\nimport { deriveParamSpecs } from \"./params.ts\";\nimport { deriveFlags, derivePositionals } from \"./positional.ts\";\nimport type { RequestBodyInfo } from \"./request-body.ts\";\nimport { deriveRequestBodyInfo } from \"./request-body.ts\";\nimport type { SecurityRequirement } from \"./types.ts\";\n\nexport type CommandAction = {\n\tid: string;\n\tkey: string;\n\taction: string;\n\t// Derived path arguments. These become positionals later.\n\tpathArgs: string[];\n\tmethod: string;\n\tpath: string;\n\toperationId?: string;\n\ttags: string[];\n\tsummary?: string;\n\tdescription?: string;\n\tdeprecated?: boolean;\n\tstyle: PlannedOperation[\"style\"];\n\n\t// Derived CLI shape (Phase 1 output; Phase 2 will wire these into commander)\n\tpositionals: Array<import(\"./positional.ts\").PositionalArg>;\n\tflags: Array<\n\t\tPick<\n\t\t\timport(\"./params.ts\").ParamSpec,\n\t\t\t| \"in\"\n\t\t\t| \"name\"\n\t\t\t| \"flag\"\n\t\t\t| \"required\"\n\t\t\t| \"description\"\n\t\t\t| \"type\"\n\t\t\t| \"format\"\n\t\t\t| \"enum\"\n\t\t\t| \"itemType\"\n\t\t\t| \"itemFormat\"\n\t\t\t| \"itemEnum\"\n\t\t>\n\t>;\n\n\t// Full raw params list (useful for debugging and future features)\n\tparams: ParamSpec[];\n\n\tauth: AuthSummary;\n\trequestBody?: RequestBodyInfo;\n\trequestBodySchema?: import(\"./types.ts\").JsonSchema;\n};\n\nexport type CommandResource = {\n\tresource: string;\n\tactions: CommandAction[];\n};\n\nexport type CommandModel = {\n\tresources: CommandResource[];\n};\n\nexport type BuildCommandModelOptions = {\n\tspecId: string;\n\tglobalSecurity?: SecurityRequirement[];\n\tauthSchemes?: AuthScheme[];\n};\n\nexport function buildCommandModel(\n\tplanned: PlannedOperation[],\n\toptions: BuildCommandModelOptions,\n): CommandModel {\n\tconst byResource = new Map<string, CommandAction[]>();\n\n\tfor (const op of planned) {\n\t\tconst list = byResource.get(op.resource) ?? [];\n\t\tconst params = deriveParamSpecs(op);\n\t\tconst positionals = derivePositionals({ pathArgs: op.pathArgs, params });\n\t\tconst flags = deriveFlags({ pathArgs: op.pathArgs, params });\n\n\t\tlist.push({\n\t\t\tid: buildCommandId({\n\t\t\t\tspecId: options.specId,\n\t\t\t\tresource: op.resource,\n\t\t\t\taction: op.action,\n\t\t\t\toperationKey: op.key,\n\t\t\t}),\n\t\t\tkey: op.key,\n\t\t\taction: op.action,\n\t\t\tpathArgs: op.pathArgs,\n\t\t\tmethod: op.method,\n\t\t\tpath: op.path,\n\t\t\toperationId: op.operationId,\n\t\t\ttags: op.tags,\n\t\t\tsummary: op.summary,\n\t\t\tdescription: op.description,\n\t\t\tdeprecated: op.deprecated,\n\t\t\tstyle: op.style,\n\t\t\tparams,\n\t\t\tpositionals,\n\t\t\tflags: flags.flags,\n\t\t\tauth: summarizeAuth(\n\t\t\t\top.security,\n\t\t\t\toptions.globalSecurity,\n\t\t\t\toptions.authSchemes ?? [],\n\t\t\t),\n\t\t\trequestBody: deriveRequestBodyInfo(op),\n\t\t\trequestBodySchema: deriveRequestBodyInfo(op)?.preferredSchema,\n\t\t});\n\t\tbyResource.set(op.resource, list);\n\t}\n\n\tconst resources: CommandResource[] = [];\n\n\tfor (const [resource, actions] of byResource.entries()) {\n\t\tactions.sort((a, b) => {\n\t\t\tif (a.action !== b.action) return a.action.localeCompare(b.action);\n\t\t\tif (a.path !== b.path) return a.path.localeCompare(b.path);\n\t\t\treturn a.method.localeCompare(b.method);\n\t\t});\n\t\tresources.push({ resource, actions });\n\t}\n\n\tresources.sort((a, b) => a.resource.localeCompare(b.resource));\n\n\treturn { resources };\n}\n"
|
|
14
|
+
],
|
|
15
|
+
"mappings": ";AAaA,SAAS,qBAAqB,CAAC,OAA8C;AAAA,EAC5E,IAAI,C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,MAAM,cACL,GAAG,UACH,QAAQ,gBACR,QAAQ,eAAe,CAAC,CACzB;AAAA,MACA,aAAa,sBAAsB,EAAE;AAAA,MACrC,mBAAmB,sBAAsB,EAAE,GAAG;AAAA,IAC/C,CAAC;AAAA,IACD,WAAW,IAAI,GAAG,UAAU,IAAI;AAAA,EACjC;AAAA,EAEA,MAAM,YAA+B,CAAC;AAAA,EAEtC,YAAY,UAAU,YAAY,WAAW,QAAQ,GAAG;AAAA,IACvD,QAAQ,KAAK,CAAC,GAAG,MAAM;AAAA,MACtB,IAAI,EAAE,WAAW,EAAE;AAAA,QAAQ,OAAO,EAAE,OAAO,cAAc,EAAE,MAAM;AAAA,MACjE,IAAI,EAAE,SAAS,EAAE;AAAA,QAAM,OAAO,EAAE,KAAK,cAAc,EAAE,IAAI;AAAA,MACzD,OAAO,EAAE,OAAO,cAAc,EAAE,MAAM;AAAA,KACtC;AAAA,IACD,UAAU,KAAK,EAAE,UAAU,QAAQ,CAAC;AAAA,EACrC;AAAA,EAEA,UAAU,KAAK,CAAC,GAAG,MAAM,EAAE,SAAS,cAAc,EAAE,QAAQ,CAAC;AAAA,EAE7D,OAAO,EAAE,UAAU;AAAA;",
|
|
16
|
+
"debugId": "45780225ADBA9F6E64756E2164756E21",
|
|
17
|
+
"names": []
|
|
18
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type CompileOptions = {
|
|
2
|
+
name?: string;
|
|
3
|
+
outfile?: string;
|
|
4
|
+
target?: string;
|
|
5
|
+
minify?: boolean;
|
|
6
|
+
bytecode?: boolean;
|
|
7
|
+
dotenv?: boolean;
|
|
8
|
+
bunfig?: boolean;
|
|
9
|
+
define?: string[];
|
|
10
|
+
server?: string;
|
|
11
|
+
serverVar?: string[];
|
|
12
|
+
auth?: string;
|
|
13
|
+
};
|
|
14
|
+
export declare function compileCommand(spec: string, options: CompileOptions): Promise<void>;
|
|
15
|
+
//# sourceMappingURL=compile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../../src/cli/compile.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,cAAc,GAAG;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAYF,wBAAsB,cAAc,CACnC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,cAAc,GACrB,OAAO,CAAC,IAAI,CAAC,CAuEf"}
|