@theholocron/http-client 1.42.0 → 1.43.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.mjs +4 -3
- package/package.json +2 -1
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createEnvLookup, firstEnv } from "@theholocron/env-utils/lookup";
|
|
1
2
|
import { NoopErrorSink, NoopLogger } from "@theholocron/observability/core";
|
|
2
3
|
//#region src/auth-resolver.ts
|
|
3
4
|
var AuthError = class extends Error {
|
|
@@ -20,10 +21,10 @@ var AuthError = class extends Error {
|
|
|
20
21
|
function createResolveToken(config) {
|
|
21
22
|
const defaultKeyring = config.getKeyringToken ?? (() => null);
|
|
22
23
|
return function resolveToken(input = {}) {
|
|
23
|
-
const env = input.env ?? process.env;
|
|
24
|
+
const env = createEnvLookup(input.env ?? process.env);
|
|
24
25
|
const keyring = input.keyring ?? defaultKeyring;
|
|
25
|
-
const org = input.org ?? env
|
|
26
|
-
const token = input.cliToken || env[config.envName
|
|
26
|
+
const org = input.org ?? env.get("HOLOCRON_ORG");
|
|
27
|
+
const token = input.cliToken || firstEnv(env, [config.envName, config.vendorEnvName]) || (org ? keyring(`${config.keyringService}.${org}`) : null) || keyring(config.keyringService);
|
|
27
28
|
if (!token) throw new AuthError(config.errorMessage);
|
|
28
29
|
return token;
|
|
29
30
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theholocron/http-client",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.43.0",
|
|
4
4
|
"description": "Shared HTTP primitives for theholocron — REST client factory, auth resolver, and error types",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"dist"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
+
"@theholocron/env-utils": "^1.15.1",
|
|
39
40
|
"@theholocron/observability": "^0.3.0"
|
|
40
41
|
},
|
|
41
42
|
"devDependencies": {
|