UNPKG

60.1 kBTypeScriptView Raw
1interface URLS {
2 resetPassword: (token: string) => string;
3 verifyEmail: (token: string) => string;
4 enrollAccount: (token: string) => string;
5}
6
7declare 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
42declare 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
85declare 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
118declare 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
153interface EmailFields {
154 from?: () => string;
155 subject?: (user: Meteor.User) => string;
156 text?: (user: Meteor.User, url: string) => string;
157 html?: (user: Meteor.User, url: string) => string;
158}
159
160interface Header {
161 [id: string]: string;
162}
163
164interface EmailTemplates {
165 from: string;
166 siteName: string;
167 headers?: Header;
168 resetPassword: EmailFields;
169 enrollAccount: EmailFields;
170 verifyEmail: EmailFields;
171}
172
173declare module Accounts {
174 var emailTemplates: EmailTemplates;
175
176 function addEmail(userId: string, newEmail: string, verified?: boolean): void;
177
178 function removeEmail(userId: string, email: string): void;
179
180 function onCreateUser(func: Function): void;
181
182 function findUserByEmail(email: string): Object;
183
184 function findUserByUsername(username: string): Object;
185
186 function sendEnrollmentEmail(userId: string, email?: string): void;
187
188 function sendResetPasswordEmail(userId: string, email?: string): void;
189
190 function sendVerificationEmail(userId: string, email?: string): void;
191
192 function setUsername(userId: string, newUsername: string): void;
193
194 function setPassword(userId: string, newPassword: string, options?: {
195 logout?: Object;
196 }): void;
197
198 function validateNewUser(func: Function): boolean;
199
200 function validateLoginAttempt(func: Function): {
201 stop: () => void
202 };
203
204 interface IValidateLoginAttemptCbOpts {
205 type: string;
206 allowed: boolean;
207 error: Meteor.Error;
208 user: Meteor.User;
209 connection: Meteor.Connection;
210 methodName: string;
211 methodArguments: any[];
212 }
213}
214
215declare module "meteor/accounts-base" {
216 interface EmailFields {
217 from?: () => string;
218 subject?: (user: Meteor.User) => string;
219 text?: (user: Meteor.User, url: string) => string;
220 html?: (user: Meteor.User, url: string) => string;
221 }
222
223 interface Header {
224 [id: string]: string;
225 }
226
227 interface EmailTemplates {
228 from: string;
229 siteName: string;
230 headers?: Header;
231 resetPassword: EmailFields;
232 enrollAccount: EmailFields;
233 verifyEmail: EmailFields;
234 }
235
236 module Accounts {
237 var emailTemplates: EmailTemplates;
238
239 function addEmail(userId: string, newEmail: string, verified?: boolean): void;
240
241 function removeEmail(userId: string, email: string): void;
242
243 function onCreateUser(func: Function): void;
244
245 function findUserByEmail(email: string): Object;
246
247 function findUserByUsername(username: string): Object;
248
249 function sendEnrollmentEmail(userId: string, email?: string): void;
250
251 function sendResetPasswordEmail(userId: string, email?: string): void;
252
253 function sendVerificationEmail(userId: string, email?: string): void;
254
255 function setUsername(userId: string, newUsername: string): void;
256
257 function setPassword(userId: string, newPassword: string, options?: {
258 logout?: Object;
259 }): void;
260
261 function validateNewUser(func: Function): boolean;
262
263 function validateLoginAttempt(func: Function): {
264 stop: () => void
265 };
266
267 interface IValidateLoginAttemptCbOpts {
268 type: string;
269 allowed: boolean;
270 error: Meteor.Error;
271 user: Meteor.User;
272 connection: Meteor.Connection;
273 methodName: string;
274 methodArguments: any[];
275 }
276 }
277}
278
279declare module Blaze {
280 var View: ViewStatic;
281
282 interface ViewStatic {
283 new(name?: string, renderFunction?: Function): View;
284 }
285
286 interface View {
287 name: string;
288 parentView: View;
289 isCreated: boolean;
290 isRendered: boolean;
291 isDestroyed: boolean;
292 renderCount: number;
293 autorun(runFunc: (computation: Tracker.Computation) => void): Tracker.Computation;
294 onViewCreated(func: Function): void;
295 onViewReady(func: Function): void;
296 onViewDestroyed(func: Function): void;
297 firstNode(): Node;
298 lastNode(): Node;
299 template: Template;
300 templateInstance(): TemplateInstance;
301 }
302 var currentView: View;
303
304 function isTemplate(value: any): boolean;
305
306 interface HelpersMap {
307 [key: string]: Function;
308 }
309
310 interface EventsMap {
311 [key: string]: Function;
312 }
313
314 var Template: TemplateStatic;
315
316 interface TemplateStatic {
317 new(viewName?: string, renderFunction?: Function): Template;
318
319 registerHelper(name: string, func: Function): void;
320 instance(): TemplateInstance;
321 currentData(): any;
322 parentData(numLevels: number): any;
323 }
324
325 interface Template {
326 viewName: string;
327 renderFunction: Function;
328 constructView(): View;
329 head: Template;
330 find(selector: string): HTMLElement;
331 findAll(selector: string): HTMLElement[];
332 $: any;
333 onCreated(cb: Function): void;
334 onRendered(cb: Function): void;
335 onDestroyed(cb: Function): void;
336 created: Function;
337 rendered: Function;
338 destroyed: Function;
339 helpers(helpersMap: HelpersMap): void;
340 events(eventsMap: EventsMap): void;
341 }
342
343 var TemplateInstance: TemplateInstanceStatic;
344
345 interface TemplateInstanceStatic {
346 new(view: View): TemplateInstance;
347 }
348
349 interface TemplateInstance {
350 $(selector: string): any;
351 autorun(runFunc: (computation: Tracker.Computation) => void): Tracker.Computation;
352 data: Object;
353 find(selector: string): HTMLElement;
354 findAll(selector: string): HTMLElement[];
355 firstNode: Object;
356 lastNode: Object;
357 subscribe(name: string, ...args: any[]): Meteor.SubscriptionHandle;
358 subscriptionsReady(): boolean;
359 view: Object;
360 }
361
362 function Each(argFunc: Function, contentFunc: Function, elseFunc?: Function): View;
363
364 function Unless(conditionFunc: Function, contentFunc: Function, elseFunc?: Function): View;
365
366 function If(conditionFunc: Function, contentFunc: Function, elseFunc?: Function): View;
367
368 function Let(bindings: Function, contentFunc: Function): View;
369
370 function With(data: Object | Function, contentFunc: Function): View;
371
372 function getData(elementOrView?: HTMLElement | View): Object;
373
374 function getView(element?: HTMLElement): View;
375
376 function remove(renderedView: View): void;
377
378 function render(templateOrView: Template | View, parentNode: Node, nextNode?: Node, parentView?: View): View;
379
380 function renderWithData(templateOrView: Template | View, data: Object | Function, parentNode: Node, nextNode?: Node, parentView?: View): View;
381
382 function toHTML(templateOrView: Template | View): string;
383
384 function toHTMLWithData(templateOrView: Template | View, data: Object | Function): string;
385}
386
387declare module "meteor/blaze" {
388 module Blaze {
389 var View: ViewStatic;
390
391 interface ViewStatic {
392 new(name?: string, renderFunction?: Function): View;
393 }
394
395 interface View {
396 name: string;
397 parentView: View;
398 isCreated: boolean;
399 isRendered: boolean;
400 isDestroyed: boolean;
401 renderCount: number;
402 autorun(runFunc: (computation: Tracker.Computation) => void): Tracker.Computation;
403 onViewCreated(func: Function): void;
404 onViewReady(func: Function): void;
405 onViewDestroyed(func: Function): void;
406 firstNode(): Node;
407 lastNode(): Node;
408 template: Template;
409 templateInstance(): TemplateInstance;
410 }
411 var currentView: View;
412
413 function isTemplate(value: any): boolean;
414
415 interface HelpersMap {
416 [key: string]: Function;
417 }
418
419 interface EventsMap {
420 [key: string]: Function;
421 }
422
423 var Template: TemplateStatic;
424
425 interface TemplateStatic {
426 new(viewName?: string, renderFunction?: Function): Template;
427
428 registerHelper(name: string, func: Function): void;
429 instance(): TemplateInstance;
430 currentData(): any;
431 parentData(numLevels: number): any;
432 }
433
434 interface Template {
435 viewName: string;
436 renderFunction: Function;
437 constructView(): View;
438 head: Template;
439 find(selector: string): HTMLElement;
440 findAll(selector: string): HTMLElement[];
441 $: any;
442 onCreated(cb: Function): void;
443 onRendered(cb: Function): void;
444 onDestroyed(cb: Function): void;
445 created: Function;
446 rendered: Function;
447 destroyed: Function;
448 helpers(helpersMap: HelpersMap): void;
449 events(eventsMap: EventsMap): void;
450 }
451
452 var TemplateInstance: TemplateInstanceStatic;
453
454 interface TemplateInstanceStatic {
455 new(view: View): TemplateInstance;
456 }
457
458 interface TemplateInstance {
459 $(selector: string): any;
460 autorun(runFunc: (computation: Tracker.Computation) => void): Tracker.Computation;
461 data: Object;
462 find(selector: string): HTMLElement;
463 findAll(selector: string): HTMLElement[];
464 firstNode: Object;
465 lastNode: Object;
466 subscribe(name: string, ...args: any[]): Meteor.SubscriptionHandle;
467 subscriptionsReady(): boolean;
468 view: Object;
469 }
470
471 function Each(argFunc: Function, contentFunc: Function, elseFunc?: Function): View;
472
473 function Unless(conditionFunc: Function, contentFunc: Function, elseFunc?: Function): View;
474
475 function If(conditionFunc: Function, contentFunc: Function, elseFunc?: Function): View;
476
477 function Let(bindings: Function, contentFunc: Function): View;
478
479 function With(data: Object | Function, contentFunc: Function): View;
480
481 function getData(elementOrView?: HTMLElement | View): Object;
482
483 function getView(element?: HTMLElement): View;
484
485 function remove(renderedView: View): void;
486
487 function render(templateOrView: Template | View, parentNode: Node, nextNode?: Node, parentView?: View): View;
488
489 function renderWithData(templateOrView: Template | View, data: Object | Function, parentNode: Node, nextNode?: Node, parentView?: View): View;
490
491 function toHTML(templateOrView: Template | View): string;
492
493 function toHTMLWithData(templateOrView: Template | View, data: Object | Function): string;
494 }
495}
496
497declare module BrowserPolicy {
498 var framing: {
499 disallow(): void;
500 restrictToOrigin(origin: string): void;
501 allowAll(): void;
502 };
503
504 var content: {
505 allowEval(): void;
506 allowInlineStyles(): void;
507 allowInlineScripts(): void;
508 allowSameOriginForAll(): void;
509 allowDataUrlForAll(): void;
510 allowOriginForAll(origin: string): void;
511 allowImageOrigin(origin: string): void;
512 allowMediaOrigin(origin: string): void;
513 allowFontOrigin(origin: string): void;
514 allowStyleOrigin(origin: string): void;
515 allowScriptOrigin(origin: string): void;
516 allowFrameOrigin(origin: string): void;
517 allowContentTypeSniffing(): void;
518 allowAllContentOrigin(): void;
519 allowAllContentDataUrl(): void;
520 allowAllContentSameOrigin(): void;
521
522 disallowAll(): void;
523 disallowInlineStyles(): void;
524 disallowEval(): void;
525 disallowInlineScripts(): void;
526 disallowFont(): void;
527 disallowObject(): void;
528 disallowAllContent(): void;
529 };
530}
531
532declare module "meteor/browser-policy-common" {
533 module BrowserPolicy {
534 var framing: {
535 disallow(): void;
536 restrictToOrigin(origin: string): void;
537 allowAll(): void;
538 };
539
540 var content: {
541 allowEval(): void;
542 allowInlineStyles(): void;
543 allowInlineScripts(): void;
544 allowSameOriginForAll(): void;
545 allowDataUrlForAll(): void;
546 allowOriginForAll(origin: string): void;
547 allowImageOrigin(origin: string): void;
548 allowMediaOrigin(origin: string): void;
549 allowFontOrigin(origin: string): void;
550 allowStyleOrigin(origin: string): void;
551 allowScriptOrigin(origin: string): void;
552 allowFrameOrigin(origin: string): void;
553 allowContentTypeSniffing(): void;
554 allowAllContentOrigin(): void;
555 allowAllContentDataUrl(): void;
556 allowAllContentSameOrigin(): void;
557
558 disallowAll(): void;
559 disallowInlineStyles(): void;
560 disallowEval(): void;
561 disallowInlineScripts(): void;
562 disallowFont(): void;
563 disallowObject(): void;
564 disallowAllContent(): void;
565 };
566 }
567}
568
569declare module Match {
570 var Any: any;
571 var String: any;
572 var Integer: any;
573 var Boolean: any;
574 var undefined: any;
575 var Object: any;
576
577 function Optional(pattern: any): boolean;
578
579 function ObjectIncluding(dico: any): boolean;
580
581 function OneOf(...patterns: any[]): any;
582
583 function Where(condition: any): any;
584
585 function test(value: any, pattern: any): boolean;
586}
587
588declare function check(value: any, pattern: any): void;
589
590declare module "meteor/check" {
591 module Match {
592 var Any: any;
593 var String: any;
594 var Integer: any;
595 var Boolean: any;
596 var undefined: any;
597 var Object: any;
598
599 function Optional(pattern: any): boolean;
600
601 function ObjectIncluding(dico: any): boolean;
602
603 function OneOf(...patterns: any[]): any;
604
605 function Where(condition: any): any;
606
607 function test(value: any, pattern: any): boolean;
608 }
609
610 function check(value: any, pattern: any): void;
611}
612
613declare module DDPRateLimiter {
614 interface Matcher {
615 type?: string | ((type: string) => boolean);
616 name?: string | ((name: string) => boolean);
617 userId?: string | ((userId: string) => boolean);
618 connectionId?: string | ((connectionId: string) => boolean);
619 clientAddress?: string | ((clientAddress: string) => boolean);
620 }
621
622 function addRule(matcher: Matcher, numRequests: number, timeInterval: number): string;
623
624 function removeRule(ruleId: string): boolean;
625}
626
627declare module "meteor/ddp-rate-limiter" {
628 module DDPRateLimiter {
629 interface Matcher {
630 type?: string | ((type: string) => boolean);
631 name?: string | ((name: string) => boolean);
632 userId?: string | ((userId: string) => boolean);
633 connectionId?: string | ((connectionId: string) => boolean);
634 clientAddress?: string | ((clientAddress: string) => boolean);
635 }
636
637 function addRule(matcher: Matcher, numRequests: number, timeInterval: number): string;
638
639 function removeRule(ruleId: string): boolean;
640 }
641}
642
643declare module DDP {
644 interface DDPStatic {
645 subscribe(name: string, ...rest: any[]): Meteor.SubscriptionHandle;
646 call(method: string, ...parameters: any[]): void;
647 apply(method: string, ...parameters: any[]): void;
648 methods(IMeteorMethodsDictionary: any): any;
649 status(): DDPStatus;
650 reconnect(): void;
651 disconnect(): void;
652 onReconnect(): void;
653 }
654
655 function _allSubscriptionsReady(): boolean;
656
657 type Status = 'connected' | 'connecting' | 'failed' | 'waiting' | 'offline';
658
659 interface DDPStatus {
660 connected: boolean;
661 status: Status;
662 retryCount: number;
663 retryTime?: number;
664 reason?: string;
665 }
666
667 function connect(url: string): DDPStatic;
668}
669
670declare module DDPCommon {
671 interface MethodInvocation {
672 new(options: {}): MethodInvocation;
673
674 unblock(): void;
675
676 setUserId(userId: number): void;
677 }
678}
679
680declare module "meteor/ddp" {
681 module DDP {
682 interface DDPStatic {
683 subscribe(name: string, ...rest: any[]): Meteor.SubscriptionHandle;
684 call(method: string, ...parameters: any[]): void;
685 apply(method: string, ...parameters: any[]): void;
686 methods(IMeteorMethodsDictionary: any): any;
687 status(): DDPStatus;
688 reconnect(): void;
689 disconnect(): void;
690 onReconnect(): void;
691 }
692
693 function _allSubscriptionsReady(): boolean;
694
695 type Status = 'connected' | 'connecting' | 'failed' | 'waiting' | 'offline';
696
697 interface DDPStatus {
698 connected: boolean;
699 status: Status;
700 retryCount: number;
701 retryTime?: number;
702 reason?: string;
703 }
704
705 function connect(url: string): DDPStatic;
706 }
707
708 module DDPCommon {
709 interface MethodInvocation {
710 new(options: {}): MethodInvocation;
711
712 unblock(): void;
713
714 setUserId(userId: number): void;
715 }
716 }
717}
718
719interface EJSONableCustomType {
720 clone(): EJSONableCustomType;
721 equals(other: Object): boolean;
722 toJSONValue(): JSONable;
723 typeName(): string;
724}
725interface EJSONable {
726 [key: string]: number | string | boolean | Object | number[] | string[] | Object[] | Date | Uint8Array | EJSONableCustomType;
727}
728interface JSONable {
729 [key: string]: number | string | boolean | Object | number[] | string[] | Object[];
730}
731interface EJSON extends EJSONable {}
732
733declare module EJSON {
734 function addType(name: string, factory: (val: JSONable) => EJSONableCustomType): void;
735
736 function clone < T > (val: T): T;
737
738 function equals(a: EJSON, b: EJSON, options?: {
739 keyOrderSensitive?: boolean;
740 }): boolean;
741
742 function fromJSONValue(val: JSONable): any;
743
744 function isBinary(x: Object): boolean;
745 var newBinary: any;
746
747 function parse(str: string): EJSON;
748
749 function stringify(val: EJSON, options?: {
750 indent?: boolean | number | string;
751 canonical?: boolean;
752 }): string;
753
754 function toJSONValue(val: EJSON): JSONable;
755}
756
757declare module "meteor/ejson" {
758 interface EJSONableCustomType {
759 clone(): EJSONableCustomType;
760 equals(other: Object): boolean;
761 toJSONValue(): JSONable;
762 typeName(): string;
763 }
764 interface EJSONable {
765 [key: string]: number | string | boolean | Object | number[] | string[] | Object[] | Date | Uint8Array | EJSONableCustomType;
766 }
767 interface JSONable {
768 [key: string]: number | string | boolean | Object | number[] | string[] | Object[];
769 }
770 interface EJSON extends EJSONable {}
771
772 module EJSON {
773 function addType(name: string, factory: (val: JSONable) => EJSONableCustomType): void;
774
775 function clone < T > (val: T): T;
776
777 function equals(a: EJSON, b: EJSON, options?: {
778 keyOrderSensitive?: boolean;
779 }): boolean;
780
781 function fromJSONValue(val: JSONable): any;
782
783 function isBinary(x: Object): boolean;
784 var newBinary: any;
785
786 function parse(str: string): EJSON;
787
788 function stringify(val: EJSON, options?: {
789 indent?: boolean | number | string;
790 canonical?: boolean;
791 }): string;
792
793 function toJSONValue(val: EJSON): JSONable;
794 }
795}
796
797declare module Email {
798 function send(options: {
799 from?: string;
800 to?: string | string[];
801 cc?: string | string[];
802 bcc?: string | string[];
803 replyTo?: string | string[];
804 subject?: string;
805 text?: string;
806 html?: string;
807 headers?: Object;
808 attachments?: Object[];
809 mailComposer?: MailComposer;
810 }): void;
811}
812
813interface MailComposerOptions {
814 escapeSMTP: boolean;
815 encoding: string;
816 charset: string;
817 keepBcc: boolean;
818 forceEmbeddedImages: boolean;
819}
820
821declare var MailComposer: MailComposerStatic;
822interface MailComposerStatic {
823 new(options: MailComposerOptions): MailComposer;
824}
825interface MailComposer {
826 addHeader(name: string, value: string): void;
827 setMessageOption(from: string, to: string, body: string, html: string): void;
828 streamMessage(): void;
829 pipe(stream: any /** fs.WriteStream **/ ): void;
830}
831
832declare module "meteor/email" {
833 module Email {
834 function send(options: {
835 from?: string;
836 to?: string | string[];
837 cc?: string | string[];
838 bcc?: string | string[];
839 replyTo?: string | string[];
840 subject?: string;
841 text?: string;
842 html?: string;
843 headers?: Object;
844 attachments?: Object[];
845 mailComposer?: MailComposer;
846 }): void;
847 }
848
849 interface MailComposerOptions {
850 escapeSMTP: boolean;
851 encoding: string;
852 charset: string;
853 keepBcc: boolean;
854 forceEmbeddedImages: boolean;
855 }
856
857 var MailComposer: MailComposerStatic;
858 interface MailComposerStatic {
859 new(options: MailComposerOptions): MailComposer;
860 }
861 interface MailComposer {
862 addHeader(name: string, value: string): void;
863 setMessageOption(from: string, to: string, body: string, html: string): void;
864 streamMessage(): void;
865 pipe(stream: any /** fs.WriteStream **/ ): void;
866 }
867}
868
869declare module HTTP {
870 interface HTTPRequest {
871 content?: string;
872 data?: any;
873 query?: string;
874 params?: {
875 [id: string]: string
876 };
877 auth?: string;
878 headers?: {
879 [id: string]: string
880 };
881 timeout?: number;
882 followRedirects?: boolean;
883 npmRequestOptions?: Object;
884 }
885
886 interface HTTPResponse {
887 statusCode?: number;
888 headers?: {
889 [id: string]: string
890 };
891 content?: string;
892 data?: any;
893 }
894
895 function call(method: string, url: string, options?: HTTP.HTTPRequest, asyncCallback?: Function): HTTP.HTTPResponse;
896
897 function del(url: string, callOptions?: HTTP.HTTPRequest, asyncCallback?: Function): HTTP.HTTPResponse;
898
899 function get(url: string, callOptions?: HTTP.HTTPRequest, asyncCallback?: Function): HTTP.HTTPResponse;
900
901 function post(url: string, callOptions?: HTTP.HTTPRequest, asyncCallback?: Function): HTTP.HTTPResponse;
902
903 function put(url: string, callOptions?: HTTP.HTTPRequest, asyncCallback?: Function): HTTP.HTTPResponse;
904
905 function call(method: string, url: string, options?: {
906 content?: string;
907 data?: Object;
908 query?: string;
909 params?: Object;
910 auth?: string;
911 headers?: Object;
912 timeout?: number;
913 followRedirects?: boolean;
914 npmRequestOptions?: Object;
915 beforeSend?: Function;
916 }, asyncCallback?: Function): HTTP.HTTPResponse;
917}
918
919declare module "meteor/http" {
920 module HTTP {
921 interface HTTPRequest {
922 content?: string;
923 data?: any;
924 query?: string;
925 params?: {
926 [id: string]: string
927 };
928 auth?: string;
929 headers?: {
930 [id: string]: string
931 };
932 timeout?: number;
933 followRedirects?: boolean;
934 npmRequestOptions?: Object;
935 }
936
937 interface HTTPResponse {
938 statusCode?: number;
939 headers?: {
940 [id: string]: string
941 };
942 content?: string;
943 data?: any;
944 }
945
946 function call(method: string, url: string, options?: HTTP.HTTPRequest, asyncCallback?: Function): HTTP.HTTPResponse;
947
948 function del(url: string, callOptions?: HTTP.HTTPRequest, asyncCallback?: Function): HTTP.HTTPResponse;
949
950 function get(url: string, callOptions?: HTTP.HTTPRequest, asyncCallback?: Function): HTTP.HTTPResponse;
951
952 function post(url: string, callOptions?: HTTP.HTTPRequest, asyncCallback?: Function): HTTP.HTTPResponse;
953
954 function put(url: string, callOptions?: HTTP.HTTPRequest, asyncCallback?: Function): HTTP.HTTPResponse;
955
956 function call(method: string, url: string, options?: {
957 content?: string;
958 data?: Object;
959 query?: string;
960 params?: Object;
961 auth?: string;
962 headers?: Object;
963 timeout?: number;
964 followRedirects?: boolean;
965 npmRequestOptions?: Object;
966 beforeSend?: Function;
967 }, asyncCallback?: Function): HTTP.HTTPResponse;
968 }
969}
970
971declare module Meteor {
972 /** Global props **/
973 var isClient: boolean;
974 var isCordova: boolean;
975 var isServer: boolean;
976 var isProduction: boolean;
977 var release: string;
978 /** Global props **/
979
980 /** Settings **/
981 interface Settings {
982 public: {
983 [id: string]: any
984 }, [id: string]: any
985 }
986 var settings: Settings;
987 /** Settings **/
988
989 /** User **/
990 interface UserEmail {
991 address: string;
992 verified: boolean;
993 }
994 interface User {
995 _id?: string;
996 username?: string;
997 emails?: UserEmail[];
998 createdAt?: number;
999 profile?: any;
1000 services?: any;
1001 }
1002
1003 function user(): User;
1004
1005 function userId(): string;
1006 var users: Mongo.Collection < User > ;
1007 /** User **/
1008
1009 /** Error **/
1010 var Error: ErrorStatic;
1011 interface ErrorStatic {
1012 new(error: string | number, reason?: string, details?: string): Error;
1013 }
1014 interface Error {
1015 error: string | number;
1016 reason?: string;
1017 details?: string;
1018 }
1019 /** Error **/
1020
1021 /** Method **/
1022 function methods(methods: Object): void;
1023
1024 function call(name: string, ...args: any[]): any;
1025
1026 function apply(name: string, args: EJSONable[], options?: {
1027 wait?: boolean;
1028 onResultReceived?: Function;
1029 }, asyncCallback?: Function): any;
1030 /** Method **/
1031
1032 /** Url **/
1033 function absoluteUrl(path?: string, options?: {
1034 secure?: boolean;
1035 replaceLocalhost?: boolean;
1036 rootUrl?: string;
1037 }): string;
1038 /** Url **/
1039
1040 /** Timeout **/
1041 function setInterval(func: Function, delay: number): number;
1042
1043 function setTimeout(func: Function, delay: number): number;
1044
1045 function clearInterval(id: number): void;
1046
1047 function clearTimeout(id: number): void;
1048
1049 function defer(func: Function): void;
1050 /** Timeout **/
1051
1052 /** utils **/
1053 function startup(func: Function): void;
1054
1055 function wrapAsync(func: Function, context?: Object): any;
1056
1057 function bindEnvironment(func: Function): any;
1058 /** utils **/
1059
1060 /** Pub/Sub **/
1061 interface SubscriptionHandle {
1062 stop(): void;
1063 ready(): boolean;
1064 }
1065 interface LiveQueryHandle {
1066 stop(): void;
1067 }
1068 /** Pub/Sub **/
1069}
1070
1071declare module "meteor/meteor" {
1072 module Meteor {
1073 /** Global props **/
1074 var isClient: boolean;
1075 var isCordova: boolean;
1076 var isServer: boolean;
1077 var isProduction: boolean;
1078 var release: string;
1079 /** Global props **/
1080
1081 /** Settings **/
1082 interface Settings {
1083 public: {
1084 [id: string]: any
1085 }, [id: string]: any
1086 }
1087 var settings: Settings;
1088 /** Settings **/
1089
1090 /** User **/
1091 interface UserEmail {
1092 address: string;
1093 verified: boolean;
1094 }
1095 interface User {
1096 _id?: string;
1097 username?: string;
1098 emails?: UserEmail[];
1099 createdAt?: number;
1100 profile?: any;
1101 services?: any;
1102 }
1103
1104 function user(): User;
1105
1106 function userId(): string;
1107 var users: Mongo.Collection < User > ;
1108 /** User **/
1109
1110 /** Error **/
1111 var Error: ErrorStatic;
1112 interface ErrorStatic {
1113 new(error: string | number, reason?: string, details?: string): Error;
1114 }
1115 interface Error {
1116 error: string | number;
1117 reason?: string;
1118 details?: string;
1119 }
1120 /** Error **/
1121
1122 /** Method **/
1123 function methods(methods: Object): void;
1124
1125 function call(name: string, ...args: any[]): any;
1126
1127 function apply(name: string, args: EJSONable[], options?: {
1128 wait?: boolean;
1129 onResultReceived?: Function;
1130 }, asyncCallback?: Function): any;
1131 /** Method **/
1132
1133 /** Url **/
1134 function absoluteUrl(path?: string, options?: {
1135 secure?: boolean;
1136 replaceLocalhost?: boolean;
1137 rootUrl?: string;
1138 }): string;
1139 /** Url **/
1140
1141 /** Timeout **/
1142 function setInterval(func: Function, delay: number): number;
1143
1144 function setTimeout(func: Function, delay: number): number;
1145
1146 function clearInterval(id: number): void;
1147
1148 function clearTimeout(id: number): void;
1149
1150 function defer(func: Function): void;
1151 /** Timeout **/
1152
1153 /** utils **/
1154 function startup(func: Function): void;
1155
1156 function wrapAsync(func: Function, context?: Object): any;
1157
1158 function bindEnvironment(func: Function): any;
1159 /** utils **/
1160
1161 /** Pub/Sub **/
1162 interface SubscriptionHandle {
1163 stop(): void;
1164 ready(): boolean;
1165 }
1166 interface LiveQueryHandle {
1167 stop(): void;
1168 }
1169 /** Pub/Sub **/
1170 }
1171}
1172
1173declare module Meteor {
1174 /** Login **/
1175 interface LoginWithExternalServiceOptions {
1176 requestPermissions?: string[];
1177 requestOfflineToken?: Boolean;
1178 forceApprovalPrompt?: Boolean;
1179 loginUrlParameters?: Object;
1180 redirectUrl?: string;
1181 loginHint?: string;
1182 loginStyle?: string;
1183 }
1184
1185 function loginWithMeteorDeveloperAccount(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
1186
1187 function loginWithFacebook(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
1188
1189 function loginWithGithub(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
1190
1191 function loginWithGoogle(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
1192
1193 function loginWithMeetup(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
1194
1195 function loginWithTwitter(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
1196
1197 function loginWithWeibo(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
1198
1199 function loggingIn(): boolean;
1200
1201 function loginWith < ExternalService > (options?: {
1202 requestPermissions?: string[];
1203 requestOfflineToken?: boolean;
1204 loginUrlParameters?: Object;
1205 userEmail?: string;
1206 loginStyle?: string;
1207 redirectUrl?: string;
1208 }, callback?: Function): void;
1209
1210 function loginWithPassword(user: Object | string, password: string, callback?: Function): void;
1211
1212 function loginWithToken(token: string, callback?: Function): void;
1213
1214 function logout(callback?: Function): void;
1215
1216 function logoutOtherClients(callback?: Function): void;
1217 /** Login **/
1218
1219 /** Event **/
1220 interface Event {
1221 type: string;
1222 target: HTMLElement;
1223 currentTarget: HTMLElement;
1224 which: number;
1225 stopPropagation(): void;
1226 stopImmediatePropagation(): void;
1227 preventDefault(): void;
1228 isPropagationStopped(): boolean;
1229 isImmediatePropagationStopped(): boolean;
1230 isDefaultPrevented(): boolean;
1231 }
1232 interface EventHandlerFunction extends Function {
1233 (event?: Meteor.Event, templateInstance?: Blaze.TemplateInstance): void;
1234 }
1235 interface EventMap {
1236 [id: string]: Meteor.EventHandlerFunction;
1237 }
1238 /** Event **/
1239
1240 /** Connection **/
1241 function reconnect(): void;
1242
1243 function disconnect(): void;
1244 /** Connection **/
1245
1246 /** Status **/
1247 function status(): DDP.DDPStatus;
1248 /** Status **/
1249
1250 /** Pub/Sub **/
1251 function subscribe(name: string, ...args: any[]): Meteor.SubscriptionHandle;
1252 /** Pub/Sub **/
1253}
1254
1255declare module "meteor/meteor" {
1256 module Meteor {
1257 /** Login **/
1258 interface LoginWithExternalServiceOptions {
1259 requestPermissions?: string[];
1260 requestOfflineToken?: Boolean;
1261 forceApprovalPrompt?: Boolean;
1262 loginUrlParameters?: Object;
1263 redirectUrl?: string;
1264 loginHint?: string;
1265 loginStyle?: string;
1266 }
1267
1268 function loginWithMeteorDeveloperAccount(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
1269
1270 function loginWithFacebook(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
1271
1272 function loginWithGithub(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
1273
1274 function loginWithGoogle(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
1275
1276 function loginWithMeetup(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
1277
1278 function loginWithTwitter(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
1279
1280 function loginWithWeibo(options?: Meteor.LoginWithExternalServiceOptions, callback?: Function): void;
1281
1282 function loggingIn(): boolean;
1283
1284 function loginWith < ExternalService > (options?: {
1285 requestPermissions?: string[];
1286 requestOfflineToken?: boolean;
1287 loginUrlParameters?: Object;
1288 userEmail?: string;
1289 loginStyle?: string;
1290 redirectUrl?: string;
1291 }, callback?: Function): void;
1292
1293 function loginWithPassword(user: Object | string, password: string, callback?: Function): void;
1294
1295 function loginWithToken(token: string, callback?: Function): void;
1296
1297 function logout(callback?: Function): void;
1298
1299 function logoutOtherClients(callback?: Function): void;
1300 /** Login **/
1301
1302 /** Event **/
1303 interface Event {
1304 type: string;
1305 target: HTMLElement;
1306 currentTarget: HTMLElement;
1307 which: number;
1308 stopPropagation(): void;
1309 stopImmediatePropagation(): void;
1310 preventDefault(): void;
1311 isPropagationStopped(): boolean;
1312 isImmediatePropagationStopped(): boolean;
1313 isDefaultPrevented(): boolean;
1314 }
1315 interface EventHandlerFunction extends Function {
1316 (event?: Meteor.Event, templateInstance?: Blaze.TemplateInstance): void;
1317 }
1318 interface EventMap {
1319 [id: string]: Meteor.EventHandlerFunction;
1320 }
1321 /** Event **/
1322
1323 /** Connection **/
1324 function reconnect(): void;
1325
1326 function disconnect(): void;
1327 /** Connection **/
1328
1329 /** Status **/
1330 function status(): DDP.DDPStatus;
1331 /** Status **/
1332
1333 /** Pub/Sub **/
1334 function subscribe(name: string, ...args: any[]): Meteor.SubscriptionHandle;
1335 /** Pub/Sub **/
1336 }
1337}
1338
1339declare module Meteor {
1340 /** Connection **/
1341 interface Connection {
1342 id: string;
1343 close: Function;
1344 onClose: Function;
1345 clientAddress: string;
1346 httpHeaders: Object;
1347 }
1348
1349 function onConnection(callback: Function): void;
1350 /** Connection **/
1351
1352 function publish(name: string, func: Function): void;
1353
1354 function _debug(...args: any[]): void;
1355}
1356
1357interface Subscription {
1358 added(collection: string, id: string, fields: Object): void;
1359 changed(collection: string, id: string, fields: Object): void;
1360 connection: Meteor.Connection;
1361 error(error: Error): void;
1362 onStop(func: Function): void;
1363 ready(): void;
1364 removed(collection: string, id: string): void;
1365 stop(): void;
1366 userId: string;
1367}
1368
1369declare module "meteor/meteor" {
1370 module Meteor {
1371 /** Connection **/
1372 interface Connection {
1373 id: string;
1374 close: Function;
1375 onClose: Function;
1376 clientAddress: string;
1377 httpHeaders: Object;
1378 }
1379
1380 function onConnection(callback: Function): void;
1381 /** Connection **/
1382
1383 function publish(name: string, func: Function): void;
1384
1385 function _debug(...args: any[]): void;
1386 }
1387
1388 interface Subscription {
1389 added(collection: string, id: string, fields: Object): void;
1390 changed(collection: string, id: string, fields: Object): void;
1391 connection: Meteor.Connection;
1392 error(error: Error): void;
1393 onStop(func: Function): void;
1394 ready(): void;
1395 removed(collection: string, id: string): void;
1396 stop(): void;
1397 userId: string;
1398 }
1399}
1400
1401declare module Mongo {
1402 interface Selector {
1403 [key: string]: any;
1404 }
1405 interface Selector extends Object {}
1406 interface Modifier {}
1407 interface SortSpecifier {}
1408 interface FieldSpecifier {
1409 [id: string]: Number;
1410 }
1411
1412 var Collection: CollectionStatic;
1413 interface CollectionStatic {
1414 new < T > (name: string | null, options?: {
1415 connection?: Object;
1416 idGeneration?: string;
1417 transform?: Function;
1418 }): Collection < T > ;
1419 }
1420 interface Collection < T > {
1421 allow(options: {
1422 insert?: (userId: string, doc: T) => boolean;
1423 update?: (userId: string, doc: T, fieldNames: string[], modifier: any) => boolean;
1424 remove?: (userId: string, doc: T) => boolean;
1425 fetch?: string[];
1426 transform?: Function;
1427 }): boolean;
1428 deny(options: {
1429 insert?: (userId: string, doc: T) => boolean;
1430 update?: (userId: string, doc: T, fieldNames: string[], modifier: any) => boolean;
1431 remove?: (userId: string, doc: T) => boolean;
1432 fetch?: string[];
1433 transform?: Function;
1434 }): boolean;
1435 find(selector?: Selector | ObjectID | string, options?: {
1436 sort?: SortSpecifier;
1437 skip?: number;
1438 limit?: number;
1439 fields?: FieldSpecifier;
1440 reactive?: boolean;
1441 transform?: Function;
1442 }): Cursor < T > ;
1443 findOne(selector?: Selector | ObjectID | string, options?: {
1444 sort?: SortSpecifier;
1445 skip?: number;
1446 fields?: FieldSpecifier;
1447 reactive?: boolean;
1448 transform?: Function;
1449 }): T;
1450 insert(doc: T, callback?: Function): string;
1451 rawCollection(): any;
1452 rawDatabase(): any;
1453 remove(selector: Selector | ObjectID | string, callback?: Function): number;
1454 update(selector: Selector | ObjectID | string, modifier: Modifier, options?: {
1455 multi?: boolean;
1456 upsert?: boolean;
1457 }, callback?: Function): number;
1458 upsert(selector: Selector | ObjectID | string, modifier: Modifier, options?: {
1459 multi?: boolean;
1460 }, callback?: Function): {
1461 numberAffected?: number;insertedId?: string;
1462 };
1463 _ensureIndex(keys: {
1464 [key: string]: number | string
1465 } | string, options?: {
1466 [key: string]: any
1467 }): void;
1468 _dropIndex(keys: {
1469 [key: string]: number | string
1470 } | string): void;
1471 }
1472
1473 var Cursor: CursorStatic;
1474 interface CursorStatic {
1475 new < T > (): Cursor < T > ;
1476 }
1477 interface ObserveCallbacks {
1478 added?(document: Object) : void;
1479 addedAt?(document: Object, atIndex: number, before: Object) : void;
1480 changed?(newDocument: Object, oldDocument: Object) : void;
1481 changedAt?(newDocument: Object, oldDocument: Object, indexAt: number) : void;
1482 removed?(oldDocument: Object) : void;
1483 removedAt?(oldDocument: Object, atIndex: number) : void;
1484 movedTo?(document: Object, fromIndex: number, toIndex: number, before: Object) : void;
1485 }
1486 interface ObserveChangesCallbacks {
1487 added?(id: string, fields: Object) : void;
1488 addedBefore?(id: string, fields: Object, before: Object) : void;
1489 changed?(id: string, fields: Object) : void;
1490 movedBefore?(id: string, before: Object) : void;
1491 removed?(id: string) : void;
1492 }
1493 interface Cursor < T > {
1494 count(applySkipLimit?: boolean): number;
1495 fetch(): Array < T > ;
1496 forEach(callback: (doc: T, index: number, cursor: Cursor < T > ) => void, thisArg?: any): void;
1497 map < U > (callback: (doc: T, index: number, cursor: Cursor < T > ) => U, thisArg?: any): Array < U > ;
1498 observe(callbacks: ObserveCallbacks): Meteor.LiveQueryHandle;
1499 observeChanges(callbacks: ObserveChangesCallbacks): Meteor.LiveQueryHandle;
1500 }
1501
1502 var ObjectID: ObjectIDStatic;
1503 interface ObjectIDStatic {
1504 new(hexString?: string): ObjectID;
1505 }
1506 interface ObjectID {}
1507}
1508
1509declare module "meteor/mongo" {
1510 module Mongo {
1511 interface Selector {
1512 [key: string]: any;
1513 }
1514 interface Selector extends Object {}
1515 interface Modifier {}
1516 interface SortSpecifier {}
1517 interface FieldSpecifier {
1518 [id: string]: Number;
1519 }
1520
1521 var Collection: CollectionStatic;
1522 interface CollectionStatic {
1523 new < T > (name: string | null, options?: {
1524 connection?: Object;
1525 idGeneration?: string;
1526 transform?: Function;
1527 }): Collection < T > ;
1528 }
1529 interface Collection < T > {
1530 allow(options: {
1531 insert?: (userId: string, doc: T) => boolean;
1532 update?: (userId: string, doc: T, fieldNames: string[], modifier: any) => boolean;
1533 remove?: (userId: string, doc: T) => boolean;
1534 fetch?: string[];
1535 transform?: Function;
1536 }): boolean;
1537 deny(options: {
1538 insert?: (userId: string, doc: T) => boolean;
1539 update?: (userId: string, doc: T, fieldNames: string[], modifier: any) => boolean;
1540 remove?: (userId: string, doc: T) => boolean;
1541 fetch?: string[];
1542 transform?: Function;
1543 }): boolean;
1544 find(selector?: Selector | ObjectID | string, options?: {
1545 sort?: SortSpecifier;
1546 skip?: number;
1547 limit?: number;
1548 fields?: FieldSpecifier;
1549 reactive?: boolean;
1550 transform?: Function;
1551 }): Cursor < T > ;
1552 findOne(selector?: Selector | ObjectID | string, options?: {
1553 sort?: SortSpecifier;
1554 skip?: number;
1555 fields?: FieldSpecifier;
1556 reactive?: boolean;
1557 transform?: Function;
1558 }): T;
1559 insert(doc: T, callback?: Function): string;
1560 rawCollection(): any;
1561 rawDatabase(): any;
1562 remove(selector: Selector | ObjectID | string, callback?: Function): number;
1563 update(selector: Selector | ObjectID | string, modifier: Modifier, options?: {
1564 multi?: boolean;
1565 upsert?: boolean;
1566 }, callback?: Function): number;
1567 upsert(selector: Selector | ObjectID | string, modifier: Modifier, options?: {
1568 multi?: boolean;
1569 }, callback?: Function): {
1570 numberAffected?: number;insertedId?: string;
1571 };
1572 _ensureIndex(keys: {
1573 [key: string]: number | string
1574 } | string, options?: {
1575 [key: string]: any
1576 }): void;
1577 _dropIndex(keys: {
1578 [key: string]: number | string
1579 } | string): void;
1580 }
1581
1582 var Cursor: CursorStatic;
1583 interface CursorStatic {
1584 new < T > (): Cursor < T > ;
1585 }
1586 interface ObserveCallbacks {
1587 added?(document: Object) : void;
1588 addedAt?(document: Object, atIndex: number, before: Object) : void;
1589 changed?(newDocument: Object, oldDocument: Object) : void;
1590 changedAt?(newDocument: Object, oldDocument: Object, indexAt: number) : void;
1591 removed?(oldDocument: Object) : void;
1592 removedAt?(oldDocument: Object, atIndex: number) : void;
1593 movedTo?(document: Object, fromIndex: number, toIndex: number, before: Object) : void;
1594 }
1595 interface ObserveChangesCallbacks {
1596 added?(id: string, fields: Object) : void;
1597 addedBefore?(id: string, fields: Object, before: Object) : void;
1598 changed?(id: string, fields: Object) : void;
1599 movedBefore?(id: string, before: Object) : void;
1600 removed?(id: string) : void;
1601 }
1602 interface Cursor < T > {
1603 count(applySkipLimit?: boolean): number;
1604 fetch(): Array < T > ;
1605 forEach(callback: (doc: T, index: number, cursor: Cursor < T > ) => void, thisArg?: any): void;
1606 map < U > (callback: (doc: T, index: number, cursor: Cursor < T > ) => U, thisArg?: any): Array < U > ;
1607 observe(callbacks: ObserveCallbacks): Meteor.LiveQueryHandle;
1608 observeChanges(callbacks: ObserveChangesCallbacks): Meteor.LiveQueryHandle;
1609 }
1610
1611 var ObjectID: ObjectIDStatic;
1612 interface ObjectIDStatic {
1613 new(hexString?: string): ObjectID;
1614 }
1615 interface ObjectID {}
1616 }
1617}
1618
1619declare module Mongo {
1620 interface AllowDenyOptions {
1621 insert?: (userId: string, doc: any) => boolean;
1622 update?: (userId: string, doc: any, fieldNames: string[], modifier: any) => boolean;
1623 remove?: (userId: string, doc: any) => boolean;
1624 fetch?: string[];
1625 transform?: Function;
1626 }
1627}
1628
1629declare module "meteor/mongo" {
1630 module Mongo {
1631 interface AllowDenyOptions {
1632 insert?: (userId: string, doc: any) => boolean;
1633 update?: (userId: string, doc: any, fieldNames: string[], modifier: any) => boolean;
1634 remove?: (userId: string, doc: any) => boolean;
1635 fetch?: string[];
1636 transform?: Function;
1637 }
1638 }
1639}
1640
1641declare module Random {
1642 function id(numberOfChars?: number): string;
1643
1644 function secret(numberOfChars?: number): string;
1645
1646 function fraction(): number;
1647 // @param numberOfDigits, @returns a random hex string of the given length
1648 function hexString(numberOfDigits: number): string;
1649 // @param array, @return a random element in array
1650 function choice(array: any[]): string;
1651 // @param str, @return a random char in str
1652 function choice(str: string): string;
1653}
1654
1655declare module "meteor/random" {
1656 module Random {
1657 function id(numberOfChars?: number): string;
1658
1659 function secret(numberOfChars?: number): string;
1660
1661 function fraction(): number;
1662 // @param numberOfDigits, @returns a random hex string of the given length
1663 function hexString(numberOfDigits: number): string;
1664 // @param array, @return a random element in array
1665 function choice(array: any[]): string;
1666 // @param str, @return a random char in str
1667 function choice(str: string): string;
1668 }
1669}
1670
1671declare var ReactiveVar: ReactiveVarStatic;
1672interface ReactiveVarStatic {
1673 new < T > (initialValue: T, equalsFunc?: Function): ReactiveVar < T > ;
1674}
1675interface ReactiveVar < T > {
1676 get(): T;
1677 set(newValue: T): void;
1678}
1679
1680declare module "meteor/reactive-var" {
1681 var ReactiveVar: ReactiveVarStatic;
1682 interface ReactiveVarStatic {
1683 new < T > (initialValue: T, equalsFunc?: Function): ReactiveVar < T > ;
1684 }
1685 interface ReactiveVar < T > {
1686 get(): T;
1687 set(newValue: T): void;
1688 }
1689}
1690
1691declare module Session {
1692 function equals(key: string, value: string | number | boolean | any): boolean;
1693
1694 function get(key: string): any;
1695
1696 function set(key: string, value: EJSONable | any): void;
1697
1698 function setDefault(key: string, value: EJSONable | any): void;
1699}
1700
1701declare module "meteor/session" {
1702 module Session {
1703 function equals(key: string, value: string | number | boolean | any): boolean;
1704
1705 function get(key: string): any;
1706
1707 function set(key: string, value: EJSONable | any): void;
1708
1709 function setDefault(key: string, value: EJSONable | any): void;
1710 }
1711}
1712
1713declare var Template: TemplateStatic;
1714interface TemplateStatic extends Blaze.TemplateStatic {
1715 new(viewName?: string, renderFunction?: Function): Blaze.Template;
1716 body: Blaze.Template;
1717 [index: string]: any | Blaze.Template;
1718}
1719
1720declare module "meteor/templating" {
1721 var Template: TemplateStatic;
1722 interface TemplateStatic extends Blaze.TemplateStatic {
1723 new(viewName?: string, renderFunction?: Function): Blaze.Template;
1724 body: Blaze.Template;
1725 [index: string]: any | Blaze.Template;
1726 }
1727}
1728
1729interface ILengthAble {
1730 length: number;
1731}
1732
1733interface ITinytestAssertions {
1734 ok(doc: Object): void;
1735 expect_fail(): void;
1736 fail(doc: Object): void;
1737 runId(): string;
1738 equal < T > (actual: T, expected: T, message?: string, not?: boolean): void;
1739 notEqual < T > (actual: T, expected: T, message?: string): void;
1740 instanceOf(obj: Object, klass: Function, message?: string): void;
1741 notInstanceOf(obj: Object, klass: Function, message?: string): void;
1742 matches(actual: any, regexp: RegExp, message?: string): void;
1743 notMatches(actual: any, regexp: RegExp, message?: string): void;
1744 throws(f: Function, expected?: string | RegExp): void;
1745 isTrue(v: boolean, msg?: string): void;
1746 isFalse(v: boolean, msg?: string): void;
1747 isNull(v: any, msg?: string): void;
1748 isNotNull(v: any, msg?: string): void;
1749 isUndefined(v: any, msg?: string): void;
1750 isNotUndefined(v: any, msg?: string): void;
1751 isNan(v: any, msg?: string): void;
1752 isNotNan(v: any, msg?: string): void;
1753 include < T > (s: Array < T > | Object | string, value: any, msg?: string, not?: boolean): void;
1754
1755 notInclude < T > (s: Array < T > | Object | string, value: any, msg?: string, not?: boolean): void;
1756 length(obj: ILengthAble, expected_length: number, msg?: string): void;
1757 _stringEqual(actual: string, expected: string, msg?: string): void;
1758}
1759
1760declare module Tinytest {
1761 function add(description: string, func: (test: ITinytestAssertions) => void): void;
1762
1763 function addAsync(description: string, func: (test: ITinytestAssertions) => void): void;
1764}
1765
1766declare module "meteor/tiny-test" {
1767 interface ILengthAble {
1768 length: number;
1769 }
1770
1771 interface ITinytestAssertions {
1772 ok(doc: Object): void;
1773 expect_fail(): void;
1774 fail(doc: Object): void;
1775 runId(): string;
1776 equal < T > (actual: T, expected: T, message?: string, not?: boolean): void;
1777 notEqual < T > (actual: T, expected: T, message?: string): void;
1778 instanceOf(obj: Object, klass: Function, message?: string): void;
1779 notInstanceOf(obj: Object, klass: Function, message?: string): void;
1780 matches(actual: any, regexp: RegExp, message?: string): void;
1781 notMatches(actual: any, regexp: RegExp, message?: string): void;
1782 throws(f: Function, expected?: string | RegExp): void;
1783 isTrue(v: boolean, msg?: string): void;
1784 isFalse(v: boolean, msg?: string): void;
1785 isNull(v: any, msg?: string): void;
1786 isNotNull(v: any, msg?: string): void;
1787 isUndefined(v: any, msg?: string): void;
1788 isNotUndefined(v: any, msg?: string): void;
1789 isNan(v: any, msg?: string): void;
1790 isNotNan(v: any, msg?: string): void;
1791 include < T > (s: Array < T > | Object | string, value: any, msg?: string, not?: boolean): void;
1792
1793 notInclude < T > (s: Array < T > | Object | string, value: any, msg?: string, not?: boolean): void;
1794 length(obj: ILengthAble, expected_length: number, msg?: string): void;
1795 _stringEqual(actual: string, expected: string, msg?: string): void;
1796 }
1797
1798 module Tinytest {
1799 function add(description: string, func: (test: ITinytestAssertions) => void): void;
1800
1801 function addAsync(description: string, func: (test: ITinytestAssertions) => void): void;
1802 }
1803}
1804
1805declare module App {
1806 function accessRule(pattern: string, options?: {
1807 type?: string;
1808 launchExternal?: boolean;
1809 }): void;
1810
1811 function configurePlugin(id: string, config: Object): void;
1812
1813 function icons(icons: Object): void;
1814
1815 function info(options: {
1816 id?: string;
1817 version?: string;
1818 name?: string;
1819 description?: string;
1820 author?: string;
1821 email?: string;
1822 website?: string;
1823 }): void;
1824
1825 function launchScreens(launchScreens: Object): void;
1826
1827 function setPreference(name: string, value: string, platform?: string): void;
1828}
1829
1830declare function execFileAsync(command: string, args?: any[], options?: {
1831 cwd?: Object;
1832 env?: Object;
1833 stdio?: any[] | string;
1834 destination?: any;
1835 waitForClose?: string;
1836}): any;
1837declare function execFileSync(command: string, args?: any[], options?: {
1838 cwd?: Object;
1839 env?: Object;
1840 stdio?: any[] | string;
1841 destination?: any;
1842 waitForClose?: string;
1843}): String;
1844
1845declare module Assets {
1846 function getBinary(assetPath: string, asyncCallback?: Function): EJSON;
1847
1848 function getText(assetPath: string, asyncCallback?: Function): string;
1849
1850 function absoluteFilePath(assetPath: string): string;
1851}
1852
1853declare module Cordova {
1854 function depends(dependencies: {
1855 [id: string]: string
1856 }): void;
1857}
1858
1859declare module Npm {
1860 function depends(dependencies: {
1861 [id: string]: string
1862 }): void;
1863
1864 function require(name: string): any;
1865}
1866
1867declare namespace Package {
1868 function describe(options: {
1869 summary?: string;
1870 version?: string;
1871 name?: string;
1872 git?: string;
1873 documentation?: string;
1874 debugOnly?: boolean;
1875 prodOnly?: boolean;
1876 testOnly?: boolean;
1877 }): void;
1878
1879 function onTest(func: (api: PackageAPI) => void): void;
1880
1881 function onUse(func: (api: PackageAPI) => void): void;
1882
1883 function registerBuildPlugin(options?: {
1884 name?: string;
1885 use?: string | string[];
1886 sources?: string[];
1887 npmDependencies?: Object;
1888 }): void;
1889}
1890
1891interface PackageAPI {
1892 new(): PackageAPI;
1893 addAssets(filenames: string | string[], architecture: string | string[]): void;
1894 addFiles(filenames: string | string[], architecture?: string | string[], options?: {
1895 bare?: boolean;
1896 }): void;
1897 export (exportedObjects: string | string[], architecture?: string | string[], exportOptions?: Object, testOnly?: boolean): void;
1898 imply(packageNames: string | string[], architecture?: string | string[]): void;
1899 use(packageNames: string | string[], architecture?: string | string[], options?: {
1900 weak?: boolean;
1901 unordered?: boolean;
1902 }): void;
1903 versionsFrom(meteorRelease: string | string[]): void;
1904}
1905
1906declare var console: Console;
1907
1908declare module "meteor/tools" {
1909 module App {
1910 function accessRule(pattern: string, options?: {
1911 type?: string;
1912 launchExternal?: boolean;
1913 }): void;
1914
1915 function configurePlugin(id: string, config: Object): void;
1916
1917 function icons(icons: Object): void;
1918
1919 function info(options: {
1920 id?: string;
1921 version?: string;
1922 name?: string;
1923 description?: string;
1924 author?: string;
1925 email?: string;
1926 website?: string;
1927 }): void;
1928
1929 function launchScreens(launchScreens: Object): void;
1930
1931 function setPreference(name: string, value: string, platform?: string): void;
1932 }
1933
1934 function execFileAsync(command: string, args?: any[], options?: {
1935 cwd?: Object;
1936 env?: Object;
1937 stdio?: any[] | string;
1938 destination?: any;
1939 waitForClose?: string;
1940 }): any;
1941
1942 function execFileSync(command: string, args?: any[], options?: {
1943 cwd?: Object;
1944 env?: Object;
1945 stdio?: any[] | string;
1946 destination?: any;
1947 waitForClose?: string;
1948 }): String;
1949
1950 module Assets {
1951 function getBinary(assetPath: string, asyncCallback?: Function): EJSON;
1952
1953 function getText(assetPath: string, asyncCallback?: Function): string;
1954
1955 function absoluteFilePath(assetPath: string): string;
1956 }
1957
1958 module Cordova {
1959 function depends(dependencies: {
1960 [id: string]: string
1961 }): void;
1962 }
1963
1964 module Npm {
1965 function depends(dependencies: {
1966 [id: string]: string
1967 }): void;
1968
1969 function require(name: string): any;
1970 }
1971
1972 namespace Package {
1973 function describe(options: {
1974 summary?: string;
1975 version?: string;
1976 name?: string;
1977 git?: string;
1978 documentation?: string;
1979 debugOnly?: boolean;
1980 prodOnly?: boolean;
1981 testOnly?: boolean;
1982 }): void;
1983
1984 function onTest(func: (api: PackageAPI) => void): void;
1985
1986 function onUse(func: (api: PackageAPI) => void): void;
1987
1988 function registerBuildPlugin(options?: {
1989 name?: string;
1990 use?: string | string[];
1991 sources?: string[];
1992 npmDependencies?: Object;
1993 }): void;
1994 }
1995
1996 interface PackageAPI {
1997 new(): PackageAPI;
1998 addAssets(filenames: string | string[], architecture: string | string[]): void;
1999 addFiles(filenames: string | string[], architecture?: string | string[], options?: {
2000 bare?: boolean;
2001 }): void;
2002 export (exportedObjects: string | string[], architecture?: string | string[], exportOptions?: Object, testOnly?: boolean): void;
2003 imply(packageNames: string | string[], architecture?: string | string[]): void;
2004 use(packageNames: string | string[], architecture?: string | string[], options?: {
2005 weak?: boolean;
2006 unordered?: boolean;
2007 }): void;
2008 versionsFrom(meteorRelease: string | string[]): void;
2009 }
2010
2011 var console: Console;
2012}
2013
2014declare module Tracker {
2015 function Computation(): void;
2016 interface Computation {
2017 firstRun: boolean;
2018 invalidate(): void;
2019 invalidated: boolean;
2020 onInvalidate(callback: Function): void;
2021 onStop(callback: Function): void;
2022 stop(): void;
2023 stopped: boolean;
2024 }
2025 var currentComputation: Computation;
2026
2027 var Dependency: DependencyStatic;
2028 interface DependencyStatic {
2029 new(): Dependency;
2030 }
2031 interface Dependency {
2032 changed(): void;
2033 depend(fromComputation?: Computation): boolean;
2034 hasDependents(): boolean;
2035 }
2036
2037 var active: boolean;
2038
2039 function afterFlush(callback: Function): void;
2040
2041 function autorun(runFunc: (computation: Computation) => void, options?: {
2042 onError?: Function;
2043 }): Computation;
2044
2045 function flush(): void;
2046
2047 function nonreactive(func: Function): void;
2048
2049 function onInvalidate(callback: Function): void;
2050}
2051
2052declare module "meteor/tracker" {
2053 module Tracker {
2054 function Computation(): void;
2055 interface Computation {
2056 firstRun: boolean;
2057 invalidate(): void;
2058 invalidated: boolean;
2059 onInvalidate(callback: Function): void;
2060 onStop(callback: Function): void;
2061 stop(): void;
2062 stopped: boolean;
2063 }
2064 var currentComputation: Computation;
2065
2066 var Dependency: DependencyStatic;
2067 interface DependencyStatic {
2068 new(): Dependency;
2069 }
2070 interface Dependency {
2071 changed(): void;
2072 depend(fromComputation?: Computation): boolean;
2073 hasDependents(): boolean;
2074 }
2075
2076 var active: boolean;
2077
2078 function afterFlush(callback: Function): void;
2079
2080 function autorun(runFunc: (computation: Computation) => void, options?: {
2081 onError?: Function;
2082 }): Computation;
2083
2084 function flush(): void;
2085
2086 function nonreactive(func: Function): void;
2087
2088 function onInvalidate(callback: Function): void;
2089 }
2090}
2091
2092declare module Match {
2093 function Maybe(pattern: any): boolean;
2094}
2095
2096declare module "meteor/check" {
2097 module Match {
2098 function Maybe(pattern: any): boolean;
2099 }
2100}
2101
2102declare module Meteor {
2103 /** Global props **/
2104 var isDevelopment: boolean;
2105 var isTest: boolean;
2106 /** Global props **/
2107}
2108
2109declare module "meteor/meteor" {
2110 module Meteor {
2111 /** Global props **/
2112 var isDevelopment: boolean;
2113 var isTest: boolean;
2114 /** Global props **/
2115 }
2116}
2117
2118declare module Accounts {
2119 function onLogout(func: Function): void;
2120
2121 function makeClientLoggedOut(): boolean | void;
2122}
2123
2124declare module "meteor/accounts-base" {
2125 module Accounts {
2126 function onLogout(func: Function): void;
2127
2128 function makeClientLoggedOut(): boolean | void;
2129 }
2130}
2131declare module "meteor/accounts-base" {
2132 module Accounts {
2133 function onLogout(func: Function): void;
2134
2135 function makeClientLoggedOut(): boolean | void;
2136 }
2137
2138 module "meteor/accounts-base" {
2139 module Accounts {
2140 function onLogout(func: Function): void;
2141
2142 function makeClientLoggedOut(): boolean | void;
2143 }
2144 }
2145}
2146
2147declare module Accounts {
2148 function onLogout(func: (user: Meteor.User, connection: Meteor.Connection) => void): void;
2149}
2150
2151declare module "meteor/accounts-base" {
2152 module Accounts {
2153 function onLogout(func: (user: Meteor.User, connection: Meteor.Connection) => void): void;
2154 }
2155}
2156
2157declare module Meteor {
2158 /** Local storage **/
2159 var _localStorage: LocalStorage;
2160 interface LocalStorage {
2161 _data: any;
2162 getItem(key: any): any;
2163 removeItem(key: any): void;
2164 setItem(key: any, value: any): any;
2165 }
2166 /** Local storage **/
2167}
2168declare module "meteor/meteor" {
2169 module Meteor {
2170 /** Local storage **/
2171 var _localStorage: LocalStorage;
2172 interface LocalStorage {
2173 _data: any;
2174 getItem(key: any): any;
2175 removeItem(key: any): void;
2176 setItem(key: any, value: any): any;
2177 }
2178 /** Local storage **/
2179 }
2180}