@mcp-com-ai/shared-utils 1.0.1-beta.260912 → 1.0.2-beta.260914

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/runtime.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- var F=Object.create;var{getPrototypeOf:N,defineProperty:Y,getOwnPropertyNames:O}=Object;var W=Object.prototype.hasOwnProperty;function z(j){return this[j]}var A,V,b=(j,q,w)=>{var D=j!=null&&typeof j==="object";if(D){var G=q?A??=new WeakMap:V??=new WeakMap,I=G.get(j);if(I)return I}w=j!=null?F(N(j)):{};let J=q||!j||!j.__esModule?Y(w,"default",{value:j,enumerable:!0}):w;for(let K of O(j))if(!W.call(J,K))Y(J,K,{get:z.bind(j,K),enumerable:!0});if(D)G.set(j,J);return J};var C=(j,q)=>()=>(q||j((q={exports:{}}).exports,q),q.exports);var h=import.meta.require;var M={},P=Q(),L=P.isBunRuntime,Z=P.isCloudflareRuntime,B=P.isNodeRuntime,_=P.hasFileSystemAccess,S=P.console,$=M;X();function g(j,q){let w=typeof process<"u"?process.env:void 0,D=w?w[j]:void 0,G=L?Bun?.env?.[j]:void 0,I=$[j],J=typeof I==="string"?I:void 0,K=Z?J??D??G:D??G??J;return K===void 0||K===""?q:K}function p(j,q){if(typeof process<"u")process.env[j]=q;$[j]=q}function c(j){globalThis.__hapiRuntimeOverride="cloudflare",H(),Object.assign(M,j)}function s(){delete globalThis.__hapiRuntimeOverride,H()}async function v(j){if(!L)throw Error(`File system access not available in this runtime: ${j}`);return await Bun.file(j).text()}async function m(j){if(!L)throw Error(`File system access not available in this runtime: ${j}`);return await Bun.file(j).json()}async function d(j){return L?await Bun.file(j).exists():!1}function a(j){if(!L)throw Error(`File system access not available in this runtime: ${j}`);return Bun.file(j)}function H(){let j=Q();U(j),X()}function l(){if(_)return;if(T()!==void 0)return;let j=Q();U(j),X()}function Q(){let j=T(),q=E(j),w=q?!1:y(j),D=f(j,w);return{isBunRuntime:q,isCloudflareRuntime:w,isNodeRuntime:D,hasFileSystemAccess:!w&&(q||D),console:k()}}function E(j){if(j==="bun")return!0;if(j==="cloudflare"||j==="node")return!1;return typeof Bun<"u"}function y(j){if(j==="cloudflare")return!0;if(j==="bun"||j==="node")return!1;let q=typeof globalThis<"u"?globalThis:void 0,w=q?.navigator?.userAgent??"",D=typeof w==="string"&&w.includes("Cloudflare-Workers"),G=typeof q?.__ENVIRONMENT__==="string"&&q.__ENVIRONMENT__.toLowerCase()==="workerd",I=typeof q?.caches?.default<"u";return D||G||I}function f(j,q){if(j==="node")return!0;if(j==="bun"||j==="cloudflare")return!1;if(q)return!1;let w=typeof process<"u"?process.versions?.node:void 0;return typeof w==="string"&&w.length>0}function T(){return typeof globalThis<"u"?globalThis.__hapiRuntimeOverride:void 0}function k(){let j=()=>{},q=typeof console<"u"?console:void 0;if(!q)return{log:j,info:j,warn:j,error:j,debug:j};let w=(G,I)=>typeof G==="function"?G.bind(q):I,D=w(q.log,j);return{log:D,info:w(q.info,D),warn:w(q.warn,D),error:w(q.error,D),debug:w(q.debug,D)}}function U(j){L=j.isBunRuntime,Z=j.isCloudflareRuntime,B=j.isNodeRuntime,_=j.hasFileSystemAccess,S=j.console}function X(){let j=x();for(let q of Object.keys(M))delete M[q];Object.assign(M,j)}function x(){if(L)return{...typeof Bun<"u"?Bun.env:{},...typeof process<"u"?process.env:{}};return(typeof process<"u"?process:void 0)?.env??{}}export{p as setEnvVar,$ as runtimeEnv,S as runtimeConsole,s as resetRuntimeForTests,H as refreshRuntimeEnvironment,v as readTextFile,m as readJsonFile,B as isNodeRuntime,Z as isCloudflareRuntime,L as isBunRuntime,c as initializeCloudflareRuntime,_ as hasFileSystemAccess,g as getEnvVar,a as getBunFile,d as fileExists,l as ensureRuntimeSynchronized};
2
+ var u={},a=l(),{isBunRuntime:s,isCloudflareRuntime:m,isNodeRuntime:v,hasFileSystemAccess:g,console:h}=a,p=u;f();function O(e,n){let t=typeof process<"u"?process.env:void 0,o=t?t[e]:void 0,i=s?Bun?.env?.[e]:void 0,r=p[e],c=typeof r==="string"?r:void 0,d=m?c??o??i:o??i??c;return d===void 0||d===""?n:d}function _(e,n){if(typeof process<"u")process.env[e]=n;p[e]=n}function F(e){globalThis.__hapiRuntimeOverride="cloudflare",y(),Object.assign(u,e)}function N(){delete globalThis.__hapiRuntimeOverride,y()}async function T(e){if(!s)throw Error(`File system access not available in this runtime: ${e}`);return await Bun.file(e).text()}async function k(e){if(!s)throw Error(`File system access not available in this runtime: ${e}`);return await Bun.file(e).json()}async function S(e){return s?await Bun.file(e).exists():!1}function A(e){if(!s)throw Error(`File system access not available in this runtime: ${e}`);return Bun.file(e)}function y(){let e=l();b(e),f()}function V(){if(g)return;if(R()!==void 0)return;let e=l();b(e),f()}function l(){let e=R(),n=x(e),t=n?!1:C(e),o=w(e,t);return{isBunRuntime:n,isCloudflareRuntime:t,isNodeRuntime:o,hasFileSystemAccess:!t&&(n||o),console:B()}}function x(e){if(e==="bun")return!0;if(e==="cloudflare"||e==="node")return!1;return typeof Bun<"u"}function C(e){if(e==="cloudflare")return!0;if(e==="bun"||e==="node")return!1;let n=typeof globalThis<"u"?globalThis:void 0,t=n?.navigator?.userAgent??"",o=typeof t==="string"&&t.includes("Cloudflare-Workers"),i=typeof n?.__ENVIRONMENT__==="string"&&n.__ENVIRONMENT__.toLowerCase()==="workerd",r=typeof n?.caches?.default<"u";return o||i||r}function w(e,n){if(e==="node")return!0;if(e==="bun"||e==="cloudflare")return!1;if(n)return!1;let t=typeof process<"u"?process.versions?.node:void 0;return typeof t==="string"&&t.length>0}function R(){return typeof globalThis<"u"?globalThis.__hapiRuntimeOverride:void 0}function B(){let e=()=>{},n=typeof console<"u"?console:void 0;if(!n)return{log:e,info:e,warn:e,error:e,debug:e};let t=(i,r)=>typeof i==="function"?i.bind(n):r,o=t(n.log,e);return{log:o,info:t(n.info,o),warn:t(n.warn,o),error:t(n.error,o),debug:t(n.debug,o)}}function b(e){s=e.isBunRuntime,m=e.isCloudflareRuntime,v=e.isNodeRuntime,g=e.hasFileSystemAccess,h=e.console}function f(){let e=E();for(let n of Object.keys(u))delete u[n];Object.assign(u,e)}function E(){if(s)return{...typeof Bun<"u"?Bun.env:{},...typeof process<"u"?process.env:{}};return(typeof process<"u"?process:void 0)?.env??{}}export{V as ensureRuntimeSynchronized,S as fileExists,A as getBunFile,O as getEnvVar,g as hasFileSystemAccess,F as initializeCloudflareRuntime,s as isBunRuntime,m as isCloudflareRuntime,v as isNodeRuntime,k as readJsonFile,T as readTextFile,y as refreshRuntimeEnvironment,N as resetRuntimeForTests,h as runtimeConsole,p as runtimeEnv,_ as setEnvVar};
package/dist/secrets.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- var c=Object.create;var{getPrototypeOf:f,defineProperty:O,getOwnPropertyNames:F}=Object;var H=Object.prototype.hasOwnProperty;function N(s){return this[s]}var U,W,h=(s,P,w)=>{var A=s!=null&&typeof s==="object";if(A){var I=P?U??=new WeakMap:W??=new WeakMap,M=I.get(s);if(M)return M}w=s!=null?c(f(s)):{};let g=P||!s||!s.__esModule?O(w,"default",{value:s,enumerable:!0}):w;for(let K of F(s))if(!H.call(g,K))O(g,K,{get:N.bind(s,K),enumerable:!0});if(A)I.set(s,g);return g};var x=(s,P)=>()=>(P||s((P={exports:{}}).exports,P),P.exports);var p=import.meta.require;var j={},q=G(),$=q.isBunRuntime,Q=q.isCloudflareRuntime,y=q.isNodeRuntime,T=q.hasFileSystemAccess,S=q.console,X=j;J();function r(s,P){let w=typeof process<"u"?process.env:void 0,A=w?w[s]:void 0,I=$?Bun?.env?.[s]:void 0,M=X[s],g=typeof M==="string"?M:void 0,K=Q?g??A??I:A??I??g;return K===void 0||K===""?P:K}function R(s,P){if(typeof process<"u")process.env[s]=P;X[s]=P}function a(s){globalThis.__hapiRuntimeOverride="cloudflare",Y(),Object.assign(j,s)}function m(){delete globalThis.__hapiRuntimeOverride,Y()}async function d(s){if(!$)throw Error(`File system access not available in this runtime: ${s}`);return await Bun.file(s).text()}async function i(s){if(!$)throw Error(`File system access not available in this runtime: ${s}`);return await Bun.file(s).json()}async function v(s){return $?await Bun.file(s).exists():!1}function u(s){if(!$)throw Error(`File system access not available in this runtime: ${s}`);return Bun.file(s)}function Y(){let s=G();_(s),J()}function t(){if(T)return;if(Z()!==void 0)return;let s=G();_(s),J()}function G(){let s=Z(),P=z(s),w=P?!1:V(s),A=k(s,w);return{isBunRuntime:P,isCloudflareRuntime:w,isNodeRuntime:A,hasFileSystemAccess:!w&&(P||A),console:E()}}function z(s){if(s==="bun")return!0;if(s==="cloudflare"||s==="node")return!1;return typeof Bun<"u"}function V(s){if(s==="cloudflare")return!0;if(s==="bun"||s==="node")return!1;let P=typeof globalThis<"u"?globalThis:void 0,w=P?.navigator?.userAgent??"",A=typeof w==="string"&&w.includes("Cloudflare-Workers"),I=typeof P?.__ENVIRONMENT__==="string"&&P.__ENVIRONMENT__.toLowerCase()==="workerd",M=typeof P?.caches?.default<"u";return A||I||M}function k(s,P){if(s==="node")return!0;if(s==="bun"||s==="cloudflare")return!1;if(P)return!1;let w=typeof process<"u"?process.versions?.node:void 0;return typeof w==="string"&&w.length>0}function Z(){return typeof globalThis<"u"?globalThis.__hapiRuntimeOverride:void 0}function E(){let s=()=>{},P=typeof console<"u"?console:void 0;if(!P)return{log:s,info:s,warn:s,error:s,debug:s};let w=(I,M)=>typeof I==="function"?I.bind(P):M,A=w(P.log,s);return{log:A,info:w(P.info,A),warn:w(P.warn,A),error:w(P.error,A),debug:w(P.debug,A)}}function _(s){$=s.isBunRuntime,Q=s.isCloudflareRuntime,y=s.isNodeRuntime,T=s.hasFileSystemAccess,S=s.console}function J(){let s=b();for(let P of Object.keys(j))delete j[P];Object.assign(j,s)}function b(){if($)return{...typeof Bun<"u"?Bun.env:{},...typeof process<"u"?process.env:{}};return(typeof process<"u"?process:void 0)?.env??{}}var B=new Map;function L(){if(!$)return null;let s=globalThis.Bun?.secrets;if(!s||typeof s.get!=="function")return null;return s}var D=(s,P)=>`${s}::${P}`;async function o(s,P){let w=L();if(w)try{return await w.get({service:s,name:P})}catch{return B.get(D(s,P))??null}return B.get(D(s,P))??null}async function e(s,P,w){let A=L();if(A)try{await A.set({service:s,name:P,value:w});return}catch{}B.set(D(s,P),w)}async function ss(s,P){let w=L();if(w)try{await w.delete({service:s,name:P});return}catch{}B.delete(D(s,P))}export{e as setSecret,o as getSecret,ss as deleteSecret};
2
+ var u={},a=f(),{isBunRuntime:o,isCloudflareRuntime:y,isNodeRuntime:C,hasFileSystemAccess:R,console:w}=a,b=u;g();function _(e,n){let t=typeof process<"u"?process.env:void 0,i=t?t[e]:void 0,r=o?Bun?.env?.[e]:void 0,s=b[e],p=typeof s==="string"?s:void 0,d=y?p??i??r:i??r??p;return d===void 0||d===""?n:d}function T(e,n){if(typeof process<"u")process.env[e]=n;b[e]=n}function F(e){globalThis.__hapiRuntimeOverride="cloudflare",v(),Object.assign(u,e)}function N(){delete globalThis.__hapiRuntimeOverride,v()}async function P(e){if(!o)throw Error(`File system access not available in this runtime: ${e}`);return await Bun.file(e).text()}async function k(e){if(!o)throw Error(`File system access not available in this runtime: ${e}`);return await Bun.file(e).json()}async function V(e){return o?await Bun.file(e).exists():!1}function j(e){if(!o)throw Error(`File system access not available in this runtime: ${e}`);return Bun.file(e)}function v(){let e=f();x(e),g()}function L(){if(R)return;if(h()!==void 0)return;let e=f();x(e),g()}function f(){let e=h(),n=B(e),t=n?!1:S(e),i=E(e,t);return{isBunRuntime:n,isCloudflareRuntime:t,isNodeRuntime:i,hasFileSystemAccess:!t&&(n||i),console:O()}}function B(e){if(e==="bun")return!0;if(e==="cloudflare"||e==="node")return!1;return typeof Bun<"u"}function S(e){if(e==="cloudflare")return!0;if(e==="bun"||e==="node")return!1;let n=typeof globalThis<"u"?globalThis:void 0,t=n?.navigator?.userAgent??"",i=typeof t==="string"&&t.includes("Cloudflare-Workers"),r=typeof n?.__ENVIRONMENT__==="string"&&n.__ENVIRONMENT__.toLowerCase()==="workerd",s=typeof n?.caches?.default<"u";return i||r||s}function E(e,n){if(e==="node")return!0;if(e==="bun"||e==="cloudflare")return!1;if(n)return!1;let t=typeof process<"u"?process.versions?.node:void 0;return typeof t==="string"&&t.length>0}function h(){return typeof globalThis<"u"?globalThis.__hapiRuntimeOverride:void 0}function O(){let e=()=>{},n=typeof console<"u"?console:void 0;if(!n)return{log:e,info:e,warn:e,error:e,debug:e};let t=(r,s)=>typeof r==="function"?r.bind(n):s,i=t(n.log,e);return{log:i,info:t(n.info,i),warn:t(n.warn,i),error:t(n.error,i),debug:t(n.debug,i)}}function x(e){o=e.isBunRuntime,y=e.isCloudflareRuntime,C=e.isNodeRuntime,R=e.hasFileSystemAccess,w=e.console}function g(){let e=A();for(let n of Object.keys(u))delete u[n];Object.assign(u,e)}function A(){if(o)return{...typeof Bun<"u"?Bun.env:{},...typeof process<"u"?process.env:{}};return(typeof process<"u"?process:void 0)?.env??{}}var c=new Map;function m(){if(!o)return null;let e=globalThis.Bun?.secrets;if(!e||typeof e.get!=="function")return null;return e}var l=(e,n)=>`${e}::${n}`;async function I(e,n){let t=m();if(t)try{return await t.get({service:e,name:n})}catch{return c.get(l(e,n))??null}return c.get(l(e,n))??null}async function W(e,n,t){let i=m();if(i)try{await i.set({service:e,name:n,value:t});return}catch{}c.set(l(e,n),t)}async function H(e,n){let t=m();if(t)try{await t.delete({service:e,name:n});return}catch{}c.delete(l(e,n))}export{H as deleteSecret,I as getSecret,W as setSecret};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcp-com-ai/shared-utils",
3
- "version": "1.0.1-beta.260912",
3
+ "version": "1.0.2-beta.260914",
4
4
  "description": "Shared HAPI utilities: HAPI_HOME resolution, logger, config loader, errors, runtime detection, secrets. Consumed by the CLI, the core engine, and all first-party plugins.",
5
5
  "license": "LRL-CL",
6
6
  "type": "module",
@@ -15,60 +15,60 @@
15
15
  "default": "./dist/index.js"
16
16
  },
17
17
  "./home": {
18
- "types": "./dist/home.d.ts",
19
- "hapi-build-source": "./src/home.ts",
20
- "bun": "./dist/home.js",
21
- "default": "./dist/home.js"
18
+ "types": "./dist/home.d.ts",
19
+ "hapi-build-source": "./src/home.ts",
20
+ "bun": "./dist/home.js",
21
+ "default": "./dist/home.js"
22
+ },
23
+ "./logger": {
24
+ "types": "./dist/logger.d.ts",
25
+ "hapi-build-source": "./src/logger.ts",
26
+ "bun": "./dist/logger.js",
27
+ "default": "./dist/logger.js"
28
+ },
29
+ "./config": {
30
+ "types": "./dist/config.d.ts",
31
+ "hapi-build-source": "./src/config.ts",
32
+ "bun": "./dist/config.js",
33
+ "default": "./dist/config.js"
34
+ },
35
+ "./errors": {
36
+ "types": "./dist/errors.d.ts",
37
+ "hapi-build-source": "./src/errors.ts",
38
+ "bun": "./dist/errors.js",
39
+ "default": "./dist/errors.js"
40
+ },
41
+ "./runtime": {
42
+ "types": "./dist/runtime.d.ts",
43
+ "hapi-build-source": "./src/runtime.ts",
44
+ "bun": "./dist/runtime.js",
45
+ "default": "./dist/runtime.js"
46
+ },
47
+ "./secrets": {
48
+ "types": "./dist/secrets.d.ts",
49
+ "hapi-build-source": "./src/secrets.ts",
50
+ "bun": "./dist/secrets.js",
51
+ "default": "./dist/secrets.js"
52
+ }
22
53
  },
23
- "./logger": {
24
- "types": "./dist/logger.d.ts",
25
- "hapi-build-source": "./src/logger.ts",
26
- "bun": "./dist/logger.js",
27
- "default": "./dist/logger.js"
28
- },
29
- "./config": {
30
- "types": "./dist/config.d.ts",
31
- "hapi-build-source": "./src/config.ts",
32
- "bun": "./dist/config.js",
33
- "default": "./dist/config.js"
34
- },
35
- "./errors": {
36
- "types": "./dist/errors.d.ts",
37
- "hapi-build-source": "./src/errors.ts",
38
- "bun": "./dist/errors.js",
39
- "default": "./dist/errors.js"
40
- },
41
- "./runtime": {
42
- "types": "./dist/runtime.d.ts",
43
- "hapi-build-source": "./src/runtime.ts",
44
- "bun": "./dist/runtime.js",
45
- "default": "./dist/runtime.js"
46
- },
47
- "./secrets": {
48
- "types": "./dist/secrets.d.ts",
49
- "hapi-build-source": "./src/secrets.ts",
50
- "bun": "./dist/secrets.js",
51
- "default": "./dist/secrets.js"
52
- }
53
- },
54
- "files": ["dist", "README.md"],
55
- "scripts": {
56
- "typecheck": "bunx tsc --noEmit",
57
- "test": "bun test",
58
- "build": "bun ../../scripts/build-package.ts ."
59
- },
60
- "peerDependencies": {
61
- "typescript": "^5"
62
- },
63
- "dependencies": {
64
- "winston": "^3.19.0",
65
- "winston-daily-rotate-file": "^5.0.0",
66
- "yaml": "^2.8.2"
67
- },
68
- "engines": {
69
- "bun": ">=1.3.0"
70
- },
71
- "publishConfig": {
72
- "access": "public"
73
- }
54
+ "files": ["dist", "README.md"],
55
+ "scripts": {
56
+ "typecheck": "bunx tsc --noEmit",
57
+ "test": "bun test",
58
+ "build": "bun ../../scripts/build-package.ts ."
59
+ },
60
+ "peerDependencies": {
61
+ "typescript": "^5"
62
+ },
63
+ "dependencies": {
64
+ "winston": "^3.19.0",
65
+ "winston-daily-rotate-file": "^5.0.0",
66
+ "yaml": "^2.8.2"
67
+ },
68
+ "engines": {
69
+ "bun": ">=1.3.0"
70
+ },
71
+ "publishConfig": {
72
+ "access": "public"
73
+ }
74
74
  }