@etsoo/appscript 1.2.38 → 1.2.39

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.
@@ -0,0 +1,15 @@
1
+ import { IBridgeHost } from './IBridgeHost';
2
+ /**
3
+ * Bridge utils
4
+ */
5
+ export declare namespace BridgeUtils {
6
+ /**
7
+ * Is electron client
8
+ * @returns Result
9
+ */
10
+ function isElectronClient(): boolean;
11
+ /**
12
+ * Bridge host
13
+ */
14
+ const host: IBridgeHost | undefined;
15
+ }
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BridgeUtils = void 0;
4
+ /**
5
+ * Bridge utils
6
+ */
7
+ var BridgeUtils;
8
+ (function (BridgeUtils) {
9
+ /**
10
+ * Is electron client
11
+ * @returns Result
12
+ */
13
+ function isElectronClient() {
14
+ // Renderer process
15
+ if (typeof window !== 'undefined' &&
16
+ typeof window.process === 'object' &&
17
+ window.process.type === 'renderer') {
18
+ return true;
19
+ }
20
+ // Main process
21
+ if (typeof process !== 'undefined' &&
22
+ typeof process.versions === 'object' &&
23
+ !!process.versions.electron) {
24
+ return true;
25
+ }
26
+ // Detect the user agent when the `nodeIntegration` option is set to true
27
+ if (typeof navigator === 'object' &&
28
+ typeof navigator.userAgent === 'string' &&
29
+ navigator.userAgent.indexOf('Electron') >= 0) {
30
+ return true;
31
+ }
32
+ return false;
33
+ }
34
+ BridgeUtils.isElectronClient = isElectronClient;
35
+ /**
36
+ * Bridge host
37
+ */
38
+ BridgeUtils.host = isElectronClient()
39
+ ? globalThis.electron
40
+ : undefined;
41
+ })(BridgeUtils = exports.BridgeUtils || (exports.BridgeUtils = {}));
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Bridge host
3
+ */
4
+ export interface IBridgeHost {
5
+ /**
6
+ * Change culture
7
+ * @param locale Locale
8
+ */
9
+ changeCulture(locale: string): void;
10
+ /**
11
+ * Exit the application
12
+ */
13
+ exit(): void;
14
+ /**
15
+ * Load application
16
+ * @param name App name
17
+ */
18
+ loadApp(name: string): void;
19
+ }
File without changes
@@ -5,9 +5,8 @@ export * from './app/AppSettings';
5
5
  export * from './app/CoreApp';
6
6
  export * from './app/ExternalSettings';
7
7
  export * from './app/UserRole';
8
- export * from './bridges/ElectronBridge';
9
- export * from './bridges/IAppData';
10
- export * from './bridges/IBridge';
8
+ export * from './bridges/BridgeUtils';
9
+ export * from './bridges/IBridgeHost';
11
10
  export * from './business/BusinessTax';
12
11
  export * from './business/BusinessUtils';
13
12
  export * from './business/EntityStatus';
package/lib/cjs/index.js CHANGED
@@ -21,9 +21,8 @@ __exportStar(require("./app/CoreApp"), exports);
21
21
  __exportStar(require("./app/ExternalSettings"), exports);
22
22
  __exportStar(require("./app/UserRole"), exports);
23
23
  // bridges
24
- __exportStar(require("./bridges/ElectronBridge"), exports);
25
- __exportStar(require("./bridges/IAppData"), exports);
26
- __exportStar(require("./bridges/IBridge"), exports);
24
+ __exportStar(require("./bridges/BridgeUtils"), exports);
25
+ __exportStar(require("./bridges/IBridgeHost"), exports);
27
26
  // business
28
27
  __exportStar(require("./business/BusinessTax"), exports);
29
28
  __exportStar(require("./business/BusinessUtils"), exports);
@@ -0,0 +1,15 @@
1
+ import { IBridgeHost } from './IBridgeHost';
2
+ /**
3
+ * Bridge utils
4
+ */
5
+ export declare namespace BridgeUtils {
6
+ /**
7
+ * Is electron client
8
+ * @returns Result
9
+ */
10
+ function isElectronClient(): boolean;
11
+ /**
12
+ * Bridge host
13
+ */
14
+ const host: IBridgeHost | undefined;
15
+ }
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Bridge utils
3
+ */
4
+ export var BridgeUtils;
5
+ (function (BridgeUtils) {
6
+ /**
7
+ * Is electron client
8
+ * @returns Result
9
+ */
10
+ function isElectronClient() {
11
+ // Renderer process
12
+ if (typeof window !== 'undefined' &&
13
+ typeof window.process === 'object' &&
14
+ window.process.type === 'renderer') {
15
+ return true;
16
+ }
17
+ // Main process
18
+ if (typeof process !== 'undefined' &&
19
+ typeof process.versions === 'object' &&
20
+ !!process.versions.electron) {
21
+ return true;
22
+ }
23
+ // Detect the user agent when the `nodeIntegration` option is set to true
24
+ if (typeof navigator === 'object' &&
25
+ typeof navigator.userAgent === 'string' &&
26
+ navigator.userAgent.indexOf('Electron') >= 0) {
27
+ return true;
28
+ }
29
+ return false;
30
+ }
31
+ BridgeUtils.isElectronClient = isElectronClient;
32
+ /**
33
+ * Bridge host
34
+ */
35
+ BridgeUtils.host = isElectronClient()
36
+ ? globalThis.electron
37
+ : undefined;
38
+ })(BridgeUtils || (BridgeUtils = {}));
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Bridge host
3
+ */
4
+ export interface IBridgeHost {
5
+ /**
6
+ * Change culture
7
+ * @param locale Locale
8
+ */
9
+ changeCulture(locale: string): void;
10
+ /**
11
+ * Exit the application
12
+ */
13
+ exit(): void;
14
+ /**
15
+ * Load application
16
+ * @param name App name
17
+ */
18
+ loadApp(name: string): void;
19
+ }
File without changes
@@ -5,9 +5,8 @@ export * from './app/AppSettings';
5
5
  export * from './app/CoreApp';
6
6
  export * from './app/ExternalSettings';
7
7
  export * from './app/UserRole';
8
- export * from './bridges/ElectronBridge';
9
- export * from './bridges/IAppData';
10
- export * from './bridges/IBridge';
8
+ export * from './bridges/BridgeUtils';
9
+ export * from './bridges/IBridgeHost';
11
10
  export * from './business/BusinessTax';
12
11
  export * from './business/BusinessUtils';
13
12
  export * from './business/EntityStatus';
package/lib/mjs/index.js CHANGED
@@ -8,9 +8,8 @@ export * from './app/CoreApp';
8
8
  export * from './app/ExternalSettings';
9
9
  export * from './app/UserRole';
10
10
  // bridges
11
- export * from './bridges/ElectronBridge';
12
- export * from './bridges/IAppData';
13
- export * from './bridges/IBridge';
11
+ export * from './bridges/BridgeUtils';
12
+ export * from './bridges/IBridgeHost';
14
13
  // business
15
14
  export * from './business/BusinessTax';
16
15
  export * from './business/BusinessUtils';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/appscript",
3
- "version": "1.2.38",
3
+ "version": "1.2.39",
4
4
  "description": "Applications shared TypeScript framework",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -54,23 +54,23 @@
54
54
  "dependencies": {
55
55
  "@etsoo/notificationbase": "^1.1.1",
56
56
  "@etsoo/restclient": "^1.0.64",
57
- "@etsoo/shared": "^1.1.10",
57
+ "@etsoo/shared": "^1.1.11",
58
58
  "@types/crypto-js": "^4.1.0",
59
59
  "crypto-js": "^4.1.1"
60
60
  },
61
61
  "devDependencies": {
62
62
  "@babel/cli": "^7.17.0",
63
- "@babel/core": "^7.17.0",
63
+ "@babel/core": "^7.17.2",
64
64
  "@babel/plugin-transform-runtime": "^7.17.0",
65
65
  "@babel/preset-env": "^7.16.11",
66
- "@babel/runtime-corejs3": "^7.17.0",
66
+ "@babel/runtime-corejs3": "^7.17.2",
67
67
  "@types/jest": "^27.4.0",
68
68
  "@typescript-eslint/eslint-plugin": "^5.11.0",
69
69
  "@typescript-eslint/parser": "^5.11.0",
70
70
  "eslint": "^8.8.0",
71
71
  "eslint-config-airbnb-base": "^15.0.0",
72
72
  "eslint-plugin-import": "^2.25.4",
73
- "jest": "^27.5.0",
73
+ "jest": "^27.5.1",
74
74
  "ts-jest": "^27.1.3",
75
75
  "typescript": "^4.5.5"
76
76
  }
@@ -0,0 +1,48 @@
1
+ import { IBridgeHost } from './IBridgeHost';
2
+
3
+ /**
4
+ * Bridge utils
5
+ */
6
+ export namespace BridgeUtils {
7
+ /**
8
+ * Is electron client
9
+ * @returns Result
10
+ */
11
+ export function isElectronClient() {
12
+ // Renderer process
13
+ if (
14
+ typeof window !== 'undefined' &&
15
+ typeof window.process === 'object' &&
16
+ (window.process as any).type === 'renderer'
17
+ ) {
18
+ return true;
19
+ }
20
+
21
+ // Main process
22
+ if (
23
+ typeof process !== 'undefined' &&
24
+ typeof process.versions === 'object' &&
25
+ !!process.versions.electron
26
+ ) {
27
+ return true;
28
+ }
29
+
30
+ // Detect the user agent when the `nodeIntegration` option is set to true
31
+ if (
32
+ typeof navigator === 'object' &&
33
+ typeof navigator.userAgent === 'string' &&
34
+ navigator.userAgent.indexOf('Electron') >= 0
35
+ ) {
36
+ return true;
37
+ }
38
+
39
+ return false;
40
+ }
41
+
42
+ /**
43
+ * Bridge host
44
+ */
45
+ export const host = isElectronClient()
46
+ ? ((globalThis as any).electron as IBridgeHost)
47
+ : undefined;
48
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Bridge host
3
+ */
4
+ export interface IBridgeHost {
5
+ /**
6
+ * Change culture
7
+ * @param locale Locale
8
+ */
9
+ changeCulture(locale: string): void;
10
+
11
+ /**
12
+ * Exit the application
13
+ */
14
+ exit(): void;
15
+
16
+ /**
17
+ * Load application
18
+ * @param name App name
19
+ */
20
+ loadApp(name: string): void;
21
+ }
package/src/index.ts CHANGED
@@ -10,9 +10,8 @@ export * from './app/ExternalSettings';
10
10
  export * from './app/UserRole';
11
11
 
12
12
  // bridges
13
- export * from './bridges/ElectronBridge';
14
- export * from './bridges/IAppData';
15
- export * from './bridges/IBridge';
13
+ export * from './bridges/BridgeUtils';
14
+ export * from './bridges/IBridgeHost';
16
15
 
17
16
  // business
18
17
  export * from './business/BusinessTax';
@@ -1,7 +0,0 @@
1
- import { IBridge } from './IBridge';
2
- /**
3
- * Electron bridge class
4
- * copes with preload.js, contextBridge.exposeInMainWorld
5
- * BrowserWindow.webPreferences, contextIsolation: true
6
- */
7
- export declare const AppRuntime: IBridge;
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AppRuntime = void 0;
4
- /**
5
- * Electron bridge class
6
- * copes with preload.js, contextBridge.exposeInMainWorld
7
- * BrowserWindow.webPreferences, contextIsolation: true
8
- */
9
- exports.AppRuntime = globalThis.appRuntime;
@@ -1,17 +0,0 @@
1
- /**
2
- * Bridge App Data interface
3
- */
4
- export interface IAppData {
5
- /**
6
- * Application name
7
- */
8
- name: string;
9
- /**
10
- * Application version
11
- */
12
- version: string;
13
- /**
14
- * Application path
15
- */
16
- path: string;
17
- }
@@ -1,26 +0,0 @@
1
- /**
2
- * IBridge unsubscribe type
3
- */
4
- declare type IBridgeUnsubscribe = () => void;
5
- /**
6
- * IBridge subscribe listener type
7
- */
8
- declare type IBridgeListener = (...args: any[]) => void;
9
- /**
10
- * window.external calls bridge interface
11
- */
12
- export interface IBridge {
13
- /**
14
- * Send data to the host process with an unique channel
15
- * @param channel an unique channel
16
- * @param data Data to send
17
- */
18
- send(channel: string, data?: any): void;
19
- /**
20
- * Subscribe to the host process
21
- * @param channel an unique channel
22
- * @param listener callback listener
23
- */
24
- subscribe(channel: string, listener: IBridgeListener): IBridgeUnsubscribe;
25
- }
26
- export {};
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,7 +0,0 @@
1
- import { IBridge } from './IBridge';
2
- /**
3
- * Electron bridge class
4
- * copes with preload.js, contextBridge.exposeInMainWorld
5
- * BrowserWindow.webPreferences, contextIsolation: true
6
- */
7
- export declare const AppRuntime: IBridge;
@@ -1,6 +0,0 @@
1
- /**
2
- * Electron bridge class
3
- * copes with preload.js, contextBridge.exposeInMainWorld
4
- * BrowserWindow.webPreferences, contextIsolation: true
5
- */
6
- export const AppRuntime = globalThis.appRuntime;
@@ -1,17 +0,0 @@
1
- /**
2
- * Bridge App Data interface
3
- */
4
- export interface IAppData {
5
- /**
6
- * Application name
7
- */
8
- name: string;
9
- /**
10
- * Application version
11
- */
12
- version: string;
13
- /**
14
- * Application path
15
- */
16
- path: string;
17
- }
@@ -1,26 +0,0 @@
1
- /**
2
- * IBridge unsubscribe type
3
- */
4
- declare type IBridgeUnsubscribe = () => void;
5
- /**
6
- * IBridge subscribe listener type
7
- */
8
- declare type IBridgeListener = (...args: any[]) => void;
9
- /**
10
- * window.external calls bridge interface
11
- */
12
- export interface IBridge {
13
- /**
14
- * Send data to the host process with an unique channel
15
- * @param channel an unique channel
16
- * @param data Data to send
17
- */
18
- send(channel: string, data?: any): void;
19
- /**
20
- * Subscribe to the host process
21
- * @param channel an unique channel
22
- * @param listener callback listener
23
- */
24
- subscribe(channel: string, listener: IBridgeListener): IBridgeUnsubscribe;
25
- }
26
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,8 +0,0 @@
1
- import { IBridge } from './IBridge';
2
-
3
- /**
4
- * Electron bridge class
5
- * copes with preload.js, contextBridge.exposeInMainWorld
6
- * BrowserWindow.webPreferences, contextIsolation: true
7
- */
8
- export const AppRuntime = (globalThis as any).appRuntime as IBridge;
@@ -1,19 +0,0 @@
1
- /**
2
- * Bridge App Data interface
3
- */
4
- export interface IAppData {
5
- /**
6
- * Application name
7
- */
8
- name: string;
9
-
10
- /**
11
- * Application version
12
- */
13
- version: string;
14
-
15
- /**
16
- * Application path
17
- */
18
- path: string;
19
- }
@@ -1,28 +0,0 @@
1
- /**
2
- * IBridge unsubscribe type
3
- */
4
- type IBridgeUnsubscribe = () => void;
5
-
6
- /**
7
- * IBridge subscribe listener type
8
- */
9
- type IBridgeListener = (...args: any[]) => void;
10
-
11
- /**
12
- * window.external calls bridge interface
13
- */
14
- export interface IBridge {
15
- /**
16
- * Send data to the host process with an unique channel
17
- * @param channel an unique channel
18
- * @param data Data to send
19
- */
20
- send(channel: string, data?: any): void;
21
-
22
- /**
23
- * Subscribe to the host process
24
- * @param channel an unique channel
25
- * @param listener callback listener
26
- */
27
- subscribe(channel: string, listener: IBridgeListener): IBridgeUnsubscribe;
28
- }