@etsoo/appscript 1.5.67 → 1.5.69

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.
@@ -2,87 +2,87 @@
2
2
  * External endpoint
3
3
  */
4
4
  export type ExternalEndpoint = {
5
- /**
6
- * API endpoint
7
- */
8
- readonly endpoint: string;
5
+ /**
6
+ * API endpoint
7
+ */
8
+ readonly endpoint: string;
9
9
 
10
- /**
11
- * Web url
12
- */
13
- readonly webUrl: string;
10
+ /**
11
+ * Web url
12
+ */
13
+ readonly webUrl: string;
14
14
  };
15
15
 
16
16
  /**
17
17
  * External settings items
18
18
  */
19
19
  export interface IExternalSettings extends ExternalEndpoint {
20
- /**
21
- * Message hub endpoint
22
- */
23
- readonly messageHub?: string;
20
+ /**
21
+ * Message hub endpoint
22
+ */
23
+ readonly messageHub?: string;
24
24
 
25
- /**
26
- * App root url
27
- */
28
- readonly homepage: string;
25
+ /**
26
+ * App root url
27
+ */
28
+ readonly homepage: string;
29
29
 
30
- /**
31
- * Application id
32
- * 程序编号
33
- */
34
- readonly appId: number;
30
+ /**
31
+ * Application id
32
+ * 程序编号
33
+ */
34
+ readonly appId: number;
35
35
 
36
- /**
37
- * Endpoints to other services
38
- */
39
- readonly endpoints?: Record<
40
- 'core' | 'accounting' | 'crm' | 'calandar' | 'task' | string,
41
- ExternalEndpoint
42
- >;
36
+ /**
37
+ * Endpoints to other services
38
+ */
39
+ readonly endpoints?: Record<
40
+ "core" | "accounting" | "crm" | "calandar" | "task" | string,
41
+ ExternalEndpoint
42
+ >;
43
43
  }
44
44
 
45
45
  /**
46
46
  * External settings namespace
47
47
  */
48
48
  export namespace ExternalSettings {
49
- /**
50
- * Create instance
51
- */
52
- export function create<T extends IExternalSettings = IExternalSettings>():
53
- | T
54
- | undefined {
55
- if ('settings' in globalThis) {
56
- const settings = Reflect.get(globalThis, 'settings');
57
- if (typeof settings === 'object') {
58
- if (typeof window !== 'undefined') {
59
- // Host name
60
- const hostname = globalThis.location.hostname;
49
+ /**
50
+ * Create instance
51
+ */
52
+ export function create<T extends IExternalSettings = IExternalSettings>():
53
+ | T
54
+ | undefined {
55
+ if ("settings" in globalThis) {
56
+ const settings = Reflect.get(globalThis, "settings");
57
+ if (typeof settings === "object") {
58
+ if (typeof window !== "undefined") {
59
+ // Host name
60
+ const hostname = globalThis.location.hostname;
61
61
 
62
- // replace {hostname}
63
- format(settings, hostname);
64
- }
65
-
66
- return settings as T;
67
- }
62
+ // replace {hostname}
63
+ format(settings, hostname);
68
64
  }
69
- return undefined;
65
+
66
+ return settings as T;
67
+ }
70
68
  }
69
+ return undefined;
70
+ }
71
71
 
72
- export function format(settings: any, hostname?: string) {
73
- // Default hostname
74
- if (!hostname) hostname = 'localhost';
72
+ export function format(settings: any, hostname?: string) {
73
+ // Default hostname
74
+ if (!hostname) hostname = "localhost";
75
75
 
76
- // replace {hostname}
77
- for (const key in settings) {
78
- const value = settings[key];
79
- if (typeof value === 'string') {
80
- settings[key] = value.replace('{hostname}', hostname);
81
- } else if (typeof value === 'object') {
82
- format(value, hostname);
83
- }
84
- }
85
-
86
- return settings;
76
+ // replace {hostname}
77
+ for (const key in settings) {
78
+ const value = settings[key];
79
+ if (typeof value === "string") {
80
+ settings[key] = value.replace("{hostname}", hostname);
81
+ } else if (typeof value === "object") {
82
+ format(value, hostname);
83
+ }
87
84
  }
85
+
86
+ return settings;
87
+ }
88
88
  }