@quonfig/node 0.0.2 → 0.0.3

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/dist/index.cjs CHANGED
@@ -1115,7 +1115,10 @@ function shouldLog(args) {
1115
1115
  while (loggerNameWithPrefix.includes(".")) {
1116
1116
  const resolvedLevel = getConfig(loggerNameWithPrefix);
1117
1117
  if (resolvedLevel !== void 0) {
1118
- return Number(resolvedLevel) <= desiredLevel;
1118
+ const resolvedLevelNum = parseLevel(resolvedLevel);
1119
+ if (resolvedLevelNum !== void 0) {
1120
+ return resolvedLevelNum <= desiredLevel;
1121
+ }
1119
1122
  }
1120
1123
  loggerNameWithPrefix = loggerNameWithPrefix.slice(
1121
1124
  0,
@@ -1519,6 +1522,9 @@ var BoundQuonfig = class _BoundQuonfig {
1519
1522
  contexts: mergeContexts(this.boundContexts, args.contexts)
1520
1523
  });
1521
1524
  }
1525
+ async flush() {
1526
+ return this.client.flush();
1527
+ }
1522
1528
  keys() {
1523
1529
  return this.client.keys();
1524
1530
  }
@@ -1757,6 +1763,22 @@ var Quonfig = class {
1757
1763
  inContext(contexts) {
1758
1764
  return new BoundQuonfig(this, mergeContexts(this.globalContext, contexts));
1759
1765
  }
1766
+ /**
1767
+ * Flush pending telemetry data immediately. Useful in serverless environments
1768
+ * (Vercel, Lambda) where the process may be frozen before the background
1769
+ * timer fires.
1770
+ *
1771
+ * ```typescript
1772
+ * const value = quonfig.get("my-flag", contexts);
1773
+ * await quonfig.flush();
1774
+ * return NextResponse.json({ value });
1775
+ * ```
1776
+ */
1777
+ async flush() {
1778
+ if (this.telemetryReporter) {
1779
+ await this.telemetryReporter.sync();
1780
+ }
1781
+ }
1760
1782
  /**
1761
1783
  * Close the SDK. Stops SSE, polling, and telemetry.
1762
1784
  */