From ed46b6256d35f02469174f6eeea7398f19082bbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20ACHAIN?= Date: Thu, 30 Nov 2023 21:44:08 +0100 Subject: [PATCH 1/2] Improves --- .gitignore | 1 + lib/compare-engine.d.ts | 37 ------------------------------ lib/compare-engine.d.ts.map | 1 - lib/compare-state.d.ts | 21 ----------------- lib/compare-state.d.ts.map | 1 - lib/compare-state.enum.d.ts | 9 -------- lib/compare-state.enum.d.ts.map | 1 - lib/finded-item.interface.d.ts | 6 ----- lib/finded-item.interface.d.ts.map | 1 - lib/index.d.ts | 4 ---- lib/index.d.ts.map | 1 - lib/index.min.mjs | 1 - lib/panel.enum.d.ts | 5 ---- lib/panel.enum.d.ts.map | 1 - package.json | 4 ++-- yarn.lock | 8 +++---- 16 files changed, 7 insertions(+), 95 deletions(-) delete mode 100644 lib/compare-engine.d.ts delete mode 100644 lib/compare-engine.d.ts.map delete mode 100644 lib/compare-state.d.ts delete mode 100644 lib/compare-state.d.ts.map delete mode 100644 lib/compare-state.enum.d.ts delete mode 100644 lib/compare-state.enum.d.ts.map delete mode 100644 lib/finded-item.interface.d.ts delete mode 100644 lib/finded-item.interface.d.ts.map delete mode 100644 lib/index.d.ts delete mode 100644 lib/index.d.ts.map delete mode 100644 lib/index.min.mjs delete mode 100644 lib/panel.enum.d.ts delete mode 100644 lib/panel.enum.d.ts.map diff --git a/.gitignore b/.gitignore index 35dff63..9d0eb90 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ /out-tsc /bazel-out /dist +/lib # Node /node_modules diff --git a/lib/compare-engine.d.ts b/lib/compare-engine.d.ts deleted file mode 100644 index 3e515e6..0000000 --- a/lib/compare-engine.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { CompareState } from "./compare-state.js"; -import { PanelEnum } from "./panel.enum.js"; -import { FindedItemInterface } from "./finded-item.interface.js"; -import { AnyValue, Path, ValueKey, ValueRecord } from '@alkemist/smart-tools'; -export declare class CompareEngine { - protected determineArrayIndexFn?: ((paths: ValueKey[]) => ValueKey) | undefined; - private readonly compareStateIndex; - private readonly arrayIndex; - private readonly panels; - constructor(determineArrayIndexFn?: ((paths: ValueKey[]) => ValueKey) | undefined, leftValue?: DATA_TYPE, rightValue?: DATA_TYPE); - private _logsEnabled; - set logsEnabled(logsEnabled: boolean); - get leftValue(): DATA_TYPE | undefined; - get rightValue(): DATA_TYPE | undefined; - updateLeft(value: DATA_TYPE | undefined): void; - updateInLeft(value: unknown, paths: ValueKey[] | ValueKey): void; - updateRight(value: DATA_TYPE | undefined): void; - updateInRight(value: unknown, paths: ValueKey[] | ValueKey): void; - leftToRight(): void; - rightToLeft(): void; - updateCompareIndex(): void; - hasChange(): boolean; - getInLeft(paths: ValueKey[] | ValueKey): unknown; - getLeftState(paths: ValueKey[] | ValueKey): CompareState; - getInRight(paths: ValueKey[] | ValueKey): T; - getRightState(paths: ValueKey[] | ValueKey): CompareState; - protected getState(panel: PanelEnum, paths: ValueKey[] | ValueKey): CompareState; - protected update(panel: PanelEnum, value: DATA_TYPE | undefined): void; - protected updateIn(panel: PanelEnum, value: unknown, paths: ValueKey[] | ValueKey): void; - protected findArrayDiffLevels(panel: PanelEnum, path: Path, level?: number, diffs?: number[], logsEnabled?: boolean): number[]; - protected findCompareItem(sideValue: AnyValue, otherSideItems: ValueRecord[], searchKey: ValueKey): FindedItemInterface; - protected comparePropertyValues(panel: PanelEnum, sideValue: unknown, otherSideObject: unknown, propertyPath: Path, logsEnabled?: boolean): CompareState; - protected getIncomparableState(panel: PanelEnum): CompareState; - protected compareValues(sideValue: unknown, otherSideValue: AnyValue): CompareState; - protected compare(panel: PanelEnum, sideValue: unknown, path?: Path): void; -} -//# sourceMappingURL=compare-engine.d.ts.map \ No newline at end of file diff --git a/lib/compare-engine.d.ts.map b/lib/compare-engine.d.ts.map deleted file mode 100644 index 5b8fa02..0000000 --- a/lib/compare-engine.d.ts.map +++ /dev/null @@ -1 +0,0 @@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S,EAAE,OAAO,EAAE,IAAI,GAAE,IAAiB,GAC3E,IAAI;CAuLT"} \ No newline at end of file diff --git a/lib/compare-state.d.ts b/lib/compare-state.d.ts deleted file mode 100644 index 88c1330..0000000 --- a/lib/compare-state.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { CompareStateEnum } from "./compare-state.enum.js"; -export declare class CompareState { - private _value; - protected constructor(_value?: CompareStateEnum); - static get NONE(): CompareState; - static get ADDED(): CompareState; - static get MOVED(): CompareState; - static get UPDATED(): CompareState; - static get REMOVED(): CompareState; - static get EQUAL(): CompareState; - get value(): CompareStateEnum; - get isNone(): boolean; - get isAdded(): boolean; - get isMoved(): boolean; - get isUpdated(): boolean; - get isRemoved(): boolean; - get isEqual(): boolean; - get isChanged(): boolean; - toString(): string; -} -//# sourceMappingURL=compare-state.d.ts.map \ No newline at end of file diff --git a/lib/compare-state.d.ts.map b/lib/compare-state.d.ts.map deleted file mode 100644 index 9aabb15..0000000 --- a/lib/compare-state.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"compare-state.d.ts","sourceRoot":"src/","sources":["compare-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,yBAAyB,CAAC;AAEzD,qBAAa,YAAY;IACC,OAAO,CAAC,MAAM;IAApC,SAAS,aAAqB,MAAM,GAAE,gBAAwC;IAG9E,MAAM,KAAK,IAAI,iBAEd;IAED,MAAM,KAAK,KAAK,iBAEf;IAED,MAAM,KAAK,KAAK,iBAEf;IAED,MAAM,KAAK,OAAO,iBAEjB;IAED,MAAM,KAAK,OAAO,iBAEjB;IAED,MAAM,KAAK,KAAK,iBAEf;IAED,IAAI,KAAK,IAAI,gBAAgB,CAE5B;IAED,IAAI,MAAM,YAET;IAED,IAAI,OAAO,YAEV;IAED,IAAI,OAAO,YAEV;IAED,IAAI,SAAS,YAEZ;IAED,IAAI,SAAS,YAEZ;IAED,IAAI,OAAO,YAEV;IAED,IAAI,SAAS,YAEZ;IAED,QAAQ,IAAI,MAAM;CAGrB"} \ No newline at end of file diff --git a/lib/compare-state.enum.d.ts b/lib/compare-state.enum.d.ts deleted file mode 100644 index e431c37..0000000 --- a/lib/compare-state.enum.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -export declare enum CompareStateEnum { - NONE = "", - ADDED = "added", - MOVED = "moved", - UPDATED = "updated", - REMOVED = "removed", - EQUAL = "equal" -} -//# sourceMappingURL=compare-state.enum.d.ts.map \ No newline at end of file diff --git a/lib/compare-state.enum.d.ts.map b/lib/compare-state.enum.d.ts.map deleted file mode 100644 index ef86a2c..0000000 --- a/lib/compare-state.enum.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"compare-state.enum.d.ts","sourceRoot":"src/","sources":["compare-state.enum.ts"],"names":[],"mappings":"AAAA,oBAAY,gBAAgB;IACxB,IAAI,KAAK;IACT,KAAK,UAAU;IACf,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,KAAK,UAAU;CAClB"} \ No newline at end of file diff --git a/lib/finded-item.interface.d.ts b/lib/finded-item.interface.d.ts deleted file mode 100644 index 88463f1..0000000 --- a/lib/finded-item.interface.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { AnyValue } from '@alkemist/smart-tools'; -export interface FindedItemInterface { - index: number; - value: Record | undefined; -} -//# sourceMappingURL=finded-item.interface.d.ts.map \ No newline at end of file diff --git a/lib/finded-item.interface.d.ts.map b/lib/finded-item.interface.d.ts.map deleted file mode 100644 index 7bf2aa7..0000000 --- a/lib/finded-item.interface.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"finded-item.interface.d.ts","sourceRoot":"src/","sources":["finded-item.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,MAAM,WAAW,mBAAmB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,SAAS,CAAA;CAC9C"} \ No newline at end of file diff --git a/lib/index.d.ts b/lib/index.d.ts deleted file mode 100644 index 8411e70..0000000 --- a/lib/index.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './compare-engine.js'; -export * from './compare-state.enum.js'; -export * from './compare-state.js'; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/lib/index.d.ts.map b/lib/index.d.ts.map deleted file mode 100644 index a52ea26..0000000 --- a/lib/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"src/","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,yBAAyB,CAAA;AACvC,cAAc,oBAAoB,CAAA"} \ No newline at end of file diff --git a/lib/index.min.mjs b/lib/index.min.mjs deleted file mode 100644 index df0ea80..0000000 --- a/lib/index.min.mjs +++ /dev/null @@ -1 +0,0 @@ -var e=[,(e,t,r)=>{r.r(t),r.d(t,{CompareEngine:()=>l});var a=r(2),s=r(4),n=r(5);class l{determineArrayIndexFn;compareStateIndex;arrayIndex;panels;constructor(e,t,r){this.determineArrayIndexFn=e,this.compareStateIndex={left:new Map,right:new Map},this.arrayIndex={left:new Map,right:new Map},this.panels={left:t,right:r}}_logsEnabled=!1;set logsEnabled(e){this._logsEnabled=e}get leftValue(){return n.TypeHelper.deepClone(this.panels[s.PanelEnum.LEFT])}get rightValue(){return n.TypeHelper.deepClone(this.panels[s.PanelEnum.RIGHT])}updateLeft(e){this.update(s.PanelEnum.LEFT,e)}updateInLeft(e,t){this.updateIn(s.PanelEnum.LEFT,e,t)}updateRight(e){this.update(s.PanelEnum.RIGHT,e)}updateInRight(e,t){this.updateIn(s.PanelEnum.RIGHT,e,t)}leftToRight(){this.updateRight(this.panels[s.PanelEnum.LEFT])}rightToLeft(){this.updateLeft(this.panels[s.PanelEnum.RIGHT])}updateCompareIndex(){this.compareStateIndex[s.PanelEnum.LEFT].clear(),this.compareStateIndex[s.PanelEnum.RIGHT].clear(),this.compare(s.PanelEnum.LEFT,this.panels[s.PanelEnum.LEFT]),this.compare(s.PanelEnum.RIGHT,this.panels[s.PanelEnum.RIGHT])}hasChange(){return this.compareStateIndex.right.get("")?.isChanged??!1}getInLeft(e){return n.TreeHelper.getIn(this.panels.left,n.TypeHelper.isArray(e)?e:[e])}getLeftState(e){return this.getState(s.PanelEnum.LEFT,e)}getInRight(e){return n.TreeHelper.getIn(this.panels.right,n.TypeHelper.isArray(e)?e:[e])}getRightState(e){return this.getState(s.PanelEnum.RIGHT,e)}getState(e,t){const r=n.Path.from(n.TypeHelper.isArray(t)?t:[t]);return this._logsEnabled&&console.log(`- [${e}] Get state :`,t,r),this.compareStateIndex[e].get(r.toString())??a.CompareState.NONE}update(e,t){this.panels[e]=n.TypeHelper.deepClone(t),this.arrayIndex[e].clear()}updateIn(e,t,r){n.TreeHelper.setIn(this.panels[e],r,n.TypeHelper.deepClone(t)),this.arrayIndex[e].clear()}findArrayDiffLevels(e,t,r=0,a=[],s=!1){const n=t.slice(0,r),l=this.arrayIndex[e].get(n.toString())??!1;return s&&(console.log("--- findArrayDiffLevels : level ",r," with path ",t),console.log("--- findArrayDiffLevels : currentPath '",n,"' is array ? ",l)),a.length>0&&(a=a.map((e=>e+1))),l&&a.push(0),rt[r]===e[r]));else{a=t.map((e=>JSON.stringify(e))).indexOf(JSON.stringify(e))}return{index:a,value:t[a]}}comparePropertyValues(e,t,r,s,l=!1){if(l&&(console.log("--- Compare property value",s.toString(),n.TreeHelper.hasProperty(r,s)?"exist":"not exist"),console.log("--- in object",r)),!n.TreeHelper.hasProperty(r,s))return this.getIncomparableState(e);const i=n.TreeHelper.getIn(r,s);return l&&(console.log("--- Is equal ?",n.TypeHelper.isEqual(t,i)),console.log("--- Other side value",i)),n.TypeHelper.isEqual(t,i)?a.CompareState.EQUAL:a.CompareState.UPDATED}getIncomparableState(e){return e===s.PanelEnum.LEFT?a.CompareState.REMOVED:a.CompareState.ADDED}compareValues(e,t){return n.TypeHelper.isEqual(e,t)?a.CompareState.EQUAL:a.CompareState.UPDATED}compare(e,t,r=new n.Path){let l,i=this._logsEnabled,o=a.CompareState.NONE;const p=e===s.PanelEnum.LEFT?s.PanelEnum.RIGHT:s.PanelEnum.LEFT;n.TypeHelper.isEvaluable(t)&&!n.TypeHelper.isPrimitive(t)&&this.arrayIndex[e].set(r.toString(),n.TypeHelper.isArray(t)),i&&(console.log(`- [${e}] ${r}`),console.log("-- Side value : ",t));const u=this.findArrayDiffLevels(e,r,0,[],i);i&&console.log("-- Array diffs : ",u);let c=this.panels[e],y=this.panels[p],g=r.clone(),h=n.TypeHelper.deepClone(t);if(u.length>0?u.forEach((t=>{const r=g.slice(0,g.length-t),s=n.TreeHelper.getIn(y,r);if(i&&(console.log("--- Current array diff : ",t),console.log("--- Current root : ",c),console.log("--- Current side value : ",h),console.log("--- Array path : ",r),console.log("--- Other side items : ",s),console.log("--- Other side is array ?",n.TypeHelper.isArray(s))),n.TypeHelper.isArray(s))if(0===t)h=n.TreeHelper.getIn(c,r),i&&(console.log("-- Array diff 0"),console.log("-- Property path : ",r),console.log("-- Compare : ",h),console.log("-- With : ",s)),o=this.comparePropertyValues(e,h,y,r,i);else{const p=this.determineArrayIndexFn?this.determineArrayIndexFn(g):"",u=g.slice(0,r.length+1),d=n.TreeHelper.getIn(c,u),m=this.findCompareItem(d,s,p),E=m.value;if(i&&(console.log("-- Object path : ",u),console.log("-- Side object : ",d),console.log("-- Item finded ? ",m)),E){const r=g.slice(u.length);if(1===t){const e=g.last();if(void 0!==e){h=n.TreeHelper.getIn(d,r),i&&(console.log("-- Array diff 1",r),console.log("-- Other side value : ",m.value),console.log("-- Indexes : ",e,m.index));const t=this.compareValues(e,m.index),s=this.compareValues(h,m.value);i&&(console.log("-- compare index : ",t.value),console.log("-- compare value : ",s.value)),o=t.isUpdated&&s.isEqual?a.CompareState.MOVED:s.isUpdated?a.CompareState.UPDATED:a.CompareState.EQUAL}}else h=n.TreeHelper.getIn(d,r),i&&(l=n.TreeHelper.getIn(E,r),console.log("-- Array diff > 1",r),console.log("-- Other side object : ",E),console.log("-- Other side value : ",l)),o=this.comparePropertyValues(e,h,E,r,i);g=r.clone(),c=n.TypeHelper.deepClone(d),h=n.TypeHelper.deepClone(d),y=n.TypeHelper.deepClone(E),i&&(l=n.TypeHelper.deepClone(E))}else o=this.getIncomparableState(e)}else h=n.TreeHelper.getIn(c,r),i&&(console.log("-- No other side array"),console.log("-- Compare",h),console.log("-- With",s)),o=this.comparePropertyValues(e,h,y,r,i)})):(o=this.comparePropertyValues(e,h,this.panels[p],r),i&&(l=n.TreeHelper.getIn(this.panels[p],r),console.log("-- No array upside"),console.log("-- Other side value : ",l))),i&&console.log("-- Update state with : ",o.value),this.compareStateIndex[e].set(r.toString(),o),o.isUpdated&&n.TypeHelper.isTree(t)){const a=n.TreeHelper.keys(t);i&&console.log("-- Sub keys : ",a),a.forEach((a=>{const s=r.clone().add(a);this._logsEnabled&&console.log("-- Sub path :",r,"+",a,"=>",s);const l=n.TypeHelper.isArray(t)?t[n.MathHelper.parseInt(a)]:t[a];this.compare(e,l,s)}))}}}},(e,t,r)=>{r.r(t),r.d(t,{CompareState:()=>s});var a=r(3);class s{_value;constructor(e=a.CompareStateEnum.NONE){this._value=e}static get NONE(){return new s}static get ADDED(){return new s(a.CompareStateEnum.ADDED)}static get MOVED(){return new s(a.CompareStateEnum.MOVED)}static get UPDATED(){return new s(a.CompareStateEnum.UPDATED)}static get REMOVED(){return new s(a.CompareStateEnum.REMOVED)}static get EQUAL(){return new s(a.CompareStateEnum.EQUAL)}get value(){return this._value}get isNone(){return this._value===a.CompareStateEnum.NONE}get isAdded(){return this._value===a.CompareStateEnum.ADDED}get isMoved(){return this._value===a.CompareStateEnum.MOVED}get isUpdated(){return this._value===a.CompareStateEnum.UPDATED}get isRemoved(){return this._value===a.CompareStateEnum.REMOVED}get isEqual(){return this._value===a.CompareStateEnum.EQUAL}get isChanged(){return this._value!==a.CompareStateEnum.EQUAL}toString(){return this.value}}},(e,t,r)=>{var a;r.r(t),r.d(t,{CompareStateEnum:()=>a}),function(e){e.NONE="",e.ADDED="added",e.MOVED="moved",e.UPDATED="updated",e.REMOVED="removed",e.EQUAL="equal"}(a||(a={}))},(e,t,r)=>{var a;r.r(t),r.d(t,{PanelEnum:()=>a}),function(e){e.LEFT="left",e.RIGHT="right"}(a||(a={}))},(e,t,r)=>{r.r(t),r.d(t,{ArrayHelper:()=>i,CONSOLE_LOG_STYLES:()=>o,ConsoleHelper:()=>p,DateHelper:()=>u,MathHelper:()=>c,ObjectHelper:()=>y,Path:()=>g,PrimitiveClassNames:()=>h,SmartMap:()=>d,StringHelper:()=>m,TreeHelper:()=>E,TypeHelper:()=>T,TypeState:()=>H,TypeStateEnum:()=>f});var a=[,(e,t,r)=>{r.r(t),r.d(t,{ArrayHelper:()=>a.ArrayHelper,ConsoleHelper:()=>s.ConsoleHelper,DateHelper:()=>n.DateHelper,MathHelper:()=>l.MathHelper,ObjectHelper:()=>i.ObjectHelper,StringHelper:()=>o.StringHelper,TreeHelper:()=>p.TreeHelper,TypeHelper:()=>u.TypeHelper});var a=r(2),s=r(3),n=r(18),l=r(17),i=r(6),o=r(5),p=r(12),u=r(4)},(e,t,r)=>{r.r(t),r.d(t,{ArrayHelper:()=>a});class a{}},(e,t,r)=>{r.r(t),r.d(t,{ConsoleHelper:()=>n});var a=r(4),s=r(12);class n{static group(e,t,r){const a=n.format(e);n.log(a.title,r&&r[0]?r[0]:"",!0,...a.data??[]),t.forEach(((e,t)=>{const a=n.format(e);n.log(a.title,r&&r[t+1]?r[t+1]:"",!1,...a.data??[])})),console.groupEnd()}static log(e,t,r=!1,...a){(r?console.group:console.log).call(console,`%c ${e}`,t,...a)}static format(e){return a.TypeHelper.isString(e)?{title:e}:void 0!==e.title&&1===s.TreeHelper.keys(e).length?e:void 0!==e.title&&void 0!==e.data&&2===s.TreeHelper.keys(e).length?{title:e.title,data:a.TypeHelper.isArray(e.data)?e.data:[e.data]}:{title:e.title??"",data:a.TypeHelper.isArray(e)?e:[e]}}}},(e,t,r)=>{r.r(t),r.d(t,{TypeHelper:()=>o});var a=r(5),s=r(6),n=r(12),l=r(13),i=r(7);class o{static isEvaluable(e){return null!=e}static getPrototypeOf(e){return Object.getPrototypeOf(e)??{}}static isBoolean(e){return o.isEvaluable(e)&&("boolean"==typeof e||o.getPrototypeOf(e).constructor===Boolean)}static isKey(e){return o.isEvaluable(e)&&(o.isNumber(e)||o.isString(e))}static isNumber(e){return o.isEvaluable(e)&&("number"==typeof e||o.getPrototypeOf(e).constructor===Number)&&!isNaN(+a.StringHelper.stringify(e))}static isSymbol(e){return o.isEvaluable(e)&&("symbol"==typeof e||o.getPrototypeOf(e).constructor===Symbol)}static isString(e){return o.isEvaluable(e)&&("string"==typeof e||o.getPrototypeOf(e).constructor===String)}static isArray(e){return o.isEvaluable(e)&&Array.isArray(e)}static isRecord(e){return o.isEvaluable(e)&&"object"==typeof e&&"Object"===o.getPrototypeOf(e).constructor.name}static isObject(e){return o.isEvaluable(e)&&"object"==typeof e&&-1===[...i.PrimitiveClassNames,"Array","Object"].indexOf(o.getPrototypeOf(e).constructor.name)}static isTree(e){return o.isArray(e)||s.ObjectHelper.hasStringIndex(e)}static isFunction(e){return o.isEvaluable(e)&&("function"==typeof e||e instanceof Function||"[object Function]"===a.StringHelper.stringify(e))}static isDate(e){return o.isObject(e)&&"Date"===o.getPrototypeOf(e).constructor.name}static isT(e){return e}static isPrimitive(e){return o.isEvaluable(e)&&!o.isTree(e)&&!o.isFunction(e)}static isEqual(e,t){const r=new l.TypeState(e);let a=new l.TypeState(t);const s=Object.is(o.serialize(e),o.serialize(t));if(s){const s=Object.is(r.type,a.type);return s&&r.isObject&&a.isObject?Object.is(o.getPrototypeOf(e),o.getPrototypeOf(t)):s}return s}static serialize(e){const t=n.TreeHelper.flat(e);return o.isString(t)?t:JSON.stringify(t)}static deepClone(e){if(o.isArray(e))return e.map((e=>o.deepClone(e)));if(o.isDate(e))return new Date(e);if(s.ObjectHelper.hasStringIndex(e)){const t=n.TreeHelper.getCycles(e),r=o.getPrototypeOf(e);return n.TreeHelper.keys(e).filter((e=>-1===t.indexOf(e))).reduce(((t,r)=>{const a=Object.getOwnPropertyDescriptor(e,r);return void 0!==a&&Object.defineProperty(t,r,a),t[r]=o.deepClone(e[r]),t}),r?Object.create(r):{})}return e}}},(e,t,r)=>{r.r(t),r.d(t,{StringHelper:()=>s});var a=r(4);class s{static stringify(e){return a.TypeHelper.isEvaluable(e)?void 0!==typeof e.toString||a.TypeHelper.isSymbol(e)?e.toString():e+"":null===e?"null":"undefined"}}},(e,t,r)=>{r.r(t),r.d(t,{ObjectHelper:()=>n});var a=r(4),s=r(7);class n{static hasStringIndex(e){return a.TypeHelper.isEvaluable(e)&&"object"==typeof e&&-1===[...s.PrimitiveClassNames,"Array"].indexOf(a.TypeHelper.getPrototypeOf(e).constructor.name)}}},(e,t,r)=>{r.r(t),r.d(t,{CONSOLE_LOG_STYLES:()=>a.CONSOLE_LOG_STYLES,PrimitiveClassNames:()=>s.PrimitiveClassNames});var a=r(8),s=(r(9),r(10));r(11)},(e,t,r)=>{r.r(t),r.d(t,{CONSOLE_LOG_STYLES:()=>a});const a={blue:"color: #2196F3; font-weight: bold",grey:"color: #FD8182; font-weight: bold",green:"color: #BADA55; font-weight: bold",red:"color: #FD8182; font-weight: bold"}},(e,t,r)=>{r.r(t)},(e,t,r)=>{r.r(t),r.d(t,{PrimitiveClassNames:()=>a});const a=["Boolean","Number","String"]},(e,t,r)=>{r.r(t)},(e,t,r)=>{r.r(t),r.d(t,{TreeHelper:()=>o});var a=r(13),s=r(6),n=r(17),l=r(4),i=r(5);class o{static keys(e){return l.TypeHelper.isEvaluable(e)?l.TypeHelper.isArray(e)?Object.keys(e).map((e=>parseInt(e))):Object.getOwnPropertyNames(e):[]}static getIn(e,t){let r=e,a=0;if(r)for(;a{l.TypeHelper.isArray(e)?r[t]=o.flat(e[n.MathHelper.parseInt(t)]):s.ObjectHelper.hasStringIndex(e)&&(r[t]=o.flat(e[t]))})),r}return e}static getCycles(e){if(!l.TypeHelper.isEvaluable(e))return[];const t=new Set,r=[],s=function(e,i=new a.Path){t.has(e)?r.push(i):(t.add(e),o.keys(e).forEach((t=>{const r=i.clone();r.push(t);const a=l.TypeHelper.isArray(e)?e[n.MathHelper.parseInt(t)]:e[t];l.TypeHelper.isTree(a)&&s(a,r)})))};return s(e),r.map((e=>e.toString()))}}},(e,t,r)=>{r.r(t),r.d(t,{Path:()=>a.Path,SmartMap:()=>s.SmartMap,TypeState:()=>n.TypeState,TypeStateEnum:()=>n.TypeStateEnum});var a=r(14),s=r(15),n=r(16)},(e,t,r)=>{r.r(t),r.d(t,{Path:()=>s});var a=r(1);class s extends Array{add(e){return super.push(e),this}clone(){return this.slice()}slice(e,t){const r=new s;return r.push(...super.slice(e,t)),r}toString(){return this.reduce(((e,t)=>e+(a.TypeHelper.isNumber(t)?`[${t}]`:`${""===e?"":"."}${t}`)),"")}last(){return this.length>0?this[this.length-1]:void 0}}},(e,t,r)=>{r.r(t),r.d(t,{SmartMap:()=>a});class a extends Map{_keys=[];_values=[];constructor(e=[]){super(e),this._keys=e.map((e=>e[0])),this._values=e.map((e=>e[1]))}get(e){return super.get(e)}set(e,t){if(this.has(e)){const r=this._keys.indexOf(e);this._values[r]=t}else this._keys.push(e),this._values.push(t);return super.set(e,t),this}getKeys(){return this._keys}getValues(){return this._values}map(e){return this._keys.map(((t,r)=>e(this._values[r],t,r)))}each(e){this._keys.forEach(((t,r)=>{e(this._values[r],t,r)}))}find(e){return this._values.find(((t,r)=>e(t,this._keys[r],r)))}filter(e){const t=new a;return this._keys.filter(((t,r)=>e(this._values[r],t,r))).forEach((e=>t.set(e,this.get(e)))),t}}},(e,t,r)=>{r.r(t),r.d(t,{TypeState:()=>n,TypeStateEnum:()=>a});var a,s=r(1);!function(e){e.NO_EVALUABLE="no_evaluable",e.PRIMITIVE="primitive",e.OBJECT="object",e.RECORD="record",e.ARRAY="array",e.FUNCTION="function"}(a||(a={}));class n{_type;constructor(e){null==e?this._type=a.NO_EVALUABLE:s.TypeHelper.isArray(e)?this._type=a.ARRAY:s.TypeHelper.isRecord(e)?this._type=a.RECORD:s.TypeHelper.isObject(e)?this._type=a.OBJECT:s.TypeHelper.isFunction(e)?this._type=a.FUNCTION:this._type=a.PRIMITIVE}get type(){return this._type}get isValuable(){return this._type!==a.NO_EVALUABLE}get isPrimitive(){return this._type===a.PRIMITIVE}get isArray(){return this._type===a.ARRAY}get isObject(){return this._type===a.OBJECT}get isRecord(){return this._type===a.RECORD}get isFunction(){return this._type===a.FUNCTION}}},(e,t,r)=>{r.r(t),r.d(t,{MathHelper:()=>s});var a=r(4);class s{static parseInt(e){return a.TypeHelper.isNumber(e)?e:parseInt(e)}}},(e,t,r)=>{r.r(t),r.d(t,{DateHelper:()=>a});class a{}},(e,t,r)=>{r.r(t),r(20)},(e,t,r)=>{r.r(t)}],s={};function n(e){var t=s[e];if(void 0!==t)return t.exports;var r=s[e]={exports:{}};return a[e](r,r.exports,n),r.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var l={};(()=>{n.r(l),n.d(l,{ArrayHelper:()=>e.ArrayHelper,CONSOLE_LOG_STYLES:()=>t.CONSOLE_LOG_STYLES,ConsoleHelper:()=>e.ConsoleHelper,DateHelper:()=>e.DateHelper,MathHelper:()=>e.MathHelper,ObjectHelper:()=>e.ObjectHelper,Path:()=>r.Path,PrimitiveClassNames:()=>t.PrimitiveClassNames,SmartMap:()=>r.SmartMap,StringHelper:()=>e.StringHelper,TreeHelper:()=>e.TreeHelper,TypeHelper:()=>e.TypeHelper,TypeState:()=>r.TypeState,TypeStateEnum:()=>r.TypeStateEnum});var e=n(1),t=(n(19),n(7)),r=n(13)})();var i=l.ArrayHelper,o=l.CONSOLE_LOG_STYLES,p=l.ConsoleHelper,u=l.DateHelper,c=l.MathHelper,y=l.ObjectHelper,g=l.Path,h=l.PrimitiveClassNames,d=l.SmartMap,m=l.StringHelper,E=l.TreeHelper,T=l.TypeHelper,H=l.TypeState,f=l.TypeStateEnum}],t={};function r(a){var s=t[a];if(void 0!==s)return s.exports;var n=t[a]={exports:{}};return e[a](n,n.exports,r),n.exports}r.d=(e,t)=>{for(var a in t)r.o(t,a)&&!r.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};(()=>{r.r(a),r.d(a,{CompareEngine:()=>e.CompareEngine,CompareState:()=>s.CompareState,CompareStateEnum:()=>t.CompareStateEnum});var e=r(1),t=r(3),s=r(2)})();var s=a.CompareEngine,n=a.CompareState,l=a.CompareStateEnum;export{s as CompareEngine,n as CompareState,l as CompareStateEnum}; \ No newline at end of file diff --git a/lib/panel.enum.d.ts b/lib/panel.enum.d.ts deleted file mode 100644 index 767abd6..0000000 --- a/lib/panel.enum.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export declare enum PanelEnum { - LEFT = "left", - RIGHT = "right" -} -//# sourceMappingURL=panel.enum.d.ts.map \ No newline at end of file diff --git a/lib/panel.enum.d.ts.map b/lib/panel.enum.d.ts.map deleted file mode 100644 index f3c859d..0000000 --- a/lib/panel.enum.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"panel.enum.d.ts","sourceRoot":"src/","sources":["panel.enum.ts"],"names":[],"mappings":"AAAA,oBAAY,SAAS;IACjB,IAAI,SAAS;IACb,KAAK,UAAU;CAClB"} \ No newline at end of file diff --git a/package.json b/package.json index eefe8ee..56f7770 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@alkemist/compare-engine", - "version": "1.3.2", + "version": "1.3.3", "description": "Comparison engine", "main": "lib/index.min.mjs", "type": "module", @@ -65,6 +65,6 @@ "webpack-cli": "^5.1.1" }, "dependencies": { - "@alkemist/smart-tools": "^1.1.10" + "@alkemist/smart-tools": "^1.1.12" } } diff --git a/yarn.lock b/yarn.lock index c4be8d4..1399da2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,10 +2,10 @@ # yarn lockfile v1 -"@alkemist/smart-tools@^1.1.10": - version "1.1.10" - resolved "https://registry.yarnpkg.com/@alkemist/smart-tools/-/smart-tools-1.1.10.tgz#2091298e04c8b2fb3050b84555c82a64db9f9c50" - integrity sha512-EudU4B5PbcXOCCNiDdPU3rvsLWOxgy6AE/frB3IdkyLAVxFHjUlkAF+2vHIjS8E5MTqcGTqM8Y2SmTlj4Dt83w== +"@alkemist/smart-tools@^1.1.12": + version "1.1.12" + resolved "https://registry.yarnpkg.com/@alkemist/smart-tools/-/smart-tools-1.1.12.tgz#99cbc532bd0d39ce7e51d9207e3ea6567a03cf09" + integrity sha512-TgmBK/FKrw/UYPAArNSge/rrOI6vXtvqaRy0GGHDJSbR1Sxyih7Mab9V3uhCfk2k+kRo00eEDdGqTYmzK6qfkQ== dependencies: "@angular/core" "^16.2.7" From 0d9387ca0ebacd36e469644ed8c63aac3ce129a3 Mon Sep 17 00:00:00 2001 From: snyk-bot Date: Mon, 12 Feb 2024 18:44:40 +0000 Subject: [PATCH 2/2] fix: upgrade @alkemist/smart-tools from 1.1.12 to 1.1.14 Snyk has created this PR to upgrade @alkemist/smart-tools from 1.1.12 to 1.1.14. See this package in npm: See this project in Snyk: https://app.snyk.io/org/alkemist/project/e72079ac-b3e1-4d40-a2bb-7e8562b637dd?utm_source=github&utm_medium=referral&page=upgrade-pr --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 56f7770..6624341 100644 --- a/package.json +++ b/package.json @@ -65,6 +65,6 @@ "webpack-cli": "^5.1.1" }, "dependencies": { - "@alkemist/smart-tools": "^1.1.12" + "@alkemist/smart-tools": "^1.1.14" } } diff --git a/yarn.lock b/yarn.lock index 1399da2..fc29a38 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,10 +2,10 @@ # yarn lockfile v1 -"@alkemist/smart-tools@^1.1.12": - version "1.1.12" - resolved "https://registry.yarnpkg.com/@alkemist/smart-tools/-/smart-tools-1.1.12.tgz#99cbc532bd0d39ce7e51d9207e3ea6567a03cf09" - integrity sha512-TgmBK/FKrw/UYPAArNSge/rrOI6vXtvqaRy0GGHDJSbR1Sxyih7Mab9V3uhCfk2k+kRo00eEDdGqTYmzK6qfkQ== +"@alkemist/smart-tools@^1.1.14": + version "1.1.14" + resolved "https://registry.yarnpkg.com/@alkemist/smart-tools/-/smart-tools-1.1.14.tgz#650de3301fe388639a8a8ce7fd93304be4fb83b1" + integrity sha512-jYQdrRMmb40I8yzgmmgHe4IFwi2d/lf9KeWRspWFg7WR+zvjLgwCozj1o7+VKpCEZ42M1bK8FEp+uQ02Ow18GA== dependencies: "@angular/core" "^16.2.7"