UNPKG

type-arango

Version:

ArangoDB Foxx decorators and utilities for TypeScript

61 lines (60 loc) 2.34 kB
import { DecoratorId, DocumentAttribute, DocumentData, DocumentOptions, EventMethod, RelationStructure, RoleObject, Roles, SchemaStructure } from '../types'; import { Entity } from '../index'; import { Collection } from './Collection.model'; /** * Finds a document instance for a decorated class */ export declare function findDocumentForContainer<T = typeof Entity>(someClass: new () => T): Document<T> | undefined; /** * Returns the respective document instance for a decorated class */ export declare function getDocumentForContainer<T = typeof Entity>(someClass: new () => T): Document<T>; export declare class Document<T = any> { Class: new () => T; col?: Collection; name: string; isEdge: boolean; options: DocumentOptions; attribute: DocumentAttribute; schema: SchemaStructure; relation: RelationStructure<Document>; roles: string[]; roleStripAttributes: RoleObject; private decorator; private forClientMap; private fromClientMap; constructor(Class: new () => T); makeEdge(): void; decorate(decorator: DecoratorId, data: any): any[]; get attributeIdentifierObject(): DocumentData; get indexes(): import("../types").DecoratorObject[] | undefined; get joi(): import("joi").ObjectSchema; forClient(doc: DocumentData, arg: any): DocumentData; fromClient(doc: DocumentData, arg: any): DocumentData; /** * Emit before event */ emitBefore(method: EventMethod, ...args: any[]): any; /** * Emit after event */ emitAfter(method: EventMethod, ...args: any[]): any; /** * Resolves one or more related entities */ resolveRelation(data: DocumentData | Entity, attribute: string, arg?: string[]): any; /** * Creates an array of attributes that can't be read or written for every role used in the collection * this.roleStripAttributes = {user:{read:[],write:['readOnlyAttribute']} */ buildAttributeRoles(): void; /** * Creates arrays of document attributes that can be read or written */ stripAttributeList(providedRoles: Roles, method: 'read' | 'write'): string[]; /** * Setup attribute names for doc.attributeIdentifierObject before finalizing */ complete(): void; finalize(): void; }