mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-21 10:50:14 +01:00
📦 chore: Bump Packages (#5791)
* chore: started with updating packages to new version. (a lot are outdated) * fix: eslint to pass when no matching files changed. * fix: eslint to pass when no matching files changed. * fix: issue with strict in actions with the test * chore: update more dependencies * feat: scan for unused imported packages * feat: scan for unused imported packages * feat: scan for unused imported packages * feat: scan for unused imported packages * feat: scan for unused imported packages * feat: scan for unused imported packages * feat: scan for unused imported packages * chore: removed Unused NPM Packages * chore: removed Unused NPM Packages in `client/package.json` * chore: removed Unused NPM Packages in `client/package.json` * chore: Only comments when there are actual unused dependencies. * chore: Only comments when there are actual unused dependencies. * ci: test if it detects unused packages. * ci: removed unused packages. * ci: both static and dynamic i18n keys * ci: revert back to no dynamic. use official nesting * chore: remove override package: ajv
This commit is contained in:
parent
936199b950
commit
404b27d045
8 changed files with 801 additions and 615 deletions
|
|
@ -22,8 +22,8 @@ export type ParametersSchema = {
|
|||
|
||||
export type OpenAPISchema = OpenAPIV3.SchemaObject &
|
||||
ParametersSchema & {
|
||||
items?: OpenAPIV3.ReferenceObject | OpenAPIV3.SchemaObject;
|
||||
};
|
||||
items?: OpenAPIV3.ReferenceObject | OpenAPIV3.SchemaObject;
|
||||
};
|
||||
|
||||
export type ApiKeyCredentials = {
|
||||
api_key: string;
|
||||
|
|
@ -43,8 +43,8 @@ export type Credentials = ApiKeyCredentials | OAuthCredentials;
|
|||
type MediaTypeObject =
|
||||
| undefined
|
||||
| {
|
||||
[media: string]: OpenAPIV3.MediaTypeObject | undefined;
|
||||
};
|
||||
[media: string]: OpenAPIV3.MediaTypeObject | undefined;
|
||||
};
|
||||
|
||||
type RequestBodyObject = Omit<OpenAPIV3.RequestBodyObject, 'content'> & {
|
||||
content: MediaTypeObject;
|
||||
|
|
@ -125,6 +125,9 @@ function openAPISchemaToZod(schema: OpenAPISchema): z.ZodTypeAny | undefined {
|
|||
return handler(schema);
|
||||
}
|
||||
|
||||
/**
|
||||
* Class representing a function signature.
|
||||
*/
|
||||
export class FunctionSignature {
|
||||
name: string;
|
||||
description: string;
|
||||
|
|
@ -150,7 +153,7 @@ export class FunctionSignature {
|
|||
name: this.name,
|
||||
description: this.description,
|
||||
parameters,
|
||||
strict: this.strict,
|
||||
...(this.strict ? { strict: this.strict } : {}),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
@ -374,7 +377,9 @@ function sanitizeOperationId(input: string) {
|
|||
return input.replace(/[^a-zA-Z0-9_-]/g, '');
|
||||
}
|
||||
|
||||
/** Function to convert OpenAPI spec to function signatures and request builders */
|
||||
/**
|
||||
* Converts an OpenAPI spec to function signatures and request builders.
|
||||
*/
|
||||
export function openapiToFunction(
|
||||
openapiSpec: OpenAPIV3.Document,
|
||||
generateZodSchemas = false,
|
||||
|
|
@ -473,6 +478,9 @@ export type ValidationResult = {
|
|||
spec?: OpenAPIV3.Document;
|
||||
};
|
||||
|
||||
/**
|
||||
* Validates and parses an OpenAPI spec.
|
||||
*/
|
||||
export function validateAndParseOpenAPISpec(specString: string): ValidationResult {
|
||||
try {
|
||||
let parsedSpec;
|
||||
|
|
@ -536,4 +544,4 @@ export function validateAndParseOpenAPISpec(specString: string): ValidationResul
|
|||
console.error(error);
|
||||
return { status: false, message: 'Error parsing OpenAPI spec.' };
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue