-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypings.d.ts
259 lines (223 loc) · 6.15 KB
/
typings.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
249
250
251
252
253
254
255
256
257
258
259
/// <reference types="zone.js" />
/// <reference types="@types/meteor" />
/// <reference types="@types/underscore" />
/// <reference types="@types/chai" />
/// <reference types="@types/mocha" />
declare module "*.html" {
const template: string;
export default template;
}
declare module "*.scss" {
const style: string;
export default style;
}
declare module "*.less" {
const style: string;
export default style;
}
declare module "*.css" {
const style: string;
export default style;
}
declare module "*.sass" {
const style: string;
export default style;
}
declare module "meteor/hwillson:stub-collections" {
import { Mongo } from "meteor/mongo";
interface IStubCollections {
stub(collection: Mongo.Collection);
restore();
}
const StubCollections: IStubCollections;
export default StubCollections;
}
declare module "chai-spies" {
const chaiSpies: (chai: any, utils: any) => void;
export = chaiSpies;
}
interface SpyCalledWith extends Chai.Assertion {
(...args: any[]): void;
exactly(...args: any[]): void;
}
interface SpyCalledAlways extends Chai.Assertion {
with: SpyCalledWith;
}
interface SpyCalledAt {
most(n: number): void;
least(n: number): void;
}
interface SpyCalled {
(n?: number): void;
/**
* Assert that a spy has been called exactly once
*
* @api public
*/
once: any;
/**
* Assert that a spy has been called exactly twice.
*
* @api public
*/
twice: any;
/**
* Assert that a spy has been called exactly `n` times.
*
* @param {Number} n times
* @api public
*/
exactly(n: number): void;
with: SpyCalledWith;
/**
* Assert that a spy has been called `n` or more times.
*
* @param {Number} n times
* @api public
*/
min(n: number): void;
/**
* Assert that a spy has been called `n` or fewer times.
*
* @param {Number} n times
* @api public
*/
max(n: number): void;
at: SpyCalledAt;
above(n: number): void;
/**
* Assert that a spy has been called more than `n` times.
*
* @param {Number} n times
* @api public
*/
gt(n: number): void;
below(n: number): void;
/**
* Assert that a spy has been called less than `n` times.
*
* @param {Number} n times
* @api public
*/
lt(n: number): void;
}
declare namespace Chai {
interface ChaiStatic {
spy(): any;
}
interface Assertion {
called: SpyCalled;
always: SpyCalledAlways;
}
}
// Type definitions for aldeed:simple-schema meteor package
// Project: https://atmospherejs.com/aldeed/simple-schema
// Definitions by: Dave Allen <https://github.com/fullflavedave>
interface IAldeedSimpleSchemaPropertyAttributes {
type: any | any[];
label?: string | Function;
min?: number | Date;
max?: number | Date;
exclusiveMin?: boolean;
exclusiveMax?: boolean;
minCount?: number;
maxCount?: number;
optional?: boolean;
allowedValues?: any[];
regEx?: RegExp;
blackbox?: boolean;
trim?: boolean;
custom?: Function;
defaultValue?: any;
autoValue?: Function;
decimal?: boolean;
/**
* Index for collection
* Can be true, -1 or 1
* @type {number|boolean}
*/
index?:number|boolean;
/**
* Unique flag for index
* @type {boolean}
*/
unique?: boolean;
/**
* Sparce flag for index
* @type {boolean}
*/
sparse?: boolean;
}
interface SimpleSchemaDefinition {
[property: string]: IAldeedSimpleSchemaPropertyAttributes;
}
interface ValidateOptions {
modifier?: boolean;
upsert?: boolean;
extendedCustomContext: { [key: string]: any };
}
interface SimpleSchemaCleanOptions {
filter?: boolean;
autoConvert?: boolean;
removeEmptyStrings?: boolean;
trimStrings?: boolean;
getAutoValues?: boolean;
isModifier?: boolean;
extendedAutoValueContext?: any;
}
interface SimpleSchema_Static {
new(definition: SimpleSchemaDefinition|SimpleSchema_Instance[]): SimpleSchema_Instance;
extendOptions(options: { [option: string]: any }): void;
addValidator(validator: Function): void;
messages(messageKeysAndTexts: { [errorKey: string]: string; /** Text for that error **/ } | { exp: RegExp; msg: string; }[]): void;
debug(isDebugging: boolean): void;
RegEx: { Email: RegExp, WeakDomain: RegExp, Url: RegExp, Domain: RegExp, IP: RegExp, IPv4: RegExp, IPv6: RegExp, Id: RegExp, ZipCode: RegExp};
}
interface SimpleSchema_Instance {
messages(messages: Object): void;
schema(): SimpleSchema_Static;
validate(obj: any, options?: ValidateOptions): boolean;
validateOne(obj: any, key: string, options: ValidateOptions): boolean;
clean(obj: any, options?: SimpleSchemaCleanOptions): void;
addValidator(validator: Function): void;
newContext(): {
validate(obj: any, options?: ValidateOptions): boolean;
validateOne(obj: any, key: string, options: ValidateOptions): boolean;
isValid(): boolean;
invalidKeys(): { name: string; type: any }[];
keyIsInvalid(key: string): boolean;
keyErrorMessage(key: string): string;
resetValidation(): void;
};
validator(): (...args: any[]) => boolean;
}
declare const SimpleSchema: SimpleSchema_Static;
declare module 'meteor/aldeed:simple-schema' {
export const SimpleSchema: SimpleSchema_Static;
type SimpleSchema = SimpleSchema_Instance;
}
// Type definitions for mdg:validated-method meteor package
// Project: https://atmospherejs.com/mdg/validated-method
// Definitions by: Dave Allen <https://github.com/fullflavedave>
interface ValidatedMethod_Static {
new(options: {
name: string;
mixins?: Function[];
validate: (args: { [key: string]: any; }) => void; // returned from SimpleSchemaInstance.validator() method;
applyOptions?: {
noRetry: boolean;
returnStubValue: boolean;
throwStubExceptions: boolean;
onResultReceived: (result: any) => void;
[key: string]: any };
run: (args: { [key: string]: any; }) => void;
}): ValidatedMethod_Instance;
}
interface ValidatedMethod_Instance {
call(args: { [key: string]: any; }, cb?: (error: any, result: any) => void ): void;
_execute(context: { [key: string]: any; }, args: { [key: string]: any; }): void;
}
declare const ValidatedMethod: ValidatedMethod_Static;
declare module 'meteor/mdg:validated-method' {
export const ValidatedMethod: ValidatedMethod_Static;
}