Options
All
  • Public
  • Public/Protected
  • All
Menu

Soukai API

Index

Classes

Interfaces

Type Aliases

Variables

Functions

Type Aliases

ArrayFieldDefinition<T>: FieldDefinitionBase<T> & { items: Omit<FieldDefinition<T>, "required">; type: typeof Array }

Type Parameters

  • T = unknown

AttributeValue: any
Attributes: Record<string, AttributeValue>
BasicFieldDefinition<T>: FieldDefinitionBase<T> & { type: Exclude<FieldTypeValue, typeof Array | typeof Object> }

Type Parameters

  • T = unknown

BootedArrayFieldDefinition<T>: BootedFieldDefinitionBase<T> & { items: Omit<BootedFieldDefinition<T>, "required">; type: typeof Array }

Type Parameters

  • T = unknown

BootedBasicFieldDefinition<T>: BootedFieldDefinitionBase<T> & { type: Exclude<FieldTypeValue, typeof Array | typeof Object> }

Type Parameters

  • T = unknown

Type Parameters

  • T = unknown

BootedFieldDefinitionBase<T>: T & { required: boolean }

Type Parameters

  • T = unknown

BootedFieldsDefinition<T>: Record<string, BootedFieldDefinition<T>>

Type Parameters

  • T = unknown

BootedObjectFieldDefinition<T>: BootedFieldDefinitionBase<T> & { fields: BootedFieldsDefinition<T>; type: typeof Object }

Type Parameters

  • T = unknown

EngineAttributeFilter: EngineAttributeValue | { $eq: EngineAttributeValue } | { $or: EngineAttributeFilter[] } | { $in: EngineAttributeLeafValue[] } | { $contains: EngineAttributeFilter | EngineAttributeFilter[] }
EngineAttributeLeafValue: string | number | boolean | null | Date
EngineAttributeUpdateOperation: { $update: EngineAttributeUpdate } | { $updateItems: EngineUpdateItemsOperatorData | EngineUpdateItemsOperatorData[] } | { $unset: string | string[] | true } | { $push: EngineAttributeValue }
EngineDocument: Record<string, EngineAttributeValue>
EngineDocumentsCollection: Record<string, EngineDocument>
EngineFilters: EngineRootFilter & Record<string, EngineAttributeFilter>
EngineUpdates: Record<string, EngineAttributeUpdate> | { $unset: string | string[] } | { $overwrite: EngineAttributeValue }

Type Parameters

  • T = unknown

FieldDefinitionBase<T>: T & { required?: boolean }

Type Parameters

  • T = unknown

FieldTypeValue: typeof FieldType[keyof typeof FieldType]
FieldsDefinition<T>: Record<string, FieldDefinition<T>>

Type Parameters

  • T = unknown

GetArrayFields<F>: { [ K in keyof F]: F[K] extends { type: typeof Array } ? K : never }[keyof F]

Type Parameters

GetDefinedFields<F>: { [ K in keyof F]: F[K] extends string | { type: string } ? K : F[K] extends Record<string, string> ? K : never }[keyof F]

Type Parameters

GetFieldType<T>: T extends FieldTypeValue ? T : T extends BasicFieldDefinition ? T["type"] : T extends ArrayFieldDefinition ? T["items"][] : T extends ObjectFieldDefinition ? T["fields"] : T

Type Parameters

GetFieldsDefinition<D>: D extends { fields: infer F } ? F : {}

Type Parameters

GetRequiredFields<F>: { [ K in keyof F]: F[K] extends { required: true } ? K : never }[keyof F]

Type Parameters

GetTimestampsDefinition<D>: D extends { timestamps: infer T } ? T : true

Type Parameters

Key: any
MagicAttributeProperties<T>: { -readonly [ K in keyof T]: MagicAttributeValue<GetFieldType<T[K]>> }

Type Parameters

MagicAttributeValue<T>: T extends FieldsDefinition ? NestedMagicAttributes<T> : T extends FieldTypeValue ? ResolveFieldType<T> : T extends (infer R)[] ? R extends FieldTypeValue ? ResolveFieldType<R>[] : never : never

Type Parameters

  • T

Type Parameters

MagicTimestampAttributes<T>: T extends false ? {} : T extends typeof CreatedAt[] ? { createdAt: Date } : T extends typeof UpdatedAt[] ? { updatedAt: Date } : { createdAt: Date; updatedAt: Date }

Type Parameters

ModelCastAttributeOptions: { definition?: BootedFieldDefinition; field?: string; malformedAttributes?: Record<string, string[]> }

Type declaration

  • Optional definition?: BootedFieldDefinition
  • Optional field?: string
  • Optional malformedAttributes?: Record<string, string[]>
ModelCloneOptions: Partial<{ clean: boolean; clones: WeakMap<Model, Model>; constructors: WeakMap<typeof Model, typeof Model> | [typeof Model, typeof Model][] }>
ModelConstructor<T>: Constructor<T> & typeof Model

Type Parameters

ModelEventValue: typeof ModelEvent[keyof typeof ModelEvent]
ModelListener<T>: ((model: T) => unknown)

Type Parameters

Type declaration

    • (model: T): unknown
    • Parameters

      • model: T

      Returns unknown

NestedMagicAttributes<T>: MagicAttributeProperties<Pick<T, GetRequiredFields<T>>> & Partial<MagicAttributeProperties<Pick<T, GetDefinedFields<T>>>>

Type Parameters

ObjectFieldDefinition<T>: FieldDefinitionBase<T> & { fields: FieldsDefinition<T>; type: typeof Object }

Type Parameters

  • T = unknown

RelationCloneOptions: Partial<{ clones: WeakMap<Model, Model>; constructors: WeakMap<typeof Model, typeof Model> }>
RelationConstructor<T>: Constructor<T> & typeof Relation

Type Parameters

RelationDeleteStrategy: null | "cascade"
ResolveFieldType<T>: T extends typeof Number ? number : T extends typeof String ? string : T extends typeof Boolean ? boolean : T extends typeof Date ? Date : T extends typeof Key ? Key : T extends typeof Any ? any : never

Type Parameters

SchemaDefinition<T>: Partial<{ fields: FieldsDefinition<T>; primaryKey: string; timestamps: TimestampsDefinition }>

Type Parameters

  • T = unknown

TimestampFieldValue: typeof TimestampField[keyof typeof TimestampField]
TimestampsDefinition: TimestampFieldValue[] | boolean

Variables

FieldRequired: { Optional: false; Required: true } = ...

Type declaration

  • Optional: false
  • Required: true
FieldType: { Any: "any"; Array: "array"; Boolean: "boolean"; Date: "date"; Key: "key"; Number: "number"; Object: "object"; String: "string" } = ...

Type declaration

  • Any: "any"
  • Array: "array"
  • Boolean: "boolean"
  • Date: "date"
  • Key: "key"
  • Number: "number"
  • Object: "object"
  • String: "string"
ModelEvent: { Created: "created"; Deleted: "deleted"; Updated: "updated" } = ...

Type declaration

  • Created: "created"
  • Deleted: "deleted"
  • Updated: "updated"
TimestampField: { CreatedAt: "createdAt"; UpdatedAt: "updatedAt" } = ...

Type declaration

  • CreatedAt: "createdAt"
  • UpdatedAt: "updatedAt"
default: Soukai
deprecated

import global methods instead.

Functions

  • bootModels(models: Record<string, typeof Model>): void
  • bootModelsFromViteGlob(glob: Record<string, Record<string, unknown>>, ignoreSuffixes?: string[]): void
  • bootModelsFromWebpackContext(context: RequireContext, ignoreSuffixes?: string[]): void
  • closeEngineConnections(): Promise<void>
  • definitionsFromContexts(context: RequireContext): Record<string, typeof Model>
  • deprecated

    This was intended for loading models, but that isn't necessary anymore. Maybe you want to use bootModelsFromWebpackContext instead.

    Parameters

    • context: RequireContext

    Returns Record<string, typeof Model>

  • getEngine(): Engine | undefined
  • getFinalEngine(): Engine | undefined
  • getModelsFromViteGlob(glob: Record<string, Record<string, unknown>>, ignoreSuffixes?: string[]): Record<string, typeof Model>
  • getModelsFromWebpackContext(context: RequireContext, ignoreSuffixes?: string[]): Record<string, typeof Model>
  • requireBootedModel<T>(name: string): T
  • requireEngine<T>(): T
  • requireFinalEngine<T>(): T
  • setEngine(engine: null | Engine): void
  • withEngine<T>(engine: Engine, operation: (() => T)): T
  • withEngine<T>(engine: Engine, operation: (() => Promise<T>)): Promise<T>

Generated using TypeDoc