vwo-fme-node-sdk 1.41.0 → 1.43.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.
- package/CHANGELOG.md +94 -0
- package/README.md +34 -7
- package/dist/VERSION.js +1 -1
- package/dist/client/vwo-fme-javascript-sdk.js +455 -231
- package/dist/client/vwo-fme-javascript-sdk.js.map +1 -1
- package/dist/client/vwo-fme-javascript-sdk.min.js +2 -2
- package/dist/client/vwo-fme-javascript-sdk.min.js.map +1 -1
- package/dist/esm/VWOBuilder.js +28 -7
- package/dist/esm/VWOBuilder.js.map +1 -1
- package/dist/esm/VWOClient.js +33 -0
- package/dist/esm/VWOClient.js.map +1 -1
- package/dist/esm/api/GetFlag.js +111 -74
- package/dist/esm/api/GetFlag.js.map +1 -1
- package/dist/esm/api/SetAttribute.js +5 -0
- package/dist/esm/api/SetAttribute.js.map +1 -1
- package/dist/esm/api/TrackEvent.js +5 -0
- package/dist/esm/api/TrackEvent.js.map +1 -1
- package/dist/esm/constants/index.js +13 -1
- package/dist/esm/constants/index.js.map +1 -1
- package/dist/esm/enums/ApiEnum.js +1 -0
- package/dist/esm/enums/ApiEnum.js.map +1 -1
- package/dist/esm/models/VWOOptionsModel.js +19 -0
- package/dist/esm/models/VWOOptionsModel.js.map +1 -1
- package/dist/esm/models/settings/SettingsModel.js +7 -0
- package/dist/esm/models/settings/SettingsModel.js.map +1 -1
- package/dist/esm/models/user/ContextModel.js +6 -0
- package/dist/esm/models/user/ContextModel.js.map +1 -1
- package/dist/esm/packages/network-layer/client/NetworkClient.js +18 -1
- package/dist/esm/packages/network-layer/client/NetworkClient.js.map +1 -1
- package/dist/esm/packages/network-layer/manager/NetworkManager.js +41 -2
- package/dist/esm/packages/network-layer/manager/NetworkManager.js.map +1 -1
- package/dist/esm/packages/network-layer/models/RequestModel.js +0 -1
- package/dist/esm/packages/network-layer/models/RequestModel.js.map +1 -1
- package/dist/esm/services/BatchEventsQueue.js +26 -13
- package/dist/esm/services/BatchEventsQueue.js.map +1 -1
- package/dist/esm/services/ServiceContainer.js +21 -3
- package/dist/esm/services/ServiceContainer.js.map +1 -1
- package/dist/esm/utils/DecisionUtil.js +38 -36
- package/dist/esm/utils/DecisionUtil.js.map +1 -1
- package/dist/esm/utils/MegUtil.js.map +1 -1
- package/dist/package.json +1 -1
- package/dist/server/vwo-fme-node-sdk.js +494 -230
- package/dist/server/vwo-fme-node-sdk.js.map +1 -1
- package/dist/server/vwo-fme-node-sdk.min.js +2 -2
- package/dist/server/vwo-fme-node-sdk.min.js.map +1 -1
- package/dist/server-unpacked/VWOBuilder.js +26 -8
- package/dist/server-unpacked/VWOBuilder.js.map +1 -1
- package/dist/server-unpacked/VWOClient.js +45 -0
- package/dist/server-unpacked/VWOClient.js.map +1 -1
- package/dist/server-unpacked/api/GetFlag.js +132 -101
- package/dist/server-unpacked/api/GetFlag.js.map +1 -1
- package/dist/server-unpacked/api/SetAttribute.js +11 -5
- package/dist/server-unpacked/api/SetAttribute.js.map +1 -1
- package/dist/server-unpacked/api/TrackEvent.js +11 -5
- package/dist/server-unpacked/api/TrackEvent.js.map +1 -1
- package/dist/server-unpacked/constants/index.js +13 -1
- package/dist/server-unpacked/constants/index.js.map +1 -1
- package/dist/server-unpacked/enums/ApiEnum.js +1 -0
- package/dist/server-unpacked/enums/ApiEnum.js.map +1 -1
- package/dist/server-unpacked/models/VWOOptionsModel.js +20 -0
- package/dist/server-unpacked/models/VWOOptionsModel.js.map +1 -1
- package/dist/server-unpacked/models/settings/SettingsModel.js +7 -0
- package/dist/server-unpacked/models/settings/SettingsModel.js.map +1 -1
- package/dist/server-unpacked/models/user/ContextModel.js +6 -0
- package/dist/server-unpacked/models/user/ContextModel.js.map +1 -1
- package/dist/server-unpacked/packages/network-layer/client/NetworkClient.js +18 -1
- package/dist/server-unpacked/packages/network-layer/client/NetworkClient.js.map +1 -1
- package/dist/server-unpacked/packages/network-layer/manager/NetworkManager.js +38 -2
- package/dist/server-unpacked/packages/network-layer/manager/NetworkManager.js.map +1 -1
- package/dist/server-unpacked/packages/network-layer/models/RequestModel.js +1 -2
- package/dist/server-unpacked/packages/network-layer/models/RequestModel.js.map +1 -1
- package/dist/server-unpacked/services/BatchEventsQueue.js +82 -53
- package/dist/server-unpacked/services/BatchEventsQueue.js.map +1 -1
- package/dist/server-unpacked/services/ServiceContainer.js +21 -3
- package/dist/server-unpacked/services/ServiceContainer.js.map +1 -1
- package/dist/server-unpacked/utils/DecisionUtil.js +57 -47
- package/dist/server-unpacked/utils/DecisionUtil.js.map +1 -1
- package/dist/server-unpacked/utils/MegUtil.js.map +1 -1
- package/dist/types/VWOBuilder.d.ts +6 -0
- package/dist/types/VWOClient.d.ts +7 -0
- package/dist/types/constants/index.d.ts +9 -0
- package/dist/types/enums/ApiEnum.d.ts +1 -0
- package/dist/types/models/VWOOptionsModel.d.ts +15 -1
- package/dist/types/models/settings/SettingsModel.d.ts +2 -0
- package/dist/types/models/user/ContextModel.d.ts +3 -0
- package/dist/types/packages/network-layer/client/NetworkClient.d.ts +16 -1
- package/dist/types/packages/network-layer/manager/NetworkManager.d.ts +11 -0
- package/dist/types/services/ServiceContainer.d.ts +15 -5
- package/lib/VWOBuilder.ts +30 -7
- package/lib/VWOClient.ts +37 -0
- package/lib/api/GetFlag.ts +189 -140
- package/lib/api/SetAttribute.ts +6 -0
- package/lib/api/TrackEvent.ts +6 -0
- package/lib/constants/index.ts +16 -1
- package/lib/enums/ApiEnum.ts +1 -0
- package/lib/models/VWOOptionsModel.ts +28 -1
- package/lib/models/settings/SettingsModel.ts +9 -0
- package/lib/models/user/ContextModel.ts +10 -0
- package/lib/packages/network-layer/client/NetworkClient.ts +34 -1
- package/lib/packages/network-layer/manager/NetworkManager.ts +55 -1
- package/lib/packages/network-layer/models/RequestModel.ts +0 -1
- package/lib/services/BatchEventsQueue.ts +29 -14
- package/lib/services/ServiceContainer.ts +25 -6
- package/lib/utils/DecisionUtil.ts +58 -56
- package/lib/utils/MegUtil.ts +6 -10
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,100 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.43.0] - 2026-04-07
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Added support for whitelisting based on custom variables via `variationTargetingVariables` in the context. This allows users to be forcefully bucketed into specific variations based on custom evaluating rules, bypassing standard traffic allocation.
|
|
13
|
+
|
|
14
|
+
Example usage:
|
|
15
|
+
|
|
16
|
+
```javascript
|
|
17
|
+
const vwoClient = await init({
|
|
18
|
+
accountId: '123456',
|
|
19
|
+
sdkKey: '32-alpha-numeric-sdk-key',
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
// Force users with 'premium' plan into a specific whitelisted variation
|
|
23
|
+
const userContext = {
|
|
24
|
+
id: 'user-123',
|
|
25
|
+
variationTargetingVariables: {
|
|
26
|
+
plan: 'premium',
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const flag = await vwoClient.getFlag('feature-key', userContext);
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
- Added support for `isDevMode` in `userContext` that disables event dispatching for that user when enabled in both `userContext` and VWO settings.
|
|
34
|
+
|
|
35
|
+
Example usage:
|
|
36
|
+
|
|
37
|
+
```javascript
|
|
38
|
+
const vwoClient = await init({
|
|
39
|
+
accountId: '123456',
|
|
40
|
+
sdkKey: '32-alpha-numeric-sdk-key',
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// send isDevMode in userContext
|
|
44
|
+
const userContext = {
|
|
45
|
+
id: 'user-123',
|
|
46
|
+
isDevMode: true,
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
// Decisions are returned as normal, but events are not sent to DaCDN
|
|
50
|
+
const flag = await vwoClient.getFlag('feature-key', userContext);
|
|
51
|
+
await vwoClient.trackEvent('event-name', userContext, eventProperties);
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## [1.42.0] - 2026-04-01
|
|
55
|
+
|
|
56
|
+
### Added
|
|
57
|
+
|
|
58
|
+
- Added a `shutdown()` API on `VWOClient` to support graceful teardown in long-running environments. Calling `shutdown()` now stops the internal settings polling loop, flushes any pending batched events, clears batch timers, and releases batching resources.
|
|
59
|
+
|
|
60
|
+
Example usage:
|
|
61
|
+
|
|
62
|
+
```javascript
|
|
63
|
+
const { init } = require('vwo-fme-node-sdk');
|
|
64
|
+
|
|
65
|
+
(async () => {
|
|
66
|
+
const vwoClient = await init({
|
|
67
|
+
accountId: '123456',
|
|
68
|
+
sdkKey: '32-alpha-numeric-sdk-key',
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
// When your app/process is about to exit:
|
|
72
|
+
await vwoClient.shutdown();
|
|
73
|
+
})();
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Changed
|
|
77
|
+
|
|
78
|
+
- Optimized the batch events queue to enforce `eventsPerRequest` as a hard per-dispatch cap, preserve event ordering when retries occur and avoid unnecessary timer wakeups when the queue is empty.
|
|
79
|
+
- Improved Node.js HTTPS networking by introducing a configurable HTTPS agent (`httpsAgentConfig`) in the network layer, including validation and sensible defaults for `keepAlive`, `maxSockets`, `maxFreeSockets`, and `timeout` to provide better socket reuse and connection management.
|
|
80
|
+
|
|
81
|
+
Example usage:
|
|
82
|
+
|
|
83
|
+
```javascript
|
|
84
|
+
const { init } = require('vwo-fme-node-sdk');
|
|
85
|
+
|
|
86
|
+
(async () => {
|
|
87
|
+
const vwoClient = await init({
|
|
88
|
+
accountId: '123456',
|
|
89
|
+
sdkKey: '32-alpha-numeric-sdk-key',
|
|
90
|
+
httpsAgentConfig: {
|
|
91
|
+
keepAlive: true, // default: true
|
|
92
|
+
maxSockets: 100, // default: 100, minimum 50
|
|
93
|
+
maxFreeSockets: 20, // default: 20, minimum 10
|
|
94
|
+
timeout: 60000, // in milliseconds, default: 60000, minimum 30000
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
// ...use the client...
|
|
99
|
+
})();
|
|
100
|
+
```
|
|
101
|
+
|
|
8
102
|
## [1.41.0] - 2026-03-18
|
|
9
103
|
|
|
10
104
|
### Added
|
package/README.md
CHANGED
|
@@ -98,6 +98,7 @@ To customize the SDK further, additional parameters can be passed to the `init()
|
|
|
98
98
|
| `integrations` | A callback function that receives data which can be pushed to any external tool that you need to integrate with. | No | Object | See [Integrations](#integrations) |
|
|
99
99
|
| `batchEventData` | Configuration for batch event processing to optimize network requests | No | Object | See [Batch Events](#batch-events) section |
|
|
100
100
|
| `retryConfig` | Configuration for network request retry behavior and exponential backoff strategy | No | Object | See [Retry Config](#retry-config) section |
|
|
101
|
+
| `httpsAgentConfig` | Node.js HTTPS agent configuration for controlling keep-alive, socket pool size, and timeouts | No | Object | See [HTTPS Agent Config](#https-agent-config) |
|
|
101
102
|
| `edgeConfig` | Configuration for edge/serverless environment optimizations (e.g., Cloudflare Workers) | No | Object | See [Edge Config](#edge-config) section |
|
|
102
103
|
|
|
103
104
|
Refer to the [official VWO documentation](https://developers.vwo.com/v2/docs/fme-node-install) for additional parameter details.
|
|
@@ -110,13 +111,13 @@ The `context` object uniquely identifies users and is crucial for consistent fea
|
|
|
110
111
|
|
|
111
112
|
The following table explains all the parameters in the `context` object:
|
|
112
113
|
|
|
113
|
-
| **Parameter** | **Description**
|
|
114
|
-
| ----------------- |
|
|
115
|
-
| `id` | Unique identifier for the user.
|
|
116
|
-
| `customVariables` | Custom attributes for targeting.
|
|
117
|
-
| `userAgent` | User agent string for identifying the user's browser and operating system.
|
|
118
|
-
| `ipAddress` | IP address of the user.
|
|
119
|
-
| `bucketingSeed` | Custom string used for bucketing instead of user `id`. See [Custom Bucketing Seed](#custom-bucketing-seed). | No
|
|
114
|
+
| **Parameter** | **Description** | **Required** | **Type** | **Example** |
|
|
115
|
+
| ----------------- | ----------------------------------------------------------------------------------------------------------- | ------------ | -------- | --------------------------------- |
|
|
116
|
+
| `id` | Unique identifier for the user. | Yes | String | `'unique_user_id'` |
|
|
117
|
+
| `customVariables` | Custom attributes for targeting. | No | Object | `{ age: 25, location: 'US' }` |
|
|
118
|
+
| `userAgent` | User agent string for identifying the user's browser and operating system. | No | String | `'Mozilla/5.0 ... Safari/537.36'` |
|
|
119
|
+
| `ipAddress` | IP address of the user. | No | String | `'1.1.1.1'` |
|
|
120
|
+
| `bucketingSeed` | Custom string used for bucketing instead of user `id`. See [Custom Bucketing Seed](#custom-bucketing-seed). | No | String | `'company-abc'` |
|
|
120
121
|
|
|
121
122
|
#### Example
|
|
122
123
|
|
|
@@ -612,6 +613,32 @@ With this configuration, the retry delays would be:
|
|
|
612
613
|
- 4th retry: 24 seconds (3 × 2^3)
|
|
613
614
|
- 5th retry: 48 seconds (3 × 2^4)
|
|
614
615
|
|
|
616
|
+
### HTTPS Agent Config
|
|
617
|
+
|
|
618
|
+
The `httpsAgentConfig` option lets you customize the underlying Node.js HTTPS agent used by the SDK for network calls. This is useful when you need finer control over TCP connection reuse, socket pool sizing, and timeouts.
|
|
619
|
+
|
|
620
|
+
| **Parameter** | **Description** | **Required** | **Type** | **Default** | **Minimum** |
|
|
621
|
+
| ---------------- | ----------------------------------------------------------------------- | ------------ | -------- | ----------- | ----------- |
|
|
622
|
+
| `keepAlive` | Reuse TCP connections so that multiple requests can use the same socket | No | Boolean | `true` | — |
|
|
623
|
+
| `maxSockets` | Maximum number of sockets allowed per host | No | Number | `100` | `50` |
|
|
624
|
+
| `maxFreeSockets` | Maximum number of sockets to leave open in a free state | No | Number | `20` | `10` |
|
|
625
|
+
| `timeout` | Socket timeout in milliseconds | No | Number | `60000` | `30000` |
|
|
626
|
+
|
|
627
|
+
If any field is missing or below the minimum, the SDK uses the default value for that field.
|
|
628
|
+
|
|
629
|
+
```javascript
|
|
630
|
+
const vwoClient = await init({
|
|
631
|
+
accountId: '123456',
|
|
632
|
+
sdkKey: '32-alpha-numeric-sdk-key',
|
|
633
|
+
httpsAgentConfig: {
|
|
634
|
+
keepAlive: true,
|
|
635
|
+
maxSockets: 100,
|
|
636
|
+
maxFreeSockets: 20,
|
|
637
|
+
timeout: 60000, // in milliseconds -- this is socket timeout
|
|
638
|
+
},
|
|
639
|
+
});
|
|
640
|
+
```
|
|
641
|
+
|
|
615
642
|
### Edge Config
|
|
616
643
|
|
|
617
644
|
The `edgeConfig` option enables edge/serverless environment optimizations. This configuration should only be passed in serverless environments (e.g., Cloudflare Workers). When used in Cloudflare environments, events are automatically flushed using `ctx.waitUntil(vwoClient.flushEvents());` to ensure proper event tracking after execution completes.
|
package/dist/VERSION.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports = { version: "1.
|
|
1
|
+
module.exports = { version: "1.43.0" };
|