Options
All
  • Public
  • Public/Protected
  • All
Menu

UpfrontJS - v0.10.0

Index

Type aliases

AttributeKeys<T, Ex>: Exclude<KeysNotMatching<T, Ex>, InternalProperties> | string

All keys of the model except where the value is a method, or it's a property defined internally.

Results in a union of keys.

Type parameters

  • T

  • Ex = CallableFunction

Attributes<T>: { [ K in AttributeKeys<T>]: T[K] }

The attributes the model is handling.

Type parameters

  • T: HasAttributes = HasAttributes

CastType: AttributeCaster | BuiltInCastType
CustomHeaders: Record<string, MaybeArray<string>>

Key-value pairs of headers where the values can be an array of values. Each value is appended to the outgoing headers.

DeepPartial<T>: { [ P in keyof T]?: DeepPartial<T[P]> | T[P] }

Set every property nested or otherwise to optional.

Type parameters

  • T

Events: Record<string, Listener[]>
KeysMatching<T, V>: { [ K in keyof T]: T[K] extends never ? V : K }[keyof T]

Get the keys of the given type where the value matches the given argument.

Type parameters

  • T

  • V

KeysNotMatching<T, V>: { [ K in keyof T]: T[K] extends V ? never : K }[keyof T]

Get the keys of the given type where the value doesn't match the given argument.

Type parameters

  • T

  • V

Listener<TArg>: (...args: TArg[]) => Promise<void> | void

Type parameters

  • TArg = any

Type declaration

    • (...args: TArg[]): Promise<void> | void
    • Parameters

      • Rest ...args: TArg[]

      Returns Promise<void> | void

MaybeArray<T>: T | T[]

Make the type either the initial value or an array of it.

Type parameters

  • T

Method: "DELETE" | "delete" | "GET" | "get" | "HEAD" | "head" | "PATCH" | "patch" | "POST" | "post" | "PUT" | "put"

The request methods.

PartialSome<T, K>: Omit<T, K> & { [ MK in K]?: T[MK] }

Make the properties defined in the union optional.

Type parameters

  • T: Record<PropertyKey, any>

  • K: keyof T

QueryParams: Partial<{ columns: string[]; distinct: string[]; limit: number; offset: number; orders: Order[]; page: number; relationsExists: string[]; scopes: string[]; wheres: WhereDescription[]; with: string[] }>
RawAttributes<T>: { [ K in AttributeKeys<T>]: T[K] extends Model ? RawAttributes<T[K]> : T[K] extends ModelCollection<infer M> ? RawAttributes<M>[] : T[K] }

Unwrap the model attributes recursively into attributes or array of attributes.

Type parameters

  • T: HasAttributes

RequireSome<T, K>: Omit<T, K> & { [ MK in K]-?: NonNullable<T[MK]> }

Make the properties defined in the union required.

Type parameters

  • T: Record<PropertyKey, any>

  • K: keyof T

ResolvableAttributes<T>: { [ K in keyof Attributes<T>]: RawAttributes<T>[K] | T[K] | ((previouslyResolvedAttributes?: Attributes<T> | RawAttributes<T>) => T[K]) }

The model attributes when constructing with a factory. Attributes might be functions called with the previously resolved attributes returning the intended attribute value.

Type parameters

SimpleAttributeKeys<T>: AttributeKeys<T, CallableFunction | (Model | ModelCollection<Model> | undefined)>

All keys of the model except where the value is a method, a relation, or it's a property defined internally.

Results in a union of keys.

Type parameters

  • T: HasAttributes = HasAttributes

SimpleAttributes<T>: { [ K in SimpleAttributeKeys<T>]: T[K] extends Model | ModelCollection<Model> ? never : T[K] }

The attributes the model is handling except relation values.

Type parameters

  • T: HasAttributes = HasAttributes

StaticToThis<T>: { prototype: T }

Hack to get the instance type of the given constructable.

This can be used like: public static myFunc(this: T): T['prototype']

Derived from the discussion on: https://github.com/Microsoft/TypeScript/issues/5863 Declaring this: https://www.typescriptlang.org/docs/handbook/2/functions.html#declaring-this-in-a-function

Type parameters

Type declaration

  • prototype: T
UnionToIntersection<T>: (T extends any ? (x: T) => any : never) extends (x: infer U) => any ? U : never

Make an intersection type from the given object type or interface union.

Type parameters

  • T: Record<PropertyKey, any>

Functions

  • after(str: string, token: string): string
  • Get part of the string after the given token.

    Parameters

    • str: string
    • token: string

      The string to search for.

    Returns string

  • afterLast(str: string, token: string): string
  • Get part of the string after the last found instance of the given token.

    Parameters

    • str: string
    • token: string

      The string to search for.

    Returns string

  • before(str: string, token: string): string
  • Get the string up to and not including the given token.

    Parameters

    • str: string
    • token: string

      The string to search for.

    Returns string

  • beforeLast(str: string, token: string): string
  • Get the string before the last instance of the found token.

    Parameters

    • str: string
    • token: string

      The string to search for.

    Returns string

  • camel(str: string): string
  • factory<T, F>(modelConstructor: new () => T, amount?: number): FactoryBuilder<T, F>
  • finish(str: string, token: string): string
  • Ensure the string ends with the given string.

    Parameters

    • str: string
    • token: string

    Returns string

  • includesAll(str: string, tokens: string[]): boolean
  • Test whether all the tokens included in the string.

    Parameters

    • str: string
    • tokens: string[]

    Returns boolean

  • is(str: string, compareValue: string | RegExp, ignoreCase?: boolean): boolean
  • Check whether the string matches the given string.

    Parameters

    • str: string
    • compareValue: string | RegExp

      The Regexp or the string to test for. "*" functions as a wildcard.

    • ignoreCase: boolean = false

      Flag indicating whether the casing should be ignored or not.

    Returns boolean

  • isObjectLiteral<T>(value: any): value is NonNullable<T>
  • Determine whether the given value is a non-null object not including the array type.

    Type parameters

    • T: Record<PropertyKey, any>

    Parameters

    • value: any

    Returns value is NonNullable<T>

  • isUserLandClass<T>(value: any): value is T
  • Determine whether the given value is a user defined class that can be called with the "new" keyword.

    Type parameters

    • T: new (...args: any) => any

    Parameters

    • value: any

    Returns value is T

  • isUuid(str: unknown): boolean
  • Determine whether the given string is a uuid of version 4.

    Parameters

    • str: unknown

    Returns boolean

  • kebab(str: string): string
  • limit(str: string, count: number, limiter?: string): string
  • Limit the number of characters on the string.

    Parameters

    • str: string
    • count: number

      The number of characters to keep.

    • limiter: string = '...'

      The string to be appended at the end after the limit.

    Returns string

  • paginate<T>(items?: any[], itemsPerPage?: number, wrapsAround?: boolean): Paginator<T>
  • Construct a paginator instance.

    Type parameters

    • T

    Parameters

    • Optional items: any[]
    • itemsPerPage: number = 10
    • wrapsAround: boolean = false

    Returns Paginator<T>

  • pascal(str: string): string
  • plural(str: string): string
  • singular(str: string): string
  • snake(str: string): string
  • start(str: string, token: string): string
  • Ensure the string starts with the given string.

    Parameters

    • str: string
    • token: string

    Returns string

  • title(str: string): string
  • ucFirst(str: string): string
  • uuid(): string
  • words(str: string, count: number, limiter?: string): string
  • Limit the number of words on the string.

    Parameters

    • str: string
    • count: number

      The number of words to keep.

    • limiter: string = '...'

      The string to be appended at the end after the limit.

    Returns string

Generated using TypeDoc