@sdk-it/typescript 0.39.0 → 0.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +169 -59
- package/dist/index.js.map +3 -3
- package/dist/lib/client.d.ts.map +1 -1
- package/dist/lib/emitters/zod.d.ts.map +1 -1
- package/dist/lib/generate.d.ts +3 -1
- package/dist/lib/generate.d.ts.map +1 -1
- package/dist/lib/generator.d.ts.map +1 -1
- package/dist/lib/options.d.ts +1 -0
- package/dist/lib/options.d.ts.map +1 -1
- package/dist/lib/sdk.d.ts +1 -1
- package/dist/lib/sdk.d.ts.map +1 -1
- package/dist/lib/server-urls.d.ts +3 -0
- package/dist/lib/server-urls.d.ts.map +1 -0
- package/dist/lib/status-map.d.ts.map +1 -1
- package/dist/lib/typescript-snippet.d.ts.map +1 -1
- package/package.json +4 -4
- package/dist/connect.d.ts +0 -1
- package/dist/connect.d.ts.map +0 -1
- package/dist/global.d.js +0 -1
- package/dist/global.d.js.map +0 -7
- package/dist/lib/connect.d.ts +0 -162
- package/dist/lib/connect.d.ts.map +0 -1
- package/dist/lib/readme-generator.d.ts +0 -8
- package/dist/lib/readme-generator.d.ts.map +0 -1
- package/dist/lib/statusMap.d.ts +0 -2
- package/dist/lib/statusMap.d.ts.map +0 -1
- package/dist/lib/utils.d.ts +0 -17
- package/dist/lib/utils.d.ts.map +0 -1
- package/dist/lib/watcher.d.ts +0 -2
- package/dist/lib/watcher.d.ts.map +0 -1
- package/dist/src/index.js +0 -5
- package/dist/src/index.js.map +0 -7
- package/dist/src/lib/agent/ai-sdk.js +0 -60
- package/dist/src/lib/agent/ai-sdk.js.map +0 -7
- package/dist/src/lib/agent/openai-agents.js +0 -42
- package/dist/src/lib/agent/openai-agents.js.map +0 -7
- package/dist/src/lib/client.js +0 -152
- package/dist/src/lib/client.js.map +0 -7
- package/dist/src/lib/emitters/interface.js +0 -169
- package/dist/src/lib/emitters/interface.js.map +0 -7
- package/dist/src/lib/emitters/snippet.js +0 -191
- package/dist/src/lib/emitters/snippet.js.map +0 -7
- package/dist/src/lib/emitters/zod.js +0 -271
- package/dist/src/lib/emitters/zod.js.map +0 -7
- package/dist/src/lib/generate.js +0 -382
- package/dist/src/lib/generate.js.map +0 -7
- package/dist/src/lib/generator.js +0 -268
- package/dist/src/lib/generator.js.map +0 -7
- package/dist/src/lib/import-utilities.js +0 -56
- package/dist/src/lib/import-utilities.js.map +0 -7
- package/dist/src/lib/options.js +0 -3
- package/dist/src/lib/options.js.map +0 -7
- package/dist/src/lib/readme/prop.emitter.js +0 -283
- package/dist/src/lib/readme/prop.emitter.js.map +0 -7
- package/dist/src/lib/readme/readme.js +0 -105
- package/dist/src/lib/readme/readme.js.map +0 -7
- package/dist/src/lib/sdk.js +0 -236
- package/dist/src/lib/sdk.js.map +0 -7
- package/dist/src/lib/status-map.js +0 -28
- package/dist/src/lib/status-map.js.map +0 -7
- package/dist/src/lib/style.js +0 -1
- package/dist/src/lib/style.js.map +0 -7
- package/dist/src/lib/typescript-snippet.js +0 -738
- package/dist/src/lib/typescript-snippet.js.map +0 -7
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/lib/readme/prop.emitter.ts"],
|
|
4
|
-
"sourcesContent": ["import type {\n OpenAPIObject,\n ReferenceObject,\n RequestBodyObject,\n SchemaObject,\n} from 'openapi3-ts/oas31';\n\nimport { followRef, isRef } from '@sdk-it/core';\nimport { coerceTypes } from '@sdk-it/spec';\n\n/**\n * PropEmitter handles converting OpenAPI schemas to Markdown documentation\n */\nexport class PropEmitter {\n #spec: OpenAPIObject;\n\n constructor(spec: OpenAPIObject) {\n this.#spec = spec;\n }\n\n /**\n * Handle objects (properties)\n */\n #object(schema: SchemaObject): string[] {\n const lines: string[] = [];\n const properties = schema.properties || {};\n\n if (Object.keys(properties).length > 0) {\n lines.push(`**Properties:**`);\n\n for (const [propName, propSchema] of Object.entries(properties)) {\n const isRequired = (schema.required ?? []).includes(propName);\n lines.push(...this.#property(propName, propSchema, isRequired));\n }\n }\n\n // Handle additionalProperties\n if (schema.additionalProperties) {\n lines.push(`**Additional Properties:**`);\n if (typeof schema.additionalProperties === 'boolean') {\n lines.push(`- Allowed: ${schema.additionalProperties}`);\n } else {\n // Indent the schema documentation for additional properties\n lines.push(\n ...this.handle(schema.additionalProperties).map((l) => ` ${l}`),\n );\n }\n }\n\n return lines;\n }\n\n /**\n * Format a property with its type and description\n */\n #property(\n name: string,\n schema: SchemaObject | ReferenceObject,\n required: boolean,\n ): string[] {\n // get full docs and extract the type line\n const docs = this.handle(schema);\n const rawType = docs[0]\n .replace('**Type:** ', '')\n .replace(' (nullable)', '|null');\n\n // detect default if present on the schema\n const defaultVal =\n !isRef(schema) && (schema as SchemaObject).default !== undefined\n ? ` default: ${JSON.stringify((schema as SchemaObject).default)}`\n : '';\n\n // build summary line\n const reqMark = required ? ' required' : '';\n const summary = `- \\`${name}\\` ${rawType}${reqMark}${defaultVal}:`;\n\n // assemble final lines (skip the type and any default in details)\n const detailLines = docs\n .slice(1)\n .filter((it) => !it.startsWith('**Default:**'))\n .map((it) => ` ${it}`);\n\n return [summary, ...detailLines];\n }\n\n /**\n * Handle array schemas\n */\n #array(schema: SchemaObject): string[] {\n const lines: string[] = [];\n lines.push(`**Array items:**`);\n\n if (schema.items) {\n // Get documentation for the items schema\n const itemDocs = this.handle(schema.items);\n // Indent item documentation\n lines.push(...itemDocs.map((line) => ` ${line}`));\n } else {\n lines.push(` **Type:** \\`unknown\\``); // Array of unknown items\n }\n // Add array constraints\n if (schema.minItems !== undefined)\n lines.push(`- Minimum items: ${schema.minItems}`);\n if (schema.maxItems !== undefined)\n lines.push(`- Maximum items: ${schema.maxItems}`);\n if (schema.uniqueItems) lines.push(`- Items must be unique.`);\n\n return lines;\n }\n\n #ref($ref: string): string[] {\n const schemaName = $ref.split('/').pop() || 'object';\n const resolved = followRef<SchemaObject>(this.#spec, $ref);\n // Link to the schema definition (assuming heading anchors are generated elsewhere)\n const lines = [\n `**Type:** [\\`${schemaName}\\`](#${schemaName.toLowerCase()})`,\n ];\n if (resolved.description) {\n lines.push(resolved.description);\n }\n // Avoid deep recursion by default, just link and show description.\n // If more detail is needed, the linked definition should provide it.\n return lines;\n }\n\n #allOf(schemas: (SchemaObject | ReferenceObject)[]): string[] {\n const lines = ['**All of (Intersection):**'];\n schemas.forEach((subSchema, index) => {\n lines.push(`- **Constraint ${index + 1}:**`);\n const subLines = this.handle(subSchema);\n lines.push(...subLines.map((l) => ` ${l}`)); // Indent sub-schema docs\n });\n return lines;\n }\n\n #anyOf(schemas: (SchemaObject | ReferenceObject)[]): string[] {\n const lines = ['**Any of (Union):**'];\n schemas.forEach((subSchema, index) => {\n lines.push(`- **Option ${index + 1}:**`);\n const subLines = this.handle(subSchema);\n lines.push(...subLines.map((l) => ` ${l}`));\n });\n return lines;\n }\n\n #oneOf(schemas: (SchemaObject | ReferenceObject)[]): string[] {\n const lines = ['**One of (Exclusive Union):**'];\n schemas.forEach((subSchema, index) => {\n lines.push(`- **Option ${index + 1}:**`);\n const subLines = this.handle(subSchema);\n lines.push(...subLines.map((l) => ` ${l}`));\n });\n return lines;\n }\n\n #enum(schema: SchemaObject): string[] {\n const lines = [`**Type:** \\`${schema.type || 'unknown'}\\` (enum)`];\n if (schema.description) lines.push(schema.description);\n lines.push('**Allowed values:**');\n lines.push(\n ...(schema.enum || []).map((val) => `- \\`${JSON.stringify(val)}\\``),\n );\n if (schema.default !== undefined) {\n lines.push(`**Default:** \\`${JSON.stringify(schema.default)}\\``);\n }\n return lines;\n }\n\n #normal(type: string, schema: SchemaObject, nullable: boolean): string[] {\n const lines: string[] = [];\n const nullableSuffix = nullable ? ' (nullable)' : '';\n const description = schema.description ? [schema.description] : [];\n\n switch (type) {\n case 'string':\n lines.push(\n `**Type:** \\`string\\`${schema.format ? ` (format: ${schema.format})` : ''}${nullableSuffix}`,\n );\n lines.push(...description);\n if (schema.minLength !== undefined)\n lines.push(`- Minimum length: ${schema.minLength}`);\n if (schema.maxLength !== undefined)\n lines.push(`- Maximum length: ${schema.maxLength}`);\n if (schema.pattern !== undefined)\n lines.push(`- Pattern: \\`${schema.pattern}\\``);\n break;\n case 'number':\n case 'integer':\n lines.push(\n `**Type:** \\`${type}\\`${schema.format ? ` (format: ${schema.format})` : ''}${nullableSuffix}`,\n );\n lines.push(...description);\n // Add number constraints (OpenAPI 3.1)\n if (schema.minimum !== undefined) {\n // Check if exclusiveMinimum is a number (OAS 3.1)\n const exclusiveMin = typeof schema.exclusiveMinimum === 'number';\n lines.push(\n `- Minimum: ${schema.minimum}${exclusiveMin ? ' (exclusive)' : ''}`,\n );\n if (exclusiveMin) {\n lines.push(\n `- Must be strictly greater than: ${schema.exclusiveMinimum}`,\n );\n }\n } else if (typeof schema.exclusiveMinimum === 'number') {\n lines.push(\n `- Must be strictly greater than: ${schema.exclusiveMinimum}`,\n );\n }\n\n if (schema.maximum !== undefined) {\n // Check if exclusiveMaximum is a number (OAS 3.1)\n const exclusiveMax = typeof schema.exclusiveMaximum === 'number';\n lines.push(\n `- Maximum: ${schema.maximum}${exclusiveMax ? ' (exclusive)' : ''}`,\n );\n if (exclusiveMax) {\n lines.push(\n `- Must be strictly less than: ${schema.exclusiveMaximum}`,\n );\n }\n } else if (typeof schema.exclusiveMaximum === 'number') {\n lines.push(\n `- Must be strictly less than: ${schema.exclusiveMaximum}`,\n );\n }\n if (schema.multipleOf !== undefined)\n lines.push(`- Must be a multiple of: ${schema.multipleOf}`);\n break;\n case 'boolean':\n lines.push(`**Type:** \\`boolean\\`${nullableSuffix}`);\n lines.push(...description);\n break;\n case 'object':\n lines.push(`**Type:** \\`object\\`${nullableSuffix}`);\n lines.push(...description);\n lines.push(...this.#object(schema));\n break;\n case 'array':\n lines.push(`**Type:** \\`array\\`${nullableSuffix}`);\n lines.push(...description);\n lines.push(...this.#array(schema));\n break;\n case 'null':\n lines.push(`**Type:** \\`null\\``);\n lines.push(...description);\n break;\n default:\n lines.push(`**Type:** \\`${type}\\`${nullableSuffix}`);\n lines.push(...description);\n }\n if (schema.default !== undefined) {\n lines.push(`**Default:** \\`${JSON.stringify(schema.default)}\\``);\n }\n return lines.filter((l) => l); // Filter out empty description lines\n }\n\n /**\n * Handle schemas by resolving references and delegating to appropriate handler\n */\n public handle(schemaOrRef: SchemaObject | ReferenceObject): string[] {\n if (isRef(schemaOrRef)) {\n return this.#ref(schemaOrRef.$ref);\n }\n\n const schema = schemaOrRef;\n\n if (schema.allOf && Array.isArray(schema.allOf)) {\n return this.#allOf(schema.allOf);\n }\n if (schema.anyOf && Array.isArray(schema.anyOf)) {\n return this.#anyOf(schema.anyOf);\n }\n if (schema.oneOf && Array.isArray(schema.oneOf)) {\n return this.#oneOf(schema.oneOf);\n }\n\n if (schema.enum && Array.isArray(schema.enum)) {\n return this.#enum(schema);\n }\n\n let types = coerceTypes(schema);\n let nullable = false; // Default to false\n\n if (types.includes('null')) {\n nullable = true;\n types = types.filter((t) => t !== 'null');\n }\n\n if (types.length === 0) {\n if (schema.properties || schema.additionalProperties) {\n types = ['object'];\n } else if (schema.items) {\n types = ['array'];\n }\n }\n\n if (types.length === 0) {\n const lines = ['**Type:** `unknown`'];\n if (schema.description) lines.push(schema.description);\n if (schema.default !== undefined)\n lines.push(`**Default:** \\`${JSON.stringify(schema.default)}\\``);\n return lines;\n }\n\n // Handle single type (potentially nullable)\n if (types.length === 1) {\n return this.#normal(types[0], schema, nullable);\n }\n\n // Handle union of multiple non-null types (potentially nullable overall)\n const typeString = types.join(' | ');\n const nullableSuffix = nullable ? ' (nullable)' : '';\n const lines = [`**Type:** \\`${typeString}\\`${nullableSuffix}`];\n if (schema.description) lines.push(schema.description);\n if (schema.default !== undefined)\n lines.push(`**Default:** \\`${JSON.stringify(schema.default)}\\``);\n return lines;\n }\n\n /**\n * Process a request body and return markdown documentation\n */\n requestBody(requestBody: RequestBodyObject): string[] {\n const lines: string[] = [];\n lines.push(`#### Input`);\n lines.push(requestBody.description || '');\n\n const contentEntries = Object.entries(requestBody.content);\n const multipleContentTypes = contentEntries.length > 1;\n if (multipleContentTypes) {\n // Use collapsible toggles\n for (const [contentType, mediaType] of contentEntries) {\n lines.push(`<details>`);\n lines.push(`<summary>Content Type: \\`${contentType}\\`</summary>`);\n lines.push('');\n\n if (mediaType.schema) {\n const schemaDocs = this.handle(mediaType.schema);\n lines.push(...schemaDocs.map((l) => l));\n }\n\n lines.push('');\n lines.push(`</details>`);\n }\n } else {\n // Single content type - show inline\n const [contentType, mediaType] = contentEntries[0];\n lines.push(`Content Type: \\`${contentType}\\``);\n\n if (mediaType.schema) {\n const schemaDocs = this.handle(mediaType.schema);\n lines.push(...schemaDocs);\n }\n }\n\n return lines;\n }\n}\n"],
|
|
5
|
-
"mappings": "AAOA,SAAS,WAAW,aAAa;AACjC,SAAS,mBAAmB;AAKrB,MAAM,YAAY;AAAA,EACvB;AAAA,EAEA,YAAY,MAAqB;AAC/B,SAAK,QAAQ;AAAA,EACf;AAAA;AAAA;AAAA;AAAA,EAKA,QAAQ,QAAgC;AACtC,UAAM,QAAkB,CAAC;AACzB,UAAM,aAAa,OAAO,cAAc,CAAC;AAEzC,QAAI,OAAO,KAAK,UAAU,EAAE,SAAS,GAAG;AACtC,YAAM,KAAK,iBAAiB;AAE5B,iBAAW,CAAC,UAAU,UAAU,KAAK,OAAO,QAAQ,UAAU,GAAG;AAC/D,cAAM,cAAc,OAAO,YAAY,CAAC,GAAG,SAAS,QAAQ;AAC5D,cAAM,KAAK,GAAG,KAAK,UAAU,UAAU,YAAY,UAAU,CAAC;AAAA,MAChE;AAAA,IACF;AAGA,QAAI,OAAO,sBAAsB;AAC/B,YAAM,KAAK,4BAA4B;AACvC,UAAI,OAAO,OAAO,yBAAyB,WAAW;AACpD,cAAM,KAAK,cAAc,OAAO,oBAAoB,EAAE;AAAA,MACxD,OAAO;AAEL,cAAM;AAAA,UACJ,GAAG,KAAK,OAAO,OAAO,oBAAoB,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{ forEachOperation } from "@sdk-it/spec";
|
|
3
|
-
import { PropEmitter } from "./prop.emitter.ts";
|
|
4
|
-
function toReadme(spec, generator) {
|
|
5
|
-
const propEmitter = new PropEmitter(spec);
|
|
6
|
-
const markdown = [];
|
|
7
|
-
markdown.push(`# ${spec.info.title} TypeScript SDK`);
|
|
8
|
-
markdown.push("");
|
|
9
|
-
markdown.push(
|
|
10
|
-
"A fully-typed TypeScript SDK with comprehensive IntelliSense support, automatic request/response validation, and modern async/await patterns. Built for seamless integration with TypeScript and JavaScript projects. Each endpoint includes a brief description, example usage, and details about request and response formats."
|
|
11
|
-
);
|
|
12
|
-
markdown.push("");
|
|
13
|
-
markdown.push(generator.clientSetupDocs());
|
|
14
|
-
markdown.push("");
|
|
15
|
-
const securitySchemes = spec.components?.securitySchemes || {};
|
|
16
|
-
if (Object.keys(securitySchemes).length > 0) {
|
|
17
|
-
markdown.push(generator.authenticationDocs());
|
|
18
|
-
markdown.push("");
|
|
19
|
-
}
|
|
20
|
-
const paginationDocs = generator.paginationDocs();
|
|
21
|
-
if (paginationDocs) {
|
|
22
|
-
markdown.push(paginationDocs);
|
|
23
|
-
markdown.push("");
|
|
24
|
-
}
|
|
25
|
-
markdown.push(generator.errorHandlingDocs());
|
|
26
|
-
markdown.push("");
|
|
27
|
-
markdown.push(generator.generalUsageDocs());
|
|
28
|
-
markdown.push("");
|
|
29
|
-
markdown.push("## API Reference");
|
|
30
|
-
markdown.push("");
|
|
31
|
-
forEachOperation(spec, (entry, operation) => {
|
|
32
|
-
const { method, path } = entry;
|
|
33
|
-
markdown.push(
|
|
34
|
-
`### ${operation["x-fn-name"]} | ${`_${method.toUpperCase()} ${path}_`}`
|
|
35
|
-
);
|
|
36
|
-
markdown.push(operation.summary || "");
|
|
37
|
-
const snippet = generator.snippet(entry, operation);
|
|
38
|
-
markdown.push(`#### Example usage`);
|
|
39
|
-
markdown.push(snippet);
|
|
40
|
-
const requestBodyContent = propEmitter.requestBody(operation.requestBody);
|
|
41
|
-
if (requestBodyContent.length > 1) {
|
|
42
|
-
markdown.push(requestBodyContent.join("\n\n"));
|
|
43
|
-
}
|
|
44
|
-
markdown.push(`#### Output`);
|
|
45
|
-
for (const status in operation.responses) {
|
|
46
|
-
const response = operation.responses[status];
|
|
47
|
-
if (!isEmpty(response.content)) {
|
|
48
|
-
const contentEntries = Object.entries(response.content);
|
|
49
|
-
if (contentEntries.length === 1) {
|
|
50
|
-
const [contentType, mediaType] = contentEntries[0];
|
|
51
|
-
markdown.push(`**${status}** - ${response.description}`);
|
|
52
|
-
markdown.push(`
|
|
53
|
-
**Content Type:** \`${contentType}\``);
|
|
54
|
-
if (mediaType.schema) {
|
|
55
|
-
const schemaDocs = propEmitter.handle(mediaType.schema);
|
|
56
|
-
markdown.push(...schemaDocs);
|
|
57
|
-
}
|
|
58
|
-
} else {
|
|
59
|
-
markdown.push(`<details>`);
|
|
60
|
-
markdown.push(
|
|
61
|
-
`<summary><b>${status}</b> <i>${response.description}</i></summary>`
|
|
62
|
-
);
|
|
63
|
-
for (const [contentType, mediaType] of contentEntries) {
|
|
64
|
-
markdown.push(`
|
|
65
|
-
**Content Type:** \`${contentType}\``);
|
|
66
|
-
if (mediaType.schema) {
|
|
67
|
-
const schemaDocs = propEmitter.handle(mediaType.schema);
|
|
68
|
-
markdown.push(...schemaDocs.map((l) => `
|
|
69
|
-
${l}`));
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
markdown.push(`</details>`);
|
|
73
|
-
}
|
|
74
|
-
} else {
|
|
75
|
-
markdown.push(`**${status}** - ${response.description}`);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
if (spec.components?.schemas) {
|
|
80
|
-
markdown.push("## Schemas");
|
|
81
|
-
markdown.push("");
|
|
82
|
-
for (const [schemaName, schema] of Object.entries(
|
|
83
|
-
spec.components.schemas
|
|
84
|
-
)) {
|
|
85
|
-
if (schemaName === "ValidationError") {
|
|
86
|
-
continue;
|
|
87
|
-
}
|
|
88
|
-
markdown.push(`<details>`);
|
|
89
|
-
markdown.push(
|
|
90
|
-
`<summary><h3 id="${schemaName.toLowerCase()}">${schemaName}</h3></summary>`
|
|
91
|
-
);
|
|
92
|
-
markdown.push("");
|
|
93
|
-
const schemaDocs = propEmitter.handle(schema);
|
|
94
|
-
markdown.push(...schemaDocs.map((line) => line.trim()));
|
|
95
|
-
markdown.push("");
|
|
96
|
-
markdown.push(`</details>`);
|
|
97
|
-
markdown.push("");
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
return markdown.join("\n\n");
|
|
101
|
-
}
|
|
102
|
-
export {
|
|
103
|
-
toReadme
|
|
104
|
-
};
|
|
105
|
-
//# sourceMappingURL=readme.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/lib/readme/readme.ts"],
|
|
4
|
-
"sourcesContent": ["import { isEmpty } from '@sdk-it/core';\nimport type { Generator } from '@sdk-it/readme';\nimport { type IR, forEachOperation } from '@sdk-it/spec';\n\nimport { PropEmitter } from './prop.emitter.ts';\n\nexport function toReadme(spec: IR, generator: Generator) {\n const propEmitter = new PropEmitter(spec);\n const markdown: string[] = [];\n\n // Add TypeScript SDK heading and description\n markdown.push(`# ${spec.info.title} TypeScript SDK`);\n markdown.push('');\n markdown.push(\n 'A fully-typed TypeScript SDK with comprehensive IntelliSense support, automatic request/response validation, and modern async/await patterns. Built for seamless integration with TypeScript and JavaScript projects. Each endpoint includes a brief description, example usage, and details about request and response formats.',\n );\n\n markdown.push('');\n\n markdown.push(generator.clientSetupDocs());\n markdown.push('');\n\n // Add authentication docs if there are security schemes\n const securitySchemes = spec.components?.securitySchemes || {};\n if (Object.keys(securitySchemes).length > 0) {\n markdown.push(generator.authenticationDocs());\n markdown.push('');\n }\n\n // Add pagination docs if any operations have pagination\n const paginationDocs = generator.paginationDocs();\n if (paginationDocs) {\n markdown.push(paginationDocs);\n markdown.push('');\n }\n\n // Add error handling docs\n markdown.push(generator.errorHandlingDocs());\n markdown.push('');\n\n // Add general usage docs\n markdown.push(generator.generalUsageDocs());\n markdown.push('');\n\n markdown.push('## API Reference');\n markdown.push('');\n\n forEachOperation(spec, (entry, operation) => {\n const { method, path } = entry;\n markdown.push(\n `### ${operation['x-fn-name']} | ${`_${method.toUpperCase()} ${path}_`}`,\n );\n markdown.push(operation.summary || '');\n\n const snippet = generator.snippet(entry, operation);\n markdown.push(`#### Example usage`);\n markdown.push(snippet);\n\n const requestBodyContent = propEmitter.requestBody(operation.requestBody);\n if (requestBodyContent.length > 1) {\n // Check if more than just the header was added\n markdown.push(requestBodyContent.join('\\n\\n'));\n }\n\n markdown.push(`#### Output`);\n for (const status in operation.responses) {\n const response = operation.responses[status];\n\n if (!isEmpty(response.content)) {\n const contentEntries = Object.entries(response.content);\n\n if (contentEntries.length === 1) {\n const [contentType, mediaType] = contentEntries[0];\n markdown.push(`**${status}** - ${response.description}`);\n markdown.push(`\\n**Content Type:** \\`${contentType}\\``);\n\n if (mediaType.schema) {\n const schemaDocs = propEmitter.handle(mediaType.schema);\n markdown.push(...schemaDocs);\n }\n } else {\n // Multiple content types - use collapsible toggle for the entire response\n markdown.push(`<details>`);\n markdown.push(\n `<summary><b>${status}</b> <i>${response.description}</i></summary>`,\n );\n\n for (const [contentType, mediaType] of contentEntries) {\n markdown.push(`\\n**Content Type:** \\`${contentType}\\``);\n if (mediaType.schema) {\n const schemaDocs = propEmitter.handle(mediaType.schema);\n markdown.push(...schemaDocs.map((l) => `\\n${l}`));\n }\n }\n\n markdown.push(`</details>`);\n }\n } else {\n // No content - just show status and description\n markdown.push(`**${status}** - ${response.description}`);\n }\n }\n }); // Add schemas section at the bottom\n if (spec.components?.schemas) {\n markdown.push('## Schemas');\n markdown.push('');\n\n for (const [schemaName, schema] of Object.entries(\n spec.components.schemas,\n )) {\n // Include all schemas except ValidationError which is internal\n if (schemaName === 'ValidationError') {\n continue;\n }\n\n markdown.push(`<details>`);\n markdown.push(\n `<summary><h3 id=\"${schemaName.toLowerCase()}\">${schemaName}</h3></summary>`,\n );\n markdown.push('');\n\n const schemaDocs = propEmitter.handle(schema);\n markdown.push(...schemaDocs.map((line) => line.trim()));\n\n markdown.push('');\n markdown.push(`</details>`);\n markdown.push('');\n }\n }\n\n // Generate Table of Contents\n\n return markdown.join('\\n\\n');\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,eAAe;AAExB,SAAkB,wBAAwB;AAE1C,SAAS,mBAAmB;AAErB,SAAS,SAAS,MAAU,WAAsB;AACvD,QAAM,cAAc,IAAI,YAAY,IAAI;AACxC,QAAM,WAAqB,CAAC;AAG5B,WAAS,KAAK,KAAK,KAAK,KAAK,KAAK,iBAAiB;AACnD,WAAS,KAAK,EAAE;AAChB,WAAS;AAAA,IACP;AAAA,EACF;AAEA,WAAS,KAAK,EAAE;AAEhB,WAAS,KAAK,UAAU,gBAAgB,CAAC;AACzC,WAAS,KAAK,EAAE;AAGhB,QAAM,kBAAkB,KAAK,YAAY,mBAAmB,CAAC;AAC7D,MAAI,OAAO,KAAK,eAAe,EAAE,SAAS,GAAG;AAC3C,aAAS,KAAK,UAAU,mBAAmB,CAAC;AAC5C,aAAS,KAAK,EAAE;AAAA,EAClB;AAGA,QAAM,iBAAiB,UAAU,eAAe;AAChD,MAAI,gBAAgB;AAClB,aAAS,KAAK,cAAc;AAC5B,aAAS,KAAK,EAAE;AAAA,EAClB;AAGA,WAAS,KAAK,UAAU,kBAAkB,CAAC;AAC3C,WAAS,KAAK,EAAE;AAGhB,WAAS,KAAK,UAAU,iBAAiB,CAAC;AAC1C,WAAS,KAAK,EAAE;AAEhB,WAAS,KAAK,kBAAkB;AAChC,WAAS,KAAK,EAAE;AAEhB,mBAAiB,MAAM,CAAC,OAAO,cAAc;AAC3C,UAAM,EAAE,QAAQ,KAAK,IAAI;AACzB,aAAS;AAAA,MACP,OAAO,UAAU,WAAW,CAAC,MAAM,IAAI,OAAO,YAAY,CAA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AAM,QAAQ,SAAS,WAAW,EAAE;AAAA,MACzD;AAAA,IACF;AAAA,EACF,CAAC;AACD,MAAI,KAAK,YAAY,SAAS;AAC5B,aAAS,KAAK,YAAY;AAC1B,aAAS,KAAK,EAAE;AAEhB,eAAW,CAAC,YAAY,MAAM,KAAK,OAAO;AAAA,MACxC,KAAK,WAAW;AAAA,IAClB,GAAG;AAED,UAAI,eAAe,mBAAmB;AACpC;AAAA,MACF;AAEA,eAAS,KAAK,WAAW;AACzB,eAAS;AAAA,QACP,oBAAoB,WAAW,YAAY,CAAC,KAAK,UAAU;AAAA,MAC7D;AACA,eAAS,KAAK,EAAE;AAEhB,YAAM,aAAa,YAAY,OAAO,MAAM;AAC5C,eAAS,KAAK,GAAG,WAAW,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC,CAAC;AAEtD,eAAS,KAAK,EAAE;AAChB,eAAS,KAAK,YAAY;AAC1B,eAAS,KAAK,EAAE;AAAA,IAClB;AAAA,EACF;AAIA,SAAO,SAAS,KAAK,MAAM;AAC7B;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/dist/src/lib/sdk.js
DELETED
|
@@ -1,236 +0,0 @@
|
|
|
1
|
-
import { camelcase } from "stringcase";
|
|
2
|
-
import { isEmpty, pascalcase } from "@sdk-it/core";
|
|
3
|
-
import {
|
|
4
|
-
isStreamingContentType,
|
|
5
|
-
isTextContentType,
|
|
6
|
-
parseJsonContentType,
|
|
7
|
-
sanitizeTag
|
|
8
|
-
} from "@sdk-it/spec";
|
|
9
|
-
import { TypeScriptEmitter } from "./emitters/interface.ts";
|
|
10
|
-
import {} from "./import-utilities.ts";
|
|
11
|
-
import statusMap from "./status-map.ts";
|
|
12
|
-
function toEndpoint(groupName, spec, specOperation, operation, utils) {
|
|
13
|
-
const schemaName = camelcase(`${specOperation.operationId} schema`);
|
|
14
|
-
const schemaRef = `${camelcase(groupName)}.${schemaName}`;
|
|
15
|
-
const schemas = [];
|
|
16
|
-
specOperation.responses ??= {};
|
|
17
|
-
const outputs = Object.keys(specOperation.responses).flatMap(
|
|
18
|
-
(status) => toHttpOutput(
|
|
19
|
-
spec,
|
|
20
|
-
specOperation.operationId,
|
|
21
|
-
status,
|
|
22
|
-
specOperation.responses[status]
|
|
23
|
-
)
|
|
24
|
-
);
|
|
25
|
-
const addTypeParser = Object.keys(operation.schemas).length > 1;
|
|
26
|
-
for (const type in operation.schemas ?? {}) {
|
|
27
|
-
let typePrefix = "";
|
|
28
|
-
if (addTypeParser && type !== "json") {
|
|
29
|
-
typePrefix = `${type} `;
|
|
30
|
-
}
|
|
31
|
-
const paths = inputToPath(specOperation, operation.inputs);
|
|
32
|
-
const endpoint = `${typePrefix}${operation.method.toUpperCase()} ${operation.path}`;
|
|
33
|
-
schemas.push(
|
|
34
|
-
`"${endpoint}": {
|
|
35
|
-
schema: ${schemaRef}${addTypeParser ? `.${type}` : ""},
|
|
36
|
-
output:[${outputs.join(",")}],
|
|
37
|
-
toRequest(input: z.input<typeof ${schemaRef}${addTypeParser ? `.${type}` : ""}>) {
|
|
38
|
-
return toRequest('${endpoint}', ${operation.outgoingContentType || "empty"}(input, {
|
|
39
|
-
inputHeaders: [${paths.inputHeaders}],
|
|
40
|
-
inputQuery: [${paths.inputQuery}],
|
|
41
|
-
inputBody: [${paths.inputBody}],
|
|
42
|
-
inputParams: [${paths.inputParams}],
|
|
43
|
-
}));},
|
|
44
|
-
async dispatch(input: z.input<typeof ${schemaRef}${addTypeParser ? `.${type}` : ""}>,options: {
|
|
45
|
-
signal?: AbortSignal;
|
|
46
|
-
interceptors: Interceptor[];
|
|
47
|
-
fetch: z.infer<typeof fetchType>;
|
|
48
|
-
})${specOperation["x-pagination"] ? paginationOperation(specOperation, utils.style) : normalOperation(utils.style)}`
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
return { schemas };
|
|
52
|
-
}
|
|
53
|
-
function normalOperation(style) {
|
|
54
|
-
return `{
|
|
55
|
-
const dispatcher = new Dispatcher(options.interceptors, options.fetch);
|
|
56
|
-
const result = await dispatcher.send(this.toRequest(input), this.output, options?.signal);
|
|
57
|
-
return ${style?.outputType === "status" ? "result" : style?.errorAsValue ? `result` : "result.data;"}
|
|
58
|
-
},
|
|
59
|
-
}`;
|
|
60
|
-
}
|
|
61
|
-
function paginationOperation(operation, style) {
|
|
62
|
-
const pagination = operation["x-pagination"];
|
|
63
|
-
const data = `${style?.errorAsValue ? `result[0]${style.outputType === "status" ? "" : ""}` : `${style?.outputType === "default" ? "result.data" : "result.data"}`}`;
|
|
64
|
-
const returnValue = `${style?.errorAsValue ? `[${style?.outputType === "status" ? "new http.Ok(pagination)" : "pagination"}, null]` : `${style?.outputType === "status" ? "new http.Ok(pagination);" : "pagination"}`}`;
|
|
65
|
-
if (pagination.type === "offset") {
|
|
66
|
-
const sameInputNames = pagination.limitParamName === "limit" && pagination.offsetParamName === "offset";
|
|
67
|
-
const initialParams = sameInputNames ? "input" : `{...input, limit: input.${pagination.limitParamName}, offset: input.${pagination.offsetParamName}}`;
|
|
68
|
-
const nextPageParams = sameInputNames ? "...nextPageParams" : `${pagination.offsetParamName}: nextPageParams.offset, ${pagination.limitParamName}: nextPageParams.limit`;
|
|
69
|
-
const logic = `const pagination = new OffsetPagination(${initialParams}, async (nextPageParams) => {
|
|
70
|
-
const dispatcher = new Dispatcher(options.interceptors, options.fetch);
|
|
71
|
-
const result = await dispatcher.send(
|
|
72
|
-
this.toRequest({...input, ${nextPageParams}}),
|
|
73
|
-
this.output,
|
|
74
|
-
);
|
|
75
|
-
return {
|
|
76
|
-
data: ${data}.${pagination.items},
|
|
77
|
-
meta: {
|
|
78
|
-
hasMore: Boolean(${data}.${pagination.hasMore}),
|
|
79
|
-
},
|
|
80
|
-
};
|
|
81
|
-
});
|
|
82
|
-
await pagination.getNextPage();
|
|
83
|
-
return ${returnValue}
|
|
84
|
-
`;
|
|
85
|
-
return style?.errorAsValue ? `{try {${logic}} catch (error) {return [null as never, error] as const;}}}` : `{${logic}}}`;
|
|
86
|
-
}
|
|
87
|
-
if (pagination.type === "cursor") {
|
|
88
|
-
const sameInputNames = pagination.cursorParamName === "cursor";
|
|
89
|
-
const initialParams = sameInputNames ? "input" : `{...input, cursor: input.${pagination.cursorParamName}}`;
|
|
90
|
-
const nextPageParams = sameInputNames ? "...nextPageParams" : `${pagination.cursorParamName}: nextPageParams.cursor`;
|
|
91
|
-
const logic = `
|
|
92
|
-
const pagination = new CursorPagination(${initialParams}, async (nextPageParams) => {
|
|
93
|
-
const dispatcher = new Dispatcher(options.interceptors, options.fetch);
|
|
94
|
-
const result = await dispatcher.send(
|
|
95
|
-
this.toRequest({...input, ${nextPageParams}}),
|
|
96
|
-
this.output,
|
|
97
|
-
);
|
|
98
|
-
${style?.errorAsValue ? `if (result[1]) {throw result[1];}` : ""}
|
|
99
|
-
return {
|
|
100
|
-
data: ${data}.${pagination.items},
|
|
101
|
-
meta: {
|
|
102
|
-
hasMore: Boolean(${data}.${pagination.hasMore}),
|
|
103
|
-
},
|
|
104
|
-
};
|
|
105
|
-
});
|
|
106
|
-
await pagination.getNextPage();
|
|
107
|
-
return ${returnValue}
|
|
108
|
-
`;
|
|
109
|
-
return style?.errorAsValue ? `{try {${logic}} catch (error) {return [null as never, error] as const;}}}` : `{${logic}}}`;
|
|
110
|
-
}
|
|
111
|
-
if (pagination.type === "page") {
|
|
112
|
-
const sameInputNames = pagination.pageNumberParamName === "page" && pagination.pageSizeParamName === "pageSize";
|
|
113
|
-
const initialParams = sameInputNames ? "input" : `{...input, page: input.${pagination.pageNumberParamName}, pageSize: input.${pagination.pageSizeParamName}}`;
|
|
114
|
-
const nextPageParams = sameInputNames ? "...nextPageParams" : `${pagination.pageNumberParamName}: nextPageParams.page, ${pagination.pageSizeParamName}: nextPageParams.pageSize`;
|
|
115
|
-
const logic = `
|
|
116
|
-
const pagination = new Pagination(${initialParams}, async (nextPageParams) => {
|
|
117
|
-
const dispatcher = new Dispatcher(options.interceptors, options.fetch);
|
|
118
|
-
const result = await dispatcher.send(
|
|
119
|
-
this.toRequest({...input, ${nextPageParams}}),
|
|
120
|
-
this.output,
|
|
121
|
-
);
|
|
122
|
-
${style?.errorAsValue ? `if (result[1]) {throw result[1];}` : ""}
|
|
123
|
-
return {
|
|
124
|
-
data: ${data}.${pagination.items},
|
|
125
|
-
meta: {
|
|
126
|
-
hasMore: Boolean(${data}.${pagination.hasMore}),
|
|
127
|
-
},
|
|
128
|
-
};
|
|
129
|
-
});
|
|
130
|
-
await pagination.getNextPage();
|
|
131
|
-
return ${returnValue}
|
|
132
|
-
`;
|
|
133
|
-
return style?.errorAsValue ? `{try {${logic}} catch (error) {return [null as never, error] as const;}}}` : `{${logic}}}`;
|
|
134
|
-
}
|
|
135
|
-
return normalOperation(style);
|
|
136
|
-
}
|
|
137
|
-
function toHttpOutput(spec, operationName, status, response, withGenerics = true) {
|
|
138
|
-
const typeScriptDeserialzer = new TypeScriptEmitter(spec);
|
|
139
|
-
const interfaceName = pascalcase(sanitizeTag(response["x-response-name"]));
|
|
140
|
-
if (!isEmpty(response.content)) {
|
|
141
|
-
const contentTypeResult = fromContentType(
|
|
142
|
-
spec,
|
|
143
|
-
typeScriptDeserialzer,
|
|
144
|
-
response
|
|
145
|
-
);
|
|
146
|
-
if (!contentTypeResult) {
|
|
147
|
-
throw new Error(
|
|
148
|
-
`No recognizable content type for response ${status} in operation ${operationName}`
|
|
149
|
-
);
|
|
150
|
-
}
|
|
151
|
-
const parser = contentTypeResult.parser || "buffered";
|
|
152
|
-
const outputs = [];
|
|
153
|
-
const statusName = `http.${statusMap[status] || "APIResponse"}`;
|
|
154
|
-
const statusCode = +status;
|
|
155
|
-
if (statusCode === 204) {
|
|
156
|
-
outputs.push(statusName);
|
|
157
|
-
} else {
|
|
158
|
-
const generic = withGenerics ? `<outputs.${interfaceName}>` : "";
|
|
159
|
-
if (status.endsWith("XX")) {
|
|
160
|
-
outputs.push(`http.APIError${generic}`);
|
|
161
|
-
} else {
|
|
162
|
-
if (parser !== "buffered") {
|
|
163
|
-
outputs.push(`{type: ${statusName}${generic}, parser: ${parser}}`);
|
|
164
|
-
} else {
|
|
165
|
-
outputs.push(`${statusName}${generic}`);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
return outputs;
|
|
170
|
-
}
|
|
171
|
-
return [];
|
|
172
|
-
}
|
|
173
|
-
function fromContentType(spec, typeScriptDeserialzer, response) {
|
|
174
|
-
if ((response.headers ?? {})["Transfer-Encoding"]) {
|
|
175
|
-
return streamedOutput();
|
|
176
|
-
}
|
|
177
|
-
for (const type in response.content) {
|
|
178
|
-
if (isStreamingContentType(type)) {
|
|
179
|
-
return streamedOutput();
|
|
180
|
-
}
|
|
181
|
-
if (parseJsonContentType(type)) {
|
|
182
|
-
return {
|
|
183
|
-
parser: "buffered",
|
|
184
|
-
responseSchema: response.content[type].schema ? typeScriptDeserialzer.handle(response.content[type].schema, true) : "void"
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
if (isTextContentType(type)) {
|
|
188
|
-
return {
|
|
189
|
-
parser: "buffered",
|
|
190
|
-
responseSchema: response.content[type].schema ? typeScriptDeserialzer.handle(response.content[type].schema, true) : "void"
|
|
191
|
-
};
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
return streamedOutput();
|
|
195
|
-
}
|
|
196
|
-
function streamedOutput() {
|
|
197
|
-
return {
|
|
198
|
-
parser: "chunked",
|
|
199
|
-
responseSchema: "ReadableStream"
|
|
200
|
-
};
|
|
201
|
-
}
|
|
202
|
-
function inputToPath(operation, inputs) {
|
|
203
|
-
const inputHeaders = [];
|
|
204
|
-
const inputQuery = [];
|
|
205
|
-
const inputBody = [];
|
|
206
|
-
const inputParams = [];
|
|
207
|
-
for (const [name, prop] of Object.entries(inputs)) {
|
|
208
|
-
if (prop.in === "headers" || prop.in === "header") {
|
|
209
|
-
inputHeaders.push(`"${name}"`);
|
|
210
|
-
} else if (prop.in === "query") {
|
|
211
|
-
inputQuery.push(`"${name}"`);
|
|
212
|
-
} else if (prop.in === "body") {
|
|
213
|
-
inputBody.push(`"${name}"`);
|
|
214
|
-
} else if (prop.in === "path") {
|
|
215
|
-
inputParams.push(`"${name}"`);
|
|
216
|
-
} else {
|
|
217
|
-
throw new Error(
|
|
218
|
-
`Unknown source ${prop.in} in ${name} ${JSON.stringify(
|
|
219
|
-
prop
|
|
220
|
-
)} in ${operation.operationId}`
|
|
221
|
-
);
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
return {
|
|
225
|
-
inputHeaders,
|
|
226
|
-
inputQuery,
|
|
227
|
-
inputBody,
|
|
228
|
-
inputParams
|
|
229
|
-
};
|
|
230
|
-
}
|
|
231
|
-
export {
|
|
232
|
-
inputToPath,
|
|
233
|
-
toEndpoint,
|
|
234
|
-
toHttpOutput
|
|
235
|
-
};
|
|
236
|
-
//# sourceMappingURL=sdk.js.map
|
package/dist/src/lib/sdk.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/lib/sdk.ts"],
|
|
4
|
-
"sourcesContent": ["import type { OpenAPIObject, ResponseObject } from 'openapi3-ts/oas31';\nimport { camelcase } from 'stringcase';\n\nimport { isEmpty, pascalcase } from '@sdk-it/core';\nimport {\n type IR,\n type OperationPagination,\n type OurParameter,\n type TunedOperationObject,\n isStreamingContentType,\n isTextContentType,\n parseJsonContentType,\n sanitizeTag,\n} from '@sdk-it/spec';\n\nimport { TypeScriptEmitter } from './emitters/interface.ts';\nimport { type MakeImportFn } from './import-utilities.ts';\nimport statusMap from './status-map.ts';\nimport type { Style } from './style.ts';\n\nexport type Parser = 'chunked' | 'buffered';\n\nexport interface SdkConfig {\n /**\n * The name of the sdk client\n */\n name: string;\n packageName?: string;\n options?: Record<string, unknown>;\n emptyBodyAsNull?: boolean;\n stripBodyFromGetAndHead?: boolean;\n output: string;\n}\n\nexport interface Spec {\n name: string;\n options: OurParameter[];\n servers: string[];\n operations: Record<string, Operation[]>;\n makeImport: MakeImportFn;\n}\n\nexport interface OperationInput {\n in: string;\n schema: string;\n}\nexport interface Operation {\n method: string;\n path: string;\n operationId: string;\n schemas: Record<string, string>;\n inputs: Record<string, OperationInput>;\n outgoingContentType?: string;\n}\n\nexport function toEndpoint(\n groupName: string,\n spec: IR,\n specOperation: TunedOperationObject,\n operation: Operation,\n utils: {\n makeImport: MakeImportFn;\n style?: Style;\n },\n) {\n const schemaName = camelcase(`${specOperation.operationId} schema`);\n const schemaRef = `${camelcase(groupName)}.${schemaName}`;\n\n const schemas: string[] = [];\n specOperation.responses ??= {};\n const outputs = Object.keys(specOperation.responses).flatMap((status) =>\n toHttpOutput(\n spec,\n specOperation.operationId,\n status,\n specOperation.responses[status],\n ),\n );\n\n const addTypeParser = Object.keys(operation.schemas).length > 1;\n for (const type in operation.schemas ?? {}) {\n let typePrefix = '';\n if (addTypeParser && type !== 'json') {\n typePrefix = `${type} `;\n }\n const paths = inputToPath(specOperation, operation.inputs);\n const endpoint = `${typePrefix}${operation.method.toUpperCase()} ${operation.path}`;\n schemas.push(\n `\"${endpoint}\": {\n schema: ${schemaRef}${addTypeParser ? `.${type}` : ''},\n output:[${outputs.join(',')}],\n toRequest(input: z.input<typeof ${schemaRef}${addTypeParser ? `.${type}` : ''}>) {\n return toRequest('${endpoint}', ${operation.outgoingContentType || 'empty'}(input, {\n inputHeaders: [${paths.inputHeaders}],\n inputQuery: [${paths.inputQuery}],\n inputBody: [${paths.inputBody}],\n inputParams: [${paths.inputParams}],\n }));},\n async dispatch(input: z.input<typeof ${schemaRef}${addTypeParser ? `.${type}` : ''}>,options: {\n signal?: AbortSignal;\n interceptors: Interceptor[];\n fetch: z.infer<typeof fetchType>;\n })${specOperation['x-pagination'] ? paginationOperation(specOperation, utils.style) : normalOperation(utils.style)}`,\n );\n }\n return { schemas };\n}\n\nfunction normalOperation(style?: Style) {\n return `{\n const dispatcher = new Dispatcher(options.interceptors, options.fetch);\n const result = await dispatcher.send(this.toRequest(input), this.output, options?.signal);\n return ${style?.outputType === 'status' ? 'result' : style?.errorAsValue ? `result` : 'result.data;'}\n },\n }`;\n}\n\nfunction paginationOperation(operation: TunedOperationObject, style?: Style) {\n const pagination = operation['x-pagination'] as OperationPagination;\n const data = `${style?.errorAsValue ? `result[0]${style.outputType === 'status' ? '' : ''}` : `${style?.outputType === 'default' ? 'result.data' : 'result.data'}`}`;\n const returnValue = `${style?.errorAsValue ? `[${style?.outputType === 'status' ? 'new http.Ok(pagination)' : 'pagination'}, null]` : `${style?.outputType === 'status' ? 'new http.Ok(pagination);' : 'pagination'}`}`;\n if (pagination.type === 'offset') {\n const sameInputNames =\n pagination.limitParamName === 'limit' &&\n pagination.offsetParamName === 'offset';\n const initialParams = sameInputNames\n ? 'input'\n : `{...input, limit: input.${pagination.limitParamName}, offset: input.${pagination.offsetParamName}}`;\n\n const nextPageParams = sameInputNames\n ? '...nextPageParams'\n : `${pagination.offsetParamName}: nextPageParams.offset, ${pagination.limitParamName}: nextPageParams.limit`;\n const logic = `const pagination = new OffsetPagination(${initialParams}, async (nextPageParams) => {\n const dispatcher = new Dispatcher(options.interceptors, options.fetch);\n const result = await dispatcher.send(\n this.toRequest({...input, ${nextPageParams}}),\n this.output,\n );\n return {\n data: ${data}.${pagination.items},\n meta: {\n hasMore: Boolean(${data}.${pagination.hasMore}),\n },\n };\n });\n await pagination.getNextPage();\n return ${returnValue}\n `;\n return style?.errorAsValue\n ? `{try {${logic}} catch (error) {return [null as never, error] as const;}}}`\n : `{${logic}}}`;\n }\n if (pagination.type === 'cursor') {\n const sameInputNames = pagination.cursorParamName === 'cursor';\n const initialParams = sameInputNames\n ? 'input'\n : `{...input, cursor: input.${pagination.cursorParamName}}`;\n\n const nextPageParams = sameInputNames\n ? '...nextPageParams'\n : `${pagination.cursorParamName}: nextPageParams.cursor`;\n const logic = `\n const pagination = new CursorPagination(${initialParams}, async (nextPageParams) => {\n const dispatcher = new Dispatcher(options.interceptors, options.fetch);\n const result = await dispatcher.send(\n this.toRequest({...input, ${nextPageParams}}),\n this.output,\n );\n ${style?.errorAsValue ? `if (result[1]) {throw result[1];}` : ''}\n return {\n data: ${data}.${pagination.items},\n meta: {\n hasMore: Boolean(${data}.${pagination.hasMore}),\n },\n };\n });\n await pagination.getNextPage();\n return ${returnValue}\n `;\n return style?.errorAsValue\n ? `{try {${logic}} catch (error) {return [null as never, error] as const;}}}`\n : `{${logic}}}`;\n }\n if (pagination.type === 'page') {\n const sameInputNames =\n pagination.pageNumberParamName === 'page' &&\n pagination.pageSizeParamName === 'pageSize';\n const initialParams = sameInputNames\n ? 'input'\n : `{...input, page: input.${pagination.pageNumberParamName}, pageSize: input.${pagination.pageSizeParamName}}`;\n const nextPageParams = sameInputNames\n ? '...nextPageParams'\n : `${pagination.pageNumberParamName}: nextPageParams.page, ${pagination.pageSizeParamName}: nextPageParams.pageSize`;\n\n const logic = `\n const pagination = new Pagination(${initialParams}, async (nextPageParams) => {\n const dispatcher = new Dispatcher(options.interceptors, options.fetch);\n const result = await dispatcher.send(\n this.toRequest({...input, ${nextPageParams}}),\n this.output,\n );\n ${style?.errorAsValue ? `if (result[1]) {throw result[1];}` : ''}\n return {\n data: ${data}.${pagination.items},\n meta: {\n hasMore: Boolean(${data}.${pagination.hasMore}),\n },\n };\n });\n await pagination.getNextPage();\n return ${returnValue}\n `;\n return style?.errorAsValue\n ? `{try {${logic}} catch (error) {return [null as never, error] as const;}}}`\n : `{${logic}}}`;\n }\n return normalOperation(style);\n}\n\nexport function toHttpOutput(\n spec: IR,\n operationName: string,\n status: string,\n response: ResponseObject,\n withGenerics = true,\n) {\n const typeScriptDeserialzer = new TypeScriptEmitter(spec);\n const interfaceName = pascalcase(sanitizeTag(response['x-response-name']));\n\n if (!isEmpty(response.content)) {\n const contentTypeResult = fromContentType(\n spec,\n typeScriptDeserialzer,\n response,\n );\n if (!contentTypeResult) {\n throw new Error(\n `No recognizable content type for response ${status} in operation ${operationName}`,\n );\n }\n const parser: Parser = contentTypeResult.parser || 'buffered';\n const outputs: string[] = [];\n const statusName = `http.${statusMap[status] || 'APIResponse'}`;\n const statusCode = +status;\n if (statusCode === 204) {\n outputs.push(statusName);\n } else {\n const generic = withGenerics ? `<outputs.${interfaceName}>` : '';\n if (status.endsWith('XX')) {\n outputs.push(`http.APIError${generic}`);\n } else {\n if (parser !== 'buffered') {\n outputs.push(`{type: ${statusName}${generic}, parser: ${parser}}`);\n } else {\n outputs.push(`${statusName}${generic}`);\n }\n }\n }\n return outputs;\n }\n return [];\n}\n\nfunction fromContentType(\n spec: OpenAPIObject,\n typeScriptDeserialzer: TypeScriptEmitter,\n response: ResponseObject,\n) {\n if ((response.headers ?? {})['Transfer-Encoding']) {\n return streamedOutput();\n }\n for (const type in response.content) {\n if (isStreamingContentType(type)) {\n return streamedOutput();\n }\n if (parseJsonContentType(type)) {\n return {\n parser: 'buffered' as const,\n responseSchema: response.content[type].schema\n ? typeScriptDeserialzer.handle(response.content[type].schema, true)\n : 'void',\n };\n }\n if (isTextContentType(type)) {\n return {\n parser: 'buffered' as const,\n responseSchema: response.content[type].schema\n ? typeScriptDeserialzer.handle(response.content[type].schema, true)\n : 'void',\n };\n }\n }\n return streamedOutput();\n}\n\nfunction streamedOutput() {\n return {\n parser: 'chunked' as const,\n responseSchema: 'ReadableStream',\n };\n}\n\nexport function inputToPath(\n operation: TunedOperationObject,\n inputs: Record<string, OperationInput>,\n) {\n const inputHeaders: string[] = [];\n const inputQuery: string[] = [];\n const inputBody: string[] = [];\n const inputParams: string[] = [];\n for (const [name, prop] of Object.entries(inputs)) {\n if (prop.in === 'headers' || prop.in === 'header') {\n inputHeaders.push(`\"${name}\"`);\n } else if (prop.in === 'query') {\n inputQuery.push(`\"${name}\"`);\n } else if (prop.in === 'body') {\n inputBody.push(`\"${name}\"`);\n } else if (prop.in === 'path') {\n inputParams.push(`\"${name}\"`);\n } else {\n throw new Error(\n `Unknown source ${prop.in} in ${name} ${JSON.stringify(\n prop,\n )} in ${operation.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unauthorized",
|
|
8
|
-
"402": "PaymentRequired",
|
|
9
|
-
"403": "Forbidden",
|
|
10
|
-
"404": "NotFound",
|
|
11
|
-
"405": "MethodNotAllowed",
|
|
12
|
-
"406": "NotAcceptable",
|
|
13
|
-
"409": "Conflict",
|
|
14
|
-
"412": "PreconditionFailed",
|
|
15
|
-
"413": "PayloadTooLarge",
|
|
16
|
-
"410": "Gone",
|
|
17
|
-
"422": "UnprocessableEntity",
|
|
18
|
-
"429": "TooManyRequests",
|
|
19
|
-
"500": "InternalServerError",
|
|
20
|
-
"501": "NotImplemented",
|
|
21
|
-
"502": "BadGateway",
|
|
22
|
-
"503": "ServiceUnavailable",
|
|
23
|
-
"504": "GatewayTimeout"
|
|
24
|
-
};
|
|
25
|
-
export {
|
|
26
|
-
status_map_default as default
|
|
27
|
-
};
|
|
28
|
-
//# sourceMappingURL=status-map.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/lib/status-map.ts"],
|
|
4
|
-
"sourcesContent": ["export default {\n '200': 'Ok',\n '201': 'Created',\n '202': 'Accepted',\n '204': 'NoContent',\n '400': 'BadRequest',\n '401': 'Unauthorized',\n '402': 'PaymentRequired',\n '403': 'Forbidden',\n '404': 'NotFound',\n '405': 'MethodNotAllowed',\n '406': 'NotAcceptable',\n '409': 'Conflict',\n '412': 'PreconditionFailed',\n '413': 'PayloadTooLarge',\n '410': 'Gone',\n '422': 'UnprocessableEntity',\n '429': 'TooManyRequests',\n '500': 'InternalServerError',\n '501': 'NotImplemented',\n '502': 'BadGateway',\n '503': 'ServiceUnavailable',\n '504': 'GatewayTimeout',\n} as Record<string, string>;\n"],
|
|
5
|
-
"mappings": "AAAA,IAAO,qBAAQ;AAAA,EACb,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AACT;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/dist/src/lib/style.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=style.js.map
|