@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.d.cts CHANGED
@@ -202,6 +202,7 @@ declare class BoundQuonfig {
202
202
  defaultLevel?: string;
203
203
  contexts?: Contexts;
204
204
  }): boolean;
205
+ flush(): Promise<void>;
205
206
  keys(): string[];
206
207
  inContext(contexts: Contexts): BoundQuonfig;
207
208
  }
@@ -303,6 +304,18 @@ declare class Quonfig {
303
304
  * Create a BoundQuonfig with the given context baked in.
304
305
  */
305
306
  inContext(contexts: Contexts): BoundQuonfig;
307
+ /**
308
+ * Flush pending telemetry data immediately. Useful in serverless environments
309
+ * (Vercel, Lambda) where the process may be frozen before the background
310
+ * timer fires.
311
+ *
312
+ * ```typescript
313
+ * const value = quonfig.get("my-flag", contexts);
314
+ * await quonfig.flush();
315
+ * return NextResponse.json({ value });
316
+ * ```
317
+ */
318
+ flush(): Promise<void>;
306
319
  /**
307
320
  * Close the SDK. Stops SSE, polling, and telemetry.
308
321
  */
@@ -674,7 +687,7 @@ declare class TelemetryReporter {
674
687
  */
675
688
  stop(): void;
676
689
  private scheduleNext;
677
- private sync;
690
+ sync(): Promise<void>;
678
691
  }
679
692
 
680
693
  /**
package/dist/index.d.ts CHANGED
@@ -202,6 +202,7 @@ declare class BoundQuonfig {
202
202
  defaultLevel?: string;
203
203
  contexts?: Contexts;
204
204
  }): boolean;
205
+ flush(): Promise<void>;
205
206
  keys(): string[];
206
207
  inContext(contexts: Contexts): BoundQuonfig;
207
208
  }
@@ -303,6 +304,18 @@ declare class Quonfig {
303
304
  * Create a BoundQuonfig with the given context baked in.
304
305
  */
305
306
  inContext(contexts: Contexts): BoundQuonfig;
307
+ /**
308
+ * Flush pending telemetry data immediately. Useful in serverless environments
309
+ * (Vercel, Lambda) where the process may be frozen before the background
310
+ * timer fires.
311
+ *
312
+ * ```typescript
313
+ * const value = quonfig.get("my-flag", contexts);
314
+ * await quonfig.flush();
315
+ * return NextResponse.json({ value });
316
+ * ```
317
+ */
318
+ flush(): Promise<void>;
306
319
  /**
307
320
  * Close the SDK. Stops SSE, polling, and telemetry.
308
321
  */
@@ -674,7 +687,7 @@ declare class TelemetryReporter {
674
687
  */
675
688
  stop(): void;
676
689
  private scheduleNext;
677
- private sync;
690
+ sync(): Promise<void>;
678
691
  }
679
692
 
680
693
  /**
package/dist/index.js CHANGED
@@ -1022,7 +1022,10 @@ function shouldLog(args) {
1022
1022
  while (loggerNameWithPrefix.includes(".")) {
1023
1023
  const resolvedLevel = getConfig(loggerNameWithPrefix);
1024
1024
  if (resolvedLevel !== void 0) {
1025
- return Number(resolvedLevel) <= desiredLevel;
1025
+ const resolvedLevelNum = parseLevel(resolvedLevel);
1026
+ if (resolvedLevelNum !== void 0) {
1027
+ return resolvedLevelNum <= desiredLevel;
1028
+ }
1026
1029
  }
1027
1030
  loggerNameWithPrefix = loggerNameWithPrefix.slice(
1028
1031
  0,
@@ -1426,6 +1429,9 @@ var BoundQuonfig = class _BoundQuonfig {
1426
1429
  contexts: mergeContexts(this.boundContexts, args.contexts)
1427
1430
  });
1428
1431
  }
1432
+ async flush() {
1433
+ return this.client.flush();
1434
+ }
1429
1435
  keys() {
1430
1436
  return this.client.keys();
1431
1437
  }
@@ -1664,6 +1670,22 @@ var Quonfig = class {
1664
1670
  inContext(contexts) {
1665
1671
  return new BoundQuonfig(this, mergeContexts(this.globalContext, contexts));
1666
1672
  }
1673
+ /**
1674
+ * Flush pending telemetry data immediately. Useful in serverless environments
1675
+ * (Vercel, Lambda) where the process may be frozen before the background
1676
+ * timer fires.
1677
+ *
1678
+ * ```typescript
1679
+ * const value = quonfig.get("my-flag", contexts);
1680
+ * await quonfig.flush();
1681
+ * return NextResponse.json({ value });
1682
+ * ```
1683
+ */
1684
+ async flush() {
1685
+ if (this.telemetryReporter) {
1686
+ await this.telemetryReporter.sync();
1687
+ }
1688
+ }
1667
1689
  /**
1668
1690
  * Close the SDK. Stops SSE, polling, and telemetry.
1669
1691
  */