react-native-mosquito-transport 0.0.40 → 0.0.42
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/TODO +1 -0
- package/package.json +1 -1
- package/src/index.d.ts +2 -2
- package/src/products/auth/index.js +8 -7
- package/src/products/http_callable/index.js +3 -2
package/TODO
CHANGED
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -450,13 +450,13 @@ interface RNMTAuth {
|
|
|
450
450
|
emulate: (projectUrl?: string) => Promise<void>;
|
|
451
451
|
}
|
|
452
452
|
|
|
453
|
-
interface SigninResult {
|
|
453
|
+
export interface SigninResult {
|
|
454
454
|
user: AuthData;
|
|
455
455
|
token: string;
|
|
456
456
|
refreshToken: string;
|
|
457
457
|
}
|
|
458
458
|
|
|
459
|
-
interface SignupResult extends SigninResult {
|
|
459
|
+
export interface SignupResult extends SigninResult {
|
|
460
460
|
isNewUser: boolean;
|
|
461
461
|
}
|
|
462
462
|
|
|
@@ -122,19 +122,17 @@ export default class MTAuth {
|
|
|
122
122
|
}, this.builder.projectUrl);
|
|
123
123
|
});
|
|
124
124
|
|
|
125
|
-
/**
|
|
126
|
-
* @type {import('../../index').RNMTAuth['listenAuth']}
|
|
127
|
-
*/
|
|
128
125
|
listenAuth = (callback) => {
|
|
129
|
-
let
|
|
126
|
+
let hasTrig;
|
|
127
|
+
const forceChangedNode = [['entityOf'], ['passwordVerified'], ['disabled'], ['authVerified'], ['sub'], ['email']];
|
|
130
128
|
|
|
131
129
|
return listenToken((t, initToken) => {
|
|
132
130
|
const { refreshToken } = CacheStore.AuthStore[this.builder.projectUrl] || {};
|
|
133
131
|
const parseData = t && parseToken(t);
|
|
134
|
-
const tokenEntity = parseData?.entityOf || null;
|
|
135
132
|
|
|
136
133
|
if (
|
|
137
|
-
|
|
134
|
+
!hasTrig ||
|
|
135
|
+
forceChangedNode.some(([k, v]) => parseData?.[k] !== v) ||
|
|
138
136
|
initToken
|
|
139
137
|
) {
|
|
140
138
|
callback(t ? {
|
|
@@ -146,7 +144,10 @@ export default class MTAuth {
|
|
|
146
144
|
} : null);
|
|
147
145
|
}
|
|
148
146
|
|
|
149
|
-
|
|
147
|
+
forceChangedNode.forEach(v => {
|
|
148
|
+
v[1] = parseData?.[v[0]];
|
|
149
|
+
});
|
|
150
|
+
hasTrig = true;
|
|
150
151
|
}, this.builder.projectUrl);
|
|
151
152
|
}
|
|
152
153
|
|
|
@@ -70,13 +70,15 @@ export const mfetch = async (input = '', init, config) => {
|
|
|
70
70
|
!Validator.JSON(body)
|
|
71
71
|
) throw `"body" must be any of string, buffer, object`;
|
|
72
72
|
}
|
|
73
|
+
await awaitStore();
|
|
73
74
|
|
|
74
75
|
const reqId = await niceHash(
|
|
75
76
|
serialize([
|
|
76
77
|
rawHeader,
|
|
77
78
|
body,
|
|
78
79
|
!!disableAuth,
|
|
79
|
-
input
|
|
80
|
+
input,
|
|
81
|
+
disableAuth ? '' : (Scoped.AuthJWTToken[projectUrl] || '')
|
|
80
82
|
]).toString('base64')
|
|
81
83
|
);
|
|
82
84
|
const processReqId = `${reqId}_${disableCache}_${retrieval}`;
|
|
@@ -104,7 +106,6 @@ export const mfetch = async (input = '', init, config) => {
|
|
|
104
106
|
}
|
|
105
107
|
};
|
|
106
108
|
|
|
107
|
-
await awaitStore();
|
|
108
109
|
const resolveCache = (reqData) => {
|
|
109
110
|
finalize(reqData, undefined, { fromCache: true });
|
|
110
111
|
};
|