@towns-protocol/dlog 0.0.346 → 0.0.348
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/envUtils.d.ts +4 -5
- package/dist/envUtils.d.ts.map +1 -1
- package/dist/envUtils.js +10 -16
- package/dist/envUtils.js.map +1 -1
- package/package.json +3 -3
package/dist/envUtils.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
1
|
+
export interface SafeEnvOpts {
|
|
2
|
+
env?: Record<string, string>;
|
|
3
|
+
keyPrefix?: string;
|
|
5
4
|
}
|
|
6
|
-
export declare function safeEnv(keys: string[]): string | undefined;
|
|
5
|
+
export declare function safeEnv(keys: string[], opts?: SafeEnvOpts): string | undefined;
|
|
7
6
|
//# sourceMappingURL=envUtils.d.ts.map
|
package/dist/envUtils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"envUtils.d.ts","sourceRoot":"","sources":["../src/envUtils.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"envUtils.d.ts","sourceRoot":"","sources":["../src/envUtils.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAExB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAE5B,SAAS,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,SAAS,CAkB9E"}
|
package/dist/envUtils.js
CHANGED
|
@@ -1,25 +1,19 @@
|
|
|
1
|
-
export function safeEnv(keys) {
|
|
2
|
-
for (const
|
|
1
|
+
export function safeEnv(keys, opts) {
|
|
2
|
+
for (const keyRef of keys) {
|
|
3
|
+
// check for key prefix
|
|
4
|
+
const key = opts?.keyPrefix ? `${opts.keyPrefix}${keyRef}` : keyRef;
|
|
5
|
+
// check for key in env
|
|
6
|
+
if (opts?.env) {
|
|
7
|
+
if (opts.env[key]) {
|
|
8
|
+
return opts.env[key];
|
|
9
|
+
}
|
|
10
|
+
}
|
|
3
11
|
// look for the key in process.env
|
|
4
12
|
if (typeof process === 'object' && 'env' in process) {
|
|
5
13
|
if (process.env[key]) {
|
|
6
14
|
return process.env[key];
|
|
7
15
|
}
|
|
8
16
|
}
|
|
9
|
-
// look for the key in process.env.VITE_ for vite apps
|
|
10
|
-
if (typeof import.meta === 'object' && 'env' in import.meta) {
|
|
11
|
-
// first check if the key is directly set in the import.meta.env
|
|
12
|
-
// for server side rendering it could be passed in,
|
|
13
|
-
// or perhaps somehow you specified the vite in the key alread for some reason
|
|
14
|
-
if (import.meta.env[key]) {
|
|
15
|
-
return import.meta.env[key];
|
|
16
|
-
}
|
|
17
|
-
// otherwise check for the vite prefix, this is the only way to pass env variables to the web client
|
|
18
|
-
const viteKey = `VITE_${key}`;
|
|
19
|
-
if (import.meta.env[viteKey]) {
|
|
20
|
-
return import.meta.env[viteKey];
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
17
|
}
|
|
24
18
|
return undefined;
|
|
25
19
|
}
|
package/dist/envUtils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"envUtils.js","sourceRoot":"","sources":["../src/envUtils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"envUtils.js","sourceRoot":"","sources":["../src/envUtils.ts"],"names":[],"mappings":"AAOA,MAAM,UAAU,OAAO,CAAC,IAAc,EAAE,IAAkB;IACtD,KAAK,MAAM,MAAM,IAAI,IAAI,EAAE,CAAC;QACxB,uBAAuB;QACvB,MAAM,GAAG,GAAG,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,SAAS,GAAG,MAAM,EAAE,CAAC,CAAC,CAAC,MAAM,CAAA;QACnE,uBAAuB;QACvB,IAAI,IAAI,EAAE,GAAG,EAAE,CAAC;YACZ,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;gBAChB,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;YACxB,CAAC;QACL,CAAC;QACD,kCAAkC;QAClC,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,KAAK,IAAI,OAAO,EAAE,CAAC;YAClD,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;gBACnB,OAAO,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;YAC3B,CAAC;QACL,CAAC;IACL,CAAC;IACD,OAAO,SAAS,CAAA;AACpB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@towns-protocol/dlog",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.348",
|
|
4
4
|
"packageManager": "yarn@3.8.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@bufbuild/protobuf": "^2.2.2",
|
|
22
|
-
"@towns-protocol/proto": "^0.0.
|
|
22
|
+
"@towns-protocol/proto": "^0.0.348",
|
|
23
23
|
"debug": "^4.3.4",
|
|
24
24
|
"ethereum-cryptography": "^3.2.0"
|
|
25
25
|
},
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"publishConfig": {
|
|
41
41
|
"access": "public"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "9d7daa617491dac9ea70b18ae5622b5ebb695119"
|
|
44
44
|
}
|