kaafil-js 0.1.0-beta.7 → 0.1.0

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.
@@ -1478,6 +1478,10 @@ var CredentialResolver = class {
1478
1478
  };
1479
1479
 
1480
1480
  // src/config.ts
1481
+ var Environment = {
1482
+ Live: "live",
1483
+ Test: "test"
1484
+ };
1481
1485
  var ENVIRONMENT_BASE_URLS = {
1482
1486
  live: "https://engine.kaafil.in",
1483
1487
  test: "https://engine.kaafil.in"
@@ -1488,6 +1492,16 @@ var KaafilConfigError = class extends Error {
1488
1492
  this.name = "KaafilConfigError";
1489
1493
  }
1490
1494
  };
1495
+ function describeConfigValue(value) {
1496
+ return typeof value === "string" ? `"${value}"` : String(value);
1497
+ }
1498
+ function assertValidEnvironment(environment) {
1499
+ if (environment !== Environment.Live && environment !== Environment.Test) {
1500
+ throw new KaafilConfigError(
1501
+ `"environment" is required and must be "${Environment.Live}" or "${Environment.Test}"; received ${describeConfigValue(environment)}.`
1502
+ );
1503
+ }
1504
+ }
1491
1505
  function isValidAbsoluteUrl(value) {
1492
1506
  try {
1493
1507
  const url = new URL(value);
@@ -1497,6 +1511,7 @@ function isValidAbsoluteUrl(value) {
1497
1511
  }
1498
1512
  }
1499
1513
  function resolveBaseUrl(environment, baseUrl) {
1514
+ assertValidEnvironment(environment);
1500
1515
  if (baseUrl === void 0) {
1501
1516
  return ENVIRONMENT_BASE_URLS[environment];
1502
1517
  }
@@ -3510,6 +3525,7 @@ function createOfflineEngine(options) {
3510
3525
  async open() {
3511
3526
  await Promise.all([snapshot.load(), outbox.load(), blobs?.load() ?? Promise.resolve()]);
3512
3527
  unbind = drainer.bindOpportunisticTriggers();
3528
+ drainer.kick();
3513
3529
  },
3514
3530
  enqueue,
3515
3531
  async enqueueWithBlob(input) {