Skip to content

Commit a26caef

Browse files
committed
Fix ts definitions
1 parent 6058681 commit a26caef

File tree

6 files changed

+120
-136
lines changed

6 files changed

+120
-136
lines changed

packages/accounts-base/accounts-base.d.ts

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Mongo } from 'meteor/mongo';
2-
import { Meteor } from 'meteor/meteor';
2+
import { Meteor as BaseMeteor } from 'meteor/meteor';
33

44
export interface URLS {
55
resetPassword: (token: string) => string;
@@ -8,18 +8,27 @@ export interface URLS {
88
}
99

1010
export interface EmailFields {
11-
from?: ((user: Meteor.User) => string) | undefined;
12-
subject?: ((user: Meteor.User) => string) | undefined;
13-
text?: ((user: Meteor.User, url: string) => string) | undefined;
14-
html?: ((user: Meteor.User, url: string) => string) | undefined;
11+
from?: ((user: BaseMeteor.User) => string) | undefined;
12+
subject?: ((user: BaseMeteor.User) => string) | undefined;
13+
text?: ((user: BaseMeteor.User, url: string) => string) | undefined;
14+
html?: ((user: BaseMeteor.User, url: string) => string) | undefined;
15+
}
16+
17+
export namespace Meteor {
18+
function user(options?: {
19+
fields?: Mongo.FieldSpecifier | undefined;
20+
}): BaseMeteor.User | null;
21+
22+
function userId(): string | null;
23+
var users: Mongo.Collection<BaseMeteor.User>;
1524
}
1625

1726
export namespace Accounts {
1827
var urls: URLS;
1928

2029
function user(options?: {
2130
fields?: Mongo.FieldSpecifier | undefined;
22-
}): Meteor.User | null;
31+
}): BaseMeteor.User | null;
2332

2433
function userId(): string | null;
2534

@@ -30,7 +39,7 @@ export namespace Accounts {
3039
password?: string | undefined;
3140
profile?: Object | undefined;
3241
},
33-
callback?: (error?: Error | Meteor.Error | Meteor.TypedError) => void
42+
callback?: (error?: Error | BaseMeteor.Error | BaseMeteor.TypedError) => void
3443
): string;
3544

3645
function config(options: {
@@ -66,23 +75,23 @@ export namespace Accounts {
6675
function changePassword(
6776
oldPassword: string,
6877
newPassword: string,
69-
callback?: (error?: Error | Meteor.Error | Meteor.TypedError) => void
78+
callback?: (error?: Error | BaseMeteor.Error | BaseMeteor.TypedError) => void
7079
): void;
7180

7281
function forgotPassword(
7382
options: { email?: string | undefined },
74-
callback?: (error?: Error | Meteor.Error | Meteor.TypedError) => void
83+
callback?: (error?: Error | BaseMeteor.Error | BaseMeteor.TypedError) => void
7584
): void;
7685

7786
function resetPassword(
7887
token: string,
7988
newPassword: string,
80-
callback?: (error?: Error | Meteor.Error | Meteor.TypedError) => void
89+
callback?: (error?: Error | BaseMeteor.Error | BaseMeteor.TypedError) => void
8190
): void;
8291

8392
function verifyEmail(
8493
token: string,
85-
callback?: (error?: Error | Meteor.Error | Meteor.TypedError) => void
94+
callback?: (error?: Error | BaseMeteor.Error | BaseMeteor.TypedError) => void
8695
): void;
8796

8897
function onEmailVerificationLink(callback: Function): void;
@@ -96,11 +105,11 @@ export namespace Accounts {
96105
function loggingOut(): boolean;
97106

98107
function logout(
99-
callback?: (error?: Error | Meteor.Error | Meteor.TypedError) => void
108+
callback?: (error?: Error | BaseMeteor.Error | BaseMeteor.TypedError) => void
100109
): void;
101110

102111
function logoutOtherClients(
103-
callback?: (error?: Error | Meteor.Error | Meteor.TypedError) => void
112+
callback?: (error?: Error | BaseMeteor.Error | BaseMeteor.TypedError) => void
104113
): void;
105114

106115
var ui: {
@@ -134,18 +143,18 @@ export namespace Accounts {
134143
function removeEmail(userId: string, email: string): void;
135144

136145
function onCreateUser(
137-
func: (options: { profile?: {} | undefined }, user: Meteor.User) => void
146+
func: (options: { profile?: {} | undefined }, user: BaseMeteor.User) => void
138147
): void;
139148

140149
function findUserByEmail(
141150
email: string,
142151
options?: { fields?: Mongo.FieldSpecifier | undefined }
143-
): Meteor.User | null | undefined;
152+
): BaseMeteor.User | null | undefined;
144153

145154
function findUserByUsername(
146155
username: string,
147156
options?: { fields?: Mongo.FieldSpecifier | undefined }
148-
): Meteor.User | null | undefined;
157+
): BaseMeteor.User | null | undefined;
149158

150159
function sendEnrollmentEmail(
151160
userId: string,
@@ -191,9 +200,9 @@ export namespace Accounts {
191200
interface IValidateLoginAttemptCbOpts {
192201
type: string;
193202
allowed: boolean;
194-
error: Meteor.Error;
195-
user: Meteor.User;
196-
connection: Meteor.Connection;
203+
error: BaseMeteor.Error;
204+
user: BaseMeteor.User;
205+
connection: BaseMeteor.Connection;
197206
methodName: string;
198207
methodArguments: any[];
199208
}
@@ -206,8 +215,8 @@ export namespace Accounts {
206215
export namespace Accounts {
207216
function onLogout(
208217
func: (options: {
209-
user: Meteor.User;
210-
connection: Meteor.Connection;
218+
user: BaseMeteor.User;
219+
connection: BaseMeteor.Connection;
211220
}) => void
212221
): void;
213222
}
@@ -245,7 +254,7 @@ export namespace Accounts {
245254
* optionally `tokenExpires`.
246255
*
247256
* This function takes care of:
248-
* - Updating the Meteor.loggingIn() reactive data source
257+
* - Updating the BaseMeteor.loggingIn() reactive data source
249258
* - Calling the method in 'wait' mode
250259
* - On success, saving the resume token to localStorage
251260
* - On success, calling Accounts.connection.setUserId()
@@ -300,7 +309,7 @@ export namespace Accounts {
300309
* `password.digest`).
301310
*/
302311
function _checkPassword(
303-
user: Meteor.User,
312+
user: BaseMeteor.User,
304313
password: Password
305314
): { userId: string; error?: any };
306315
}

packages/accounts-base/package.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package.describe({
22
summary: 'A user account system',
3-
version: '2.2.6-2',
3+
version: '2.2.6-qualia.3',
44
});
55

66
Package.onUse(api => {

packages/ddp/ddp.d.ts

Lines changed: 85 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
import { Meteor } from 'meteor/meteor';
1+
import { Meteor as BaseMeteor } from 'meteor/meteor';
2+
import { EJSONable, EJSONableProperty } from 'meteor/ejson';
3+
4+
export type global_Error = Error;
25

36
export namespace DDP {
47
interface DDPStatic {
5-
subscribe(name: string, ...rest: any[]): Meteor.SubscriptionHandle;
8+
subscribe(name: string, ...rest: any[]): BaseMeteor.SubscriptionHandle;
69
call(method: string, ...parameters: any[]): any;
710
apply(method: string, ...parameters: any[]): any;
811
methods(IMeteorMethodsDictionary: any): any;
@@ -27,12 +30,80 @@ export namespace DDP {
2730
function connect(url: string): DDPStatic;
2831
}
2932

33+
export namespace Meteor {
34+
35+
/** Method **/
36+
interface MethodThisType {
37+
/** Access inside a method invocation. Boolean value, true if this invocation is a stub. */
38+
isSimulation: boolean;
39+
/** The id of the user that made this method call, or `null` if no user was logged in. */
40+
userId: string | null;
41+
/**
42+
* Access inside a method invocation. The connection that this method was received on. `null` if the method is not associated with a connection, eg. a server initiated method call. Calls
43+
* to methods made from a server method which was in turn initiated from the client share the same `connection`. */
44+
connection: BaseMeteor.Connection | null;
45+
/**
46+
* Set the logged in user.
47+
* @param userId The value that should be returned by `userId` on this connection.
48+
*/
49+
setUserId(userId: string | null): void;
50+
/** Call inside a method invocation. Allow subsequent method from this client to begin running in a new fiber. */
51+
unblock(): void;
52+
}
53+
54+
/**
55+
* Defines functions that can be invoked over the network by clients.
56+
* @param methods Dictionary whose keys are method names and values are functions.
57+
*/
58+
function methods(methods: {
59+
[key: string]: (this: MethodThisType, ...args: any[]) => any;
60+
}): void;
61+
62+
/**
63+
* Invokes a method passing any number of arguments.
64+
* @param name Name of method to invoke
65+
* @param args Optional method arguments
66+
*/
67+
function call(name: string, ...args: any[]): any;
68+
69+
function apply<
70+
Result extends
71+
| EJSONable
72+
| EJSONable[]
73+
| EJSONableProperty
74+
| EJSONableProperty[]
75+
>(
76+
name: string,
77+
args: ReadonlyArray<EJSONable | EJSONableProperty>,
78+
options?: {
79+
wait?: boolean | undefined;
80+
onResultReceived?:
81+
| ((
82+
error: global_Error | BaseMeteor.Error | undefined,
83+
result?: Result
84+
) => void)
85+
| undefined;
86+
/**
87+
* (Client only) if true, don't send this method again on reload, simply call the callback an error with the error code 'invocation-failed'.
88+
*/
89+
noRetry?: boolean | undefined;
90+
returnStubValue?: boolean | undefined;
91+
throwStubExceptions?: boolean | undefined;
92+
},
93+
asyncCallback?: (
94+
error: global_Error | BaseMeteor.Error | undefined,
95+
result?: Result
96+
) => void
97+
): any;
98+
/** Method **/
99+
}
100+
30101
export namespace DDPCommon {
31102
interface MethodInvocationOptions {
32103
userId: string | null;
33104
setUserId?: ((newUserId: string) => void) | undefined;
34105
isSimulation: boolean;
35-
connection: Meteor.Connection;
106+
connection: BaseMeteor.Connection;
36107
randomSeed: string;
37108
}
38109

@@ -60,6 +131,16 @@ export namespace DDPCommon {
60131
* Access inside a method invocation. The [connection](#meteor_onconnection) that this method was received on. `null` if the method is not associated with a connection, eg. a server
61132
* initiated method call. Calls to methods made from a server method which was in turn initiated from the client share the same `connection`.
62133
*/
63-
connection: Meteor.Connection;
134+
connection: BaseMeteor.Connection;
64135
}
136+
137+
/** Connection **/
138+
function reconnect(): void;
139+
140+
function disconnect(): void;
141+
/** Connection **/
142+
143+
/** Status **/
144+
function status(): DDP.DDPStatus;
145+
/** Status **/
65146
}

packages/ddp/package.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package.describe({
22
summary: "Meteor's latency-compensated distributed data framework",
3-
version: '1.4.1'
3+
version: '1.4.2-qualia.1'
44
});
55

66
Package.onUse(function (api) {

0 commit comments

Comments
 (0)