Commit 6e3c0aa8 authored by Tim Kinnane's avatar Tim Kinnane
Browse files

fix(asteroid): Missing interface for resumeLoginPromise

+ style change to empty catch handler
+ removed unused asteroid v2 interfaces
+ rebuild for release
parent 1023103a
......@@ -232,56 +232,56 @@ FN:78,useLog
FN:99,connect
FN:103,(anonymous_10)
FN:110,(anonymous_11)
FN:111,(anonymous_12)
FN:113,(anonymous_13)
FN:124,(anonymous_14)
FN:136,disconnect
FN:140,(anonymous_16)
FN:150,setupMethodCache
FN:171,asyncCall
FN:175,(anonymous_19)
FN:179,(anonymous_20)
FN:194,callMethod
FN:205,cacheCall
FN:207,(anonymous_23)
FN:211,(anonymous_24)
FN:223,login
FN:244,(anonymous_26)
FN:248,(anonymous_27)
FN:255,logout
FN:257,(anonymous_29)
FN:268,subscribe
FN:272,(anonymous_31)
FN:277,(anonymous_32)
FN:285,unsubscribe
FN:295,unsubscribeAll
FN:296,(anonymous_35)
FN:303,subscribeToMessages
FN:305,(anonymous_37)
FN:334,reactToMessages
FN:337,(anonymous_39)
FN:362,respondToMessages
FN:379,(anonymous_41)
FN:385,(anonymous_42)
FN:385,(anonymous_43)
FN:431,getRoomId
FN:436,getRoomName
FN:445,getDirectMessageRoomId
FN:447,(anonymous_47)
FN:451,joinRoom
FN:463,leaveRoom
FN:475,joinRooms
FN:476,(anonymous_53)
FN:483,prepareMessage
FN:496,sendMessage
FN:509,sendToRoomId
FN:516,(anonymous_57)
FN:527,sendToRoom
FN:532,(anonymous_59)
FN:540,sendDirectToUser
FN:545,(anonymous_61)
FN:552,editMessage
FN:561,setReaction
FN:114,(anonymous_12)
FN:116,(anonymous_13)
FN:127,(anonymous_14)
FN:139,disconnect
FN:143,(anonymous_16)
FN:153,setupMethodCache
FN:174,asyncCall
FN:178,(anonymous_19)
FN:182,(anonymous_20)
FN:197,callMethod
FN:208,cacheCall
FN:210,(anonymous_23)
FN:214,(anonymous_24)
FN:226,login
FN:247,(anonymous_26)
FN:251,(anonymous_27)
FN:258,logout
FN:260,(anonymous_29)
FN:271,subscribe
FN:275,(anonymous_31)
FN:280,(anonymous_32)
FN:288,unsubscribe
FN:298,unsubscribeAll
FN:299,(anonymous_35)
FN:306,subscribeToMessages
FN:308,(anonymous_37)
FN:337,reactToMessages
FN:340,(anonymous_39)
FN:365,respondToMessages
FN:382,(anonymous_41)
FN:388,(anonymous_42)
FN:388,(anonymous_43)
FN:434,getRoomId
FN:439,getRoomName
FN:448,getDirectMessageRoomId
FN:450,(anonymous_47)
FN:454,joinRoom
FN:466,leaveRoom
FN:478,joinRooms
FN:479,(anonymous_53)
FN:486,prepareMessage
FN:499,sendMessage
FN:512,sendToRoomId
FN:519,(anonymous_57)
FN:530,sendToRoom
FN:535,(anonymous_59)
FN:543,sendDirectToUser
FN:548,(anonymous_61)
FN:555,editMessage
FN:564,setReaction
FNF:54
FNH:46
FNDA:0,useLog
......@@ -360,226 +360,228 @@ DA:106,37
DA:107,37
DA:109,37
DA:110,37
DA:111,37
DA:112,37
DA:113,37
DA:114,4
DA:115,4
DA:116,4
DA:111,33
DA:112,33
DA:114,37
DA:115,37
DA:116,37
DA:117,4
DA:118,4
DA:123,37
DA:124,37
DA:125,33
DA:127,33
DA:119,4
DA:120,4
DA:121,4
DA:126,37
DA:127,37
DA:128,33
DA:129,33
DA:136,1
DA:137,1
DA:138,1
DA:130,33
DA:131,33
DA:132,33
DA:139,1
DA:140,1
DA:151,37
DA:152,37
DA:160,37
DA:171,1
DA:172,23
DA:173,23
DA:174,23
DA:176,0
DA:177,0
DA:180,23
DA:141,1
DA:142,1
DA:143,1
DA:154,37
DA:155,37
DA:163,37
DA:174,1
DA:175,23
DA:176,23
DA:177,23
DA:179,0
DA:180,0
DA:183,23
DA:194,1
DA:195,1
DA:205,1
DA:206,13
DA:208,0
DA:209,0
DA:212,13
DA:186,23
DA:197,1
DA:198,1
DA:208,1
DA:209,13
DA:211,0
DA:212,0
DA:215,13
DA:223,1
DA:237,28
DA:238,28
DA:243,28
DA:245,28
DA:218,13
DA:226,1
DA:240,28
DA:241,28
DA:246,28
DA:249,0
DA:250,0
DA:255,1
DA:256,2
DA:258,0
DA:259,0
DA:268,1
DA:272,15
DA:273,15
DA:274,15
DA:248,28
DA:249,28
DA:252,0
DA:253,0
DA:258,1
DA:259,2
DA:261,0
DA:262,0
DA:271,1
DA:275,15
DA:276,15
DA:277,15
DA:278,15
DA:279,15
DA:285,1
DA:286,8
DA:287,8
DA:288,8
DA:281,15
DA:282,15
DA:288,1
DA:289,8
DA:290,8
DA:291,8
DA:295,1
DA:296,8
DA:303,1
DA:304,15
DA:306,15
DA:293,8
DA:294,8
DA:298,1
DA:299,8
DA:306,1
DA:307,15
DA:334,1
DA:335,12
DA:337,12
DA:338,151
DA:339,151
DA:340,151
DA:309,15
DA:310,15
DA:337,1
DA:338,12
DA:340,12
DA:341,151
DA:342,81
DA:343,81
DA:345,70
DA:348,0
DA:362,1
DA:366,10
DA:368,10
DA:372,10
DA:378,1
DA:380,0
DA:384,10
DA:385,40
DA:386,40
DA:387,0
DA:388,0
DA:392,40
DA:395,39
DA:396,39
DA:399,38
DA:400,38
DA:342,151
DA:343,151
DA:344,151
DA:345,81
DA:346,81
DA:348,70
DA:351,0
DA:365,1
DA:369,10
DA:371,10
DA:375,10
DA:381,1
DA:383,0
DA:387,10
DA:388,40
DA:389,40
DA:390,0
DA:391,0
DA:395,40
DA:398,39
DA:399,39
DA:402,38
DA:403,38
DA:406,38
DA:409,38
DA:412,36
DA:412,38
DA:415,36
DA:418,7
DA:419,7
DA:418,36
DA:421,7
DA:422,7
DA:424,10
DA:431,1
DA:432,8
DA:436,1
DA:437,3
DA:445,1
DA:446,2
DA:447,2
DA:451,1
DA:452,4
DA:453,4
DA:454,4
DA:455,0
DA:425,7
DA:427,10
DA:434,1
DA:435,8
DA:439,1
DA:440,3
DA:448,1
DA:449,2
DA:450,2
DA:454,1
DA:455,4
DA:456,4
DA:457,4
DA:458,4
DA:463,1
DA:464,0
DA:465,0
DA:466,0
DA:458,0
DA:460,4
DA:461,4
DA:466,1
DA:467,0
DA:468,0
DA:469,0
DA:470,0
DA:475,1
DA:476,4
DA:483,1
DA:487,14
DA:488,14
DA:489,14
DA:496,1
DA:497,15
DA:509,1
DA:513,8
DA:514,5
DA:516,3
DA:517,6
DA:527,1
DA:531,2
DA:532,2
DA:540,1
DA:544,2
DA:545,2
DA:552,1
DA:553,1
DA:561,1
DA:562,2
LF:172
LH:152
DA:472,0
DA:473,0
DA:478,1
DA:479,4
DA:486,1
DA:490,14
DA:491,14
DA:492,14
DA:499,1
DA:500,15
DA:512,1
DA:516,8
DA:517,5
DA:519,3
DA:520,6
DA:530,1
DA:534,2
DA:535,2
DA:543,1
DA:547,2
DA:548,2
DA:555,1
DA:556,1
DA:564,1
DA:565,2
LF:174
LH:154
BRDA:100,0,0,30
BRDA:118,1,0,3
BRDA:118,1,1,1
BRDA:123,2,0,37
BRDA:123,2,1,0
BRDA:128,3,0,2
BRDA:128,3,1,31
BRDA:172,4,0,21
BRDA:172,4,1,2
BRDA:181,5,0,16
BRDA:181,5,1,7
BRDA:196,6,0,1
BRDA:196,6,1,0
BRDA:195,7,0,1
BRDA:195,7,1,1
BRDA:213,8,0,12
BRDA:213,8,1,1
BRDA:223,9,0,28
BRDA:239,10,0,28
BRDA:239,10,1,28
BRDA:287,11,0,0
BRDA:287,11,1,8
BRDA:339,12,0,151
BRDA:339,12,1,0
BRDA:339,13,0,151
BRDA:339,13,1,151
BRDA:341,14,0,81
BRDA:341,14,1,70
BRDA:364,15,0,1
BRDA:372,16,0,1
BRDA:372,16,1,9
BRDA:373,17,0,10
BRDA:373,17,1,10
BRDA:373,17,2,1
BRDA:373,17,3,1
BRDA:386,18,0,0
BRDA:386,18,1,40
BRDA:392,19,0,1
BRDA:392,19,1,39
BRDA:396,20,0,1
BRDA:396,20,1,38
BRDA:396,21,0,39
BRDA:396,21,1,2
BRDA:400,22,0,0
BRDA:400,22,1,38
BRDA:400,23,0,38
BRDA:400,23,1,0
BRDA:403,24,0,0
BRDA:403,24,1,38
BRDA:403,25,0,38
BRDA:403,25,1,38
BRDA:403,25,2,37
BRDA:409,26,0,2
BRDA:409,26,1,36
BRDA:409,27,0,38
BRDA:409,27,1,35
BRDA:412,28,0,1
BRDA:412,28,1,35
BRDA:415,29,0,29
BRDA:415,29,1,7
BRDA:454,30,0,0
BRDA:454,30,1,4
BRDA:466,31,0,0
BRDA:466,31,1,0
BRDA:488,32,0,11
BRDA:488,32,1,3
BRDA:513,33,0,5
BRDA:513,33,1,3
BRDA:121,1,0,3
BRDA:121,1,1,1
BRDA:126,2,0,37
BRDA:126,2,1,0
BRDA:131,3,0,2
BRDA:131,3,1,31
BRDA:175,4,0,21
BRDA:175,4,1,2
BRDA:184,5,0,16
BRDA:184,5,1,7
BRDA:199,6,0,1
BRDA:199,6,1,0
BRDA:198,7,0,1
BRDA:198,7,1,1
BRDA:216,8,0,12
BRDA:216,8,1,1
BRDA:226,9,0,28
BRDA:242,10,0,28
BRDA:242,10,1,28
BRDA:290,11,0,0
BRDA:290,11,1,8
BRDA:342,12,0,151
BRDA:342,12,1,0
BRDA:342,13,0,151
BRDA:342,13,1,151
BRDA:344,14,0,81
BRDA:344,14,1,70
BRDA:367,15,0,1
BRDA:375,16,0,1
BRDA:375,16,1,9
BRDA:376,17,0,10
BRDA:376,17,1,10
BRDA:376,17,2,1
BRDA:376,17,3,1
BRDA:389,18,0,0
BRDA:389,18,1,40
BRDA:395,19,0,1
BRDA:395,19,1,39
BRDA:399,20,0,1
BRDA:399,20,1,38
BRDA:399,21,0,39
BRDA:399,21,1,2
BRDA:403,22,0,0
BRDA:403,22,1,38
BRDA:403,23,0,38
BRDA:403,23,1,0
BRDA:406,24,0,0
BRDA:406,24,1,38
BRDA:406,25,0,38
BRDA:406,25,1,38
BRDA:406,25,2,37
BRDA:412,26,0,2
BRDA:412,26,1,36
BRDA:412,27,0,38
BRDA:412,27,1,35
BRDA:415,28,0,1
BRDA:415,28,1,35
BRDA:418,29,0,29
BRDA:418,29,1,7
BRDA:457,30,0,0
BRDA:457,30,1,4
BRDA:469,31,0,0
BRDA:469,31,1,0
BRDA:491,32,0,11
BRDA:491,32,1,3
BRDA:516,33,0,5
BRDA:516,33,1,3
BRF:68
BRH:57
end_of_record
......
......@@ -26,6 +26,7 @@ export interface IAsteroid extends EventEmitter {
call: (method: string, ...params: any[]) => IMethodResult;
apply: (method: string, params: any[]) => IMethodResult;
getCollection: (name: string) => ICollection;
resumeLoginPromise: Promise<string>;
ddp: IAsteroidDDP;
}
/**
......
{"version":3,"file":"asteroidInterfaces.js","sourceRoot":"","sources":["../../src/config/asteroidInterfaces.ts"],"names":[],"mappings":"","sourcesContent":["import { EventEmitter } from 'events'\n// import { Map } from 'immutable'\n\n/**\n * Asteroid DDP - add known properties to avoid TS lint errors\n */\nexport interface IAsteroidDDP extends EventEmitter {\n readyState: 1 | 0\n}\n\n/**\n * Asteroid type\n * @todo Update with typing from definitely typed (when available)\n */\nexport interface IAsteroid extends EventEmitter {\n connect: () => Promise<void>,\n disconnect: () => Promise<void>,\n createUser: (usernameOrEmail: string, password: string, profile: IUserOptions) => Promise<any>\n loginWithLDAP: (...params: any[]) => Promise<any>\n loginWithFacebook: (...params: any[]) => Promise<any>\n loginWithGoogle: (...params: any[]) => Promise<any>\n loginWithTwitter: (...params: any[]) => Promise<any>\n loginWithGithub: (...params: any[]) => Promise<any>\n loginWithPassword: (usernameOrEmail: string, password: string) => Promise<any>\n logout: () => Promise<null>\n subscribe: (name: string, ...params: any[]) => ISubscription\n subscriptions: ISubscription[],\n call: (method: string, ...params: any[]) => IMethodResult\n apply: (method: string, params: any[]) => IMethodResult\n getCollection: (name: string) => ICollection\n ddp: IAsteroidDDP\n // v2 Interface\n /*\n collections: Map<string, any>,\n unsubscribe: (id: string) => void,\n createUser: (options: IUserOptions) => Promise<string>,\n loginWithPassword: (options: IUserOptions) => Promise<string>,\n login: (params: any) => Promise<string>,\n */\n}\n\n/**\n * Asteroid user options type\n * @todo Update with typing from definitely typed (when available)\n */\nexport interface IUserOptions {\n username?: string,\n email?: string,\n password: string\n}\n\n/**\n * Asteroid subscription type.\n * ID is populated when ready promise resolves.\n * @todo Update with typing from definitely typed (when available)\n */\nexport interface ISubscription {\n stop: () => void,\n ready: Promise<IReady>,\n id?: string\n}\n\n// Asteroid v1 only\nexport interface IReady { state: string, value: string }\n\n/* // v2\nexport interface ISubscription extends EventEmitter {\n id: string\n}\n*/\n\n/**\n * If the method is successful, the `result` promise will be resolved with the\n * return value passed by the server. The `updated` promise will be resolved\n * with nothing once the server emits the updated message, that tells the client\n * that any side-effect that the method execution caused on the database has\n * been reflected on the client (for example, if the method caused the insertion\n * of an item into a collection, the client has been notified of said\n * insertion).\n *\n * If the method fails, the `result` promise will be rejected with the error\n * returned by the server. The `updated` promise will be rejected as well\n * (with nothing).\n */\nexport interface IMethodResult {\n result: Promise<any>,\n updated: Promise<any>\n}\n\n/**\n *\n */\nexport interface ICollection {\n name: string,\n insert: (item: any) => ICollectionResult,\n update: (id: string, item: any) => ICollectionResult,\n remove: (id: string) => ICollectionResult,\n reactiveQuery: (selector: object | Function) => IReactiveQuery\n}\n\n/**\n * The `local` promise is immediately resolved with the `_id` of the updated\n * item. That is, unless an error occurred. In that case, an exception will be\n * raised.\n * The `remote` promise is resolved with the `_id` of the updated item if the\n * remote update is successful. Otherwise it's rejected with the reason of the\n * failure.\n */\nexport interface ICollectionResult {\n local: Promise<any>,\n remote: Promise<any>\n}\n\n/**\n * A reactive subset of a collection. Possible events are:\n * `change`: emitted whenever the result of the query changes. The id of the\n * item that changed is passed to the handler.\n */\nexport interface IReactiveQuery {\n on: (event: string, handler: Function) => void,\n result: any[]\n}\n\n/** Credentials for Asteroid login method */\nexport interface ICredentials {\n password: string,\n username?: string,\n email?: string,\n ldap?: boolean,\n ldapOptions?: object\n}\n"]}
\ No newline at end of file
{"version":3,"file":"asteroidInterfaces.js","sourceRoot":"","sources":["../../src/config/asteroidInterfaces.ts"],"names":[],"mappings":"","sourcesContent":["import { EventEmitter } from 'events'\n// import { Map } from 'immutable'\n\n/**\n * Asteroid DDP - add known properties to avoid TS lint errors\n */\nexport interface IAsteroidDDP extends EventEmitter {\n readyState: 1 | 0\n}\n\n/**\n * Asteroid type\n * @todo Update with typing from definitely typed (when available)\n */\nexport interface IAsteroid extends EventEmitter {\n connect: () => Promise<void>,\n disconnect: () => Promise<void>,\n createUser: (usernameOrEmail: string, password: string, profile: IUserOptions) => Promise<any>\n loginWithLDAP: (...params: any[]) => Promise<any>\n loginWithFacebook: (...params: any[]) => Promise<any>\n loginWithGoogle: (...params: any[]) => Promise<any>\n loginWithTwitter: (...params: any[]) => Promise<any>\n loginWithGithub: (...params: any[]) => Promise<any>\n loginWithPassword: (usernameOrEmail: string, password: string) => Promise<any>\n logout: () => Promise<null>\n subscribe: (name: string, ...params: any[]) => ISubscription\n subscriptions: ISubscription[],\n call: (method: string, ...params: any[]) => IMethodResult\n apply: (method: string, params: any[]) => IMethodResult\n getCollection: (name: string) => ICollection\n resumeLoginPromise: Promise<string>\n ddp: IAsteroidDDP\n}\n\n/**\n * Asteroid user options type\n * @todo Update with typing from definitely typed (when available)\n */\nexport interface IUserOptions {\n username?: string,\n email?: string,\n password: string\n}\n\n/**\n * Asteroid subscription type.\n * ID is populated when ready promise resolves.\n * @todo Update with typing from definitely typed (when available)\n */\nexport interface ISubscription {\n stop: () => void,\n ready: Promise<IReady>,\n id?: string\n}\n\n// Asteroid v1 only\nexport interface IReady { state: string, value: string }\n\n/* // v2\nexport interface ISubscription extends EventEmitter {\n id: string\n}\n*/\n\n/**\n * If the method is successful, the `result` promise will be resolved with the\n * return value passed by the server. The `updated` promise will be resolved\n * with nothing once the server emits the updated message, that tells the client\n * that any side-effect that the method execution caused on the database has\n * been reflected on the client (for example, if the method caused the insertion\n * of an item into a collection, the client has been notified of said\n * insertion).\n *\n * If the method fails, the `result` promise will be rejected with the error\n * returned by the server. The `updated` promise will be rejected as well\n * (with nothing).\n */\nexport interface IMethodResult {\n result: Promise<any>,\n updated: Promise<any>\n}\n\n/**\n *\n */\nexport interface ICollection {\n name: string,\n insert: (item: any) => ICollectionResult,\n update: (id: string, item: any) => ICollectionResult,\n remove: (id: string) => ICollectionResult,\n reactiveQuery: (selector: object | Function) => IReactiveQuery\n}\n\n/**\n * The `local` promise is immediately resolved with the `_id` of the updated\n * item. That is, unless an error occurred. In that case, an exception will be\n * raised.\n * The `remote` promise is resolved with the `_id` of the updated item if the\n * remote update is successful. Otherwise it's rejected with the reason of the\n * failure.\n */\nexport interface ICollectionResult {\n local: Promise<any>,\n remote: Promise<any>\n}\n\n/**\n * A reactive subset of a collection. Possible events are:\n * `change`: emitted whenever the result of the query changes. The id of the\n * item that changed is passed to the handler.\n */\nexport interface IReactiveQuery {\n on: (event: string, handler: Function) => void,\n result: any[]\n}\n\n/** Credentials for Asteroid login method */\nexport interface ICredentials {\n password: string,\n username?: string,\n email?: string,\n ldap?: boolean,\n ldapOptions?: object\n}\n"]}
\ No newline at end of file
......@@ -81,7 +81,10 @@ function connect(options = {}, callback) {
log_1.logger.info('[connect] Connecting', config);
exports.asteroid = new asteroid_1.default(config.host, config.useSsl);
setupMethodCache(exports.asteroid); // init instance for later caching method calls
exports.asteroid.on('connected', () => exports.events.emit('connected'));
exports.asteroid.on('connected', () => {
exports.asteroid.resumeLoginPromise.catch();
exports.events.emit('connected');
});
exports.asteroid.on('reconnected', () => exports.events.emit('reconnected'));
let cancelled = false;
const rejectionTimeout = setTimeout(function () {
......
This diff is collapsed.
......@@ -28,15 +28,8 @@ export interface IAsteroid extends EventEmitter {
call: (method: string, ...params: any[]) => IMethodResult
apply: (method: string, params: any[]) => IMethodResult
getCollection: (name: string) => ICollection
resumeLoginPromise: Promise<string>
ddp: IAsteroidDDP
// v2 Interface
/*
collections: Map<string, any>,
unsubscribe: (id: string) => void,
createUser: (options: IUserOptions) => Promise<string>,
loginWithPassword: (options: IUserOptions) => Promise<string>,
login: (params: any) => Promise<string>,
*/
}
/**
......
......@@ -108,9 +108,7 @@ export function connect (
setupMethodCache(asteroid) // init instance for later caching method calls
asteroid.on('connected', () => {
asteroid.resumeLoginPromise.catch(function () {
// pass
})
asteroid.resumeLoginPromise.catch()
events.emit('connected')
})
asteroid.on('reconnected', () => events.emit('reconnected'))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment