├── .gitignore
├── .travis.yml
├── 1.2
├── browser.d.ts
├── header.d.ts
├── main.d.ts
├── packages
│ ├── accounts-base.d.ts
│ ├── accounts-base_browser.d.ts
│ ├── accounts-base_main.d.ts
│ ├── blaze_browser.d.ts
│ ├── browser-policy-common.d.ts
│ ├── check.d.ts
│ ├── ddp-rate-limiter_main.d.ts
│ ├── ddp.d.ts
│ ├── ejson.d.ts
│ ├── email_main.d.ts
│ ├── http.d.ts
│ ├── meteor.d.ts
│ ├── meteor_browser.d.ts
│ ├── meteor_main.d.ts
│ ├── mongo.d.ts
│ ├── mongo_main.d.ts
│ ├── random.d.ts
│ ├── reactive-var.d.ts
│ ├── session_browser.d.ts
│ ├── templating_browser.d.ts
│ ├── tiny-test.d.ts
│ ├── tools_main.d.ts
│ └── tracker_browser.d.ts
└── typings.json
├── 1.3
├── browser.d.ts
├── header.d.ts
├── main.d.ts
├── packages
│ ├── check.d.ts
│ └── meteor.d.ts
└── typings.json
├── 1.4
├── browser.d.ts
├── header.d.ts
├── main.d.ts
├── packages
│ ├── accounts-base_browser.d.ts
│ ├── accounts-base_main.d.ts
│ └── meteor_browser.d.ts
├── test
│ ├── test.ts
│ └── tsconfig.json
└── typings.json
├── README.md
├── gulpfile.js
├── package.json
├── tslint.json
└── typings.json
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 | *.log
3 | out/
4 | typings
5 | .idea
6 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | node_js: "node"
3 | script: npm install && npm run build+test
4 |
--------------------------------------------------------------------------------
/1.2/browser.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 | interface URLS {
3 | resetPassword: (token: string) => string;
4 | verifyEmail: (token: string) => string;
5 | enrollAccount: (token: string) => string;
6 | }
7 |
8 | declare module Accounts {
9 | var urls: URLS;
10 |
11 | function user(): Meteor.User;
12 | function userId(): string;
13 |
14 | function createUser(options: {
15 | username?: string;
16 | email?: string;
17 | password?: string;
18 | profile?: Object;
19 | }, callback?: Function): string;
20 |
21 | function config(options: {
22 | sendVerificationEmail?: boolean;
23 | forbidClientAccountCreation?: boolean;
24 | restrictCreationByEmailDomain?: string | Function;
25 | loginExpirationInDays?: number;
26 | oauthSecretKey?: string;
27 | }): void;
28 |
29 | function onLogin(func: Function): { stop: () => void };
30 | function onLoginFailure(func: Function): { stop: () => void };
31 |
32 | function loginServicesConfigured(): boolean;
33 | function onPageLoadLogin(func: Function): void;
34 | }
35 |
36 | declare module Accounts {
37 | function changePassword(oldPassword: string, newPassword: string, callback?: Function): void;
38 | function forgotPassword(options: {
39 | email?: string;
40 | }, callback?: Function): void;
41 | function resetPassword(token: string, newPassword: string, callback?: Function): void;
42 | function verifyEmail(token: string, callback?: Function): void;
43 |
44 | function onEmailVerificationLink(callback: Function): void;
45 | function onEnrollmentLink(callback: Function): void;
46 | function onResetPasswordLink(callback: Function): void;
47 |
48 | function loggingIn(): boolean;
49 | function logout(callback?: Function): void;
50 | function logoutOtherClients(callback?: Function): void;
51 |
52 | var ui: {
53 | config(options: {
54 | requestPermissions?: Object;
55 | requestOfflineToken?: Object;
56 | forceApprovalPrompt?: Object;
57 | passwordSignupFields?: string;
58 | }): void;
59 | };
60 | }
61 |
62 | ///
63 |
64 | declare module Blaze {
65 | var View: ViewStatic;
66 |
67 | interface ViewStatic {
68 | new (name?: string, renderFunction?: Function): View;
69 | }
70 |
71 | interface View {
72 | name: string;
73 | parentView: View;
74 | isCreated: boolean;
75 | isRendered: boolean;
76 | isDestroyed: boolean;
77 | renderCount: number;
78 | autorun(runFunc: (computation: Tracker.Computation) => void): Tracker.Computation;
79 | onViewCreated(func: Function): void;
80 | onViewReady(func: Function): void;
81 | onViewDestroyed(func: Function): void;
82 | firstNode(): Node;
83 | lastNode(): Node;
84 | template: Template;
85 | templateInstance(): TemplateInstance;
86 | }
87 | var currentView: View;
88 |
89 | function isTemplate(value: any): boolean;
90 |
91 | interface HelpersMap {
92 | [key: string]: Function;
93 | }
94 |
95 | interface EventsMap {
96 | [key: string]: Function;
97 | }
98 |
99 | var Template: TemplateStatic;
100 |
101 | interface TemplateStatic {
102 | new (viewName?: string, renderFunction?: Function): Template;
103 |
104 | registerHelper(name: string, func: Function): void;
105 | instance(): TemplateInstance;
106 | currentData(): any;
107 | parentData(numLevels: number): any;
108 | }
109 |
110 | interface Template {
111 | viewName: string;
112 | renderFunction: Function;
113 | constructView(): View;
114 | head: Template;
115 | find(selector: string): HTMLElement;
116 | findAll(selector: string): HTMLElement[];
117 | $: any;
118 | onCreated(cb: Function): void;
119 | onRendered(cb: Function): void;
120 | onDestroyed(cb: Function): void;
121 | created: Function;
122 | rendered: Function;
123 | destroyed: Function;
124 | helpers(helpersMap: HelpersMap): void;
125 | events(eventsMap: EventsMap): void;
126 | }
127 |
128 | var TemplateInstance: TemplateInstanceStatic;
129 |
130 | interface TemplateInstanceStatic {
131 | new (view: View): TemplateInstance;
132 | }
133 |
134 | interface TemplateInstance {
135 | $(selector: string): any;
136 | autorun(runFunc: (computation: Tracker.Computation) => void): Tracker.Computation;
137 | data: Object;
138 | find(selector: string): HTMLElement;
139 | findAll(selector: string): HTMLElement[];
140 | firstNode: Object;
141 | lastNode: Object;
142 | subscribe(name: string, ...args: any[]): Meteor.SubscriptionHandle;
143 | subscriptionsReady(): boolean;
144 | view: Object;
145 | }
146 |
147 | function Each(argFunc: Function, contentFunc: Function, elseFunc?: Function): View;
148 | function Unless(conditionFunc: Function, contentFunc: Function, elseFunc?: Function): View;
149 | function If(conditionFunc: Function, contentFunc: Function, elseFunc?: Function): View;
150 |
151 | function Let(bindings: Function, contentFunc: Function): View;
152 | function With(data: Object | Function, contentFunc: Function): View;
153 |
154 | function getData(elementOrView?: HTMLElement | View): Object;
155 | function getView(element?: HTMLElement): View;
156 |
157 | function remove(renderedView: View): void;
158 | function render(templateOrView: Template | View, parentNode: Node, nextNode?: Node, parentView?: View): View;
159 | function renderWithData(templateOrView: Template | View, data: Object | Function, parentNode: Node, nextNode?: Node, parentView?: View): View;
160 | function toHTML(templateOrView: Template | View): string;
161 | function toHTMLWithData(templateOrView: Template | View, data: Object | Function): string;
162 | }
163 |
164 | declare module BrowserPolicy {
165 | var framing: {
166 | disallow(): void;
167 | restrictToOrigin(origin: string): void;
168 | allowAll(): void;
169 | };
170 |
171 | var content: {
172 | allowEval(): void;
173 | allowInlineStyles(): void;
174 | allowInlineScripts(): void;
175 | allowSameOriginForAll(): void;
176 | allowDataUrlForAll(): void;
177 | allowOriginForAll(origin: string): void;
178 | allowImageOrigin(origin: string): void;
179 | allowMediaOrigin(origin: string): void;
180 | allowFontOrigin(origin: string): void;
181 | allowStyleOrigin(origin: string): void;
182 | allowScriptOrigin(origin: string): void;
183 | allowFrameOrigin(origin: string): void;
184 | allowContentTypeSniffing(): void;
185 | allowAllContentOrigin(): void;
186 | allowAllContentDataUrl(): void;
187 | allowAllContentSameOrigin(): void;
188 |
189 | disallowAll(): void;
190 | disallowInlineStyles(): void;
191 | disallowEval(): void;
192 | disallowInlineScripts(): void;
193 | disallowFont(): void;
194 | disallowObject(): void;
195 | disallowAllContent(): void;
196 | };
197 | }
198 |
199 | declare module Match {
200 | var Any: any;
201 | var String: any;
202 | var Integer: any;
203 | var Boolean: any;
204 | var undefined: any;
205 | var Object: any;
206 | function Optional(pattern: any): boolean;
207 | function ObjectIncluding(dico: any): boolean;
208 | function OneOf(...patterns: any[]): any;
209 | function Where(condition: any): any;
210 | function test(value: any, pattern: any): boolean;
211 | }
212 |
213 | declare function check(value: any, pattern: any): void;
214 |
215 | ///
216 |
217 | declare module DDP {
218 | interface DDPStatic {
219 | subscribe(name: string, ...rest: any[]): Meteor.SubscriptionHandle;
220 | call(method: string, ...parameters: any[]): void;
221 | apply(method: string, ...parameters: any[]): void;
222 | methods(IMeteorMethodsDictionary: any): any;
223 | status(): DDPStatus;
224 | reconnect(): void;
225 | disconnect(): void;
226 | onReconnect(): void;
227 | }
228 |
229 | function _allSubscriptionsReady(): boolean;
230 |
231 | type Status = 'connected' | 'connecting' | 'failed' | 'waiting' | 'offline';
232 |
233 | interface DDPStatus {
234 | connected: boolean;
235 | status: Status;
236 | retryCount: number;
237 | retryTime?: number;
238 | reason?: string;
239 | }
240 |
241 | function connect(url: string): DDPStatic;
242 | }
243 |
244 | declare module DDPCommon {
245 | interface MethodInvocation {
246 | new (options: {}): MethodInvocation;
247 |
248 | unblock(): void;
249 |
250 | setUserId(userId: number): void;
251 | }
252 | }
253 |
254 | interface EJSONableCustomType {
255 | clone(): EJSONableCustomType;
256 | equals(other: Object): boolean;
257 | toJSONValue(): JSONable;
258 | typeName(): string;
259 | }
260 | interface EJSONable {
261 | [key: string]: number | string | boolean | Object | number[] | string[] | Object[] | Date | Uint8Array | EJSONableCustomType;
262 | }
263 | interface JSONable {
264 | [key: string]: number | string | boolean | Object | number[] | string[] | Object[];
265 | }
266 | interface EJSON extends EJSONable { }
267 |
268 | declare module EJSON {
269 | function addType(name: string, factory: (val: JSONable) => EJSONableCustomType): void;
270 | function clone(val: T): T;
271 | function equals(a: EJSON, b: EJSON, options?: {
272 | keyOrderSensitive?: boolean;
273 | }): boolean;
274 | function fromJSONValue(val: JSONable): any;
275 | function isBinary(x: Object): boolean;
276 | var newBinary: any;
277 | function parse(str: string): EJSON;
278 | function stringify(val: EJSON, options?: {
279 | indent?: boolean | number | string;
280 | canonical?: boolean;
281 | }): string;
282 | function toJSONValue(val: EJSON): JSONable;
283 | }
284 |
285 | declare module HTTP {
286 | interface HTTPRequest {
287 | content?: string;
288 | data?: any;
289 | query?: string;
290 | params?: { [id: string]: string };
291 | auth?: string;
292 | headers?: { [id: string]: string };
293 | timeout?: number;
294 | followRedirects?: boolean;
295 | npmRequestOptions?: Object;
296 | }
297 |
298 | interface HTTPResponse {
299 | statusCode?: number;
300 | headers?: { [id: string]: string };
301 | content?: string;
302 | data?: any;
303 | }
304 |
305 | function call(method: string, url: string, options?: HTTP.HTTPRequest, asyncCallback?: Function): HTTP.HTTPResponse;
306 | function del(url: string, callOptions?: HTTP.HTTPRequest, asyncCallback?: Function): HTTP.HTTPResponse;
307 | function get(url: string, callOptions?: HTTP.HTTPRequest, asyncCallback?: Function): HTTP.HTTPResponse;
308 | function post(url: string, callOptions?: HTTP.HTTPRequest, asyncCallback?: Function): HTTP.HTTPResponse;
309 | function put(url: string, callOptions?: HTTP.HTTPRequest, asyncCallback?: Function): HTTP.HTTPResponse;
310 | function call(method: string, url: string, options?: {
311 | content?: string;
312 | data?: Object;
313 | query?: string;
314 | params?: Object;
315 | auth?: string;
316 | headers?: Object;
317 | timeout?: number;
318 | followRedirects?: boolean;
319 | npmRequestOptions?: Object;
320 | beforeSend?: Function;
321 | }, asyncCallback?: Function): HTTP.HTTPResponse;
322 | }
323 |
324 | ///
325 | ///
326 |
327 | declare module Meteor {
328 | /** Global props **/
329 | var isClient: boolean;
330 | var isCordova: boolean;
331 | var isServer: boolean;
332 | var isProduction: boolean;
333 | var release: string;
334 | /** Global props **/
335 |
336 | /** Settings **/
337 | interface Settings {
338 | public: {[id:string]: any},
339 | [id:string]: any
340 | }
341 | var settings: Settings;
342 | /** Settings **/
343 |
344 | /** User **/
345 | interface UserEmail {
346 | address: string;
347 | verified: boolean;
348 | }
349 | interface User {
350 | _id?: string;
351 | username?: string;
352 | emails?: UserEmail[];
353 | createdAt?: number;
354 | profile?: any;
355 | services?: any;
356 | }
357 | function user(): User;
358 | function userId(): string;
359 | var users: Mongo.Collection;
360 | /** User **/
361 |
362 | /** Error **/
363 | var Error: ErrorStatic;
364 | interface ErrorStatic {
365 | new (error: string | number, reason?: string, details?: string): Error;
366 | }
367 | interface Error {
368 | error: string | number;
369 | reason?: string;
370 | details?: string;
371 | }
372 | /** Error **/
373 |
374 | /** Method **/
375 | function methods(methods: Object): void;
376 | function call(name: string, ...args: any[]): any;
377 | function apply(name: string, args: EJSONable[], options?: {
378 | wait?: boolean;
379 | onResultReceived?: Function;
380 | }, asyncCallback?: Function): any;
381 | /** Method **/
382 |
383 | /** Url **/
384 | function absoluteUrl(path?: string, options?: {
385 | secure?: boolean;
386 | replaceLocalhost?: boolean;
387 | rootUrl?: string;
388 | }): string;
389 | /** Url **/
390 |
391 | /** Timeout **/
392 | function setInterval(func: Function, delay: number): number;
393 | function setTimeout(func: Function, delay: number): number;
394 | function clearInterval(id: number): void;
395 | function clearTimeout(id: number): void;
396 | function defer(func: Function): void;
397 | /** Timeout **/
398 |
399 | /** utils **/
400 | function startup(func: Function): void;
401 | function wrapAsync(func: Function, context?: Object): any;
402 | function bindEnvironment(func: Function): any;
403 | /** utils **/
404 |
405 | /** Pub/Sub **/
406 | interface SubscriptionHandle {
407 | stop(): void;
408 | ready(): boolean;
409 | }
410 | interface LiveQueryHandle {
411 | stop(): void;
412 | }
413 | /** Pub/Sub **/
414 | }
415 |
416 | ///
417 |
418 | declare module Meteor {
419 | /** Login **/
420 | interface LoginWithExternalServiceOptions {
421 | requestPermissions?: string[];
422 | requestOfflineToken?: Boolean;
423 | forceApprovalPrompt?: Boolean;
424 | loginUrlParameters?: Object;
425 | redirectUrl?: string;
426 | loginHint?: string;
427 | loginStyle?: string;
428 | }
429 | function loginWithMeteorDeveloperAccount(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
430 | function loginWithFacebook(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
431 | function loginWithGithub(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
432 | function loginWithGoogle(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
433 | function loginWithMeetup(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
434 | function loginWithTwitter(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
435 | function loginWithWeibo(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
436 | function loggingIn(): boolean;
437 | function loginWith(options?: {
438 | requestPermissions?: string[];
439 | requestOfflineToken?: boolean;
440 | loginUrlParameters?: Object;
441 | userEmail?: string;
442 | loginStyle?: string;
443 | redirectUrl?: string;
444 | }, callback?: Function): void;
445 | function loginWithPassword(user: Object | string, password: string, callback?: Function): void;
446 | function loginWithToken(token: string, callback?: Function): void;
447 | function logout(callback?: Function): void;
448 | function logoutOtherClients(callback?: Function): void;
449 | /** Login **/
450 |
451 | /** Event **/
452 | interface Event {
453 | type: string;
454 | target: HTMLElement;
455 | currentTarget: HTMLElement;
456 | which: number;
457 | stopPropagation(): void;
458 | stopImmediatePropagation(): void;
459 | preventDefault(): void;
460 | isPropagationStopped(): boolean;
461 | isImmediatePropagationStopped(): boolean;
462 | isDefaultPrevented(): boolean;
463 | }
464 | interface EventHandlerFunction extends Function {
465 | (event?: Meteor.Event, templateInstance?: Blaze.TemplateInstance): void;
466 | }
467 | interface EventMap {
468 | [id: string]: Meteor.EventHandlerFunction;
469 | }
470 | /** Event **/
471 |
472 | /** Connection **/
473 | function reconnect(): void;
474 | function disconnect(): void;
475 | /** Connection **/
476 |
477 | /** Status **/
478 | function status(): DDP.DDPStatus;
479 | /** Status **/
480 |
481 | /** Pub/Sub **/
482 | function subscribe(name: string, ...args: any[]): Meteor.SubscriptionHandle;
483 | /** Pub/Sub **/
484 | }
485 |
486 | declare module Mongo {
487 | interface Selector {
488 | [key: string]: any;
489 | }
490 | interface Selector extends Object { }
491 | interface Modifier { }
492 | interface SortSpecifier { }
493 | interface FieldSpecifier {
494 | [id: string]: Number;
495 | }
496 |
497 | var Collection: CollectionStatic;
498 | interface CollectionStatic {
499 | new (name: string | null, options?: {
500 | connection?: Object;
501 | idGeneration?: string;
502 | transform?: Function;
503 | }): Collection;
504 | }
505 | interface Collection {
506 | allow(options: {
507 | insert?: (userId: string, doc: T) => boolean;
508 | update?: (userId: string, doc: T, fieldNames: string[], modifier: any) => boolean;
509 | remove?: (userId: string, doc: T) => boolean;
510 | fetch?: string[];
511 | transform?: Function;
512 | }): boolean;
513 | deny(options: {
514 | insert?: (userId: string, doc: T) => boolean;
515 | update?: (userId: string, doc: T, fieldNames: string[], modifier: any) => boolean;
516 | remove?: (userId: string, doc: T) => boolean;
517 | fetch?: string[];
518 | transform?: Function;
519 | }): boolean;
520 | find(selector?: Selector | ObjectID | string, options?: {
521 | sort?: SortSpecifier;
522 | skip?: number;
523 | limit?: number;
524 | fields?: FieldSpecifier;
525 | reactive?: boolean;
526 | transform?: Function;
527 | }): Cursor;
528 | findOne(selector?: Selector | ObjectID | string, options?: {
529 | sort?: SortSpecifier;
530 | skip?: number;
531 | fields?: FieldSpecifier;
532 | reactive?: boolean;
533 | transform?: Function;
534 | }): T;
535 | insert(doc: T, callback?: Function): string;
536 | rawCollection(): any;
537 | rawDatabase(): any;
538 | remove(selector: Selector | ObjectID | string, callback?: Function): number;
539 | update(selector: Selector | ObjectID | string, modifier: Modifier, options?: {
540 | multi?: boolean;
541 | upsert?: boolean;
542 | }, callback?: Function): number;
543 | upsert(selector: Selector | ObjectID | string, modifier: Modifier, options?: {
544 | multi?: boolean;
545 | }, callback?: Function): { numberAffected?: number; insertedId?: string; };
546 | _ensureIndex(keys: { [key: string]: number | string } | string, options?: { [key: string]: any }): void;
547 | _dropIndex(keys: { [key: string]: number | string } | string): void;
548 | }
549 |
550 | var Cursor: CursorStatic;
551 | interface CursorStatic {
552 | new (): Cursor;
553 | }
554 | interface ObserveCallbacks {
555 | added?(document: Object): void;
556 | addedAt?(document: Object, atIndex: number, before: Object): void;
557 | changed?(newDocument: Object, oldDocument: Object): void;
558 | changedAt?(newDocument: Object, oldDocument: Object, indexAt: number): void;
559 | removed?(oldDocument: Object): void;
560 | removedAt?(oldDocument: Object, atIndex: number): void;
561 | movedTo?(document: Object, fromIndex: number, toIndex: number, before: Object): void;
562 | }
563 | interface ObserveChangesCallbacks {
564 | added?(id: string, fields: Object): void;
565 | addedBefore?(id: string, fields: Object, before: Object): void;
566 | changed?(id: string, fields: Object): void;
567 | movedBefore?(id: string, before: Object): void;
568 | removed?(id: string): void;
569 | }
570 | interface Cursor {
571 | count(applySkipLimit?: boolean): number;
572 | fetch(): Array;
573 | forEach(callback: (doc: T, index: number, cursor: Cursor) => void, thisArg?: any): void;
574 | map(callback: (doc: T, index: number, cursor: Cursor) => U, thisArg?: any): Array;
575 | observe(callbacks: ObserveCallbacks): Meteor.LiveQueryHandle;
576 | observeChanges(callbacks: ObserveChangesCallbacks): Meteor.LiveQueryHandle;
577 | }
578 |
579 | var ObjectID: ObjectIDStatic;
580 | interface ObjectIDStatic {
581 | new (hexString?: string): ObjectID;
582 | }
583 | interface ObjectID { }
584 | }
585 |
586 | declare module Random {
587 | function id(numberOfChars?: number): string;
588 | function secret(numberOfChars?: number): string;
589 | function fraction(): number;
590 | // @param numberOfDigits, @returns a random hex string of the given length
591 | function hexString(numberOfDigits: number): string;
592 | // @param array, @return a random element in array
593 | function choice(array: any[]): string;
594 | // @param str, @return a random char in str
595 | function choice(str: string): string;
596 | }
597 |
598 | declare var ReactiveVar: ReactiveVarStatic;
599 | interface ReactiveVarStatic {
600 | new (initialValue: T, equalsFunc?: Function): ReactiveVar;
601 | }
602 | interface ReactiveVar {
603 | get(): T;
604 | set(newValue: T): void;
605 | }
606 |
607 | ///
608 |
609 | declare module Session {
610 | function equals(key: string, value: string | number | boolean | any): boolean;
611 | function get(key: string): any;
612 | function set(key: string, value: EJSONable | any): void;
613 | function setDefault(key: string, value: EJSONable | any): void;
614 | }
615 |
616 | ///
617 |
618 | declare var Template: TemplateStatic;
619 | interface TemplateStatic extends Blaze.TemplateStatic {
620 | new (viewName?: string, renderFunction?: Function): Blaze.Template;
621 | body: Blaze.Template;
622 | [index: string]: any | Blaze.Template;
623 | }
624 |
625 | interface ILengthAble {
626 | length: number;
627 | }
628 |
629 | interface ITinytestAssertions {
630 | ok(doc: Object): void;
631 | expect_fail(): void;
632 | fail(doc: Object): void;
633 | runId(): string;
634 | equal(actual: T, expected: T, message?: string, not?: boolean): void;
635 | notEqual(actual: T, expected: T, message?: string): void;
636 | instanceOf(obj: Object, klass: Function, message?: string): void;
637 | notInstanceOf(obj: Object, klass: Function, message?: string): void;
638 | matches(actual: any, regexp: RegExp, message?: string): void;
639 | notMatches(actual: any, regexp: RegExp, message?: string): void;
640 | throws(f: Function, expected?: string | RegExp): void;
641 | isTrue(v: boolean, msg?: string): void;
642 | isFalse(v: boolean, msg?: string): void;
643 | isNull(v: any, msg?: string): void;
644 | isNotNull(v: any, msg?: string): void;
645 | isUndefined(v: any, msg?: string): void;
646 | isNotUndefined(v: any, msg?: string): void;
647 | isNan(v: any, msg?: string): void;
648 | isNotNan(v: any, msg?: string): void;
649 | include(s: Array | Object | string, value: any, msg?: string, not?: boolean): void;
650 |
651 | notInclude(s: Array | Object | string, value: any, msg?: string, not?: boolean): void;
652 | length(obj: ILengthAble, expected_length: number, msg?: string): void;
653 | _stringEqual(actual: string, expected: string, msg?: string): void;
654 | }
655 |
656 | declare module Tinytest {
657 | function add(description: string, func: (test: ITinytestAssertions) => void): void;
658 | function addAsync(description: string, func: (test: ITinytestAssertions) => void): void;
659 | }
660 |
661 | declare module Tracker {
662 | function Computation(): void;
663 | interface Computation {
664 | firstRun: boolean;
665 | invalidate(): void;
666 | invalidated: boolean;
667 | onInvalidate(callback: Function): void;
668 | onStop(callback: Function): void;
669 | stop(): void;
670 | stopped: boolean;
671 | }
672 | var currentComputation: Computation;
673 |
674 | var Dependency: DependencyStatic;
675 | interface DependencyStatic {
676 | new (): Dependency;
677 | }
678 | interface Dependency {
679 | changed(): void;
680 | depend(fromComputation?: Computation): boolean;
681 | hasDependents(): boolean;
682 | }
683 |
684 | var active: boolean;
685 | function afterFlush(callback: Function): void;
686 | function autorun(runFunc: (computation: Computation) => void, options?: {
687 | onError?: Function;
688 | }): Computation;
689 | function flush(): void;
690 | function nonreactive(func: Function): void;
691 | function onInvalidate(callback: Function): void;
692 | }
693 |
--------------------------------------------------------------------------------
/1.2/header.d.ts:
--------------------------------------------------------------------------------
1 | // Type definitions for Meteor 1.2
2 | // Project: http://www.meteor.com/
3 | // Definitions by:
4 | // Alex Borodach ,
5 | // Dave Allen
6 |
--------------------------------------------------------------------------------
/1.2/main.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 | interface URLS {
3 | resetPassword: (token: string) => string;
4 | verifyEmail: (token: string) => string;
5 | enrollAccount: (token: string) => string;
6 | }
7 |
8 | declare module Accounts {
9 | var urls: URLS;
10 |
11 | function user(): Meteor.User;
12 | function userId(): string;
13 |
14 | function createUser(options: {
15 | username?: string;
16 | email?: string;
17 | password?: string;
18 | profile?: Object;
19 | }, callback?: Function): string;
20 |
21 | function config(options: {
22 | sendVerificationEmail?: boolean;
23 | forbidClientAccountCreation?: boolean;
24 | restrictCreationByEmailDomain?: string | Function;
25 | loginExpirationInDays?: number;
26 | oauthSecretKey?: string;
27 | }): void;
28 |
29 | function onLogin(func: Function): { stop: () => void };
30 | function onLoginFailure(func: Function): { stop: () => void };
31 |
32 | function loginServicesConfigured(): boolean;
33 | function onPageLoadLogin(func: Function): void;
34 | }
35 |
36 | declare module Accounts {
37 | function changePassword(oldPassword: string, newPassword: string, callback?: Function): void;
38 | function forgotPassword(options: {
39 | email?: string;
40 | }, callback?: Function): void;
41 | function resetPassword(token: string, newPassword: string, callback?: Function): void;
42 | function verifyEmail(token: string, callback?: Function): void;
43 |
44 | function onEmailVerificationLink(callback: Function): void;
45 | function onEnrollmentLink(callback: Function): void;
46 | function onResetPasswordLink(callback: Function): void;
47 |
48 | function loggingIn(): boolean;
49 | function logout(callback?: Function): void;
50 | function logoutOtherClients(callback?: Function): void;
51 |
52 | var ui: {
53 | config(options: {
54 | requestPermissions?: Object;
55 | requestOfflineToken?: Object;
56 | forceApprovalPrompt?: Object;
57 | passwordSignupFields?: string;
58 | }): void;
59 | };
60 | }
61 |
62 | ///
63 | ///
64 |
65 | interface EmailFields {
66 | from?: () => string;
67 | subject?: (user: Meteor.User) => string;
68 | text?: (user: Meteor.User, url: string) => string;
69 | html?: (user: Meteor.User, url: string) => string;
70 | }
71 |
72 | interface Header {
73 | [id: string]: string;
74 | }
75 |
76 | interface EmailTemplates {
77 | from: string;
78 | siteName: string;
79 | headers?: Header;
80 | resetPassword: EmailFields;
81 | enrollAccount: EmailFields;
82 | verifyEmail: EmailFields;
83 | }
84 |
85 | declare module Accounts {
86 | var emailTemplates: EmailTemplates;
87 | function addEmail(userId: string, newEmail: string, verified?: boolean): void;
88 | function removeEmail(userId: string, email: string): void;
89 |
90 | function onCreateUser(func: Function): void;
91 | function findUserByEmail(email: string): Object;
92 | function findUserByUsername(username: string): Object;
93 |
94 | function sendEnrollmentEmail(userId: string, email?: string): void;
95 | function sendResetPasswordEmail(userId: string, email?: string): void;
96 | function sendVerificationEmail(userId: string, email?: string): void;
97 |
98 | function setUsername(userId: string, newUsername: string): void;
99 | function setPassword(userId: string, newPassword: string, options?: {
100 | logout?: Object;
101 | }): void;
102 |
103 | function validateNewUser(func: Function): boolean;
104 | function validateLoginAttempt(func: Function): { stop: () => void };
105 |
106 | interface IValidateLoginAttemptCbOpts {
107 | type: string;
108 | allowed: boolean;
109 | error: Meteor.Error;
110 | user: Meteor.User;
111 | connection: Meteor.Connection;
112 | methodName: string;
113 | methodArguments: any[];
114 | }
115 | }
116 |
117 | ///
118 |
119 | declare module Blaze {
120 | var View: ViewStatic;
121 |
122 | interface ViewStatic {
123 | new (name?: string, renderFunction?: Function): View;
124 | }
125 |
126 | interface View {
127 | name: string;
128 | parentView: View;
129 | isCreated: boolean;
130 | isRendered: boolean;
131 | isDestroyed: boolean;
132 | renderCount: number;
133 | autorun(runFunc: (computation: Tracker.Computation) => void): Tracker.Computation;
134 | onViewCreated(func: Function): void;
135 | onViewReady(func: Function): void;
136 | onViewDestroyed(func: Function): void;
137 | firstNode(): Node;
138 | lastNode(): Node;
139 | template: Template;
140 | templateInstance(): TemplateInstance;
141 | }
142 | var currentView: View;
143 |
144 | function isTemplate(value: any): boolean;
145 |
146 | interface HelpersMap {
147 | [key: string]: Function;
148 | }
149 |
150 | interface EventsMap {
151 | [key: string]: Function;
152 | }
153 |
154 | var Template: TemplateStatic;
155 |
156 | interface TemplateStatic {
157 | new (viewName?: string, renderFunction?: Function): Template;
158 |
159 | registerHelper(name: string, func: Function): void;
160 | instance(): TemplateInstance;
161 | currentData(): any;
162 | parentData(numLevels: number): any;
163 | }
164 |
165 | interface Template {
166 | viewName: string;
167 | renderFunction: Function;
168 | constructView(): View;
169 | head: Template;
170 | find(selector: string): HTMLElement;
171 | findAll(selector: string): HTMLElement[];
172 | $: any;
173 | onCreated(cb: Function): void;
174 | onRendered(cb: Function): void;
175 | onDestroyed(cb: Function): void;
176 | created: Function;
177 | rendered: Function;
178 | destroyed: Function;
179 | helpers(helpersMap: HelpersMap): void;
180 | events(eventsMap: EventsMap): void;
181 | }
182 |
183 | var TemplateInstance: TemplateInstanceStatic;
184 |
185 | interface TemplateInstanceStatic {
186 | new (view: View): TemplateInstance;
187 | }
188 |
189 | interface TemplateInstance {
190 | $(selector: string): any;
191 | autorun(runFunc: (computation: Tracker.Computation) => void): Tracker.Computation;
192 | data: Object;
193 | find(selector: string): HTMLElement;
194 | findAll(selector: string): HTMLElement[];
195 | firstNode: Object;
196 | lastNode: Object;
197 | subscribe(name: string, ...args: any[]): Meteor.SubscriptionHandle;
198 | subscriptionsReady(): boolean;
199 | view: Object;
200 | }
201 |
202 | function Each(argFunc: Function, contentFunc: Function, elseFunc?: Function): View;
203 | function Unless(conditionFunc: Function, contentFunc: Function, elseFunc?: Function): View;
204 | function If(conditionFunc: Function, contentFunc: Function, elseFunc?: Function): View;
205 |
206 | function Let(bindings: Function, contentFunc: Function): View;
207 | function With(data: Object | Function, contentFunc: Function): View;
208 |
209 | function getData(elementOrView?: HTMLElement | View): Object;
210 | function getView(element?: HTMLElement): View;
211 |
212 | function remove(renderedView: View): void;
213 | function render(templateOrView: Template | View, parentNode: Node, nextNode?: Node, parentView?: View): View;
214 | function renderWithData(templateOrView: Template | View, data: Object | Function, parentNode: Node, nextNode?: Node, parentView?: View): View;
215 | function toHTML(templateOrView: Template | View): string;
216 | function toHTMLWithData(templateOrView: Template | View, data: Object | Function): string;
217 | }
218 |
219 | declare module BrowserPolicy {
220 | var framing: {
221 | disallow(): void;
222 | restrictToOrigin(origin: string): void;
223 | allowAll(): void;
224 | };
225 |
226 | var content: {
227 | allowEval(): void;
228 | allowInlineStyles(): void;
229 | allowInlineScripts(): void;
230 | allowSameOriginForAll(): void;
231 | allowDataUrlForAll(): void;
232 | allowOriginForAll(origin: string): void;
233 | allowImageOrigin(origin: string): void;
234 | allowMediaOrigin(origin: string): void;
235 | allowFontOrigin(origin: string): void;
236 | allowStyleOrigin(origin: string): void;
237 | allowScriptOrigin(origin: string): void;
238 | allowFrameOrigin(origin: string): void;
239 | allowContentTypeSniffing(): void;
240 | allowAllContentOrigin(): void;
241 | allowAllContentDataUrl(): void;
242 | allowAllContentSameOrigin(): void;
243 |
244 | disallowAll(): void;
245 | disallowInlineStyles(): void;
246 | disallowEval(): void;
247 | disallowInlineScripts(): void;
248 | disallowFont(): void;
249 | disallowObject(): void;
250 | disallowAllContent(): void;
251 | };
252 | }
253 |
254 | declare module Match {
255 | var Any: any;
256 | var String: any;
257 | var Integer: any;
258 | var Boolean: any;
259 | var undefined: any;
260 | var Object: any;
261 | function Optional(pattern: any): boolean;
262 | function ObjectIncluding(dico: any): boolean;
263 | function OneOf(...patterns: any[]): any;
264 | function Where(condition: any): any;
265 | function test(value: any, pattern: any): boolean;
266 | }
267 |
268 | declare function check(value: any, pattern: any): void;
269 |
270 | declare module DDPRateLimiter {
271 | interface Matcher {
272 | type?: string | ((type: string) => boolean);
273 | name?: string | ((name: string) => boolean);
274 | userId?: string | ((userId: string) => boolean);
275 | connectionId?: string | ((connectionId: string) => boolean);
276 | clientAddress?: string | ((clientAddress: string) => boolean);
277 | }
278 |
279 | function addRule(matcher: Matcher, numRequests: number, timeInterval: number): string;
280 |
281 | function removeRule(ruleId: string): boolean;
282 | }
283 |
284 | ///
285 |
286 | declare module DDP {
287 | interface DDPStatic {
288 | subscribe(name: string, ...rest: any[]): Meteor.SubscriptionHandle;
289 | call(method: string, ...parameters: any[]): void;
290 | apply(method: string, ...parameters: any[]): void;
291 | methods(IMeteorMethodsDictionary: any): any;
292 | status(): DDPStatus;
293 | reconnect(): void;
294 | disconnect(): void;
295 | onReconnect(): void;
296 | }
297 |
298 | function _allSubscriptionsReady(): boolean;
299 |
300 | type Status = 'connected' | 'connecting' | 'failed' | 'waiting' | 'offline';
301 |
302 | interface DDPStatus {
303 | connected: boolean;
304 | status: Status;
305 | retryCount: number;
306 | retryTime?: number;
307 | reason?: string;
308 | }
309 |
310 | function connect(url: string): DDPStatic;
311 | }
312 |
313 | declare module DDPCommon {
314 | interface MethodInvocation {
315 | new (options: {}): MethodInvocation;
316 |
317 | unblock(): void;
318 |
319 | setUserId(userId: number): void;
320 | }
321 | }
322 |
323 | interface EJSONableCustomType {
324 | clone(): EJSONableCustomType;
325 | equals(other: Object): boolean;
326 | toJSONValue(): JSONable;
327 | typeName(): string;
328 | }
329 | interface EJSONable {
330 | [key: string]: number | string | boolean | Object | number[] | string[] | Object[] | Date | Uint8Array | EJSONableCustomType;
331 | }
332 | interface JSONable {
333 | [key: string]: number | string | boolean | Object | number[] | string[] | Object[];
334 | }
335 | interface EJSON extends EJSONable { }
336 |
337 | declare module EJSON {
338 | function addType(name: string, factory: (val: JSONable) => EJSONableCustomType): void;
339 | function clone(val: T): T;
340 | function equals(a: EJSON, b: EJSON, options?: {
341 | keyOrderSensitive?: boolean;
342 | }): boolean;
343 | function fromJSONValue(val: JSONable): any;
344 | function isBinary(x: Object): boolean;
345 | var newBinary: any;
346 | function parse(str: string): EJSON;
347 | function stringify(val: EJSON, options?: {
348 | indent?: boolean | number | string;
349 | canonical?: boolean;
350 | }): string;
351 | function toJSONValue(val: EJSON): JSONable;
352 | }
353 |
354 | declare module Email {
355 | function send(options: {
356 | from?: string;
357 | to?: string | string[];
358 | cc?: string | string[];
359 | bcc?: string | string[];
360 | replyTo?: string | string[];
361 | subject?: string;
362 | text?: string;
363 | html?: string;
364 | headers?: Object;
365 | attachments?: Object[];
366 | mailComposer?: MailComposer;
367 | }): void;
368 | }
369 |
370 | interface MailComposerOptions {
371 | escapeSMTP: boolean;
372 | encoding: string;
373 | charset: string;
374 | keepBcc: boolean;
375 | forceEmbeddedImages: boolean;
376 | }
377 |
378 | declare var MailComposer: MailComposerStatic;
379 | interface MailComposerStatic {
380 | new (options: MailComposerOptions): MailComposer;
381 | }
382 | interface MailComposer {
383 | addHeader(name: string, value: string): void;
384 | setMessageOption(from: string, to: string, body: string, html: string): void;
385 | streamMessage(): void;
386 | pipe(stream: any /** fs.WriteStream **/): void;
387 | }
388 |
389 | declare module HTTP {
390 | interface HTTPRequest {
391 | content?: string;
392 | data?: any;
393 | query?: string;
394 | params?: { [id: string]: string };
395 | auth?: string;
396 | headers?: { [id: string]: string };
397 | timeout?: number;
398 | followRedirects?: boolean;
399 | npmRequestOptions?: Object;
400 | }
401 |
402 | interface HTTPResponse {
403 | statusCode?: number;
404 | headers?: { [id: string]: string };
405 | content?: string;
406 | data?: any;
407 | }
408 |
409 | function call(method: string, url: string, options?: HTTP.HTTPRequest, asyncCallback?: Function): HTTP.HTTPResponse;
410 | function del(url: string, callOptions?: HTTP.HTTPRequest, asyncCallback?: Function): HTTP.HTTPResponse;
411 | function get(url: string, callOptions?: HTTP.HTTPRequest, asyncCallback?: Function): HTTP.HTTPResponse;
412 | function post(url: string, callOptions?: HTTP.HTTPRequest, asyncCallback?: Function): HTTP.HTTPResponse;
413 | function put(url: string, callOptions?: HTTP.HTTPRequest, asyncCallback?: Function): HTTP.HTTPResponse;
414 | function call(method: string, url: string, options?: {
415 | content?: string;
416 | data?: Object;
417 | query?: string;
418 | params?: Object;
419 | auth?: string;
420 | headers?: Object;
421 | timeout?: number;
422 | followRedirects?: boolean;
423 | npmRequestOptions?: Object;
424 | beforeSend?: Function;
425 | }, asyncCallback?: Function): HTTP.HTTPResponse;
426 | }
427 |
428 | ///
429 | ///
430 |
431 | declare module Meteor {
432 | /** Global props **/
433 | var isClient: boolean;
434 | var isCordova: boolean;
435 | var isServer: boolean;
436 | var isProduction: boolean;
437 | var release: string;
438 | /** Global props **/
439 |
440 | /** Settings **/
441 | interface Settings {
442 | public: {[id:string]: any},
443 | [id:string]: any
444 | }
445 | var settings: Settings;
446 | /** Settings **/
447 |
448 | /** User **/
449 | interface UserEmail {
450 | address: string;
451 | verified: boolean;
452 | }
453 | interface User {
454 | _id?: string;
455 | username?: string;
456 | emails?: UserEmail[];
457 | createdAt?: number;
458 | profile?: any;
459 | services?: any;
460 | }
461 | function user(): User;
462 | function userId(): string;
463 | var users: Mongo.Collection;
464 | /** User **/
465 |
466 | /** Error **/
467 | var Error: ErrorStatic;
468 | interface ErrorStatic {
469 | new (error: string | number, reason?: string, details?: string): Error;
470 | }
471 | interface Error {
472 | error: string | number;
473 | reason?: string;
474 | details?: string;
475 | }
476 | /** Error **/
477 |
478 | /** Method **/
479 | function methods(methods: Object): void;
480 | function call(name: string, ...args: any[]): any;
481 | function apply(name: string, args: EJSONable[], options?: {
482 | wait?: boolean;
483 | onResultReceived?: Function;
484 | }, asyncCallback?: Function): any;
485 | /** Method **/
486 |
487 | /** Url **/
488 | function absoluteUrl(path?: string, options?: {
489 | secure?: boolean;
490 | replaceLocalhost?: boolean;
491 | rootUrl?: string;
492 | }): string;
493 | /** Url **/
494 |
495 | /** Timeout **/
496 | function setInterval(func: Function, delay: number): number;
497 | function setTimeout(func: Function, delay: number): number;
498 | function clearInterval(id: number): void;
499 | function clearTimeout(id: number): void;
500 | function defer(func: Function): void;
501 | /** Timeout **/
502 |
503 | /** utils **/
504 | function startup(func: Function): void;
505 | function wrapAsync(func: Function, context?: Object): any;
506 | function bindEnvironment(func: Function): any;
507 | /** utils **/
508 |
509 | /** Pub/Sub **/
510 | interface SubscriptionHandle {
511 | stop(): void;
512 | ready(): boolean;
513 | }
514 | interface LiveQueryHandle {
515 | stop(): void;
516 | }
517 | /** Pub/Sub **/
518 | }
519 |
520 | ///
521 |
522 | declare module Meteor {
523 | /** Login **/
524 | interface LoginWithExternalServiceOptions {
525 | requestPermissions?: string[];
526 | requestOfflineToken?: Boolean;
527 | forceApprovalPrompt?: Boolean;
528 | loginUrlParameters?: Object;
529 | redirectUrl?: string;
530 | loginHint?: string;
531 | loginStyle?: string;
532 | }
533 | function loginWithMeteorDeveloperAccount(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
534 | function loginWithFacebook(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
535 | function loginWithGithub(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
536 | function loginWithGoogle(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
537 | function loginWithMeetup(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
538 | function loginWithTwitter(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
539 | function loginWithWeibo(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
540 | function loggingIn(): boolean;
541 | function loginWith(options?: {
542 | requestPermissions?: string[];
543 | requestOfflineToken?: boolean;
544 | loginUrlParameters?: Object;
545 | userEmail?: string;
546 | loginStyle?: string;
547 | redirectUrl?: string;
548 | }, callback?: Function): void;
549 | function loginWithPassword(user: Object | string, password: string, callback?: Function): void;
550 | function loginWithToken(token: string, callback?: Function): void;
551 | function logout(callback?: Function): void;
552 | function logoutOtherClients(callback?: Function): void;
553 | /** Login **/
554 |
555 | /** Event **/
556 | interface Event {
557 | type: string;
558 | target: HTMLElement;
559 | currentTarget: HTMLElement;
560 | which: number;
561 | stopPropagation(): void;
562 | stopImmediatePropagation(): void;
563 | preventDefault(): void;
564 | isPropagationStopped(): boolean;
565 | isImmediatePropagationStopped(): boolean;
566 | isDefaultPrevented(): boolean;
567 | }
568 | interface EventHandlerFunction extends Function {
569 | (event?: Meteor.Event, templateInstance?: Blaze.TemplateInstance): void;
570 | }
571 | interface EventMap {
572 | [id: string]: Meteor.EventHandlerFunction;
573 | }
574 | /** Event **/
575 |
576 | /** Connection **/
577 | function reconnect(): void;
578 | function disconnect(): void;
579 | /** Connection **/
580 |
581 | /** Status **/
582 | function status(): DDP.DDPStatus;
583 | /** Status **/
584 |
585 | /** Pub/Sub **/
586 | function subscribe(name: string, ...args: any[]): Meteor.SubscriptionHandle;
587 | /** Pub/Sub **/
588 | }
589 |
590 | declare module Meteor {
591 | /** Connection **/
592 | interface Connection {
593 | id: string;
594 | close: Function;
595 | onClose: Function;
596 | clientAddress: string;
597 | httpHeaders: Object;
598 | }
599 | function onConnection(callback: Function): void;
600 | /** Connection **/
601 |
602 | function publish(name: string, func: Function): void;
603 |
604 | function _debug(...args: any[]): void;
605 | }
606 |
607 | interface Subscription {
608 | added(collection: string, id: string, fields: Object): void;
609 | changed(collection: string, id: string, fields: Object): void;
610 | connection: Meteor.Connection;
611 | error(error: Error): void;
612 | onStop(func: Function): void;
613 | ready(): void;
614 | removed(collection: string, id: string): void;
615 | stop(): void;
616 | userId: string;
617 | }
618 |
619 | declare module Mongo {
620 | interface Selector {
621 | [key: string]: any;
622 | }
623 | interface Selector extends Object { }
624 | interface Modifier { }
625 | interface SortSpecifier { }
626 | interface FieldSpecifier {
627 | [id: string]: Number;
628 | }
629 |
630 | var Collection: CollectionStatic;
631 | interface CollectionStatic {
632 | new (name: string | null, options?: {
633 | connection?: Object;
634 | idGeneration?: string;
635 | transform?: Function;
636 | }): Collection;
637 | }
638 | interface Collection {
639 | allow(options: {
640 | insert?: (userId: string, doc: T) => boolean;
641 | update?: (userId: string, doc: T, fieldNames: string[], modifier: any) => boolean;
642 | remove?: (userId: string, doc: T) => boolean;
643 | fetch?: string[];
644 | transform?: Function;
645 | }): boolean;
646 | deny(options: {
647 | insert?: (userId: string, doc: T) => boolean;
648 | update?: (userId: string, doc: T, fieldNames: string[], modifier: any) => boolean;
649 | remove?: (userId: string, doc: T) => boolean;
650 | fetch?: string[];
651 | transform?: Function;
652 | }): boolean;
653 | find(selector?: Selector | ObjectID | string, options?: {
654 | sort?: SortSpecifier;
655 | skip?: number;
656 | limit?: number;
657 | fields?: FieldSpecifier;
658 | reactive?: boolean;
659 | transform?: Function;
660 | }): Cursor;
661 | findOne(selector?: Selector | ObjectID | string, options?: {
662 | sort?: SortSpecifier;
663 | skip?: number;
664 | fields?: FieldSpecifier;
665 | reactive?: boolean;
666 | transform?: Function;
667 | }): T;
668 | insert(doc: T, callback?: Function): string;
669 | rawCollection(): any;
670 | rawDatabase(): any;
671 | remove(selector: Selector | ObjectID | string, callback?: Function): number;
672 | update(selector: Selector | ObjectID | string, modifier: Modifier, options?: {
673 | multi?: boolean;
674 | upsert?: boolean;
675 | }, callback?: Function): number;
676 | upsert(selector: Selector | ObjectID | string, modifier: Modifier, options?: {
677 | multi?: boolean;
678 | }, callback?: Function): { numberAffected?: number; insertedId?: string; };
679 | _ensureIndex(keys: { [key: string]: number | string } | string, options?: { [key: string]: any }): void;
680 | _dropIndex(keys: { [key: string]: number | string } | string): void;
681 | }
682 |
683 | var Cursor: CursorStatic;
684 | interface CursorStatic {
685 | new (): Cursor;
686 | }
687 | interface ObserveCallbacks {
688 | added?(document: Object): void;
689 | addedAt?(document: Object, atIndex: number, before: Object): void;
690 | changed?(newDocument: Object, oldDocument: Object): void;
691 | changedAt?(newDocument: Object, oldDocument: Object, indexAt: number): void;
692 | removed?(oldDocument: Object): void;
693 | removedAt?(oldDocument: Object, atIndex: number): void;
694 | movedTo?(document: Object, fromIndex: number, toIndex: number, before: Object): void;
695 | }
696 | interface ObserveChangesCallbacks {
697 | added?(id: string, fields: Object): void;
698 | addedBefore?(id: string, fields: Object, before: Object): void;
699 | changed?(id: string, fields: Object): void;
700 | movedBefore?(id: string, before: Object): void;
701 | removed?(id: string): void;
702 | }
703 | interface Cursor {
704 | count(applySkipLimit?: boolean): number;
705 | fetch(): Array;
706 | forEach(callback: (doc: T, index: number, cursor: Cursor) => void, thisArg?: any): void;
707 | map(callback: (doc: T, index: number, cursor: Cursor) => U, thisArg?: any): Array;
708 | observe(callbacks: ObserveCallbacks): Meteor.LiveQueryHandle;
709 | observeChanges(callbacks: ObserveChangesCallbacks): Meteor.LiveQueryHandle;
710 | }
711 |
712 | var ObjectID: ObjectIDStatic;
713 | interface ObjectIDStatic {
714 | new (hexString?: string): ObjectID;
715 | }
716 | interface ObjectID { }
717 | }
718 |
719 | declare module Mongo {
720 | interface AllowDenyOptions {
721 | insert?: (userId: string, doc: any) => boolean;
722 | update?: (userId: string, doc: any, fieldNames: string[], modifier: any) => boolean;
723 | remove?: (userId: string, doc: any) => boolean;
724 | fetch?: string[];
725 | transform?: Function;
726 | }
727 | }
728 |
729 | declare module Random {
730 | function id(numberOfChars?: number): string;
731 | function secret(numberOfChars?: number): string;
732 | function fraction(): number;
733 | // @param numberOfDigits, @returns a random hex string of the given length
734 | function hexString(numberOfDigits: number): string;
735 | // @param array, @return a random element in array
736 | function choice(array: any[]): string;
737 | // @param str, @return a random char in str
738 | function choice(str: string): string;
739 | }
740 |
741 | declare var ReactiveVar: ReactiveVarStatic;
742 | interface ReactiveVarStatic {
743 | new (initialValue: T, equalsFunc?: Function): ReactiveVar;
744 | }
745 | interface ReactiveVar {
746 | get(): T;
747 | set(newValue: T): void;
748 | }
749 |
750 | ///
751 |
752 | declare module Session {
753 | function equals(key: string, value: string | number | boolean | any): boolean;
754 | function get(key: string): any;
755 | function set(key: string, value: EJSONable | any): void;
756 | function setDefault(key: string, value: EJSONable | any): void;
757 | }
758 |
759 | ///
760 |
761 | declare var Template: TemplateStatic;
762 | interface TemplateStatic extends Blaze.TemplateStatic {
763 | new (viewName?: string, renderFunction?: Function): Blaze.Template;
764 | body: Blaze.Template;
765 | [index: string]: any | Blaze.Template;
766 | }
767 |
768 | interface ILengthAble {
769 | length: number;
770 | }
771 |
772 | interface ITinytestAssertions {
773 | ok(doc: Object): void;
774 | expect_fail(): void;
775 | fail(doc: Object): void;
776 | runId(): string;
777 | equal(actual: T, expected: T, message?: string, not?: boolean): void;
778 | notEqual(actual: T, expected: T, message?: string): void;
779 | instanceOf(obj: Object, klass: Function, message?: string): void;
780 | notInstanceOf(obj: Object, klass: Function, message?: string): void;
781 | matches(actual: any, regexp: RegExp, message?: string): void;
782 | notMatches(actual: any, regexp: RegExp, message?: string): void;
783 | throws(f: Function, expected?: string | RegExp): void;
784 | isTrue(v: boolean, msg?: string): void;
785 | isFalse(v: boolean, msg?: string): void;
786 | isNull(v: any, msg?: string): void;
787 | isNotNull(v: any, msg?: string): void;
788 | isUndefined(v: any, msg?: string): void;
789 | isNotUndefined(v: any, msg?: string): void;
790 | isNan(v: any, msg?: string): void;
791 | isNotNan(v: any, msg?: string): void;
792 | include(s: Array | Object | string, value: any, msg?: string, not?: boolean): void;
793 |
794 | notInclude(s: Array | Object | string, value: any, msg?: string, not?: boolean): void;
795 | length(obj: ILengthAble, expected_length: number, msg?: string): void;
796 | _stringEqual(actual: string, expected: string, msg?: string): void;
797 | }
798 |
799 | declare module Tinytest {
800 | function add(description: string, func: (test: ITinytestAssertions) => void): void;
801 | function addAsync(description: string, func: (test: ITinytestAssertions) => void): void;
802 | }
803 |
804 | declare module App {
805 | function accessRule(pattern: string, options?: {
806 | type?: string;
807 | launchExternal?: boolean;
808 | }): void;
809 | function configurePlugin(id: string, config: Object): void;
810 | function icons(icons: Object): void;
811 | function info(options: {
812 | id?: string;
813 | version?: string;
814 | name?: string;
815 | description?: string;
816 | author?: string;
817 | email?: string;
818 | website?: string;
819 | }): void;
820 | function launchScreens(launchScreens: Object): void;
821 | function setPreference(name: string, value: string, platform?: string): void;
822 | }
823 |
824 | declare function execFileAsync(command: string, args?: any[], options?: {
825 | cwd?: Object;
826 | env?: Object;
827 | stdio?: any[] | string;
828 | destination?: any;
829 | waitForClose?: string;
830 | }): any;
831 | declare function execFileSync(command: string, args?: any[], options?: {
832 | cwd?: Object;
833 | env?: Object;
834 | stdio?: any[] | string;
835 | destination?: any;
836 | waitForClose?: string;
837 | }): String;
838 |
839 | declare module Assets {
840 | function getBinary(assetPath: string, asyncCallback?: Function): EJSON;
841 | function getText(assetPath: string, asyncCallback?: Function): string;
842 | function absoluteFilePath(assetPath: string): string;
843 | }
844 |
845 | declare module Cordova {
846 | function depends(dependencies: { [id: string]: string }): void;
847 | }
848 |
849 | declare module Npm {
850 | function depends(dependencies: { [id: string]: string }): void;
851 | function require(name: string): any;
852 | }
853 |
854 | declare namespace Package {
855 | function describe(options: {
856 | summary?: string;
857 | version?: string;
858 | name?: string;
859 | git?: string;
860 | documentation?: string;
861 | debugOnly?: boolean;
862 | prodOnly?: boolean;
863 | testOnly?: boolean;
864 | }): void;
865 | function onTest(func: (api: PackageAPI) => void): void;
866 | function onUse(func: (api: PackageAPI) => void): void;
867 | function registerBuildPlugin(options?: {
868 | name?: string;
869 | use?: string | string[];
870 | sources?: string[];
871 | npmDependencies?: Object;
872 | }): void;
873 | }
874 |
875 | interface PackageAPI {
876 | new (): PackageAPI;
877 | addAssets(filenames: string | string[], architecture: string | string[]): void;
878 | addFiles(filenames: string | string[], architecture?: string | string[], options?: {
879 | bare?: boolean;
880 | }): void;
881 | export(exportedObjects: string | string[], architecture?: string | string[], exportOptions?: Object, testOnly?: boolean): void;
882 | imply(packageNames: string | string[], architecture?: string | string[]): void;
883 | use(packageNames: string | string[], architecture?: string | string[], options?: {
884 | weak?: boolean;
885 | unordered?: boolean;
886 | }): void;
887 | versionsFrom(meteorRelease: string | string[]): void;
888 | }
889 |
890 | declare var console: Console;
891 |
892 | declare module Tracker {
893 | function Computation(): void;
894 | interface Computation {
895 | firstRun: boolean;
896 | invalidate(): void;
897 | invalidated: boolean;
898 | onInvalidate(callback: Function): void;
899 | onStop(callback: Function): void;
900 | stop(): void;
901 | stopped: boolean;
902 | }
903 | var currentComputation: Computation;
904 |
905 | var Dependency: DependencyStatic;
906 | interface DependencyStatic {
907 | new (): Dependency;
908 | }
909 | interface Dependency {
910 | changed(): void;
911 | depend(fromComputation?: Computation): boolean;
912 | hasDependents(): boolean;
913 | }
914 |
915 | var active: boolean;
916 | function afterFlush(callback: Function): void;
917 | function autorun(runFunc: (computation: Computation) => void, options?: {
918 | onError?: Function;
919 | }): Computation;
920 | function flush(): void;
921 | function nonreactive(func: Function): void;
922 | function onInvalidate(callback: Function): void;
923 | }
924 |
--------------------------------------------------------------------------------
/1.2/packages/accounts-base.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 | interface URLS {
3 | resetPassword: (token: string) => string;
4 | verifyEmail: (token: string) => string;
5 | enrollAccount: (token: string) => string;
6 | }
7 |
8 | declare module Accounts {
9 | var urls: URLS;
10 |
11 | function user(): Meteor.User;
12 | function userId(): string;
13 |
14 | function createUser(options: {
15 | username?: string;
16 | email?: string;
17 | password?: string;
18 | profile?: Object;
19 | }, callback?: Function): string;
20 |
21 | function config(options: {
22 | sendVerificationEmail?: boolean;
23 | forbidClientAccountCreation?: boolean;
24 | restrictCreationByEmailDomain?: string | Function;
25 | loginExpirationInDays?: number;
26 | oauthSecretKey?: string;
27 | }): void;
28 |
29 | function onLogin(func: Function): { stop: () => void };
30 | function onLoginFailure(func: Function): { stop: () => void };
31 |
32 | function loginServicesConfigured(): boolean;
33 | function onPageLoadLogin(func: Function): void;
34 | }
35 |
--------------------------------------------------------------------------------
/1.2/packages/accounts-base_browser.d.ts:
--------------------------------------------------------------------------------
1 | declare module Accounts {
2 | function changePassword(oldPassword: string, newPassword: string, callback?: Function): void;
3 | function forgotPassword(options: {
4 | email?: string;
5 | }, callback?: Function): void;
6 | function resetPassword(token: string, newPassword: string, callback?: Function): void;
7 | function verifyEmail(token: string, callback?: Function): void;
8 |
9 | function onEmailVerificationLink(callback: Function): void;
10 | function onEnrollmentLink(callback: Function): void;
11 | function onResetPasswordLink(callback: Function): void;
12 |
13 | function loggingIn(): boolean;
14 | function logout(callback?: Function): void;
15 | function logoutOtherClients(callback?: Function): void;
16 |
17 | var ui: {
18 | config(options: {
19 | requestPermissions?: Object;
20 | requestOfflineToken?: Object;
21 | forceApprovalPrompt?: Object;
22 | passwordSignupFields?: string;
23 | }): void;
24 | };
25 | }
26 |
--------------------------------------------------------------------------------
/1.2/packages/accounts-base_main.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 | ///
3 |
4 | interface EmailFields {
5 | from?: () => string;
6 | subject?: (user: Meteor.User) => string;
7 | text?: (user: Meteor.User, url: string) => string;
8 | html?: (user: Meteor.User, url: string) => string;
9 | }
10 |
11 | interface Header {
12 | [id: string]: string;
13 | }
14 |
15 | interface EmailTemplates {
16 | from: string;
17 | siteName: string;
18 | headers?: Header;
19 | resetPassword: EmailFields;
20 | enrollAccount: EmailFields;
21 | verifyEmail: EmailFields;
22 | }
23 |
24 | declare module Accounts {
25 | var emailTemplates: EmailTemplates;
26 | function addEmail(userId: string, newEmail: string, verified?: boolean): void;
27 | function removeEmail(userId: string, email: string): void;
28 |
29 | function onCreateUser(func: Function): void;
30 | function findUserByEmail(email: string): Object;
31 | function findUserByUsername(username: string): Object;
32 |
33 | function sendEnrollmentEmail(userId: string, email?: string): void;
34 | function sendResetPasswordEmail(userId: string, email?: string): void;
35 | function sendVerificationEmail(userId: string, email?: string): void;
36 |
37 | function setUsername(userId: string, newUsername: string): void;
38 | function setPassword(userId: string, newPassword: string, options?: {
39 | logout?: Object;
40 | }): void;
41 |
42 | function validateNewUser(func: Function): boolean;
43 | function validateLoginAttempt(func: Function): { stop: () => void };
44 |
45 | interface IValidateLoginAttemptCbOpts {
46 | type: string;
47 | allowed: boolean;
48 | error: Meteor.Error;
49 | user: Meteor.User;
50 | connection: Meteor.Connection;
51 | methodName: string;
52 | methodArguments: any[];
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/1.2/packages/blaze_browser.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
3 | declare module Blaze {
4 | var View: ViewStatic;
5 |
6 | interface ViewStatic {
7 | new (name?: string, renderFunction?: Function): View;
8 | }
9 |
10 | interface View {
11 | name: string;
12 | parentView: View;
13 | isCreated: boolean;
14 | isRendered: boolean;
15 | isDestroyed: boolean;
16 | renderCount: number;
17 | autorun(runFunc: (computation: Tracker.Computation) => void): Tracker.Computation;
18 | onViewCreated(func: Function): void;
19 | onViewReady(func: Function): void;
20 | onViewDestroyed(func: Function): void;
21 | firstNode(): Node;
22 | lastNode(): Node;
23 | template: Template;
24 | templateInstance(): TemplateInstance;
25 | }
26 | var currentView: View;
27 |
28 | function isTemplate(value: any): boolean;
29 |
30 | interface HelpersMap {
31 | [key: string]: Function;
32 | }
33 |
34 | interface EventsMap {
35 | [key: string]: Function;
36 | }
37 |
38 | var Template: TemplateStatic;
39 |
40 | interface TemplateStatic {
41 | new (viewName?: string, renderFunction?: Function): Template;
42 |
43 | registerHelper(name: string, func: Function): void;
44 | instance(): TemplateInstance;
45 | currentData(): any;
46 | parentData(numLevels: number): any;
47 | }
48 |
49 | interface Template {
50 | viewName: string;
51 | renderFunction: Function;
52 | constructView(): View;
53 | head: Template;
54 | find(selector: string): HTMLElement;
55 | findAll(selector: string): HTMLElement[];
56 | $: any;
57 | onCreated(cb: Function): void;
58 | onRendered(cb: Function): void;
59 | onDestroyed(cb: Function): void;
60 | created: Function;
61 | rendered: Function;
62 | destroyed: Function;
63 | helpers(helpersMap: HelpersMap): void;
64 | events(eventsMap: EventsMap): void;
65 | }
66 |
67 | var TemplateInstance: TemplateInstanceStatic;
68 |
69 | interface TemplateInstanceStatic {
70 | new (view: View): TemplateInstance;
71 | }
72 |
73 | interface TemplateInstance {
74 | $(selector: string): any;
75 | autorun(runFunc: (computation: Tracker.Computation) => void): Tracker.Computation;
76 | data: Object;
77 | find(selector: string): HTMLElement;
78 | findAll(selector: string): HTMLElement[];
79 | firstNode: Object;
80 | lastNode: Object;
81 | subscribe(name: string, ...args: any[]): Meteor.SubscriptionHandle;
82 | subscriptionsReady(): boolean;
83 | view: Object;
84 | }
85 |
86 | function Each(argFunc: Function, contentFunc: Function, elseFunc?: Function): View;
87 | function Unless(conditionFunc: Function, contentFunc: Function, elseFunc?: Function): View;
88 | function If(conditionFunc: Function, contentFunc: Function, elseFunc?: Function): View;
89 |
90 | function Let(bindings: Function, contentFunc: Function): View;
91 | function With(data: Object | Function, contentFunc: Function): View;
92 |
93 | function getData(elementOrView?: HTMLElement | View): Object;
94 | function getView(element?: HTMLElement): View;
95 |
96 | function remove(renderedView: View): void;
97 | function render(templateOrView: Template | View, parentNode: Node, nextNode?: Node, parentView?: View): View;
98 | function renderWithData(templateOrView: Template | View, data: Object | Function, parentNode: Node, nextNode?: Node, parentView?: View): View;
99 | function toHTML(templateOrView: Template | View): string;
100 | function toHTMLWithData(templateOrView: Template | View, data: Object | Function): string;
101 | }
102 |
--------------------------------------------------------------------------------
/1.2/packages/browser-policy-common.d.ts:
--------------------------------------------------------------------------------
1 | declare module BrowserPolicy {
2 | var framing: {
3 | disallow(): void;
4 | restrictToOrigin(origin: string): void;
5 | allowAll(): void;
6 | };
7 |
8 | var content: {
9 | allowEval(): void;
10 | allowInlineStyles(): void;
11 | allowInlineScripts(): void;
12 | allowSameOriginForAll(): void;
13 | allowDataUrlForAll(): void;
14 | allowOriginForAll(origin: string): void;
15 | allowImageOrigin(origin: string): void;
16 | allowMediaOrigin(origin: string): void;
17 | allowFontOrigin(origin: string): void;
18 | allowStyleOrigin(origin: string): void;
19 | allowScriptOrigin(origin: string): void;
20 | allowFrameOrigin(origin: string): void;
21 | allowContentTypeSniffing(): void;
22 | allowAllContentOrigin(): void;
23 | allowAllContentDataUrl(): void;
24 | allowAllContentSameOrigin(): void;
25 |
26 | disallowAll(): void;
27 | disallowInlineStyles(): void;
28 | disallowEval(): void;
29 | disallowInlineScripts(): void;
30 | disallowFont(): void;
31 | disallowObject(): void;
32 | disallowAllContent(): void;
33 | };
34 | }
35 |
--------------------------------------------------------------------------------
/1.2/packages/check.d.ts:
--------------------------------------------------------------------------------
1 | declare module Match {
2 | var Any: any;
3 | var String: any;
4 | var Integer: any;
5 | var Boolean: any;
6 | var undefined: any;
7 | var Object: any;
8 | function Optional(pattern: any): boolean;
9 | function ObjectIncluding(dico: any): boolean;
10 | function OneOf(...patterns: any[]): any;
11 | function Where(condition: any): any;
12 | function test(value: any, pattern: any): boolean;
13 | }
14 |
15 | declare function check(value: any, pattern: any): void;
16 |
--------------------------------------------------------------------------------
/1.2/packages/ddp-rate-limiter_main.d.ts:
--------------------------------------------------------------------------------
1 | declare module DDPRateLimiter {
2 | interface Matcher {
3 | type?: string | ((type: string) => boolean);
4 | name?: string | ((name: string) => boolean);
5 | userId?: string | ((userId: string) => boolean);
6 | connectionId?: string | ((connectionId: string) => boolean);
7 | clientAddress?: string | ((clientAddress: string) => boolean);
8 | }
9 |
10 | function addRule(matcher: Matcher, numRequests: number, timeInterval: number): string;
11 |
12 | function removeRule(ruleId: string): boolean;
13 | }
14 |
--------------------------------------------------------------------------------
/1.2/packages/ddp.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
3 | declare module DDP {
4 | interface DDPStatic {
5 | subscribe(name: string, ...rest: any[]): Meteor.SubscriptionHandle;
6 | call(method: string, ...parameters: any[]): void;
7 | apply(method: string, ...parameters: any[]): void;
8 | methods(IMeteorMethodsDictionary: any): any;
9 | status(): DDPStatus;
10 | reconnect(): void;
11 | disconnect(): void;
12 | onReconnect(): void;
13 | }
14 |
15 | function _allSubscriptionsReady(): boolean;
16 |
17 | type Status = 'connected' | 'connecting' | 'failed' | 'waiting' | 'offline';
18 |
19 | interface DDPStatus {
20 | connected: boolean;
21 | status: Status;
22 | retryCount: number;
23 | retryTime?: number;
24 | reason?: string;
25 | }
26 |
27 | function connect(url: string): DDPStatic;
28 | }
29 |
30 | declare module DDPCommon {
31 | interface MethodInvocation {
32 | new (options: {}): MethodInvocation;
33 |
34 | unblock(): void;
35 |
36 | setUserId(userId: number): void;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/1.2/packages/ejson.d.ts:
--------------------------------------------------------------------------------
1 | interface EJSONableCustomType {
2 | clone(): EJSONableCustomType;
3 | equals(other: Object): boolean;
4 | toJSONValue(): JSONable;
5 | typeName(): string;
6 | }
7 | interface EJSONable {
8 | [key: string]: number | string | boolean | Object | number[] | string[] | Object[] | Date | Uint8Array | EJSONableCustomType;
9 | }
10 | interface JSONable {
11 | [key: string]: number | string | boolean | Object | number[] | string[] | Object[];
12 | }
13 | interface EJSON extends EJSONable { }
14 |
15 | declare module EJSON {
16 | function addType(name: string, factory: (val: JSONable) => EJSONableCustomType): void;
17 | function clone(val: T): T;
18 | function equals(a: EJSON, b: EJSON, options?: {
19 | keyOrderSensitive?: boolean;
20 | }): boolean;
21 | function fromJSONValue(val: JSONable): any;
22 | function isBinary(x: Object): boolean;
23 | var newBinary: any;
24 | function parse(str: string): EJSON;
25 | function stringify(val: EJSON, options?: {
26 | indent?: boolean | number | string;
27 | canonical?: boolean;
28 | }): string;
29 | function toJSONValue(val: EJSON): JSONable;
30 | }
31 |
--------------------------------------------------------------------------------
/1.2/packages/email_main.d.ts:
--------------------------------------------------------------------------------
1 | declare module Email {
2 | function send(options: {
3 | from?: string;
4 | to?: string | string[];
5 | cc?: string | string[];
6 | bcc?: string | string[];
7 | replyTo?: string | string[];
8 | subject?: string;
9 | text?: string;
10 | html?: string;
11 | headers?: Object;
12 | attachments?: Object[];
13 | mailComposer?: MailComposer;
14 | }): void;
15 | }
16 |
17 | interface MailComposerOptions {
18 | escapeSMTP: boolean;
19 | encoding: string;
20 | charset: string;
21 | keepBcc: boolean;
22 | forceEmbeddedImages: boolean;
23 | }
24 |
25 | declare var MailComposer: MailComposerStatic;
26 | interface MailComposerStatic {
27 | new (options: MailComposerOptions): MailComposer;
28 | }
29 | interface MailComposer {
30 | addHeader(name: string, value: string): void;
31 | setMessageOption(from: string, to: string, body: string, html: string): void;
32 | streamMessage(): void;
33 | pipe(stream: any /** fs.WriteStream **/): void;
34 | }
35 |
--------------------------------------------------------------------------------
/1.2/packages/http.d.ts:
--------------------------------------------------------------------------------
1 | declare module HTTP {
2 | interface HTTPRequest {
3 | content?: string;
4 | data?: any;
5 | query?: string;
6 | params?: { [id: string]: string };
7 | auth?: string;
8 | headers?: { [id: string]: string };
9 | timeout?: number;
10 | followRedirects?: boolean;
11 | npmRequestOptions?: Object;
12 | }
13 |
14 | interface HTTPResponse {
15 | statusCode?: number;
16 | headers?: { [id: string]: string };
17 | content?: string;
18 | data?: any;
19 | }
20 |
21 | function call(method: string, url: string, options?: HTTP.HTTPRequest, asyncCallback?: Function): HTTP.HTTPResponse;
22 | function del(url: string, callOptions?: HTTP.HTTPRequest, asyncCallback?: Function): HTTP.HTTPResponse;
23 | function get(url: string, callOptions?: HTTP.HTTPRequest, asyncCallback?: Function): HTTP.HTTPResponse;
24 | function post(url: string, callOptions?: HTTP.HTTPRequest, asyncCallback?: Function): HTTP.HTTPResponse;
25 | function put(url: string, callOptions?: HTTP.HTTPRequest, asyncCallback?: Function): HTTP.HTTPResponse;
26 | function call(method: string, url: string, options?: {
27 | content?: string;
28 | data?: Object;
29 | query?: string;
30 | params?: Object;
31 | auth?: string;
32 | headers?: Object;
33 | timeout?: number;
34 | followRedirects?: boolean;
35 | npmRequestOptions?: Object;
36 | beforeSend?: Function;
37 | }, asyncCallback?: Function): HTTP.HTTPResponse;
38 | }
39 |
--------------------------------------------------------------------------------
/1.2/packages/meteor.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 | ///
3 |
4 | declare module Meteor {
5 | /** Global props **/
6 | var isClient: boolean;
7 | var isCordova: boolean;
8 | var isServer: boolean;
9 | var isProduction: boolean;
10 | var release: string;
11 | /** Global props **/
12 |
13 | /** Settings **/
14 | interface Settings {
15 | public: {[id:string]: any},
16 | [id:string]: any
17 | }
18 | var settings: Settings;
19 | /** Settings **/
20 |
21 | /** User **/
22 | interface UserEmail {
23 | address: string;
24 | verified: boolean;
25 | }
26 | interface User {
27 | _id?: string;
28 | username?: string;
29 | emails?: UserEmail[];
30 | createdAt?: number;
31 | profile?: any;
32 | services?: any;
33 | }
34 | function user(): User;
35 | function userId(): string;
36 | var users: Mongo.Collection;
37 | /** User **/
38 |
39 | /** Error **/
40 | var Error: ErrorStatic;
41 | interface ErrorStatic {
42 | new (error: string | number, reason?: string, details?: string): Error;
43 | }
44 | interface Error {
45 | error: string | number;
46 | reason?: string;
47 | details?: string;
48 | }
49 | /** Error **/
50 |
51 | /** Method **/
52 | function methods(methods: Object): void;
53 | function call(name: string, ...args: any[]): any;
54 | function apply(name: string, args: EJSONable[], options?: {
55 | wait?: boolean;
56 | onResultReceived?: Function;
57 | }, asyncCallback?: Function): any;
58 | /** Method **/
59 |
60 | /** Url **/
61 | function absoluteUrl(path?: string, options?: {
62 | secure?: boolean;
63 | replaceLocalhost?: boolean;
64 | rootUrl?: string;
65 | }): string;
66 | /** Url **/
67 |
68 | /** Timeout **/
69 | function setInterval(func: Function, delay: number): number;
70 | function setTimeout(func: Function, delay: number): number;
71 | function clearInterval(id: number): void;
72 | function clearTimeout(id: number): void;
73 | function defer(func: Function): void;
74 | /** Timeout **/
75 |
76 | /** utils **/
77 | function startup(func: Function): void;
78 | function wrapAsync(func: Function, context?: Object): any;
79 | function bindEnvironment(func: Function): any;
80 | /** utils **/
81 |
82 | /** Pub/Sub **/
83 | interface SubscriptionHandle {
84 | stop(): void;
85 | ready(): boolean;
86 | }
87 | interface LiveQueryHandle {
88 | stop(): void;
89 | }
90 | /** Pub/Sub **/
91 | }
92 |
--------------------------------------------------------------------------------
/1.2/packages/meteor_browser.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
3 | declare module Meteor {
4 | /** Login **/
5 | interface LoginWithExternalServiceOptions {
6 | requestPermissions?: string[];
7 | requestOfflineToken?: Boolean;
8 | forceApprovalPrompt?: Boolean;
9 | loginUrlParameters?: Object;
10 | redirectUrl?: string;
11 | loginHint?: string;
12 | loginStyle?: string;
13 | }
14 | function loginWithMeteorDeveloperAccount(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
15 | function loginWithFacebook(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
16 | function loginWithGithub(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
17 | function loginWithGoogle(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
18 | function loginWithMeetup(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
19 | function loginWithTwitter(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
20 | function loginWithWeibo(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
21 | function loggingIn(): boolean;
22 | function loginWith(options?: {
23 | requestPermissions?: string[];
24 | requestOfflineToken?: boolean;
25 | loginUrlParameters?: Object;
26 | userEmail?: string;
27 | loginStyle?: string;
28 | redirectUrl?: string;
29 | }, callback?: Function): void;
30 | function loginWithPassword(user: Object | string, password: string, callback?: Function): void;
31 | function loginWithToken(token: string, callback?: Function): void;
32 | function logout(callback?: Function): void;
33 | function logoutOtherClients(callback?: Function): void;
34 | /** Login **/
35 |
36 | /** Event **/
37 | interface Event {
38 | type: string;
39 | target: HTMLElement;
40 | currentTarget: HTMLElement;
41 | which: number;
42 | stopPropagation(): void;
43 | stopImmediatePropagation(): void;
44 | preventDefault(): void;
45 | isPropagationStopped(): boolean;
46 | isImmediatePropagationStopped(): boolean;
47 | isDefaultPrevented(): boolean;
48 | }
49 | interface EventHandlerFunction extends Function {
50 | (event?: Meteor.Event, templateInstance?: Blaze.TemplateInstance): void;
51 | }
52 | interface EventMap {
53 | [id: string]: Meteor.EventHandlerFunction;
54 | }
55 | /** Event **/
56 |
57 | /** Connection **/
58 | function reconnect(): void;
59 | function disconnect(): void;
60 | /** Connection **/
61 |
62 | /** Status **/
63 | function status(): DDP.DDPStatus;
64 | /** Status **/
65 |
66 | /** Pub/Sub **/
67 | function subscribe(name: string, ...args: any[]): Meteor.SubscriptionHandle;
68 | /** Pub/Sub **/
69 | }
70 |
--------------------------------------------------------------------------------
/1.2/packages/meteor_main.d.ts:
--------------------------------------------------------------------------------
1 | declare module Meteor {
2 | /** Connection **/
3 | interface Connection {
4 | id: string;
5 | close: Function;
6 | onClose: Function;
7 | clientAddress: string;
8 | httpHeaders: Object;
9 | }
10 | function onConnection(callback: Function): void;
11 | /** Connection **/
12 |
13 | function publish(name: string, func: Function): void;
14 |
15 | function _debug(...args: any[]): void;
16 | }
17 |
18 | interface Subscription {
19 | added(collection: string, id: string, fields: Object): void;
20 | changed(collection: string, id: string, fields: Object): void;
21 | connection: Meteor.Connection;
22 | error(error: Error): void;
23 | onStop(func: Function): void;
24 | ready(): void;
25 | removed(collection: string, id: string): void;
26 | stop(): void;
27 | userId: string;
28 | }
29 |
--------------------------------------------------------------------------------
/1.2/packages/mongo.d.ts:
--------------------------------------------------------------------------------
1 | declare module Mongo {
2 | interface Selector {
3 | [key: string]: any;
4 | }
5 | interface Selector extends Object { }
6 | interface Modifier { }
7 | interface SortSpecifier { }
8 | interface FieldSpecifier {
9 | [id: string]: Number;
10 | }
11 |
12 | var Collection: CollectionStatic;
13 | interface CollectionStatic {
14 | new (name: string | null, options?: {
15 | connection?: Object;
16 | idGeneration?: string;
17 | transform?: Function;
18 | }): Collection;
19 | }
20 | interface Collection {
21 | allow(options: {
22 | insert?: (userId: string, doc: T) => boolean;
23 | update?: (userId: string, doc: T, fieldNames: string[], modifier: any) => boolean;
24 | remove?: (userId: string, doc: T) => boolean;
25 | fetch?: string[];
26 | transform?: Function;
27 | }): boolean;
28 | deny(options: {
29 | insert?: (userId: string, doc: T) => boolean;
30 | update?: (userId: string, doc: T, fieldNames: string[], modifier: any) => boolean;
31 | remove?: (userId: string, doc: T) => boolean;
32 | fetch?: string[];
33 | transform?: Function;
34 | }): boolean;
35 | find(selector?: Selector | ObjectID | string, options?: {
36 | sort?: SortSpecifier;
37 | skip?: number;
38 | limit?: number;
39 | fields?: FieldSpecifier;
40 | reactive?: boolean;
41 | transform?: Function;
42 | }): Cursor;
43 | findOne(selector?: Selector | ObjectID | string, options?: {
44 | sort?: SortSpecifier;
45 | skip?: number;
46 | fields?: FieldSpecifier;
47 | reactive?: boolean;
48 | transform?: Function;
49 | }): T;
50 | insert(doc: T, callback?: Function): string;
51 | rawCollection(): any;
52 | rawDatabase(): any;
53 | remove(selector: Selector | ObjectID | string, callback?: Function): number;
54 | update(selector: Selector | ObjectID | string, modifier: Modifier, options?: {
55 | multi?: boolean;
56 | upsert?: boolean;
57 | }, callback?: Function): number;
58 | upsert(selector: Selector | ObjectID | string, modifier: Modifier, options?: {
59 | multi?: boolean;
60 | }, callback?: Function): { numberAffected?: number; insertedId?: string; };
61 | _ensureIndex(keys: { [key: string]: number | string } | string, options?: { [key: string]: any }): void;
62 | _dropIndex(keys: { [key: string]: number | string } | string): void;
63 | }
64 |
65 | var Cursor: CursorStatic;
66 | interface CursorStatic {
67 | new (): Cursor;
68 | }
69 | interface ObserveCallbacks {
70 | added?(document: Object): void;
71 | addedAt?(document: Object, atIndex: number, before: Object): void;
72 | changed?(newDocument: Object, oldDocument: Object): void;
73 | changedAt?(newDocument: Object, oldDocument: Object, indexAt: number): void;
74 | removed?(oldDocument: Object): void;
75 | removedAt?(oldDocument: Object, atIndex: number): void;
76 | movedTo?(document: Object, fromIndex: number, toIndex: number, before: Object): void;
77 | }
78 | interface ObserveChangesCallbacks {
79 | added?(id: string, fields: Object): void;
80 | addedBefore?(id: string, fields: Object, before: Object): void;
81 | changed?(id: string, fields: Object): void;
82 | movedBefore?(id: string, before: Object): void;
83 | removed?(id: string): void;
84 | }
85 | interface Cursor {
86 | count(applySkipLimit?: boolean): number;
87 | fetch(): Array;
88 | forEach(callback: (doc: T, index: number, cursor: Cursor) => void, thisArg?: any): void;
89 | map(callback: (doc: T, index: number, cursor: Cursor) => U, thisArg?: any): Array;
90 | observe(callbacks: ObserveCallbacks): Meteor.LiveQueryHandle;
91 | observeChanges(callbacks: ObserveChangesCallbacks): Meteor.LiveQueryHandle;
92 | }
93 |
94 | var ObjectID: ObjectIDStatic;
95 | interface ObjectIDStatic {
96 | new (hexString?: string): ObjectID;
97 | }
98 | interface ObjectID { }
99 | }
100 |
--------------------------------------------------------------------------------
/1.2/packages/mongo_main.d.ts:
--------------------------------------------------------------------------------
1 | declare module Mongo {
2 | interface AllowDenyOptions {
3 | insert?: (userId: string, doc: any) => boolean;
4 | update?: (userId: string, doc: any, fieldNames: string[], modifier: any) => boolean;
5 | remove?: (userId: string, doc: any) => boolean;
6 | fetch?: string[];
7 | transform?: Function;
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/1.2/packages/random.d.ts:
--------------------------------------------------------------------------------
1 | declare module Random {
2 | function id(numberOfChars?: number): string;
3 | function secret(numberOfChars?: number): string;
4 | function fraction(): number;
5 | // @param numberOfDigits, @returns a random hex string of the given length
6 | function hexString(numberOfDigits: number): string;
7 | // @param array, @return a random element in array
8 | function choice(array: any[]): string;
9 | // @param str, @return a random char in str
10 | function choice(str: string): string;
11 | }
12 |
--------------------------------------------------------------------------------
/1.2/packages/reactive-var.d.ts:
--------------------------------------------------------------------------------
1 | declare var ReactiveVar: ReactiveVarStatic;
2 | interface ReactiveVarStatic {
3 | new (initialValue: T, equalsFunc?: Function): ReactiveVar;
4 | }
5 | interface ReactiveVar {
6 | get(): T;
7 | set(newValue: T): void;
8 | }
9 |
--------------------------------------------------------------------------------
/1.2/packages/session_browser.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
3 | declare module Session {
4 | function equals(key: string, value: string | number | boolean | any): boolean;
5 | function get(key: string): any;
6 | function set(key: string, value: EJSONable | any): void;
7 | function setDefault(key: string, value: EJSONable | any): void;
8 | }
9 |
--------------------------------------------------------------------------------
/1.2/packages/templating_browser.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
3 | declare var Template: TemplateStatic;
4 | interface TemplateStatic extends Blaze.TemplateStatic {
5 | new (viewName?: string, renderFunction?: Function): Blaze.Template;
6 | body: Blaze.Template;
7 | [index: string]: any | Blaze.Template;
8 | }
9 |
--------------------------------------------------------------------------------
/1.2/packages/tiny-test.d.ts:
--------------------------------------------------------------------------------
1 | interface ILengthAble {
2 | length: number;
3 | }
4 |
5 | interface ITinytestAssertions {
6 | ok(doc: Object): void;
7 | expect_fail(): void;
8 | fail(doc: Object): void;
9 | runId(): string;
10 | equal(actual: T, expected: T, message?: string, not?: boolean): void;
11 | notEqual(actual: T, expected: T, message?: string): void;
12 | instanceOf(obj: Object, klass: Function, message?: string): void;
13 | notInstanceOf(obj: Object, klass: Function, message?: string): void;
14 | matches(actual: any, regexp: RegExp, message?: string): void;
15 | notMatches(actual: any, regexp: RegExp, message?: string): void;
16 | throws(f: Function, expected?: string | RegExp): void;
17 | isTrue(v: boolean, msg?: string): void;
18 | isFalse(v: boolean, msg?: string): void;
19 | isNull(v: any, msg?: string): void;
20 | isNotNull(v: any, msg?: string): void;
21 | isUndefined(v: any, msg?: string): void;
22 | isNotUndefined(v: any, msg?: string): void;
23 | isNan(v: any, msg?: string): void;
24 | isNotNan(v: any, msg?: string): void;
25 | include(s: Array | Object | string, value: any, msg?: string, not?: boolean): void;
26 |
27 | notInclude(s: Array | Object | string, value: any, msg?: string, not?: boolean): void;
28 | length(obj: ILengthAble, expected_length: number, msg?: string): void;
29 | _stringEqual(actual: string, expected: string, msg?: string): void;
30 | }
31 |
32 | declare module Tinytest {
33 | function add(description: string, func: (test: ITinytestAssertions) => void): void;
34 | function addAsync(description: string, func: (test: ITinytestAssertions) => void): void;
35 | }
36 |
--------------------------------------------------------------------------------
/1.2/packages/tools_main.d.ts:
--------------------------------------------------------------------------------
1 | declare module App {
2 | function accessRule(pattern: string, options?: {
3 | type?: string;
4 | launchExternal?: boolean;
5 | }): void;
6 | function configurePlugin(id: string, config: Object): void;
7 | function icons(icons: Object): void;
8 | function info(options: {
9 | id?: string;
10 | version?: string;
11 | name?: string;
12 | description?: string;
13 | author?: string;
14 | email?: string;
15 | website?: string;
16 | }): void;
17 | function launchScreens(launchScreens: Object): void;
18 | function setPreference(name: string, value: string, platform?: string): void;
19 | }
20 |
21 | declare function execFileAsync(command: string, args?: any[], options?: {
22 | cwd?: Object;
23 | env?: Object;
24 | stdio?: any[] | string;
25 | destination?: any;
26 | waitForClose?: string;
27 | }): any;
28 | declare function execFileSync(command: string, args?: any[], options?: {
29 | cwd?: Object;
30 | env?: Object;
31 | stdio?: any[] | string;
32 | destination?: any;
33 | waitForClose?: string;
34 | }): String;
35 |
36 | declare module Assets {
37 | function getBinary(assetPath: string, asyncCallback?: Function): EJSON;
38 | function getText(assetPath: string, asyncCallback?: Function): string;
39 | function absoluteFilePath(assetPath: string): string;
40 | }
41 |
42 | declare module Cordova {
43 | function depends(dependencies: { [id: string]: string }): void;
44 | }
45 |
46 | declare module Npm {
47 | function depends(dependencies: { [id: string]: string }): void;
48 | function require(name: string): any;
49 | }
50 |
51 | declare namespace Package {
52 | function describe(options: {
53 | summary?: string;
54 | version?: string;
55 | name?: string;
56 | git?: string;
57 | documentation?: string;
58 | debugOnly?: boolean;
59 | prodOnly?: boolean;
60 | testOnly?: boolean;
61 | }): void;
62 | function onTest(func: (api: PackageAPI) => void): void;
63 | function onUse(func: (api: PackageAPI) => void): void;
64 | function registerBuildPlugin(options?: {
65 | name?: string;
66 | use?: string | string[];
67 | sources?: string[];
68 | npmDependencies?: Object;
69 | }): void;
70 | }
71 |
72 | interface PackageAPI {
73 | new (): PackageAPI;
74 | addAssets(filenames: string | string[], architecture: string | string[]): void;
75 | addFiles(filenames: string | string[], architecture?: string | string[], options?: {
76 | bare?: boolean;
77 | }): void;
78 | export(exportedObjects: string | string[], architecture?: string | string[], exportOptions?: Object, testOnly?: boolean): void;
79 | imply(packageNames: string | string[], architecture?: string | string[]): void;
80 | use(packageNames: string | string[], architecture?: string | string[], options?: {
81 | weak?: boolean;
82 | unordered?: boolean;
83 | }): void;
84 | versionsFrom(meteorRelease: string | string[]): void;
85 | }
86 |
87 | declare var console: Console;
88 |
--------------------------------------------------------------------------------
/1.2/packages/tracker_browser.d.ts:
--------------------------------------------------------------------------------
1 | declare module Tracker {
2 | function Computation(): void;
3 | interface Computation {
4 | firstRun: boolean;
5 | invalidate(): void;
6 | invalidated: boolean;
7 | onInvalidate(callback: Function): void;
8 | onStop(callback: Function): void;
9 | stop(): void;
10 | stopped: boolean;
11 | }
12 | var currentComputation: Computation;
13 |
14 | var Dependency: DependencyStatic;
15 | interface DependencyStatic {
16 | new (): Dependency;
17 | }
18 | interface Dependency {
19 | changed(): void;
20 | depend(fromComputation?: Computation): boolean;
21 | hasDependents(): boolean;
22 | }
23 |
24 | var active: boolean;
25 | function afterFlush(callback: Function): void;
26 | function autorun(runFunc: (computation: Computation) => void, options?: {
27 | onError?: Function;
28 | }): Computation;
29 | function flush(): void;
30 | function nonreactive(func: Function): void;
31 | function onInvalidate(callback: Function): void;
32 | }
33 |
--------------------------------------------------------------------------------
/1.2/typings.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "meteor",
3 | "version": "1.2",
4 | "main": "main.d.ts",
5 | "browser": "browser.d.ts",
6 | "homepage": "https://meteor.com",
7 | "global": true,
8 | "files": [
9 | "header.d.ts"
10 | ],
11 | "resolution": {
12 | "main": "typings/main",
13 | "browser": "typings/browser"
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/1.3/browser.d.ts:
--------------------------------------------------------------------------------
1 | interface URLS {
2 | resetPassword: (token: string) => string;
3 | verifyEmail: (token: string) => string;
4 | enrollAccount: (token: string) => string;
5 | }
6 |
7 | declare module Accounts {
8 | var urls: URLS;
9 |
10 | function user(): Meteor.User;
11 |
12 | function userId(): string;
13 |
14 | function createUser(options: {
15 | username?: string;
16 | email?: string;
17 | password?: string;
18 | profile?: Object;
19 | }, callback?: Function): string;
20 |
21 | function config(options: {
22 | sendVerificationEmail?: boolean;
23 | forbidClientAccountCreation?: boolean;
24 | restrictCreationByEmailDomain?: string | Function;
25 | loginExpirationInDays?: number;
26 | oauthSecretKey?: string;
27 | }): void;
28 |
29 | function onLogin(func: Function): {
30 | stop: () => void
31 | };
32 |
33 | function onLoginFailure(func: Function): {
34 | stop: () => void
35 | };
36 |
37 | function loginServicesConfigured(): boolean;
38 |
39 | function onPageLoadLogin(func: Function): void;
40 | }
41 |
42 | declare module "meteor/accounts-base" {
43 | interface URLS {
44 | resetPassword: (token: string) => string;
45 | verifyEmail: (token: string) => string;
46 | enrollAccount: (token: string) => string;
47 | }
48 |
49 | module Accounts {
50 | var urls: URLS;
51 |
52 | function user(): Meteor.User;
53 |
54 | function userId(): string;
55 |
56 | function createUser(options: {
57 | username?: string;
58 | email?: string;
59 | password?: string;
60 | profile?: Object;
61 | }, callback?: Function): string;
62 |
63 | function config(options: {
64 | sendVerificationEmail?: boolean;
65 | forbidClientAccountCreation?: boolean;
66 | restrictCreationByEmailDomain?: string | Function;
67 | loginExpirationInDays?: number;
68 | oauthSecretKey?: string;
69 | }): void;
70 |
71 | function onLogin(func: Function): {
72 | stop: () => void
73 | };
74 |
75 | function onLoginFailure(func: Function): {
76 | stop: () => void
77 | };
78 |
79 | function loginServicesConfigured(): boolean;
80 |
81 | function onPageLoadLogin(func: Function): void;
82 | }
83 | }
84 |
85 | declare module Accounts {
86 | function changePassword(oldPassword: string, newPassword: string, callback?: Function): void;
87 |
88 | function forgotPassword(options: {
89 | email?: string;
90 | }, callback?: Function): void;
91 |
92 | function resetPassword(token: string, newPassword: string, callback?: Function): void;
93 |
94 | function verifyEmail(token: string, callback?: Function): void;
95 |
96 | function onEmailVerificationLink(callback: Function): void;
97 |
98 | function onEnrollmentLink(callback: Function): void;
99 |
100 | function onResetPasswordLink(callback: Function): void;
101 |
102 | function loggingIn(): boolean;
103 |
104 | function logout(callback?: Function): void;
105 |
106 | function logoutOtherClients(callback?: Function): void;
107 |
108 | var ui: {
109 | config(options: {
110 | requestPermissions?: Object;
111 | requestOfflineToken?: Object;
112 | forceApprovalPrompt?: Object;
113 | passwordSignupFields?: string;
114 | }): void;
115 | };
116 | }
117 |
118 | declare module "meteor/accounts-base" {
119 | module Accounts {
120 | function changePassword(oldPassword: string, newPassword: string, callback?: Function): void;
121 |
122 | function forgotPassword(options: {
123 | email?: string;
124 | }, callback?: Function): void;
125 |
126 | function resetPassword(token: string, newPassword: string, callback?: Function): void;
127 |
128 | function verifyEmail(token: string, callback?: Function): void;
129 |
130 | function onEmailVerificationLink(callback: Function): void;
131 |
132 | function onEnrollmentLink(callback: Function): void;
133 |
134 | function onResetPasswordLink(callback: Function): void;
135 |
136 | function loggingIn(): boolean;
137 |
138 | function logout(callback?: Function): void;
139 |
140 | function logoutOtherClients(callback?: Function): void;
141 |
142 | var ui: {
143 | config(options: {
144 | requestPermissions?: Object;
145 | requestOfflineToken?: Object;
146 | forceApprovalPrompt?: Object;
147 | passwordSignupFields?: string;
148 | }): void;
149 | };
150 | }
151 | }
152 |
153 | declare module Blaze {
154 | var View: ViewStatic;
155 |
156 | interface ViewStatic {
157 | new(name?: string, renderFunction?: Function): View;
158 | }
159 |
160 | interface View {
161 | name: string;
162 | parentView: View;
163 | isCreated: boolean;
164 | isRendered: boolean;
165 | isDestroyed: boolean;
166 | renderCount: number;
167 | autorun(runFunc: (computation: Tracker.Computation) => void): Tracker.Computation;
168 | onViewCreated(func: Function): void;
169 | onViewReady(func: Function): void;
170 | onViewDestroyed(func: Function): void;
171 | firstNode(): Node;
172 | lastNode(): Node;
173 | template: Template;
174 | templateInstance(): TemplateInstance;
175 | }
176 | var currentView: View;
177 |
178 | function isTemplate(value: any): boolean;
179 |
180 | interface HelpersMap {
181 | [key: string]: Function;
182 | }
183 |
184 | interface EventsMap {
185 | [key: string]: Function;
186 | }
187 |
188 | var Template: TemplateStatic;
189 |
190 | interface TemplateStatic {
191 | new(viewName?: string, renderFunction?: Function): Template;
192 |
193 | registerHelper(name: string, func: Function): void;
194 | instance(): TemplateInstance;
195 | currentData(): any;
196 | parentData(numLevels: number): any;
197 | }
198 |
199 | interface Template {
200 | viewName: string;
201 | renderFunction: Function;
202 | constructView(): View;
203 | head: Template;
204 | find(selector: string): HTMLElement;
205 | findAll(selector: string): HTMLElement[];
206 | $: any;
207 | onCreated(cb: Function): void;
208 | onRendered(cb: Function): void;
209 | onDestroyed(cb: Function): void;
210 | created: Function;
211 | rendered: Function;
212 | destroyed: Function;
213 | helpers(helpersMap: HelpersMap): void;
214 | events(eventsMap: EventsMap): void;
215 | }
216 |
217 | var TemplateInstance: TemplateInstanceStatic;
218 |
219 | interface TemplateInstanceStatic {
220 | new(view: View): TemplateInstance;
221 | }
222 |
223 | interface TemplateInstance {
224 | $(selector: string): any;
225 | autorun(runFunc: (computation: Tracker.Computation) => void): Tracker.Computation;
226 | data: Object;
227 | find(selector: string): HTMLElement;
228 | findAll(selector: string): HTMLElement[];
229 | firstNode: Object;
230 | lastNode: Object;
231 | subscribe(name: string, ...args: any[]): Meteor.SubscriptionHandle;
232 | subscriptionsReady(): boolean;
233 | view: Object;
234 | }
235 |
236 | function Each(argFunc: Function, contentFunc: Function, elseFunc?: Function): View;
237 |
238 | function Unless(conditionFunc: Function, contentFunc: Function, elseFunc?: Function): View;
239 |
240 | function If(conditionFunc: Function, contentFunc: Function, elseFunc?: Function): View;
241 |
242 | function Let(bindings: Function, contentFunc: Function): View;
243 |
244 | function With(data: Object | Function, contentFunc: Function): View;
245 |
246 | function getData(elementOrView?: HTMLElement | View): Object;
247 |
248 | function getView(element?: HTMLElement): View;
249 |
250 | function remove(renderedView: View): void;
251 |
252 | function render(templateOrView: Template | View, parentNode: Node, nextNode?: Node, parentView?: View): View;
253 |
254 | function renderWithData(templateOrView: Template | View, data: Object | Function, parentNode: Node, nextNode?: Node, parentView?: View): View;
255 |
256 | function toHTML(templateOrView: Template | View): string;
257 |
258 | function toHTMLWithData(templateOrView: Template | View, data: Object | Function): string;
259 | }
260 |
261 | declare module "meteor/blaze" {
262 | module Blaze {
263 | var View: ViewStatic;
264 |
265 | interface ViewStatic {
266 | new(name?: string, renderFunction?: Function): View;
267 | }
268 |
269 | interface View {
270 | name: string;
271 | parentView: View;
272 | isCreated: boolean;
273 | isRendered: boolean;
274 | isDestroyed: boolean;
275 | renderCount: number;
276 | autorun(runFunc: (computation: Tracker.Computation) => void): Tracker.Computation;
277 | onViewCreated(func: Function): void;
278 | onViewReady(func: Function): void;
279 | onViewDestroyed(func: Function): void;
280 | firstNode(): Node;
281 | lastNode(): Node;
282 | template: Template;
283 | templateInstance(): TemplateInstance;
284 | }
285 | var currentView: View;
286 |
287 | function isTemplate(value: any): boolean;
288 |
289 | interface HelpersMap {
290 | [key: string]: Function;
291 | }
292 |
293 | interface EventsMap {
294 | [key: string]: Function;
295 | }
296 |
297 | var Template: TemplateStatic;
298 |
299 | interface TemplateStatic {
300 | new(viewName?: string, renderFunction?: Function): Template;
301 |
302 | registerHelper(name: string, func: Function): void;
303 | instance(): TemplateInstance;
304 | currentData(): any;
305 | parentData(numLevels: number): any;
306 | }
307 |
308 | interface Template {
309 | viewName: string;
310 | renderFunction: Function;
311 | constructView(): View;
312 | head: Template;
313 | find(selector: string): HTMLElement;
314 | findAll(selector: string): HTMLElement[];
315 | $: any;
316 | onCreated(cb: Function): void;
317 | onRendered(cb: Function): void;
318 | onDestroyed(cb: Function): void;
319 | created: Function;
320 | rendered: Function;
321 | destroyed: Function;
322 | helpers(helpersMap: HelpersMap): void;
323 | events(eventsMap: EventsMap): void;
324 | }
325 |
326 | var TemplateInstance: TemplateInstanceStatic;
327 |
328 | interface TemplateInstanceStatic {
329 | new(view: View): TemplateInstance;
330 | }
331 |
332 | interface TemplateInstance {
333 | $(selector: string): any;
334 | autorun(runFunc: (computation: Tracker.Computation) => void): Tracker.Computation;
335 | data: Object;
336 | find(selector: string): HTMLElement;
337 | findAll(selector: string): HTMLElement[];
338 | firstNode: Object;
339 | lastNode: Object;
340 | subscribe(name: string, ...args: any[]): Meteor.SubscriptionHandle;
341 | subscriptionsReady(): boolean;
342 | view: Object;
343 | }
344 |
345 | function Each(argFunc: Function, contentFunc: Function, elseFunc?: Function): View;
346 |
347 | function Unless(conditionFunc: Function, contentFunc: Function, elseFunc?: Function): View;
348 |
349 | function If(conditionFunc: Function, contentFunc: Function, elseFunc?: Function): View;
350 |
351 | function Let(bindings: Function, contentFunc: Function): View;
352 |
353 | function With(data: Object | Function, contentFunc: Function): View;
354 |
355 | function getData(elementOrView?: HTMLElement | View): Object;
356 |
357 | function getView(element?: HTMLElement): View;
358 |
359 | function remove(renderedView: View): void;
360 |
361 | function render(templateOrView: Template | View, parentNode: Node, nextNode?: Node, parentView?: View): View;
362 |
363 | function renderWithData(templateOrView: Template | View, data: Object | Function, parentNode: Node, nextNode?: Node, parentView?: View): View;
364 |
365 | function toHTML(templateOrView: Template | View): string;
366 |
367 | function toHTMLWithData(templateOrView: Template | View, data: Object | Function): string;
368 | }
369 | }
370 |
371 | declare module BrowserPolicy {
372 | var framing: {
373 | disallow(): void;
374 | restrictToOrigin(origin: string): void;
375 | allowAll(): void;
376 | };
377 |
378 | var content: {
379 | allowEval(): void;
380 | allowInlineStyles(): void;
381 | allowInlineScripts(): void;
382 | allowSameOriginForAll(): void;
383 | allowDataUrlForAll(): void;
384 | allowOriginForAll(origin: string): void;
385 | allowImageOrigin(origin: string): void;
386 | allowMediaOrigin(origin: string): void;
387 | allowFontOrigin(origin: string): void;
388 | allowStyleOrigin(origin: string): void;
389 | allowScriptOrigin(origin: string): void;
390 | allowFrameOrigin(origin: string): void;
391 | allowContentTypeSniffing(): void;
392 | allowAllContentOrigin(): void;
393 | allowAllContentDataUrl(): void;
394 | allowAllContentSameOrigin(): void;
395 |
396 | disallowAll(): void;
397 | disallowInlineStyles(): void;
398 | disallowEval(): void;
399 | disallowInlineScripts(): void;
400 | disallowFont(): void;
401 | disallowObject(): void;
402 | disallowAllContent(): void;
403 | };
404 | }
405 |
406 | declare module "meteor/browser-policy-common" {
407 | module BrowserPolicy {
408 | var framing: {
409 | disallow(): void;
410 | restrictToOrigin(origin: string): void;
411 | allowAll(): void;
412 | };
413 |
414 | var content: {
415 | allowEval(): void;
416 | allowInlineStyles(): void;
417 | allowInlineScripts(): void;
418 | allowSameOriginForAll(): void;
419 | allowDataUrlForAll(): void;
420 | allowOriginForAll(origin: string): void;
421 | allowImageOrigin(origin: string): void;
422 | allowMediaOrigin(origin: string): void;
423 | allowFontOrigin(origin: string): void;
424 | allowStyleOrigin(origin: string): void;
425 | allowScriptOrigin(origin: string): void;
426 | allowFrameOrigin(origin: string): void;
427 | allowContentTypeSniffing(): void;
428 | allowAllContentOrigin(): void;
429 | allowAllContentDataUrl(): void;
430 | allowAllContentSameOrigin(): void;
431 |
432 | disallowAll(): void;
433 | disallowInlineStyles(): void;
434 | disallowEval(): void;
435 | disallowInlineScripts(): void;
436 | disallowFont(): void;
437 | disallowObject(): void;
438 | disallowAllContent(): void;
439 | };
440 | }
441 | }
442 |
443 | declare module Match {
444 | var Any: any;
445 | var String: any;
446 | var Integer: any;
447 | var Boolean: any;
448 | var undefined: any;
449 | var Object: any;
450 |
451 | function Optional(pattern: any): boolean;
452 |
453 | function ObjectIncluding(dico: any): boolean;
454 |
455 | function OneOf(...patterns: any[]): any;
456 |
457 | function Where(condition: any): any;
458 |
459 | function test(value: any, pattern: any): boolean;
460 | }
461 |
462 | declare function check(value: any, pattern: any): void;
463 |
464 | declare module "meteor/check" {
465 | module Match {
466 | var Any: any;
467 | var String: any;
468 | var Integer: any;
469 | var Boolean: any;
470 | var undefined: any;
471 | var Object: any;
472 |
473 | function Optional(pattern: any): boolean;
474 |
475 | function ObjectIncluding(dico: any): boolean;
476 |
477 | function OneOf(...patterns: any[]): any;
478 |
479 | function Where(condition: any): any;
480 |
481 | function test(value: any, pattern: any): boolean;
482 | }
483 |
484 | function check(value: any, pattern: any): void;
485 | }
486 |
487 | declare module DDP {
488 | interface DDPStatic {
489 | subscribe(name: string, ...rest: any[]): Meteor.SubscriptionHandle;
490 | call(method: string, ...parameters: any[]): void;
491 | apply(method: string, ...parameters: any[]): void;
492 | methods(IMeteorMethodsDictionary: any): any;
493 | status(): DDPStatus;
494 | reconnect(): void;
495 | disconnect(): void;
496 | onReconnect(): void;
497 | }
498 |
499 | function _allSubscriptionsReady(): boolean;
500 |
501 | type Status = 'connected' | 'connecting' | 'failed' | 'waiting' | 'offline';
502 |
503 | interface DDPStatus {
504 | connected: boolean;
505 | status: Status;
506 | retryCount: number;
507 | retryTime?: number;
508 | reason?: string;
509 | }
510 |
511 | function connect(url: string): DDPStatic;
512 | }
513 |
514 | declare module DDPCommon {
515 | interface MethodInvocation {
516 | new(options: {}): MethodInvocation;
517 |
518 | unblock(): void;
519 |
520 | setUserId(userId: number): void;
521 | }
522 | }
523 |
524 | declare module "meteor/ddp" {
525 | module DDP {
526 | interface DDPStatic {
527 | subscribe(name: string, ...rest: any[]): Meteor.SubscriptionHandle;
528 | call(method: string, ...parameters: any[]): void;
529 | apply(method: string, ...parameters: any[]): void;
530 | methods(IMeteorMethodsDictionary: any): any;
531 | status(): DDPStatus;
532 | reconnect(): void;
533 | disconnect(): void;
534 | onReconnect(): void;
535 | }
536 |
537 | function _allSubscriptionsReady(): boolean;
538 |
539 | type Status = 'connected' | 'connecting' | 'failed' | 'waiting' | 'offline';
540 |
541 | interface DDPStatus {
542 | connected: boolean;
543 | status: Status;
544 | retryCount: number;
545 | retryTime?: number;
546 | reason?: string;
547 | }
548 |
549 | function connect(url: string): DDPStatic;
550 | }
551 |
552 | module DDPCommon {
553 | interface MethodInvocation {
554 | new(options: {}): MethodInvocation;
555 |
556 | unblock(): void;
557 |
558 | setUserId(userId: number): void;
559 | }
560 | }
561 | }
562 |
563 | interface EJSONableCustomType {
564 | clone(): EJSONableCustomType;
565 | equals(other: Object): boolean;
566 | toJSONValue(): JSONable;
567 | typeName(): string;
568 | }
569 | interface EJSONable {
570 | [key: string]: number | string | boolean | Object | number[] | string[] | Object[] | Date | Uint8Array | EJSONableCustomType;
571 | }
572 | interface JSONable {
573 | [key: string]: number | string | boolean | Object | number[] | string[] | Object[];
574 | }
575 | interface EJSON extends EJSONable {}
576 |
577 | declare module EJSON {
578 | function addType(name: string, factory: (val: JSONable) => EJSONableCustomType): void;
579 |
580 | function clone < T > (val: T): T;
581 |
582 | function equals(a: EJSON, b: EJSON, options?: {
583 | keyOrderSensitive?: boolean;
584 | }): boolean;
585 |
586 | function fromJSONValue(val: JSONable): any;
587 |
588 | function isBinary(x: Object): boolean;
589 | var newBinary: any;
590 |
591 | function parse(str: string): EJSON;
592 |
593 | function stringify(val: EJSON, options?: {
594 | indent?: boolean | number | string;
595 | canonical?: boolean;
596 | }): string;
597 |
598 | function toJSONValue(val: EJSON): JSONable;
599 | }
600 |
601 | declare module "meteor/ejson" {
602 | interface EJSONableCustomType {
603 | clone(): EJSONableCustomType;
604 | equals(other: Object): boolean;
605 | toJSONValue(): JSONable;
606 | typeName(): string;
607 | }
608 | interface EJSONable {
609 | [key: string]: number | string | boolean | Object | number[] | string[] | Object[] | Date | Uint8Array | EJSONableCustomType;
610 | }
611 | interface JSONable {
612 | [key: string]: number | string | boolean | Object | number[] | string[] | Object[];
613 | }
614 | interface EJSON extends EJSONable {}
615 |
616 | module EJSON {
617 | function addType(name: string, factory: (val: JSONable) => EJSONableCustomType): void;
618 |
619 | function clone < T > (val: T): T;
620 |
621 | function equals(a: EJSON, b: EJSON, options?: {
622 | keyOrderSensitive?: boolean;
623 | }): boolean;
624 |
625 | function fromJSONValue(val: JSONable): any;
626 |
627 | function isBinary(x: Object): boolean;
628 | var newBinary: any;
629 |
630 | function parse(str: string): EJSON;
631 |
632 | function stringify(val: EJSON, options?: {
633 | indent?: boolean | number | string;
634 | canonical?: boolean;
635 | }): string;
636 |
637 | function toJSONValue(val: EJSON): JSONable;
638 | }
639 | }
640 |
641 | declare module HTTP {
642 | interface HTTPRequest {
643 | content?: string;
644 | data?: any;
645 | query?: string;
646 | params?: {
647 | [id: string]: string
648 | };
649 | auth?: string;
650 | headers?: {
651 | [id: string]: string
652 | };
653 | timeout?: number;
654 | followRedirects?: boolean;
655 | npmRequestOptions?: Object;
656 | }
657 |
658 | interface HTTPResponse {
659 | statusCode?: number;
660 | headers?: {
661 | [id: string]: string
662 | };
663 | content?: string;
664 | data?: any;
665 | }
666 |
667 | function call(method: string, url: string, options?: HTTP.HTTPRequest, asyncCallback?: Function): HTTP.HTTPResponse;
668 |
669 | function del(url: string, callOptions?: HTTP.HTTPRequest, asyncCallback?: Function): HTTP.HTTPResponse;
670 |
671 | function get(url: string, callOptions?: HTTP.HTTPRequest, asyncCallback?: Function): HTTP.HTTPResponse;
672 |
673 | function post(url: string, callOptions?: HTTP.HTTPRequest, asyncCallback?: Function): HTTP.HTTPResponse;
674 |
675 | function put(url: string, callOptions?: HTTP.HTTPRequest, asyncCallback?: Function): HTTP.HTTPResponse;
676 |
677 | function call(method: string, url: string, options?: {
678 | content?: string;
679 | data?: Object;
680 | query?: string;
681 | params?: Object;
682 | auth?: string;
683 | headers?: Object;
684 | timeout?: number;
685 | followRedirects?: boolean;
686 | npmRequestOptions?: Object;
687 | beforeSend?: Function;
688 | }, asyncCallback?: Function): HTTP.HTTPResponse;
689 | }
690 |
691 | declare module "meteor/http" {
692 | module HTTP {
693 | interface HTTPRequest {
694 | content?: string;
695 | data?: any;
696 | query?: string;
697 | params?: {
698 | [id: string]: string
699 | };
700 | auth?: string;
701 | headers?: {
702 | [id: string]: string
703 | };
704 | timeout?: number;
705 | followRedirects?: boolean;
706 | npmRequestOptions?: Object;
707 | }
708 |
709 | interface HTTPResponse {
710 | statusCode?: number;
711 | headers?: {
712 | [id: string]: string
713 | };
714 | content?: string;
715 | data?: any;
716 | }
717 |
718 | function call(method: string, url: string, options?: HTTP.HTTPRequest, asyncCallback?: Function): HTTP.HTTPResponse;
719 |
720 | function del(url: string, callOptions?: HTTP.HTTPRequest, asyncCallback?: Function): HTTP.HTTPResponse;
721 |
722 | function get(url: string, callOptions?: HTTP.HTTPRequest, asyncCallback?: Function): HTTP.HTTPResponse;
723 |
724 | function post(url: string, callOptions?: HTTP.HTTPRequest, asyncCallback?: Function): HTTP.HTTPResponse;
725 |
726 | function put(url: string, callOptions?: HTTP.HTTPRequest, asyncCallback?: Function): HTTP.HTTPResponse;
727 |
728 | function call(method: string, url: string, options?: {
729 | content?: string;
730 | data?: Object;
731 | query?: string;
732 | params?: Object;
733 | auth?: string;
734 | headers?: Object;
735 | timeout?: number;
736 | followRedirects?: boolean;
737 | npmRequestOptions?: Object;
738 | beforeSend?: Function;
739 | }, asyncCallback?: Function): HTTP.HTTPResponse;
740 | }
741 | }
742 |
743 | declare module Meteor {
744 | /** Global props **/
745 | var isClient: boolean;
746 | var isCordova: boolean;
747 | var isServer: boolean;
748 | var isProduction: boolean;
749 | var release: string;
750 | /** Global props **/
751 |
752 | /** Settings **/
753 | interface Settings {
754 | public: {
755 | [id: string]: any
756 | }, [id: string]: any
757 | }
758 | var settings: Settings;
759 | /** Settings **/
760 |
761 | /** User **/
762 | interface UserEmail {
763 | address: string;
764 | verified: boolean;
765 | }
766 | interface User {
767 | _id?: string;
768 | username?: string;
769 | emails?: UserEmail[];
770 | createdAt?: number;
771 | profile?: any;
772 | services?: any;
773 | }
774 |
775 | function user(): User;
776 |
777 | function userId(): string;
778 | var users: Mongo.Collection < User > ;
779 | /** User **/
780 |
781 | /** Error **/
782 | var Error: ErrorStatic;
783 | interface ErrorStatic {
784 | new(error: string | number, reason?: string, details?: string): Error;
785 | }
786 | interface Error {
787 | error: string | number;
788 | reason?: string;
789 | details?: string;
790 | }
791 | /** Error **/
792 |
793 | /** Method **/
794 | function methods(methods: Object): void;
795 |
796 | function call(name: string, ...args: any[]): any;
797 |
798 | function apply(name: string, args: EJSONable[], options?: {
799 | wait?: boolean;
800 | onResultReceived?: Function;
801 | }, asyncCallback?: Function): any;
802 | /** Method **/
803 |
804 | /** Url **/
805 | function absoluteUrl(path?: string, options?: {
806 | secure?: boolean;
807 | replaceLocalhost?: boolean;
808 | rootUrl?: string;
809 | }): string;
810 | /** Url **/
811 |
812 | /** Timeout **/
813 | function setInterval(func: Function, delay: number): number;
814 |
815 | function setTimeout(func: Function, delay: number): number;
816 |
817 | function clearInterval(id: number): void;
818 |
819 | function clearTimeout(id: number): void;
820 |
821 | function defer(func: Function): void;
822 | /** Timeout **/
823 |
824 | /** utils **/
825 | function startup(func: Function): void;
826 |
827 | function wrapAsync(func: Function, context?: Object): any;
828 |
829 | function bindEnvironment(func: Function): any;
830 | /** utils **/
831 |
832 | /** Pub/Sub **/
833 | interface SubscriptionHandle {
834 | stop(): void;
835 | ready(): boolean;
836 | }
837 | interface LiveQueryHandle {
838 | stop(): void;
839 | }
840 | /** Pub/Sub **/
841 | }
842 |
843 | declare module "meteor/meteor" {
844 | module Meteor {
845 | /** Global props **/
846 | var isClient: boolean;
847 | var isCordova: boolean;
848 | var isServer: boolean;
849 | var isProduction: boolean;
850 | var release: string;
851 | /** Global props **/
852 |
853 | /** Settings **/
854 | interface Settings {
855 | public: {
856 | [id: string]: any
857 | }, [id: string]: any
858 | }
859 | var settings: Settings;
860 | /** Settings **/
861 |
862 | /** User **/
863 | interface UserEmail {
864 | address: string;
865 | verified: boolean;
866 | }
867 | interface User {
868 | _id?: string;
869 | username?: string;
870 | emails?: UserEmail[];
871 | createdAt?: number;
872 | profile?: any;
873 | services?: any;
874 | }
875 |
876 | function user(): User;
877 |
878 | function userId(): string;
879 | var users: Mongo.Collection < User > ;
880 | /** User **/
881 |
882 | /** Error **/
883 | var Error: ErrorStatic;
884 | interface ErrorStatic {
885 | new(error: string | number, reason?: string, details?: string): Error;
886 | }
887 | interface Error {
888 | error: string | number;
889 | reason?: string;
890 | details?: string;
891 | }
892 | /** Error **/
893 |
894 | /** Method **/
895 | function methods(methods: Object): void;
896 |
897 | function call(name: string, ...args: any[]): any;
898 |
899 | function apply(name: string, args: EJSONable[], options?: {
900 | wait?: boolean;
901 | onResultReceived?: Function;
902 | }, asyncCallback?: Function): any;
903 | /** Method **/
904 |
905 | /** Url **/
906 | function absoluteUrl(path?: string, options?: {
907 | secure?: boolean;
908 | replaceLocalhost?: boolean;
909 | rootUrl?: string;
910 | }): string;
911 | /** Url **/
912 |
913 | /** Timeout **/
914 | function setInterval(func: Function, delay: number): number;
915 |
916 | function setTimeout(func: Function, delay: number): number;
917 |
918 | function clearInterval(id: number): void;
919 |
920 | function clearTimeout(id: number): void;
921 |
922 | function defer(func: Function): void;
923 | /** Timeout **/
924 |
925 | /** utils **/
926 | function startup(func: Function): void;
927 |
928 | function wrapAsync(func: Function, context?: Object): any;
929 |
930 | function bindEnvironment(func: Function): any;
931 | /** utils **/
932 |
933 | /** Pub/Sub **/
934 | interface SubscriptionHandle {
935 | stop(): void;
936 | ready(): boolean;
937 | }
938 | interface LiveQueryHandle {
939 | stop(): void;
940 | }
941 | /** Pub/Sub **/
942 | }
943 | }
944 |
945 | declare module Meteor {
946 | /** Login **/
947 | interface LoginWithExternalServiceOptions {
948 | requestPermissions?: string[];
949 | requestOfflineToken?: Boolean;
950 | forceApprovalPrompt?: Boolean;
951 | loginUrlParameters?: Object;
952 | redirectUrl?: string;
953 | loginHint?: string;
954 | loginStyle?: string;
955 | }
956 |
957 | function loginWithMeteorDeveloperAccount(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
958 |
959 | function loginWithFacebook(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
960 |
961 | function loginWithGithub(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
962 |
963 | function loginWithGoogle(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
964 |
965 | function loginWithMeetup(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
966 |
967 | function loginWithTwitter(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
968 |
969 | function loginWithWeibo(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
970 |
971 | function loggingIn(): boolean;
972 |
973 | function loginWith < ExternalService > (options?: {
974 | requestPermissions?: string[];
975 | requestOfflineToken?: boolean;
976 | loginUrlParameters?: Object;
977 | userEmail?: string;
978 | loginStyle?: string;
979 | redirectUrl?: string;
980 | }, callback?: Function): void;
981 |
982 | function loginWithPassword(user: Object | string, password: string, callback?: Function): void;
983 |
984 | function loginWithToken(token: string, callback?: Function): void;
985 |
986 | function logout(callback?: Function): void;
987 |
988 | function logoutOtherClients(callback?: Function): void;
989 | /** Login **/
990 |
991 | /** Event **/
992 | interface Event {
993 | type: string;
994 | target: HTMLElement;
995 | currentTarget: HTMLElement;
996 | which: number;
997 | stopPropagation(): void;
998 | stopImmediatePropagation(): void;
999 | preventDefault(): void;
1000 | isPropagationStopped(): boolean;
1001 | isImmediatePropagationStopped(): boolean;
1002 | isDefaultPrevented(): boolean;
1003 | }
1004 | interface EventHandlerFunction extends Function {
1005 | (event?: Meteor.Event, templateInstance?: Blaze.TemplateInstance): void;
1006 | }
1007 | interface EventMap {
1008 | [id: string]: Meteor.EventHandlerFunction;
1009 | }
1010 | /** Event **/
1011 |
1012 | /** Connection **/
1013 | function reconnect(): void;
1014 |
1015 | function disconnect(): void;
1016 | /** Connection **/
1017 |
1018 | /** Status **/
1019 | function status(): DDP.DDPStatus;
1020 | /** Status **/
1021 |
1022 | /** Pub/Sub **/
1023 | function subscribe(name: string, ...args: any[]): Meteor.SubscriptionHandle;
1024 | /** Pub/Sub **/
1025 | }
1026 |
1027 | declare module "meteor/meteor" {
1028 | module Meteor {
1029 | /** Login **/
1030 | interface LoginWithExternalServiceOptions {
1031 | requestPermissions?: string[];
1032 | requestOfflineToken?: Boolean;
1033 | forceApprovalPrompt?: Boolean;
1034 | loginUrlParameters?: Object;
1035 | redirectUrl?: string;
1036 | loginHint?: string;
1037 | loginStyle?: string;
1038 | }
1039 |
1040 | function loginWithMeteorDeveloperAccount(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
1041 |
1042 | function loginWithFacebook(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
1043 |
1044 | function loginWithGithub(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
1045 |
1046 | function loginWithGoogle(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
1047 |
1048 | function loginWithMeetup(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
1049 |
1050 | function loginWithTwitter(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
1051 |
1052 | function loginWithWeibo(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
1053 |
1054 | function loggingIn(): boolean;
1055 |
1056 | function loginWith < ExternalService > (options?: {
1057 | requestPermissions?: string[];
1058 | requestOfflineToken?: boolean;
1059 | loginUrlParameters?: Object;
1060 | userEmail?: string;
1061 | loginStyle?: string;
1062 | redirectUrl?: string;
1063 | }, callback?: Function): void;
1064 |
1065 | function loginWithPassword(user: Object | string, password: string, callback?: Function): void;
1066 |
1067 | function loginWithToken(token: string, callback?: Function): void;
1068 |
1069 | function logout(callback?: Function): void;
1070 |
1071 | function logoutOtherClients(callback?: Function): void;
1072 | /** Login **/
1073 |
1074 | /** Event **/
1075 | interface Event {
1076 | type: string;
1077 | target: HTMLElement;
1078 | currentTarget: HTMLElement;
1079 | which: number;
1080 | stopPropagation(): void;
1081 | stopImmediatePropagation(): void;
1082 | preventDefault(): void;
1083 | isPropagationStopped(): boolean;
1084 | isImmediatePropagationStopped(): boolean;
1085 | isDefaultPrevented(): boolean;
1086 | }
1087 | interface EventHandlerFunction extends Function {
1088 | (event?: Meteor.Event, templateInstance?: Blaze.TemplateInstance): void;
1089 | }
1090 | interface EventMap {
1091 | [id: string]: Meteor.EventHandlerFunction;
1092 | }
1093 | /** Event **/
1094 |
1095 | /** Connection **/
1096 | function reconnect(): void;
1097 |
1098 | function disconnect(): void;
1099 | /** Connection **/
1100 |
1101 | /** Status **/
1102 | function status(): DDP.DDPStatus;
1103 | /** Status **/
1104 |
1105 | /** Pub/Sub **/
1106 | function subscribe(name: string, ...args: any[]): Meteor.SubscriptionHandle;
1107 | /** Pub/Sub **/
1108 | }
1109 | }
1110 |
1111 | declare module Mongo {
1112 | interface Selector {
1113 | [key: string]: any;
1114 | }
1115 | interface Selector extends Object {}
1116 | interface Modifier {}
1117 | interface SortSpecifier {}
1118 | interface FieldSpecifier {
1119 | [id: string]: Number;
1120 | }
1121 |
1122 | var Collection: CollectionStatic;
1123 | interface CollectionStatic {
1124 | new < T > (name: string | null, options?: {
1125 | connection?: Object;
1126 | idGeneration?: string;
1127 | transform?: Function;
1128 | }): Collection < T > ;
1129 | }
1130 | interface Collection < T > {
1131 | allow(options: {
1132 | insert?: (userId: string, doc: T) => boolean;
1133 | update?: (userId: string, doc: T, fieldNames: string[], modifier: any) => boolean;
1134 | remove?: (userId: string, doc: T) => boolean;
1135 | fetch?: string[];
1136 | transform?: Function;
1137 | }): boolean;
1138 | deny(options: {
1139 | insert?: (userId: string, doc: T) => boolean;
1140 | update?: (userId: string, doc: T, fieldNames: string[], modifier: any) => boolean;
1141 | remove?: (userId: string, doc: T) => boolean;
1142 | fetch?: string[];
1143 | transform?: Function;
1144 | }): boolean;
1145 | find(selector?: Selector | ObjectID | string, options?: {
1146 | sort?: SortSpecifier;
1147 | skip?: number;
1148 | limit?: number;
1149 | fields?: FieldSpecifier;
1150 | reactive?: boolean;
1151 | transform?: Function;
1152 | }): Cursor < T > ;
1153 | findOne(selector?: Selector | ObjectID | string, options?: {
1154 | sort?: SortSpecifier;
1155 | skip?: number;
1156 | fields?: FieldSpecifier;
1157 | reactive?: boolean;
1158 | transform?: Function;
1159 | }): T;
1160 | insert(doc: T, callback?: Function): string;
1161 | rawCollection(): any;
1162 | rawDatabase(): any;
1163 | remove(selector: Selector | ObjectID | string, callback?: Function): number;
1164 | update(selector: Selector | ObjectID | string, modifier: Modifier, options?: {
1165 | multi?: boolean;
1166 | upsert?: boolean;
1167 | }, callback?: Function): number;
1168 | upsert(selector: Selector | ObjectID | string, modifier: Modifier, options?: {
1169 | multi?: boolean;
1170 | }, callback?: Function): {
1171 | numberAffected?: number;insertedId?: string;
1172 | };
1173 | _ensureIndex(keys: {
1174 | [key: string]: number | string
1175 | } | string, options?: {
1176 | [key: string]: any
1177 | }): void;
1178 | _dropIndex(keys: {
1179 | [key: string]: number | string
1180 | } | string): void;
1181 | }
1182 |
1183 | var Cursor: CursorStatic;
1184 | interface CursorStatic {
1185 | new < T > (): Cursor < T > ;
1186 | }
1187 | interface ObserveCallbacks {
1188 | added?(document: Object) : void;
1189 | addedAt?(document: Object, atIndex: number, before: Object) : void;
1190 | changed?(newDocument: Object, oldDocument: Object) : void;
1191 | changedAt?(newDocument: Object, oldDocument: Object, indexAt: number) : void;
1192 | removed?(oldDocument: Object) : void;
1193 | removedAt?(oldDocument: Object, atIndex: number) : void;
1194 | movedTo?(document: Object, fromIndex: number, toIndex: number, before: Object) : void;
1195 | }
1196 | interface ObserveChangesCallbacks {
1197 | added?(id: string, fields: Object) : void;
1198 | addedBefore?(id: string, fields: Object, before: Object) : void;
1199 | changed?(id: string, fields: Object) : void;
1200 | movedBefore?(id: string, before: Object) : void;
1201 | removed?(id: string) : void;
1202 | }
1203 | interface Cursor < T > {
1204 | count(applySkipLimit?: boolean): number;
1205 | fetch(): Array < T > ;
1206 | forEach(callback: (doc: T, index: number, cursor: Cursor < T > ) => void, thisArg?: any): void;
1207 | map < U > (callback: (doc: T, index: number, cursor: Cursor < T > ) => U, thisArg?: any): Array < U > ;
1208 | observe(callbacks: ObserveCallbacks): Meteor.LiveQueryHandle;
1209 | observeChanges(callbacks: ObserveChangesCallbacks): Meteor.LiveQueryHandle;
1210 | }
1211 |
1212 | var ObjectID: ObjectIDStatic;
1213 | interface ObjectIDStatic {
1214 | new(hexString?: string): ObjectID;
1215 | }
1216 | interface ObjectID {}
1217 | }
1218 |
1219 | declare module "meteor/mongo" {
1220 | module Mongo {
1221 | interface Selector {
1222 | [key: string]: any;
1223 | }
1224 | interface Selector extends Object {}
1225 | interface Modifier {}
1226 | interface SortSpecifier {}
1227 | interface FieldSpecifier {
1228 | [id: string]: Number;
1229 | }
1230 |
1231 | var Collection: CollectionStatic;
1232 | interface CollectionStatic {
1233 | new < T > (name: string | null, options?: {
1234 | connection?: Object;
1235 | idGeneration?: string;
1236 | transform?: Function;
1237 | }): Collection < T > ;
1238 | }
1239 | interface Collection < T > {
1240 | allow(options: {
1241 | insert?: (userId: string, doc: T) => boolean;
1242 | update?: (userId: string, doc: T, fieldNames: string[], modifier: any) => boolean;
1243 | remove?: (userId: string, doc: T) => boolean;
1244 | fetch?: string[];
1245 | transform?: Function;
1246 | }): boolean;
1247 | deny(options: {
1248 | insert?: (userId: string, doc: T) => boolean;
1249 | update?: (userId: string, doc: T, fieldNames: string[], modifier: any) => boolean;
1250 | remove?: (userId: string, doc: T) => boolean;
1251 | fetch?: string[];
1252 | transform?: Function;
1253 | }): boolean;
1254 | find(selector?: Selector | ObjectID | string, options?: {
1255 | sort?: SortSpecifier;
1256 | skip?: number;
1257 | limit?: number;
1258 | fields?: FieldSpecifier;
1259 | reactive?: boolean;
1260 | transform?: Function;
1261 | }): Cursor < T > ;
1262 | findOne(selector?: Selector | ObjectID | string, options?: {
1263 | sort?: SortSpecifier;
1264 | skip?: number;
1265 | fields?: FieldSpecifier;
1266 | reactive?: boolean;
1267 | transform?: Function;
1268 | }): T;
1269 | insert(doc: T, callback?: Function): string;
1270 | rawCollection(): any;
1271 | rawDatabase(): any;
1272 | remove(selector: Selector | ObjectID | string, callback?: Function): number;
1273 | update(selector: Selector | ObjectID | string, modifier: Modifier, options?: {
1274 | multi?: boolean;
1275 | upsert?: boolean;
1276 | }, callback?: Function): number;
1277 | upsert(selector: Selector | ObjectID | string, modifier: Modifier, options?: {
1278 | multi?: boolean;
1279 | }, callback?: Function): {
1280 | numberAffected?: number;insertedId?: string;
1281 | };
1282 | _ensureIndex(keys: {
1283 | [key: string]: number | string
1284 | } | string, options?: {
1285 | [key: string]: any
1286 | }): void;
1287 | _dropIndex(keys: {
1288 | [key: string]: number | string
1289 | } | string): void;
1290 | }
1291 |
1292 | var Cursor: CursorStatic;
1293 | interface CursorStatic {
1294 | new < T > (): Cursor < T > ;
1295 | }
1296 | interface ObserveCallbacks {
1297 | added?(document: Object) : void;
1298 | addedAt?(document: Object, atIndex: number, before: Object) : void;
1299 | changed?(newDocument: Object, oldDocument: Object) : void;
1300 | changedAt?(newDocument: Object, oldDocument: Object, indexAt: number) : void;
1301 | removed?(oldDocument: Object) : void;
1302 | removedAt?(oldDocument: Object, atIndex: number) : void;
1303 | movedTo?(document: Object, fromIndex: number, toIndex: number, before: Object) : void;
1304 | }
1305 | interface ObserveChangesCallbacks {
1306 | added?(id: string, fields: Object) : void;
1307 | addedBefore?(id: string, fields: Object, before: Object) : void;
1308 | changed?(id: string, fields: Object) : void;
1309 | movedBefore?(id: string, before: Object) : void;
1310 | removed?(id: string) : void;
1311 | }
1312 | interface Cursor < T > {
1313 | count(applySkipLimit?: boolean): number;
1314 | fetch(): Array < T > ;
1315 | forEach(callback: (doc: T, index: number, cursor: Cursor < T > ) => void, thisArg?: any): void;
1316 | map < U > (callback: (doc: T, index: number, cursor: Cursor < T > ) => U, thisArg?: any): Array < U > ;
1317 | observe(callbacks: ObserveCallbacks): Meteor.LiveQueryHandle;
1318 | observeChanges(callbacks: ObserveChangesCallbacks): Meteor.LiveQueryHandle;
1319 | }
1320 |
1321 | var ObjectID: ObjectIDStatic;
1322 | interface ObjectIDStatic {
1323 | new(hexString?: string): ObjectID;
1324 | }
1325 | interface ObjectID {}
1326 | }
1327 | }
1328 |
1329 | declare module Random {
1330 | function id(numberOfChars?: number): string;
1331 |
1332 | function secret(numberOfChars?: number): string;
1333 |
1334 | function fraction(): number;
1335 | // @param numberOfDigits, @returns a random hex string of the given length
1336 | function hexString(numberOfDigits: number): string;
1337 | // @param array, @return a random element in array
1338 | function choice(array: any[]): string;
1339 | // @param str, @return a random char in str
1340 | function choice(str: string): string;
1341 | }
1342 |
1343 | declare module "meteor/random" {
1344 | module Random {
1345 | function id(numberOfChars?: number): string;
1346 |
1347 | function secret(numberOfChars?: number): string;
1348 |
1349 | function fraction(): number;
1350 | // @param numberOfDigits, @returns a random hex string of the given length
1351 | function hexString(numberOfDigits: number): string;
1352 | // @param array, @return a random element in array
1353 | function choice(array: any[]): string;
1354 | // @param str, @return a random char in str
1355 | function choice(str: string): string;
1356 | }
1357 | }
1358 |
1359 | declare var ReactiveVar: ReactiveVarStatic;
1360 | interface ReactiveVarStatic {
1361 | new < T > (initialValue: T, equalsFunc?: Function): ReactiveVar < T > ;
1362 | }
1363 | interface ReactiveVar < T > {
1364 | get(): T;
1365 | set(newValue: T): void;
1366 | }
1367 |
1368 | declare module "meteor/reactive-var" {
1369 | var ReactiveVar: ReactiveVarStatic;
1370 | interface ReactiveVarStatic {
1371 | new < T > (initialValue: T, equalsFunc?: Function): ReactiveVar < T > ;
1372 | }
1373 | interface ReactiveVar < T > {
1374 | get(): T;
1375 | set(newValue: T): void;
1376 | }
1377 | }
1378 |
1379 | declare module Session {
1380 | function equals(key: string, value: string | number | boolean | any): boolean;
1381 |
1382 | function get(key: string): any;
1383 |
1384 | function set(key: string, value: EJSONable | any): void;
1385 |
1386 | function setDefault(key: string, value: EJSONable | any): void;
1387 | }
1388 |
1389 | declare module "meteor/session" {
1390 | module Session {
1391 | function equals(key: string, value: string | number | boolean | any): boolean;
1392 |
1393 | function get(key: string): any;
1394 |
1395 | function set(key: string, value: EJSONable | any): void;
1396 |
1397 | function setDefault(key: string, value: EJSONable | any): void;
1398 | }
1399 | }
1400 |
1401 | declare var Template: TemplateStatic;
1402 | interface TemplateStatic extends Blaze.TemplateStatic {
1403 | new(viewName?: string, renderFunction?: Function): Blaze.Template;
1404 | body: Blaze.Template;
1405 | [index: string]: any | Blaze.Template;
1406 | }
1407 |
1408 | declare module "meteor/templating" {
1409 | var Template: TemplateStatic;
1410 | interface TemplateStatic extends Blaze.TemplateStatic {
1411 | new(viewName?: string, renderFunction?: Function): Blaze.Template;
1412 | body: Blaze.Template;
1413 | [index: string]: any | Blaze.Template;
1414 | }
1415 | }
1416 |
1417 | interface ILengthAble {
1418 | length: number;
1419 | }
1420 |
1421 | interface ITinytestAssertions {
1422 | ok(doc: Object): void;
1423 | expect_fail(): void;
1424 | fail(doc: Object): void;
1425 | runId(): string;
1426 | equal < T > (actual: T, expected: T, message?: string, not?: boolean): void;
1427 | notEqual < T > (actual: T, expected: T, message?: string): void;
1428 | instanceOf(obj: Object, klass: Function, message?: string): void;
1429 | notInstanceOf(obj: Object, klass: Function, message?: string): void;
1430 | matches(actual: any, regexp: RegExp, message?: string): void;
1431 | notMatches(actual: any, regexp: RegExp, message?: string): void;
1432 | throws(f: Function, expected?: string | RegExp): void;
1433 | isTrue(v: boolean, msg?: string): void;
1434 | isFalse(v: boolean, msg?: string): void;
1435 | isNull(v: any, msg?: string): void;
1436 | isNotNull(v: any, msg?: string): void;
1437 | isUndefined(v: any, msg?: string): void;
1438 | isNotUndefined(v: any, msg?: string): void;
1439 | isNan(v: any, msg?: string): void;
1440 | isNotNan(v: any, msg?: string): void;
1441 | include < T > (s: Array < T > | Object | string, value: any, msg?: string, not?: boolean): void;
1442 |
1443 | notInclude < T > (s: Array < T > | Object | string, value: any, msg?: string, not?: boolean): void;
1444 | length(obj: ILengthAble, expected_length: number, msg?: string): void;
1445 | _stringEqual(actual: string, expected: string, msg?: string): void;
1446 | }
1447 |
1448 | declare module Tinytest {
1449 | function add(description: string, func: (test: ITinytestAssertions) => void): void;
1450 |
1451 | function addAsync(description: string, func: (test: ITinytestAssertions) => void): void;
1452 | }
1453 |
1454 | declare module "meteor/tiny-test" {
1455 | interface ILengthAble {
1456 | length: number;
1457 | }
1458 |
1459 | interface ITinytestAssertions {
1460 | ok(doc: Object): void;
1461 | expect_fail(): void;
1462 | fail(doc: Object): void;
1463 | runId(): string;
1464 | equal < T > (actual: T, expected: T, message?: string, not?: boolean): void;
1465 | notEqual < T > (actual: T, expected: T, message?: string): void;
1466 | instanceOf(obj: Object, klass: Function, message?: string): void;
1467 | notInstanceOf(obj: Object, klass: Function, message?: string): void;
1468 | matches(actual: any, regexp: RegExp, message?: string): void;
1469 | notMatches(actual: any, regexp: RegExp, message?: string): void;
1470 | throws(f: Function, expected?: string | RegExp): void;
1471 | isTrue(v: boolean, msg?: string): void;
1472 | isFalse(v: boolean, msg?: string): void;
1473 | isNull(v: any, msg?: string): void;
1474 | isNotNull(v: any, msg?: string): void;
1475 | isUndefined(v: any, msg?: string): void;
1476 | isNotUndefined(v: any, msg?: string): void;
1477 | isNan(v: any, msg?: string): void;
1478 | isNotNan(v: any, msg?: string): void;
1479 | include < T > (s: Array < T > | Object | string, value: any, msg?: string, not?: boolean): void;
1480 |
1481 | notInclude < T > (s: Array < T > | Object | string, value: any, msg?: string, not?: boolean): void;
1482 | length(obj: ILengthAble, expected_length: number, msg?: string): void;
1483 | _stringEqual(actual: string, expected: string, msg?: string): void;
1484 | }
1485 |
1486 | module Tinytest {
1487 | function add(description: string, func: (test: ITinytestAssertions) => void): void;
1488 |
1489 | function addAsync(description: string, func: (test: ITinytestAssertions) => void): void;
1490 | }
1491 | }
1492 |
1493 | declare module Tracker {
1494 | function Computation(): void;
1495 | interface Computation {
1496 | firstRun: boolean;
1497 | invalidate(): void;
1498 | invalidated: boolean;
1499 | onInvalidate(callback: Function): void;
1500 | onStop(callback: Function): void;
1501 | stop(): void;
1502 | stopped: boolean;
1503 | }
1504 | var currentComputation: Computation;
1505 |
1506 | var Dependency: DependencyStatic;
1507 | interface DependencyStatic {
1508 | new(): Dependency;
1509 | }
1510 | interface Dependency {
1511 | changed(): void;
1512 | depend(fromComputation?: Computation): boolean;
1513 | hasDependents(): boolean;
1514 | }
1515 |
1516 | var active: boolean;
1517 |
1518 | function afterFlush(callback: Function): void;
1519 |
1520 | function autorun(runFunc: (computation: Computation) => void, options?: {
1521 | onError?: Function;
1522 | }): Computation;
1523 |
1524 | function flush(): void;
1525 |
1526 | function nonreactive(func: Function): void;
1527 |
1528 | function onInvalidate(callback: Function): void;
1529 | }
1530 |
1531 | declare module "meteor/tracker" {
1532 | module Tracker {
1533 | function Computation(): void;
1534 | interface Computation {
1535 | firstRun: boolean;
1536 | invalidate(): void;
1537 | invalidated: boolean;
1538 | onInvalidate(callback: Function): void;
1539 | onStop(callback: Function): void;
1540 | stop(): void;
1541 | stopped: boolean;
1542 | }
1543 | var currentComputation: Computation;
1544 |
1545 | var Dependency: DependencyStatic;
1546 | interface DependencyStatic {
1547 | new(): Dependency;
1548 | }
1549 | interface Dependency {
1550 | changed(): void;
1551 | depend(fromComputation?: Computation): boolean;
1552 | hasDependents(): boolean;
1553 | }
1554 |
1555 | var active: boolean;
1556 |
1557 | function afterFlush(callback: Function): void;
1558 |
1559 | function autorun(runFunc: (computation: Computation) => void, options?: {
1560 | onError?: Function;
1561 | }): Computation;
1562 |
1563 | function flush(): void;
1564 |
1565 | function nonreactive(func: Function): void;
1566 |
1567 | function onInvalidate(callback: Function): void;
1568 | }
1569 | }
1570 |
1571 | declare module Match {
1572 | function Maybe(pattern: any): boolean;
1573 | }
1574 |
1575 | declare module "meteor/check" {
1576 | module Match {
1577 | function Maybe(pattern: any): boolean;
1578 | }
1579 | }
1580 |
1581 | declare module Meteor {
1582 | /** Global props **/
1583 | var isDevelopment: boolean;
1584 | var isTest: boolean;
1585 | /** Global props **/
1586 | }
1587 |
1588 | declare module "meteor/meteor" {
1589 | module Meteor {
1590 | /** Global props **/
1591 | var isDevelopment: boolean;
1592 | var isTest: boolean;
1593 | /** Global props **/
1594 | }
1595 | }
1596 |
--------------------------------------------------------------------------------
/1.3/header.d.ts:
--------------------------------------------------------------------------------
1 | // Type definitions for Meteor 1.3
2 | // Project: http://www.meteor.com/
3 | // Definitions by:
4 | // Alex Borodach
5 | // Dave Allen
6 | // Olivier Refalo
7 |
--------------------------------------------------------------------------------
/1.3/packages/check.d.ts:
--------------------------------------------------------------------------------
1 | declare module Match {
2 | function Maybe(pattern: any): boolean;
3 | }
4 |
--------------------------------------------------------------------------------
/1.3/packages/meteor.d.ts:
--------------------------------------------------------------------------------
1 | declare module Meteor {
2 | /** Global props **/
3 | var isDevelopment: boolean;
4 | var isTest: boolean;
5 | /** Global props **/
6 | }
7 |
--------------------------------------------------------------------------------
/1.3/typings.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "meteor",
3 | "version": "1.3",
4 | "main": "main.d.ts",
5 | "browser": "browser.d.ts",
6 | "homepage": "https://meteor.com",
7 | "global": true,
8 | "files": [
9 | "header.d.ts"
10 | ],
11 | "resolution": {
12 | "main": "typings/main",
13 | "browser": "typings/browser"
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/1.4/header.d.ts:
--------------------------------------------------------------------------------
1 | // Type definitions for Meteor 1.3
2 | // Project: http://www.meteor.com/
3 | // Definitions by:
4 | // Alex Borodach
5 | // Dave Allen
6 | // Olivier Refalo
7 | // Daniel Neveux
--------------------------------------------------------------------------------
/1.4/packages/accounts-base_browser.d.ts:
--------------------------------------------------------------------------------
1 | declare module Accounts {
2 | function onLogout(func: Function): void;
3 | function makeClientLoggedOut(): boolean | void;
4 | }
5 |
6 | declare module "meteor/accounts-base" {
7 | module Accounts {
8 | function onLogout(func: Function): void;
9 | function makeClientLoggedOut(): boolean | void;
10 | }
11 | }
--------------------------------------------------------------------------------
/1.4/packages/accounts-base_main.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 | ///
3 | declare module Accounts {
4 | function onLogout(func: (user:Meteor.User, connection: Meteor.Connection) => void): void;
5 | }
6 |
--------------------------------------------------------------------------------
/1.4/packages/meteor_browser.d.ts:
--------------------------------------------------------------------------------
1 | declare module Meteor {
2 | /** Local storage **/
3 | var _localStorage: LocalStorage;
4 | interface LocalStorage {
5 | _data: any;
6 | getItem(key: any): any;
7 | removeItem(key: any): void;
8 | setItem(key: any, value: any): any;
9 | }
10 | /** Local storage **/
11 | }
--------------------------------------------------------------------------------
/1.4/test/test.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * All code below was copied from the examples at http://docs.meteor.com/.
3 | * When necessary, code was added to make the examples work (e.g. declaring a variable
4 | * that was assumed to have been declared earlier)
5 | */
6 |
7 |
8 | /*********************************** Begin setup for tests ******************************/
9 | import {Mongo} from "meteor/mongo";
10 | import {Meteor} from "meteor/meteor";
11 | import {check, Match} from "meteor/check";
12 | import {Tracker} from "meteor/tracker";
13 | import {Template} from "meteor/templating";
14 | import {Blaze} from "meteor/blaze";
15 | import {Session} from "meteor/session";
16 | import {HTTP} from "meteor/http";
17 | import {ReactiveVar} from "meteor/reactive-var";
18 | import {Accounts} from "meteor/accounts-base";
19 | import {BrowserPolicy} from "meteor/browser-policy-common";
20 | import {DDPRateLimiter} from "meteor/ddp-rate-limiter";
21 |
22 | var Rooms = new Mongo.Collection('rooms');
23 | var Messages = new Mongo.Collection('messages');
24 | interface MonkeyDAO {
25 | _id: string;
26 | name: string;
27 | }
28 | var Monkeys = new Mongo.Collection('monkeys');
29 | //var x = new Mongo.Collection('x');
30 | //var y = new Mongo.Collection('y');
31 | /********************************** End setup for tests *********************************/
32 |
33 |
34 | /**
35 | * From Core, Meteor.startup section
36 | * Tests Meteor.isServer, Meteor.startup, Collection.insert(), Collection.find()
37 | */
38 | if (Meteor.isServer) {
39 | Meteor.startup(function () {
40 | if (Rooms.find().count() === 0) {
41 | Rooms.insert({name: "Initial room"});
42 | }
43 | });
44 | }
45 |
46 | /**
47 | * From Publish and Subscribe, Meteor.publish section
48 | **/
49 | Meteor.publish("rooms", function () {
50 | return Rooms.find({}, {fields: {secretInfo: 0}});
51 | });
52 |
53 | Meteor.publish("adminSecretInfo", function () {
54 | return Rooms.find({admin: this.userId}, {fields: {secretInfo: 1}});
55 | });
56 |
57 | Meteor.publish("roomAndMessages", function (roomId: string) {
58 | check(roomId, String);
59 | return [
60 | Rooms.find({_id: roomId}, {fields: {secretInfo: 0}}),
61 | Messages.find({roomId: roomId})
62 | ];
63 | });
64 |
65 | /**
66 | * Also from Publish and Subscribe, Meteor.publish section
67 | */
68 | Meteor.publish("counts-by-room", function (roomId: string) {
69 | var self = this;
70 | check(roomId, String);
71 | var count = 0;
72 | var initializing = true;
73 | var handle = Messages.find({roomId: roomId}).observeChanges({
74 | added: function (id: any) {
75 | count++;
76 | // if (!initializing)
77 | // this.changed("counts", roomId, {count: count});
78 | },
79 | removed: function (id: any) {
80 | count--;
81 | // Todo: Not sure how to define in typescript
82 | // self.changed("counts", roomId, {count: count});
83 | }
84 | });
85 |
86 | initializing = false;
87 |
88 | // Todo: Not sure how to define in typescript
89 | // self.added("counts", roomId, {count: count});
90 | self.ready();
91 |
92 | self.onStop(function () {
93 | handle.stop();
94 | });
95 | });
96 |
97 | var Counts = new Mongo.Collection("counts");
98 |
99 | Tracker.autorun(function () {
100 | Meteor.subscribe("counts-by-room", Session.get("roomId"));
101 | });
102 |
103 | // Checking status
104 | let status: DDP.Status = 'connected';
105 |
106 | console.log("Current room has " +
107 | Counts.find(Session.get("roomId")).count +
108 | " messages.");
109 |
110 | /**
111 | * From Publish and Subscribe, Meteor.subscribe section
112 | */
113 | Meteor.subscribe("allplayers");
114 |
115 | /**
116 | * Also from Meteor.subscribe section
117 | */
118 | Tracker.autorun(function () {
119 | Meteor.subscribe("chat", {room: Session.get("current-room")});
120 | Meteor.subscribe("privateMessages");
121 | });
122 |
123 | /**
124 | * From Methods, Meteor.methods section
125 | */
126 | Meteor.methods({
127 | foo: function (arg1: string, arg2: number[]) {
128 | check(arg1, String);
129 | check(arg2, [Number]);
130 |
131 | var you_want_to_throw_an_error = true;
132 | if (you_want_to_throw_an_error)
133 | throw new Meteor.Error("404", "Can't find my pants");
134 | return "some return value";
135 | },
136 |
137 | bar: function () {
138 | // .. do other stuff ..
139 | return "baz";
140 | }
141 | });
142 |
143 | /**
144 | * From Methods, Meteor.Error section
145 | */
146 | function meteorErrorTestFunction1() {
147 | throw new Meteor.Error("logged-out",
148 | "The user must be logged in to post a comment.");
149 | }
150 |
151 | function meteorErrorTestFunction2() {
152 | throw new Meteor.Error(403,
153 | "The user must be logged in to post a comment.");
154 | }
155 |
156 | Meteor.call("methodName", function (error: Meteor.Error) {
157 | if (error.error === "logged-out") {
158 | Session.set("errorMessage", "Please log in to post a comment.");
159 | }
160 | });
161 | var error = new Meteor.Error("logged-out", "The user must be logged in to post a comment.");
162 | console.log(error.error === "logged-out");
163 | console.log(error.reason === "The user must be logged in to post a comment.");
164 | console.log(error.details !== "");
165 |
166 | /**
167 | * From Methods, Meteor.call section
168 | */
169 | Meteor.call('foo', 1, 2, function (error:any, result:any) {} );
170 | var result = Meteor.call('foo', 1, 2);
171 |
172 | /**
173 | * From Collections, Mongo.Collection section
174 | */
175 | // DA: I added the "var" keyword in there
176 |
177 | interface ChatroomsDAO {
178 | _id?: string;
179 | }
180 | interface MessagesDAO {
181 | _id?: string;
182 | }
183 | var Chatrooms = new Mongo.Collection("chatrooms");
184 | Messages = new Mongo.Collection("messages");
185 |
186 | var myMessages:any[] = Messages.find({userId: Session.get('myUserId')}).fetch();
187 |
188 | Messages.insert({text: "Hello, world!"});
189 |
190 | Messages.update(myMessages[0]._id, {$set: {important: true}});
191 |
192 | var Posts = new Mongo.Collection("posts");
193 | Posts.insert({title: "Hello world", body: "First post"});
194 |
195 | // Couldn't find assert() in the meteor docs
196 | //assert(Posts.find().count() === 1);
197 |
198 | /**
199 | * Todo: couldn't figure out how to make this next line work with Typescript
200 | * since there is already a Collection constructor with a different signature
201 | *
202 | var Scratchpad = new Mongo.Collection;
203 | for (var i = 0; i < 10; i++)
204 | Scratchpad.insert({number: i * 2});
205 | assert(Scratchpad.find({number: {$lt: 9}}).count() === 5);
206 | **/
207 |
208 | class Animal {
209 | private sound:string;
210 | constructor(doc:any) {
211 |
212 | }
213 | makeNoise() {
214 | console.log(this.sound)
215 | }
216 | }
217 |
218 | interface AnimalDAO {
219 | _id?: string;
220 | name: string;
221 | sound: string;
222 | makeNoise?: () => void;
223 | }
224 |
225 | // Define a Collection that uses Animal as its document
226 | var Animals = new Mongo.Collection("Animals", {
227 | transform: function (doc:any): Animal { return new Animal(doc); }
228 | });
229 |
230 | // Create an Animal and call its makeNoise method
231 | Animals.insert({name: "raptor", sound: "roar"});
232 | Animals.findOne({name: "raptor"}).makeNoise(); // prints "roar"
233 |
234 | /**
235 | * From Collections, Collection.insert section
236 | */
237 | // DA: I added the variable declaration statements to make this work
238 | var Lists = new Mongo.Collection('Lists');
239 | var Items = new Mongo.Collection('Lists');
240 |
241 | var groceriesId = Lists.insert({name: "Groceries"});
242 | Items.insert({list: groceriesId, name: "Watercress"});
243 | Items.insert({list: groceriesId, name: "Persimmons"});
244 |
245 | /**
246 | * From Collections, collection.update section
247 | */
248 | var Players = new Mongo.Collection('Players');
249 |
250 | Template['adminDashboard'].events({
251 | 'click .givePoints': function () {
252 | Players.update(Session.get("currentPlayer"), {$inc: {score: 5}});
253 | }
254 | });
255 |
256 | /**
257 | * Also from Collections, collection.update section
258 | */
259 | Meteor.methods({
260 | declareWinners: function () {
261 | Players.update({score: {$gt: 10}},
262 | {$addToSet: {badges: "Winner"}},
263 | {multi: true});
264 | }
265 | });
266 |
267 | /**
268 | * From Collections, collection.remove section
269 | */
270 | Template['chat'].events({
271 | 'click .remove': function () {
272 | Messages.remove(this._id);
273 | }
274 | });
275 |
276 | // DA: I added this next line
277 | var Logs = new Mongo.Collection('logs');
278 |
279 | Meteor.startup(function () {
280 | if (Meteor.isServer) {
281 | Logs.remove({});
282 | Players.remove({karma: {$lt: -2}});
283 | }
284 | });
285 |
286 | /***
287 | * From Collections, collection.allow section
288 | */
289 |
290 | interface iPost {
291 | _id: string;
292 | owner: string;
293 | userId: string;
294 | locked: boolean;
295 | }
296 |
297 | Posts = new Mongo.Collection("posts");
298 |
299 | Posts.allow({
300 | insert: function (userId:string, doc: iPost) {
301 | // the user must be logged in, and the document must be owned by the user
302 | return (userId && doc.owner === userId);
303 | },
304 | update: function (userId:string, doc: iPost, fields:string[], modifier:any) {
305 | // can only change your own documents
306 | return doc.owner === userId;
307 | },
308 | remove: function (userId:string, doc: iPost) {
309 | // can only remove your own documents
310 | return doc.owner === userId;
311 | },
312 | fetch: ['owner']
313 | });
314 |
315 | Posts.deny({
316 | update: function (userId:string, doc: iPost, fields:string[], modifier:any) {
317 | // can't change owners
318 | return doc.userId !== userId;
319 | },
320 | remove: function (userId:string, doc: iPost) {
321 | // can't remove locked documents
322 | return doc.locked;
323 | },
324 | fetch: ['locked'] // no need to fetch 'owner'
325 | });
326 |
327 | /**
328 | * From Collections, cursor.forEach section
329 | */
330 | var topPosts = Posts.find({}, {sort: {score: -1}, limit: 5});
331 | var count = 0;
332 | topPosts.forEach(function (post:{title:string}) {
333 | console.log("Title of post " + count + ": " + post.title);
334 | count += 1;
335 | });
336 |
337 | /**
338 | * From Collections, cursor.observeChanges section
339 | */
340 | // DA: I added this line to make it work
341 | var Users = new Mongo.Collection('users');
342 |
343 | var count1 = 0;
344 | var query = Users.find({admin: true, onlineNow: true});
345 | var handle = query.observeChanges({
346 | added: function (id:string, user:{name:string}) {
347 | count1++;
348 | console.log(user.name + " brings the total to " + count1 + " admins.");
349 | },
350 | removed: function () {
351 | count1--;
352 | console.log("Lost one. We're now down to " + count1 + " admins.");
353 | }
354 | });
355 |
356 | let cursor: Mongo.Cursor