UNPKG

@looker/wholly-artifact

Version:
91 lines (90 loc) 2.81 kB
import type { IArtifact, IUpdateArtifact } from '@looker/sdk'; export type SheetValues = any[]; export declare const noDate: Date; export declare const APP_JSON = "application/json"; export declare const nilCell = "\0"; export declare const addMinutes: (date: Date, minutes: number) => Date; export declare const stringer: (value: any) => any; export type RowValues = Record<string, any>; export type ColumnHeaders = string[]; export declare const rowPosition = "_row"; export interface IRowValidationError { message: string; type: 'error'; } export type RowValidationErrors = Record<string, IRowValidationError>; export declare enum RowAction { None = 0, Create = 1, Update = 2, Delete = 3 } export interface IRowModelProps extends RowValues { _row: number; _id: string; _updated: Date; $action: RowAction; $artifact: Partial<IArtifact>; } export interface IRowModel extends IRowModelProps { assign(values: any): IRowModel; keys(): ColumnHeaders; header(): ColumnHeaders; displayHeader(): ColumnHeaders; values(): SheetValues; prepare(): IRowModel; validate(): RowValidationErrors | undefined; typeCast(key: string, value: any): any; toObject(): Record<string, unknown>; fromObject(obj: Record<string, unknown>): IRowModel; toArtifact(): Partial<IUpdateArtifact>; fromArtifact(obj: Partial<IArtifact>): IRowModel; setUpdate(): boolean; setDelete(): boolean; setCreate(): boolean; isNew(): boolean; isStored(): boolean; namespace(): string; tableName(): string; makey(): string; } export declare abstract class RowModel<T extends IRowModel> implements IRowModel { _row: number; _id: string; _updated: Date; $artifact: Partial<IArtifact>; constructor(values?: any); isNew(): boolean; isStored(): boolean; private $_action; private static hide; private initFromArray; private initValues; tableName(): string; makey(): string; get key(): string; set key(value: string); private oops; get $action(): RowAction; set $action(value: RowAction); setCreate(): boolean; setUpdate(): boolean; setDelete(): boolean; keys(): ColumnHeaders; header(): ColumnHeaders; displayHeader(): ColumnHeaders; prepare(): T; values(): SheetValues; typeCast(key: string, value: any): any; assign(values: any): T; validate(): RowValidationErrors | undefined; toObject(): Record<string, unknown>; fromObject(obj: Record<string, unknown>): IRowModel; fromArtifact(obj: Partial<IArtifact>): IRowModel; private storageValues; toArtifact(): Partial<IUpdateArtifact>; abstract namespace(): string; } export type RowModelFactory<T extends IRowModel> = { new (values?: any): T; };