@ops-ai/react-router-toggly 1.2.0 → 1.2.1
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 +5 -0
- package/dist/client.cjs +10 -18
- package/dist/client.cjs.map +1 -1
- package/dist/client.js +10 -18
- package/dist/client.js.map +1 -1
- package/dist/server.cjs +47 -47
- package/dist/server.cjs.map +1 -1
- package/dist/server.js +47 -47
- package/dist/server.js.map +1 -1
- package/dist/telemetry/grpc.cjs +1 -1
- package/dist/telemetry/grpc.cjs.map +1 -1
- package/dist/telemetry/grpc.js +1 -1
- package/dist/telemetry/grpc.js.map +1 -1
- package/package.json +1 -1
package/dist/server.cjs
CHANGED
|
@@ -333,10 +333,7 @@ var UsageBatcher = class {
|
|
|
333
333
|
featureCount() {
|
|
334
334
|
return this.perFeature.size;
|
|
335
335
|
}
|
|
336
|
-
|
|
337
|
-
if (this.isEmpty()) {
|
|
338
|
-
return null;
|
|
339
|
-
}
|
|
336
|
+
buildPayload() {
|
|
340
337
|
const payload = {
|
|
341
338
|
appKey: this.appKey,
|
|
342
339
|
environment: this.environment,
|
|
@@ -346,57 +343,60 @@ var UsageBatcher = class {
|
|
|
346
343
|
uniqueUserHashes: [...this.appUnique],
|
|
347
344
|
processStartTime: toProtobufTimestamp(this.processStartTime)
|
|
348
345
|
};
|
|
349
|
-
if (this.instanceName)
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
if (this.
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
346
|
+
if (this.instanceName) payload.instanceName = this.instanceName;
|
|
347
|
+
if (this.appVersion) payload.appVersion = this.appVersion;
|
|
348
|
+
if (this.definitionCacheHits > 0) payload.definitionCacheHits = this.definitionCacheHits;
|
|
349
|
+
if (this.definitionCacheMisses > 0) payload.definitionCacheMisses = this.definitionCacheMisses;
|
|
350
|
+
return payload;
|
|
351
|
+
}
|
|
352
|
+
appendFeatureStat(payload, snapshots, feature, agg) {
|
|
353
|
+
const variantStats = {};
|
|
354
|
+
for (const [name, stats] of agg.variantStats) {
|
|
355
|
+
if (stats.checkCount > 0 || stats.requestCount > 0 || stats.usedCount > 0 || stats.viewedCount > 0) {
|
|
356
|
+
variantStats[name] = { ...stats };
|
|
357
|
+
}
|
|
360
358
|
}
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
359
|
+
if (agg.uniqueUsersEnabled.size > 0) snapshots.uniqueUsersEnabled[feature] = [...agg.uniqueUsersEnabled];
|
|
360
|
+
if (agg.uniqueUsersDisabled.size > 0) snapshots.uniqueUsersDisabled[feature] = [...agg.uniqueUsersDisabled];
|
|
361
|
+
if (agg.uniqueUsersUsed.size > 0) snapshots.uniqueUsersUsed[feature] = [...agg.uniqueUsersUsed];
|
|
362
|
+
payload.stats.push({
|
|
363
|
+
feature,
|
|
364
|
+
uniqueContextIdentifierEnabledCount: agg.uniqueUsersEnabled.size,
|
|
365
|
+
uniqueContextIdentifierDisabledCount: agg.uniqueUsersDisabled.size,
|
|
366
|
+
uniqueUsersUsedCount: agg.uniqueUsersUsed.size,
|
|
367
|
+
uniqueUserHashes: [...agg.uniqueUserHashes],
|
|
368
|
+
uniqueViewedUserHashes: [...agg.uniqueViewedUserHashes],
|
|
369
|
+
variantStats
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
buildIdentitySnapshots(payload) {
|
|
373
|
+
const snapshots = {
|
|
374
|
+
uniqueUsersEnabled: {},
|
|
375
|
+
uniqueUsersDisabled: {},
|
|
376
|
+
uniqueUsersUsed: {}
|
|
377
|
+
};
|
|
364
378
|
for (const [feature, agg] of this.perFeature) {
|
|
365
|
-
|
|
366
|
-
for (const [name, stats] of agg.variantStats) {
|
|
367
|
-
if (stats.checkCount > 0 || stats.requestCount > 0 || stats.usedCount > 0 || stats.viewedCount > 0) {
|
|
368
|
-
variantStats[name] = { ...stats };
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
if (agg.uniqueUsersEnabled.size > 0) {
|
|
372
|
-
uniqueUsersEnabled[feature] = [...agg.uniqueUsersEnabled];
|
|
373
|
-
}
|
|
374
|
-
if (agg.uniqueUsersDisabled.size > 0) {
|
|
375
|
-
uniqueUsersDisabled[feature] = [...agg.uniqueUsersDisabled];
|
|
376
|
-
}
|
|
377
|
-
if (agg.uniqueUsersUsed.size > 0) {
|
|
378
|
-
uniqueUsersUsed[feature] = [...agg.uniqueUsersUsed];
|
|
379
|
-
}
|
|
380
|
-
payload.stats.push({
|
|
381
|
-
feature,
|
|
382
|
-
uniqueContextIdentifierEnabledCount: agg.uniqueUsersEnabled.size,
|
|
383
|
-
uniqueContextIdentifierDisabledCount: agg.uniqueUsersDisabled.size,
|
|
384
|
-
uniqueUsersUsedCount: agg.uniqueUsersUsed.size,
|
|
385
|
-
uniqueUserHashes: [...agg.uniqueUserHashes],
|
|
386
|
-
uniqueViewedUserHashes: [...agg.uniqueViewedUserHashes],
|
|
387
|
-
variantStats
|
|
388
|
-
});
|
|
379
|
+
this.appendFeatureStat(payload, snapshots, feature, agg);
|
|
389
380
|
}
|
|
381
|
+
return snapshots;
|
|
382
|
+
}
|
|
383
|
+
reset() {
|
|
390
384
|
this.perFeature = /* @__PURE__ */ new Map();
|
|
391
385
|
this.appUnique = /* @__PURE__ */ new Set();
|
|
392
386
|
this.droppedFeatures = false;
|
|
393
387
|
this.definitionCacheHits = 0;
|
|
394
388
|
this.definitionCacheMisses = 0;
|
|
389
|
+
}
|
|
390
|
+
buildAndReset() {
|
|
391
|
+
if (this.isEmpty()) {
|
|
392
|
+
return null;
|
|
393
|
+
}
|
|
394
|
+
const payload = this.buildPayload();
|
|
395
|
+
const snapshots = this.buildIdentitySnapshots(payload);
|
|
396
|
+
this.reset();
|
|
395
397
|
return {
|
|
396
398
|
payload,
|
|
397
|
-
|
|
398
|
-
uniqueUsersDisabled,
|
|
399
|
-
uniqueUsersUsed
|
|
399
|
+
...snapshots
|
|
400
400
|
};
|
|
401
401
|
}
|
|
402
402
|
restoreFromBundle(bundle) {
|
|
@@ -587,7 +587,7 @@ var MetricsBatcher = class {
|
|
|
587
587
|
|
|
588
588
|
// src/core/sdk-identity.ts
|
|
589
589
|
var SDK_ID = "react-router";
|
|
590
|
-
var SDK_VERSION = "1.2.
|
|
590
|
+
var SDK_VERSION = "1.2.1";
|
|
591
591
|
function sdkUserAgent() {
|
|
592
592
|
return `toggly-${SDK_ID}/${SDK_VERSION}`;
|
|
593
593
|
}
|
|
@@ -1107,7 +1107,7 @@ async function extractEvalContext(request, providers = {}) {
|
|
|
1107
1107
|
|
|
1108
1108
|
// src/server/sdk-identity.ts
|
|
1109
1109
|
var SDK_ID2 = "react-router";
|
|
1110
|
-
var SDK_VERSION2 = "1.2.
|
|
1110
|
+
var SDK_VERSION2 = "1.2.1";
|
|
1111
1111
|
var SDK_HEADER_ID = "X-Toggly-Sdk";
|
|
1112
1112
|
var SDK_HEADER_VERSION = "X-Toggly-Sdk-Version";
|
|
1113
1113
|
function sdkUserAgent2() {
|