expf-sigma-node.js 3.2.8 → 3.2.10
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/package.json +67 -63
- package/public/sigma.js +37 -5
package/package.json
CHANGED
|
@@ -1,63 +1,67 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "expf-sigma-node.js",
|
|
3
|
-
"version": "3.2.
|
|
4
|
-
"description": "expf-sigma-node.js lets you manage features flags and remote config across web, server side applications. Deliver true Continuous Integration. Get builds out faster. Control who has access to new features.",
|
|
5
|
-
"main": "public/sigma.js",
|
|
6
|
-
"keywords": [
|
|
7
|
-
"nodejs",
|
|
8
|
-
"sigma",
|
|
9
|
-
"feature flags",
|
|
10
|
-
"feature toggles",
|
|
11
|
-
"remote configuration",
|
|
12
|
-
"continuous deployment"
|
|
13
|
-
],
|
|
14
|
-
"homepage": "https://docs.expf.ru",
|
|
15
|
-
"bugs": {
|
|
16
|
-
"url": "https://expf-team.ru/sigma/node_js_sdk/issues"
|
|
17
|
-
},
|
|
18
|
-
"author": "iskander.mirmakhmadov",
|
|
19
|
-
"license": "Apache-2.0",
|
|
20
|
-
"scripts": {
|
|
21
|
-
"release": "np",
|
|
22
|
-
"build": "node esbuild.js",
|
|
23
|
-
"dev": "esbuild --bundle ./src/sigma.js --platform=node --format=cjs --outdir=public --watch",
|
|
24
|
-
"lint": "eslint ./src/sigma.js",
|
|
25
|
-
"lint:all": "eslint \"**/*.js\"",
|
|
26
|
-
"test": "jest"
|
|
27
|
-
},
|
|
28
|
-
"dependencies": {
|
|
29
|
-
"node-cache": "^5.1.2",
|
|
30
|
-
"node-fetch": "^2.6.8"
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
"babel
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"eslint
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
},
|
|
52
|
-
"
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "expf-sigma-node.js",
|
|
3
|
+
"version": "3.2.10",
|
|
4
|
+
"description": "expf-sigma-node.js lets you manage features flags and remote config across web, server side applications. Deliver true Continuous Integration. Get builds out faster. Control who has access to new features.",
|
|
5
|
+
"main": "public/sigma.js",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"nodejs",
|
|
8
|
+
"sigma",
|
|
9
|
+
"feature flags",
|
|
10
|
+
"feature toggles",
|
|
11
|
+
"remote configuration",
|
|
12
|
+
"continuous deployment"
|
|
13
|
+
],
|
|
14
|
+
"homepage": "https://docs.expf.ru",
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://expf-team.ru/sigma/node_js_sdk/issues"
|
|
17
|
+
},
|
|
18
|
+
"author": "iskander.mirmakhmadov",
|
|
19
|
+
"license": "Apache-2.0",
|
|
20
|
+
"scripts": {
|
|
21
|
+
"release": "np",
|
|
22
|
+
"build": "node esbuild.js",
|
|
23
|
+
"dev": "esbuild --bundle ./src/sigma.js --platform=node --format=cjs --outdir=public --watch",
|
|
24
|
+
"lint": "eslint ./src/sigma.js",
|
|
25
|
+
"lint:all": "eslint \"**/*.js\"",
|
|
26
|
+
"test": "jest"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"node-cache": "^5.1.2",
|
|
30
|
+
"node-fetch": "^2.6.8",
|
|
31
|
+
"ua-parser-js": "^1.0.35"
|
|
32
|
+
},
|
|
33
|
+
"engines": {
|
|
34
|
+
"node": ">=18.0.0"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@babel/core": "^7.20.12",
|
|
38
|
+
"@babel/preset-env": "^7.20.2",
|
|
39
|
+
"babel-eslint": "^10.1.0",
|
|
40
|
+
"babel-jest": "^29.2.2",
|
|
41
|
+
"babel-loader": "^8.3.0",
|
|
42
|
+
"esbuild": "^0.14.25",
|
|
43
|
+
"esbuild-node-externals": "^1.6.0",
|
|
44
|
+
"eslint": "^6.8.0",
|
|
45
|
+
"eslint-config-prettier": "^6.10.1",
|
|
46
|
+
"eslint-plugin-jest": "^23.8.2",
|
|
47
|
+
"eslint-plugin-node": "^11.1.0",
|
|
48
|
+
"eslint-plugin-prettier": "^3.1.3",
|
|
49
|
+
"jest": "^29.2.2",
|
|
50
|
+
"prettier": "^2.2.1"
|
|
51
|
+
},
|
|
52
|
+
"repository": {
|
|
53
|
+
"type": "git",
|
|
54
|
+
"url": "https://expf-team.ru/sigma/server_node_js_sdk"
|
|
55
|
+
},
|
|
56
|
+
"npmName": "expf-sigma-node.js",
|
|
57
|
+
"npmFileMap": [
|
|
58
|
+
{
|
|
59
|
+
"files": [
|
|
60
|
+
"public/*"
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
"files": [
|
|
65
|
+
"public/*"
|
|
66
|
+
]
|
|
67
|
+
}
|
package/public/sigma.js
CHANGED
|
@@ -31,6 +31,7 @@ module.exports = __toCommonJS(sigma_exports);
|
|
|
31
31
|
var import_node_fetch = __toESM(require("node-fetch"));
|
|
32
32
|
|
|
33
33
|
// src/modules/sigmaUserData.js
|
|
34
|
+
var import_ua_parser_js = __toESM(require("ua-parser-js"));
|
|
34
35
|
var SigmaUserData = class {
|
|
35
36
|
platform = "all";
|
|
36
37
|
constructor() {
|
|
@@ -104,6 +105,36 @@ var SigmaUserData = class {
|
|
|
104
105
|
this.user.query = query;
|
|
105
106
|
this.user.pathname = pathname;
|
|
106
107
|
}
|
|
108
|
+
getUserBrowser(ua) {
|
|
109
|
+
const { user } = this;
|
|
110
|
+
if (!ua) {
|
|
111
|
+
return user.browser = {
|
|
112
|
+
name: null,
|
|
113
|
+
version: null
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
const userAgentParser = new import_ua_parser_js.default(ua);
|
|
117
|
+
const browser = userAgentParser.getBrowser();
|
|
118
|
+
return user.browser = {
|
|
119
|
+
name: browser.name || void 0,
|
|
120
|
+
version: browser.version || void 0
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
getUserOs(ua) {
|
|
124
|
+
const { user } = this;
|
|
125
|
+
if (!ua) {
|
|
126
|
+
return user.os = {
|
|
127
|
+
name: null,
|
|
128
|
+
version: null
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
const userAgentParser = new import_ua_parser_js.default(ua);
|
|
132
|
+
const os = userAgentParser.getOS();
|
|
133
|
+
return user.os = {
|
|
134
|
+
name: os.name || void 0,
|
|
135
|
+
version: os.version || void 0
|
|
136
|
+
};
|
|
137
|
+
}
|
|
107
138
|
setUserId(userId) {
|
|
108
139
|
this.user.userId = userId;
|
|
109
140
|
}
|
|
@@ -1108,7 +1139,7 @@ function generateFilteredList(array, name) {
|
|
|
1108
1139
|
}
|
|
1109
1140
|
|
|
1110
1141
|
// package.json
|
|
1111
|
-
var version = "3.2.
|
|
1142
|
+
var version = "3.2.10";
|
|
1112
1143
|
|
|
1113
1144
|
// src/helpers/sdkVersion.js
|
|
1114
1145
|
var sdkVersion = version;
|
|
@@ -1144,13 +1175,14 @@ var Sigma = class {
|
|
|
1144
1175
|
appVersion: this.userData.appVersion || null,
|
|
1145
1176
|
custom: this.userData.custom || null,
|
|
1146
1177
|
deviceCategory: this.userData.deviceCategory || null,
|
|
1147
|
-
browser: this.userData.browser ||
|
|
1148
|
-
os: this.userData.os ||
|
|
1178
|
+
browser: this.userData.browser || this.sigmaUserData.getUserBrowser(this.userData.ua),
|
|
1179
|
+
os: this.userData.os || this.sigmaUserData.getUserOs(this.userData.ua),
|
|
1149
1180
|
geo: this.userData.geo || null,
|
|
1150
1181
|
domain: this.userData.domain || null,
|
|
1151
1182
|
url: this.userData.url || null,
|
|
1152
1183
|
query: this.userData.query || null,
|
|
1153
|
-
pathname: this.userData.pathname || null
|
|
1184
|
+
pathname: this.userData.pathname || null,
|
|
1185
|
+
ua: this.userData.ua || void 0
|
|
1154
1186
|
});
|
|
1155
1187
|
this.setSplitIdsToCache(this.userData);
|
|
1156
1188
|
this.makePrivateIdInCache();
|
|
@@ -1565,7 +1597,7 @@ var Sigma = class {
|
|
|
1565
1597
|
return {
|
|
1566
1598
|
getParamValue,
|
|
1567
1599
|
getFeatureValue,
|
|
1568
|
-
groupIndex
|
|
1600
|
+
groupIndex: groupIndex < 0 ? null : groupIndex
|
|
1569
1601
|
};
|
|
1570
1602
|
}
|
|
1571
1603
|
async getAllUserExperiments() {
|