@etsoo/appscript 1.2.46 → 1.2.47
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/cjs/app/CoreApp.js +9 -9
- package/lib/mjs/app/CoreApp.js +9 -9
- package/package.json +1 -1
- package/src/app/CoreApp.ts +24 -9
package/lib/cjs/app/CoreApp.js
CHANGED
|
@@ -46,7 +46,7 @@ class CoreApp {
|
|
|
46
46
|
this.storage = storage;
|
|
47
47
|
this.name = name;
|
|
48
48
|
// Device id
|
|
49
|
-
this._deviceId = storage.getData(CoreApp.deviceIdField, '');
|
|
49
|
+
this._deviceId = storage.getData(this.addIdentifier(CoreApp.deviceIdField), '');
|
|
50
50
|
// Restore
|
|
51
51
|
this.restore();
|
|
52
52
|
this.setApi(api);
|
|
@@ -118,9 +118,9 @@ class CoreApp {
|
|
|
118
118
|
*/
|
|
119
119
|
get persistedFields() {
|
|
120
120
|
return [
|
|
121
|
-
CoreApp.deviceIdField,
|
|
121
|
+
this.addIdentifier(CoreApp.deviceIdField),
|
|
122
122
|
this.addIdentifier(CoreApp.devicePassphraseField),
|
|
123
|
-
CoreApp.serversideDeviceIdField,
|
|
123
|
+
this.addIdentifier(CoreApp.serversideDeviceIdField),
|
|
124
124
|
this.addIdentifier(CoreApp.headerTokenField)
|
|
125
125
|
];
|
|
126
126
|
}
|
|
@@ -131,7 +131,7 @@ class CoreApp {
|
|
|
131
131
|
this.storage.clear([
|
|
132
132
|
this.addIdentifier(CoreApp.devicePassphraseField),
|
|
133
133
|
this.addIdentifier(CoreApp.headerTokenField),
|
|
134
|
-
CoreApp.serversideDeviceIdField
|
|
134
|
+
this.addIdentifier(CoreApp.serversideDeviceIdField)
|
|
135
135
|
], false);
|
|
136
136
|
this.passphrase = '';
|
|
137
137
|
}
|
|
@@ -145,7 +145,7 @@ class CoreApp {
|
|
|
145
145
|
// First vist, restore and keep the source
|
|
146
146
|
this.storage.copyFrom(this.persistedFields, false);
|
|
147
147
|
// Reset device id
|
|
148
|
-
this._deviceId = this.storage.getData(CoreApp.deviceIdField, '');
|
|
148
|
+
this._deviceId = this.storage.getData(this.addIdentifier(CoreApp.deviceIdField), '');
|
|
149
149
|
// Totally new, no data restored
|
|
150
150
|
if (this._deviceId === '')
|
|
151
151
|
return false;
|
|
@@ -256,7 +256,7 @@ class CoreApp {
|
|
|
256
256
|
return;
|
|
257
257
|
}
|
|
258
258
|
// Serverside encrypted device id
|
|
259
|
-
const identifier = this.storage.getData(CoreApp.serversideDeviceIdField);
|
|
259
|
+
const identifier = this.storage.getData(this.addIdentifier(CoreApp.serversideDeviceIdField));
|
|
260
260
|
// Timestamp
|
|
261
261
|
const timestamp = new Date().getTime();
|
|
262
262
|
// Request data
|
|
@@ -292,7 +292,7 @@ class CoreApp {
|
|
|
292
292
|
if (callback)
|
|
293
293
|
callback(false);
|
|
294
294
|
// Clear device id
|
|
295
|
-
this.storage.setData(CoreApp.deviceIdField, undefined);
|
|
295
|
+
this.storage.setData(this.addIdentifier(CoreApp.deviceIdField), undefined);
|
|
296
296
|
return;
|
|
297
297
|
}
|
|
298
298
|
this.initCallUpdate(result.data, data.timestamp);
|
|
@@ -315,7 +315,7 @@ class CoreApp {
|
|
|
315
315
|
return;
|
|
316
316
|
// Update device id and cache it
|
|
317
317
|
this._deviceId = data.deviceId;
|
|
318
|
-
this.storage.setData(CoreApp.deviceIdField, this._deviceId);
|
|
318
|
+
this.storage.setData(this.addIdentifier(CoreApp.deviceIdField), this._deviceId);
|
|
319
319
|
// Devices
|
|
320
320
|
const devices = this.storage.getPersistedData(CoreApp.devicesField, []);
|
|
321
321
|
devices.push(this.getDeviceId());
|
|
@@ -960,7 +960,7 @@ class CoreApp {
|
|
|
960
960
|
userLogin(user, refreshToken, keep) {
|
|
961
961
|
this.userData = user;
|
|
962
962
|
// Cache the encrypted serverside device id
|
|
963
|
-
this.storage.setData(CoreApp.serversideDeviceIdField, user.deviceId);
|
|
963
|
+
this.storage.setData(this.addIdentifier(CoreApp.serversideDeviceIdField), user.deviceId);
|
|
964
964
|
if (keep) {
|
|
965
965
|
this.authorize(user.token, refreshToken);
|
|
966
966
|
}
|
package/lib/mjs/app/CoreApp.js
CHANGED
|
@@ -43,7 +43,7 @@ export class CoreApp {
|
|
|
43
43
|
this.storage = storage;
|
|
44
44
|
this.name = name;
|
|
45
45
|
// Device id
|
|
46
|
-
this._deviceId = storage.getData(CoreApp.deviceIdField, '');
|
|
46
|
+
this._deviceId = storage.getData(this.addIdentifier(CoreApp.deviceIdField), '');
|
|
47
47
|
// Restore
|
|
48
48
|
this.restore();
|
|
49
49
|
this.setApi(api);
|
|
@@ -115,9 +115,9 @@ export class CoreApp {
|
|
|
115
115
|
*/
|
|
116
116
|
get persistedFields() {
|
|
117
117
|
return [
|
|
118
|
-
CoreApp.deviceIdField,
|
|
118
|
+
this.addIdentifier(CoreApp.deviceIdField),
|
|
119
119
|
this.addIdentifier(CoreApp.devicePassphraseField),
|
|
120
|
-
CoreApp.serversideDeviceIdField,
|
|
120
|
+
this.addIdentifier(CoreApp.serversideDeviceIdField),
|
|
121
121
|
this.addIdentifier(CoreApp.headerTokenField)
|
|
122
122
|
];
|
|
123
123
|
}
|
|
@@ -128,7 +128,7 @@ export class CoreApp {
|
|
|
128
128
|
this.storage.clear([
|
|
129
129
|
this.addIdentifier(CoreApp.devicePassphraseField),
|
|
130
130
|
this.addIdentifier(CoreApp.headerTokenField),
|
|
131
|
-
CoreApp.serversideDeviceIdField
|
|
131
|
+
this.addIdentifier(CoreApp.serversideDeviceIdField)
|
|
132
132
|
], false);
|
|
133
133
|
this.passphrase = '';
|
|
134
134
|
}
|
|
@@ -142,7 +142,7 @@ export class CoreApp {
|
|
|
142
142
|
// First vist, restore and keep the source
|
|
143
143
|
this.storage.copyFrom(this.persistedFields, false);
|
|
144
144
|
// Reset device id
|
|
145
|
-
this._deviceId = this.storage.getData(CoreApp.deviceIdField, '');
|
|
145
|
+
this._deviceId = this.storage.getData(this.addIdentifier(CoreApp.deviceIdField), '');
|
|
146
146
|
// Totally new, no data restored
|
|
147
147
|
if (this._deviceId === '')
|
|
148
148
|
return false;
|
|
@@ -253,7 +253,7 @@ export class CoreApp {
|
|
|
253
253
|
return;
|
|
254
254
|
}
|
|
255
255
|
// Serverside encrypted device id
|
|
256
|
-
const identifier = this.storage.getData(CoreApp.serversideDeviceIdField);
|
|
256
|
+
const identifier = this.storage.getData(this.addIdentifier(CoreApp.serversideDeviceIdField));
|
|
257
257
|
// Timestamp
|
|
258
258
|
const timestamp = new Date().getTime();
|
|
259
259
|
// Request data
|
|
@@ -289,7 +289,7 @@ export class CoreApp {
|
|
|
289
289
|
if (callback)
|
|
290
290
|
callback(false);
|
|
291
291
|
// Clear device id
|
|
292
|
-
this.storage.setData(CoreApp.deviceIdField, undefined);
|
|
292
|
+
this.storage.setData(this.addIdentifier(CoreApp.deviceIdField), undefined);
|
|
293
293
|
return;
|
|
294
294
|
}
|
|
295
295
|
this.initCallUpdate(result.data, data.timestamp);
|
|
@@ -312,7 +312,7 @@ export class CoreApp {
|
|
|
312
312
|
return;
|
|
313
313
|
// Update device id and cache it
|
|
314
314
|
this._deviceId = data.deviceId;
|
|
315
|
-
this.storage.setData(CoreApp.deviceIdField, this._deviceId);
|
|
315
|
+
this.storage.setData(this.addIdentifier(CoreApp.deviceIdField), this._deviceId);
|
|
316
316
|
// Devices
|
|
317
317
|
const devices = this.storage.getPersistedData(CoreApp.devicesField, []);
|
|
318
318
|
devices.push(this.getDeviceId());
|
|
@@ -957,7 +957,7 @@ export class CoreApp {
|
|
|
957
957
|
userLogin(user, refreshToken, keep) {
|
|
958
958
|
this.userData = user;
|
|
959
959
|
// Cache the encrypted serverside device id
|
|
960
|
-
this.storage.setData(CoreApp.serversideDeviceIdField, user.deviceId);
|
|
960
|
+
this.storage.setData(this.addIdentifier(CoreApp.serversideDeviceIdField), user.deviceId);
|
|
961
961
|
if (keep) {
|
|
962
962
|
this.authorize(user.token, refreshToken);
|
|
963
963
|
}
|
package/package.json
CHANGED
package/src/app/CoreApp.ts
CHANGED
|
@@ -632,9 +632,9 @@ export abstract class CoreApp<
|
|
|
632
632
|
*/
|
|
633
633
|
protected get persistedFields() {
|
|
634
634
|
return [
|
|
635
|
-
CoreApp.deviceIdField,
|
|
635
|
+
this.addIdentifier(CoreApp.deviceIdField),
|
|
636
636
|
this.addIdentifier(CoreApp.devicePassphraseField),
|
|
637
|
-
CoreApp.serversideDeviceIdField,
|
|
637
|
+
this.addIdentifier(CoreApp.serversideDeviceIdField),
|
|
638
638
|
this.addIdentifier(CoreApp.headerTokenField)
|
|
639
639
|
];
|
|
640
640
|
}
|
|
@@ -661,7 +661,10 @@ export abstract class CoreApp<
|
|
|
661
661
|
this.name = name;
|
|
662
662
|
|
|
663
663
|
// Device id
|
|
664
|
-
this._deviceId = storage.getData(
|
|
664
|
+
this._deviceId = storage.getData(
|
|
665
|
+
this.addIdentifier(CoreApp.deviceIdField),
|
|
666
|
+
''
|
|
667
|
+
);
|
|
665
668
|
|
|
666
669
|
// Restore
|
|
667
670
|
this.restore();
|
|
@@ -686,7 +689,7 @@ export abstract class CoreApp<
|
|
|
686
689
|
[
|
|
687
690
|
this.addIdentifier(CoreApp.devicePassphraseField),
|
|
688
691
|
this.addIdentifier(CoreApp.headerTokenField),
|
|
689
|
-
CoreApp.serversideDeviceIdField
|
|
692
|
+
this.addIdentifier(CoreApp.serversideDeviceIdField)
|
|
690
693
|
],
|
|
691
694
|
false
|
|
692
695
|
);
|
|
@@ -708,7 +711,10 @@ export abstract class CoreApp<
|
|
|
708
711
|
this.storage.copyFrom(this.persistedFields, false);
|
|
709
712
|
|
|
710
713
|
// Reset device id
|
|
711
|
-
this._deviceId = this.storage.getData(
|
|
714
|
+
this._deviceId = this.storage.getData(
|
|
715
|
+
this.addIdentifier(CoreApp.deviceIdField),
|
|
716
|
+
''
|
|
717
|
+
);
|
|
712
718
|
|
|
713
719
|
// Totally new, no data restored
|
|
714
720
|
if (this._deviceId === '') return false;
|
|
@@ -839,7 +845,7 @@ export abstract class CoreApp<
|
|
|
839
845
|
|
|
840
846
|
// Serverside encrypted device id
|
|
841
847
|
const identifier = this.storage.getData<string>(
|
|
842
|
-
CoreApp.serversideDeviceIdField
|
|
848
|
+
this.addIdentifier(CoreApp.serversideDeviceIdField)
|
|
843
849
|
);
|
|
844
850
|
|
|
845
851
|
// Timestamp
|
|
@@ -884,7 +890,10 @@ export abstract class CoreApp<
|
|
|
884
890
|
if (callback) callback(false);
|
|
885
891
|
|
|
886
892
|
// Clear device id
|
|
887
|
-
this.storage.setData(
|
|
893
|
+
this.storage.setData(
|
|
894
|
+
this.addIdentifier(CoreApp.deviceIdField),
|
|
895
|
+
undefined
|
|
896
|
+
);
|
|
888
897
|
|
|
889
898
|
return;
|
|
890
899
|
}
|
|
@@ -910,7 +919,10 @@ export abstract class CoreApp<
|
|
|
910
919
|
|
|
911
920
|
// Update device id and cache it
|
|
912
921
|
this._deviceId = data.deviceId;
|
|
913
|
-
this.storage.setData(
|
|
922
|
+
this.storage.setData(
|
|
923
|
+
this.addIdentifier(CoreApp.deviceIdField),
|
|
924
|
+
this._deviceId
|
|
925
|
+
);
|
|
914
926
|
|
|
915
927
|
// Devices
|
|
916
928
|
const devices = this.storage.getPersistedData<string[]>(
|
|
@@ -1702,7 +1714,10 @@ export abstract class CoreApp<
|
|
|
1702
1714
|
this.userData = user;
|
|
1703
1715
|
|
|
1704
1716
|
// Cache the encrypted serverside device id
|
|
1705
|
-
this.storage.setData(
|
|
1717
|
+
this.storage.setData(
|
|
1718
|
+
this.addIdentifier(CoreApp.serversideDeviceIdField),
|
|
1719
|
+
user.deviceId
|
|
1720
|
+
);
|
|
1706
1721
|
|
|
1707
1722
|
if (keep) {
|
|
1708
1723
|
this.authorize(user.token, refreshToken);
|