This repository has been archived by the owner on Apr 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 95
/
jaydata.d.ts
249 lines (210 loc) · 8.05 KB
/
jaydata.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
declare module $data {
interface IPromise<T> extends Object {
then: {
(handler: (args: T) => void ): IPromise<any>;
(handler: (args: T) => any): IPromise<any>;
};
fail: {
(handler: (args: T) => void ): IPromise<any>;
(handler: (args: T) => any): IPromise<any>;
};
valueOf(): any;
}
export class Base implements Object {
constructor(...params: any[]);
getType: () => Base;
}
interface Event extends Object {
attach(eventHandler: (sender: any, event: any) => void ): void;
detach(eventHandler: () => void ): void;
fire(e: any, sender: any): void;
}
export class Entity extends Base {
constructor();
constructor(initData: {});
entityState: number;
changedProperties: any[];
propertyChanging: Event;
propertyChanged: Event;
propertyValidationError: Event;
isValid: boolean;
}
export class Queryable<T extends Entity> implements Object {
filter(predicate: (it: T) => boolean): Queryable<T>;
filter(predicate: (it: T) => boolean, thisArg: any): Queryable<T>;
map(projection: (it: T) => any): Queryable<any>;
length(): $data.IPromise<Number>;
length(handler: (result: number) => void ): $data.IPromise<Number>;
length(handler: { success?: (result: number) => void; error?: (result: any) => void; }): $data.IPromise<Number>;
forEach(handler: (it: any) => void ): $data.IPromise<T>;
toArray(): $data.IPromise<T[]>;
toArray(handler: (result: T[]) => void ): $data.IPromise<T[]>;
toArray(handler: { success?: (result: T[]) => void; error?: (result: any) => void; }): $data.IPromise<T[]>;
single(predicate: (it: T) => boolean, params?: any, handler?: (result: T) => void ): $data.IPromise<T>;
single(predicate: (it: T) => boolean, params?: any, handler?: { success?: (result: T) => void; error?: (result: any) => void; }): $data.IPromise<T>;
take(amout: number): Queryable<T>;
skip(amout: number): Queryable<T>;
order(selector: string): Queryable<T>;
orderBy(predicate: (it: any) => any): Queryable<T>;
orderByDescending(predicate: (it: any) => any): Queryable<T>;
first(predicate: (it: T) => boolean, params?: any, handler?: (result: T) => void ): $data.IPromise<T>;
first(predicate: (it: T) => boolean, params?: any, handler?: { success?: (result: T) => void; error?: (result: any) => void; }): $data.IPromise<T>;
include(selector: string): Queryable<T>;
removeAll(): $data.IPromise<Number>;
removeAll(handler: (count: number) => void ): $data.IPromise<Number>;
removeAll(handler: { success?: (result: number) => void; error?: (result: any) => void; }): $data.IPromise<Number>;
}
export class EntitySet<T extends Entity> extends Queryable<T> {
tableName: string;
collectionName: string;
add(item: T): T;
add(initData: {}): T;
attach(item: T): void;
attach(item: {}): void;
attachOrGet(item: T): T;
attachOrGet(item: {}): T;
detach(item: T): void;
detach(item: {}): void;
remove(item: T): void;
remove(item: {}): void;
elementType: T;
}
export class EntityContext implements Object {
constructor(config: any);
constructor(config: { name: string; oDataServiceHost: string; MaxDataServiceVersion: string; });
constructor(config: { name: string; oDataServiceHost?: string; databaseName?: string; localStoreName?: string; user?: string; password?: string; });
onReady(): $data.IPromise<EntityContext>;
onReady(handler: (currentContext: EntityContext) => void ): $data.IPromise<EntityContext>;
saveChanges(): $data.IPromise<Number>;
saveChanges(handler: (result: number) => void ): $data.IPromise<Number>;
saveChanges(cb: { success?: (result: number) => void; error?: (result: any) => void; }): $data.IPromise<Number>;
add(item: Entity): Entity;
attach(item: Entity): void;
attachOrGet(item: Entity): Entity;
detach(item: Entity): void;
remove(item: Entity): void;
}
export class Blob implements Object {
}
export class Guid implements Object {
constructor(value: string);
value: string;
}
export class SimpleBase implements Object {
constructor(initData: any);
}
export class Geospatial extends SimpleBase {
constructor(initData: any);
type: String;
}
export class Geography extends Geospatial {
constructor(initData: any);
}
export class GeographyPoint extends Geography {
constructor(initData: any);
constructor(coordinates: any[]);
constructor(longitude: number, latitude: number);
longitude: number;
latitude: number;
coordinates: any[];
}
export class GeographyLineString extends Geography {
constructor(initData: any);
constructor(coordinates: any[]);
coordinates: any[];
}
export class GeographyPolygon extends Geography {
constructor(initData: any);
constructor(coordinates: any[]);
coordinates: any[];
}
export class GeographyMultiPoint extends Geography {
constructor(initData: any);
constructor(coordinates: any[]);
coordinates: any[];
}
export class GeographyMultiLineString extends Geography {
constructor(initData: any);
constructor(coordinates: any[]);
coordinates: any[];
}
export class GeographyMultiPolygon extends Geography {
constructor(initData: any);
constructor(coordinates: any[]);
coordinates: any[];
}
export class GeographyCollection extends Geography {
constructor(initData: any);
constructor(geometries: any[]);
geometries: any[];
}
export class Geometry extends Geospatial {
constructor(initData: any);
}
export class GeometryPoint extends Geometry {
constructor(initData: any);
constructor(coordinates: any[]);
constructor(x: number, y: number);
x: number;
y: number;
coordinates: any[];
}
export class GeometryLineString extends Geometry {
constructor(initData: any);
constructor(coordinates: any[]);
coordinates: any[];
}
export class GeometryPolygon extends Geometry {
constructor(initData: any);
constructor(coordinates: any[]);
coordinates: any[];
}
export class GeometryMultiPoint extends Geometry {
constructor(initData: any);
constructor(coordinates: any[]);
coordinates: any[];
}
export class GeometryMultiLineString extends Geometry {
constructor(initData: any);
constructor(coordinates: any[]);
coordinates: any[];
}
export class GeometryMultiPolygon extends Geometry {
constructor(initData: any);
constructor(coordinates: any[]);
coordinates: any[];
}
export class GeometryCollection extends Geography {
constructor(initData: any);
constructor(geometries: any[]);
geometries: any[];
}
}
declare module Q {
export var resolve: (p: any) => $data.IPromise<any>;
export var when: (p: $data.IPromise<any>, then?: () => any, fail?: () => any) => $data.IPromise<any>;
export var all: (p: $data.IPromise<any>[]) => $data.IPromise<any>;
export var allResolved: (p: $data.IPromise<any>[]) => $data.IPromise<any>;
export var fcall: (handler: () => any) => $data.IPromise<any>;
}
interface String {
contains(s: string): boolean;
startsWith(s: string): boolean;
endsWith(s: string): boolean;
strLength(): number;
indexOf(s: string): number;
concat(s: string): string;
}
interface Date {
day(): number;
hour(): number;
minute(): number;
month(): number;
second(): number;
year(): number;
}
interface Number {
round(): number;
floor(): number;
ceiling(): number;
}