@politie/sherlock-proxy
Advanced tools
Comparing version 1.0.0-beta.3 to 1.0.0-beta.4
{ | ||
"name": "@politie/sherlock-proxy", | ||
"version": "1.0.0-beta.3", | ||
"version": "1.0.0-beta.4", | ||
"description": "A proxy extension to Sherlock.", | ||
@@ -41,4 +41,4 @@ "main": "sherlock-proxy.cjs.js", | ||
"peerDependencies": { | ||
"@politie/sherlock": "1.0.0-beta.3" | ||
"@politie/sherlock": "1.0.0-beta.4" | ||
} | ||
} |
@@ -8,5 +8,2 @@ 'use strict'; | ||
var BaseError = sherlock.informant.BaseError; | ||
var Logger = sherlock.informant.Logger; | ||
var logger = Logger.get('@politie/sherlock.proxy'); | ||
var IS_DERIVABLE_PROXY = Symbol('isDerivableProxy'); | ||
@@ -58,3 +55,3 @@ /** | ||
// istanbul ignore next: for debug purposes | ||
throw new BaseError(e, { expression: pd.$expression }, 'error while getting %s', pd.$expression || '$value'); | ||
throw Object.assign(new Error("error while getting " + (pd.$expression || '$value') + ": " + (e && e.message)), { jse_cause: e }); | ||
} | ||
@@ -67,4 +64,3 @@ }, | ||
if (!sherlock.isAtom(atom)) { | ||
var oldValue = safeGet(atom); | ||
throw new BaseError({ oldValue: oldValue, newValue: newValue, expression: expression }, '%s is readonly', expression || '$value'); | ||
throw new Error((expression || '$value') + " is readonly"); | ||
} | ||
@@ -75,4 +71,3 @@ try { | ||
catch (e) { | ||
var oldValue = safeGet(atom); | ||
throw new BaseError(e, { oldValue: oldValue, newValue: newValue, expression: expression }, 'error while setting %s', expression || '$value'); | ||
throw Object.assign(new Error("error while setting " + (expression || '$value') + ": " + (e && e.message)), { jse_cause: e }); | ||
} | ||
@@ -94,3 +89,3 @@ }, | ||
// istanbul ignore next: for debug purposes | ||
throw new BaseError(e, { expression: pd.$expression }, 'error while getting %s', pd.$expression || '$targetValue'); | ||
throw Object.assign(new Error("error while getting " + (pd.$expression || '$targetValue') + ": " + (e && e.message)), { jse_cause: e }); | ||
} | ||
@@ -103,4 +98,3 @@ }, | ||
if (!sherlock.isAtom(atom)) { | ||
var oldValue = safeGet(atom); | ||
throw new BaseError({ oldValue: oldValue, newValue: newValue, expression: expression }, '%s is readonly', expression || '$targetValue'); | ||
throw new Error((expression || '$targetValue') + " is readonly"); | ||
} | ||
@@ -111,4 +105,3 @@ try { | ||
catch (e) { | ||
var oldValue = safeGet(atom); | ||
throw new BaseError(e, { oldValue: oldValue, newValue: newValue, expression: expression }, 'error while setting %s', expression || '$targetValue'); | ||
throw Object.assign(new Error("error while setting " + (expression || '$targetValue') + ": " + (e && e.message)), { jse_cause: e }); | ||
} | ||
@@ -144,3 +137,2 @@ }, | ||
descriptor.$path = path; | ||
logger.trace({ obj: obj, expression: expression, descriptor: descriptor }, 'created'); | ||
return new Proxy(descriptor, proxyHandler); | ||
@@ -212,3 +204,3 @@ }; | ||
expression = pd.$expression; | ||
throw new BaseError({ value: pd.$value, expression: expression }, '%s is not iterable', expression || 'object'); | ||
throw Object.assign(new Error((expression || 'object') + " is not iterable"), { value: pd.$value, expression: expression }); | ||
} | ||
@@ -249,10 +241,2 @@ i = 0; | ||
} | ||
function safeGet(a$) { | ||
try { | ||
return a$.get(); | ||
} | ||
catch (e) { | ||
return e; | ||
} | ||
} | ||
function unpackProxy(obj) { | ||
@@ -259,0 +243,0 @@ if (isDerivableProxy(obj)) { |
import { __generator } from 'tslib'; | ||
import { clone, informant, isAtom, isDerivable } from '@politie/sherlock'; | ||
import { clone, isAtom, isDerivable } from '@politie/sherlock'; | ||
var BaseError = informant.BaseError; | ||
var Logger = informant.Logger; | ||
var logger = Logger.get('@politie/sherlock.proxy'); | ||
var IS_DERIVABLE_PROXY = Symbol('isDerivableProxy'); | ||
@@ -53,3 +50,3 @@ /** | ||
// istanbul ignore next: for debug purposes | ||
throw new BaseError(e, { expression: pd.$expression }, 'error while getting %s', pd.$expression || '$value'); | ||
throw Object.assign(new Error("error while getting " + (pd.$expression || '$value') + ": " + (e && e.message)), { jse_cause: e }); | ||
} | ||
@@ -62,4 +59,3 @@ }, | ||
if (!isAtom(atom)) { | ||
var oldValue = safeGet(atom); | ||
throw new BaseError({ oldValue: oldValue, newValue: newValue, expression: expression }, '%s is readonly', expression || '$value'); | ||
throw new Error((expression || '$value') + " is readonly"); | ||
} | ||
@@ -70,4 +66,3 @@ try { | ||
catch (e) { | ||
var oldValue = safeGet(atom); | ||
throw new BaseError(e, { oldValue: oldValue, newValue: newValue, expression: expression }, 'error while setting %s', expression || '$value'); | ||
throw Object.assign(new Error("error while setting " + (expression || '$value') + ": " + (e && e.message)), { jse_cause: e }); | ||
} | ||
@@ -89,3 +84,3 @@ }, | ||
// istanbul ignore next: for debug purposes | ||
throw new BaseError(e, { expression: pd.$expression }, 'error while getting %s', pd.$expression || '$targetValue'); | ||
throw Object.assign(new Error("error while getting " + (pd.$expression || '$targetValue') + ": " + (e && e.message)), { jse_cause: e }); | ||
} | ||
@@ -98,4 +93,3 @@ }, | ||
if (!isAtom(atom)) { | ||
var oldValue = safeGet(atom); | ||
throw new BaseError({ oldValue: oldValue, newValue: newValue, expression: expression }, '%s is readonly', expression || '$targetValue'); | ||
throw new Error((expression || '$targetValue') + " is readonly"); | ||
} | ||
@@ -106,4 +100,3 @@ try { | ||
catch (e) { | ||
var oldValue = safeGet(atom); | ||
throw new BaseError(e, { oldValue: oldValue, newValue: newValue, expression: expression }, 'error while setting %s', expression || '$targetValue'); | ||
throw Object.assign(new Error("error while setting " + (expression || '$targetValue') + ": " + (e && e.message)), { jse_cause: e }); | ||
} | ||
@@ -139,3 +132,2 @@ }, | ||
descriptor.$path = path; | ||
logger.trace({ obj: obj, expression: expression, descriptor: descriptor }, 'created'); | ||
return new Proxy(descriptor, proxyHandler); | ||
@@ -207,3 +199,3 @@ }; | ||
expression = pd.$expression; | ||
throw new BaseError({ value: pd.$value, expression: expression }, '%s is not iterable', expression || 'object'); | ||
throw Object.assign(new Error((expression || 'object') + " is not iterable"), { value: pd.$value, expression: expression }); | ||
} | ||
@@ -244,10 +236,2 @@ i = 0; | ||
} | ||
function safeGet(a$) { | ||
try { | ||
return a$.get(); | ||
} | ||
catch (e) { | ||
return e; | ||
} | ||
} | ||
function unpackProxy(obj) { | ||
@@ -254,0 +238,0 @@ if (isDerivableProxy(obj)) { |
@@ -21,18 +21,3 @@ (function (global, factory) { | ||
***************************************************************************** */ | ||
/* global Reflect, Promise */ | ||
function __generator(thisArg, body) { | ||
@@ -66,5 +51,2 @@ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
var BaseError = sherlock.informant.BaseError; | ||
var Logger = sherlock.informant.Logger; | ||
var logger = Logger.get('@politie/sherlock.proxy'); | ||
var IS_DERIVABLE_PROXY = Symbol('isDerivableProxy'); | ||
@@ -116,3 +98,3 @@ /** | ||
// istanbul ignore next: for debug purposes | ||
throw new BaseError(e, { expression: pd.$expression }, 'error while getting %s', pd.$expression || '$value'); | ||
throw Object.assign(new Error("error while getting " + (pd.$expression || '$value') + ": " + (e && e.message)), { jse_cause: e }); | ||
} | ||
@@ -125,4 +107,3 @@ }, | ||
if (!sherlock.isAtom(atom)) { | ||
var oldValue = safeGet(atom); | ||
throw new BaseError({ oldValue: oldValue, newValue: newValue, expression: expression }, '%s is readonly', expression || '$value'); | ||
throw new Error((expression || '$value') + " is readonly"); | ||
} | ||
@@ -133,4 +114,3 @@ try { | ||
catch (e) { | ||
var oldValue = safeGet(atom); | ||
throw new BaseError(e, { oldValue: oldValue, newValue: newValue, expression: expression }, 'error while setting %s', expression || '$value'); | ||
throw Object.assign(new Error("error while setting " + (expression || '$value') + ": " + (e && e.message)), { jse_cause: e }); | ||
} | ||
@@ -152,3 +132,3 @@ }, | ||
// istanbul ignore next: for debug purposes | ||
throw new BaseError(e, { expression: pd.$expression }, 'error while getting %s', pd.$expression || '$targetValue'); | ||
throw Object.assign(new Error("error while getting " + (pd.$expression || '$targetValue') + ": " + (e && e.message)), { jse_cause: e }); | ||
} | ||
@@ -161,4 +141,3 @@ }, | ||
if (!sherlock.isAtom(atom)) { | ||
var oldValue = safeGet(atom); | ||
throw new BaseError({ oldValue: oldValue, newValue: newValue, expression: expression }, '%s is readonly', expression || '$targetValue'); | ||
throw new Error((expression || '$targetValue') + " is readonly"); | ||
} | ||
@@ -169,4 +148,3 @@ try { | ||
catch (e) { | ||
var oldValue = safeGet(atom); | ||
throw new BaseError(e, { oldValue: oldValue, newValue: newValue, expression: expression }, 'error while setting %s', expression || '$targetValue'); | ||
throw Object.assign(new Error("error while setting " + (expression || '$targetValue') + ": " + (e && e.message)), { jse_cause: e }); | ||
} | ||
@@ -202,3 +180,2 @@ }, | ||
descriptor.$path = path; | ||
logger.trace({ obj: obj, expression: expression, descriptor: descriptor }, 'created'); | ||
return new Proxy(descriptor, proxyHandler); | ||
@@ -270,3 +247,3 @@ }; | ||
expression = pd.$expression; | ||
throw new BaseError({ value: pd.$value, expression: expression }, '%s is not iterable', expression || 'object'); | ||
throw Object.assign(new Error((expression || 'object') + " is not iterable"), { value: pd.$value, expression: expression }); | ||
} | ||
@@ -307,10 +284,2 @@ i = 0; | ||
} | ||
function safeGet(a$) { | ||
try { | ||
return a$.get(); | ||
} | ||
catch (e) { | ||
return e; | ||
} | ||
} | ||
function unpackProxy(obj) { | ||
@@ -317,0 +286,0 @@ if (isDerivableProxy(obj)) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
132158
1122