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/client-entry.cjs +98 -3
- package/dist/client-entry.cjs.map +1 -1
- package/dist/client-entry.d.cts +99 -33
- package/dist/client-entry.d.ts +99 -33
- package/dist/client-entry.js +98 -4
- package/dist/client-entry.js.map +1 -1
- package/dist/index.cjs +11 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -1
- package/dist/{vocabulary-Cjd7p4_r.d.cts → vocabulary-uZXjYsxn.d.cts} +17 -1
- package/dist/{vocabulary-Cjd7p4_r.d.ts → vocabulary-uZXjYsxn.d.ts} +17 -1
- package/package.json +3 -2
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
|
}
|