@featbit/js-client-sdk 3.0.13 → 4.0.0

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.
Files changed (120) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +301 -301
  3. package/dist/esm/FbClientCore.d.ts +6 -5
  4. package/dist/esm/FbClientCore.d.ts.map +1 -1
  5. package/dist/esm/FbClientCore.js +27 -4
  6. package/dist/esm/FbClientCore.js.map +1 -1
  7. package/dist/esm/IFbClientCore.d.ts +8 -7
  8. package/dist/esm/IFbClientCore.d.ts.map +1 -1
  9. package/dist/esm/version.d.ts +1 -1
  10. package/dist/esm/version.d.ts.map +1 -1
  11. package/dist/esm/version.js +1 -1
  12. package/dist/esm/version.js.map +1 -1
  13. package/dist/umd/featbit-js-client-sdk-4.0.0.js +2 -0
  14. package/dist/umd/featbit-js-client-sdk-4.0.0.js.map +1 -0
  15. package/dist/umd/featbit-js-client-sdk.js +1 -1
  16. package/dist/umd/featbit-js-client-sdk.js.map +1 -1
  17. package/package.json +46 -46
  18. package/src/Configuration.ts +232 -232
  19. package/src/Context.ts +61 -61
  20. package/src/FbClientBuilder.ts +167 -167
  21. package/src/FbClientCore.ts +428 -405
  22. package/src/IContextProperty.ts +3 -3
  23. package/src/IDataKind.ts +11 -11
  24. package/src/IFbClient.ts +29 -29
  25. package/src/IFbClientCore.ts +291 -290
  26. package/src/IVersionedData.ts +18 -18
  27. package/src/bootstrap/IBootstrapProvider.ts +4 -4
  28. package/src/bootstrap/JsonBootstrapProvider.ts +34 -34
  29. package/src/bootstrap/NullBootstrapProvider.ts +20 -20
  30. package/src/bootstrap/index.ts +2 -2
  31. package/src/constants.ts +1 -1
  32. package/src/data-sources/DataSourceUpdates.ts +116 -116
  33. package/src/data-sources/createStreamListeners.ts +67 -67
  34. package/src/data-sources/index.ts +1 -1
  35. package/src/data-sync/DataSyncMode.ts +3 -3
  36. package/src/data-sync/IDataSynchronizer.ts +15 -15
  37. package/src/data-sync/IRequestor.ts +10 -10
  38. package/src/data-sync/NullDataSynchronizer.ts +14 -14
  39. package/src/data-sync/PollingDataSynchronizer.ts +125 -125
  40. package/src/data-sync/Requestor.ts +61 -61
  41. package/src/data-sync/WebSocketDataSynchronizer.ts +77 -77
  42. package/src/data-sync/index.ts +8 -8
  43. package/src/data-sync/types.ts +19 -19
  44. package/src/data-sync/utils.ts +31 -31
  45. package/src/errors.ts +47 -47
  46. package/src/evaluation/EvalResult.ts +35 -35
  47. package/src/evaluation/Evaluator.ts +26 -26
  48. package/src/evaluation/IEvalDetail.ts +23 -23
  49. package/src/evaluation/ReasonKinds.ts +9 -9
  50. package/src/evaluation/data/IFlag.ts +29 -29
  51. package/src/evaluation/index.ts +4 -4
  52. package/src/events/DefaultEventProcessor.ts +83 -83
  53. package/src/events/DefaultEventQueue.ts +49 -49
  54. package/src/events/DefaultEventSender.ts +73 -73
  55. package/src/events/DefaultEventSerializer.ts +11 -11
  56. package/src/events/EventDispatcher.ts +127 -127
  57. package/src/events/EventSerializer.ts +4 -4
  58. package/src/events/IEventProcessor.ts +8 -8
  59. package/src/events/IEventQueue.ts +16 -16
  60. package/src/events/IEventSender.ts +13 -13
  61. package/src/events/NullEventProcessor.ts +15 -15
  62. package/src/events/event.ts +129 -129
  63. package/src/events/index.ts +11 -11
  64. package/src/index.ts +21 -21
  65. package/src/integrations/TestLogger.ts +24 -24
  66. package/src/integrations/index.ts +1 -1
  67. package/src/integrations/test_data/FlagBuilder.ts +59 -59
  68. package/src/integrations/test_data/TestData.ts +57 -57
  69. package/src/integrations/test_data/TestDataSynchronizer.ts +49 -49
  70. package/src/integrations/test_data/index.ts +4 -4
  71. package/src/logging/BasicLogger.ts +108 -108
  72. package/src/logging/IBasicLoggerOptions.ts +46 -46
  73. package/src/logging/ILogger.ts +49 -49
  74. package/src/logging/LogLevel.ts +8 -8
  75. package/src/logging/SafeLogger.ts +69 -69
  76. package/src/logging/format.ts +154 -154
  77. package/src/logging/index.ts +5 -5
  78. package/src/options/ClientContext.ts +39 -39
  79. package/src/options/IClientContext.ts +53 -53
  80. package/src/options/IOptions.ts +123 -123
  81. package/src/options/IUser.ts +6 -6
  82. package/src/options/IValidatedOptions.ts +29 -29
  83. package/src/options/OptionMessages.ts +35 -35
  84. package/src/options/UserBuilder.ts +35 -35
  85. package/src/options/Validators.ts +300 -300
  86. package/src/options/index.ts +7 -7
  87. package/src/platform/IInfo.ts +102 -102
  88. package/src/platform/IPlatform.ts +20 -20
  89. package/src/platform/IStore.ts +112 -112
  90. package/src/platform/IWebSocket.ts +22 -22
  91. package/src/platform/browser/BrowserInfo.ts +24 -24
  92. package/src/platform/browser/BrowserPlatform.ts +19 -19
  93. package/src/platform/browser/BrowserRequests.ts +6 -6
  94. package/src/platform/browser/BrowserWebSocket.ts +147 -147
  95. package/src/platform/browser/FbClient.ts +65 -65
  96. package/src/platform/browser/LocalStorageStore.ts +59 -59
  97. package/src/platform/index.ts +11 -11
  98. package/src/platform/requests.ts +76 -76
  99. package/src/store/BaseStore.ts +125 -125
  100. package/src/store/DataKinds.ts +6 -6
  101. package/src/store/IDataSourceUpdates.ts +68 -68
  102. package/src/store/InMemoryStore.ts +36 -36
  103. package/src/store/index.ts +5 -5
  104. package/src/store/serialization.ts +52 -52
  105. package/src/store/store.ts +37 -37
  106. package/src/utils/Emits.ts +75 -75
  107. package/src/utils/EventEmitter.ts +128 -128
  108. package/src/utils/IEventEmitter.ts +14 -14
  109. package/src/utils/Regex.ts +21 -21
  110. package/src/utils/ValueConverters.ts +55 -55
  111. package/src/utils/canonicalizeUri.ts +3 -3
  112. package/src/utils/debounce.ts +33 -33
  113. package/src/utils/http.ts +40 -40
  114. package/src/utils/index.ts +5 -5
  115. package/src/utils/isNullOrUndefined.ts +2 -2
  116. package/src/utils/serializeUser.ts +27 -27
  117. package/src/utils/sleep.ts +5 -5
  118. package/src/version.ts +1 -1
  119. package/dist/umd/featbit-js-client-sdk-3.0.13.js +0 -2
  120. package/dist/umd/featbit-js-client-sdk-3.0.13.js.map +0 -1
@@ -1,103 +1,103 @@
1
- export interface IFbDevice {
2
- manufacturer?: string;
3
- model?: string;
4
- storageBytes?: string;
5
- memoryBytes?: string;
6
- os?: {
7
- /**
8
- * The family of operating system.
9
- */
10
- family?: string;
11
- name?: string;
12
- version?: string;
13
- };
14
- }
15
-
16
- /**
17
- * Information about the platform of the SDK and the environment it is executing.
18
- */
19
- export interface IPlatformData {
20
- /**
21
- * Information about the OS on which the SDK is running. Should be populated
22
- * when available. Not all platforms will make this data accessible.
23
- */
24
- os?: {
25
- /**
26
- * The architecture. Ideally at runtime, but may be build time if that is
27
- * a constraint.
28
- */
29
- arch?: string;
30
- /**
31
- * The name of the OS. "MacOS", "Windows", or "Linux". If not one of those,
32
- * then use the value provided by the OS.
33
- */
34
- name?: string;
35
-
36
- /** The version of the OS. */
37
- version?: string;
38
- };
39
-
40
- /**
41
- * The name of the platform the SDK is running on. For instance 'Node'.
42
- */
43
- name?: string;
44
-
45
- /**
46
- * Any additional attributes associated with the platform.
47
- */
48
- additional?: Record<string, string>;
49
-
50
- /**
51
- * Device hardware information. Should be populated when available. Not all
52
- * platforms will have this data.
53
- */
54
- fbDevice?: IFbDevice;
55
- }
56
-
57
- export interface ISdkData {
58
- /**
59
- * The name of the SDK. e.g. "browser-server-sdk"
60
- */
61
- name?: string;
62
-
63
- /**
64
- * The version of the SDK.
65
- */
66
- version?: string;
67
-
68
- /**
69
- * If this is a top-level (not a wrapper) SDK this will be used to create the user agent string.
70
- * It will take the form 'userAgentBase/version`.
71
- */
72
- userAgent?: string;
73
-
74
- /**
75
- * Name of the wrapper SDK if present.
76
- */
77
- wrapperName?: string;
78
- /**
79
- * Version of the wrapper if present.
80
- */
81
- wrapperVersion?: string;
82
- }
83
-
84
- /**
85
- * Interface for getting information about the SDK or the environment it is
86
- * executing in.
87
- */
88
- export interface IInfo {
89
- /**
90
- * Get the app type
91
- */
92
- get appType(): string;
93
-
94
- /**
95
- * Get information about the platform.
96
- */
97
- platformData(): IPlatformData;
98
-
99
- /**
100
- * Get information about the SDK implementation.
101
- */
102
- sdkData(): ISdkData;
1
+ export interface IFbDevice {
2
+ manufacturer?: string;
3
+ model?: string;
4
+ storageBytes?: string;
5
+ memoryBytes?: string;
6
+ os?: {
7
+ /**
8
+ * The family of operating system.
9
+ */
10
+ family?: string;
11
+ name?: string;
12
+ version?: string;
13
+ };
14
+ }
15
+
16
+ /**
17
+ * Information about the platform of the SDK and the environment it is executing.
18
+ */
19
+ export interface IPlatformData {
20
+ /**
21
+ * Information about the OS on which the SDK is running. Should be populated
22
+ * when available. Not all platforms will make this data accessible.
23
+ */
24
+ os?: {
25
+ /**
26
+ * The architecture. Ideally at runtime, but may be build time if that is
27
+ * a constraint.
28
+ */
29
+ arch?: string;
30
+ /**
31
+ * The name of the OS. "MacOS", "Windows", or "Linux". If not one of those,
32
+ * then use the value provided by the OS.
33
+ */
34
+ name?: string;
35
+
36
+ /** The version of the OS. */
37
+ version?: string;
38
+ };
39
+
40
+ /**
41
+ * The name of the platform the SDK is running on. For instance 'Node'.
42
+ */
43
+ name?: string;
44
+
45
+ /**
46
+ * Any additional attributes associated with the platform.
47
+ */
48
+ additional?: Record<string, string>;
49
+
50
+ /**
51
+ * Device hardware information. Should be populated when available. Not all
52
+ * platforms will have this data.
53
+ */
54
+ fbDevice?: IFbDevice;
55
+ }
56
+
57
+ export interface ISdkData {
58
+ /**
59
+ * The name of the SDK. e.g. "browser-server-sdk"
60
+ */
61
+ name?: string;
62
+
63
+ /**
64
+ * The version of the SDK.
65
+ */
66
+ version?: string;
67
+
68
+ /**
69
+ * If this is a top-level (not a wrapper) SDK this will be used to create the user agent string.
70
+ * It will take the form 'userAgentBase/version`.
71
+ */
72
+ userAgent?: string;
73
+
74
+ /**
75
+ * Name of the wrapper SDK if present.
76
+ */
77
+ wrapperName?: string;
78
+ /**
79
+ * Version of the wrapper if present.
80
+ */
81
+ wrapperVersion?: string;
82
+ }
83
+
84
+ /**
85
+ * Interface for getting information about the SDK or the environment it is
86
+ * executing in.
87
+ */
88
+ export interface IInfo {
89
+ /**
90
+ * Get the app type
91
+ */
92
+ get appType(): string;
93
+
94
+ /**
95
+ * Get information about the platform.
96
+ */
97
+ platformData(): IPlatformData;
98
+
99
+ /**
100
+ * Get information about the SDK implementation.
101
+ */
102
+ sdkData(): ISdkData;
103
103
  }
@@ -1,21 +1,21 @@
1
- import { IRequests } from "./requests";
2
- import { IInfo } from "./IInfo";
3
- import { IWebSocketWithEvents } from "./IWebSocket";
4
-
5
- export interface IPlatform {
6
- /**
7
- * The interface for getting information about the platform and the execution
8
- * environment.
9
- */
10
- info: IInfo;
11
-
12
- /**
13
- * The interface for performing http/https requests.
14
- */
15
- requests: IRequests;
16
-
17
- /**
18
- * The interface for performing websocket connections.
19
- */
20
- webSocket: IWebSocketWithEvents;
1
+ import { IRequests } from "./requests";
2
+ import { IInfo } from "./IInfo";
3
+ import { IWebSocketWithEvents } from "./IWebSocket";
4
+
5
+ export interface IPlatform {
6
+ /**
7
+ * The interface for getting information about the platform and the execution
8
+ * environment.
9
+ */
10
+ info: IInfo;
11
+
12
+ /**
13
+ * The interface for performing http/https requests.
14
+ */
15
+ requests: IRequests;
16
+
17
+ /**
18
+ * The interface for performing websocket connections.
19
+ */
20
+ webSocket: IWebSocketWithEvents;
21
21
  }
@@ -1,113 +1,113 @@
1
- import { IDataKind } from "../IDataKind";
2
- import { IKeyedStoreItem, IStoreDataStorage, IStoreItem, IStoreKindData } from "../store/store";
3
- import { IUser } from "../options/IUser";
4
-
5
- /**
6
- * Interface for a feature store component.
7
- *
8
- * The feature store is what the client uses to store feature flag data that has been received
9
- * from FeatBit. By default, it uses an in-memory implementation; database integrations are
10
- * also available. Read the [SDK features guide](xxx).
11
- * You will not need to use this interface unless you are writing your own implementation.
12
- *
13
- * Feature store methods can and should call their callbacks directly whenever possible, rather
14
- * than deferring them with setImmediate() or process.nextTick(). This means that if for any
15
- * reason you are updating or querying a feature store directly in your application code (which
16
- * is not part of normal use of the SDK) you should be aware that the callback may be executed
17
- * immediately.
18
- */
19
- export interface IStore {
20
- /**
21
- * Set the current user of the store.
22
- *
23
- * @param user
24
- * The current user. The actual type of this parameter is
25
- * {@link IUser}.
26
- */
27
- identify(user: IUser): Promise<void>;
28
-
29
- /**
30
- * Get the current user of the store.
31
- */
32
- user: IUser;
33
-
34
- /**
35
- * Get an entity from the store.
36
- *
37
- * The store should treat any entity with the property `deleted: true` as "not found".
38
- *
39
- * @param kind
40
- * The type of data to be accessed. The store should not make any assumptions about the format
41
- * of the data, but just return a JSON object. The actual type of this parameter is
42
- * {@link DataKind}.
43
- *
44
- * @param key
45
- * The unique key of the entity within the specified collection.
46
- */
47
- get(kind: IDataKind, key: string): IStoreItem | null
48
-
49
- /**
50
- * Get all entities from a collection.
51
- *
52
- * The store should filter out any entities with the property `deleted: true`.
53
- *
54
- * @param kind
55
- * The type of data to be accessed. The store should not make any assumptions about the format
56
- * of the data, but just return an object in which each key is the `key` property of an entity
57
- * and the value is the entity. The actual type of this parameter is
58
- * {@link IDataKind}.
59
- */
60
- all(kind: IDataKind): [IStoreKindData, number];
61
-
62
- /**
63
- * Initialize the store, overwriting any existing data.
64
- *
65
- * @param allData
66
- * An object in which each key is the "namespace" of a collection (e.g. `"features"`) and
67
- * the value is an object that maps keys to entities. The actual type of this parameter is
68
- * `interfaces.FullDataSet<VersionedData>`.
69
- */
70
- init(allData: IStoreDataStorage): Promise<void>;
71
-
72
- /**
73
- * Add an entity or update an existing entity.
74
- *
75
- * @param kind
76
- * The type of data to be accessed. The actual type of this parameter is
77
- * {@link IDataKind}.
78
- *
79
- * @param data
80
- * The contents of the entity, as an object that can be converted to JSON. The store
81
- * should check the `version` property of this object, and should *not* overwrite any
82
- * existing data if the existing `version` is greater than or equal to that value.
83
- * The actual type of this parameter is {@link IKeyedStoreItem}.
84
- */
85
- upsert(kind: IDataKind, data: IKeyedStoreItem): Promise<void>;
86
-
87
- /**
88
- * Tests whether the store is initialized.
89
- *
90
- * "Initialized" means that the store has been populated with data, either by the client
91
- * having called `init()` within this process, or by another process (if this is a shared
92
- * database).
93
- *
94
- * @param callback
95
- * Will be called back with the boolean result.
96
- */
97
- initialized(): boolean;
98
-
99
- /**
100
- * Releases any resources being used by the feature store.
101
- */
102
- close(): void;
103
-
104
- /**
105
- * Get a description of the store.
106
- */
107
- getDescription?(): string;
108
-
109
- /**
110
- * The current version of the store.
111
- */
112
- version: number;
1
+ import { IDataKind } from "../IDataKind";
2
+ import { IKeyedStoreItem, IStoreDataStorage, IStoreItem, IStoreKindData } from "../store/store";
3
+ import { IUser } from "../options/IUser";
4
+
5
+ /**
6
+ * Interface for a feature store component.
7
+ *
8
+ * The feature store is what the client uses to store feature flag data that has been received
9
+ * from FeatBit. By default, it uses an in-memory implementation; database integrations are
10
+ * also available. Read the [SDK features guide](xxx).
11
+ * You will not need to use this interface unless you are writing your own implementation.
12
+ *
13
+ * Feature store methods can and should call their callbacks directly whenever possible, rather
14
+ * than deferring them with setImmediate() or process.nextTick(). This means that if for any
15
+ * reason you are updating or querying a feature store directly in your application code (which
16
+ * is not part of normal use of the SDK) you should be aware that the callback may be executed
17
+ * immediately.
18
+ */
19
+ export interface IStore {
20
+ /**
21
+ * Set the current user of the store.
22
+ *
23
+ * @param user
24
+ * The current user. The actual type of this parameter is
25
+ * {@link IUser}.
26
+ */
27
+ identify(user: IUser): Promise<void>;
28
+
29
+ /**
30
+ * Get the current user of the store.
31
+ */
32
+ user: IUser;
33
+
34
+ /**
35
+ * Get an entity from the store.
36
+ *
37
+ * The store should treat any entity with the property `deleted: true` as "not found".
38
+ *
39
+ * @param kind
40
+ * The type of data to be accessed. The store should not make any assumptions about the format
41
+ * of the data, but just return a JSON object. The actual type of this parameter is
42
+ * {@link DataKind}.
43
+ *
44
+ * @param key
45
+ * The unique key of the entity within the specified collection.
46
+ */
47
+ get(kind: IDataKind, key: string): IStoreItem | null
48
+
49
+ /**
50
+ * Get all entities from a collection.
51
+ *
52
+ * The store should filter out any entities with the property `deleted: true`.
53
+ *
54
+ * @param kind
55
+ * The type of data to be accessed. The store should not make any assumptions about the format
56
+ * of the data, but just return an object in which each key is the `key` property of an entity
57
+ * and the value is the entity. The actual type of this parameter is
58
+ * {@link IDataKind}.
59
+ */
60
+ all(kind: IDataKind): [IStoreKindData, number];
61
+
62
+ /**
63
+ * Initialize the store, overwriting any existing data.
64
+ *
65
+ * @param allData
66
+ * An object in which each key is the "namespace" of a collection (e.g. `"features"`) and
67
+ * the value is an object that maps keys to entities. The actual type of this parameter is
68
+ * `interfaces.FullDataSet<VersionedData>`.
69
+ */
70
+ init(allData: IStoreDataStorage): Promise<void>;
71
+
72
+ /**
73
+ * Add an entity or update an existing entity.
74
+ *
75
+ * @param kind
76
+ * The type of data to be accessed. The actual type of this parameter is
77
+ * {@link IDataKind}.
78
+ *
79
+ * @param data
80
+ * The contents of the entity, as an object that can be converted to JSON. The store
81
+ * should check the `version` property of this object, and should *not* overwrite any
82
+ * existing data if the existing `version` is greater than or equal to that value.
83
+ * The actual type of this parameter is {@link IKeyedStoreItem}.
84
+ */
85
+ upsert(kind: IDataKind, data: IKeyedStoreItem): Promise<void>;
86
+
87
+ /**
88
+ * Tests whether the store is initialized.
89
+ *
90
+ * "Initialized" means that the store has been populated with data, either by the client
91
+ * having called `init()` within this process, or by another process (if this is a shared
92
+ * database).
93
+ *
94
+ * @param callback
95
+ * Will be called back with the boolean result.
96
+ */
97
+ initialized(): boolean;
98
+
99
+ /**
100
+ * Releases any resources being used by the feature store.
101
+ */
102
+ close(): void;
103
+
104
+ /**
105
+ * Get a description of the store.
106
+ */
107
+ getDescription?(): string;
108
+
109
+ /**
110
+ * The current version of the store.
111
+ */
112
+ version: number;
113
113
  }
@@ -1,23 +1,23 @@
1
- import { IEventEmitter } from "../utils/IEventEmitter";
2
- import { ILogger } from "../logging/ILogger";
3
- import { IUser } from "../options/IUser";
4
-
5
- export interface IWebSocketConfig {
6
- sdkKey: string;
7
- streamingUri: string;
8
- pingInterval: number;
9
- user: IUser;
10
- logger: ILogger;
11
- getStoreTimestamp: () => number,
12
- emitter?: IEventEmitter;
13
- }
14
-
15
- export interface IWebSocket {
16
- connect: () => void;
17
- close: () => void;
18
- config: (param: IWebSocketConfig) => void;
19
- identify: (user: IUser) => void;
20
- }
21
-
22
- export interface IWebSocketWithEvents extends IWebSocket, IEventEmitter {
1
+ import { IEventEmitter } from "../utils/IEventEmitter";
2
+ import { ILogger } from "../logging/ILogger";
3
+ import { IUser } from "../options/IUser";
4
+
5
+ export interface IWebSocketConfig {
6
+ sdkKey: string;
7
+ streamingUri: string;
8
+ pingInterval: number;
9
+ user: IUser;
10
+ logger: ILogger;
11
+ getStoreTimestamp: () => number,
12
+ emitter?: IEventEmitter;
13
+ }
14
+
15
+ export interface IWebSocket {
16
+ connect: () => void;
17
+ close: () => void;
18
+ config: (param: IWebSocketConfig) => void;
19
+ identify: (user: IUser) => void;
20
+ }
21
+
22
+ export interface IWebSocketWithEvents extends IWebSocket, IEventEmitter {
23
23
  }
@@ -1,25 +1,25 @@
1
- import { IInfo, IPlatformData, ISdkData } from "../IInfo";
2
- import { name, version } from '../../version';
3
-
4
-
5
- export default class BrowserInfo implements IInfo {
6
- get appType(): string {
7
- return 'Browser-Client-SDK';
8
- }
9
-
10
- platformData(): IPlatformData {
11
- return {
12
- os: {},
13
- name: 'Browser',
14
- additional: {},
15
- };
16
- }
17
-
18
- sdkData(): ISdkData {
19
- return {
20
- name: name,
21
- version: version,
22
- userAgent: `${ this.appType }/${ version }`,
23
- };
24
- }
1
+ import { IInfo, IPlatformData, ISdkData } from "../IInfo";
2
+ import { name, version } from '../../version';
3
+
4
+
5
+ export default class BrowserInfo implements IInfo {
6
+ get appType(): string {
7
+ return 'Browser-Client-SDK';
8
+ }
9
+
10
+ platformData(): IPlatformData {
11
+ return {
12
+ os: {},
13
+ name: 'Browser',
14
+ additional: {},
15
+ };
16
+ }
17
+
18
+ sdkData(): ISdkData {
19
+ return {
20
+ name: name,
21
+ version: version,
22
+ userAgent: `${ this.appType }/${ version }`,
23
+ };
24
+ }
25
25
  }
@@ -1,20 +1,20 @@
1
- import { IPlatform } from "../IPlatform";
2
- import { IInfo } from "../IInfo";
3
- import { IRequests } from "../requests";
4
- import { IOptions } from "../../options/IOptions";
5
- import BrowserInfo from "./BrowserInfo";
6
- import { BrowserRequests } from "./BrowserRequests";
7
- import { IWebSocketWithEvents } from "../IWebSocket";
8
- import BrowserWebSocket from "./BrowserWebSocket";
9
-
10
- export class BrowserPlatform implements IPlatform {
11
- info: IInfo = new BrowserInfo();
12
-
13
- requests: IRequests;
14
- webSocket: IWebSocketWithEvents;
15
-
16
- constructor(options: IOptions) {
17
- this.requests = new BrowserRequests();
18
- this.webSocket = new BrowserWebSocket();
19
- }
1
+ import { IPlatform } from "../IPlatform";
2
+ import { IInfo } from "../IInfo";
3
+ import { IRequests } from "../requests";
4
+ import { IOptions } from "../../options/IOptions";
5
+ import BrowserInfo from "./BrowserInfo";
6
+ import { BrowserRequests } from "./BrowserRequests";
7
+ import { IWebSocketWithEvents } from "../IWebSocket";
8
+ import BrowserWebSocket from "./BrowserWebSocket";
9
+
10
+ export class BrowserPlatform implements IPlatform {
11
+ info: IInfo = new BrowserInfo();
12
+
13
+ requests: IRequests;
14
+ webSocket: IWebSocketWithEvents;
15
+
16
+ constructor(options: IOptions) {
17
+ this.requests = new BrowserRequests();
18
+ this.webSocket = new BrowserWebSocket();
19
+ }
20
20
  }
@@ -1,7 +1,7 @@
1
- import { IRequestOptions, IRequests } from "../requests";
2
-
3
- export class BrowserRequests implements IRequests {
4
- fetch(url: string, options: IRequestOptions = {}): Promise<any> {
5
- return fetch(url, options);
6
- }
1
+ import { IRequestOptions, IRequests } from "../requests";
2
+
3
+ export class BrowserRequests implements IRequests {
4
+ fetch(url: string, options: IRequestOptions = {}): Promise<any> {
5
+ return fetch(url, options);
6
+ }
7
7
  }