@live-change/dao 0.3.12 → 0.3.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/ReactiveServerConnection.js +17 -14
- package/package.json +1 -1
|
@@ -389,8 +389,7 @@ class ReactiveServerConnection extends EventEmitter {
|
|
|
389
389
|
|
|
390
390
|
if(this.settings.fastAuth) {
|
|
391
391
|
try {
|
|
392
|
-
this.credentials
|
|
393
|
-
this.daoPromise = this.daoFactory(this.credentials, this.connection, this)
|
|
392
|
+
this.handleDaoPromise(this.daoFactory(this.credentials, this.connection, this))
|
|
394
393
|
} catch(error) {
|
|
395
394
|
return this.handleDaoFactoryError(error)
|
|
396
395
|
}
|
|
@@ -696,6 +695,21 @@ class ReactiveServerConnection extends EventEmitter {
|
|
|
696
695
|
this.closeConnection()
|
|
697
696
|
}
|
|
698
697
|
|
|
698
|
+
handleDaoPromise(daoPromise) {
|
|
699
|
+
this.daoPromise = daoPromise
|
|
700
|
+
if(!this.daoPromise.then) {
|
|
701
|
+
this.dao = this.daoPromise
|
|
702
|
+
this.daoPromise = null
|
|
703
|
+
} else {
|
|
704
|
+
this.daoPromise.catch(error => this.handleDaoFactoryError(error)).then(dd => {
|
|
705
|
+
if(!dd) return this.handleDaoFactoryError("dao not defined")
|
|
706
|
+
this.dao = dd
|
|
707
|
+
this.daoPromise = null
|
|
708
|
+
for(const message of this.daoGenerationQueue) this.handleAuthorizedMessage(message)
|
|
709
|
+
})
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
|
|
699
713
|
handleMessage(message) {
|
|
700
714
|
if (!this.dao && !this.daoPromise) {
|
|
701
715
|
if (!message) {
|
|
@@ -704,21 +718,10 @@ class ReactiveServerConnection extends EventEmitter {
|
|
|
704
718
|
}
|
|
705
719
|
try {
|
|
706
720
|
this.credentials = message
|
|
707
|
-
this.
|
|
721
|
+
this.handleDaoPromise(this.daoFactory(this.credentials, this.connection, this))
|
|
708
722
|
} catch(error) {
|
|
709
723
|
return this.handleDaoFactoryError(error)
|
|
710
724
|
}
|
|
711
|
-
if(!this.daoPromise.then) {
|
|
712
|
-
this.dao = this.daoPromise
|
|
713
|
-
this.daoPromise = null
|
|
714
|
-
} else {
|
|
715
|
-
this.daoPromise.catch(error => this.handleDaoFactoryError(error)).then(dd => {
|
|
716
|
-
if(!dd) return this.handleDaoFactoryError("dao not defined")
|
|
717
|
-
this.dao = dd
|
|
718
|
-
this.daoPromise = null
|
|
719
|
-
for(const message of this.daoGenerationQueue) this.handleAuthorizedMessage(message)
|
|
720
|
-
})
|
|
721
|
-
}
|
|
722
725
|
} else if(this.daoPromise && !this.dao) {
|
|
723
726
|
this.daoGenerationQueue.push(message)
|
|
724
727
|
} else {
|
package/package.json
CHANGED