@types/json-api-serializer
Advanced tools
Comparing version 2.6.3 to 2.6.4
@@ -7,167 +7,169 @@ // Type definitions for json-api-serializer 2.6 | ||
declare namespace JSONAPISerializer { | ||
type TypeCallback = ( | ||
relationshipData: { [key: string]: RelationshipOptions }, | ||
data: unknown | ||
) => unknown; | ||
type TypeCallback = ( | ||
relationshipData: { [key: string]: RelationshipOptions }, | ||
data: unknown, | ||
) => unknown; | ||
type LinksCallback = (data: unknown, extraData?: unknown) => string | LinksObject; | ||
type LinksCallback = (data: unknown, extraData?: unknown) => string | LinksObject; | ||
type MetaCallback = (data: unknown, extraData?: unknown) => unknown; | ||
type MetaCallback = (data: unknown, extraData?: unknown) => unknown; | ||
type BeforeSerializeCallback = (data: unknown) => unknown; | ||
type BeforeSerializeCallback = (data: unknown) => unknown; | ||
type AfterDeseralizeCallback = (data: unknown) => unknown; | ||
type AfterDeseralizeCallback = (data: unknown) => unknown; | ||
interface RelationshipOptions { | ||
type: string | TypeCallback; | ||
alternativeKey?: string | undefined; | ||
schema?: string | undefined; | ||
links?: LinksObject | LinksCallback | undefined; | ||
meta?: MetaCallback | Meta | undefined; | ||
beforeSerialize?: BeforeSerializeCallback | undefined; | ||
} | ||
interface RelationshipOptions { | ||
type: string | TypeCallback; | ||
alternativeKey?: string | undefined; | ||
schema?: string | undefined; | ||
links?: LinksObject | LinksCallback | undefined; | ||
meta?: MetaCallback | Meta | undefined; | ||
beforeSerialize?: BeforeSerializeCallback | undefined; | ||
} | ||
type Case = 'kebab-case' | 'snake_case' | 'camelCase'; | ||
type Case = "kebab-case" | "snake_case" | "camelCase"; | ||
interface Options { | ||
id?: string | undefined; | ||
blacklist?: string[] | undefined; | ||
whitelist?: string[] | undefined; | ||
jsonapiObject?: boolean | undefined; | ||
links?: LinksObject | LinksCallback | undefined; | ||
topLevelLinks?: LinksCallback | LinksObject | undefined; | ||
topLevelMeta?: MetaCallback | unknown | undefined; | ||
meta?: MetaCallback | Meta | undefined; | ||
relationships?: { | ||
[key: string]: RelationshipOptions; | ||
} | undefined; | ||
blacklistOnDeserialize?: string[] | undefined; | ||
whitelistOnDeserialize?: string[] | undefined; | ||
convertCase?: Case | undefined; | ||
unconvertCase?: Case | undefined; | ||
convertCaseCacheSize?: number | undefined; | ||
beforeSerialize?: BeforeSerializeCallback | undefined; | ||
afterDeserialize?: AfterDeseralizeCallback | undefined; | ||
} | ||
interface Options { | ||
id?: string | undefined; | ||
blacklist?: string[] | undefined; | ||
whitelist?: string[] | undefined; | ||
jsonapiObject?: boolean | undefined; | ||
links?: LinksObject | LinksCallback | undefined; | ||
topLevelLinks?: LinksCallback | LinksObject | undefined; | ||
topLevelMeta?: MetaCallback | unknown | undefined; | ||
meta?: MetaCallback | Meta | undefined; | ||
relationships?: { | ||
[key: string]: RelationshipOptions; | ||
} | undefined; | ||
blacklistOnDeserialize?: string[] | undefined; | ||
whitelistOnDeserialize?: string[] | undefined; | ||
convertCase?: Case | undefined; | ||
unconvertCase?: Case | undefined; | ||
convertCaseCacheSize?: number | undefined; | ||
beforeSerialize?: BeforeSerializeCallback | undefined; | ||
afterDeserialize?: AfterDeseralizeCallback | undefined; | ||
} | ||
interface DynamicTypeOptions { | ||
id?: string | undefined; | ||
jsonapiObject?: boolean | undefined; | ||
topLevelLinks?: LinksObject | LinksCallback | undefined; | ||
topLevelMeta?: unknown | MetaCallback | undefined; | ||
} | ||
interface DynamicTypeOptions { | ||
id?: string | undefined; | ||
jsonapiObject?: boolean | undefined; | ||
topLevelLinks?: LinksObject | LinksCallback | undefined; | ||
topLevelMeta?: unknown | MetaCallback | undefined; | ||
} | ||
interface LinkObject { | ||
href: string; | ||
meta?: Meta; | ||
} | ||
interface LinkObject { | ||
href: string; | ||
meta?: Meta; | ||
} | ||
interface LinksObject { | ||
self?: LinkObject | LinksCallback | string | null; | ||
related?: LinkObject | LinksCallback | string | null; | ||
} | ||
interface LinksObject { | ||
self?: LinkObject | LinksCallback | string | null; | ||
related?: LinkObject | LinksCallback | string | null; | ||
} | ||
interface ResourceObject<T> { | ||
id: string; | ||
type: string; | ||
attributes?: Omit<T, 'id'> | undefined; | ||
relationships?: { | ||
[key: string]: Relationship; | ||
} | undefined; | ||
links?: LinksObject | LinksCallback | undefined; | ||
} | ||
interface ResourceObject<T> { | ||
id: string; | ||
type: string; | ||
attributes?: Omit<T, "id"> | undefined; | ||
relationships?: { | ||
[key: string]: Relationship; | ||
} | undefined; | ||
links?: LinksObject | LinksCallback | undefined; | ||
} | ||
type Relationship = { | ||
links?: LinksObject | LinksCallback | undefined; | ||
data: Linkage | Linkage[]; | ||
meta?: Meta; | ||
} | { | ||
links?: LinksObject | LinksCallback | undefined; | ||
data?: Linkage | Linkage[]; | ||
meta: Meta; | ||
} | { | ||
links: LinksObject | LinksCallback | undefined; | ||
data?: Linkage | Linkage[]; | ||
meta?: Meta; | ||
}; | ||
type Relationship = { | ||
links?: LinksObject | LinksCallback | undefined; | ||
data: Linkage | Linkage[]; | ||
meta?: Meta; | ||
} | { | ||
links?: LinksObject | LinksCallback | undefined; | ||
data?: Linkage | Linkage[]; | ||
meta: Meta; | ||
} | { | ||
links: LinksObject | LinksCallback | undefined; | ||
data?: Linkage | Linkage[]; | ||
meta?: Meta; | ||
}; | ||
interface Meta { | ||
[name: string]: unknown; | ||
} | ||
interface Meta { | ||
[name: string]: unknown; | ||
} | ||
interface Linkage { | ||
type: string; | ||
id: string; | ||
meta?: Meta; | ||
} | ||
interface Linkage { | ||
type: string; | ||
id: string; | ||
meta?: Meta; | ||
} | ||
interface JsonApiObject { | ||
version: string; | ||
} | ||
interface JsonApiObject { | ||
version: string; | ||
} | ||
interface ErrorObject { | ||
id?: string | undefined; | ||
links?: LinksObject & { | ||
about: LinkObject | string; | ||
} | undefined; | ||
status?: string | undefined; | ||
code?: string | undefined; | ||
title?: string | undefined; | ||
detail?: string | undefined; | ||
source?: unknown | undefined; | ||
meta?: Meta | undefined; | ||
} | ||
interface ErrorObject { | ||
id?: string | undefined; | ||
links?: | ||
| LinksObject & { | ||
about: LinkObject | string; | ||
} | ||
| undefined; | ||
status?: string | undefined; | ||
code?: string | undefined; | ||
title?: string | undefined; | ||
detail?: string | undefined; | ||
source?: unknown | undefined; | ||
meta?: Meta | undefined; | ||
} | ||
interface JSONAPIDocument { | ||
jsonapi?: JsonApiObject | undefined; | ||
links?: LinksObject | undefined; | ||
data?: ResourceObject<unknown> | Array<ResourceObject<unknown>> | undefined; | ||
errors?: ErrorObject[] | undefined; | ||
meta?: Meta | undefined; | ||
included?: Array<ResourceObject<unknown>> | undefined; | ||
} | ||
interface JSONAPIDocument { | ||
jsonapi?: JsonApiObject | undefined; | ||
links?: LinksObject | undefined; | ||
data?: ResourceObject<unknown> | Array<ResourceObject<unknown>> | undefined; | ||
errors?: ErrorObject[] | undefined; | ||
meta?: Meta | undefined; | ||
included?: Array<ResourceObject<unknown>> | undefined; | ||
} | ||
} | ||
declare class JSONAPISerializer { | ||
constructor(opts?: JSONAPISerializer.Options); | ||
constructor(opts?: JSONAPISerializer.Options); | ||
register(type: string, schema?: string | JSONAPISerializer.Options, opts?: JSONAPISerializer.Options): void; | ||
register(type: string, schema?: string | JSONAPISerializer.Options, opts?: JSONAPISerializer.Options): void; | ||
serialize(type: string, data: unknown, topLevelMeta?: unknown): JSONAPISerializer.JSONAPIDocument; | ||
serialize(type: string, data: unknown, topLevelMeta?: unknown): JSONAPISerializer.JSONAPIDocument; | ||
serialize( | ||
type: string, | ||
data: unknown, | ||
schema?: string | JSONAPISerializer.Options, | ||
topLevelMeta?: unknown, | ||
excludeTopLevelMeta?: boolean, | ||
overrideSchemaOptions?: { [type: string]: JSONAPISerializer.Options } | ||
): JSONAPISerializer.JSONAPIDocument; | ||
serialize( | ||
type: string, | ||
data: unknown, | ||
schema?: string | JSONAPISerializer.Options, | ||
topLevelMeta?: unknown, | ||
excludeTopLevelMeta?: boolean, | ||
overrideSchemaOptions?: { [type: string]: JSONAPISerializer.Options }, | ||
): JSONAPISerializer.JSONAPIDocument; | ||
serializeAsync( | ||
type: string | JSONAPISerializer.DynamicTypeOptions, | ||
data: unknown | unknown[], | ||
schema?: string, | ||
topLevelMeta?: unknown, | ||
excludeTopLevelMeta?: boolean, | ||
overrideSchemaOptions?: { [type: string]: JSONAPISerializer.Options } | ||
): Promise<JSONAPISerializer.JSONAPIDocument>; | ||
serializeAsync( | ||
type: string | JSONAPISerializer.DynamicTypeOptions, | ||
data: unknown | unknown[], | ||
schema?: string, | ||
topLevelMeta?: unknown, | ||
excludeTopLevelMeta?: boolean, | ||
overrideSchemaOptions?: { [type: string]: JSONAPISerializer.Options }, | ||
): Promise<JSONAPISerializer.JSONAPIDocument>; | ||
deserialize( | ||
type: string | JSONAPISerializer.DynamicTypeOptions, | ||
data: JSONAPISerializer.JSONAPIDocument, | ||
schema?: string | ||
): any; | ||
deserialize( | ||
type: string | JSONAPISerializer.DynamicTypeOptions, | ||
data: JSONAPISerializer.JSONAPIDocument, | ||
schema?: string, | ||
): any; | ||
deserializeAsync( | ||
type: string | JSONAPISerializer.DynamicTypeOptions, | ||
data: JSONAPISerializer.JSONAPIDocument, | ||
schema?: string | ||
): Promise<any>; | ||
deserializeAsync( | ||
type: string | JSONAPISerializer.DynamicTypeOptions, | ||
data: JSONAPISerializer.JSONAPIDocument, | ||
schema?: string, | ||
): Promise<any>; | ||
serializeError( | ||
error: JSONAPISerializer.ErrorObject | JSONAPISerializer.ErrorObject[] | Error | Error[] | ||
): JSONAPISerializer.ErrorObject; | ||
serializeError( | ||
error: JSONAPISerializer.ErrorObject | JSONAPISerializer.ErrorObject[] | Error | Error[], | ||
): JSONAPISerializer.ErrorObject; | ||
} | ||
export = JSONAPISerializer; |
{ | ||
"name": "@types/json-api-serializer", | ||
"version": "2.6.3", | ||
"version": "2.6.4", | ||
"description": "TypeScript definitions for json-api-serializer", | ||
@@ -23,4 +23,4 @@ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/json-api-serializer", | ||
"dependencies": {}, | ||
"typesPublisherContentHash": "5c199e1418428f5f8675157f87dc61d88a99c3f4b088c771977698a513dbe99e", | ||
"typeScriptVersion": "3.7" | ||
"typesPublisherContentHash": "9b9e989fe0f204b371dd7787f0df35698165f34390c254eac049ff19b610e46e", | ||
"typeScriptVersion": "4.5" | ||
} |
@@ -11,3 +11,3 @@ # Installation | ||
### Additional Details | ||
* Last updated: Mon, 30 Aug 2021 16:01:20 GMT | ||
* Last updated: Fri, 15 Sep 2023 20:36:37 GMT | ||
* Dependencies: none | ||
@@ -14,0 +14,0 @@ * Global values: none |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8097
147