@jsfsi-core/ts-nodejs 1.1.39 → 1.1.41
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 +3 -3
- package/dist/index.mjs +497 -531
- package/dist/{ts-nodejs/src → src}/database/TransactionalEntity.d.ts +1 -1
- package/dist/src/index.d.ts +3 -2
- package/package.json +6 -6
- package/dist/ts-nodejs/src/index.d.ts +0 -3
- /package/dist/{ts-nodejs/src → src}/database/TransactionalRepository.d.ts +0 -0
- /package/dist/{ts-nodejs/src → src}/database/TransactionalRepository.test.d.ts +0 -0
- /package/dist/{ts-nodejs/src → src}/database/TransactionalRepositoryMock.d.ts +0 -0
- /package/dist/{ts-nodejs/src → src}/database/index.d.ts +0 -0
- /package/dist/{ts-nodejs/src → src}/database/postgres/index.d.ts +0 -0
- /package/dist/{ts-nodejs/src → src}/database/postgres/search.d.ts +0 -0
- /package/dist/{ts-nodejs/src → src}/env/env.loader.d.ts +0 -0
- /package/dist/{ts-nodejs/src → src}/env/env.loader.unit.test.d.ts +0 -0
- /package/dist/{ts-nodejs/src → src}/logger/GCPLogger.d.ts +0 -0
- /package/dist/{ts-nodejs/src → src}/logger/GCPLogger.unit.test.d.ts +0 -0
- /package/dist/{ts-nodejs/src → src}/logger/Logger.d.ts +0 -0
- /package/dist/{ts-nodejs/src → src}/logger/MockLogger.d.ts +0 -0
- /package/dist/{ts-nodejs/src → src}/logger/index.d.ts +0 -0
- /package/dist/{ts-nodejs/vite.config.d.ts → vite.config.d.ts} +0 -0
- /package/dist/{ts-nodejs/vitest.config.d.ts → vitest.config.d.ts} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
`);let
|
|
3
|
-
`),g=g.replace(/\\r/g,"\r")),a[E]=g}return a}function u(e){e=e||{};const a=s(e);e.path=a;const l=_.configDotenv(e);if(!l.parsed){const o=new Error(`MISSING_DATA: Cannot parse ${a} for an unknown reason`);throw o.code="MISSING_DATA",o}const d=y(e).split(","),E=d.length;let g;for(let o=0;o<E;o++)try{const m=d[o].trim(),T=v(l,m);g=_.decrypt(T.ciphertext,T.key);break}catch(m){if(o+1>=E)throw m}return _.parse(g)}function p(e){console.error(`[dotenv@${N}][WARN] ${e}`)}function i(e){console.log(`[dotenv@${N}][DEBUG] ${e}`)}function f(e){console.log(`[dotenv@${N}] ${e}`)}function y(e){return e&&e.DOTENV_KEY&&e.DOTENV_KEY.length>0?e.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function v(e,a){let l;try{l=new URL(a)}catch(m){if(m.code==="ERR_INVALID_URL"){const T=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw T.code="INVALID_DOTENV_KEY",T}throw m}const d=l.password;if(!d){const m=new Error("INVALID_DOTENV_KEY: Missing key part");throw m.code="INVALID_DOTENV_KEY",m}const E=l.searchParams.get("environment");if(!E){const m=new Error("INVALID_DOTENV_KEY: Missing environment part");throw m.code="INVALID_DOTENV_KEY",m}const g=`DOTENV_VAULT_${E.toUpperCase()}`,o=e.parsed[g];if(!o){const m=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${g} in your .env.vault file.`);throw m.code="NOT_FOUND_DOTENV_ENVIRONMENT",m}return{ciphertext:o,key:d}}function s(e){let a=null;if(e&&e.path&&e.path.length>0)if(Array.isArray(e.path))for(const l of e.path)h.existsSync(l)&&(a=l.endsWith(".vault")?l:`${l}.vault`);else a=e.path.endsWith(".vault")?e.path:`${e.path}.vault`;else a=t.resolve(process.cwd(),".env.vault");return h.existsSync(a)?a:null}function R(e){return e[0]==="~"?t.join(n.homedir(),e.slice(1)):e}function V(e){const a=b(process.env.DOTENV_CONFIG_DEBUG||e&&e.debug),l=b(process.env.DOTENV_CONFIG_QUIET||e&&e.quiet);(a||!l)&&f("Loading env from encrypted .env.vault");const d=_._parseVault(e);let E=process.env;return e&&e.processEnv!=null&&(E=e.processEnv),_.populate(E,d,e),{parsed:d}}function x(e){const a=t.resolve(process.cwd(),".env");let l="utf8",d=process.env;e&&e.processEnv!=null&&(d=e.processEnv);let E=b(d.DOTENV_CONFIG_DEBUG||e&&e.debug),g=b(d.DOTENV_CONFIG_QUIET||e&&e.quiet);e&&e.encoding?l=e.encoding:E&&i("No encoding is specified. UTF-8 is used by default");let o=[a];if(e&&e.path)if(!Array.isArray(e.path))o=[R(e.path)];else{o=[];for(const L of e.path)o.push(R(L))}let m;const T={};for(const L of o)try{const $=_.parse(h.readFileSync(L,{encoding:l}));_.populate(T,$,e)}catch($){E&&i(`Failed to load ${L} ${$.message}`),m=$}const F=_.populate(d,T,e);if(E=b(d.DOTENV_CONFIG_DEBUG||E),g=b(d.DOTENV_CONFIG_QUIET||g),E||!g){const L=Object.keys(F).length,$=[];for(const K of o)try{const C=t.relative(process.cwd(),K);$.push(C)}catch(C){E&&i(`Failed to load ${K} ${C.message}`),m=C}f(`injecting env (${L}) from ${$.join(",")} ${A(`-- tip: ${I()}`)}`)}return m?{parsed:T,error:m}:{parsed:T}}function G(e){if(y(e).length===0)return _.configDotenv(e);const a=s(e);return a?_._configVault(e):(p(`You set DOTENV_KEY but you are missing a .env.vault file at ${a}. Did you forget to build it?`),_.configDotenv(e))}function k(e,a){const l=Buffer.from(a.slice(-64),"hex");let d=Buffer.from(e,"base64");const E=d.subarray(0,12),g=d.subarray(-16);d=d.subarray(12,-16);try{const o=c.createDecipheriv("aes-256-gcm",l,E);return o.setAuthTag(g),`${o.update(d)}${o.final()}`}catch(o){const m=o instanceof RangeError,T=o.message==="Invalid key length",F=o.message==="Unsupported state or unable to authenticate data";if(m||T){const L=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw L.code="INVALID_DOTENV_KEY",L}else if(F){const L=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw L.code="DECRYPTION_FAILED",L}else throw o}}function z(e,a,l={}){const d=!!(l&&l.debug),E=!!(l&&l.override),g={};if(typeof a!="object"){const o=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw o.code="OBJECT_REQUIRED",o}for(const o of Object.keys(a))Object.prototype.hasOwnProperty.call(e,o)?(E===!0&&(e[o]=a[o],g[o]=a[o]),d&&i(E===!0?`"${o}" is already defined and WAS overwritten`:`"${o}" is already defined and was NOT overwritten`)):(e[o]=a[o],g[o]=a[o]);return g}const _={configDotenv:x,_configVault:V,_parseVault:u,config:G,decrypt:k,parse:r,populate:z};return S.exports.configDotenv=_.configDotenv,S.exports._configVault=_._configVault,S.exports._parseVault=_._parseVault,S.exports.config=_.config,S.exports.decrypt=_.decrypt,S.exports.parse=_.parse,S.exports.populate=_.populate,S.exports=_,S.exports}var ne=re();const oe=W.fileURLToPath(typeof document>"u"?require("url").pathToFileURL(__filename).href:U&&U.tagName.toUpperCase()==="SCRIPT"&&U.src||new URL("index.cjs",document.baseURI).href),ie=Y.dirname(oe),se=(h={})=>{const{env:t,configPath:n}=h,c=Y.resolve(ie,`${n??"."}/.env${t?`.${t}`:""}`),{parsed:w}=ne.config({path:c});return w};var j,B;function ce(){if(B)return j;B=1,j=N,N.default=N,N.stable=D,N.stableStringify=D;var h="[...]",t="[Circular]",n=[],c=[];function w(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function N(r,u,p,i){typeof i>"u"&&(i=w()),I(r,"",0,[],void 0,0,i);var f;try{c.length===0?f=JSON.stringify(r,u,p):f=JSON.stringify(r,M(u),p)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;n.length!==0;){var y=n.pop();y.length===4?Object.defineProperty(y[0],y[1],y[3]):y[0][y[1]]=y[2]}}return f}function O(r,u,p,i){var f=Object.getOwnPropertyDescriptor(i,p);f.get!==void 0?f.configurable?(Object.defineProperty(i,p,{value:r}),n.push([i,p,u,f])):c.push([u,p,r]):(i[p]=r,n.push([i,p,u]))}function I(r,u,p,i,f,y,v){y+=1;var s;if(typeof r=="object"&&r!==null){for(s=0;s<i.length;s++)if(i[s]===r){O(t,r,u,f);return}if(typeof v.depthLimit<"u"&&y>v.depthLimit){O(h,r,u,f);return}if(typeof v.edgesLimit<"u"&&p+1>v.edgesLimit){O(h,r,u,f);return}if(i.push(r),Array.isArray(r))for(s=0;s<r.length;s++)I(r[s],s,s,i,r,y,v);else{var R=Object.keys(r);for(s=0;s<R.length;s++){var V=R[s];I(r[V],V,s,i,r,y,v)}}i.pop()}}function b(r,u){return r<u?-1:r>u?1:0}function D(r,u,p,i){typeof i>"u"&&(i=w());var f=A(r,"",0,[],void 0,0,i)||r,y;try{c.length===0?y=JSON.stringify(f,u,p):y=JSON.stringify(f,M(u),p)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;n.length!==0;){var v=n.pop();v.length===4?Object.defineProperty(v[0],v[1],v[3]):v[0][v[1]]=v[2]}}return y}function A(r,u,p,i,f,y,v){y+=1;var s;if(typeof r=="object"&&r!==null){for(s=0;s<i.length;s++)if(i[s]===r){O(t,r,u,f);return}try{if(typeof r.toJSON=="function")return}catch{return}if(typeof v.depthLimit<"u"&&y>v.depthLimit){O(h,r,u,f);return}if(typeof v.edgesLimit<"u"&&p+1>v.edgesLimit){O(h,r,u,f);return}if(i.push(r),Array.isArray(r))for(s=0;s<r.length;s++)A(r[s],s,s,i,r,y,v);else{var R={},V=Object.keys(r).sort(b);for(s=0;s<V.length;s++){var x=V[s];A(r[x],x,s,i,r,y,v),R[x]=r[x]}if(typeof f<"u")n.push([f,u,r]),f[u]=R;else return R}i.pop()}}function M(r){return r=typeof r<"u"?r:function(u,p){return p},function(u,p){if(c.length>0)for(var i=0;i<c.length;i++){var f=c[i];if(f[1]===u&&f[0]===p){p=f[2],c.splice(i,1);break}}return r.call(this,u,p)}}return j}var ae=ce();const ue=Z(ae),J={debug:"debug",verbose:"debug",log:"log",warn:"warn",error:"error",fatal:"error"},fe={verbose:"DEFAULT",debug:"DEBUG",log:"INFO",warn:"WARNING",error:"ERROR",fatal:"CRITICAL"},le=["x-api-key","x-api-token","x-key","x-token","cookie","password","pass","psw","auth","authentication","authorization","token","access_token","client-secret","credentials","secret"];class de{constructor(t,n={}){this.module=t,n.logLevels&&(this.levels=new Set(n.logLevels))}levels=new Set(["verbose","debug","log","warn","error","fatal"]);mapLogLevelToConsoleMethod(t){return J[t]}write(t,n,c,w,N){if(!this.levels.has(t))return;const O=this.buildLog(t,n,c,w,N),I=ue(O,this.sensitiveReplacer),b=this.mapLogLevelToConsoleMethod(t);console[b](I)}buildLog(t,n,c,w,N){const{writeMetadata:O,writeContext:I,writeError:b}=this.sanitizeLog(c,w,N),D={};return typeof n=="string"&&(D.textPayload=n),!O&&typeof n!="string"&&!(n instanceof Error)&&(D.metadata=n),n instanceof Error&&(D.error=JSON.stringify(n,Object.getOwnPropertyNames(n))),I&&(D.context=I),O&&(D.metadata=O),!D.error&&b&&(D.error=JSON.stringify(b,Object.getOwnPropertyNames(b))),{severity:fe[t],module:this.module,textPayload:D.textPayload,message:D}}sanitizeLog(t,n,c){if(n instanceof Error&&(!c||typeof c=="string"))return{writeMetadata:void 0,writeContext:t||c,writeError:n};let w=n,N=t;return typeof w=="string"&&!t&&(N=w,w=void 0),{writeMetadata:w,writeContext:N,writeError:c}}sensitiveReplacer(t,n){return le.includes(t.toLowerCase())?"[HIDDEN BY LOGGER]":n}debug(t,n,c){this.write("debug",t,c,n)}verbose(t,n,c){this.write("verbose",t,c,n)}log(t,n,c){this.write("log",t,c,n)}warn(t,n,c,w){this.write("warn",t,w,n,c)}error(t,n,c,w){this.write("error",t,w,n,c)}fatal(t,n,c,w){this.write("fatal",t,w,n,c)}setLogLevels(t){this.levels=new Set(t)}}class ge{debug=()=>{};verbose=()=>{};log=()=>{};warn=()=>{};error=()=>{};fatal=()=>{};setLogLevels=()=>{}}class P{constructor(t){this.dataSource=t}em;static newInstance(t){const n=t.constructor;return new n(t.dataSource)}withEntityManager(t){return this.em=t,this}withRepositoryManager(t){return P.newInstance(this).withEntityManager(t.em)}lockInTransaction(t="pessimistic_write"){return this.em?{mode:t}:void 0}getRepository(t){return this.em?this.em.getRepository(t):this.dataSource.getRepository(t)}async withTransaction(t){let n;return await this.dataSource.transaction(async c=>{n=await t(P.newInstance(this).withEntityManager(c))}),n}}const he=h=>({...h,withTransaction:async t=>await t(h),withRepositoryManager:()=>h}),pe=(h,t)=>`unaccent(LOWER(${h})) ILIKE unaccent(LOWER(:${t}))`,ye=Object.freeze(Object.defineProperty({__proto__:null,unaccentSearch:pe},Symbol.toStringTag,{value:"Module"}));exports.GCPLogger=de;exports.LogLevelToConsoleMethodMap=J;exports.MockLogger=ge;exports.TransactionalRepository=P;exports.buildTransactionalRepositoryMock=he;exports.loadEnvConfig=se;exports.postgres=ye;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,a)=>(a=n==null?{}:e(i(n)),c(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let u=require(`path`);u=l(u);let d=require(`url`);var f=l(o(((e,t)=>{var n=require(`fs`),r=require(`path`),i=require(`os`),a=require(`crypto`),o=[`◈ encrypted .env [www.dotenvx.com]`,`◈ secrets for agents [www.dotenvx.com]`,`⌁ auth for agents [www.vestauth.com]`,`⌘ custom filepath { path: '/custom/path/.env' }`,`⌘ enable debugging { debug: true }`,`⌘ override existing { override: true }`,`⌘ suppress logs { quiet: true }`,`⌘ multiple files { path: ['.env.local', '.env'] }`];function s(){return o[Math.floor(Math.random()*o.length)]}function c(e){return typeof e==`string`?![`false`,`0`,`no`,`off`,``].includes(e.toLowerCase()):!!e}function l(){return process.stdout.isTTY}function u(e){return l()?`\x1b[2m${e}\x1b[0m`:e}var d=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;function f(e){let t={},n=e.toString();n=n.replace(/\r\n?/gm,`
|
|
2
|
+
`);let r;for(;(r=d.exec(n))!=null;){let e=r[1],n=r[2]||``;n=n.trim();let i=n[0];n=n.replace(/^(['"`])([\s\S]*)\1$/gm,`$2`),i===`"`&&(n=n.replace(/\\n/g,`
|
|
3
|
+
`),n=n.replace(/\\r/g,`\r`)),t[e]=n}return t}function p(e){e||={};let t=y(e);e.path=t;let n=E.configDotenv(e);if(!n.parsed){let e=Error(`MISSING_DATA: Cannot parse ${t} for an unknown reason`);throw e.code=`MISSING_DATA`,e}let r=_(e).split(`,`),i=r.length,a;for(let e=0;e<i;e++)try{let t=v(n,r[e].trim());a=E.decrypt(t.ciphertext,t.key);break}catch(t){if(e+1>=i)throw t}return E.parse(a)}function m(e){console.error(`⚠ ${e}`)}function h(e){console.log(`┆ ${e}`)}function g(e){console.log(`◇ ${e}`)}function _(e){return e&&e.DOTENV_KEY&&e.DOTENV_KEY.length>0?e.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:``}function v(e,t){let n;try{n=new URL(t)}catch(e){if(e.code===`ERR_INVALID_URL`){let e=Error(`INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development`);throw e.code=`INVALID_DOTENV_KEY`,e}throw e}let r=n.password;if(!r){let e=Error(`INVALID_DOTENV_KEY: Missing key part`);throw e.code=`INVALID_DOTENV_KEY`,e}let i=n.searchParams.get(`environment`);if(!i){let e=Error(`INVALID_DOTENV_KEY: Missing environment part`);throw e.code=`INVALID_DOTENV_KEY`,e}let a=`DOTENV_VAULT_${i.toUpperCase()}`,o=e.parsed[a];if(!o){let e=Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${a} in your .env.vault file.`);throw e.code=`NOT_FOUND_DOTENV_ENVIRONMENT`,e}return{ciphertext:o,key:r}}function y(e){let t=null;if(e&&e.path&&e.path.length>0)if(Array.isArray(e.path))for(let r of e.path)n.existsSync(r)&&(t=r.endsWith(`.vault`)?r:`${r}.vault`);else t=e.path.endsWith(`.vault`)?e.path:`${e.path}.vault`;else t=r.resolve(process.cwd(),`.env.vault`);return n.existsSync(t)?t:null}function b(e){return e[0]===`~`?r.join(i.homedir(),e.slice(1)):e}function x(e){let t=c(process.env.DOTENV_CONFIG_DEBUG||e&&e.debug),n=c(process.env.DOTENV_CONFIG_QUIET||e&&e.quiet);(t||!n)&&g(`loading env from encrypted .env.vault`);let r=E._parseVault(e),i=process.env;return e&&e.processEnv!=null&&(i=e.processEnv),E.populate(i,r,e),{parsed:r}}function S(e){let t=r.resolve(process.cwd(),`.env`),i=`utf8`,a=process.env;e&&e.processEnv!=null&&(a=e.processEnv);let o=c(a.DOTENV_CONFIG_DEBUG||e&&e.debug),l=c(a.DOTENV_CONFIG_QUIET||e&&e.quiet);e&&e.encoding?i=e.encoding:o&&h(`no encoding is specified (UTF-8 is used by default)`);let d=[t];if(e&&e.path)if(!Array.isArray(e.path))d=[b(e.path)];else{d=[];for(let t of e.path)d.push(b(t))}let f,p={};for(let t of d)try{let r=E.parse(n.readFileSync(t,{encoding:i}));E.populate(p,r,e)}catch(e){o&&h(`failed to load ${t} ${e.message}`),f=e}let m=E.populate(a,p,e);if(o=c(a.DOTENV_CONFIG_DEBUG||o),l=c(a.DOTENV_CONFIG_QUIET||l),o||!l){let e=Object.keys(m).length,t=[];for(let e of d)try{let n=r.relative(process.cwd(),e);t.push(n)}catch(t){o&&h(`failed to load ${e} ${t.message}`),f=t}g(`injected env (${e}) from ${t.join(`,`)} ${u(`// tip: ${s()}`)}`)}return f?{parsed:p,error:f}:{parsed:p}}function C(e){if(_(e).length===0)return E.configDotenv(e);let t=y(e);return t?E._configVault(e):(m(`you set DOTENV_KEY but you are missing a .env.vault file at ${t}`),E.configDotenv(e))}function w(e,t){let n=Buffer.from(t.slice(-64),`hex`),r=Buffer.from(e,`base64`),i=r.subarray(0,12),o=r.subarray(-16);r=r.subarray(12,-16);try{let e=a.createDecipheriv(`aes-256-gcm`,n,i);return e.setAuthTag(o),`${e.update(r)}${e.final()}`}catch(e){let t=e instanceof RangeError,n=e.message===`Invalid key length`,r=e.message===`Unsupported state or unable to authenticate data`;if(t||n){let e=Error(`INVALID_DOTENV_KEY: It must be 64 characters long (or more)`);throw e.code=`INVALID_DOTENV_KEY`,e}else if(r){let e=Error(`DECRYPTION_FAILED: Please check your DOTENV_KEY`);throw e.code=`DECRYPTION_FAILED`,e}else throw e}}function T(e,t,n={}){let r=!!(n&&n.debug),i=!!(n&&n.override),a={};if(typeof t!=`object`){let e=Error(`OBJECT_REQUIRED: Please check the processEnv argument being passed to populate`);throw e.code=`OBJECT_REQUIRED`,e}for(let n of Object.keys(t))Object.prototype.hasOwnProperty.call(e,n)?(i===!0&&(e[n]=t[n],a[n]=t[n]),r&&h(i===!0?`"${n}" is already defined and WAS overwritten`:`"${n}" is already defined and was NOT overwritten`)):(e[n]=t[n],a[n]=t[n]);return a}var E={configDotenv:S,_configVault:x,_parseVault:p,config:C,decrypt:w,parse:f,populate:T};t.exports.configDotenv=E.configDotenv,t.exports._configVault=E._configVault,t.exports._parseVault=E._parseVault,t.exports.config=E.config,t.exports.decrypt=E.decrypt,t.exports.parse=E.parse,t.exports.populate=E.populate,t.exports=E}))(),1),p=(0,d.fileURLToPath)({}.url),m=u.default.dirname(p),h=(e={})=>{let{env:t,configPath:n}=e,r=u.default.resolve(m,`${n??`.`}/.env${t?`.${t}`:``}`),{parsed:i}=f.config({path:r});return i},g=l(o(((e,t)=>{t.exports=s,s.default=s,s.stable=d,s.stableStringify=d;var n=`[...]`,r=`[Circular]`,i=[],a=[];function o(){return{depthLimit:2**53-1,edgesLimit:2**53-1}}function s(e,t,n,r){r===void 0&&(r=o()),l(e,``,0,[],void 0,0,r);var s;try{s=a.length===0?JSON.stringify(e,t,n):JSON.stringify(e,p(t),n)}catch{return JSON.stringify(`[unable to serialize, circular reference is too complex to analyze]`)}finally{for(;i.length!==0;){var c=i.pop();c.length===4?Object.defineProperty(c[0],c[1],c[3]):c[0][c[1]]=c[2]}}return s}function c(e,t,n,r){var o=Object.getOwnPropertyDescriptor(r,n);o.get===void 0?(r[n]=e,i.push([r,n,t])):o.configurable?(Object.defineProperty(r,n,{value:e}),i.push([r,n,t,o])):a.push([t,n,e])}function l(e,t,i,a,o,s,u){s+=1;var d;if(typeof e==`object`&&e){for(d=0;d<a.length;d++)if(a[d]===e){c(r,e,t,o);return}if(u.depthLimit!==void 0&&s>u.depthLimit){c(n,e,t,o);return}if(u.edgesLimit!==void 0&&i+1>u.edgesLimit){c(n,e,t,o);return}if(a.push(e),Array.isArray(e))for(d=0;d<e.length;d++)l(e[d],d,d,a,e,s,u);else{var f=Object.keys(e);for(d=0;d<f.length;d++){var p=f[d];l(e[p],p,d,a,e,s,u)}}a.pop()}}function u(e,t){return e<t?-1:e>t?1:0}function d(e,t,n,r){r===void 0&&(r=o());var s=f(e,``,0,[],void 0,0,r)||e,c;try{c=a.length===0?JSON.stringify(s,t,n):JSON.stringify(s,p(t),n)}catch{return JSON.stringify(`[unable to serialize, circular reference is too complex to analyze]`)}finally{for(;i.length!==0;){var l=i.pop();l.length===4?Object.defineProperty(l[0],l[1],l[3]):l[0][l[1]]=l[2]}}return c}function f(e,t,a,o,s,l,d){l+=1;var p;if(typeof e==`object`&&e){for(p=0;p<o.length;p++)if(o[p]===e){c(r,e,t,s);return}try{if(typeof e.toJSON==`function`)return}catch{return}if(d.depthLimit!==void 0&&l>d.depthLimit){c(n,e,t,s);return}if(d.edgesLimit!==void 0&&a+1>d.edgesLimit){c(n,e,t,s);return}if(o.push(e),Array.isArray(e))for(p=0;p<e.length;p++)f(e[p],p,p,o,e,l,d);else{var m={},h=Object.keys(e).sort(u);for(p=0;p<h.length;p++){var g=h[p];f(e[g],g,p,o,e,l,d),m[g]=e[g]}if(s!==void 0)i.push([s,t,e]),s[t]=m;else return m}o.pop()}}function p(e){return e=e===void 0?function(e,t){return t}:e,function(t,n){if(a.length>0)for(var r=0;r<a.length;r++){var i=a[r];if(i[1]===t&&i[0]===n){n=i[2],a.splice(r,1);break}}return e.call(this,t,n)}}}))(),1),_={debug:`debug`,verbose:`debug`,log:`log`,warn:`warn`,error:`error`,fatal:`error`},v={verbose:`DEFAULT`,debug:`DEBUG`,log:`INFO`,warn:`WARNING`,error:`ERROR`,fatal:`CRITICAL`},y=[`x-api-key`,`x-api-token`,`x-key`,`x-token`,`cookie`,`password`,`pass`,`psw`,`auth`,`authentication`,`authorization`,`token`,`access_token`,`client-secret`,`credentials`,`secret`],b=class{levels=new Set([`verbose`,`debug`,`log`,`warn`,`error`,`fatal`]);constructor(e,t={}){this.module=e,t.logLevels&&(this.levels=new Set(t.logLevels))}mapLogLevelToConsoleMethod(e){return _[e]}write(e,t,n,r,i){if(!this.levels.has(e))return;let a=(0,g.default)(this.buildLog(e,t,n,r,i),this.sensitiveReplacer),o=this.mapLogLevelToConsoleMethod(e);console[o](a)}buildLog(e,t,n,r,i){let{writeMetadata:a,writeContext:o,writeError:s}=this.sanitizeLog(n,r,i),c={};return typeof t==`string`&&(c.textPayload=t),!a&&typeof t!=`string`&&!(t instanceof Error)&&(c.metadata=t),t instanceof Error&&(c.error=JSON.stringify(t,Object.getOwnPropertyNames(t))),o&&(c.context=o),a&&(c.metadata=a),!c.error&&s&&(c.error=JSON.stringify(s,Object.getOwnPropertyNames(s))),{severity:v[e],module:this.module,textPayload:c.textPayload,message:c}}sanitizeLog(e,t,n){if(t instanceof Error&&(!n||typeof n==`string`))return{writeMetadata:void 0,writeContext:e||n,writeError:t};let r=t,i=e;return typeof r==`string`&&!e&&(i=r,r=void 0),{writeMetadata:r,writeContext:i,writeError:n}}sensitiveReplacer(e,t){return y.includes(e.toLowerCase())?`[HIDDEN BY LOGGER]`:t}debug(e,t,n){this.write(`debug`,e,n,t)}verbose(e,t,n){this.write(`verbose`,e,n,t)}log(e,t,n){this.write(`log`,e,n,t)}warn(e,t,n,r){this.write(`warn`,e,r,t,n)}error(e,t,n,r){this.write(`error`,e,r,t,n)}fatal(e,t,n,r){this.write(`fatal`,e,r,t,n)}setLogLevels(e){this.levels=new Set(e)}},x=class{debug=()=>void 0;verbose=()=>void 0;log=()=>void 0;warn=()=>void 0;error=()=>void 0;fatal=()=>void 0;setLogLevels=()=>void 0},S=class e{em;constructor(e){this.dataSource=e}static newInstance(e){let t=e.constructor;return new t(e.dataSource)}withEntityManager(e){return this.em=e,this}withRepositoryManager(t){return e.newInstance(this).withEntityManager(t.em)}lockInTransaction(e=`pessimistic_write`){return this.em?{mode:e}:void 0}getRepository(e){return this.em?this.em.getRepository(e):this.dataSource.getRepository(e)}async withTransaction(t){let n;return await this.dataSource.transaction(async r=>{n=await t(e.newInstance(this).withEntityManager(r))}),n}},C=e=>({...e,withTransaction:async t=>await t(e),withRepositoryManager:()=>e}),w=(e,t)=>`unaccent(LOWER(${e})) ILIKE unaccent(LOWER(:${t}))`,T=s({unaccentSearch:()=>w});exports.GCPLogger=b,exports.LogLevelToConsoleMethodMap=_,exports.MockLogger=x,exports.TransactionalRepository=S,exports.buildTransactionalRepositoryMock=C,exports.loadEnvConfig=h,Object.defineProperty(exports,`postgres`,{enumerable:!0,get:function(){return T}});
|
package/dist/index.mjs
CHANGED
|
@@ -1,531 +1,497 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { fileURLToPath as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
lockInTransaction(t = "pessimistic_write") {
|
|
499
|
-
return this.em ? {
|
|
500
|
-
mode: t
|
|
501
|
-
} : void 0;
|
|
502
|
-
}
|
|
503
|
-
getRepository(t) {
|
|
504
|
-
return this.em ? this.em.getRepository(t) : this.dataSource.getRepository(t);
|
|
505
|
-
}
|
|
506
|
-
async withTransaction(t) {
|
|
507
|
-
let n;
|
|
508
|
-
return await this.dataSource.transaction(async (c) => {
|
|
509
|
-
n = await t(
|
|
510
|
-
Y.newInstance(this).withEntityManager(c)
|
|
511
|
-
);
|
|
512
|
-
}), n;
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
const me = (h) => ({
|
|
516
|
-
...h,
|
|
517
|
-
withTransaction: async (t) => await t(h),
|
|
518
|
-
withRepositoryManager: () => h
|
|
519
|
-
}), fe = (h, t) => `unaccent(LOWER(${h})) ILIKE unaccent(LOWER(:${t}))`, we = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
520
|
-
__proto__: null,
|
|
521
|
-
unaccentSearch: fe
|
|
522
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
523
|
-
export {
|
|
524
|
-
ve as GCPLogger,
|
|
525
|
-
ce as LogLevelToConsoleMethodMap,
|
|
526
|
-
Ee as MockLogger,
|
|
527
|
-
Y as TransactionalRepository,
|
|
528
|
-
me as buildTransactionalRepositoryMock,
|
|
529
|
-
ye as loadEnvConfig,
|
|
530
|
-
we as postgres
|
|
531
|
-
};
|
|
1
|
+
import e from "path";
|
|
2
|
+
import { fileURLToPath as t } from "url";
|
|
3
|
+
//#region \0rolldown/runtime.js
|
|
4
|
+
var n = Object.create, r = Object.defineProperty, i = Object.getOwnPropertyDescriptor, a = Object.getOwnPropertyNames, o = Object.getPrototypeOf, s = Object.prototype.hasOwnProperty, c = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), l = (e, t) => {
|
|
5
|
+
let n = {};
|
|
6
|
+
for (var i in e) r(n, i, {
|
|
7
|
+
get: e[i],
|
|
8
|
+
enumerable: !0
|
|
9
|
+
});
|
|
10
|
+
return t || r(n, Symbol.toStringTag, { value: "Module" }), n;
|
|
11
|
+
}, u = (e, t, n, o) => {
|
|
12
|
+
if (t && typeof t == "object" || typeof t == "function") for (var c = a(t), l = 0, u = c.length, d; l < u; l++) d = c[l], !s.call(e, d) && d !== n && r(e, d, {
|
|
13
|
+
get: ((e) => t[e]).bind(null, d),
|
|
14
|
+
enumerable: !(o = i(t, d)) || o.enumerable
|
|
15
|
+
});
|
|
16
|
+
return e;
|
|
17
|
+
}, d = (e, t, i) => (i = e == null ? {} : n(o(e)), u(t || !e || !e.__esModule ? r(i, "default", {
|
|
18
|
+
value: e,
|
|
19
|
+
enumerable: !0
|
|
20
|
+
}) : i, e)), f = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
|
|
21
|
+
if (typeof require < "u") return require.apply(this, arguments);
|
|
22
|
+
throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
|
|
23
|
+
}), p = /* @__PURE__ */ d((/* @__PURE__ */ c(((e, t) => {
|
|
24
|
+
var n = f("fs"), r = f("path"), i = f("os"), a = f("crypto"), o = [
|
|
25
|
+
"◈ encrypted .env [www.dotenvx.com]",
|
|
26
|
+
"◈ secrets for agents [www.dotenvx.com]",
|
|
27
|
+
"⌁ auth for agents [www.vestauth.com]",
|
|
28
|
+
"⌘ custom filepath { path: '/custom/path/.env' }",
|
|
29
|
+
"⌘ enable debugging { debug: true }",
|
|
30
|
+
"⌘ override existing { override: true }",
|
|
31
|
+
"⌘ suppress logs { quiet: true }",
|
|
32
|
+
"⌘ multiple files { path: ['.env.local', '.env'] }"
|
|
33
|
+
];
|
|
34
|
+
function s() {
|
|
35
|
+
return o[Math.floor(Math.random() * o.length)];
|
|
36
|
+
}
|
|
37
|
+
function c(e) {
|
|
38
|
+
return typeof e == "string" ? ![
|
|
39
|
+
"false",
|
|
40
|
+
"0",
|
|
41
|
+
"no",
|
|
42
|
+
"off",
|
|
43
|
+
""
|
|
44
|
+
].includes(e.toLowerCase()) : !!e;
|
|
45
|
+
}
|
|
46
|
+
function l() {
|
|
47
|
+
return process.stdout.isTTY;
|
|
48
|
+
}
|
|
49
|
+
function u(e) {
|
|
50
|
+
return l() ? `\x1b[2m${e}\x1b[0m` : e;
|
|
51
|
+
}
|
|
52
|
+
var d = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;
|
|
53
|
+
function p(e) {
|
|
54
|
+
let t = {}, n = e.toString();
|
|
55
|
+
n = n.replace(/\r\n?/gm, "\n");
|
|
56
|
+
let r;
|
|
57
|
+
for (; (r = d.exec(n)) != null;) {
|
|
58
|
+
let e = r[1], n = r[2] || "";
|
|
59
|
+
n = n.trim();
|
|
60
|
+
let i = n[0];
|
|
61
|
+
n = n.replace(/^(['"`])([\s\S]*)\1$/gm, "$2"), i === "\"" && (n = n.replace(/\\n/g, "\n"), n = n.replace(/\\r/g, "\r")), t[e] = n;
|
|
62
|
+
}
|
|
63
|
+
return t;
|
|
64
|
+
}
|
|
65
|
+
function m(e) {
|
|
66
|
+
e ||= {};
|
|
67
|
+
let t = b(e);
|
|
68
|
+
e.path = t;
|
|
69
|
+
let n = D.configDotenv(e);
|
|
70
|
+
if (!n.parsed) {
|
|
71
|
+
let e = /* @__PURE__ */ Error(`MISSING_DATA: Cannot parse ${t} for an unknown reason`);
|
|
72
|
+
throw e.code = "MISSING_DATA", e;
|
|
73
|
+
}
|
|
74
|
+
let r = v(e).split(","), i = r.length, a;
|
|
75
|
+
for (let e = 0; e < i; e++) try {
|
|
76
|
+
let t = y(n, r[e].trim());
|
|
77
|
+
a = D.decrypt(t.ciphertext, t.key);
|
|
78
|
+
break;
|
|
79
|
+
} catch (t) {
|
|
80
|
+
if (e + 1 >= i) throw t;
|
|
81
|
+
}
|
|
82
|
+
return D.parse(a);
|
|
83
|
+
}
|
|
84
|
+
function h(e) {
|
|
85
|
+
console.error(`⚠ ${e}`);
|
|
86
|
+
}
|
|
87
|
+
function g(e) {
|
|
88
|
+
console.log(`┆ ${e}`);
|
|
89
|
+
}
|
|
90
|
+
function _(e) {
|
|
91
|
+
console.log(`◇ ${e}`);
|
|
92
|
+
}
|
|
93
|
+
function v(e) {
|
|
94
|
+
return e && e.DOTENV_KEY && e.DOTENV_KEY.length > 0 ? e.DOTENV_KEY : process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0 ? process.env.DOTENV_KEY : "";
|
|
95
|
+
}
|
|
96
|
+
function y(e, t) {
|
|
97
|
+
let n;
|
|
98
|
+
try {
|
|
99
|
+
n = new URL(t);
|
|
100
|
+
} catch (e) {
|
|
101
|
+
if (e.code === "ERR_INVALID_URL") {
|
|
102
|
+
let e = /* @__PURE__ */ Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");
|
|
103
|
+
throw e.code = "INVALID_DOTENV_KEY", e;
|
|
104
|
+
}
|
|
105
|
+
throw e;
|
|
106
|
+
}
|
|
107
|
+
let r = n.password;
|
|
108
|
+
if (!r) {
|
|
109
|
+
let e = /* @__PURE__ */ Error("INVALID_DOTENV_KEY: Missing key part");
|
|
110
|
+
throw e.code = "INVALID_DOTENV_KEY", e;
|
|
111
|
+
}
|
|
112
|
+
let i = n.searchParams.get("environment");
|
|
113
|
+
if (!i) {
|
|
114
|
+
let e = /* @__PURE__ */ Error("INVALID_DOTENV_KEY: Missing environment part");
|
|
115
|
+
throw e.code = "INVALID_DOTENV_KEY", e;
|
|
116
|
+
}
|
|
117
|
+
let a = `DOTENV_VAULT_${i.toUpperCase()}`, o = e.parsed[a];
|
|
118
|
+
if (!o) {
|
|
119
|
+
let e = /* @__PURE__ */ Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${a} in your .env.vault file.`);
|
|
120
|
+
throw e.code = "NOT_FOUND_DOTENV_ENVIRONMENT", e;
|
|
121
|
+
}
|
|
122
|
+
return {
|
|
123
|
+
ciphertext: o,
|
|
124
|
+
key: r
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
function b(e) {
|
|
128
|
+
let t = null;
|
|
129
|
+
if (e && e.path && e.path.length > 0) if (Array.isArray(e.path)) for (let r of e.path) n.existsSync(r) && (t = r.endsWith(".vault") ? r : `${r}.vault`);
|
|
130
|
+
else t = e.path.endsWith(".vault") ? e.path : `${e.path}.vault`;
|
|
131
|
+
else t = r.resolve(process.cwd(), ".env.vault");
|
|
132
|
+
return n.existsSync(t) ? t : null;
|
|
133
|
+
}
|
|
134
|
+
function x(e) {
|
|
135
|
+
return e[0] === "~" ? r.join(i.homedir(), e.slice(1)) : e;
|
|
136
|
+
}
|
|
137
|
+
function S(e) {
|
|
138
|
+
let t = c(process.env.DOTENV_CONFIG_DEBUG || e && e.debug), n = c(process.env.DOTENV_CONFIG_QUIET || e && e.quiet);
|
|
139
|
+
(t || !n) && _("loading env from encrypted .env.vault");
|
|
140
|
+
let r = D._parseVault(e), i = process.env;
|
|
141
|
+
return e && e.processEnv != null && (i = e.processEnv), D.populate(i, r, e), { parsed: r };
|
|
142
|
+
}
|
|
143
|
+
function C(e) {
|
|
144
|
+
let t = r.resolve(process.cwd(), ".env"), i = "utf8", a = process.env;
|
|
145
|
+
e && e.processEnv != null && (a = e.processEnv);
|
|
146
|
+
let o = c(a.DOTENV_CONFIG_DEBUG || e && e.debug), l = c(a.DOTENV_CONFIG_QUIET || e && e.quiet);
|
|
147
|
+
e && e.encoding ? i = e.encoding : o && g("no encoding is specified (UTF-8 is used by default)");
|
|
148
|
+
let d = [t];
|
|
149
|
+
if (e && e.path) if (!Array.isArray(e.path)) d = [x(e.path)];
|
|
150
|
+
else {
|
|
151
|
+
d = [];
|
|
152
|
+
for (let t of e.path) d.push(x(t));
|
|
153
|
+
}
|
|
154
|
+
let f, p = {};
|
|
155
|
+
for (let t of d) try {
|
|
156
|
+
let r = D.parse(n.readFileSync(t, { encoding: i }));
|
|
157
|
+
D.populate(p, r, e);
|
|
158
|
+
} catch (e) {
|
|
159
|
+
o && g(`failed to load ${t} ${e.message}`), f = e;
|
|
160
|
+
}
|
|
161
|
+
let m = D.populate(a, p, e);
|
|
162
|
+
if (o = c(a.DOTENV_CONFIG_DEBUG || o), l = c(a.DOTENV_CONFIG_QUIET || l), o || !l) {
|
|
163
|
+
let e = Object.keys(m).length, t = [];
|
|
164
|
+
for (let e of d) try {
|
|
165
|
+
let n = r.relative(process.cwd(), e);
|
|
166
|
+
t.push(n);
|
|
167
|
+
} catch (t) {
|
|
168
|
+
o && g(`failed to load ${e} ${t.message}`), f = t;
|
|
169
|
+
}
|
|
170
|
+
_(`injected env (${e}) from ${t.join(",")} ${u(`// tip: ${s()}`)}`);
|
|
171
|
+
}
|
|
172
|
+
return f ? {
|
|
173
|
+
parsed: p,
|
|
174
|
+
error: f
|
|
175
|
+
} : { parsed: p };
|
|
176
|
+
}
|
|
177
|
+
function w(e) {
|
|
178
|
+
if (v(e).length === 0) return D.configDotenv(e);
|
|
179
|
+
let t = b(e);
|
|
180
|
+
return t ? D._configVault(e) : (h(`you set DOTENV_KEY but you are missing a .env.vault file at ${t}`), D.configDotenv(e));
|
|
181
|
+
}
|
|
182
|
+
function T(e, t) {
|
|
183
|
+
let n = Buffer.from(t.slice(-64), "hex"), r = Buffer.from(e, "base64"), i = r.subarray(0, 12), o = r.subarray(-16);
|
|
184
|
+
r = r.subarray(12, -16);
|
|
185
|
+
try {
|
|
186
|
+
let e = a.createDecipheriv("aes-256-gcm", n, i);
|
|
187
|
+
return e.setAuthTag(o), `${e.update(r)}${e.final()}`;
|
|
188
|
+
} catch (e) {
|
|
189
|
+
let t = e instanceof RangeError, n = e.message === "Invalid key length", r = e.message === "Unsupported state or unable to authenticate data";
|
|
190
|
+
if (t || n) {
|
|
191
|
+
let e = /* @__PURE__ */ Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");
|
|
192
|
+
throw e.code = "INVALID_DOTENV_KEY", e;
|
|
193
|
+
} else if (r) {
|
|
194
|
+
let e = /* @__PURE__ */ Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");
|
|
195
|
+
throw e.code = "DECRYPTION_FAILED", e;
|
|
196
|
+
} else throw e;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
function E(e, t, n = {}) {
|
|
200
|
+
let r = !!(n && n.debug), i = !!(n && n.override), a = {};
|
|
201
|
+
if (typeof t != "object") {
|
|
202
|
+
let e = /* @__PURE__ */ Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");
|
|
203
|
+
throw e.code = "OBJECT_REQUIRED", e;
|
|
204
|
+
}
|
|
205
|
+
for (let n of Object.keys(t)) Object.prototype.hasOwnProperty.call(e, n) ? (i === !0 && (e[n] = t[n], a[n] = t[n]), r && g(i === !0 ? `"${n}" is already defined and WAS overwritten` : `"${n}" is already defined and was NOT overwritten`)) : (e[n] = t[n], a[n] = t[n]);
|
|
206
|
+
return a;
|
|
207
|
+
}
|
|
208
|
+
var D = {
|
|
209
|
+
configDotenv: C,
|
|
210
|
+
_configVault: S,
|
|
211
|
+
_parseVault: m,
|
|
212
|
+
config: w,
|
|
213
|
+
decrypt: T,
|
|
214
|
+
parse: p,
|
|
215
|
+
populate: E
|
|
216
|
+
};
|
|
217
|
+
t.exports.configDotenv = D.configDotenv, t.exports._configVault = D._configVault, t.exports._parseVault = D._parseVault, t.exports.config = D.config, t.exports.decrypt = D.decrypt, t.exports.parse = D.parse, t.exports.populate = D.populate, t.exports = D;
|
|
218
|
+
})))(), 1), m = t(import.meta.url), h = e.dirname(m), g = (t = {}) => {
|
|
219
|
+
let { env: n, configPath: r } = t, i = e.resolve(h, `${r ?? "."}/.env${n ? `.${n}` : ""}`), { parsed: a } = p.config({ path: i });
|
|
220
|
+
return a;
|
|
221
|
+
}, _ = /* @__PURE__ */ d((/* @__PURE__ */ c(((e, t) => {
|
|
222
|
+
t.exports = s, s.default = s, s.stable = d, s.stableStringify = d;
|
|
223
|
+
var n = "[...]", r = "[Circular]", i = [], a = [];
|
|
224
|
+
function o() {
|
|
225
|
+
return {
|
|
226
|
+
depthLimit: 2 ** 53 - 1,
|
|
227
|
+
edgesLimit: 2 ** 53 - 1
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
function s(e, t, n, r) {
|
|
231
|
+
r === void 0 && (r = o()), l(e, "", 0, [], void 0, 0, r);
|
|
232
|
+
var s;
|
|
233
|
+
try {
|
|
234
|
+
s = a.length === 0 ? JSON.stringify(e, t, n) : JSON.stringify(e, p(t), n);
|
|
235
|
+
} catch {
|
|
236
|
+
return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]");
|
|
237
|
+
} finally {
|
|
238
|
+
for (; i.length !== 0;) {
|
|
239
|
+
var c = i.pop();
|
|
240
|
+
c.length === 4 ? Object.defineProperty(c[0], c[1], c[3]) : c[0][c[1]] = c[2];
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
return s;
|
|
244
|
+
}
|
|
245
|
+
function c(e, t, n, r) {
|
|
246
|
+
var o = Object.getOwnPropertyDescriptor(r, n);
|
|
247
|
+
o.get === void 0 ? (r[n] = e, i.push([
|
|
248
|
+
r,
|
|
249
|
+
n,
|
|
250
|
+
t
|
|
251
|
+
])) : o.configurable ? (Object.defineProperty(r, n, { value: e }), i.push([
|
|
252
|
+
r,
|
|
253
|
+
n,
|
|
254
|
+
t,
|
|
255
|
+
o
|
|
256
|
+
])) : a.push([
|
|
257
|
+
t,
|
|
258
|
+
n,
|
|
259
|
+
e
|
|
260
|
+
]);
|
|
261
|
+
}
|
|
262
|
+
function l(e, t, i, a, o, s, u) {
|
|
263
|
+
s += 1;
|
|
264
|
+
var d;
|
|
265
|
+
if (typeof e == "object" && e) {
|
|
266
|
+
for (d = 0; d < a.length; d++) if (a[d] === e) {
|
|
267
|
+
c(r, e, t, o);
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
if (u.depthLimit !== void 0 && s > u.depthLimit) {
|
|
271
|
+
c(n, e, t, o);
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
if (u.edgesLimit !== void 0 && i + 1 > u.edgesLimit) {
|
|
275
|
+
c(n, e, t, o);
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
if (a.push(e), Array.isArray(e)) for (d = 0; d < e.length; d++) l(e[d], d, d, a, e, s, u);
|
|
279
|
+
else {
|
|
280
|
+
var f = Object.keys(e);
|
|
281
|
+
for (d = 0; d < f.length; d++) {
|
|
282
|
+
var p = f[d];
|
|
283
|
+
l(e[p], p, d, a, e, s, u);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
a.pop();
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
function u(e, t) {
|
|
290
|
+
return e < t ? -1 : e > t ? 1 : 0;
|
|
291
|
+
}
|
|
292
|
+
function d(e, t, n, r) {
|
|
293
|
+
r === void 0 && (r = o());
|
|
294
|
+
var s = f(e, "", 0, [], void 0, 0, r) || e, c;
|
|
295
|
+
try {
|
|
296
|
+
c = a.length === 0 ? JSON.stringify(s, t, n) : JSON.stringify(s, p(t), n);
|
|
297
|
+
} catch {
|
|
298
|
+
return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]");
|
|
299
|
+
} finally {
|
|
300
|
+
for (; i.length !== 0;) {
|
|
301
|
+
var l = i.pop();
|
|
302
|
+
l.length === 4 ? Object.defineProperty(l[0], l[1], l[3]) : l[0][l[1]] = l[2];
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
return c;
|
|
306
|
+
}
|
|
307
|
+
function f(e, t, a, o, s, l, d) {
|
|
308
|
+
l += 1;
|
|
309
|
+
var p;
|
|
310
|
+
if (typeof e == "object" && e) {
|
|
311
|
+
for (p = 0; p < o.length; p++) if (o[p] === e) {
|
|
312
|
+
c(r, e, t, s);
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
try {
|
|
316
|
+
if (typeof e.toJSON == "function") return;
|
|
317
|
+
} catch {
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
if (d.depthLimit !== void 0 && l > d.depthLimit) {
|
|
321
|
+
c(n, e, t, s);
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
if (d.edgesLimit !== void 0 && a + 1 > d.edgesLimit) {
|
|
325
|
+
c(n, e, t, s);
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
if (o.push(e), Array.isArray(e)) for (p = 0; p < e.length; p++) f(e[p], p, p, o, e, l, d);
|
|
329
|
+
else {
|
|
330
|
+
var m = {}, h = Object.keys(e).sort(u);
|
|
331
|
+
for (p = 0; p < h.length; p++) {
|
|
332
|
+
var g = h[p];
|
|
333
|
+
f(e[g], g, p, o, e, l, d), m[g] = e[g];
|
|
334
|
+
}
|
|
335
|
+
if (s !== void 0) i.push([
|
|
336
|
+
s,
|
|
337
|
+
t,
|
|
338
|
+
e
|
|
339
|
+
]), s[t] = m;
|
|
340
|
+
else return m;
|
|
341
|
+
}
|
|
342
|
+
o.pop();
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
function p(e) {
|
|
346
|
+
return e = e === void 0 ? function(e, t) {
|
|
347
|
+
return t;
|
|
348
|
+
} : e, function(t, n) {
|
|
349
|
+
if (a.length > 0) for (var r = 0; r < a.length; r++) {
|
|
350
|
+
var i = a[r];
|
|
351
|
+
if (i[1] === t && i[0] === n) {
|
|
352
|
+
n = i[2], a.splice(r, 1);
|
|
353
|
+
break;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
return e.call(this, t, n);
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
})))(), 1), v = {
|
|
360
|
+
debug: "debug",
|
|
361
|
+
verbose: "debug",
|
|
362
|
+
log: "log",
|
|
363
|
+
warn: "warn",
|
|
364
|
+
error: "error",
|
|
365
|
+
fatal: "error"
|
|
366
|
+
}, y = {
|
|
367
|
+
verbose: "DEFAULT",
|
|
368
|
+
debug: "DEBUG",
|
|
369
|
+
log: "INFO",
|
|
370
|
+
warn: "WARNING",
|
|
371
|
+
error: "ERROR",
|
|
372
|
+
fatal: "CRITICAL"
|
|
373
|
+
}, b = [
|
|
374
|
+
"x-api-key",
|
|
375
|
+
"x-api-token",
|
|
376
|
+
"x-key",
|
|
377
|
+
"x-token",
|
|
378
|
+
"cookie",
|
|
379
|
+
"password",
|
|
380
|
+
"pass",
|
|
381
|
+
"psw",
|
|
382
|
+
"auth",
|
|
383
|
+
"authentication",
|
|
384
|
+
"authorization",
|
|
385
|
+
"token",
|
|
386
|
+
"access_token",
|
|
387
|
+
"client-secret",
|
|
388
|
+
"credentials",
|
|
389
|
+
"secret"
|
|
390
|
+
], x = class {
|
|
391
|
+
levels = new Set([
|
|
392
|
+
"verbose",
|
|
393
|
+
"debug",
|
|
394
|
+
"log",
|
|
395
|
+
"warn",
|
|
396
|
+
"error",
|
|
397
|
+
"fatal"
|
|
398
|
+
]);
|
|
399
|
+
constructor(e, t = {}) {
|
|
400
|
+
this.module = e, t.logLevels && (this.levels = new Set(t.logLevels));
|
|
401
|
+
}
|
|
402
|
+
mapLogLevelToConsoleMethod(e) {
|
|
403
|
+
return v[e];
|
|
404
|
+
}
|
|
405
|
+
write(e, t, n, r, i) {
|
|
406
|
+
if (!this.levels.has(e)) return;
|
|
407
|
+
let a = (0, _.default)(this.buildLog(e, t, n, r, i), this.sensitiveReplacer), o = this.mapLogLevelToConsoleMethod(e);
|
|
408
|
+
console[o](a);
|
|
409
|
+
}
|
|
410
|
+
buildLog(e, t, n, r, i) {
|
|
411
|
+
let { writeMetadata: a, writeContext: o, writeError: s } = this.sanitizeLog(n, r, i), c = {};
|
|
412
|
+
return typeof t == "string" && (c.textPayload = t), !a && typeof t != "string" && !(t instanceof Error) && (c.metadata = t), t instanceof Error && (c.error = JSON.stringify(t, Object.getOwnPropertyNames(t))), o && (c.context = o), a && (c.metadata = a), !c.error && s && (c.error = JSON.stringify(s, Object.getOwnPropertyNames(s))), {
|
|
413
|
+
severity: y[e],
|
|
414
|
+
module: this.module,
|
|
415
|
+
textPayload: c.textPayload,
|
|
416
|
+
message: c
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
sanitizeLog(e, t, n) {
|
|
420
|
+
if (t instanceof Error && (!n || typeof n == "string")) return {
|
|
421
|
+
writeMetadata: void 0,
|
|
422
|
+
writeContext: e || n,
|
|
423
|
+
writeError: t
|
|
424
|
+
};
|
|
425
|
+
let r = t, i = e;
|
|
426
|
+
return typeof r == "string" && !e && (i = r, r = void 0), {
|
|
427
|
+
writeMetadata: r,
|
|
428
|
+
writeContext: i,
|
|
429
|
+
writeError: n
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
sensitiveReplacer(e, t) {
|
|
433
|
+
return b.includes(e.toLowerCase()) ? "[HIDDEN BY LOGGER]" : t;
|
|
434
|
+
}
|
|
435
|
+
debug(e, t, n) {
|
|
436
|
+
this.write("debug", e, n, t);
|
|
437
|
+
}
|
|
438
|
+
verbose(e, t, n) {
|
|
439
|
+
this.write("verbose", e, n, t);
|
|
440
|
+
}
|
|
441
|
+
log(e, t, n) {
|
|
442
|
+
this.write("log", e, n, t);
|
|
443
|
+
}
|
|
444
|
+
warn(e, t, n, r) {
|
|
445
|
+
this.write("warn", e, r, t, n);
|
|
446
|
+
}
|
|
447
|
+
error(e, t, n, r) {
|
|
448
|
+
this.write("error", e, r, t, n);
|
|
449
|
+
}
|
|
450
|
+
fatal(e, t, n, r) {
|
|
451
|
+
this.write("fatal", e, r, t, n);
|
|
452
|
+
}
|
|
453
|
+
setLogLevels(e) {
|
|
454
|
+
this.levels = new Set(e);
|
|
455
|
+
}
|
|
456
|
+
}, S = class {
|
|
457
|
+
debug = () => void 0;
|
|
458
|
+
verbose = () => void 0;
|
|
459
|
+
log = () => void 0;
|
|
460
|
+
warn = () => void 0;
|
|
461
|
+
error = () => void 0;
|
|
462
|
+
fatal = () => void 0;
|
|
463
|
+
setLogLevels = () => void 0;
|
|
464
|
+
}, C = class e {
|
|
465
|
+
em;
|
|
466
|
+
constructor(e) {
|
|
467
|
+
this.dataSource = e;
|
|
468
|
+
}
|
|
469
|
+
static newInstance(e) {
|
|
470
|
+
let t = e.constructor;
|
|
471
|
+
return new t(e.dataSource);
|
|
472
|
+
}
|
|
473
|
+
withEntityManager(e) {
|
|
474
|
+
return this.em = e, this;
|
|
475
|
+
}
|
|
476
|
+
withRepositoryManager(t) {
|
|
477
|
+
return e.newInstance(this).withEntityManager(t.em);
|
|
478
|
+
}
|
|
479
|
+
lockInTransaction(e = "pessimistic_write") {
|
|
480
|
+
return this.em ? { mode: e } : void 0;
|
|
481
|
+
}
|
|
482
|
+
getRepository(e) {
|
|
483
|
+
return this.em ? this.em.getRepository(e) : this.dataSource.getRepository(e);
|
|
484
|
+
}
|
|
485
|
+
async withTransaction(t) {
|
|
486
|
+
let n;
|
|
487
|
+
return await this.dataSource.transaction(async (r) => {
|
|
488
|
+
n = await t(e.newInstance(this).withEntityManager(r));
|
|
489
|
+
}), n;
|
|
490
|
+
}
|
|
491
|
+
}, w = (e) => ({
|
|
492
|
+
...e,
|
|
493
|
+
withTransaction: async (t) => await t(e),
|
|
494
|
+
withRepositoryManager: () => e
|
|
495
|
+
}), T = (e, t) => `unaccent(LOWER(${e})) ILIKE unaccent(LOWER(:${t}))`, E = /* @__PURE__ */ l({ unaccentSearch: () => T });
|
|
496
|
+
//#endregion
|
|
497
|
+
export { x as GCPLogger, v as LogLevelToConsoleMethodMap, S as MockLogger, C as TransactionalRepository, w as buildTransactionalRepositoryMock, g as loadEnvConfig, E as postgres };
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export * from '
|
|
2
|
-
export
|
|
1
|
+
export * from './env/env.loader';
|
|
2
|
+
export * from './logger';
|
|
3
|
+
export * from './database';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsfsi-core/ts-nodejs",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.41",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"dist"
|
|
24
24
|
],
|
|
25
25
|
"scripts": {
|
|
26
|
-
"build": "npm run lint && tsc && vite build",
|
|
26
|
+
"build": "npm run lint && tsc --noEmit && vite build",
|
|
27
27
|
"build:watch": "tsc && (tsc --watch & vite build --watch)",
|
|
28
28
|
"clean": "rm -rf dist && rm -rf node_modules && rm -rf coverage",
|
|
29
29
|
"format": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,css,md}\"",
|
|
@@ -35,14 +35,14 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@jsfsi-core/ts-crossplatform": "file:../ts-crossplatform",
|
|
38
|
-
"dotenv": "17.
|
|
38
|
+
"dotenv": "17.4.1",
|
|
39
39
|
"fast-safe-stringify": "2.1.1",
|
|
40
40
|
"typeorm": "0.3.28"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@vitest/coverage-v8": "4.
|
|
44
|
-
"vite": "
|
|
43
|
+
"@vitest/coverage-v8": "4.1.2",
|
|
44
|
+
"vite": "^8.0.5",
|
|
45
45
|
"vite-plugin-dts": "4.5.4",
|
|
46
|
-
"vitest": "4.
|
|
46
|
+
"vitest": "4.1.2"
|
|
47
47
|
}
|
|
48
48
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|