<commit_before>// Type definitions for jsonapi-serializer 3.6
// Project: https://github.com/SeyZ/jsonapi-serializer#readme
// Definitions by: <NAME> <https://github.com/chiangf>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

// TypeScript Version: 2.2

export type RefFunction = (current: any, item: any) => string;

export interface Relation {
    ref: string | RefFunction;
    attributes?: string[];
    included?: boolean;
}

export interface SerializerOptions {
    ref?: (() => void) | boolean | string;
    included?: boolean;
    id?: string;
    attributes?: string[];
    topLevelLinks?: string[] | Array<() => void>;
    dataLinks?: string[] | Array<() => void>;
    dataMeta?: (() => void) | object;
    relationshipLinks?: object;
    relationshipMeta?: object;
    ignoreRelationshipData?: boolean;
    keyForAttribute?: string | KeyForAttribute;
    nullIfMissing?: boolean;
    pluralizeType?: boolean;
    typeForAttribute?: TypeForAttribute;
    meta?: object;
    transform?: Transform;
}

export interface KeyForAttribute {
    (attribute: string): string;
}

export interface TypeForAttribute {
    (attribute: string, object?: any): any;
}

export interface Transform {
    (record: any): any;
}

export interface DeserializerOptions {
    id?: string;
    keyForAttribute?:
        | "dash-case"
        | "lisp-case"
        | "spinal-case"
        | "kebab-case"
        | "underscore_case"
        | "snake_case"
        | "camelCase"
        | "CamelCase";
    pluralizeType?: boolean;
    typeAsAttribute?: boolean;
    transform?: Transform;
}

export interface DeserializerConstructor {
    new (opts: DeserializerOptions): Deserializer;
}

export interface SerializerConstructor {
    new (collectionName: string, opts: SerializerOptions): Serializer;
}

export interface ErrorConstructor {
    new (opts: JSONAPIErrorOptions | JSONAPIErrorOptions[]): JSONAPIError;
}

export interface JSONAPIError {
    errors: any[];
}

export interface JSONAPIErrorOptions {<commit_msg>Added additional type for DeserializerOptions keyForAttribute option (#36070)<commit_after>// Type definitions for jsonapi-serializer 3.6
// Project: https://github.com/SeyZ/jsonapi-serializer#readme
// Definitions by: <NAME> <https://github.com/chiangf>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

// TypeScript Version: 2.2

export type RefFunction = (current: any, item: any) => string;

export interface Relation {
    ref: string | RefFunction;
    attributes?: string[];
    included?: boolean;
}

export interface SerializerOptions {
    ref?: (() => void) | boolean | string;
    included?: boolean;
    id?: string;
    attributes?: string[];
    topLevelLinks?: string[] | Array<() => void>;
    dataLinks?: string[] | Array<() => void>;
    dataMeta?: (() => void) | object;
    relationshipLinks?: object;
    relationshipMeta?: object;
    ignoreRelationshipData?: boolean;
    keyForAttribute?: string | KeyForAttribute;
    nullIfMissing?: boolean;
    pluralizeType?: boolean;
    typeForAttribute?: TypeForAttribute;
    meta?: object;
    transform?: Transform;
}

export interface KeyForAttribute {
    (attribute: string): string;
}

export interface TypeForAttribute {
    (attribute: string, object?: any): any;
}

export interface Transform {
    (record: any): any;
}

export interface DeserializerOptions {
    id?: string;
    keyForAttribute?:
        | "dash-case"
        | "lisp-case"
        | "spinal-case"
        | "kebab-case"
        | "underscore_case"
        | "snake_case"
        | "camelCase"
        | "CamelCase"
        | KeyForAttribute;
    pluralizeType?: boolean;
    typeAsAttribute?: boolean;
    transform?: Transform;
}

export interface DeserializerConstructor {
    new (opts: DeserializerOptions): Deserializer;
}

export interface SerializerConstructor {
    new (collectionName: string, opts: SerializerOptions): Serializer;
}

export interface ErrorConstructor {
    new (opts: JSONAPIErrorOptions | JSONAPIErrorOptions[]): JSONAPIError;
}

export interface JSONAPIError {
    errors: any[];
}

export interface JSONAPIErrorOptions {
{'fraction_non_alphanumeric': 0.12312892322549493, 'fraction_numerical': 0.0031385803959439883, 'mean_word_length': 3.7079545454545455, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 21, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '348334', 'n_tokens_mistral': 1197, 'n_tokens_neox': 1189, 'n_words': 308}