diff --git a/package.json b/package.json index 51e1b745..15a6ca0e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "powership", - "version": "5.6.1", + "version": "5.7.7", "private": true, "scripts": { "patch": "run-s patch:*", diff --git a/packages/accounts/package.json b/packages/accounts/package.json index 0e7a079a..8314f258 100644 --- a/packages/accounts/package.json +++ b/packages/accounts/package.json @@ -1,6 +1,6 @@ { "name": "@powership/accounts", - "version": "5.6.1", + "version": "5.7.7", "description": "Powership accounts", "type": "module", "main": "./out/index.cjs", diff --git a/packages/babel-plugins/package.json b/packages/babel-plugins/package.json index 5f420d4b..604dbb6f 100644 --- a/packages/babel-plugins/package.json +++ b/packages/babel-plugins/package.json @@ -1,6 +1,6 @@ { "name": "@powership/babel-plugins", - "version": "5.6.1", + "version": "5.7.7", "main": "./out/index.js", "sideEffects": false, "typings": "./out/index.d.ts", diff --git a/packages/boilerplate/package.json b/packages/boilerplate/package.json index b175be29..9aeeb1c7 100644 --- a/packages/boilerplate/package.json +++ b/packages/boilerplate/package.json @@ -1,6 +1,6 @@ { "name": "@powership/boilerplate", - "version": "5.6.1", + "version": "5.7.7", "author": "antoniopresto ", "sideEffects": false, "type": "module", diff --git a/packages/entity/package.json b/packages/entity/package.json index 0ed2c0f8..bb7debe0 100644 --- a/packages/entity/package.json +++ b/packages/entity/package.json @@ -1,6 +1,6 @@ { "name": "@powership/entity", - "version": "5.6.1", + "version": "5.7.7", "type": "module", "main": "./out/index.cjs", "module": "./out/index.mjs", diff --git a/packages/logstorm/package.json b/packages/logstorm/package.json index c21b4171..c6493ed3 100644 --- a/packages/logstorm/package.json +++ b/packages/logstorm/package.json @@ -1,6 +1,6 @@ { "name": "logstorm", - "version": "5.6.1", + "version": "5.7.7", "typings": "out", "author": "antoniopresto ", "type": "module", diff --git a/packages/mongo/package.json b/packages/mongo/package.json index 455081e3..72fb64af 100644 --- a/packages/mongo/package.json +++ b/packages/mongo/package.json @@ -1,6 +1,6 @@ { "name": "@powership/mongo", - "version": "5.6.1", + "version": "5.7.7", "type": "module", "main": "./out/index.cjs", "module": "./out/index.mjs", diff --git a/packages/plugin-engine/package.json b/packages/plugin-engine/package.json index 280c1f7a..ccf637a7 100644 --- a/packages/plugin-engine/package.json +++ b/packages/plugin-engine/package.json @@ -1,6 +1,6 @@ { "name": "plugin-engine", - "version": "5.6.1", + "version": "5.7.7", "type": "module", "main": "./out/index.cjs", "module": "./out/index.mjs", diff --git a/packages/powership/package.json b/packages/powership/package.json index 68b44c81..15f18004 100644 --- a/packages/powership/package.json +++ b/packages/powership/package.json @@ -1,6 +1,6 @@ { "name": "powership", - "version": "5.6.1", + "version": "5.7.7", "author": "antoniopresto ", "type": "module", "main": "./out/index.cjs", diff --git a/packages/runmate/package.json b/packages/runmate/package.json index d3e3905f..f13e0108 100644 --- a/packages/runmate/package.json +++ b/packages/runmate/package.json @@ -1,6 +1,6 @@ { "name": "runmate", - "version": "5.6.1", + "version": "5.7.7", "typings": "out", "author": "antoniopresto ", "license": "MIT", diff --git a/packages/schema/package.json b/packages/schema/package.json index 121672f2..aa001ff1 100644 --- a/packages/schema/package.json +++ b/packages/schema/package.json @@ -1,6 +1,6 @@ { "name": "@powership/schema", - "version": "5.6.1", + "version": "5.7.7", "type": "module", "main": "./out/index.cjs", "module": "./out/index.mjs", diff --git a/packages/server/package.json b/packages/server/package.json index 6d53bf20..60511f42 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,6 +1,6 @@ { "name": "@powership/server", - "version": "5.6.1", + "version": "5.7.7", "type": "module", "main": "./out/index.cjs", "module": "./out/index.mjs", diff --git a/packages/transporter/package.json b/packages/transporter/package.json index ab1e675d..d770cfa2 100644 --- a/packages/transporter/package.json +++ b/packages/transporter/package.json @@ -1,6 +1,6 @@ { "name": "@powership/transporter", - "version": "5.6.1", + "version": "5.7.7", "type": "module", "main": "./out/index.cjs", "module": "./out/index.mjs", diff --git a/packages/utils/package.json b/packages/utils/package.json index 0b86d2f1..df21bc64 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -1,6 +1,6 @@ { "name": "@powership/utils", - "version": "5.6.1", + "version": "5.7.7", "typings": "out", "author": "antoniopresto ", "license": "MIT", diff --git a/packages/utils/src/getTypeName.ts b/packages/utils/src/getTypeName.ts index 91684217..da6e2487 100644 --- a/packages/utils/src/getTypeName.ts +++ b/packages/utils/src/getTypeName.ts @@ -1,6 +1,5 @@ import { isPlainObject } from 'lodash'; -import { BJSON } from './BJSON'; import { proxyRealValue } from './createProxy'; import { hashObject } from './hashObject'; import { tupleEnum } from './typings'; @@ -11,14 +10,6 @@ export function getTypeName(input: any): string { return describeConstructor(input).constructorName; } -export const messageTypes = { - expectedValueOfTypeFound(expected: string, foundValue: unknown) { - return `Expected value to be of type '${expected}', but found a '${getTypeName( - foundValue - )}' instead.`; - }, -}; - export const KNOWN_CONSTRUCTOR_NAMES = tupleEnum( 'undefined', 'null', @@ -165,7 +156,7 @@ export function describeType(value) { let _string: string; function toString() { - return (_string = _string ?? BJSON.stringify(value)); + return (_string = _string ?? hashObject(value)); } let _hash: string; diff --git a/packages/utils/src/hashObject.ts b/packages/utils/src/hashObject.ts index c9719608..b14a5358 100644 --- a/packages/utils/src/hashObject.ts +++ b/packages/utils/src/hashObject.ts @@ -5,3 +5,5 @@ export function hashObject(obj: any) { respectType: false, }); } + +export { objectHash }; diff --git a/packages/utils/src/simpleObjectHash.ts b/packages/utils/src/simpleObjectHash.ts index 9fb5c3f1..689cf3a6 100644 --- a/packages/utils/src/simpleObjectHash.ts +++ b/packages/utils/src/simpleObjectHash.ts @@ -1,8 +1,7 @@ -import { BJSON } from './BJSON'; import { proxyRealValue } from './createProxy'; import { describeConstructor, getNativeConstructorType } from './getTypeName'; -import { hashName, hashString, stringHash } from './hashString'; -import { sortObject } from './sortObject'; +import { objectHash } from './hashObject'; +import { hashName, hashString } from './hashString'; export function simpleObjectHash(value: any): string { return hashName(_simpleObjectHash(value)); @@ -15,8 +14,7 @@ export function _simpleObjectHash(value: any): string { value = proxyRealValue(value); if (typeof value === 'function' && value.name) { - const json = BJSON.stringify(value); - const hash = stringHash(json); + const hash = objectHash(value); return `;function(${value.name}_${hash});`; } @@ -35,9 +33,7 @@ export function _simpleObjectHash(value: any): string { } } - const sorted = sortObject(value); - - const bJSON = BJSON.stringify(sorted); + const bJSON = objectHash(value); return `;${constructorName}(${hashString(bJSON)})`; }