@etsoo/appscript 1.2.65 → 1.2.66

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.
@@ -521,6 +521,12 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
521
521
  * @returns Result
522
522
  */
523
523
  protected apiInitCall(data: InitCallDto): Promise<InitCallResult | undefined>;
524
+ /**
525
+ * Check the action result is about device invalid
526
+ * @param result Action result
527
+ * @returns true means device is invalid
528
+ */
529
+ protected checkDeviceResult(result: IActionResult): boolean;
524
530
  /**
525
531
  * Init call
526
532
  * @param callback Callback
@@ -269,6 +269,16 @@ class CoreApp {
269
269
  async apiInitCall(data) {
270
270
  return await this.api.put(this.initCallApi, data);
271
271
  }
272
+ /**
273
+ * Check the action result is about device invalid
274
+ * @param result Action result
275
+ * @returns true means device is invalid
276
+ */
277
+ checkDeviceResult(result) {
278
+ if (result.type == 'NoValidData' && result.field == 'Device')
279
+ return true;
280
+ return false;
281
+ }
272
282
  /**
273
283
  * Init call
274
284
  * @param callback Callback
@@ -278,8 +288,10 @@ class CoreApp {
278
288
  async initCall(callback, resetKeys) {
279
289
  var _a;
280
290
  // Reset keys
281
- if (resetKeys)
291
+ if (resetKeys) {
292
+ this._deviceId = '';
282
293
  this.resetKeys();
294
+ }
283
295
  // Passphrase exists?
284
296
  if (this.passphrase) {
285
297
  if (callback)
@@ -521,6 +521,12 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
521
521
  * @returns Result
522
522
  */
523
523
  protected apiInitCall(data: InitCallDto): Promise<InitCallResult | undefined>;
524
+ /**
525
+ * Check the action result is about device invalid
526
+ * @param result Action result
527
+ * @returns true means device is invalid
528
+ */
529
+ protected checkDeviceResult(result: IActionResult): boolean;
524
530
  /**
525
531
  * Init call
526
532
  * @param callback Callback
@@ -266,6 +266,16 @@ export class CoreApp {
266
266
  async apiInitCall(data) {
267
267
  return await this.api.put(this.initCallApi, data);
268
268
  }
269
+ /**
270
+ * Check the action result is about device invalid
271
+ * @param result Action result
272
+ * @returns true means device is invalid
273
+ */
274
+ checkDeviceResult(result) {
275
+ if (result.type == 'NoValidData' && result.field == 'Device')
276
+ return true;
277
+ return false;
278
+ }
269
279
  /**
270
280
  * Init call
271
281
  * @param callback Callback
@@ -275,8 +285,10 @@ export class CoreApp {
275
285
  async initCall(callback, resetKeys) {
276
286
  var _a;
277
287
  // Reset keys
278
- if (resetKeys)
288
+ if (resetKeys) {
289
+ this._deviceId = '';
279
290
  this.resetKeys();
291
+ }
280
292
  // Passphrase exists?
281
293
  if (this.passphrase) {
282
294
  if (callback)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/appscript",
3
- "version": "1.2.65",
3
+ "version": "1.2.66",
4
4
  "description": "Applications shared TypeScript framework",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -59,15 +59,15 @@
59
59
  "crypto-js": "^4.1.1"
60
60
  },
61
61
  "devDependencies": {
62
- "@babel/cli": "^7.18.9",
63
- "@babel/core": "^7.18.9",
64
- "@babel/plugin-transform-runtime": "^7.18.9",
65
- "@babel/preset-env": "^7.18.9",
62
+ "@babel/cli": "^7.18.10",
63
+ "@babel/core": "^7.18.10",
64
+ "@babel/plugin-transform-runtime": "^7.18.10",
65
+ "@babel/preset-env": "^7.18.10",
66
66
  "@babel/runtime-corejs3": "^7.18.9",
67
67
  "@types/jest": "^28.1.6",
68
- "@typescript-eslint/eslint-plugin": "^5.31.0",
69
- "@typescript-eslint/parser": "^5.31.0",
70
- "eslint": "^8.20.0",
68
+ "@typescript-eslint/eslint-plugin": "^5.32.0",
69
+ "@typescript-eslint/parser": "^5.32.0",
70
+ "eslint": "^8.21.0",
71
71
  "eslint-config-airbnb-base": "^15.0.0",
72
72
  "eslint-plugin-import": "^2.26.0",
73
73
  "jest": "^28.1.3",
@@ -884,6 +884,17 @@ export abstract class CoreApp<
884
884
  return await this.api.put<InitCallResult>(this.initCallApi, data);
885
885
  }
886
886
 
887
+ /**
888
+ * Check the action result is about device invalid
889
+ * @param result Action result
890
+ * @returns true means device is invalid
891
+ */
892
+ protected checkDeviceResult(result: IActionResult): boolean {
893
+ if (result.type == 'NoValidData' && result.field == 'Device')
894
+ return true;
895
+ return false;
896
+ }
897
+
887
898
  /**
888
899
  * Init call
889
900
  * @param callback Callback
@@ -892,7 +903,10 @@ export abstract class CoreApp<
892
903
  */
893
904
  async initCall(callback?: (result: boolean) => void, resetKeys?: boolean) {
894
905
  // Reset keys
895
- if (resetKeys) this.resetKeys();
906
+ if (resetKeys) {
907
+ this._deviceId = '';
908
+ this.resetKeys();
909
+ }
896
910
 
897
911
  // Passphrase exists?
898
912
  if (this.passphrase) {