Skip to content

Commit d0e8e33

Browse files
author
Vlad Balin
authored
Merge pull request #6 from Volicon/f/export-d-ts
F/export d ts
2 parents c5df061 + 83eb79d commit d0e8e33

File tree

139 files changed

+4481
-48884
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

139 files changed

+4481
-48884
lines changed

dist/collection/add.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { CollectionTransaction, CollectionOptions, CollectionCore } from './commons';
2+
export interface AddOptions extends CollectionOptions {
3+
at?: number;
4+
}
5+
export declare function addTransaction(collection: CollectionCore, items: any, options: AddOptions, merge?: boolean): CollectionTransaction;

dist/collection/commons.d.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import { Record } from '../record';
2+
import { Owner, Transaction, TransactionOptions, Transactional } from '../transactions';
3+
import { eventsApi } from '../object-plus';
4+
export interface CollectionCore extends Transactional, Owner {
5+
_byId: IdIndex;
6+
models: Record[];
7+
model: typeof Record;
8+
idAttribute: string;
9+
_comparator: Comparator;
10+
get(objOrId: string | Record | Object): Record;
11+
_itemEvents?: eventsApi.EventMap;
12+
_shared: number;
13+
_aggregationError: Record[];
14+
_log(level: string, text: string, value: any): any;
15+
}
16+
export declare type Elements = (Object | Record)[];
17+
export interface CollectionOptions extends TransactionOptions {
18+
sort?: boolean;
19+
}
20+
export declare type Comparator = (a: Record, b: Record) => number;
21+
export declare function dispose(collection: CollectionCore): Record[];
22+
export declare function convertAndAquire(collection: CollectionCore, attrs: {} | Record, options: any): Record;
23+
export declare function free(owner: CollectionCore, child: Record): void;
24+
export declare function freeAll(collection: CollectionCore, children: Record[]): Record[];
25+
export declare function sortElements(collection: CollectionCore, options: CollectionOptions): boolean;
26+
export interface IdIndex {
27+
[id: string]: Record;
28+
}
29+
export declare function addIndex(index: IdIndex, model: Record): void;
30+
export declare function removeIndex(index: IdIndex, model: Record): void;
31+
export declare function updateIndex(index: IdIndex, model: Record): void;
32+
export declare class CollectionTransaction implements Transaction {
33+
object: CollectionCore;
34+
isRoot: boolean;
35+
added: Record[];
36+
removed: Record[];
37+
nested: Transaction[];
38+
sorted: boolean;
39+
constructor(object: CollectionCore, isRoot: boolean, added: Record[], removed: Record[], nested: Transaction[], sorted: boolean);
40+
commit(initiator?: Transactional): void;
41+
}
42+
export declare function logAggregationError(collection: CollectionCore): void;

dist/collection/index.d.ts

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import { EventMap, EventsDefinition } from '../object-plus';
2+
import { Transactional, CloneOptions, TransactionOptions, TransactionalDefinition } from '../transactions';
3+
import { Record, AggregatedType } from '../record';
4+
import { IdIndex, CollectionCore, CollectionTransaction } from './commons';
5+
export declare type GenericComparator = string | ((x: Record) => number) | ((a: Record, b: Record) => number);
6+
export interface CollectionOptions extends TransactionOptions {
7+
comparator?: GenericComparator;
8+
model?: typeof Record;
9+
}
10+
export interface CollectionDefinition extends TransactionalDefinition {
11+
model?: Record;
12+
itemEvents?: EventsDefinition;
13+
_itemEvents?: EventMap;
14+
}
15+
export declare class Collection extends Transactional implements CollectionCore {
16+
_shared: number;
17+
_aggregationError: Record[];
18+
static Subset: typeof Collection;
19+
static Refs: typeof Collection;
20+
static _SubsetOf: typeof Collection;
21+
createSubset(models: any, options: any): any;
22+
static predefine(): any;
23+
static define(protoProps?: CollectionDefinition, staticProps?: any): any;
24+
static subsetOf: (collectionReference: any) => any;
25+
_itemEvents: EventMap;
26+
models: Record[];
27+
readonly __inner_state__: Record[];
28+
_byId: IdIndex;
29+
comparator: GenericComparator;
30+
getStore(): Transactional;
31+
_store: Transactional;
32+
_comparator: (a: Record, b: Record) => number;
33+
_onChildrenChange(record: Record, options?: TransactionOptions, initiator?: Transactional): void;
34+
get(objOrId: string | Record | Object): Record;
35+
each(iteratee: (val: Record, key: number) => void, context?: any): void;
36+
map<T>(iteratee: (val: Record, key: number) => T, context?: any): T[];
37+
_validateNested(errors: {}): number;
38+
model: typeof Record;
39+
idAttribute: string;
40+
constructor(records?: (Record | {})[], options?: CollectionOptions, shared?: number);
41+
initialize(): void;
42+
readonly length: number;
43+
first(): Record;
44+
last(): Record;
45+
at(a_index: number): Record;
46+
clone(options?: CloneOptions): this;
47+
toJSON(): Object[];
48+
set(elements?: ElementsArg, options?: TransactionOptions): this;
49+
dispose(): void;
50+
reset(a_elements?: ElementsArg, options?: TransactionOptions): Record[];
51+
add(a_elements: ElementsArg, options?: TransactionOptions): Record[];
52+
remove(recordsOrIds: any, options?: TransactionOptions): Record[] | Record;
53+
_createTransaction(a_elements: ElementsArg, options?: TransactionOptions): CollectionTransaction;
54+
static _attribute: typeof AggregatedType;
55+
pluck(key: string): any[];
56+
sort(options?: TransactionOptions): this;
57+
push(model: any, options: any): Record[];
58+
pop(options: any): Record;
59+
unshift(model: any, options: any): Record[];
60+
shift(options?: CollectionOptions): Record;
61+
slice(): Record[];
62+
indexOf(modelOrId: any): number;
63+
modelId(attrs: {}): any;
64+
toggle(model: Record, a_next?: boolean): boolean;
65+
_log(level: string, text: string, value: any): void;
66+
getClassName(): string;
67+
}
68+
export declare type ElementsArg = Object | Record | Object[] | Record[];

dist/collection/remove.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { Record } from '../record';
2+
import { CollectionCore } from './commons';
3+
import { TransactionOptions } from '../transactions';
4+
export declare function removeOne(collection: CollectionCore, el: Record | {} | string, options: TransactionOptions): Record;
5+
export declare function removeMany(collection: CollectionCore, toRemove: any[], options: any): any[];

dist/collection/set.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { CollectionTransaction, CollectionOptions, CollectionCore, Elements } from './commons';
2+
export declare function emptySetTransaction(collection: CollectionCore, items: Elements, options: CollectionOptions, silent?: boolean): CollectionTransaction;
3+
export declare function setTransaction(collection: any, items: any, options: any): CollectionTransaction;

dist/index.d.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export * from './object-plus';
2+
export * from './collection';
3+
export * from './relations';
4+
export * from './record';
5+
export declare const on: any, off: any, trigger: any, once: any, listenTo: any, stopListening: any, listenToOnce: any;
6+
import { Record as Model } from './record';
7+
import { Mixable as Class } from './object-plus/';
8+
export { Model, Class };
9+
import { ChainableAttributeSpec } from './record';
10+
export declare function value(x: any): ChainableAttributeSpec;
11+
export declare function transaction<F extends Function>(method: F): F;

0 commit comments

Comments
 (0)