Skip to content

Latest commit

 

History

History
587 lines (324 loc) · 35.7 KB

Entity.EntityFromContext.md

File metadata and controls

587 lines (324 loc) · 35.7 KB

Powership / Modules / Entity / EntityFromContext

Interface: EntityFromContext<Context>

Entity.EntityFromContext

Type parameters

Name Type
Context extends AnyEntityTypesContext

Hierarchy

Table of contents

Properties

Methods

Properties

__context

__context: Context

Defined in

packages/entity/src/EntityInterfaces/EntityFromContext.ts:117


__isEntity

__isEntity: true

Defined in

packages/entity/src/EntityInterfaces/EntityFromContext.ts:116


addHooks

addHooks: (options: (hooks: EntityHooks<{}, AnyEntity>) => any) => EntityFromContext<Context>

Type declaration

▸ (options): EntityFromContext<Context>

Parameters
Name Type
options (hooks: EntityHooks<{}, AnyEntity>) => any
Returns

EntityFromContext<Context>

Defined in

packages/entity/src/EntityInterfaces/EntityFromContext.ts:110


addIndexRelation

addIndexRelation: <E, Name>(name: Name, entity: E) => EntityFromContext<EntityTypesContext<Omit<Context["originDefinition"], Name> & { [L in string]: Object }, Context["indexes"]>>

Type declaration

▸ <E, Name>(name, entity): EntityFromContext<EntityTypesContext<Omit<Context["originDefinition"], Name> & { [L in string]: Object }, Context["indexes"]>>

Type parameters
Name Type
E extends unknown
Name extends string
Parameters
Name Type
name Name
entity E
Returns

EntityFromContext<EntityTypesContext<Omit<Context["originDefinition"], Name> & { [L in string]: Object }, Context["indexes"]>>

Defined in

packages/entity/src/EntityInterfaces/EntityFromContext.ts:58


addRelation

addRelation: EntityAddRelation<EntityFromContext<Context>, Context>

Defined in

packages/entity/src/EntityInterfaces/EntityFromContext.ts:84


aliasPaths

aliasPaths: string[]

Defined in

packages/entity/src/EntityInterfaces/EntityFromContext.ts:70


conditionsDefinition

conditionsDefinition: EntityFilterConditionsDefinition<Context["originDefinition"]>

Defined in

packages/entity/src/EntityInterfaces/EntityFromContext.ts:72


createOne

createOne: Context["indexes"][number] extends I ? I extends unknown ? I extends { PK: readonly PK[] ; SK?: readonly SK[] } ? { condition: undefined | FilterRecord<Context["documentCreationInput"]> ; context: undefined | LoaderContext ; item: Context["documentCreationInput"] ; replace: undefined | boolean } : never : never : never extends Record<string, any> ? (options: Context["indexes"][number] extends I ? I extends unknown ? I extends { PK: readonly PK[] ; SK?: readonly SK[] } ? { condition: undefined | FilterRecord<Context["documentCreationInput"]> ; context: undefined | LoaderContext ; item: Context["documentCreationInput"] ; replace: undefined | boolean } : never : never : never) => Promise<{ created: boolean ; error?: null | string ; item: null | Context["document"] ; updated: boolean }> & _EntityLoaderUtils<Context["indexes"][number] extends I ? I extends unknown ? I extends { PK: readonly PK[] ; SK?: readonly SK[] } ? { condition: undefined | FilterRecord<Context["documentCreationInput"]> ; context: undefined | LoaderContext ; item: Context["documentCreationInput"] ; replace: undefined | boolean } : never : never : never, Context> : CreateOne<Context["documentCreationInput"], Context["document"], Context["indexes"]>

Inherited from

EntityLoaderMethods.createOne

Defined in

packages/entity/src/EntityInterfaces/EntityLoaderMethods.ts:58


databaseType

databaseType: GraphType<{ object: Context["outputDefinition"] }>

Defined in

packages/entity/src/EntityInterfaces/EntityFromContext.ts:76


deleteMany

deleteMany: Context["indexes"][number] extends I ? I extends unknown ? I extends { PK: readonly PK[] ; SK?: readonly SK[] } ? { condition: undefined | FilterRecord<Context["document"]> ; context: undefined | LoaderContext ; filter: Compute<UnionToIntersection<IndexFilterRecord<IndexField<PK, never>, IndexField<SK, undefined>> extends F ? F extends unknown ? { [K in string | number | symbol]?: F[K] } & { id?: PKSKValueType } : {} : {}>, 1> } : never : never : never extends Record<string, any> ? (options: Context["indexes"][number] extends I ? I extends unknown ? I extends { PK: readonly PK[] ; SK?: readonly SK[] } ? { condition: undefined | FilterRecord<Context["document"]> ; context: undefined | LoaderContext ; filter: Compute<UnionToIntersection<IndexFilterRecord<IndexField<PK, never>, IndexField<SK, undefined>> extends F ? F extends unknown ? { [K in string | number | symbol]?: F[K] } & { id?: PKSKValueType } : {} : {}>, 1> } : never : never : never) => Promise<{ deletedCount: number ; error?: null | string }> & _EntityLoaderUtils<Context["indexes"][number] extends I ? I extends unknown ? I extends { PK: readonly PK[] ; SK?: readonly SK[] } ? { condition: undefined | FilterRecord<Context["document"]> ; context: undefined | LoaderContext ; filter: Compute<UnionToIntersection<IndexFilterRecord<IndexField<PK, never>, IndexField<SK, undefined>> extends F ? F extends unknown ? { [K in string | number | symbol]?: F[K] } & { id?: PKSKValueType } : {} : {}>, 1> } : never : never : never, Context> : DeleteMany<Context["document"], Context["indexes"]>

Inherited from

EntityLoaderMethods.deleteMany

Defined in

packages/entity/src/EntityInterfaces/EntityLoaderMethods.ts:70


deleteOne

deleteOne: Context["indexes"][number] extends I ? I extends unknown ? I extends { PK: readonly PK[] ; SK?: readonly SK[] } ? { condition: undefined | FilterRecord<Context["document"]> ; context: undefined | LoaderContext ; filter: Compute<UnionToIntersection<IndexFilterRecord<IndexField<PK, never>, IndexField<SK, undefined>> extends F ? F extends unknown ? { [K in string | number | symbol]?: F[K] } & { id?: PKSKValueType } : {} : {}>, 1> } : never : never : never extends Record<string, any> ? (options: Context["indexes"][number] extends I ? I extends unknown ? I extends { PK: readonly PK[] ; SK?: readonly SK[] } ? { condition: undefined | FilterRecord<Context["document"]> ; context: undefined | LoaderContext ; filter: Compute<UnionToIntersection<IndexFilterRecord<IndexField<PK, never>, IndexField<SK, undefined>> extends F ? F extends unknown ? { [K in string | number | symbol]?: F[K] } & { id?: PKSKValueType } : {} : {}>, 1> } : never : never : never) => Promise<{ item: null | Context["document"] }> & _EntityLoaderUtils<Context["indexes"][number] extends I ? I extends unknown ? I extends { PK: readonly PK[] ; SK?: readonly SK[] } ? { condition: undefined | FilterRecord<Context["document"]> ; context: undefined | LoaderContext ; filter: Compute<UnionToIntersection<IndexFilterRecord<IndexField<PK, never>, IndexField<SK, undefined>> extends F ? F extends unknown ? { [K in string | number | symbol]?: F[K] } & { id?: PKSKValueType } : {} : {}>, 1> } : never : never : never, Context> : DeleteOne<Context["document"], Context["indexes"]>

Inherited from

EntityLoaderMethods.deleteOne

Defined in

packages/entity/src/EntityInterfaces/EntityLoaderMethods.ts:72


edgeType

edgeType: EdgeType<GraphType<{ object: Context["outputDefinition"] }>>

Defined in

packages/entity/src/EntityInterfaces/EntityFromContext.ts:78


extend

extend: ExtendEntity<EntityFromContext<Context>>

Defined in

packages/entity/src/EntityInterfaces/EntityFromContext.ts:112


extendInput

extendInput: ExtendObjectDefinition<{ object: Context["originDefinition"] }, { object: Context["originDefinition"] }>

Defined in

packages/entity/src/EntityInterfaces/EntityFromContext.ts:48


extendUpdate

extendUpdate: ExtendObjectDefinition<{ object: OverrideField<DescribeObjectDefinition<Context["originDefinition"]>, keyof Context["originDefinition"], { optional: true }> }, { object: OverrideField<DescribeObjectDefinition<Context["originDefinition"]>, keyof Context["originDefinition"], { optional: true }> }>

Defined in

packages/entity/src/EntityInterfaces/EntityFromContext.ts:53


findById

findById: Context["indexes"][number] extends I ? I extends unknown ? I extends { PK: readonly PK[] ; SK?: readonly SK[] } ? { condition: undefined | FilterRecord<Context["document"]> ; consistent: undefined | boolean ; context: undefined | LoaderContext ; id: string ; projection: undefined | string[] } : never : never : never extends Record<string, any> ? (options: Context["indexes"][number] extends I ? I extends unknown ? I extends { PK: readonly PK[] ; SK?: readonly SK[] } ? { condition: undefined | FilterRecord<Context["document"]> ; consistent: undefined | boolean ; context: undefined | LoaderContext ; id: string ; projection: undefined | string[] } : never : never : never) => Promise<{ item: null | Context["document"] }> & _EntityLoaderUtils<Context["indexes"][number] extends I ? I extends unknown ? I extends { PK: readonly PK[] ; SK?: readonly SK[] } ? { condition: undefined | FilterRecord<Context["document"]> ; consistent: undefined | boolean ; context: undefined | LoaderContext ; id: string ; projection: undefined | string[] } : never : never : never, Context> : FindById<Context["document"], Context["indexes"]>

Inherited from

EntityLoaderMethods.findById

Defined in

packages/entity/src/EntityInterfaces/EntityLoaderMethods.ts:74


findMany

findMany: Context["indexes"][number] extends I ? I extends unknown ? I extends { PK: readonly PK[] ; SK?: readonly SK[] } ? { after: undefined | string | IndexFilterRecord<IndexField<PK, never>, IndexField<SK, undefined>> extends R ? { [K in string | number | symbol]: R[K] } : {} ; condition: undefined | FilterRecord<Context["document"]> ; consistent: undefined | boolean ; context: undefined | LoaderContext ; filter: Compute<UnionToIntersection<IndexFilterRecord<IndexField<PK, never>, IndexField<SK, undefined>> extends F ? F extends unknown ? { [K in string | number | symbol]?: F[K] } & { id?: PKSKValueType } : {} : {}>, 1> ; first: undefined | number ; projection: undefined | string[] ; sort: undefined | QuerySort } : never : never : never extends Record<string, any> ? (options: Context["indexes"][number] extends I ? I extends unknown ? I extends { PK: readonly PK[] ; SK?: readonly SK[] } ? { after: undefined | string | IndexFilterRecord<IndexField<PK, never>, IndexField<SK, undefined>> extends R ? { [K in string | number | symbol]: R[K] } : {} ; condition: undefined | FilterRecord<Context["document"]> ; consistent: undefined | boolean ; context: undefined | LoaderContext ; filter: Compute<UnionToIntersection<IndexFilterRecord<IndexField<PK, never>, IndexField<SK, undefined>> extends F ? F extends unknown ? { [K in string | number | symbol]?: F[K] } & { id?: PKSKValueType } : {} : {}>, 1> ; first: undefined | number ; projection: undefined | string[] ; sort: undefined | QuerySort } : never : never : never) => Promise<{ items: Context["document"][] }> & _EntityLoaderUtils<Context["indexes"][number] extends I ? I extends unknown ? I extends { PK: readonly PK[] ; SK?: readonly SK[] } ? { after: undefined | string | IndexFilterRecord<IndexField<PK, never>, IndexField<SK, undefined>> extends R ? { [K in string | number | symbol]: R[K] } : {} ; condition: undefined | FilterRecord<Context["document"]> ; consistent: undefined | boolean ; context: undefined | LoaderContext ; filter: Compute<UnionToIntersection<IndexFilterRecord<IndexField<PK, never>, IndexField<SK, undefined>> extends F ? F extends unknown ? { [K in string | number | symbol]?: F[K] } & { id?: PKSKValueType } : {} : {}>, 1> ; first: undefined | number ; projection: undefined | string[] ; sort: undefined | QuerySort } : never : never : never, Context> : FindMany<Context["document"], Context["indexes"]>

Inherited from

EntityLoaderMethods.findMany

Defined in

packages/entity/src/EntityInterfaces/EntityLoaderMethods.ts:66


findOne

findOne: Context["indexes"][number] extends I ? I extends unknown ? I extends { PK: readonly PK[] ; SK?: readonly SK[] } ? { condition: undefined | FilterRecord<Context["document"]> ; consistent: undefined | boolean ; context: undefined | LoaderContext ; filter: Compute<UnionToIntersection<IndexFilterRecord<IndexField<PK, never>, IndexField<SK, undefined>> extends F ? F extends unknown ? { [K in string | number | symbol]?: F[K] } & { id?: PKSKValueType } : {} : {}>, 1> ; projection: undefined | string[] } : never : never : never extends Record<string, any> ? (options: Context["indexes"][number] extends I ? I extends unknown ? I extends { PK: readonly PK[] ; SK?: readonly SK[] } ? { condition: undefined | FilterRecord<Context["document"]> ; consistent: undefined | boolean ; context: undefined | LoaderContext ; filter: Compute<UnionToIntersection<IndexFilterRecord<IndexField<PK, never>, IndexField<SK, undefined>> extends F ? F extends unknown ? { [K in string | number | symbol]?: F[K] } & { id?: PKSKValueType } : {} : {}>, 1> ; projection: undefined | string[] } : never : never : never) => Promise<{ item: null | Context["document"] }> & _EntityLoaderUtils<Context["indexes"][number] extends I ? I extends unknown ? I extends { PK: readonly PK[] ; SK?: readonly SK[] } ? { condition: undefined | FilterRecord<Context["document"]> ; consistent: undefined | boolean ; context: undefined | LoaderContext ; filter: Compute<UnionToIntersection<IndexFilterRecord<IndexField<PK, never>, IndexField<SK, undefined>> extends F ? F extends unknown ? { [K in string | number | symbol]?: F[K] } & { id?: PKSKValueType } : {} : {}>, 1> ; projection: undefined | string[] } : never : never : never, Context> : FindOne<Context["document"], Context["indexes"]>

Inherited from

EntityLoaderMethods.findOne

Defined in

packages/entity/src/EntityInterfaces/EntityLoaderMethods.ts:64


hasAliases

Readonly hasAliases: boolean

Defined in

packages/entity/src/EntityInterfaces/EntityFromContext.ts:86


hooks

hooks: EntityHooks<{}, AnyEntity>

Defined in

packages/entity/src/EntityInterfaces/EntityFromContext.ts:114


indexGraphTypes

indexGraphTypes: Object

Index signature

▪ [K: string]: GraphType<{ object: ObjectDefinitionInput }>

Defined in

packages/entity/src/EntityInterfaces/EntityFromContext.ts:88


indexRelations

indexRelations: EntityIndexRelations

Defined in

packages/entity/src/EntityInterfaces/EntityFromContext.ts:95


indexes

indexes: Context["indexes"]

Defined in

packages/entity/src/EntityInterfaces/EntityFromContext.ts:42


inputType

inputType: GraphType<{ object: Omit<EntityDocumentBaseDef<true>, keyof Context["originDefinition"]> & Context["originDefinition"] }>

Defined in

packages/entity/src/EntityInterfaces/EntityFromContext.ts:32


name

name: string

Defined in

packages/entity/src/EntityInterfaces/EntityFromContext.ts:28


originType

originType: GraphType<{ object: Context["originDefinition"] }>

Defined in

packages/entity/src/EntityInterfaces/EntityFromContext.ts:30


paginate

paginate: Context["indexes"][number] extends I ? I extends unknown ? I extends { PK: readonly PK[] ; SK?: readonly SK[] } ? { after: undefined | string | IndexFilterRecord<IndexField<PK, never>, IndexField<SK, undefined>> extends R ? { [K in string | number | symbol]: R[K] } : {} ; condition: undefined | FilterRecord<Context["document"]> ; consistent: undefined | boolean ; context: undefined | LoaderContext ; filter: Compute<UnionToIntersection<IndexFilterRecord<IndexField<PK, never>, IndexField<SK, undefined>> extends F ? F extends unknown ? { [K in string | number | symbol]?: F[K] } & { id?: PKSKValueType } : {} : {}>, 1> ; first: undefined | number ; projection: undefined | string[] ; sort: undefined | QuerySort } : never : never : never extends Record<string, any> ? (options: Context["indexes"][number] extends I ? I extends unknown ? I extends { PK: readonly PK[] ; SK?: readonly SK[] } ? { after: undefined | string | IndexFilterRecord<IndexField<PK, never>, IndexField<SK, undefined>> extends R ? { [K in string | number | symbol]: R[K] } : {} ; condition: undefined | FilterRecord<Context["document"]> ; consistent: undefined | boolean ; context: undefined | LoaderContext ; filter: Compute<UnionToIntersection<IndexFilterRecord<IndexField<PK, never>, IndexField<SK, undefined>> extends F ? F extends unknown ? { [K in string | number | symbol]?: F[K] } & { id?: PKSKValueType } : {} : {}>, 1> ; first: undefined | number ; projection: undefined | string[] ; sort: undefined | QuerySort } : never : never : never) => Promise<{ edges: { cursor: string ; node: Context["document"] }[] ; pageInfo: { endCursor: undefined | string ; hasNextPage: boolean ; hasPreviousPage: boolean ; startCursor: undefined | string } }> & _EntityLoaderUtils<Context["indexes"][number] extends I ? I extends unknown ? I extends { PK: readonly PK[] ; SK?: readonly SK[] } ? { after: undefined | string | IndexFilterRecord<IndexField<PK, never>, IndexField<SK, undefined>> extends R ? { [K in string | number | symbol]: R[K] } : {} ; condition: undefined | FilterRecord<Context["document"]> ; consistent: undefined | boolean ; context: undefined | LoaderContext ; filter: Compute<UnionToIntersection<IndexFilterRecord<IndexField<PK, never>, IndexField<SK, undefined>> extends F ? F extends unknown ? { [K in string | number | symbol]?: F[K] } & { id?: PKSKValueType } : {} : {}>, 1> ; first: undefined | number ; projection: undefined | string[] ; sort: undefined | QuerySort } : never : never : never, Context> : Paginate<Context["document"], Context["indexes"]>

Inherited from

EntityLoaderMethods.paginate

Defined in

packages/entity/src/EntityInterfaces/EntityLoaderMethods.ts:68


paginationType

paginationType: PaginationType<GraphType<{ object: Context["outputDefinition"] }>>

Defined in

packages/entity/src/EntityInterfaces/EntityFromContext.ts:97


parse

parse: (...args: [input: any, options?: FieldParserConfig]) => Context["document"]

Type declaration

▸ (...args): Context["document"]

Parameters
Name Type
...args [input: any, options?: FieldParserConfig]
Returns

Context["document"]

Defined in

packages/entity/src/EntityInterfaces/EntityFromContext.ts:99


setOption

setOption: <Key, V>(optionName: Key, value: V) => EntityFromContext<Context>

Type declaration

▸ <Key, V>(optionName, value): EntityFromContext<Context>

Type parameters
Name Type
Key extends string | number | symbol
V V
Parameters
Name Type
optionName Key
value V
Returns

EntityFromContext<Context>

Defined in

packages/entity/src/EntityInterfaces/EntityFromContext.ts:103


transporter

transporter: undefined | Transporter<any>

Defined in

packages/entity/src/EntityInterfaces/EntityFromContext.ts:108


type

type: GraphType<{ object: Context["outputDefinition"] }>

Defined in

packages/entity/src/EntityInterfaces/EntityFromContext.ts:44


updateMany

updateMany: Context["indexes"][number] extends I ? I extends unknown ? I extends { PK: readonly PK[] ; SK?: readonly SK[] } ? { condition: undefined | FilterRecord<Context["document"]> ; context: undefined | LoaderContext ; filter: Compute<UnionToIntersection<IndexFilterRecord<IndexField<PK, never>, IndexField<SK, undefined>> extends F ? F extends unknown ? { [K in string | number | symbol]?: F[K] } & { id?: PKSKValueType } : {} : {}>, 1> ; update: UpdateExpression<Context["document"]> ; upsert: undefined | boolean } : never : never : never extends Record<string, any> ? (options: Context["indexes"][number] extends I ? I extends unknown ? I extends { PK: readonly PK[] ; SK?: readonly SK[] } ? { condition: undefined | FilterRecord<Context["document"]> ; context: undefined | LoaderContext ; filter: Compute<UnionToIntersection<IndexFilterRecord<IndexField<PK, never>, IndexField<SK, undefined>> extends F ? F extends unknown ? { [K in string | number | symbol]?: F[K] } & { id?: PKSKValueType } : {} : {}>, 1> ; update: UpdateExpression<Context["document"]> ; upsert: undefined | boolean } : never : never : never) => Promise<{ error?: null | string ; modifiedCount: null | number ; upsertedId: null | string }> & _EntityLoaderUtils<Context["indexes"][number] extends I ? I extends unknown ? I extends { PK: readonly PK[] ; SK?: readonly SK[] } ? { condition: undefined | FilterRecord<Context["document"]> ; context: undefined | LoaderContext ; filter: Compute<UnionToIntersection<IndexFilterRecord<IndexField<PK, never>, IndexField<SK, undefined>> extends F ? F extends unknown ? { [K in string | number | symbol]?: F[K] } & { id?: PKSKValueType } : {} : {}>, 1> ; update: UpdateExpression<Context["document"]> ; upsert: undefined | boolean } : never : never : never, Context> : UpdateMany<Context["document"], Context["indexes"]>

Inherited from

EntityLoaderMethods.updateMany

Defined in

packages/entity/src/EntityInterfaces/EntityLoaderMethods.ts:76


updateOne

updateOne: Context["indexes"][number] extends I ? I extends unknown ? I extends { PK: readonly PK[] ; SK?: readonly SK[] } ? { condition: undefined | FilterRecord<Context["document"]> ; context: undefined | LoaderContext ; filter: Compute<UnionToIntersection<IndexFilterRecord<IndexField<PK, never>, IndexField<SK, undefined>> extends F ? F extends unknown ? { [K in string | number | symbol]?: F[K] } & { id?: PKSKValueType } : {} : {}>, 1> ; update: UpdateExpression<Context["document"]> ; upsert: undefined | boolean } : never : never : never extends Record<string, any> ? (options: Context["indexes"][number] extends I ? I extends unknown ? I extends { PK: readonly PK[] ; SK?: readonly SK[] } ? { condition: undefined | FilterRecord<Context["document"]> ; context: undefined | LoaderContext ; filter: Compute<UnionToIntersection<IndexFilterRecord<IndexField<PK, never>, IndexField<SK, undefined>> extends F ? F extends unknown ? { [K in string | number | symbol]?: F[K] } & { id?: PKSKValueType } : {} : {}>, 1> ; update: UpdateExpression<Context["document"]> ; upsert: undefined | boolean } : never : never : never) => Promise<{ created: boolean ; error?: null | string ; item: null | Context["document"] ; updated: boolean }> & _EntityLoaderUtils<Context["indexes"][number] extends I ? I extends unknown ? I extends { PK: readonly PK[] ; SK?: readonly SK[] } ? { condition: undefined | FilterRecord<Context["document"]> ; context: undefined | LoaderContext ; filter: Compute<UnionToIntersection<IndexFilterRecord<IndexField<PK, never>, IndexField<SK, undefined>> extends F ? F extends unknown ? { [K in string | number | symbol]?: F[K] } & { id?: PKSKValueType } : {} : {}>, 1> ; update: UpdateExpression<Context["document"]> ; upsert: undefined | boolean } : never : never : never, Context> : UpdateOne<Context["document"], Context["indexes"]>

Inherited from

EntityLoaderMethods.updateOne

Defined in

packages/entity/src/EntityInterfaces/EntityLoaderMethods.ts:78


usedOptions

usedOptions: Context["options"]

Defined in

packages/entity/src/EntityInterfaces/EntityFromContext.ts:40

Methods

getDocumentId

getDocumentId(doc): string

Parameters

Name Type
doc Record<string, any>

Returns

string

Defined in

packages/entity/src/EntityInterfaces/EntityFromContext.ts:80


getIndexFields

getIndexFields(doc): CommonIndexFields

Parameters

Name Type
doc Record<string, any>

Returns

CommonIndexFields

Defined in

packages/entity/src/EntityInterfaces/EntityFromContext.ts:82


parseDocumentIndexes

parseDocumentIndexes(doc): ParsedDocumentIndexes

Parameters

Name Type
doc Record<string, any>

Returns

ParsedDocumentIndexes

Defined in

packages/entity/src/EntityInterfaces/EntityFromContext.ts:101