@etsoo/appscript 1.4.76 → 1.4.77

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.
@@ -116,6 +116,7 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
116
116
  get isReady(): boolean;
117
117
  private set isReady(value);
118
118
  private _isTryingLogin;
119
+ private CJ;
119
120
  /**
120
121
  * Last called with token refresh
121
122
  */
@@ -34,7 +34,6 @@ const EntityStatus_1 = require("../business/EntityStatus");
34
34
  const ActionResultError_1 = require("../result/ActionResultError");
35
35
  const IApp_1 = require("./IApp");
36
36
  const UserRole_1 = require("./UserRole");
37
- let CJ;
38
37
  /**
39
38
  * Core application
40
39
  */
@@ -133,6 +132,7 @@ class CoreApp {
133
132
  this._authorized = false;
134
133
  this._isReady = false;
135
134
  this._isTryingLogin = false;
135
+ this.CJ = null;
136
136
  /**
137
137
  * Last called with token refresh
138
138
  */
@@ -173,7 +173,7 @@ class CoreApp {
173
173
  Promise.resolve().then(() => __importStar(require('crypto-js'))),
174
174
  this.changeCulture(currentCulture)
175
175
  ]).then(([cj, _resources]) => {
176
- (CJ = cj), this.changeRegion(currentRegion);
176
+ (this.CJ = cj), this.changeRegion(currentRegion);
177
177
  this.setup();
178
178
  });
179
179
  }
@@ -673,7 +673,7 @@ class CoreApp {
673
673
  const iterations = parseInt(messageEncrypted.substring(0, 2), 10);
674
674
  if (isNaN(iterations))
675
675
  return undefined;
676
- const { PBKDF2, algo, enc, AES, pad, mode } = CJ;
676
+ const { PBKDF2, algo, enc, AES, pad, mode } = this.CJ;
677
677
  try {
678
678
  const salt = enc.Hex.parse(messageEncrypted.substring(2, 34));
679
679
  const iv = enc.Hex.parse(messageEncrypted.substring(34, 66));
@@ -801,7 +801,7 @@ class CoreApp {
801
801
  encrypt(message, passphrase, iterations) {
802
802
  // Default 1 * 1000
803
803
  iterations !== null && iterations !== void 0 ? iterations : (iterations = 1);
804
- const { lib, PBKDF2, algo, enc, AES, pad, mode } = CJ;
804
+ const { lib, PBKDF2, algo, enc, AES, pad, mode } = this.CJ;
805
805
  const bits = 16; // 128 / 8
806
806
  const salt = lib.WordArray.random(bits);
807
807
  const key = PBKDF2(passphrase !== null && passphrase !== void 0 ? passphrase : this.passphrase, salt, {
@@ -1189,7 +1189,7 @@ class CoreApp {
1189
1189
  * @param passphrase Secret passphrase
1190
1190
  */
1191
1191
  hash(message, passphrase) {
1192
- const { SHA3, enc, HmacSHA512 } = CJ;
1192
+ const { SHA3, enc, HmacSHA512 } = this.CJ;
1193
1193
  if (passphrase == null)
1194
1194
  return SHA3(message, { outputLength: 512 }).toString(enc.Base64);
1195
1195
  else
@@ -1202,7 +1202,7 @@ class CoreApp {
1202
1202
  * @param passphrase Secret passphrase
1203
1203
  */
1204
1204
  hashHex(message, passphrase) {
1205
- const { SHA3, enc, HmacSHA512 } = CJ;
1205
+ const { SHA3, enc, HmacSHA512 } = this.CJ;
1206
1206
  if (passphrase == null)
1207
1207
  return SHA3(message, { outputLength: 512 }).toString(enc.Hex);
1208
1208
  else
@@ -116,6 +116,7 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
116
116
  get isReady(): boolean;
117
117
  private set isReady(value);
118
118
  private _isTryingLogin;
119
+ private CJ;
119
120
  /**
120
121
  * Last called with token refresh
121
122
  */
@@ -8,7 +8,6 @@ import { EntityStatus } from '../business/EntityStatus';
8
8
  import { ActionResultError } from '../result/ActionResultError';
9
9
  import { appFields } from './IApp';
10
10
  import { UserRole } from './UserRole';
11
- let CJ;
12
11
  /**
13
12
  * Core application
14
13
  */
@@ -107,6 +106,7 @@ export class CoreApp {
107
106
  this._authorized = false;
108
107
  this._isReady = false;
109
108
  this._isTryingLogin = false;
109
+ this.CJ = null;
110
110
  /**
111
111
  * Last called with token refresh
112
112
  */
@@ -147,7 +147,7 @@ export class CoreApp {
147
147
  import('crypto-js'),
148
148
  this.changeCulture(currentCulture)
149
149
  ]).then(([cj, _resources]) => {
150
- (CJ = cj), this.changeRegion(currentRegion);
150
+ (this.CJ = cj), this.changeRegion(currentRegion);
151
151
  this.setup();
152
152
  });
153
153
  }
@@ -647,7 +647,7 @@ export class CoreApp {
647
647
  const iterations = parseInt(messageEncrypted.substring(0, 2), 10);
648
648
  if (isNaN(iterations))
649
649
  return undefined;
650
- const { PBKDF2, algo, enc, AES, pad, mode } = CJ;
650
+ const { PBKDF2, algo, enc, AES, pad, mode } = this.CJ;
651
651
  try {
652
652
  const salt = enc.Hex.parse(messageEncrypted.substring(2, 34));
653
653
  const iv = enc.Hex.parse(messageEncrypted.substring(34, 66));
@@ -775,7 +775,7 @@ export class CoreApp {
775
775
  encrypt(message, passphrase, iterations) {
776
776
  // Default 1 * 1000
777
777
  iterations !== null && iterations !== void 0 ? iterations : (iterations = 1);
778
- const { lib, PBKDF2, algo, enc, AES, pad, mode } = CJ;
778
+ const { lib, PBKDF2, algo, enc, AES, pad, mode } = this.CJ;
779
779
  const bits = 16; // 128 / 8
780
780
  const salt = lib.WordArray.random(bits);
781
781
  const key = PBKDF2(passphrase !== null && passphrase !== void 0 ? passphrase : this.passphrase, salt, {
@@ -1163,7 +1163,7 @@ export class CoreApp {
1163
1163
  * @param passphrase Secret passphrase
1164
1164
  */
1165
1165
  hash(message, passphrase) {
1166
- const { SHA3, enc, HmacSHA512 } = CJ;
1166
+ const { SHA3, enc, HmacSHA512 } = this.CJ;
1167
1167
  if (passphrase == null)
1168
1168
  return SHA3(message, { outputLength: 512 }).toString(enc.Base64);
1169
1169
  else
@@ -1176,7 +1176,7 @@ export class CoreApp {
1176
1176
  * @param passphrase Secret passphrase
1177
1177
  */
1178
1178
  hashHex(message, passphrase) {
1179
- const { SHA3, enc, HmacSHA512 } = CJ;
1179
+ const { SHA3, enc, HmacSHA512 } = this.CJ;
1180
1180
  if (passphrase == null)
1181
1181
  return SHA3(message, { outputLength: 512 }).toString(enc.Hex);
1182
1182
  else
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/appscript",
3
- "version": "1.4.76",
3
+ "version": "1.4.77",
4
4
  "description": "Applications shared TypeScript framework",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -43,7 +43,6 @@ import type CryptoJS from 'crypto-js';
43
43
  import { Currency } from '../business/Currency';
44
44
 
45
45
  type CJType = typeof CryptoJS;
46
- let CJ: CJType;
47
46
 
48
47
  /**
49
48
  * Core application interface
@@ -215,6 +214,8 @@ export abstract class CoreApp<
215
214
 
216
215
  private _isTryingLogin = false;
217
216
 
217
+ private CJ: CJType | null = null;
218
+
218
219
  /**
219
220
  * Last called with token refresh
220
221
  */
@@ -298,7 +299,7 @@ export abstract class CoreApp<
298
299
  import('crypto-js'),
299
300
  this.changeCulture(currentCulture)
300
301
  ]).then(([cj, _resources]) => {
301
- (CJ = cj), this.changeRegion(currentRegion);
302
+ (this.CJ = cj), this.changeRegion(currentRegion);
302
303
  this.setup();
303
304
  });
304
305
  }
@@ -918,7 +919,7 @@ export abstract class CoreApp<
918
919
  const iterations = parseInt(messageEncrypted.substring(0, 2), 10);
919
920
  if (isNaN(iterations)) return undefined;
920
921
 
921
- const { PBKDF2, algo, enc, AES, pad, mode } = CJ;
922
+ const { PBKDF2, algo, enc, AES, pad, mode } = this.CJ!;
922
923
 
923
924
  try {
924
925
  const salt = enc.Hex.parse(messageEncrypted.substring(2, 34));
@@ -1086,7 +1087,7 @@ export abstract class CoreApp<
1086
1087
  // Default 1 * 1000
1087
1088
  iterations ??= 1;
1088
1089
 
1089
- const { lib, PBKDF2, algo, enc, AES, pad, mode } = CJ;
1090
+ const { lib, PBKDF2, algo, enc, AES, pad, mode } = this.CJ!;
1090
1091
 
1091
1092
  const bits = 16; // 128 / 8
1092
1093
  const salt = lib.WordArray.random(bits);
@@ -1552,7 +1553,7 @@ export abstract class CoreApp<
1552
1553
  * @param passphrase Secret passphrase
1553
1554
  */
1554
1555
  hash(message: string, passphrase?: string) {
1555
- const { SHA3, enc, HmacSHA512 } = CJ;
1556
+ const { SHA3, enc, HmacSHA512 } = this.CJ!;
1556
1557
  if (passphrase == null)
1557
1558
  return SHA3(message, { outputLength: 512 }).toString(enc.Base64);
1558
1559
  else return HmacSHA512(message, passphrase).toString(enc.Base64);
@@ -1565,7 +1566,7 @@ export abstract class CoreApp<
1565
1566
  * @param passphrase Secret passphrase
1566
1567
  */
1567
1568
  hashHex(message: string, passphrase?: string) {
1568
- const { SHA3, enc, HmacSHA512 } = CJ;
1569
+ const { SHA3, enc, HmacSHA512 } = this.CJ!;
1569
1570
  if (passphrase == null)
1570
1571
  return SHA3(message, { outputLength: 512 }).toString(enc.Hex);
1571
1572
  else return HmacSHA512(message, passphrase).toString(enc.Hex);