json-api-nestjs
Version:
JsonApi Plugin for NestJs
193 lines (192 loc) • 6.1 kB
TypeScript
import { SchemaObject } from '@nestjs/swagger/dist/interfaces/open-api-spec.interface';
import { ZodEntityProps } from '../types';
import { EntityClass, ObjectLiteral } from '../../../types';
export declare const errorSchema: {
type: string;
properties: {
statusCode: {
type: string;
};
error: {
type: string;
};
message: {
type: string;
items: {
type: string;
properties: {
code: {
type: string;
};
message: {
type: string;
};
path: {
type: string;
items: {
type: string;
};
};
keys: {
type: string;
items: {
type: string;
};
};
};
required: string[];
};
};
};
};
export declare function jsonSchemaResponse<E extends ObjectLiteral>(entity: EntityClass<E>, mapEntity: Map<EntityClass<E>, ZodEntityProps<E>>, array?: boolean): {
type: string;
properties: {
meta: {
type: string;
};
data: {
type: string;
properties: {
type: {
type: string;
const: string;
};
id: {
type: string;
};
attributes: {
type: string;
properties: Record<string, SchemaObject>;
};
relationships: {
type: string;
properties: Record<string, SchemaObject>;
};
links: {
type: string;
properties: {
self: {
type: string;
};
};
required: string[];
};
};
} | {
type: string;
items: {
type: string;
properties: {
type: {
type: string;
const: string;
};
id: {
type: string;
};
attributes: {
type: string;
properties: Record<string, SchemaObject>;
};
relationships: {
type: string;
properties: Record<string, SchemaObject>;
};
links: {
type: string;
properties: {
self: {
type: string;
};
};
required: string[];
};
};
};
};
includes: {
type: string;
items: {
type: string;
properties: {
type: {
type: string;
};
id: {
type: string;
};
attributes: {
type: string;
};
relationships: {
type: string;
properties: {
relationName: {
properties: {
links: {
type: string;
properties: {
self: {
type: string;
};
};
required: string[];
};
};
required: string[];
};
};
};
links: {
type: string;
properties: {
self: {
type: string;
};
};
required: string[];
};
};
required: string[];
};
};
};
required: string[];
};
export declare function createApiModels<E extends ObjectLiteral>(entity: EntityClass<E>, mapEntity: ZodEntityProps<E>): EntityClass<E>;
export declare const schemaTypeForRelation: {
type: string;
properties: {
data: {
oneOf: ({
type: string;
properties: {
type: {
type: string;
};
id: {
type: string;
};
};
} | {
type: string;
items?: undefined;
} | {
type: string;
items: {
type: string;
properties: {
type: {
type: string;
};
id: {
type: string;
};
};
};
})[];
};
};
};
export declare function getEntityMapProps<E extends ObjectLiteral>(mapEntity: Map<EntityClass<E>, ZodEntityProps<E>>, entity: EntityClass<E>): ZodEntityProps<E>;