@bagelink/sdk 1.8.32 → 1.8.33
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.cjs
CHANGED
|
@@ -727,7 +727,8 @@ function generateFunctionForOperation(method, path, operation) {
|
|
|
727
727
|
);
|
|
728
728
|
const allParams = isFileUpload ? "file: File, options?: UploadOptions & { dirPath?: string, tags?: string[] }" : combineAllParams(parameters, requestBodyParam);
|
|
729
729
|
const responseType = generateResponseType(operation.responses);
|
|
730
|
-
const
|
|
730
|
+
const isArrayResponse = responseType.endsWith("[]");
|
|
731
|
+
const responseTypeStr = responseType ? isArrayResponse ? `: Promise<ApiResponse<${responseType}>>` : `: Promise<${responseType} & { $raw?: any, $metadata?: any, totalCount?: number, page?: number, perPage?: number, totalPages?: number, rateLimit?: number, rateLimitReset?: number, getHeader?: (name: string) => string | undefined, hasPagination?: boolean, hasNextPage?: boolean, hasPrevPage?: boolean }>` : "";
|
|
731
732
|
const functionComment = buildJSDocComment(operation, method, path);
|
|
732
733
|
if (isStream) {
|
|
733
734
|
const eventTypes = extractSSEEventTypes(operation);
|
package/dist/index.mjs
CHANGED
|
@@ -721,7 +721,8 @@ function generateFunctionForOperation(method, path, operation) {
|
|
|
721
721
|
);
|
|
722
722
|
const allParams = isFileUpload ? "file: File, options?: UploadOptions & { dirPath?: string, tags?: string[] }" : combineAllParams(parameters, requestBodyParam);
|
|
723
723
|
const responseType = generateResponseType(operation.responses);
|
|
724
|
-
const
|
|
724
|
+
const isArrayResponse = responseType.endsWith("[]");
|
|
725
|
+
const responseTypeStr = responseType ? isArrayResponse ? `: Promise<ApiResponse<${responseType}>>` : `: Promise<${responseType} & { $raw?: any, $metadata?: any, totalCount?: number, page?: number, perPage?: number, totalPages?: number, rateLimit?: number, rateLimitReset?: number, getHeader?: (name: string) => string | undefined, hasPagination?: boolean, hasNextPage?: boolean, hasPrevPage?: boolean }>` : "";
|
|
725
726
|
const functionComment = buildJSDocComment(operation, method, path);
|
|
726
727
|
if (isStream) {
|
|
727
728
|
const eventTypes = extractSSEEventTypes(operation);
|
package/package.json
CHANGED
|
@@ -629,8 +629,16 @@ function generateFunctionForOperation(
|
|
|
629
629
|
: combineAllParams(parameters, requestBodyParam)
|
|
630
630
|
|
|
631
631
|
const responseType = generateResponseType(operation.responses)
|
|
632
|
+
|
|
633
|
+
// Determine if response is an array type
|
|
634
|
+
const isArrayResponse = responseType.endsWith('[]')
|
|
635
|
+
|
|
636
|
+
// For arrays: ApiResponse<T[]>
|
|
637
|
+
// For single objects: T & metadata (more permissive for assignment)
|
|
632
638
|
const responseTypeStr = responseType
|
|
633
|
-
?
|
|
639
|
+
? isArrayResponse
|
|
640
|
+
? `: Promise<ApiResponse<${responseType}>>`
|
|
641
|
+
: `: Promise<${responseType} & { $raw?: any, $metadata?: any, totalCount?: number, page?: number, perPage?: number, totalPages?: number, rateLimit?: number, rateLimitReset?: number, getHeader?: (name: string) => string | undefined, hasPagination?: boolean, hasNextPage?: boolean, hasPrevPage?: boolean }>`
|
|
634
642
|
: ''
|
|
635
643
|
|
|
636
644
|
// Create JSDoc comment with OpenAPI documentation
|