object-unpacker
Advanced tools
Comparing version 0.0.21 to 0.0.22
@@ -1,1 +0,1 @@ | ||
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.ObjectUnpacker=r():e.ObjectUnpacker=r()}(self,(function(){return(()=>{"use strict";var e={571:(e,r,t)=>{const n=t(346);e.exports=a;const i=function(){function e(e){return void 0!==e&&e}try{return"undefined"!=typeof globalThis||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch(r){return e(self)||e(window)||e(this)||{}}}().console||{},s={mapHttpRequest:v,mapHttpResponse:v,wrapRequestSerializer:h,wrapResponseSerializer:h,wrapErrorSerializer:h,req:v,res:v,err:function(e){const r={type:e.constructor.name,msg:e.message,stack:e.stack};for(const t in e)void 0===r[t]&&(r[t]=e[t]);return r}};function a(e){(e=e||{}).browser=e.browser||{};const r=e.browser.transmit;if(r&&"function"!=typeof r.send)throw Error("pino: transmit option must have a send function");const t=e.browser.write||i;e.browser.write&&(e.browser.asObject=!0);const n=e.serializers||{},s=function(e,r){return Array.isArray(e)?e.filter((function(e){return"!stdSerializers.err"!==e})):!0===e&&Object.keys(r)}(e.browser.serialize,n);let l=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(l=!1),"function"==typeof t&&(t.error=t.fatal=t.warn=t.info=t.debug=t.trace=t),!1===e.enabled&&(e.level="silent");const f=e.level||"info",v=Object.create(t);v.log||(v.log=b),Object.defineProperty(v,"levelVal",{get:function(){return"silent"===this.level?1/0:this.levels.values[this.level]}}),Object.defineProperty(v,"level",{get:function(){return this._level},set:function(e){if("silent"!==e&&!this.levels.values[e])throw Error("unknown level "+e);this._level=e,o(h,v,"error","log"),o(h,v,"fatal","error"),o(h,v,"warn","error"),o(h,v,"info","log"),o(h,v,"debug","log"),o(h,v,"trace","log")}});const h={transmit:r,serialize:s,asObject:e.browser.asObject,levels:["error","fatal","warn","info","debug","trace"],timestamp:y(e)};return v.levels=a.levels,v.level=f,v.setMaxListeners=v.getMaxListeners=v.emit=v.addListener=v.on=v.prependListener=v.once=v.prependOnceListener=v.removeListener=v.removeAllListeners=v.listeners=v.listenerCount=v.eventNames=v.write=v.flush=b,v.serializers=n,v._serialize=s,v._stdErrSerialize=l,v.child=function(t,i){if(!t)throw new Error("missing bindings for child Pino");i=i||{},s&&t.serializers&&(i.serializers=t.serializers);const a=i.serializers;if(s&&a){var o=Object.assign({},n,a),l=!0===e.browser.serialize?Object.keys(o):s;delete t.serializers,u([t],l,o,this._stdErrSerialize)}function f(e){this._childLevel=1+(0|e._childLevel),this.error=c(e,t,"error"),this.fatal=c(e,t,"fatal"),this.warn=c(e,t,"warn"),this.info=c(e,t,"info"),this.debug=c(e,t,"debug"),this.trace=c(e,t,"trace"),o&&(this.serializers=o,this._serialize=l),r&&(this._logEvent=p([].concat(e._logEvent.bindings,t)))}return f.prototype=this,new f(this)},r&&(v._logEvent=p()),v}function o(e,r,t,n){const s=Object.getPrototypeOf(r);r[t]=r.levelVal>r.levels.values[t]?b:s[t]?s[t]:i[t]||i[n]||b,function(e,r,t){var n;(e.transmit||r[t]!==b)&&(r[t]=(n=r[t],function(){const s=e.timestamp(),o=new Array(arguments.length),c=Object.getPrototypeOf&&Object.getPrototypeOf(this)===i?i:this;for(var p=0;p<o.length;p++)o[p]=arguments[p];if(e.serialize&&!e.asObject&&u(o,this._serialize,this.serializers,this._stdErrSerialize),e.asObject?n.call(c,l(this,t,o,s)):n.apply(c,o),e.transmit){const n=e.transmit.level||r.level,i=a.levels.values[n],l=a.levels.values[t];if(l<i)return;f(this,{ts:s,methodLevel:t,methodValue:l,transmitLevel:n,transmitValue:a.levels.values[e.transmit.level||r.level],send:e.transmit.send,val:r.levelVal},o)}}))}(e,r,t)}function l(e,r,t,i){e._serialize&&u(t,e._serialize,e.serializers,e._stdErrSerialize);const s=t.slice();let o=s[0];const l={};i&&(l.time=i),l.level=a.levels.values[r];let c=1+(0|e._childLevel);if(c<1&&(c=1),null!==o&&"object"==typeof o){for(;c--&&"object"==typeof s[0];)Object.assign(l,s.shift());o=s.length?n(s.shift(),s):void 0}else"string"==typeof o&&(o=n(s.shift(),s));return void 0!==o&&(l.msg=o),l}function u(e,r,t,n){for(const i in e)if(n&&e[i]instanceof Error)e[i]=a.stdSerializers.err(e[i]);else if("object"==typeof e[i]&&!Array.isArray(e[i]))for(const n in e[i])r&&r.indexOf(n)>-1&&n in t&&(e[i][n]=t[n](e[i][n]))}function c(e,r,t){return function(){const n=new Array(1+arguments.length);n[0]=r;for(var i=1;i<n.length;i++)n[i]=arguments[i-1];return e[t].apply(this,n)}}function f(e,r,t){const n=r.send,i=r.ts,s=r.methodLevel,a=r.methodValue,o=r.val,l=e._logEvent.bindings;u(t,e._serialize||Object.keys(e.serializers),e.serializers,void 0===e._stdErrSerialize||e._stdErrSerialize),e._logEvent.ts=i,e._logEvent.messages=t.filter((function(e){return-1===l.indexOf(e)})),e._logEvent.level.label=s,e._logEvent.level.value=a,n(s,e._logEvent,o),e._logEvent=p(l)}function p(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function y(e){return"function"==typeof e.timestamp?e.timestamp:!1===e.timestamp?d:g}function v(){return{}}function h(e){return e}function b(){}function d(){return!1}function g(){return Date.now()}a.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},a.stdSerializers=s,a.stdTimeFunctions=Object.assign({},{nullTime:d,epochTime:g,unixTime:function(){return Math.round(Date.now()/1e3)},isoTime:function(){return new Date(Date.now()).toISOString()}})},346:e=>{function r(e){try{return JSON.stringify(e)}catch(e){return'"[Circular]"'}}e.exports=function(e,t,n){var i=n&&n.stringify||r;if("object"==typeof e&&null!==e){var s=t.length+1;if(1===s)return e;var a=new Array(s);a[0]=i(e);for(var o=1;o<s;o++)a[o]=i(t[o]);return a.join(" ")}if("string"!=typeof e)return e;var l=t.length;if(0===l)return e;for(var u="",c=0,f=-1,p=e&&e.length||0,y=0;y<p;){if(37===e.charCodeAt(y)&&y+1<p){switch(f=f>-1?f:0,e.charCodeAt(y+1)){case 100:case 102:if(c>=l)break;if(null==t[c])break;f<y&&(u+=e.slice(f,y)),u+=Number(t[c]),f=y+2,y++;break;case 105:if(c>=l)break;if(null==t[c])break;f<y&&(u+=e.slice(f,y)),u+=Math.floor(Number(t[c])),f=y+2,y++;break;case 79:case 111:case 106:if(c>=l)break;if(void 0===t[c])break;f<y&&(u+=e.slice(f,y));var v=typeof t[c];if("string"===v){u+="'"+t[c]+"'",f=y+2,y++;break}if("function"===v){u+=t[c].name||"<anonymous>",f=y+2,y++;break}u+=i(t[c]),f=y+2,y++;break;case 115:if(c>=l)break;f<y&&(u+=e.slice(f,y)),u+=String(t[c]),f=y+2,y++;break;case 37:f<y&&(u+=e.slice(f,y)),u+="%",f=y+2,y++,c--}++c}++y}return-1===f?e:(f<p&&(u+=e.slice(f)),u)}},616:(e,r,t)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.createObjectUnpacker=void 0;var n=t(503);r.createObjectUnpacker=function(e){switch(e){case"0.0.18":case"0.0.19":case"0.0.20":case"0.0.21":default:return new n.ObjectUnpacker001}}},503:function(e,r,t){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.ObjectUnpacker001=void 0;var i=n(t(571)),s=t(980),a=t(27),o=t(102),l=i.default(),u=function(){function e(){}return e.prototype.convert=function(e,r,t){try{var n=v(t),i=o.transform(r,o.prefixReferences),a=new Map;o.indexObject(c,f,p,s.INDEX_NAMESPACE,a,i["?"]),o.indexObject(c,f,p,s.COMPACT_NAMESPACE,a,i),o.indexObject(c,f,p,s.SUBS_NAMESPACE,a,e);var u=h(i,n,a);return delete u["?"],y.resolve(a,u)}catch(e){return l.error(e.message),{error:e.message}}},e}();r.ObjectUnpacker001=u;var c="%",f="%",p=!0,y=s.createReferencesResolver(),v=function(e){var r=new Map;return Object.keys(e).forEach((function(t){r.set(t,new a.TransformationInstruction(t,e[t]))})),r},h=function(e,r,t){if(null===e)return null;if(Array.isArray(e))return e.map((function(e){return h(e,r,t)}));if("object"==typeof e){var n={};return Object.keys(e).forEach((function(i){var s=r.get(i);if(s&&s.additionalKeys&&s.additionalKeys.has(i)&&(s=s.additionalKeys.get(i)),s){if(s.isRemovePair())return;var a="object"!=typeof e[i]&&s.assignKeys?[e[i]]:e[i],l=b(a,s,r,t);"string"==typeof l&&l.includes("%self")&&(l=S(a,l));var u=s.transformKey(i);if(s.replacePair)P(l)&&M(l,n);else if(s.rewriteValue)if(s.resultValue)if("object"==typeof s.resultValue)n[u]=b(a,s,r,t);else if("string"==typeof s.resultValue&&s.resultValue.startsWith("%")){var y=new Map;t.forEach((function(e,r){return y.set(r,e)})),o.indexObject(c,f,p,"",y,a),n[u]=b(a,s,r,y)}else n[u]=l;else n[u]=null;else n[u]=l}else t.has(i)?n[i]=t.get(i):n[i]=h(e[i],r,t)})),n}return e},b=function(e,r,t,n){if(null===e)return e;var i=P(e)?k(e,r,n):e,s=Array.isArray(i)&&r.assignKeys?g(r.assignKeys,i):new Map,a=new Map;if(n.forEach((function(e,r){return a.set(r,e)})),o.indexObject(c,f,p,"",a,d(s)),r.isArrayMapping()){if(Array.isArray(i)){var l=r.arrayItemsName,u=l?m(l,i):i;return r.assignKeys?g(r.assignKeys,u):h(u,t,a)}throw new Error('"arrayItems" can only be applied to arrays.')}if(!r.resultValue)return s.size>0?h(d(s),t,a):h(i,t,a);switch(typeof r.resultValue){case"object":return Array.isArray(r.resultValue)?j(r,t,a):w(r,i,t,a,s);case"string":return"%self"===r.resultValue?h(i,t,a):r.resultValue.match("^%[a-zA-Z]+(.[a-zA-Z]+)*$")?a.get(r.resultValue):h(r.resultValue,t,a);default:return r.resultValue}},d=function(e){var r={};return e.forEach((function(e,t){return r[t]=e})),r},g=function(e,r){var t=new Map;return Array.isArray(r)?e.forEach((function(e,n){n<r.length?t.set(e,r[n]):t.set(e,null)})):"object"==typeof r?e.forEach((function(e){t.set(e,r[e])})):e.forEach((function(e,n){0===n?t.set(e,r):t.set(e,null)})),t},m=function(e,r){return r.map((function(r){var t={};return t[e]=r,t}))},w=function(e,r,t,n,i){var s={},a=e.resultValue?e.resultValue:r;return Object.keys(a).forEach((function(e){var l=h(a[e],t,n);if("string"==typeof l){var u=l;if(E(r,u))"object"==typeof(v=r[u.substr(1)])?O(v,t,u)?s[e]=b(v,t.get(u.substr(1)),t,n):s[e]=h(v,t,n):s[e]=v;else if(A(u,i)){var v;(v=i.get(u.substr(1)))&&"object"==typeof v?O(v,t,u)?s[e]=b(v,t.get(u.substr(1)),t,n):s[e]=h(v,t,n):s[e]=v}else if(_(u)){var d=new Map;n.forEach((function(e,r){return d.set(r,e)})),o.indexObject(c,f,p,"",d,r),s[e]=y.resolve(d,l)}else u.includes("%self")?s[e]=S(r,u):n.has(u)?s[e]=n.get(u):s[e]=null}else z(l)?s[e]=y.resolve(n,l):s[e]=l})),s},j=function(e,r,t){return e.resultValue&&Array.isArray(e.resultValue)?e.resultValue.map((function(n){return b(n,e,r,t)})).filter((function(e){return null!==e})):[]},E=function(e,r){return"object"==typeof e&&"%"===r.charAt(0)&&e.hasOwnProperty(r.substr(1))},A=function(e,r){return"%"===e.charAt(0)&&r.has(e.substr(1))},O=function(e,r,t){return Array.isArray(e)&&r.has(t.substr(1))},_=function(e){return e.startsWith("%/")||!e.startsWith("%")&&!e.includes("%self")},z=function(e){return null!==e&&"object"==typeof e},S=function(e,r){var t=new Map;return t.set("%self",e),t.set("%self%",e),y.resolve(t,r)},P=function(e){return null!==e&&!Array.isArray(e)&&"object"==typeof e},M=function(e,r){Object.keys(e).forEach((function(t){r[t]=e[t]}))},k=function(e,r,t){var n=e,i={};for(var s in n)if(r.additionalKeys.has(s)){var a=r.additionalKeys.get(s);i[a.transformKey(s)]=h(n[s],a.additionalKeys,t)}else i[s]=n[s];return i}},980:(e,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.FIND_REFS=r.SUBS_NAMESPACE=r.COMPACT_NAMESPACE=r.INDEX_NAMESPACE=r.createReferencesResolver=void 0,r.createReferencesResolver=function(){return new t},r.INDEX_NAMESPACE="/index",r.COMPACT_NAMESPACE="/compact",r.SUBS_NAMESPACE="/subs",r.FIND_REFS=new RegExp(/%?%[\w-./@]+%?/gm);var t=function(){function e(){}return e.prototype.resolve=function(e,r){if(null==r)throw new Error("Cannot dereference an undefined dataObject.");if("string"==typeof r)return s(e,r);var t=Array.isArray(r["?"])?r["?"]:[r["?"]];return t&&t.forEach((function(r,t){e.set("%"+t,r),e.set("%"+t+"%",r)})),Array.isArray(r)?n("",e,r):i("",e,r)},e}(),n=function(e,r,t){var a=[];return t.forEach((function(t,o){var l=e+"."+o;Array.isArray(t)?a.push(n(l,r,t)):"object"==typeof t?a.push(i(l,r,t)):"string"==typeof t?a.push(s(r,t)):a.push(t)})),a},i=function(e,r,t){if(null===t)return null;var a={};return Object.keys(t).forEach((function(o){var l=t[o];if(null!==l){var u=e+"."+o;Array.isArray(l)?a[o]=n(u,r,l):a[o]="object"==typeof l?i(u,r,l):"string"==typeof l?s(r,l):l}else a[o]=null})),a},s=function(e,t){for(var n=t,i=[],s=r.FIND_REFS.exec(n);null!==s;){var o=s[0];i.push(o),s=r.FIND_REFS.exec(n)}return i.forEach((function(r){if(!r.startsWith("%%")){var t=e.get(r);if(null!=t&&"string"==typeof n)if(n===r)n="string"==typeof t?a(t):t;else if("object"==typeof t){var i=a(r);console.error(i+" refers to an object or array and cannot be embedded in a string"),n=n.replace(r,""+i)}else n=n.replace(r,""+t);else n=n===r?null:n.replace(r,"")}})),"string"==typeof n?n.replace("%%","%"):n},a=function(e){return e.replace("/index.","").replace("/subs.","")}},27:(e,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TransformationInstruction=void 0;var t=["rewriteValue","assignKeys","rewriteKey","replacePair","arrayItems"],n=function(){function e(r,n){var i=this;this.key=r,this.rewriteValue=!!n.hasOwnProperty("rewriteValue"),this.replacePair=!!n.hasOwnProperty("replacePair"),this.assignKeys=n.assignKeys?n.assignKeys:null,this.resultValue=n.rewriteValue?n.rewriteValue:n.replacePair,this.rewriteKey=n.rewriteKey?n.rewriteKey:null,this.arrayItemsName=n.arrayItems?n.arrayItems:null,this.additionalKeys=new Map,"object"!=typeof n||Array.isArray(n)||Object.keys(n).filter((function(e){return!t.includes(e)})).forEach((function(r){i.additionalKeys.set(r,new e(r,n[r]))}))}return e.prototype.transformKey=function(e){return this.rewriteKey?this.rewriteKey:e},e.prototype.shouldRewriteValue=function(){return this.rewriteValue},e.prototype.isArrayMapping=function(){return null!==this.arrayItemsName},e.prototype.isRemovePair=function(){return!this.replacePair&&!this.rewriteValue&&null===this.arrayItemsName&&null===this.assignKeys&&null===this.rewriteKey&&void 0===this.resultValue&&0===this.additionalKeys.size},e}();r.TransformationInstruction=n},102:(e,r,t)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.identity=r.prefixReferences=r.transform=r.indexObject=void 0;var n=t(980);r.indexObject=function(e,t,n,i,s,a){a&&Object.entries(a).forEach((function(a){var o=i.length>0?i+"."+a[0]:""+a[0];n&&s.set(e+o,a[1]),s.set(e+o+t,a[1]),"object"==typeof a[1]&&r.indexObject(e,t,n,o,s,a[1])}))},r.transform=function(e,t){if(!e)return t(e);if(Array.isArray(e)){var n=[];return e.forEach((function(e){"object"==typeof e?n.push(r.transform(e,t)):n.push(t(e))})),t(n)}if("object"==typeof e){var i={};return Object.entries(e).forEach((function(e){"object"==typeof e[1]?i[e[0]]=r.transform(e[1],t):i[e[0]]=t(e[1])})),t(i)}return t(e)},r.prefixReferences=function(e){return"string"!=typeof e?e:e.replace(n.FIND_REFS,(function(e){if(e.startsWith("%%"))return e;var r=e.charCodeAt(1);return r>47&&r<58?"%"+n.INDEX_NAMESPACE+"."+e.substr(1):"%"+n.SUBS_NAMESPACE+"."+e.substr(1)}))},r.identity=function(e){return e}}},r={};function t(n){if(r[n])return r[n].exports;var i=r[n]={exports:{}};return e[n].call(i.exports,i,i.exports,t),i.exports}var n={};return(()=>{var e=n;Object.defineProperty(e,"__esModule",{value:!0}),e.mapper=void 0;var r=t(616);e.mapper=r.createObjectUnpacker()})(),n})()})); | ||
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.ObjectUnpacker=r():e.ObjectUnpacker=r()}(self,(function(){return(()=>{"use strict";var e={65:function(e,r,t){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.logger=r.Options=r.Level=void 0;var i,s=n(t(501));!function(e){e[e.silent=0]="silent",e[e.trace=10]="trace",e[e.debug=20]="debug",e[e.info=30]="info",e[e.warn=40]="warn",e[e.error=50]="error",e[e.fatal=60]="fatal"}(i=r.Level||(r.Level={}));var o=function(e,r){this.consoleOnly=e,this.level=r};r.Options=o;var a=(0,s.default)(),l=function(){function e(e){this.options=e}return e.prototype.setConsoleOnly=function(e){this.options.consoleOnly=e},e.prototype.silent=function(e){},e.prototype.trace=function(e){this.options.level<=i.trace&&(this.options.consoleOnly?console.log(e):a.trace(e))},e.prototype.debug=function(e){this.options.level<=i.debug&&(this.options.consoleOnly?console.log(e):a.debug(e))},e.prototype.info=function(e){this.options.level<=i.info&&(this.options.consoleOnly?console.info(e):a.info(e))},e.prototype.warn=function(e){this.options.level<=i.warn&&(this.options.consoleOnly?console.warn(e):a.warn(e))},e.prototype.error=function(e){this.options.level<=i.error&&(this.options.consoleOnly?console.error(e):a.error(e))},e.prototype.fatal=function(e){this.options.level<=i.fatal&&(this.options.consoleOnly?console.error(e):a.fatal(e))},e.prototype.always=function(e){console.log(e)},e.prototype.setLevel=function(e){switch(this.options.level=e,e){case i.silent:a.level="silent";break;case i.trace:a.level="trace";break;case i.debug:a.level="debug";break;case i.info:a.level="info";break;case i.warn:a.level="warn";break;case i.error:a.level="error";break;case i.fatal:a.level="fatal";break;default:a.level="info"}},e}();r.logger=new l(new o(!1,i.info))},571:(e,r,t)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Level=r.log=void 0;var n=t(65);Object.defineProperty(r,"log",{enumerable:!0,get:function(){return n.logger}}),Object.defineProperty(r,"Level",{enumerable:!0,get:function(){return n.Level}})},501:(e,r,t)=>{const n=t(346);e.exports=o;const i=function(){function e(e){return void 0!==e&&e}try{return"undefined"!=typeof globalThis||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch(r){return e(self)||e(window)||e(this)||{}}}().console||{},s={mapHttpRequest:v,mapHttpResponse:v,wrapRequestSerializer:b,wrapResponseSerializer:b,wrapErrorSerializer:b,req:v,res:v,err:function(e){const r={type:e.constructor.name,msg:e.message,stack:e.stack};for(const t in e)void 0===r[t]&&(r[t]=e[t]);return r}};function o(e){(e=e||{}).browser=e.browser||{};const r=e.browser.transmit;if(r&&"function"!=typeof r.send)throw Error("pino: transmit option must have a send function");const t=e.browser.write||i;e.browser.write&&(e.browser.asObject=!0);const n=e.serializers||{},s=function(e,r){return Array.isArray(e)?e.filter((function(e){return"!stdSerializers.err"!==e})):!0===e&&Object.keys(r)}(e.browser.serialize,n);let l=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(l=!1),"function"==typeof t&&(t.error=t.fatal=t.warn=t.info=t.debug=t.trace=t),!1===e.enabled&&(e.level="silent");const f=e.level||"info",v=Object.create(t);v.log||(v.log=h),Object.defineProperty(v,"levelVal",{get:function(){return"silent"===this.level?1/0:this.levels.values[this.level]}}),Object.defineProperty(v,"level",{get:function(){return this._level},set:function(e){if("silent"!==e&&!this.levels.values[e])throw Error("unknown level "+e);this._level=e,a(b,v,"error","log"),a(b,v,"fatal","error"),a(b,v,"warn","error"),a(b,v,"info","log"),a(b,v,"debug","log"),a(b,v,"trace","log")}});const b={transmit:r,serialize:s,asObject:e.browser.asObject,levels:["error","fatal","warn","info","debug","trace"],timestamp:y(e)};return v.levels=o.levels,v.level=f,v.setMaxListeners=v.getMaxListeners=v.emit=v.addListener=v.on=v.prependListener=v.once=v.prependOnceListener=v.removeListener=v.removeAllListeners=v.listeners=v.listenerCount=v.eventNames=v.write=v.flush=h,v.serializers=n,v._serialize=s,v._stdErrSerialize=l,v.child=function(t,i){if(!t)throw new Error("missing bindings for child Pino");i=i||{},s&&t.serializers&&(i.serializers=t.serializers);const o=i.serializers;if(s&&o){var a=Object.assign({},n,o),l=!0===e.browser.serialize?Object.keys(a):s;delete t.serializers,u([t],l,a,this._stdErrSerialize)}function f(e){this._childLevel=1+(0|e._childLevel),this.error=c(e,t,"error"),this.fatal=c(e,t,"fatal"),this.warn=c(e,t,"warn"),this.info=c(e,t,"info"),this.debug=c(e,t,"debug"),this.trace=c(e,t,"trace"),a&&(this.serializers=a,this._serialize=l),r&&(this._logEvent=p([].concat(e._logEvent.bindings,t)))}return f.prototype=this,new f(this)},r&&(v._logEvent=p()),v}function a(e,r,t,n){const s=Object.getPrototypeOf(r);r[t]=r.levelVal>r.levels.values[t]?h:s[t]?s[t]:i[t]||i[n]||h,function(e,r,t){var n;(e.transmit||r[t]!==h)&&(r[t]=(n=r[t],function(){const s=e.timestamp(),a=new Array(arguments.length),c=Object.getPrototypeOf&&Object.getPrototypeOf(this)===i?i:this;for(var p=0;p<a.length;p++)a[p]=arguments[p];if(e.serialize&&!e.asObject&&u(a,this._serialize,this.serializers,this._stdErrSerialize),e.asObject?n.call(c,l(this,t,a,s)):n.apply(c,a),e.transmit){const n=e.transmit.level||r.level,i=o.levels.values[n],l=o.levels.values[t];if(l<i)return;f(this,{ts:s,methodLevel:t,methodValue:l,transmitLevel:n,transmitValue:o.levels.values[e.transmit.level||r.level],send:e.transmit.send,val:r.levelVal},a)}}))}(e,r,t)}function l(e,r,t,i){e._serialize&&u(t,e._serialize,e.serializers,e._stdErrSerialize);const s=t.slice();let a=s[0];const l={};i&&(l.time=i),l.level=o.levels.values[r];let c=1+(0|e._childLevel);if(c<1&&(c=1),null!==a&&"object"==typeof a){for(;c--&&"object"==typeof s[0];)Object.assign(l,s.shift());a=s.length?n(s.shift(),s):void 0}else"string"==typeof a&&(a=n(s.shift(),s));return void 0!==a&&(l.msg=a),l}function u(e,r,t,n){for(const i in e)if(n&&e[i]instanceof Error)e[i]=o.stdSerializers.err(e[i]);else if("object"==typeof e[i]&&!Array.isArray(e[i]))for(const n in e[i])r&&r.indexOf(n)>-1&&n in t&&(e[i][n]=t[n](e[i][n]))}function c(e,r,t){return function(){const n=new Array(1+arguments.length);n[0]=r;for(var i=1;i<n.length;i++)n[i]=arguments[i-1];return e[t].apply(this,n)}}function f(e,r,t){const n=r.send,i=r.ts,s=r.methodLevel,o=r.methodValue,a=r.val,l=e._logEvent.bindings;u(t,e._serialize||Object.keys(e.serializers),e.serializers,void 0===e._stdErrSerialize||e._stdErrSerialize),e._logEvent.ts=i,e._logEvent.messages=t.filter((function(e){return-1===l.indexOf(e)})),e._logEvent.level.label=s,e._logEvent.level.value=o,n(s,e._logEvent,a),e._logEvent=p(l)}function p(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function y(e){return"function"==typeof e.timestamp?e.timestamp:!1===e.timestamp?d:g}function v(){return{}}function b(e){return e}function h(){}function d(){return!1}function g(){return Date.now()}o.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},o.stdSerializers=s,o.stdTimeFunctions=Object.assign({},{nullTime:d,epochTime:g,unixTime:function(){return Math.round(Date.now()/1e3)},isoTime:function(){return new Date(Date.now()).toISOString()}})},346:e=>{function r(e){try{return JSON.stringify(e)}catch(e){return'"[Circular]"'}}e.exports=function(e,t,n){var i=n&&n.stringify||r;if("object"==typeof e&&null!==e){var s=t.length+1;if(1===s)return e;var o=new Array(s);o[0]=i(e);for(var a=1;a<s;a++)o[a]=i(t[a]);return o.join(" ")}if("string"!=typeof e)return e;var l=t.length;if(0===l)return e;for(var u="",c=0,f=-1,p=e&&e.length||0,y=0;y<p;){if(37===e.charCodeAt(y)&&y+1<p){switch(f=f>-1?f:0,e.charCodeAt(y+1)){case 100:case 102:if(c>=l)break;if(null==t[c])break;f<y&&(u+=e.slice(f,y)),u+=Number(t[c]),f=y+2,y++;break;case 105:if(c>=l)break;if(null==t[c])break;f<y&&(u+=e.slice(f,y)),u+=Math.floor(Number(t[c])),f=y+2,y++;break;case 79:case 111:case 106:if(c>=l)break;if(void 0===t[c])break;f<y&&(u+=e.slice(f,y));var v=typeof t[c];if("string"===v){u+="'"+t[c]+"'",f=y+2,y++;break}if("function"===v){u+=t[c].name||"<anonymous>",f=y+2,y++;break}u+=i(t[c]),f=y+2,y++;break;case 115:if(c>=l)break;f<y&&(u+=e.slice(f,y)),u+=String(t[c]),f=y+2,y++;break;case 37:f<y&&(u+=e.slice(f,y)),u+="%",f=y+2,y++,c--}++c}++y}return-1===f?e:(f<p&&(u+=e.slice(f)),u)}},616:(e,r,t)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.createObjectUnpacker=void 0;var n=t(503);r.createObjectUnpacker=function(e){switch(e){case"0.0.18":case"0.0.19":case"0.0.20":case"0.0.21":default:return new n.ObjectUnpacker001}}},503:(e,r,t)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ObjectUnpacker001=void 0;var n=t(980),i=t(27),s=t(102),o=t(571),a=function(){function e(){}return e.prototype.convert=function(e,r,t){try{var i=p(t),a=s.transform(r,s.prefixReferences),v=new Map;s.indexObject(l,u,c,n.INDEX_NAMESPACE,v,a["?"]),s.indexObject(l,u,c,n.COMPACT_NAMESPACE,v,a),s.indexObject(l,u,c,n.SUBS_NAMESPACE,v,e);var b=y(a,i,v);return delete b["?"],f.resolve(v,b)}catch(e){return o.log.error(e.message),{error:e.message}}},e}();r.ObjectUnpacker001=a;var l="%",u="%",c=!0,f=n.createReferencesResolver(),p=function(e){var r=new Map;return Object.keys(e).forEach((function(t){r.set(t,new i.TransformationInstruction(t,e[t]))})),r},y=function(e,r,t){if(null===e)return null;if(Array.isArray(e))return e.map((function(e){return y(e,r,t)}));if("object"==typeof e){var n={};return Object.keys(e).forEach((function(i){var o=r.get(i);if(o&&o.additionalKeys&&o.additionalKeys.has(i)&&(o=o.additionalKeys.get(i)),o){if(o.isRemovePair())return;var a="object"!=typeof e[i]&&o.assignKeys?[e[i]]:e[i],f=v(a,o,r,t);"string"==typeof f&&f.includes("%self")&&(f=_(a,f));var p=o.transformKey(i);if(o.replacePair)z(f)&&P(f,n);else if(o.rewriteValue)if(o.resultValue)if("object"==typeof o.resultValue)n[p]=v(a,o,r,t);else if("string"==typeof o.resultValue&&o.resultValue.startsWith("%")){var b=new Map;t.forEach((function(e,r){return b.set(r,e)})),s.indexObject(l,u,c,"",b,a),n[p]=v(a,o,r,b)}else n[p]=f;else n[p]=null;else n[p]=f}else t.has(i)?n[i]=t.get(i):n[i]=y(e[i],r,t)})),n}return e},v=function(e,r,t,n){if(null===e)return e;var i=z(e)?k(e,r,n):e,o=Array.isArray(i)&&r.assignKeys?h(r.assignKeys,i):new Map,a=new Map;if(n.forEach((function(e,r){return a.set(r,e)})),s.indexObject(l,u,c,"",a,b(o)),r.isArrayMapping()){if(Array.isArray(i)){var f=r.arrayItemsName,p=f?d(f,i):i;return r.assignKeys?h(r.assignKeys,p):y(p,t,a)}throw new Error('"arrayItems" can only be applied to arrays.')}if(!r.resultValue)return o.size>0?y(b(o),t,a):y(i,t,a);switch(typeof r.resultValue){case"object":return Array.isArray(r.resultValue)?w(r,t,a):g(r,i,t,a,o);case"string":return"%self"===r.resultValue?y(i,t,a):r.resultValue.match("^%[a-zA-Z]+(.[a-zA-Z]+)*$")?a.get(r.resultValue):y(r.resultValue,t,a);default:return r.resultValue}},b=function(e){var r={};return e.forEach((function(e,t){return r[t]=e})),r},h=function(e,r){var t=new Map;return Array.isArray(r)?e.forEach((function(e,n){n<r.length?t.set(e,r[n]):t.set(e,null)})):"object"==typeof r?e.forEach((function(e){t.set(e,r[e])})):e.forEach((function(e,n){0===n?t.set(e,r):t.set(e,null)})),t},d=function(e,r){return r.map((function(r){var t={};return t[e]=r,t}))},g=function(e,r,t,n,i){var o={},a=e.resultValue?e.resultValue:r;return Object.keys(a).forEach((function(e){var p=y(a[e],t,n);if("string"==typeof p){var b=p;if(m(r,b))"object"==typeof(h=r[b.substr(1)])?O(h,t,b)?o[e]=v(h,t.get(b.substr(1)),t,n):o[e]=y(h,t,n):o[e]=h;else if(j(b,i)){var h;(h=i.get(b.substr(1)))&&"object"==typeof h?O(h,t,b)?o[e]=v(h,t.get(b.substr(1)),t,n):o[e]=y(h,t,n):o[e]=h}else if(E(b)){var d=new Map;n.forEach((function(e,r){return d.set(r,e)})),s.indexObject(l,u,c,"",d,r),o[e]=f.resolve(d,p)}else b.includes("%self")?o[e]=_(r,b):n.has(b)?o[e]=n.get(b):o[e]=null}else A(p)?o[e]=f.resolve(n,p):o[e]=p})),o},w=function(e,r,t){return e.resultValue&&Array.isArray(e.resultValue)?e.resultValue.map((function(n){return v(n,e,r,t)})).filter((function(e){return null!==e})):[]},m=function(e,r){return"object"==typeof e&&"%"===r.charAt(0)&&e.hasOwnProperty(r.substr(1))},j=function(e,r){return"%"===e.charAt(0)&&r.has(e.substr(1))},O=function(e,r,t){return Array.isArray(e)&&r.has(t.substr(1))},E=function(e){return e.startsWith("%/")||!e.startsWith("%")&&!e.includes("%self")},A=function(e){return null!==e&&"object"==typeof e},_=function(e,r){var t=new Map;return t.set("%self",e),t.set("%self%",e),f.resolve(t,r)},z=function(e){return null!==e&&!Array.isArray(e)&&"object"==typeof e},P=function(e,r){Object.keys(e).forEach((function(t){r[t]=e[t]}))},k=function(e,r,t){var n=e,i={};for(var s in n)if(r.additionalKeys.has(s)){var o=r.additionalKeys.get(s);i[o.transformKey(s)]=y(n[s],o.additionalKeys,t)}else i[s]=n[s];return i}},980:(e,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.FIND_REFS=r.SUBS_NAMESPACE=r.COMPACT_NAMESPACE=r.INDEX_NAMESPACE=r.createReferencesResolver=void 0,r.createReferencesResolver=function(){return new t},r.INDEX_NAMESPACE="/index",r.COMPACT_NAMESPACE="/compact",r.SUBS_NAMESPACE="/subs",r.FIND_REFS=new RegExp(/%?%[\w-./@]+%?/gm);var t=function(){function e(){}return e.prototype.resolve=function(e,r){if(null==r)throw new Error("Cannot dereference an undefined dataObject.");if("string"==typeof r)return s(e,r);var t=Array.isArray(r["?"])?r["?"]:[r["?"]];return t&&t.forEach((function(r,t){e.set("%"+t,r),e.set("%"+t+"%",r)})),Array.isArray(r)?n("",e,r):i("",e,r)},e}(),n=function(e,r,t){var o=[];return t.forEach((function(t,a){var l=e+"."+a;Array.isArray(t)?o.push(n(l,r,t)):"object"==typeof t?o.push(i(l,r,t)):"string"==typeof t?o.push(s(r,t)):o.push(t)})),o},i=function(e,r,t){if(null===t)return null;var o={};return Object.keys(t).forEach((function(a){var l=t[a];if(null!==l){var u=e+"."+a;Array.isArray(l)?o[a]=n(u,r,l):o[a]="object"==typeof l?i(u,r,l):"string"==typeof l?s(r,l):l}else o[a]=null})),o},s=function(e,t){for(var n=t,i=[],s=r.FIND_REFS.exec(n);null!==s;){var a=s[0];i.push(a),s=r.FIND_REFS.exec(n)}return i.forEach((function(r){if(!r.startsWith("%%")){var t=e.get(r);if(null!=t&&"string"==typeof n)if(n===r)n="string"==typeof t?o(t):t;else if("object"==typeof t){var i=o(r);console.error(i+" refers to an object or array and cannot be embedded in a string"),n=n.replace(r,""+i)}else n=n.replace(r,""+t);else n=n===r?null:n.replace(r,"")}})),"string"==typeof n?n.replace("%%","%"):n},o=function(e){return e.replace("/index.","").replace("/subs.","")}},27:(e,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TransformationInstruction=void 0;var t=["rewriteValue","assignKeys","rewriteKey","replacePair","arrayItems"],n=function(){function e(r,n){var i=this;this.key=r,this.rewriteValue=!!n.hasOwnProperty("rewriteValue"),this.replacePair=!!n.hasOwnProperty("replacePair"),this.assignKeys=n.assignKeys?n.assignKeys:null,this.resultValue=n.rewriteValue?n.rewriteValue:n.replacePair,this.rewriteKey=n.rewriteKey?n.rewriteKey:null,this.arrayItemsName=n.arrayItems?n.arrayItems:null,this.additionalKeys=new Map,"object"!=typeof n||Array.isArray(n)||Object.keys(n).filter((function(e){return!t.includes(e)})).forEach((function(r){i.additionalKeys.set(r,new e(r,n[r]))}))}return e.prototype.transformKey=function(e){return this.rewriteKey?this.rewriteKey:e},e.prototype.shouldRewriteValue=function(){return this.rewriteValue},e.prototype.isArrayMapping=function(){return null!==this.arrayItemsName},e.prototype.isRemovePair=function(){return!this.replacePair&&!this.rewriteValue&&null===this.arrayItemsName&&null===this.assignKeys&&null===this.rewriteKey&&void 0===this.resultValue&&0===this.additionalKeys.size},e}();r.TransformationInstruction=n},102:(e,r,t)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.identity=r.prefixReferences=r.transform=r.indexObject=void 0;var n=t(980);r.indexObject=function(e,t,n,i,s,o){o&&Object.entries(o).forEach((function(o){var a=i.length>0?i+"."+o[0]:""+o[0];n&&s.set(e+a,o[1]),s.set(e+a+t,o[1]),"object"==typeof o[1]&&r.indexObject(e,t,n,a,s,o[1])}))},r.transform=function(e,t){if(!e)return t(e);if(Array.isArray(e)){var n=[];return e.forEach((function(e){"object"==typeof e?n.push(r.transform(e,t)):n.push(t(e))})),t(n)}if("object"==typeof e){var i={};return Object.entries(e).forEach((function(e){"object"==typeof e[1]?i[e[0]]=r.transform(e[1],t):i[e[0]]=t(e[1])})),t(i)}return t(e)},r.prefixReferences=function(e){return"string"!=typeof e?e:e.replace(n.FIND_REFS,(function(e){if(e.startsWith("%%"))return e;var r=e.charCodeAt(1);return r>47&&r<58?"%"+n.INDEX_NAMESPACE+"."+e.substr(1):"%"+n.SUBS_NAMESPACE+"."+e.substr(1)}))},r.identity=function(e){return e}}},r={};function t(n){if(r[n])return r[n].exports;var i=r[n]={exports:{}};return e[n].call(i.exports,i,i.exports,t),i.exports}var n={};return(()=>{var e=n;Object.defineProperty(e,"__esModule",{value:!0}),e.mapper=void 0;var r=t(616);e.mapper=r.createObjectUnpacker()})(),n})()})); |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ObjectUnpacker001 = void 0; | ||
var pino_1 = __importDefault(require("pino")); | ||
var ReferencesResolver_1 = require("./ReferencesResolver"); | ||
var TransformationInstructions_1 = require("./TransformationInstructions"); | ||
var Util_1 = require("./Util"); | ||
var log = pino_1.default(); | ||
var num_easy_log_1 = require("num-easy-log"); | ||
var ObjectUnpacker001 = (function () { | ||
@@ -28,3 +24,3 @@ function ObjectUnpacker001() { | ||
catch (e) { | ||
log.error(e.message); | ||
num_easy_log_1.log.error(e.message); | ||
return { error: e.message }; | ||
@@ -31,0 +27,0 @@ } |
{ | ||
"name": "object-unpacker", | ||
"version": "0.0.21", | ||
"version": "0.0.22", | ||
"description": "A JSON to JSON mapper in TypeScript", | ||
@@ -8,3 +8,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"pino": "^7.6.5" | ||
"num-easy-log": "^0.0.2" | ||
}, | ||
@@ -11,0 +11,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
68566
0
627
+ Addednum-easy-log@^0.0.2
+ Addednum-easy-log@0.0.2(transitive)
- Removedpino@^7.6.5