@statsig/statsig-node-core 0.15.1 → 0.15.2-beta.2602031515
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/index.js +1 -32
- package/package.json +9 -10
- package/statsig-generated.d.ts +1 -8
package/index.js
CHANGED
|
@@ -22,13 +22,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
22
22
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
23
23
|
});
|
|
24
24
|
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
26
|
exports.Statsig = void 0;
|
|
30
27
|
const https_proxy_agent_1 = require("https-proxy-agent");
|
|
31
|
-
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
32
28
|
const console_capture_1 = require("./console_capture");
|
|
33
29
|
const error_boundary_1 = require("./error_boundary");
|
|
34
30
|
const statsig_generated_1 = require("./statsig-generated");
|
|
@@ -58,32 +54,6 @@ function createProxyAgent(options) {
|
|
|
58
54
|
}
|
|
59
55
|
return undefined; // node-fetch agent parameter takes in undefined type instead of null
|
|
60
56
|
}
|
|
61
|
-
function createFetchFunc(options) {
|
|
62
|
-
const proxyAgent = createProxyAgent(options);
|
|
63
|
-
return (method, url, headers, body) => __awaiter(this, void 0, void 0, function* () {
|
|
64
|
-
try {
|
|
65
|
-
const res = yield (0, node_fetch_1.default)(url, {
|
|
66
|
-
method,
|
|
67
|
-
headers: Object.assign({ 'accept-encoding': 'gzip, deflate, br' }, headers),
|
|
68
|
-
body: body ? Buffer.from(body) : undefined,
|
|
69
|
-
agent: proxyAgent,
|
|
70
|
-
});
|
|
71
|
-
const data = yield res.arrayBuffer();
|
|
72
|
-
const resHeaders = Object.fromEntries(res.headers.entries());
|
|
73
|
-
return {
|
|
74
|
-
status: res.status,
|
|
75
|
-
data: Array.from(new Uint8Array(data)),
|
|
76
|
-
headers: resHeaders,
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
catch (err) {
|
|
80
|
-
return {
|
|
81
|
-
status: 0,
|
|
82
|
-
error: 'message' in err ? err.message : 'Unknown Node Fetch Error',
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
57
|
class Statsig extends statsig_generated_1.StatsigNapiInternal {
|
|
88
58
|
static shared() {
|
|
89
59
|
if (!Statsig.hasShared()) {
|
|
@@ -109,8 +79,7 @@ class Statsig extends statsig_generated_1.StatsigNapiInternal {
|
|
|
109
79
|
}
|
|
110
80
|
constructor(sdkKey, options) {
|
|
111
81
|
var _a;
|
|
112
|
-
|
|
113
|
-
super(fetchFunc, sdkKey, options);
|
|
82
|
+
super(sdkKey, options);
|
|
114
83
|
error_boundary_1.ErrorBoundary.wrap(this);
|
|
115
84
|
if ((_a = options === null || options === void 0 ? void 0 : options.consoleCaptureOptions) === null || _a === void 0 ? void 0 : _a.enabled) {
|
|
116
85
|
(0, console_capture_1.startStatsigConsoleCapture)(sdkKey, options.consoleCaptureOptions);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@statsig/statsig-node-core",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.2-beta.2602031515",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "jest --colors"
|
|
@@ -55,14 +55,13 @@
|
|
|
55
55
|
]
|
|
56
56
|
},
|
|
57
57
|
"optionalDependencies": {
|
|
58
|
-
"@statsig/statsig-node-core-linux-x64-musl": "0.15.
|
|
59
|
-
"@statsig/statsig-node-core-linux-x64-gnu": "0.15.
|
|
60
|
-
"@statsig/statsig-node-core-win32-x64-msvc": "0.15.
|
|
61
|
-
"@statsig/statsig-node-core-darwin-x64": "0.15.
|
|
62
|
-
"@statsig/statsig-node-core-win32-ia32-msvc": "0.15.
|
|
63
|
-
"@statsig/statsig-node-core-linux-arm64-musl": "0.15.
|
|
64
|
-
"@statsig/statsig-node-core-linux-arm64-gnu": "0.15.
|
|
65
|
-
"@statsig/statsig-node-core-
|
|
66
|
-
"@statsig/statsig-node-core-darwin-arm64": "0.15.1"
|
|
58
|
+
"@statsig/statsig-node-core-linux-x64-musl": "0.15.2-beta.2602031515",
|
|
59
|
+
"@statsig/statsig-node-core-linux-x64-gnu": "0.15.2-beta.2602031515",
|
|
60
|
+
"@statsig/statsig-node-core-win32-x64-msvc": "0.15.2-beta.2602031515",
|
|
61
|
+
"@statsig/statsig-node-core-darwin-x64": "0.15.2-beta.2602031515",
|
|
62
|
+
"@statsig/statsig-node-core-win32-ia32-msvc": "0.15.2-beta.2602031515",
|
|
63
|
+
"@statsig/statsig-node-core-linux-arm64-musl": "0.15.2-beta.2602031515",
|
|
64
|
+
"@statsig/statsig-node-core-linux-arm64-gnu": "0.15.2-beta.2602031515",
|
|
65
|
+
"@statsig/statsig-node-core-darwin-arm64": "0.15.2-beta.2602031515"
|
|
67
66
|
}
|
|
68
67
|
}
|
package/statsig-generated.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export declare class StatsigNapiInternal {
|
|
|
12
12
|
unsubscribe(eventName: SdkEvent): void
|
|
13
13
|
unsubscribeById(subscriptionId: string): void
|
|
14
14
|
unsubscribeAll(): void
|
|
15
|
-
constructor(
|
|
15
|
+
constructor(sdkKey: string, options?: StatsigOptions | undefined | null)
|
|
16
16
|
initialize(): Promise<StatsigResult>
|
|
17
17
|
shutdown(timeoutMs?: number | undefined | null): Promise<StatsigResult>
|
|
18
18
|
flushEvents(): Promise<StatsigResult>
|
|
@@ -160,13 +160,6 @@ export interface LayerEvaluationOptions {
|
|
|
160
160
|
userPersistedValues?: Record<string, any>
|
|
161
161
|
}
|
|
162
162
|
|
|
163
|
-
export interface NapiNetworkFuncResult {
|
|
164
|
-
status: number
|
|
165
|
-
data?: Array<number>
|
|
166
|
-
headers?: Record<string, string>
|
|
167
|
-
error?: string
|
|
168
|
-
}
|
|
169
|
-
|
|
170
163
|
export interface ObservabilityClient {
|
|
171
164
|
initialize?: () => void
|
|
172
165
|
increment?: (metricName: string, value: number, tags: Record<string, string>) => void
|