dexie-cloud-addon 4.0.1-beta.55 → 4.0.1-beta.56
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/dist/modern/DexieCloudAPI.d.ts +8 -5
- package/dist/modern/authentication/authenticate.d.ts +3 -10
- package/dist/modern/authentication/login.d.ts +2 -5
- package/dist/modern/dexie-cloud-addon.js +21 -10
- package/dist/modern/dexie-cloud-addon.js.map +1 -1
- package/dist/modern/dexie-cloud-addon.min.js +1 -1
- package/dist/modern/dexie-cloud-addon.min.js.map +1 -1
- package/dist/modern/service-worker.js +21 -10
- package/dist/modern/service-worker.js.map +1 -1
- package/dist/modern/service-worker.min.js +1 -1
- package/dist/modern/service-worker.min.js.map +1 -1
- package/dist/umd/DexieCloudAPI.d.ts +8 -5
- package/dist/umd/authentication/authenticate.d.ts +3 -10
- package/dist/umd/authentication/login.d.ts +2 -5
- package/dist/umd/dexie-cloud-addon.js +21 -10
- package/dist/umd/dexie-cloud-addon.js.map +1 -1
- package/dist/umd/dexie-cloud-addon.min.js +1 -1
- package/dist/umd/dexie-cloud-addon.min.js.map +1 -1
- package/dist/umd/service-worker.js +21 -10
- package/dist/umd/service-worker.js.map +1 -1
- package/dist/umd/service-worker.min.js +1 -1
- package/dist/umd/service-worker.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* ==========================================================================
|
|
10
10
|
*
|
|
11
|
-
* Version 4.0.1-beta.
|
|
11
|
+
* Version 4.0.1-beta.56, Wed Jan 31 2024
|
|
12
12
|
*
|
|
13
13
|
* https://dexie.org
|
|
14
14
|
*
|
|
@@ -4241,6 +4241,19 @@
|
|
|
4241
4241
|
demo_user,
|
|
4242
4242
|
grant_type: 'demo',
|
|
4243
4243
|
scopes: ['ACCESS_DB'],
|
|
4244
|
+
public_key
|
|
4245
|
+
};
|
|
4246
|
+
}
|
|
4247
|
+
else if ((hints === null || hints === void 0 ? void 0 : hints.otpId) && hints.otp) {
|
|
4248
|
+
// User provided OTP ID and OTP code. This means that the OTP email
|
|
4249
|
+
// has already gone out and the user may have clicked a magic link
|
|
4250
|
+
// in the email with otp and otpId in query and the app has picked
|
|
4251
|
+
// up those values and passed them to db.cloud.login().
|
|
4252
|
+
tokenRequest = {
|
|
4253
|
+
grant_type: 'otp',
|
|
4254
|
+
otp_id: hints.otpId,
|
|
4255
|
+
otp: hints.otp,
|
|
4256
|
+
scopes: ['ACCESS_DB'],
|
|
4244
4257
|
public_key,
|
|
4245
4258
|
};
|
|
4246
4259
|
}
|
|
@@ -4250,7 +4263,6 @@
|
|
|
4250
4263
|
email,
|
|
4251
4264
|
grant_type: 'otp',
|
|
4252
4265
|
scopes: ['ACCESS_DB'],
|
|
4253
|
-
public_key,
|
|
4254
4266
|
};
|
|
4255
4267
|
}
|
|
4256
4268
|
const res1 = yield fetch(`${url}/token`, {
|
|
@@ -4274,28 +4286,27 @@
|
|
|
4274
4286
|
// Error can also be returned right away.
|
|
4275
4287
|
return response;
|
|
4276
4288
|
}
|
|
4277
|
-
else if (tokenRequest.grant_type === 'otp') {
|
|
4289
|
+
else if (tokenRequest.grant_type === 'otp' && 'email' in tokenRequest) {
|
|
4278
4290
|
if (response.type !== 'otp-sent')
|
|
4279
4291
|
throw new Error(`Unexpected response from ${url}/token`);
|
|
4280
4292
|
const otp = yield promptForOTP(userInteraction, tokenRequest.email);
|
|
4281
|
-
|
|
4282
|
-
tokenRequest.otp_id = response.otp_id;
|
|
4293
|
+
const tokenRequest2 = Object.assign(Object.assign({}, tokenRequest), { otp: otp || '', otp_id: response.otp_id });
|
|
4283
4294
|
let res2 = yield fetch(`${url}/token`, {
|
|
4284
|
-
body: JSON.stringify(
|
|
4295
|
+
body: JSON.stringify(tokenRequest2),
|
|
4285
4296
|
method: 'post',
|
|
4286
4297
|
headers: { 'Content-Type': 'application/json' },
|
|
4287
4298
|
mode: 'cors',
|
|
4288
4299
|
});
|
|
4289
4300
|
while (res2.status === 401) {
|
|
4290
4301
|
const errorText = yield res2.text();
|
|
4291
|
-
|
|
4302
|
+
tokenRequest2.otp = yield promptForOTP(userInteraction, tokenRequest.email, {
|
|
4292
4303
|
type: 'error',
|
|
4293
4304
|
messageCode: 'INVALID_OTP',
|
|
4294
4305
|
message: errorText,
|
|
4295
4306
|
messageParams: {}
|
|
4296
4307
|
});
|
|
4297
4308
|
res2 = yield fetch(`${url}/token`, {
|
|
4298
|
-
body: JSON.stringify(
|
|
4309
|
+
body: JSON.stringify(tokenRequest2),
|
|
4299
4310
|
method: 'post',
|
|
4300
4311
|
headers: { 'Content-Type': 'application/json' },
|
|
4301
4312
|
mode: 'cors',
|
|
@@ -6249,7 +6260,7 @@
|
|
|
6249
6260
|
const syncComplete = new rxjs.Subject();
|
|
6250
6261
|
dexie.cloud = {
|
|
6251
6262
|
// @ts-ignore
|
|
6252
|
-
version: "4.0.1-beta.
|
|
6263
|
+
version: "4.0.1-beta.56",
|
|
6253
6264
|
options: Object.assign({}, DEFAULT_OPTIONS),
|
|
6254
6265
|
schema: null,
|
|
6255
6266
|
get currentUserId() {
|
|
@@ -6526,7 +6537,7 @@
|
|
|
6526
6537
|
}
|
|
6527
6538
|
}
|
|
6528
6539
|
// @ts-ignore
|
|
6529
|
-
dexieCloud.version = "4.0.1-beta.
|
|
6540
|
+
dexieCloud.version = "4.0.1-beta.56";
|
|
6530
6541
|
Dexie.Cloud = dexieCloud;
|
|
6531
6542
|
|
|
6532
6543
|
// In case the SW lives for a while, let it reuse already opened connections:
|