kaafil-js 0.1.0-beta.7 → 0.2.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.
package/dist/index.cjs CHANGED
@@ -1520,6 +1520,16 @@ var ApiKeyEnvironmentMismatchError = class extends KaafilConfigError {
1520
1520
  this.keyPrefix = keyPrefix;
1521
1521
  }
1522
1522
  };
1523
+ function describeConfigValue(value) {
1524
+ return typeof value === "string" ? `"${value}"` : String(value);
1525
+ }
1526
+ function assertValidEnvironment(environment) {
1527
+ if (environment !== Environment.Live && environment !== Environment.Test) {
1528
+ throw new KaafilConfigError(
1529
+ `"environment" is required and must be "${Environment.Live}" or "${Environment.Test}"; received ${describeConfigValue(environment)}.`
1530
+ );
1531
+ }
1532
+ }
1523
1533
  function isValidAbsoluteUrl(value) {
1524
1534
  try {
1525
1535
  const url = new URL(value);
@@ -1529,6 +1539,7 @@ function isValidAbsoluteUrl(value) {
1529
1539
  }
1530
1540
  }
1531
1541
  function resolveBaseUrl(environment, baseUrl) {
1542
+ assertValidEnvironment(environment);
1532
1543
  if (baseUrl === void 0) {
1533
1544
  return ENVIRONMENT_BASE_URLS[environment];
1534
1545
  }