From 96bfc7a436f155fbf1130b0f0baa13af125295e2 Mon Sep 17 00:00:00 2001 From: sylvainpolletvillard Date: Wed, 1 Aug 2018 23:19:39 +0200 Subject: [PATCH] build for v3.6.0 --- dist/object-model.js | 232 ++++++++++++++++------------------- dist/object-model.js.map | 2 +- dist/object-model.min.js | 4 +- dist/object-model.min.js.map | 2 +- index.html | 4 +- package-lock.json | 16 +-- 6 files changed, 122 insertions(+), 138 deletions(-) diff --git a/dist/object-model.js b/dist/object-model.js index a06048d..2c1d66d 100644 --- a/dist/object-model.js +++ b/dist/object-model.js @@ -1,4 +1,4 @@ -// ObjectModel v3.5.4 - http://objectmodel.js.org +// ObjectModel v3.6.0 - http://objectmodel.js.org // MIT License - Sylvain Pollet-Villard (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : @@ -8,17 +8,18 @@ const bettertypeof = x => Object.prototype.toString.call(x).match(/\s([a-zA-Z]+)/)[1], - getProto = x => Object.getPrototypeOf(x), - setProto = (x,p) => Object.setPrototypeOf(x,p), + getProto = x => Object.getPrototypeOf(x), + setProto = (x, p) => Object.setPrototypeOf(x, p), - has = (o, prop) => o.hasOwnProperty(prop), - is = (Constructor, obj) => obj instanceof Constructor, - isFunction = f => typeof f === "function", - isObject = o => typeof o === "object", + has = (o, prop) => o.hasOwnProperty(prop), + is = (Constructor, obj) => obj instanceof Constructor, + isFunction = f => typeof f === "function", + isObject = o => typeof o === "object", isPlainObject = o => o && isObject(o) && getProto(o) === Object.prototype, + isIterable = x => x && isFunction(x[Symbol.iterator]), - proxifyFn = (fn, apply) => new Proxy(fn, {apply}), - proxifyModel = (val, model, traps) => new Proxy(val, Object.assign({getPrototypeOf: () => model.prototype}, traps)), + proxifyFn = (fn, apply) => new Proxy(fn, { apply }), + proxifyModel = (val, model, traps) => new Proxy(val, Object.assign({ getPrototypeOf: () => model.prototype }, traps)), merge = (target, src = {}, deep) => { for (let key in src) { @@ -34,7 +35,7 @@ }, define = (obj, key, value, enumerable = false) => { - Object.defineProperty(obj, key, {value, enumerable, writable: true, configurable: true}); + Object.defineProperty(obj, key, { value, enumerable, writable: true, configurable: true }); }, setConstructor = (model, constructor) => { @@ -73,7 +74,7 @@ }, stackError = (errors, expected, received, path, message) => { - errors.push({expected, received, path, message}); + errors.push({ expected, received, path, message }); }, unstackErrors = (model, errorCollector = model.errorCollector) => { @@ -114,7 +115,7 @@ if (!Array.isArray(newParts)) newParts = [newParts]; if (newParts.length > 0) { def = newParts - .reduce((def, ext) => def.concat(ext), Array.isArray(def) ? def.slice() : [def]) // clone to lose ref + .reduce((def, ext) => def.concat(ext), Array.isArray(def) ? [...def] : [def]) // clone to lose ref .filter((value, index, self) => self.indexOf(value) === index); // remove duplicates } @@ -173,7 +174,7 @@ if (result !== true) { let onFail = isFunction(assertion.description) ? assertion.description : (assertionResult, value) => `assertion "${assertion.description}" returned ${format(assertionResult)} ` - +`for ${path ? path+" =" : "value"} ${format(value)}`; + + `for ${path ? path + " =" : "value"} ${format(value)}`; stackError(errors, assertion, obj, path, onFail.call(model, result, obj, path)); } } @@ -192,10 +193,10 @@ if (Array.isArray(obj)) return `[${obj.map(item => format(item, stack)).join(', ')}]` if (obj.toString !== Object.prototype.toString) return obj.toString() if (obj && isObject(obj)) { - let props = Object.keys(obj), - indent = '\t'.repeat(stack.length); + let props = Object.keys(obj), + indent = '\t'.repeat(stack.length); return `{${props.map( - key => `\n${indent + key}: ${format(obj[key], stack.slice())}` + key => `\n${indent + key}: ${format(obj[key], [...stack])}` ).join(',')} ${props.length ? `\n${indent.slice(1)}` : ''}}` } @@ -206,10 +207,10 @@ controlMutation = (model, def, path, o, key, privateAccess, applyMutation) => { let newPath = formatPath(path, key), - isPrivate = model.conventionForPrivate(key), - isConstant = model.conventionForConstant(key), - isOwnProperty = has(o, key), - initialPropDescriptor = isOwnProperty && Object.getOwnPropertyDescriptor(o, key); + isPrivate = model.conventionForPrivate(key), + isConstant = model.conventionForConstant(key), + isOwnProperty = has(o, key), + initialPropDescriptor = isOwnProperty && Object.getOwnPropertyDescriptor(o, key); if (key in def && ((isPrivate && !privateAccess) || (isConstant && o[key] !== undefined))) cannot(`modify ${isPrivate ? "private" : "constant"} property ${key}`, model); @@ -250,7 +251,7 @@ return obj // no value or not leaf or already a model instance let def = parseDefinition(defNode), - suitableModels = []; + suitableModels = []; for (let part of def) { if (is(Model, part) && part.test(obj)) @@ -272,9 +273,9 @@ checkUndeclaredProps = (obj, def, errors, path) => { Object.keys(obj).map(key => { let val = obj[key], - subpath = formatPath(path, key); + subpath = formatPath(path, key); if (!has(def, key)) rejectUndeclaredProp(subpath, val, errors); - else if (isPlainObject(val)) checkUndeclaredProps(val, def[key], errors, subpath); + else if (isPlainObject(val)) checkUndeclaredProps(val, def[key], errors, subpath); }); }, @@ -394,12 +395,12 @@ test(obj) { let model = this; - while(!has(model, "errorCollector")) { + while (!has(model, "errorCollector")) { model = getProto(model); } let initialErrorCollector = model.errorCollector, - failed; + failed; model.errorCollector = () => { failed = true; @@ -483,8 +484,8 @@ extend(...newParts) { let def = Object.assign({}, this.definition), - newAssertions = [], - proto = {}; + newAssertions = [], + proto = {}; merge(proto, this.prototype, false); @@ -525,29 +526,58 @@ } }); - let ARRAY_MUTATORS = ["pop", "push", "reverse", "shift", "sort", "splice", "unshift"]; + const initListModel = (base, constructor, def, init, clone, mutators, otherTraps = {}) => { - function ArrayModel(def) { + let model = function (list = model.default) { + list = init(list); - let model = function (array = model.default) { - if (model.validate(array)) return proxifyModel(array, model, { - get(arr, key) { - if (key === _original) return arr + if (model.validate(list)) return proxifyModel(list, model, Object.assign({ + get(l, key) { + if (key === _original) return l - let val = arr[key]; + let val = l[key]; return isFunction(val) ? proxifyFn(val, (fn, ctx, args) => { - if (ARRAY_MUTATORS.includes(key)) { - let testArray = arr.slice(); - fn.apply(testArray, args); - model.validate(testArray); + if (has(mutators, key)) { + if (mutators[key]) args = mutators[key](args); // autocast method args + + let testingClone = clone(l); + fn.apply(testingClone, args); + model.validate(testingClone); } - let returnValue = fn.apply(arr, args); - array.forEach((a, i) => arr[i] = cast(a, model.definition)); - return returnValue + return fn.apply(l, args) }) : val - }, + } + }, otherTraps)) + }; + + extend(model, base); + setConstructor(model, constructor); + initModel(model, def); + return model + }; + function ArrayModel(def) { + let castAll = args => args.map(arg => cast(arg, def)); + + let model = initListModel( + Array, + ArrayModel, + def, + a => Array.isArray(a) ? castAll(a) : a, + a => [...a], + { + "copyWithin": 0, + "fill": ([val, ...rest]) => [cast(val, def), ...rest], + "pop": 0, + "push": castAll, + "reverse": 0, + "shift": 0, + "sort": 0, + "splice": ([start, end, ...vals]) => [start, end, ...castAll(vals)], + "unshift": castAll, + }, + { set(arr, key, val) { return setArrayKey(arr, key, val, model) }, @@ -555,12 +585,9 @@ deleteProperty(arr, key) { return !(key in arr) || setArrayKey(arr, key, undefined, model) } - }) - }; + } + ); - extend(model, Array); - setConstructor(model, ArrayModel); - initModel(model, def); return model } @@ -589,7 +616,7 @@ if (parseInt(key) === +key && key >= 0) value = checkDefinition(value, model.definition, path, model.errors, []); - let testArray = array.slice(); + let testArray = [...array]; testArray[key] = value; checkAssertions(testArray, model, path); let isSuccess = !unstackErrors(model); @@ -597,42 +624,19 @@ return isSuccess }; - let SET_MUTATORS = ["add", "delete", "clear"]; - function SetModel(def) { - - let model = function (iterable = model.default) { - let castValue = val => cast(val, model.definition), - set = new Set([...iterable].map(castValue)); - - if (!model.validate(set)) return - - return proxifyModel(set, model, { - get(set, key) { - if (key === _original) return set - - let val = set[key]; - return isFunction(val) ? proxifyFn(val, (fn, ctx, args) => { - if (key === "add") { - args[0] = castValue(args[0]); - } - - if (SET_MUTATORS.includes(key)) { - let testSet = new Set(set); - fn.apply(testSet, args); - model.validate(testSet); - } - - return fn.apply(set, args) - }) : val - } - }) - }; - - extend(model, Set); - setConstructor(model, SetModel); - initModel(model, def); - return model + return initListModel( + Set, + SetModel, + def, + it => isIterable(it) ? new Set([...it].map(val => cast(val, def))) : it, + set => new Set(set), + { + "add": ([val]) => [cast(val, def)], + "delete": 0, + "clear": 0 + } + ) } extend(SetModel, Model, { @@ -654,47 +658,27 @@ } }); - let MAP_MUTATORS = ["set", "delete", "clear"]; - function MapModel(key, value) { - let model = function (iterable = model.default) { - let castKeyValue = pair => ["key", "value"].map((prop, i) => cast(pair[i], model.definition[prop])), - map = new Map([...iterable].map(castKeyValue)); - - if (!model.validate(map)) return - - return proxifyModel(map, model, { - get(map, key) { - if (key === _original) return map - - let val = map[key]; - return isFunction(val) ? proxifyFn(val, (fn, ctx, args) => { - if (key === "set") { - args = castKeyValue(args); - } - - if (MAP_MUTATORS.includes(key)) { - let testMap = new Map(map); - fn.apply(testMap, args); - model.validate(testMap); - } - - return fn.apply(map, args) - }) : val - } - }) - }; - - extend(model, Map); - setConstructor(model, MapModel); - initModel(model, {key, value}); - return model + let castKeyValue = ([k, v]) => [cast(k, key), cast(v, value)]; + + return initListModel( + Map, + MapModel, + { key, value }, + it => isIterable(it) ? new Map([...it].map(castKeyValue)) : it, + map => new Map(map), + { + "set": castKeyValue, + "delete": 0, + "clear": 0 + } + ) } extend(MapModel, Model, { toString(stack) { - let {key, value} = this.definition; + let { key, value } = this.definition; return `Map of ${formatDefinition(key, stack)} : ${formatDefinition(value, stack)}` }, @@ -711,7 +695,7 @@ }, extend(keyPart, valuePart) { - let {key, value} = this.definition; + let { key, value } = this.definition; return extendModel(new MapModel(extendDefinition(key, keyPart), extendDefinition(value, valuePart)), this) } }); @@ -726,7 +710,7 @@ return fn[key] }, - apply (fn, ctx, args) { + apply(fn, ctx, args) { let def = model.definition; def.arguments.forEach((argDef, i) => { @@ -749,7 +733,7 @@ extend(model, Function); setConstructor(model, FunctionModel); - initModel(model, {arguments: argsDef}); + initModel(model, { arguments: argsDef }); return model } @@ -757,7 +741,7 @@ extend(FunctionModel, Model, { toString(stack = []) { let out = `Function(${this.definition.arguments.map( - argDef => formatDefinition(argDef, stack.slice()) + argDef => formatDefinition(argDef, [...stack]) ).join(", ")})`; if ("return" in this.definition) { @@ -773,8 +757,8 @@ extend(newArgs, newReturns) { let args = this.definition.arguments, - mixedArgs = newArgs.map((a, i) => extendDefinition(i in args ? args[i] : [], newArgs[i])), - mixedReturns = extendDefinition(this.definition.return, newReturns); + mixedArgs = newArgs.map((a, i) => extendDefinition(i in args ? args[i] : [], newArgs[i])), + mixedReturns = extendDefinition(this.definition.return, newReturns); return extendModel(new FunctionModel(...mixedArgs).return(mixedReturns), this) }, diff --git a/dist/object-model.js.map b/dist/object-model.js.map index 2cf4ef1..945fab7 100644 --- a/dist/object-model.js.map +++ b/dist/object-model.js.map @@ -1 +1 @@ -{"version":3,"file":"object-model.js","sources":["../src/helpers.js","../src/object-model.js","../src/array-model.js","../src/set-model.js","../src/map-model.js","../src/function-model.js","../src/devtool-formatter.js"],"sourcesContent":["export const\r\n\tbettertypeof = x => Object.prototype.toString.call(x).match(/\\s([a-zA-Z]+)/)[1],\r\n\tgetProto = x => Object.getPrototypeOf(x),\r\n\tsetProto = (x,p) => Object.setPrototypeOf(x,p),\r\n\r\n\thas = (o, prop) => o.hasOwnProperty(prop),\r\n\tis = (Constructor, obj) => obj instanceof Constructor,\r\n\tisFunction = f => typeof f === \"function\",\r\n\tisObject = o => typeof o === \"object\",\r\n\tisPlainObject = o => o && isObject(o) && getProto(o) === Object.prototype,\r\n\r\n\tproxifyFn = (fn, apply) => new Proxy(fn, {apply}),\r\n\tproxifyModel = (val, model, traps) => new Proxy(val, Object.assign({getPrototypeOf: () => model.prototype}, traps)),\r\n\r\n\tmerge = (target, src = {}, deep) => {\r\n\t\tfor (let key in src) {\r\n\t\t\tif (deep && isPlainObject(src[key])) {\r\n\t\t\t\tlet o = {}\r\n\t\t\t\tmerge(o, target[key], deep)\r\n\t\t\t\tmerge(o, src[key], deep)\r\n\t\t\t\ttarget[key] = o\r\n\t\t\t} else {\r\n\t\t\t\ttarget[key] = src[key]\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\tdefine = (obj, key, value, enumerable = false) => {\r\n\t\tObject.defineProperty(obj, key, {value, enumerable, writable: true, configurable: true})\r\n\t},\r\n\r\n\tsetConstructor = (model, constructor) => {\r\n\t\tsetProto(model, constructor.prototype)\r\n\t\tdefine(model, \"constructor\", constructor)\r\n\t},\r\n\r\n\textend = (child, parent, props) => {\r\n\t\tchild.prototype = Object.assign(Object.create(parent.prototype, {\r\n\t\t\tconstructor: {\r\n\t\t\t\tvalue: child,\r\n\t\t\t\twritable: true,\r\n\t\t\t\tconfigurable: true\r\n\t\t\t}\r\n\t\t}), props)\r\n\t\tsetProto(child, parent)\r\n\t}","import {\r\n\tbettertypeof, define, extend, getProto, has, is, isFunction, isObject, isPlainObject,\r\n\tmerge, proxifyFn, setConstructor\r\n} from \"./helpers.js\"\r\n\r\nexport const\r\n\t_constructor = Symbol(),\r\n\t_validate = Symbol(),\r\n\t_original = Symbol(),\r\n\t_get = Symbol(), // used to bypass private access\r\n\r\n\tinitModel = (model, def) => {\r\n\t\tmodel.definition = def\r\n\t\tmodel.assertions = [...model.assertions]\r\n\t\tdefine(model, \"errors\", [])\r\n\t\tdelete model.name;\r\n\t},\r\n\r\n\textendModel = (child, parent, newProps) => {\r\n\t\textend(child, parent, newProps)\r\n\t\tchild.assertions.push(...parent.assertions)\r\n\t\treturn child\r\n\t},\r\n\r\n\tstackError = (errors, expected, received, path, message) => {\r\n\t\terrors.push({expected, received, path, message})\r\n\t},\r\n\r\n\tunstackErrors = (model, errorCollector = model.errorCollector) => {\r\n\t\tlet nbErrors = model.errors.length\r\n\t\tif (nbErrors > 0) {\r\n\t\t\tlet errors = model.errors.map(err => {\r\n\t\t\t\tif (!err.message) {\r\n\t\t\t\t\tlet def = Array.isArray(err.expected) ? err.expected : [err.expected]\r\n\t\t\t\t\terr.message = \"expecting \" + (err.path ? err.path + \" to be \" : \"\") + def.map(d => format(d)).join(\" or \")\r\n\t\t\t\t\t\t+ \", got \" + (err.received != null ? bettertypeof(err.received) + \" \" : \"\") + format(err.received)\r\n\t\t\t\t}\r\n\t\t\t\treturn err\r\n\t\t\t})\r\n\t\t\tmodel.errors = []\r\n\t\t\terrorCollector.call(model, errors) // throw all errors collected\r\n\t\t}\r\n\t\treturn nbErrors\r\n\t},\r\n\r\n\tisModelInstance = i => i && is(Model, getProto(i).constructor),\r\n\r\n\tparseDefinition = (def) => {\r\n\t\tif (isPlainObject(def)) {\r\n\t\t\tObject.keys(def).map(key => { def[key] = parseDefinition(def[key]) })\r\n\t\t}\r\n\t\telse if (!Array.isArray(def)) return [def]\r\n\t\telse if (def.length === 1) return [...def, undefined, null]\r\n\r\n\t\treturn def\r\n\t},\r\n\r\n\tformatDefinition = (def, stack) => {\r\n\t\tlet parts = parseDefinition(def).map(d => format(d, stack));\r\n\t\treturn parts.length > 1 ? `(${parts.join(\" or \")})` : parts[0]\r\n\t},\r\n\r\n\textendDefinition = (def, newParts = []) => {\r\n\t\tif (!Array.isArray(newParts)) newParts = [newParts]\r\n\t\tif (newParts.length > 0) {\r\n\t\t\tdef = newParts\r\n\t\t\t\t.reduce((def, ext) => def.concat(ext), Array.isArray(def) ? def.slice() : [def]) // clone to lose ref\r\n\t\t\t\t.filter((value, index, self) => self.indexOf(value) === index) // remove duplicates\r\n\t\t}\r\n\r\n\t\treturn def\r\n\t},\r\n\r\n\tcheckDefinition = (obj, def, path, errors, stack) => {\r\n\t\tlet indexFound = stack.indexOf(def)\r\n\t\tif (indexFound !== -1 && stack.indexOf(def, indexFound + 1) !== -1)\r\n\t\t\treturn obj //if found twice in call stack, cycle detected, skip validation\r\n\r\n\t\tobj = cast(obj, def)\r\n\r\n\t\tif (is(Model, def)) {\r\n\t\t\tdef[_validate](obj, path, errors, stack.concat(def))\r\n\t\t}\r\n\t\telse if (isPlainObject(def)) {\r\n\t\t\tObject.keys(def).map(key => {\r\n\t\t\t\tlet val = obj ? obj[_get] ? obj[_get](key) : obj[key] : undefined;\r\n\t\t\t\tcheckDefinition(val, def[key], formatPath(path, key), errors, stack)\r\n\t\t\t})\r\n\t\t}\r\n\t\telse {\r\n\t\t\tlet pdef = parseDefinition(def)\r\n\t\t\tif (pdef.some(part => checkDefinitionPart(obj, part, path, stack)))\r\n\t\t\t\treturn obj\r\n\r\n\t\t\tstackError(errors, def, obj, path)\r\n\t\t}\r\n\r\n\t\treturn obj\r\n\t},\r\n\r\n\tcheckDefinitionPart = (obj, def, path, stack) => {\r\n\t\tif (obj == null) return obj === def\r\n\t\tif (isPlainObject(def) || is(Model, def)) { // object or model as part of union type\r\n\t\t\tlet errors = []\r\n\t\t\tcheckDefinition(obj, def, path, errors, stack)\r\n\t\t\treturn !errors.length\r\n\t\t}\r\n\t\tif (is(RegExp, def)) return def.test(obj)\r\n\t\tif (def === Number || def === Date) return obj.constructor === def && !isNaN(obj)\r\n\t\treturn obj === def\r\n\t\t\t|| (isFunction(def) && is(def, obj))\r\n\t\t\t|| obj.constructor === def\r\n\t},\r\n\r\n\tcheckAssertions = (obj, model, path, errors = model.errors) => {\r\n\t\tfor (let assertion of model.assertions) {\r\n\t\t\tlet result\r\n\t\t\ttry {\r\n\t\t\t\tresult = assertion.call(model, obj)\r\n\t\t\t} catch (err) {\r\n\t\t\t\tresult = err\r\n\t\t\t}\r\n\t\t\tif (result !== true) {\r\n\t\t\t\tlet onFail = isFunction(assertion.description) ? assertion.description : (assertionResult, value) =>\r\n\t\t\t\t\t`assertion \"${assertion.description}\" returned ${format(assertionResult)} `\r\n\t\t\t\t\t+`for ${path ? path+\" =\" : \"value\"} ${format(value)}`\r\n\t\t\t\tstackError(errors, assertion, obj, path, onFail.call(model, result, obj, path))\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\tformat = (obj, stack = []) => {\r\n\t\tif (stack.length > 15 || stack.includes(obj)) return '...'\r\n\t\tif (obj === null || obj === undefined) return String(obj)\r\n\t\tif (typeof obj === 'string') return `\"${obj}\"`\r\n\t\tif (is(Model, obj)) return obj.toString(stack)\r\n\r\n\t\tstack.unshift(obj)\r\n\r\n\t\tif (isFunction(obj)) return obj.name || obj.toString()\r\n\t\tif (is(Map, obj) || is(Set, obj)) return format([...obj])\r\n\t\tif (Array.isArray(obj)) return `[${obj.map(item => format(item, stack)).join(', ')}]`\r\n\t\tif (obj.toString !== Object.prototype.toString) return obj.toString()\r\n\t\tif (obj && isObject(obj)) {\r\n\t\t\tlet props = Object.keys(obj),\r\n\t\t\t indent = '\\t'.repeat(stack.length)\r\n\t\t\treturn `{${props.map(\r\n\t\t\t\tkey => `\\n${indent + key}: ${format(obj[key], stack.slice())}`\r\n\t\t\t).join(',')} ${props.length ? `\\n${indent.slice(1)}` : ''}}`\r\n\t\t}\r\n\r\n\t\treturn String(obj)\r\n\t},\r\n\r\n\tformatPath = (path, key) => path ? path + '.' + key : key,\r\n\r\n\tcontrolMutation = (model, def, path, o, key, privateAccess, applyMutation) => {\r\n\t\tlet newPath = formatPath(path, key),\r\n\t\t isPrivate = model.conventionForPrivate(key),\r\n\t\t isConstant = model.conventionForConstant(key),\r\n\t\t isOwnProperty = has(o, key),\r\n\t\t initialPropDescriptor = isOwnProperty && Object.getOwnPropertyDescriptor(o, key)\r\n\r\n\t\tif (key in def && ((isPrivate && !privateAccess) || (isConstant && o[key] !== undefined)))\r\n\t\t\tcannot(`modify ${isPrivate ? \"private\" : \"constant\"} property ${key}`, model)\r\n\r\n\t\tlet isInDefinition = has(def, key);\r\n\t\tif (isInDefinition || !model.sealed) {\r\n\t\t\tapplyMutation(newPath)\r\n\t\t\tif (isInDefinition) checkDefinition(o[key], def[key], newPath, model.errors, [])\r\n\t\t\tcheckAssertions(o, model, newPath)\r\n\t\t}\r\n\t\telse rejectUndeclaredProp(newPath, o[key], model.errors)\r\n\r\n\t\tlet nbErrors = model.errors.length\r\n\t\tif (nbErrors) {\r\n\t\t\tif (isOwnProperty) Object.defineProperty(o, key, initialPropDescriptor)\r\n\t\t\telse delete o[key] // back to the initial property defined in prototype chain\r\n\r\n\t\t\tunstackErrors(model)\r\n\t\t}\r\n\r\n\t\treturn !nbErrors\r\n\t},\r\n\r\n\tcannot = (msg, model) => {\r\n\t\tmodel.errors.push({ message: \"cannot \" + msg })\r\n\t},\r\n\r\n\trejectUndeclaredProp = (path, received, errors) => {\r\n\t\terrors.push({\r\n\t\t\tpath,\r\n\t\t\treceived,\r\n\t\t\tmessage: `property ${path} is not declared in the sealed model definition`\r\n\t\t})\r\n\t},\r\n\r\n\tcast = (obj, defNode = []) => {\r\n\t\tif (!obj || isPlainObject(defNode) || isModelInstance(obj))\r\n\t\t\treturn obj // no value or not leaf or already a model instance\r\n\r\n\t\tlet def = parseDefinition(defNode),\r\n\t\t suitableModels = []\r\n\r\n\t\tfor (let part of def) {\r\n\t\t\tif (is(Model, part) && part.test(obj))\r\n\t\t\t\tsuitableModels.push(part)\r\n\t\t}\r\n\r\n\t\tif (suitableModels.length === 1) {\r\n\t\t\t// automatically cast to suitable model when explicit (duck typing)\r\n\t\t\tlet duck = suitableModels[0];\r\n\t\t\treturn is(ObjectModel, duck) ? new duck(obj) : duck(obj)\r\n\t\t}\r\n\r\n\t\tif (suitableModels.length > 1)\r\n\t\t\tconsole.warn(`Ambiguous model for value ${format(obj)}, could be ${suitableModels.join(\" or \")}`)\r\n\r\n\t\treturn obj\r\n\t},\r\n\r\n\tcheckUndeclaredProps = (obj, def, errors, path) => {\r\n\t\tObject.keys(obj).map(key => {\r\n\t\t\tlet val = obj[key],\r\n\t\t\t subpath = formatPath(path, key)\r\n\t\t\tif (!has(def, key)) rejectUndeclaredProp(subpath, val, errors)\r\n\t\t\telse if (isPlainObject(val))\tcheckUndeclaredProps(val, def[key], errors, subpath)\r\n\t\t})\r\n\t},\r\n\r\n\tgetProxy = (model, obj, def, path, privateAccess) => {\r\n\t\tif (!isPlainObject(def)) return cast(obj, def)\r\n\r\n\t\tconst grantTemporaryPrivateAccess = f => proxifyFn(f, (fn, ctx, args) => {\r\n\t\t\tprivateAccess = true;\r\n\t\t\tlet result = Reflect.apply(fn, ctx, args);\r\n\t\t\tprivateAccess = false;\r\n\t\t\treturn result\r\n\t\t})\r\n\r\n\t\treturn new Proxy(obj, {\r\n\r\n\t\t\tgetPrototypeOf: () => path ? Object.prototype : getProto(obj),\r\n\r\n\t\t\tget(o, key) {\r\n\t\t\t\tif (key === _original) return o\r\n\t\t\t\tif (key === _get) return grantTemporaryPrivateAccess(prop => o[prop])\r\n\r\n\t\t\t\tif (typeof key !== \"string\") return Reflect.get(o, key)\r\n\r\n\t\t\t\tlet newPath = formatPath(path, key),\r\n\t\t\t\t\tdefPart = def[key];\r\n\r\n\t\t\t\tif (!privateAccess && key in def && model.conventionForPrivate(key)) {\r\n\t\t\t\t\tcannot(`access to private property ${newPath}`, model)\r\n\t\t\t\t\tunstackErrors(model)\r\n\t\t\t\t\treturn\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (o[key] && has(o, key) && !isPlainObject(defPart) && !isModelInstance(o[key])) {\r\n\t\t\t\t\to[key] = cast(o[key], defPart) // cast nested models\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (isFunction(o[key]) && key !== \"constructor\") {\r\n\t\t\t\t\treturn grantTemporaryPrivateAccess(o[key])\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (isPlainObject(defPart) && !o[key]) {\r\n\t\t\t\t\to[key] = {} // null-safe traversal\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn getProxy(model, o[key], defPart, newPath, privateAccess)\r\n\t\t\t},\r\n\r\n\t\t\tset(o, key, val) {\r\n\t\t\t\treturn controlMutation(model, def, path, o, key, privateAccess,\r\n\t\t\t\t\tnewPath => Reflect.set(o, key, getProxy(model, val, def[key], newPath))\r\n\t\t\t\t)\r\n\t\t\t},\r\n\r\n\t\t\tdeleteProperty(o, key) {\r\n\t\t\t\treturn controlMutation(model, def, path, o, key, privateAccess, () => Reflect.deleteProperty(o, key))\r\n\t\t\t},\r\n\r\n\t\t\tdefineProperty(o, key, args) {\r\n\t\t\t\treturn controlMutation(model, def, path, o, key, privateAccess, () => Reflect.defineProperty(o, key, args))\r\n\t\t\t},\r\n\r\n\t\t\thas(o, key) {\r\n\t\t\t\treturn Reflect.has(o, key) && Reflect.has(def, key) && !model.conventionForPrivate(key)\r\n\t\t\t},\r\n\r\n\t\t\townKeys(o) {\r\n\t\t\t\treturn Reflect.ownKeys(o).filter(key => Reflect.has(def, key) && !model.conventionForPrivate(key))\r\n\t\t\t},\r\n\r\n\t\t\tgetOwnPropertyDescriptor(o, key) {\r\n\t\t\t\tlet descriptor;\r\n\t\t\t\tif (!model.conventionForPrivate(key)) {\r\n\t\t\t\t\tdescriptor = Object.getOwnPropertyDescriptor(def, key);\r\n\t\t\t\t\tif (descriptor !== undefined) descriptor.value = o[key];\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn descriptor\r\n\t\t\t}\r\n\t\t})\r\n\t}\r\n\r\n\r\nexport function Model(def, params) {\r\n\treturn isPlainObject(def) ? new ObjectModel(def, params) : new BasicModel(def)\r\n}\r\n\r\nObject.assign(Model.prototype, {\r\n\tname: \"Model\",\r\n\tassertions: [],\r\n\r\n\tconventionForConstant: key => key.toUpperCase() === key,\r\n\tconventionForPrivate: key => key[0] === \"_\",\r\n\r\n\ttoString(stack) {\r\n\t\treturn formatDefinition(this.definition, stack)\r\n\t},\r\n\r\n\tas(name) {\r\n\t\tdefine(this, \"name\", name);\r\n\t\treturn this\r\n\t},\r\n\r\n\tdefaultTo(val) {\r\n\t\tthis.default = val\r\n\t\treturn this\r\n\t},\r\n\r\n\t[_validate](obj, path, errors, stack) {\r\n\t\tcheckDefinition(obj, this.definition, path, errors, stack)\r\n\t\tcheckAssertions(obj, this, path, errors)\r\n\t},\r\n\r\n\tvalidate(obj, errorCollector) {\r\n\t\tthis[_validate](obj, null, this.errors, [])\r\n\t\treturn !unstackErrors(this, errorCollector)\r\n\t},\r\n\r\n\ttest(obj) {\r\n\t\tlet model = this;\r\n\t\twhile(!has(model, \"errorCollector\")) {\r\n\t\t\tmodel = getProto(model)\r\n\t\t}\r\n\r\n\t\tlet initialErrorCollector = model.errorCollector,\r\n\t\t failed;\r\n\r\n\t\tmodel.errorCollector = () => {\r\n\t\t\tfailed = true\r\n\t\t}\r\n\r\n\t\tnew this(obj) // may trigger this.errorCollector\r\n\r\n\t\tmodel.errorCollector = initialErrorCollector\r\n\t\treturn !failed\r\n\t},\r\n\r\n\terrorCollector(errors) {\r\n\t\tlet e = new TypeError(errors.map(e => e.message).join('\\n'))\r\n\t\te.stack = e.stack.replace(/\\n.*object-model(.|\\n)*object-model.*/, \"\") // blackbox objectmodel in stacktrace\r\n\t\tthrow e\r\n\t},\r\n\r\n\tassert(assertion, description = format(assertion)) {\r\n\t\tdefine(assertion, \"description\", description)\r\n\t\tthis.assertions = this.assertions.concat(assertion)\r\n\t\treturn this\r\n\t}\r\n})\r\n\r\n\r\nexport function BasicModel(def) {\r\n\tlet model = function (val = model.default) {\r\n\t\treturn model.validate(val) ? val : undefined\r\n\t}\r\n\r\n\tsetConstructor(model, BasicModel)\r\n\tinitModel(model, def)\r\n\treturn model\r\n}\r\n\r\nextend(BasicModel, Model, {\r\n\textend(...newParts) {\r\n\t\tlet child = extendModel(new BasicModel(extendDefinition(this.definition, newParts)), this)\r\n\t\tfor (let part of newParts) {\r\n\t\t\tif (is(BasicModel, part)) child.assertions.push(...part.assertions)\r\n\t\t}\r\n\r\n\t\treturn child\r\n\t}\r\n})\r\n\r\n\r\nexport function ObjectModel(def, params) {\r\n\tlet model = function (obj = model.default) {\r\n\t\tif (!is(model, this)) return new model(obj)\r\n\t\tif (is(model, obj)) return obj\r\n\r\n\t\tif (!is(Object, obj) && obj !== undefined) {\r\n\t\t\tstackError(model.errors, Object, obj);\r\n\t\t}\r\n\r\n\t\tmerge(this, model[_constructor](obj), true)\r\n\r\n\t\tif (!model.validate(this)) return\r\n\t\treturn getProxy(model, this, model.definition)\r\n\t}\r\n\r\n\tObject.assign(model, params)\r\n\textend(model, Object)\r\n\tsetConstructor(model, ObjectModel)\r\n\tinitModel(model, def)\r\n\treturn model\r\n}\r\n\r\nextend(ObjectModel, Model, {\r\n\tsealed: false,\r\n\r\n\tdefaults(p) {\r\n\t\tObject.assign(this.prototype, p)\r\n\t\treturn this\r\n\t},\r\n\r\n\ttoString(stack) {\r\n\t\treturn format(this.definition, stack)\r\n\t},\r\n\r\n\textend(...newParts) {\r\n\t\tlet def = Object.assign({}, this.definition),\r\n\t\t newAssertions = [],\r\n\t\t proto = {}\r\n\r\n\t\tmerge(proto, this.prototype, false)\r\n\r\n\t\tfor (let part of newParts) {\r\n\t\t\tif (is(Model, part)) {\r\n\t\t\t\tmerge(def, part.definition, true)\r\n\t\t\t\tnewAssertions.push(...part.assertions)\r\n\t\t\t}\r\n\t\t\tif (isFunction(part)) merge(proto, part.prototype, true)\r\n\t\t\tif (isObject(part)) merge(def, part, true)\r\n\t\t}\r\n\r\n\t\tlet submodel = extendModel(new ObjectModel(def), this, proto)\r\n\t\tsubmodel.assertions = [...this.assertions, ...newAssertions]\r\n\r\n\t\tif (getProto(this) !== ObjectModel.prototype) { // extended class\r\n\t\t\tsubmodel[_constructor] = (obj) => {\r\n\t\t\t\tlet parentInstance = new this(obj)\r\n\t\t\t\tmerge(obj, parentInstance, true) // get modified props from parent class constructor\r\n\t\t\t\treturn obj\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn submodel\r\n\t},\r\n\r\n\t[_constructor]: o => o,\r\n\r\n\t[_validate](obj, path, errors, stack) {\r\n\t\tif (isObject(obj)) {\r\n\t\t\tlet def = this.definition\r\n\t\t\tcheckDefinition(obj, def, path, errors, stack)\r\n\t\t\tif (this.sealed) checkUndeclaredProps(obj, def, errors)\r\n\t\t}\r\n\t\telse stackError(errors, this, obj, path)\r\n\r\n\t\tcheckAssertions(obj, this, path, errors)\r\n\t}\r\n})","import {_original, _validate, cast, checkAssertions, checkDefinition, extendDefinition, extendModel, formatDefinition, initModel, Model, stackError, unstackErrors} from \"./object-model.js\"\r\nimport {extend, isFunction, proxifyFn, proxifyModel, setConstructor} from \"./helpers.js\"\r\n\r\nlet ARRAY_MUTATORS = [\"pop\", \"push\", \"reverse\", \"shift\", \"sort\", \"splice\", \"unshift\"]\r\n\r\nexport default function ArrayModel(def) {\r\n\r\n\tlet model = function (array = model.default) {\r\n\t\tif (model.validate(array)) return proxifyModel(array, model, {\r\n\t\t\tget(arr, key) {\r\n\t\t\t\tif (key === _original) return arr\r\n\r\n\t\t\t\tlet val = arr[key];\r\n\t\t\t\treturn isFunction(val) ? proxifyFn(val, (fn, ctx, args) => {\r\n\t\t\t\t\tif (ARRAY_MUTATORS.includes(key)) {\r\n\t\t\t\t\t\tlet testArray = arr.slice()\r\n\t\t\t\t\t\tfn.apply(testArray, args)\r\n\t\t\t\t\t\tmodel.validate(testArray)\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tlet returnValue = fn.apply(arr, args)\r\n\t\t\t\t\tarray.forEach((a, i) => arr[i] = cast(a, model.definition))\r\n\t\t\t\t\treturn returnValue\r\n\t\t\t\t}) : val\r\n\t\t\t},\r\n\r\n\t\t\tset(arr, key, val) {\r\n\t\t\t\treturn setArrayKey(arr, key, val, model)\r\n\t\t\t},\r\n\r\n\t\t\tdeleteProperty(arr, key) {\r\n\t\t\t\treturn !(key in arr) || setArrayKey(arr, key, undefined, model)\r\n\t\t\t}\r\n\t\t})\r\n\t}\r\n\r\n\textend(model, Array)\r\n\tsetConstructor(model, ArrayModel)\r\n\tinitModel(model, def)\r\n\treturn model\r\n}\r\n\r\nextend(ArrayModel, Model, {\r\n\ttoString(stack) {\r\n\t\treturn 'Array of ' + formatDefinition(this.definition, stack)\r\n\t},\r\n\r\n\t[_validate](arr, path, errors, stack) {\r\n\t\tif (Array.isArray(arr))\r\n\t\t\tarr.forEach((a, i) => {\r\n\t\t\t\tarr[i] = checkDefinition(a, this.definition, `${path || \"Array\"}[${i}]`, errors, stack)\r\n\t\t\t})\r\n\t\telse stackError(errors, this, arr, path)\r\n\r\n\t\tcheckAssertions(arr, this, path, errors)\r\n\t},\r\n\r\n\textend(...newParts) {\r\n\t\treturn extendModel(new ArrayModel(extendDefinition(this.definition, newParts)), this)\r\n\t}\r\n})\r\n\r\nlet setArrayKey = (array, key, value, model) => {\r\n\tlet path = `Array[${key}]`;\r\n\tif (parseInt(key) === +key && key >= 0)\r\n\t\tvalue = checkDefinition(value, model.definition, path, model.errors, [])\r\n\r\n\tlet testArray = array.slice()\r\n\ttestArray[key] = value\r\n\tcheckAssertions(testArray, model, path)\r\n\tlet isSuccess = !unstackErrors(model)\r\n\tif (isSuccess) array[key] = value\r\n\treturn isSuccess\r\n}","import {_original, _validate, cast, checkAssertions, checkDefinition, extendDefinition, extendModel, formatDefinition, initModel, Model, stackError} from \"./object-model.js\"\r\nimport {extend, is, isFunction, proxifyFn, proxifyModel, setConstructor} from \"./helpers.js\"\r\n\r\nlet SET_MUTATORS = [\"add\", \"delete\", \"clear\"]\r\n\r\nexport default function SetModel(def) {\r\n\r\n\tlet model = function (iterable = model.default) {\r\n\t\tlet castValue = val => cast(val, model.definition),\r\n\t\t set = new Set([...iterable].map(castValue))\r\n\r\n\t\tif (!model.validate(set)) return\r\n\r\n\t\treturn proxifyModel(set, model, {\r\n\t\t\tget(set, key) {\r\n\t\t\t\tif (key === _original) return set\r\n\r\n\t\t\t\tlet val = set[key]\r\n\t\t\t\treturn isFunction(val) ? proxifyFn(val, (fn, ctx, args) => {\r\n\t\t\t\t\tif (key === \"add\") {\r\n\t\t\t\t\t\targs[0] = castValue(args[0])\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (SET_MUTATORS.includes(key)) {\r\n\t\t\t\t\t\tlet testSet = new Set(set)\r\n\t\t\t\t\t\tfn.apply(testSet, args)\r\n\t\t\t\t\t\tmodel.validate(testSet)\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\treturn fn.apply(set, args)\r\n\t\t\t\t}) : val\r\n\t\t\t}\r\n\t\t})\r\n\t}\r\n\r\n\textend(model, Set)\r\n\tsetConstructor(model, SetModel)\r\n\tinitModel(model, def)\r\n\treturn model\r\n}\r\n\r\nextend(SetModel, Model, {\r\n\ttoString(stack) {\r\n\t\treturn \"Set of \" + formatDefinition(this.definition, stack)\r\n\t},\r\n\r\n\t[_validate](set, path, errors, stack) {\r\n\t\tif (is(Set, set)) {\r\n\t\t\tfor (let item of set.values()) {\r\n\t\t\t\tcheckDefinition(item, this.definition, `${path || \"Set\"} value`, errors, stack)\r\n\t\t\t}\r\n\t\t} else stackError(errors, this, set, path)\r\n\t\tcheckAssertions(set, this, path, errors)\r\n\t},\r\n\r\n\textend(...newParts) {\r\n\t\treturn extendModel(new SetModel(extendDefinition(this.definition, newParts)), this)\r\n\t}\r\n})","import {_original, _validate, cast, checkAssertions, checkDefinition, extendDefinition, extendModel, format, formatDefinition, initModel, Model, stackError} from \"./object-model.js\";\r\nimport {extend, is, isFunction, proxifyFn, proxifyModel, setConstructor} from \"./helpers.js\"\r\n\r\nlet MAP_MUTATORS = [\"set\", \"delete\", \"clear\"]\r\n\r\nexport default function MapModel(key, value) {\r\n\r\n\tlet model = function (iterable = model.default) {\r\n\t\tlet castKeyValue = pair => [\"key\", \"value\"].map((prop, i) => cast(pair[i], model.definition[prop])),\r\n\t\t map = new Map([...iterable].map(castKeyValue))\r\n\r\n\t\tif (!model.validate(map)) return\r\n\r\n\t\treturn proxifyModel(map, model, {\r\n\t\t\tget(map, key) {\r\n\t\t\t\tif (key === _original) return map\r\n\r\n\t\t\t\tlet val = map[key];\r\n\t\t\t\treturn isFunction(val) ? proxifyFn(val, (fn, ctx, args) => {\r\n\t\t\t\t\tif (key === \"set\") {\r\n\t\t\t\t\t\targs = castKeyValue(args)\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (MAP_MUTATORS.includes(key)) {\r\n\t\t\t\t\t\tlet testMap = new Map(map)\r\n\t\t\t\t\t\tfn.apply(testMap, args)\r\n\t\t\t\t\t\tmodel.validate(testMap)\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\treturn fn.apply(map, args)\r\n\t\t\t\t}) : val\r\n\t\t\t}\r\n\t\t})\r\n\t}\r\n\r\n\textend(model, Map)\r\n\tsetConstructor(model, MapModel)\r\n\tinitModel(model, {key, value})\r\n\treturn model\r\n}\r\n\r\nextend(MapModel, Model, {\r\n\ttoString(stack) {\r\n\t\tlet {key, value} = this.definition\r\n\t\treturn `Map of ${formatDefinition(key, stack)} : ${formatDefinition(value, stack)}`\r\n\t},\r\n\r\n\t[_validate](map, path, errors, stack) {\r\n\t\tif (is(Map, map)) {\r\n\t\t\tpath = path || 'Map'\r\n\t\t\tfor (let [key, value] of map) {\r\n\t\t\t\tcheckDefinition(key, this.definition.key, `${path} key`, errors, stack)\r\n\t\t\t\tcheckDefinition(value, this.definition.value, `${path}[${format(key)}]`, errors, stack)\r\n\t\t\t}\r\n\t\t} else stackError(errors, this, map, path)\r\n\r\n\t\tcheckAssertions(map, this, path, errors)\r\n\t},\r\n\r\n\textend(keyPart, valuePart) {\r\n\t\tlet {key, value} = this.definition\r\n\t\treturn extendModel(new MapModel(extendDefinition(key, keyPart), extendDefinition(value, valuePart)), this)\r\n\t}\r\n})","import {_original, _validate, checkAssertions, checkDefinition, extendDefinition, extendModel, format, formatDefinition, initModel, Model, stackError, unstackErrors} from \"./object-model.js\"\r\nimport {extend, isFunction, proxifyModel, setConstructor} from \"./helpers.js\"\r\n\r\n\r\nexport default function FunctionModel(...argsDef) {\r\n\r\n\tlet model = function (fn = model.default) {\r\n\t\tif (!model.validate(fn)) return\r\n\t\treturn proxifyModel(fn, model, {\r\n\t\t\tget(fn, key) {\r\n\t\t\t\tif (key === _original) return fn\r\n\t\t\t\treturn fn[key]\r\n\t\t\t},\r\n\r\n\t\t\tapply (fn, ctx, args) {\r\n\t\t\t\tlet def = model.definition\r\n\r\n\t\t\t\tdef.arguments.forEach((argDef, i) => {\r\n\t\t\t\t\targs[i] = checkDefinition(args[i], argDef, `arguments[${i}]`, model.errors, [])\r\n\t\t\t\t})\r\n\r\n\t\t\t\tcheckAssertions(args, model, \"arguments\")\r\n\r\n\t\t\t\tlet result\r\n\t\t\t\tif (!model.errors.length) {\r\n\t\t\t\t\tresult = Reflect.apply(fn, ctx, args)\r\n\t\t\t\t\tif (\"return\" in def)\r\n\t\t\t\t\t\tresult = checkDefinition(result, def.return, \"return value\", model.errors, [])\r\n\t\t\t\t}\r\n\t\t\t\tunstackErrors(model)\r\n\t\t\t\treturn result\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\r\n\textend(model, Function)\r\n\tsetConstructor(model, FunctionModel)\r\n\tinitModel(model, {arguments: argsDef})\r\n\r\n\treturn model\r\n}\r\n\r\nextend(FunctionModel, Model, {\r\n\ttoString(stack = []) {\r\n\t\tlet out = `Function(${this.definition.arguments.map(\r\n\t\t\targDef => formatDefinition(argDef, stack.slice())\r\n\t\t).join(\", \")})`\r\n\r\n\t\tif (\"return\" in this.definition) {\r\n\t\t\tout += \" => \" + formatDefinition(this.definition.return, stack)\r\n\t\t}\r\n\t\treturn out\r\n\t},\r\n\r\n\treturn(def) {\r\n\t\tthis.definition.return = def\r\n\t\treturn this\r\n\t},\r\n\r\n\textend(newArgs, newReturns) {\r\n\t\tlet args = this.definition.arguments,\r\n\t\t mixedArgs = newArgs.map((a, i) => extendDefinition(i in args ? args[i] : [], newArgs[i])),\r\n\t\t mixedReturns = extendDefinition(this.definition.return, newReturns)\r\n\t\treturn extendModel(new FunctionModel(...mixedArgs).return(mixedReturns), this)\r\n\t},\r\n\r\n\t[_validate](f, path, errors) {\r\n\t\tif (!isFunction(f)) stackError(errors, \"Function\", f, path)\r\n\t}\r\n})\r\n\r\nFunctionModel.prototype.assert(function numberOfArgs(args) {\r\n\treturn (args.length > this.definition.arguments.length) ? args : true\r\n}, function (args) {\r\n\treturn `expecting ${this.definition.arguments.length} arguments for ${format(this)}, got ${args.length}`\r\n})","import {Model, BasicModel, ObjectModel, _original} from \"./object-model.js\"\r\nimport ArrayModel from \"./array-model.js\"\r\nimport SetModel from \"./set-model.js\"\r\nimport MapModel from \"./map-model.js\"\r\nimport FunctionModel from \"./function-model.js\"\r\nimport {getProto, is, isFunction, isPlainObject} from \"./helpers.js\"\r\n\r\nconst styles = {\r\n\tlist: `list-style-type: none; padding: 0; margin: 0;`,\r\n\tlistItem: `padding: 0 0 0 1em;`,\r\n\tmodel: `color: #3e999f;`,\r\n\tsealedModel: `color: #3e999f; font-weight: bold`,\r\n\tinstance: `color: #718c00; font-style: italic`,\r\n\tfunction: `color: #4271AE`,\r\n\tstring: `color: #C41A16`,\r\n\tnumber: `color: #1C00CF`,\r\n\tboolean: `color: #AA0D91`,\r\n\tproperty: `color: #8959a8`,\r\n\tprivate: `color: #C19ED8`,\r\n\tconstant: `color: #8959a8; font-weight: bold`,\r\n\tprivateConstant: `color: #C19ED8; font-weight: bold`,\r\n\tnull: `color: #8e908c`,\r\n\tundeclared: `color: #C0C0C0;`,\r\n\tproto: `color: #B871BD; font-style: italic`\r\n};\r\n\r\nconst getModel = (instance) => {\r\n\tif (instance === undefined || instance === null)\r\n\t\treturn null\r\n\r\n\tlet proto = getProto(instance);\r\n\tif (!proto || !proto.constructor || !is(Model, proto.constructor))\r\n\t\treturn null\r\n\r\n\treturn proto.constructor\r\n}\r\n\r\nconst span = (style, ...children) => [\"span\", {style}, ...children]\r\n\r\nconst format = (x, config={}) => {\r\n\tif (x === null || x === undefined)\r\n\t\treturn span(styles.null, \"\"+x);\r\n\r\n\tif (typeof x === \"boolean\")\r\n\t\treturn span(styles.boolean, x);\r\n\r\n\tif (typeof x === \"number\")\r\n\t\treturn span(styles.number, x);\r\n\r\n\tif (typeof x === \"string\")\r\n\t\treturn span(styles.string, `\"${x}\"`);\r\n\r\n\tif (Array.isArray(x) && config.isModelDefinition) {\r\n\t\tlet def = [];\r\n\t\tif (x.length === 1) x.push(undefined, null);\r\n\t\tfor (let i = 0; i < x.length; i++) {\r\n\t\t\tdef.push(format(x[i], config))\r\n\t\t\tif (i < x.length - 1) def.push(' or ')\r\n\t\t}\r\n\t\treturn span('', ...def)\r\n\t}\r\n\r\n\tif (isPlainObject(x))\r\n\t\treturn formatObject(x, getModel(x), config)\r\n\r\n\tif (isFunction(x) && !is(Model, x) && config.isModelDefinition)\r\n\t\treturn span(styles.function, x.name || x.toString());\r\n\r\n\treturn ['object', {object: x, config}]\r\n}\r\n\r\nconst formatObject = (o, model, config) => span('',\r\n\t'{',\r\n\t['ol', {style: styles.list}, ...Object.keys(o).map(prop =>\r\n\t\t['li', {style: styles.listItem}, span(styles.property, prop), ': ', format(o[prop], config) ])\r\n\t],\r\n\t'}'\r\n)\r\n\r\nconst formatModel = model => {\r\n\tconst parts = [],\r\n\t cfg = { isModelDefinition: true },\r\n\t def = model.definition,\r\n\t formatList = (list, map) => list.reduce((r, e) => [...r, map(e), \", \"], []).slice(0, 2 * list.length - 1);\r\n\r\n\tif (is(BasicModel, model )) parts.push(format(def, cfg))\r\n\tif (is(ArrayModel, model)) parts.push(\"Array of \", format(def, cfg))\r\n\tif (is(SetModel, model)) parts.push(\"Set of \", format(def, cfg))\r\n\tif (is(MapModel, model)) parts.push(\"Map of \", format(def.key, cfg), \" : \", format(def.value, cfg))\r\n\tif (is(FunctionModel, model)) {\r\n\t\tparts.push(\"Function(\", ...formatList(def.arguments, arg => format(arg, cfg)), \")\")\r\n\t\tif (\"return\" in def) parts.push(\" => \", format(def.return, cfg))\r\n\t}\r\n\r\n\tif (model.assertions.length > 0) {\r\n\t\tparts.push(\"\\n(assertions: \", ...formatList(model.assertions, f => ['object', { object: f }]), \")\")\r\n\t}\r\n\r\n\treturn span(styles.model, ...parts)\r\n}\r\n\r\nconst ModelFormatter = {\r\n\theader(x, config = {}) {\r\n\t\tif (is(ObjectModel, x))\r\n\t\t\treturn span(x.sealed ? styles.sealedModel : styles.model, x.name)\r\n\r\n\t\tif (is(Model, x)) {\r\n\t\t\treturn formatModel(x)\r\n\t\t}\r\n\r\n\t\tif (config.isModelDefinition && isPlainObject(x))\r\n\t\t\treturn format(x, config)\r\n\r\n\t\treturn null;\r\n\t},\r\n\thasBody(x) {\r\n\t\treturn is(ObjectModel, x)\r\n\t},\r\n\tbody(model) {\r\n\t\treturn span('',\r\n\t\t\t'{',\r\n\t\t\t['ol', {style: styles.list}, ...Object.keys(model.definition).map(prop => {\r\n\t\t\t\tlet isPrivate = model.conventionForPrivate(prop),\r\n\t\t\t\t isConstant = model.conventionForConstant(prop),\r\n\t\t\t\t hasDefault = model.prototype.hasOwnProperty(prop),\r\n\t\t\t\t style = styles.property;\r\n\r\n\t\t\t\tif (isPrivate) {\r\n\t\t\t\t\tstyle = isConstant ? styles.privateConstant : styles.private\r\n\t\t\t\t} else if (isConstant) {\r\n\t\t\t\t\tstyle = styles.constant\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn ['li', {style: styles.listItem},\r\n\t\t\t\t\tspan(style, prop), ': ', format(model.definition[prop], { isModelDefinition: true }),\r\n\t\t\t\t\thasDefault ? span(styles.proto, ' = ', format(model.prototype[prop])) : ''\r\n\t\t\t\t]\r\n\t\t\t}) ],\r\n\t\t\t'}'\r\n\t\t)\r\n\t}\r\n}\r\n\r\nconst ModelInstanceFormatter = {\r\n\theader(x, config = {}) {\r\n\t\tif (config.isInstanceProperty && isPlainObject(x)) {\r\n\t\t\treturn format(x, config)\r\n\t\t}\r\n\r\n\t\tlet model = getModel(x);\r\n\t\tif (is(Model, model)) {\r\n\t\t\tlet parts = is(ObjectModel, model) ? [model.name] : [['object', { object: x[_original] }], ` (${model.name})`];\r\n\t\t\treturn span(styles.instance, ...parts)\r\n\t\t}\r\n\r\n\t\treturn null;\r\n\t},\r\n\thasBody(x) {\r\n\t\treturn x && is(ObjectModel, getModel(x))\r\n\t},\r\n\tbody(x) {\r\n\t\tconst model = getModel(x)\r\n\t\tconst o = x[_original] || x;\r\n\t\treturn span('',\r\n\t\t\t'{',\r\n\t\t\t[\r\n\t\t\t\t'ol',\r\n\t\t\t\t{style: styles.list},\r\n\t\t\t\t...Object.keys(o).map(prop => {\r\n\t\t\t\t\tlet isPrivate = model.conventionForPrivate(prop),\r\n\t\t\t\t\t\tisConstant = model.conventionForConstant(prop),\r\n\t\t\t\t\t\tisDeclared = prop in model.definition,\r\n\t\t\t\t\t\tstyle = styles.property;\r\n\r\n\t\t\t\t\tif (!isDeclared) {\r\n\t\t\t\t\t\tstyle = styles.undeclared\r\n\t\t\t\t\t} else if (isPrivate) {\r\n\t\t\t\t\t\tstyle = isConstant ? styles.privateConstant : styles.private\r\n\t\t\t\t\t} else if (isConstant) {\r\n\t\t\t\t\t\tstyle = styles.constant\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\treturn ['li', {style: styles.listItem},\r\n\t\t\t\t\t\tspan(style, prop), ': ', format(o[prop], { isInstanceProperty: true })\r\n\t\t\t\t\t]\r\n\t\t\t\t}),\r\n\t\t\t\t['li', {style: styles.listItem},\r\n\t\t\t\t\tspan(styles.proto, '__proto__', ': ', ['object', {object: getProto(x)}])\r\n\t\t\t\t]\r\n\t\t\t],\r\n\t\t\t'}'\r\n\t\t)\r\n\t}\r\n}\r\n\r\nif (typeof window !== \"undefined\") {\r\n\twindow.devtoolsFormatters = (window.devtoolsFormatters || [])\r\n\t\t.concat(ModelFormatter, ModelInstanceFormatter);\r\n}"],"names":["format"],"mappings":";;;;;;CAAO;CACP,CAAC,YAAY,GAAG,CAAC,IAAI,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;CAChF,CAAC,QAAQ,OAAO,CAAC,IAAI,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC;CAC7C,CAAC,QAAQ,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;;CAEnD,CAAC,GAAG,aAAa,CAAC,CAAC,EAAE,IAAI,KAAK,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC;CACpD,CAAC,EAAE,cAAc,CAAC,WAAW,EAAE,GAAG,KAAK,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AE,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAC7E,KAAK;CACL,IAAI;CACJ,GAAG,GAAG;CACN,GAAG;CACH,EAAE;CACF,EAAC;;CAED,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;CACnC,CAAC,MAAM,CAAC,kBAAkB,GAAG,CAAC,MAAM,CAAC,kBAAkB,IAAI,EAAE;CAC7D,GAAG,MAAM,CAAC,cAAc,EAAE,sBAAsB,CAAC,CAAC;CAClD;;;;;;;;;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"object-model.js","sources":["../src/helpers.js","../src/object-model.js","../src/list-model.js","../src/array-model.js","../src/set-model.js","../src/map-model.js","../src/function-model.js","../src/devtool-formatter.js"],"sourcesContent":["export const\n\tbettertypeof = x => Object.prototype.toString.call(x).match(/\\s([a-zA-Z]+)/)[1],\n\tgetProto = x => Object.getPrototypeOf(x),\n\tsetProto = (x, p) => Object.setPrototypeOf(x, p),\n\n\thas = (o, prop) => o.hasOwnProperty(prop),\n\tis = (Constructor, obj) => obj instanceof Constructor,\n\tisFunction = f => typeof f === \"function\",\n\tisObject = o => typeof o === \"object\",\n\tisPlainObject = o => o && isObject(o) && getProto(o) === Object.prototype,\n\tisIterable = x => x && isFunction(x[Symbol.iterator]),\n\n\tproxifyFn = (fn, apply) => new Proxy(fn, { apply }),\n\tproxifyModel = (val, model, traps) => new Proxy(val, Object.assign({ getPrototypeOf: () => model.prototype }, traps)),\n\n\tmerge = (target, src = {}, deep) => {\n\t\tfor (let key in src) {\n\t\t\tif (deep && isPlainObject(src[key])) {\n\t\t\t\tlet o = {}\n\t\t\t\tmerge(o, target[key], deep)\n\t\t\t\tmerge(o, src[key], deep)\n\t\t\t\ttarget[key] = o\n\t\t\t} else {\n\t\t\t\ttarget[key] = src[key]\n\t\t\t}\n\t\t}\n\t},\n\n\tdefine = (obj, key, value, enumerable = false) => {\n\t\tObject.defineProperty(obj, key, { value, enumerable, writable: true, configurable: true })\n\t},\n\n\tsetConstructor = (model, constructor) => {\n\t\tsetProto(model, constructor.prototype)\n\t\tdefine(model, \"constructor\", constructor)\n\t},\n\n\textend = (child, parent, props) => {\n\t\tchild.prototype = Object.assign(Object.create(parent.prototype, {\n\t\t\tconstructor: {\n\t\t\t\tvalue: child,\n\t\t\t\twritable: true,\n\t\t\t\tconfigurable: true\n\t\t\t}\n\t\t}), props)\n\t\tsetProto(child, parent)\n\t}","import {\n\tbettertypeof, define, extend, getProto, has, is, isFunction, isObject, isPlainObject,\n\tmerge, proxifyFn, setConstructor\n} from \"./helpers.js\"\n\nexport const\n\t_constructor = Symbol(),\n\t_validate = Symbol(),\n\t_original = Symbol(),\n\t_get = Symbol(), // used to bypass private access\n\n\tinitModel = (model, def) => {\n\t\tmodel.definition = def\n\t\tmodel.assertions = [...model.assertions]\n\t\tdefine(model, \"errors\", [])\n\t\tdelete model.name;\n\t},\n\n\textendModel = (child, parent, newProps) => {\n\t\textend(child, parent, newProps)\n\t\tchild.assertions.push(...parent.assertions)\n\t\treturn child\n\t},\n\n\tstackError = (errors, expected, received, path, message) => {\n\t\terrors.push({ expected, received, path, message })\n\t},\n\n\tunstackErrors = (model, errorCollector = model.errorCollector) => {\n\t\tlet nbErrors = model.errors.length\n\t\tif (nbErrors > 0) {\n\t\t\tlet errors = model.errors.map(err => {\n\t\t\t\tif (!err.message) {\n\t\t\t\t\tlet def = Array.isArray(err.expected) ? err.expected : [err.expected]\n\t\t\t\t\terr.message = \"expecting \" + (err.path ? err.path + \" to be \" : \"\") + def.map(d => format(d)).join(\" or \")\n\t\t\t\t\t\t+ \", got \" + (err.received != null ? bettertypeof(err.received) + \" \" : \"\") + format(err.received)\n\t\t\t\t}\n\t\t\t\treturn err\n\t\t\t})\n\t\t\tmodel.errors = []\n\t\t\terrorCollector.call(model, errors) // throw all errors collected\n\t\t}\n\t\treturn nbErrors\n\t},\n\n\tisModelInstance = i => i && is(Model, getProto(i).constructor),\n\n\tparseDefinition = (def) => {\n\t\tif (isPlainObject(def)) {\n\t\t\tObject.keys(def).map(key => { def[key] = parseDefinition(def[key]) })\n\t\t}\n\t\telse if (!Array.isArray(def)) return [def]\n\t\telse if (def.length === 1) return [...def, undefined, null]\n\n\t\treturn def\n\t},\n\n\tformatDefinition = (def, stack) => {\n\t\tlet parts = parseDefinition(def).map(d => format(d, stack));\n\t\treturn parts.length > 1 ? `(${parts.join(\" or \")})` : parts[0]\n\t},\n\n\textendDefinition = (def, newParts = []) => {\n\t\tif (!Array.isArray(newParts)) newParts = [newParts]\n\t\tif (newParts.length > 0) {\n\t\t\tdef = newParts\n\t\t\t\t.reduce((def, ext) => def.concat(ext), Array.isArray(def) ? [...def] : [def]) // clone to lose ref\n\t\t\t\t.filter((value, index, self) => self.indexOf(value) === index) // remove duplicates\n\t\t}\n\n\t\treturn def\n\t},\n\n\tcheckDefinition = (obj, def, path, errors, stack) => {\n\t\tlet indexFound = stack.indexOf(def)\n\t\tif (indexFound !== -1 && stack.indexOf(def, indexFound + 1) !== -1)\n\t\t\treturn obj //if found twice in call stack, cycle detected, skip validation\n\n\t\tobj = cast(obj, def)\n\n\t\tif (is(Model, def)) {\n\t\t\tdef[_validate](obj, path, errors, stack.concat(def))\n\t\t}\n\t\telse if (isPlainObject(def)) {\n\t\t\tObject.keys(def).map(key => {\n\t\t\t\tlet val = obj ? obj[_get] ? obj[_get](key) : obj[key] : undefined;\n\t\t\t\tcheckDefinition(val, def[key], formatPath(path, key), errors, stack)\n\t\t\t})\n\t\t}\n\t\telse {\n\t\t\tlet pdef = parseDefinition(def)\n\t\t\tif (pdef.some(part => checkDefinitionPart(obj, part, path, stack)))\n\t\t\t\treturn obj\n\n\t\t\tstackError(errors, def, obj, path)\n\t\t}\n\n\t\treturn obj\n\t},\n\n\tcheckDefinitionPart = (obj, def, path, stack) => {\n\t\tif (obj == null) return obj === def\n\t\tif (isPlainObject(def) || is(Model, def)) { // object or model as part of union type\n\t\t\tlet errors = []\n\t\t\tcheckDefinition(obj, def, path, errors, stack)\n\t\t\treturn !errors.length\n\t\t}\n\t\tif (is(RegExp, def)) return def.test(obj)\n\t\tif (def === Number || def === Date) return obj.constructor === def && !isNaN(obj)\n\t\treturn obj === def\n\t\t\t|| (isFunction(def) && is(def, obj))\n\t\t\t|| obj.constructor === def\n\t},\n\n\tcheckAssertions = (obj, model, path, errors = model.errors) => {\n\t\tfor (let assertion of model.assertions) {\n\t\t\tlet result\n\t\t\ttry {\n\t\t\t\tresult = assertion.call(model, obj)\n\t\t\t} catch (err) {\n\t\t\t\tresult = err\n\t\t\t}\n\t\t\tif (result !== true) {\n\t\t\t\tlet onFail = isFunction(assertion.description) ? assertion.description : (assertionResult, value) =>\n\t\t\t\t\t`assertion \"${assertion.description}\" returned ${format(assertionResult)} `\n\t\t\t\t\t+ `for ${path ? path + \" =\" : \"value\"} ${format(value)}`\n\t\t\t\tstackError(errors, assertion, obj, path, onFail.call(model, result, obj, path))\n\t\t\t}\n\t\t}\n\t},\n\n\tformat = (obj, stack = []) => {\n\t\tif (stack.length > 15 || stack.includes(obj)) return '...'\n\t\tif (obj === null || obj === undefined) return String(obj)\n\t\tif (typeof obj === 'string') return `\"${obj}\"`\n\t\tif (is(Model, obj)) return obj.toString(stack)\n\n\t\tstack.unshift(obj)\n\n\t\tif (isFunction(obj)) return obj.name || obj.toString()\n\t\tif (is(Map, obj) || is(Set, obj)) return format([...obj])\n\t\tif (Array.isArray(obj)) return `[${obj.map(item => format(item, stack)).join(', ')}]`\n\t\tif (obj.toString !== Object.prototype.toString) return obj.toString()\n\t\tif (obj && isObject(obj)) {\n\t\t\tlet props = Object.keys(obj),\n\t\t\t\tindent = '\\t'.repeat(stack.length)\n\t\t\treturn `{${props.map(\n\t\t\t\tkey => `\\n${indent + key}: ${format(obj[key], [...stack])}`\n\t\t\t).join(',')} ${props.length ? `\\n${indent.slice(1)}` : ''}}`\n\t\t}\n\n\t\treturn String(obj)\n\t},\n\n\tformatPath = (path, key) => path ? path + '.' + key : key,\n\n\tcontrolMutation = (model, def, path, o, key, privateAccess, applyMutation) => {\n\t\tlet newPath = formatPath(path, key),\n\t\t\tisPrivate = model.conventionForPrivate(key),\n\t\t\tisConstant = model.conventionForConstant(key),\n\t\t\tisOwnProperty = has(o, key),\n\t\t\tinitialPropDescriptor = isOwnProperty && Object.getOwnPropertyDescriptor(o, key)\n\n\t\tif (key in def && ((isPrivate && !privateAccess) || (isConstant && o[key] !== undefined)))\n\t\t\tcannot(`modify ${isPrivate ? \"private\" : \"constant\"} property ${key}`, model)\n\n\t\tlet isInDefinition = has(def, key);\n\t\tif (isInDefinition || !model.sealed) {\n\t\t\tapplyMutation(newPath)\n\t\t\tif (isInDefinition) checkDefinition(o[key], def[key], newPath, model.errors, [])\n\t\t\tcheckAssertions(o, model, newPath)\n\t\t}\n\t\telse rejectUndeclaredProp(newPath, o[key], model.errors)\n\n\t\tlet nbErrors = model.errors.length\n\t\tif (nbErrors) {\n\t\t\tif (isOwnProperty) Object.defineProperty(o, key, initialPropDescriptor)\n\t\t\telse delete o[key] // back to the initial property defined in prototype chain\n\n\t\t\tunstackErrors(model)\n\t\t}\n\n\t\treturn !nbErrors\n\t},\n\n\tcannot = (msg, model) => {\n\t\tmodel.errors.push({ message: \"cannot \" + msg })\n\t},\n\n\trejectUndeclaredProp = (path, received, errors) => {\n\t\terrors.push({\n\t\t\tpath,\n\t\t\treceived,\n\t\t\tmessage: `property ${path} is not declared in the sealed model definition`\n\t\t})\n\t},\n\n\tcast = (obj, defNode = []) => {\n\t\tif (!obj || isPlainObject(defNode) || isModelInstance(obj))\n\t\t\treturn obj // no value or not leaf or already a model instance\n\n\t\tlet def = parseDefinition(defNode),\n\t\t\tsuitableModels = []\n\n\t\tfor (let part of def) {\n\t\t\tif (is(Model, part) && part.test(obj))\n\t\t\t\tsuitableModels.push(part)\n\t\t}\n\n\t\tif (suitableModels.length === 1) {\n\t\t\t// automatically cast to suitable model when explicit (duck typing)\n\t\t\tlet duck = suitableModels[0];\n\t\t\treturn is(ObjectModel, duck) ? new duck(obj) : duck(obj)\n\t\t}\n\n\t\tif (suitableModels.length > 1)\n\t\t\tconsole.warn(`Ambiguous model for value ${format(obj)}, could be ${suitableModels.join(\" or \")}`)\n\n\t\treturn obj\n\t},\n\n\tcheckUndeclaredProps = (obj, def, errors, path) => {\n\t\tObject.keys(obj).map(key => {\n\t\t\tlet val = obj[key],\n\t\t\t\tsubpath = formatPath(path, key)\n\t\t\tif (!has(def, key)) rejectUndeclaredProp(subpath, val, errors)\n\t\t\telse if (isPlainObject(val)) checkUndeclaredProps(val, def[key], errors, subpath)\n\t\t})\n\t},\n\n\tgetProxy = (model, obj, def, path, privateAccess) => {\n\t\tif (!isPlainObject(def)) return cast(obj, def)\n\n\t\tconst grantTemporaryPrivateAccess = f => proxifyFn(f, (fn, ctx, args) => {\n\t\t\tprivateAccess = true;\n\t\t\tlet result = Reflect.apply(fn, ctx, args);\n\t\t\tprivateAccess = false;\n\t\t\treturn result\n\t\t})\n\n\t\treturn new Proxy(obj, {\n\n\t\t\tgetPrototypeOf: () => path ? Object.prototype : getProto(obj),\n\n\t\t\tget(o, key) {\n\t\t\t\tif (key === _original) return o\n\t\t\t\tif (key === _get) return grantTemporaryPrivateAccess(prop => o[prop])\n\n\t\t\t\tif (typeof key !== \"string\") return Reflect.get(o, key)\n\n\t\t\t\tlet newPath = formatPath(path, key),\n\t\t\t\t\tdefPart = def[key];\n\n\t\t\t\tif (!privateAccess && key in def && model.conventionForPrivate(key)) {\n\t\t\t\t\tcannot(`access to private property ${newPath}`, model)\n\t\t\t\t\tunstackErrors(model)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif (o[key] && has(o, key) && !isPlainObject(defPart) && !isModelInstance(o[key])) {\n\t\t\t\t\to[key] = cast(o[key], defPart) // cast nested models\n\t\t\t\t}\n\n\t\t\t\tif (isFunction(o[key]) && key !== \"constructor\") {\n\t\t\t\t\treturn grantTemporaryPrivateAccess(o[key])\n\t\t\t\t}\n\n\t\t\t\tif (isPlainObject(defPart) && !o[key]) {\n\t\t\t\t\to[key] = {} // null-safe traversal\n\t\t\t\t}\n\n\t\t\t\treturn getProxy(model, o[key], defPart, newPath, privateAccess)\n\t\t\t},\n\n\t\t\tset(o, key, val) {\n\t\t\t\treturn controlMutation(model, def, path, o, key, privateAccess,\n\t\t\t\t\tnewPath => Reflect.set(o, key, getProxy(model, val, def[key], newPath))\n\t\t\t\t)\n\t\t\t},\n\n\t\t\tdeleteProperty(o, key) {\n\t\t\t\treturn controlMutation(model, def, path, o, key, privateAccess, () => Reflect.deleteProperty(o, key))\n\t\t\t},\n\n\t\t\tdefineProperty(o, key, args) {\n\t\t\t\treturn controlMutation(model, def, path, o, key, privateAccess, () => Reflect.defineProperty(o, key, args))\n\t\t\t},\n\n\t\t\thas(o, key) {\n\t\t\t\treturn Reflect.has(o, key) && Reflect.has(def, key) && !model.conventionForPrivate(key)\n\t\t\t},\n\n\t\t\townKeys(o) {\n\t\t\t\treturn Reflect.ownKeys(o).filter(key => Reflect.has(def, key) && !model.conventionForPrivate(key))\n\t\t\t},\n\n\t\t\tgetOwnPropertyDescriptor(o, key) {\n\t\t\t\tlet descriptor;\n\t\t\t\tif (!model.conventionForPrivate(key)) {\n\t\t\t\t\tdescriptor = Object.getOwnPropertyDescriptor(def, key);\n\t\t\t\t\tif (descriptor !== undefined) descriptor.value = o[key];\n\t\t\t\t}\n\n\t\t\t\treturn descriptor\n\t\t\t}\n\t\t})\n\t}\n\n\nexport function Model(def, params) {\n\treturn isPlainObject(def) ? new ObjectModel(def, params) : new BasicModel(def)\n}\n\nObject.assign(Model.prototype, {\n\tname: \"Model\",\n\tassertions: [],\n\n\tconventionForConstant: key => key.toUpperCase() === key,\n\tconventionForPrivate: key => key[0] === \"_\",\n\n\ttoString(stack) {\n\t\treturn formatDefinition(this.definition, stack)\n\t},\n\n\tas(name) {\n\t\tdefine(this, \"name\", name);\n\t\treturn this\n\t},\n\n\tdefaultTo(val) {\n\t\tthis.default = val\n\t\treturn this\n\t},\n\n\t[_validate](obj, path, errors, stack) {\n\t\tcheckDefinition(obj, this.definition, path, errors, stack)\n\t\tcheckAssertions(obj, this, path, errors)\n\t},\n\n\tvalidate(obj, errorCollector) {\n\t\tthis[_validate](obj, null, this.errors, [])\n\t\treturn !unstackErrors(this, errorCollector)\n\t},\n\n\ttest(obj) {\n\t\tlet model = this;\n\t\twhile (!has(model, \"errorCollector\")) {\n\t\t\tmodel = getProto(model)\n\t\t}\n\n\t\tlet initialErrorCollector = model.errorCollector,\n\t\t\tfailed;\n\n\t\tmodel.errorCollector = () => {\n\t\t\tfailed = true\n\t\t}\n\n\t\tnew this(obj) // may trigger this.errorCollector\n\n\t\tmodel.errorCollector = initialErrorCollector\n\t\treturn !failed\n\t},\n\n\terrorCollector(errors) {\n\t\tlet e = new TypeError(errors.map(e => e.message).join('\\n'))\n\t\te.stack = e.stack.replace(/\\n.*object-model(.|\\n)*object-model.*/, \"\") // blackbox objectmodel in stacktrace\n\t\tthrow e\n\t},\n\n\tassert(assertion, description = format(assertion)) {\n\t\tdefine(assertion, \"description\", description)\n\t\tthis.assertions = this.assertions.concat(assertion)\n\t\treturn this\n\t}\n})\n\n\nexport function BasicModel(def) {\n\tlet model = function (val = model.default) {\n\t\treturn model.validate(val) ? val : undefined\n\t}\n\n\tsetConstructor(model, BasicModel)\n\tinitModel(model, def)\n\treturn model\n}\n\nextend(BasicModel, Model, {\n\textend(...newParts) {\n\t\tlet child = extendModel(new BasicModel(extendDefinition(this.definition, newParts)), this)\n\t\tfor (let part of newParts) {\n\t\t\tif (is(BasicModel, part)) child.assertions.push(...part.assertions)\n\t\t}\n\n\t\treturn child\n\t}\n})\n\n\nexport function ObjectModel(def, params) {\n\tlet model = function (obj = model.default) {\n\t\tif (!is(model, this)) return new model(obj)\n\t\tif (is(model, obj)) return obj\n\n\t\tif (!is(Object, obj) && obj !== undefined) {\n\t\t\tstackError(model.errors, Object, obj);\n\t\t}\n\n\t\tmerge(this, model[_constructor](obj), true)\n\n\t\tif (!model.validate(this)) return\n\t\treturn getProxy(model, this, model.definition)\n\t}\n\n\tObject.assign(model, params)\n\textend(model, Object)\n\tsetConstructor(model, ObjectModel)\n\tinitModel(model, def)\n\treturn model\n}\n\nextend(ObjectModel, Model, {\n\tsealed: false,\n\n\tdefaults(p) {\n\t\tObject.assign(this.prototype, p)\n\t\treturn this\n\t},\n\n\ttoString(stack) {\n\t\treturn format(this.definition, stack)\n\t},\n\n\textend(...newParts) {\n\t\tlet def = Object.assign({}, this.definition),\n\t\t\tnewAssertions = [],\n\t\t\tproto = {}\n\n\t\tmerge(proto, this.prototype, false)\n\n\t\tfor (let part of newParts) {\n\t\t\tif (is(Model, part)) {\n\t\t\t\tmerge(def, part.definition, true)\n\t\t\t\tnewAssertions.push(...part.assertions)\n\t\t\t}\n\t\t\tif (isFunction(part)) merge(proto, part.prototype, true)\n\t\t\tif (isObject(part)) merge(def, part, true)\n\t\t}\n\n\t\tlet submodel = extendModel(new ObjectModel(def), this, proto)\n\t\tsubmodel.assertions = [...this.assertions, ...newAssertions]\n\n\t\tif (getProto(this) !== ObjectModel.prototype) { // extended class\n\t\t\tsubmodel[_constructor] = (obj) => {\n\t\t\t\tlet parentInstance = new this(obj)\n\t\t\t\tmerge(obj, parentInstance, true) // get modified props from parent class constructor\n\t\t\t\treturn obj\n\t\t\t}\n\t\t}\n\n\t\treturn submodel\n\t},\n\n\t[_constructor]: o => o,\n\n\t[_validate](obj, path, errors, stack) {\n\t\tif (isObject(obj)) {\n\t\t\tlet def = this.definition\n\t\t\tcheckDefinition(obj, def, path, errors, stack)\n\t\t\tif (this.sealed) checkUndeclaredProps(obj, def, errors)\n\t\t}\n\t\telse stackError(errors, this, obj, path)\n\n\t\tcheckAssertions(obj, this, path, errors)\n\t}\n})","import { _original, initModel } from \"./object-model.js\"\nimport { extend, has, isFunction, proxifyFn, proxifyModel, setConstructor } from \"./helpers.js\"\n\nexport const initListModel = (base, constructor, def, init, clone, mutators, otherTraps = {}) => {\n\n\tlet model = function (list = model.default) {\n\t\tlist = init(list)\n\n\t\tif (model.validate(list)) return proxifyModel(list, model, Object.assign({\n\t\t\tget(l, key) {\n\t\t\t\tif (key === _original) return l\n\n\t\t\t\tlet val = l[key];\n\t\t\t\treturn isFunction(val) ? proxifyFn(val, (fn, ctx, args) => {\n\t\t\t\t\tif (has(mutators, key)) {\n\t\t\t\t\t\tif (mutators[key]) args = mutators[key](args) // autocast method args\n\n\t\t\t\t\t\tlet testingClone = clone(l)\n\t\t\t\t\t\tfn.apply(testingClone, args)\n\t\t\t\t\t\tmodel.validate(testingClone)\n\t\t\t\t\t}\n\n\t\t\t\t\treturn fn.apply(l, args)\n\t\t\t\t}) : val\n\t\t\t}\n\t\t}, otherTraps))\n\t}\n\n\textend(model, base)\n\tsetConstructor(model, constructor)\n\tinitModel(model, def)\n\treturn model\n}","import { _validate, cast, checkAssertions, checkDefinition, extendDefinition, extendModel, formatDefinition, Model, stackError, unstackErrors } from \"./object-model.js\"\nimport { extend } from \"./helpers.js\"\nimport { initListModel } from \"./list-model.js\";\n\nexport default function ArrayModel(def) {\n\tlet castAll = args => args.map(arg => cast(arg, def))\n\n\tlet model = initListModel(\n\t\tArray,\n\t\tArrayModel,\n\t\tdef,\n\t\ta => Array.isArray(a) ? castAll(a) : a,\n\t\ta => [...a],\n\t\t{\n\t\t\t\"copyWithin\": 0,\n\t\t\t\"fill\": ([val, ...rest]) => [cast(val, def), ...rest],\n\t\t\t\"pop\": 0,\n\t\t\t\"push\": castAll,\n\t\t\t\"reverse\": 0,\n\t\t\t\"shift\": 0,\n\t\t\t\"sort\": 0,\n\t\t\t\"splice\": ([start, end, ...vals]) => [start, end, ...castAll(vals)],\n\t\t\t\"unshift\": castAll,\n\t\t},\n\t\t{\n\t\t\tset(arr, key, val) {\n\t\t\t\treturn setArrayKey(arr, key, val, model)\n\t\t\t},\n\n\t\t\tdeleteProperty(arr, key) {\n\t\t\t\treturn !(key in arr) || setArrayKey(arr, key, undefined, model)\n\t\t\t}\n\t\t}\n\t)\n\n\treturn model\n}\n\nextend(ArrayModel, Model, {\n\ttoString(stack) {\n\t\treturn 'Array of ' + formatDefinition(this.definition, stack)\n\t},\n\n\t[_validate](arr, path, errors, stack) {\n\t\tif (Array.isArray(arr))\n\t\t\tarr.forEach((a, i) => {\n\t\t\t\tarr[i] = checkDefinition(a, this.definition, `${path || \"Array\"}[${i}]`, errors, stack)\n\t\t\t})\n\t\telse stackError(errors, this, arr, path)\n\n\t\tcheckAssertions(arr, this, path, errors)\n\t},\n\n\textend(...newParts) {\n\t\treturn extendModel(new ArrayModel(extendDefinition(this.definition, newParts)), this)\n\t}\n})\n\nlet setArrayKey = (array, key, value, model) => {\n\tlet path = `Array[${key}]`;\n\tif (parseInt(key) === +key && key >= 0)\n\t\tvalue = checkDefinition(value, model.definition, path, model.errors, [])\n\n\tlet testArray = [...array]\n\ttestArray[key] = value\n\tcheckAssertions(testArray, model, path)\n\tlet isSuccess = !unstackErrors(model)\n\tif (isSuccess) array[key] = value\n\treturn isSuccess\n}","import { _validate, cast, checkAssertions, checkDefinition, extendDefinition, extendModel, formatDefinition, Model, stackError } from \"./object-model.js\"\nimport { initListModel } from \"./list-model.js\"\nimport { extend, is, isIterable } from \"./helpers.js\"\n\nexport default function SetModel(def) {\n\treturn initListModel(\n\t\tSet,\n\t\tSetModel,\n\t\tdef,\n\t\tit => isIterable(it) ? new Set([...it].map(val => cast(val, def))) : it,\n\t\tset => new Set(set),\n\t\t{\n\t\t\t\"add\": ([val]) => [cast(val, def)],\n\t\t\t\"delete\": 0,\n\t\t\t\"clear\": 0\n\t\t}\n\t)\n}\n\nextend(SetModel, Model, {\n\ttoString(stack) {\n\t\treturn \"Set of \" + formatDefinition(this.definition, stack)\n\t},\n\n\t[_validate](set, path, errors, stack) {\n\t\tif (is(Set, set)) {\n\t\t\tfor (let item of set.values()) {\n\t\t\t\tcheckDefinition(item, this.definition, `${path || \"Set\"} value`, errors, stack)\n\t\t\t}\n\t\t} else stackError(errors, this, set, path)\n\t\tcheckAssertions(set, this, path, errors)\n\t},\n\n\textend(...newParts) {\n\t\treturn extendModel(new SetModel(extendDefinition(this.definition, newParts)), this)\n\t}\n})","import { _validate, cast, checkAssertions, checkDefinition, extendDefinition, extendModel, format, formatDefinition, Model, stackError } from \"./object-model.js\";\nimport { initListModel } from \"./list-model.js\"\nimport { extend, is, isIterable } from \"./helpers.js\"\n\nexport default function MapModel(key, value) {\n\n\tlet castKeyValue = ([k, v]) => [cast(k, key), cast(v, value)]\n\n\treturn initListModel(\n\t\tMap,\n\t\tMapModel,\n\t\t{ key, value },\n\t\tit => isIterable(it) ? new Map([...it].map(castKeyValue)) : it,\n\t\tmap => new Map(map),\n\t\t{\n\t\t\t\"set\": castKeyValue,\n\t\t\t\"delete\": 0,\n\t\t\t\"clear\": 0\n\t\t}\n\t)\n}\n\nextend(MapModel, Model, {\n\ttoString(stack) {\n\t\tlet { key, value } = this.definition\n\t\treturn `Map of ${formatDefinition(key, stack)} : ${formatDefinition(value, stack)}`\n\t},\n\n\t[_validate](map, path, errors, stack) {\n\t\tif (is(Map, map)) {\n\t\t\tpath = path || 'Map'\n\t\t\tfor (let [key, value] of map) {\n\t\t\t\tcheckDefinition(key, this.definition.key, `${path} key`, errors, stack)\n\t\t\t\tcheckDefinition(value, this.definition.value, `${path}[${format(key)}]`, errors, stack)\n\t\t\t}\n\t\t} else stackError(errors, this, map, path)\n\n\t\tcheckAssertions(map, this, path, errors)\n\t},\n\n\textend(keyPart, valuePart) {\n\t\tlet { key, value } = this.definition\n\t\treturn extendModel(new MapModel(extendDefinition(key, keyPart), extendDefinition(value, valuePart)), this)\n\t}\n})","import { _original, _validate, checkAssertions, checkDefinition, extendDefinition, extendModel, format, formatDefinition, initModel, Model, stackError, unstackErrors } from \"./object-model.js\"\nimport { extend, isFunction, proxifyModel, setConstructor } from \"./helpers.js\"\n\n\nexport default function FunctionModel(...argsDef) {\n\n\tlet model = function (fn = model.default) {\n\t\tif (!model.validate(fn)) return\n\t\treturn proxifyModel(fn, model, {\n\t\t\tget(fn, key) {\n\t\t\t\tif (key === _original) return fn\n\t\t\t\treturn fn[key]\n\t\t\t},\n\n\t\t\tapply(fn, ctx, args) {\n\t\t\t\tlet def = model.definition\n\n\t\t\t\tdef.arguments.forEach((argDef, i) => {\n\t\t\t\t\targs[i] = checkDefinition(args[i], argDef, `arguments[${i}]`, model.errors, [])\n\t\t\t\t})\n\n\t\t\t\tcheckAssertions(args, model, \"arguments\")\n\n\t\t\t\tlet result\n\t\t\t\tif (!model.errors.length) {\n\t\t\t\t\tresult = Reflect.apply(fn, ctx, args)\n\t\t\t\t\tif (\"return\" in def)\n\t\t\t\t\t\tresult = checkDefinition(result, def.return, \"return value\", model.errors, [])\n\t\t\t\t}\n\t\t\t\tunstackErrors(model)\n\t\t\t\treturn result\n\t\t\t}\n\t\t});\n\t}\n\n\textend(model, Function)\n\tsetConstructor(model, FunctionModel)\n\tinitModel(model, { arguments: argsDef })\n\n\treturn model\n}\n\nextend(FunctionModel, Model, {\n\ttoString(stack = []) {\n\t\tlet out = `Function(${this.definition.arguments.map(\n\t\t\targDef => formatDefinition(argDef, [...stack])\n\t\t).join(\", \")})`\n\n\t\tif (\"return\" in this.definition) {\n\t\t\tout += \" => \" + formatDefinition(this.definition.return, stack)\n\t\t}\n\t\treturn out\n\t},\n\n\treturn(def) {\n\t\tthis.definition.return = def\n\t\treturn this\n\t},\n\n\textend(newArgs, newReturns) {\n\t\tlet args = this.definition.arguments,\n\t\t\tmixedArgs = newArgs.map((a, i) => extendDefinition(i in args ? args[i] : [], newArgs[i])),\n\t\t\tmixedReturns = extendDefinition(this.definition.return, newReturns)\n\t\treturn extendModel(new FunctionModel(...mixedArgs).return(mixedReturns), this)\n\t},\n\n\t[_validate](f, path, errors) {\n\t\tif (!isFunction(f)) stackError(errors, \"Function\", f, path)\n\t}\n})\n\nFunctionModel.prototype.assert(function numberOfArgs(args) {\n\treturn (args.length > this.definition.arguments.length) ? args : true\n}, function (args) {\n\treturn `expecting ${this.definition.arguments.length} arguments for ${format(this)}, got ${args.length}`\n})","import {Model, BasicModel, ObjectModel, _original} from \"./object-model.js\"\nimport ArrayModel from \"./array-model.js\"\nimport SetModel from \"./set-model.js\"\nimport MapModel from \"./map-model.js\"\nimport FunctionModel from \"./function-model.js\"\nimport {getProto, is, isFunction, isPlainObject} from \"./helpers.js\"\n\nconst styles = {\n\tlist: `list-style-type: none; padding: 0; margin: 0;`,\n\tlistItem: `padding: 0 0 0 1em;`,\n\tmodel: `color: #3e999f;`,\n\tsealedModel: `color: #3e999f; font-weight: bold`,\n\tinstance: `color: #718c00; font-style: italic`,\n\tfunction: `color: #4271AE`,\n\tstring: `color: #C41A16`,\n\tnumber: `color: #1C00CF`,\n\tboolean: `color: #AA0D91`,\n\tproperty: `color: #8959a8`,\n\tprivate: `color: #C19ED8`,\n\tconstant: `color: #8959a8; font-weight: bold`,\n\tprivateConstant: `color: #C19ED8; font-weight: bold`,\n\tnull: `color: #8e908c`,\n\tundeclared: `color: #C0C0C0;`,\n\tproto: `color: #B871BD; font-style: italic`\n};\n\nconst getModel = (instance) => {\n\tif (instance === undefined || instance === null)\n\t\treturn null\n\n\tlet proto = getProto(instance);\n\tif (!proto || !proto.constructor || !is(Model, proto.constructor))\n\t\treturn null\n\n\treturn proto.constructor\n}\n\nconst span = (style, ...children) => [\"span\", {style}, ...children]\n\nconst format = (x, config={}) => {\n\tif (x === null || x === undefined)\n\t\treturn span(styles.null, \"\"+x);\n\n\tif (typeof x === \"boolean\")\n\t\treturn span(styles.boolean, x);\n\n\tif (typeof x === \"number\")\n\t\treturn span(styles.number, x);\n\n\tif (typeof x === \"string\")\n\t\treturn span(styles.string, `\"${x}\"`);\n\n\tif (Array.isArray(x) && config.isModelDefinition) {\n\t\tlet def = [];\n\t\tif (x.length === 1) x.push(undefined, null);\n\t\tfor (let i = 0; i < x.length; i++) {\n\t\t\tdef.push(format(x[i], config))\n\t\t\tif (i < x.length - 1) def.push(' or ')\n\t\t}\n\t\treturn span('', ...def)\n\t}\n\n\tif (isPlainObject(x))\n\t\treturn formatObject(x, getModel(x), config)\n\n\tif (isFunction(x) && !is(Model, x) && config.isModelDefinition)\n\t\treturn span(styles.function, x.name || x.toString());\n\n\treturn ['object', {object: x, config}]\n}\n\nconst formatObject = (o, model, config) => span('',\n\t'{',\n\t['ol', {style: styles.list}, ...Object.keys(o).map(prop =>\n\t\t['li', {style: styles.listItem}, span(styles.property, prop), ': ', format(o[prop], config) ])\n\t],\n\t'}'\n)\n\nconst formatModel = model => {\n\tconst parts = [],\n\t cfg = { isModelDefinition: true },\n\t def = model.definition,\n\t formatList = (list, map) => list.reduce((r, e) => [...r, map(e), \", \"], []).slice(0, 2 * list.length - 1);\n\n\tif (is(BasicModel, model )) parts.push(format(def, cfg))\n\tif (is(ArrayModel, model)) parts.push(\"Array of \", format(def, cfg))\n\tif (is(SetModel, model)) parts.push(\"Set of \", format(def, cfg))\n\tif (is(MapModel, model)) parts.push(\"Map of \", format(def.key, cfg), \" : \", format(def.value, cfg))\n\tif (is(FunctionModel, model)) {\n\t\tparts.push(\"Function(\", ...formatList(def.arguments, arg => format(arg, cfg)), \")\")\n\t\tif (\"return\" in def) parts.push(\" => \", format(def.return, cfg))\n\t}\n\n\tif (model.assertions.length > 0) {\n\t\tparts.push(\"\\n(assertions: \", ...formatList(model.assertions, f => ['object', { object: f }]), \")\")\n\t}\n\n\treturn span(styles.model, ...parts)\n}\n\nconst ModelFormatter = {\n\theader(x, config = {}) {\n\t\tif (is(ObjectModel, x))\n\t\t\treturn span(x.sealed ? styles.sealedModel : styles.model, x.name)\n\n\t\tif (is(Model, x)) {\n\t\t\treturn formatModel(x)\n\t\t}\n\n\t\tif (config.isModelDefinition && isPlainObject(x))\n\t\t\treturn format(x, config)\n\n\t\treturn null;\n\t},\n\thasBody(x) {\n\t\treturn is(ObjectModel, x)\n\t},\n\tbody(model) {\n\t\treturn span('',\n\t\t\t'{',\n\t\t\t['ol', {style: styles.list}, ...Object.keys(model.definition).map(prop => {\n\t\t\t\tlet isPrivate = model.conventionForPrivate(prop),\n\t\t\t\t isConstant = model.conventionForConstant(prop),\n\t\t\t\t hasDefault = model.prototype.hasOwnProperty(prop),\n\t\t\t\t style = styles.property;\n\n\t\t\t\tif (isPrivate) {\n\t\t\t\t\tstyle = isConstant ? styles.privateConstant : styles.private\n\t\t\t\t} else if (isConstant) {\n\t\t\t\t\tstyle = styles.constant\n\t\t\t\t}\n\n\t\t\t\treturn ['li', {style: styles.listItem},\n\t\t\t\t\tspan(style, prop), ': ', format(model.definition[prop], { isModelDefinition: true }),\n\t\t\t\t\thasDefault ? span(styles.proto, ' = ', format(model.prototype[prop])) : ''\n\t\t\t\t]\n\t\t\t}) ],\n\t\t\t'}'\n\t\t)\n\t}\n}\n\nconst ModelInstanceFormatter = {\n\theader(x, config = {}) {\n\t\tif (config.isInstanceProperty && isPlainObject(x)) {\n\t\t\treturn format(x, config)\n\t\t}\n\n\t\tlet model = getModel(x);\n\t\tif (is(Model, model)) {\n\t\t\tlet parts = is(ObjectModel, model) ? [model.name] : [['object', { object: x[_original] }], ` (${model.name})`];\n\t\t\treturn span(styles.instance, ...parts)\n\t\t}\n\n\t\treturn null;\n\t},\n\thasBody(x) {\n\t\treturn x && is(ObjectModel, getModel(x))\n\t},\n\tbody(x) {\n\t\tconst model = getModel(x)\n\t\tconst o = x[_original] || x;\n\t\treturn span('',\n\t\t\t'{',\n\t\t\t[\n\t\t\t\t'ol',\n\t\t\t\t{style: styles.list},\n\t\t\t\t...Object.keys(o).map(prop => {\n\t\t\t\t\tlet isPrivate = model.conventionForPrivate(prop),\n\t\t\t\t\t\tisConstant = model.conventionForConstant(prop),\n\t\t\t\t\t\tisDeclared = prop in model.definition,\n\t\t\t\t\t\tstyle = styles.property;\n\n\t\t\t\t\tif (!isDeclared) {\n\t\t\t\t\t\tstyle = styles.undeclared\n\t\t\t\t\t} else if (isPrivate) {\n\t\t\t\t\t\tstyle = isConstant ? styles.privateConstant : styles.private\n\t\t\t\t\t} else if (isConstant) {\n\t\t\t\t\t\tstyle = styles.constant\n\t\t\t\t\t}\n\n\t\t\t\t\treturn ['li', {style: styles.listItem},\n\t\t\t\t\t\tspan(style, prop), ': ', format(o[prop], { isInstanceProperty: true })\n\t\t\t\t\t]\n\t\t\t\t}),\n\t\t\t\t['li', {style: styles.listItem},\n\t\t\t\t\tspan(styles.proto, '__proto__', ': ', ['object', {object: getProto(x)}])\n\t\t\t\t]\n\t\t\t],\n\t\t\t'}'\n\t\t)\n\t}\n}\n\nif (typeof window !== \"undefined\") {\n\twindow.devtoolsFormatters = (window.devtoolsFormatters || [])\n\t\t.concat(ModelFormatter, ModelInstanceFormatter);\n}"],"names":["format"],"mappings":";;;;;;CAAO;CACP,CAAC,YAAY,GAAG,CAAC,IAAI,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;CAChF,CAAC,QAAQ,GAAG,CAAC,IAAI,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC;CACzC,CAAC,QAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,MAAM,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC;;CAEjD,CAAC,GAAG,GAAG,CAAC,CAAC,EAAE,IAAI,KAAK,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC;CAC1C,CAAC,EAAE,GAAG,CAAC,WAAW,EAAE,GAAG,KAAK,GAAG,YAAY,WAAW;CACtD,CAAC,UAAU,GAAG,CAAC,IAAI,OAAO,CAAC,KAAK,UAAU;CAC1C,CAAC,QAAQ,GAAG,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ;CACtC,CAAC,aAAa,GAAG,CAAC,IAAI,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,SAAS;CAC1E,CAAC,UAAU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C,QAAQ,CAAC;CACnC,KAAK,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAC7E,KAAK;CACL,IAAI;CACJ,GAAG,GAAG;CACN,GAAG;CACH,EAAE;CACF,EAAC;;CAED,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;CACnC,CAAC,MAAM,CAAC,kBAAkB,GAAG,CAAC,MAAM,CAAC,kBAAkB,IAAI,EAAE;CAC7D,GAAG,MAAM,CAAC,cAAc,EAAE,sBAAsB,CAAC,CAAC;CAClD;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/object-model.min.js b/dist/object-model.min.js index ed550af..2867093 100644 --- a/dist/object-model.min.js +++ b/dist/object-model.min.js @@ -1,4 +1,4 @@ -// ObjectModel v3.5.4 - http://objectmodel.js.org +// ObjectModel v3.6.0 - http://objectmodel.js.org // MIT License - Sylvain Pollet-Villard -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.window=e.window||{})}(this,function(e){"use strict";const t=e=>Object.getPrototypeOf(e),r=(e,t)=>Object.setPrototypeOf(e,t),n=(e,t)=>e.hasOwnProperty(t),i=(e,t)=>t instanceof e,o=e=>"function"==typeof e,s=e=>"object"==typeof e,l=e=>e&&s(e)&&t(e)===Object.prototype,a=(e,t)=>new Proxy(e,{apply:t}),u=(e,t,r)=>new Proxy(e,Object.assign({getPrototypeOf:()=>t.prototype},r)),f=(e,t={},r)=>{for(let n in t)if(r&&l(t[n])){let i={};f(i,e[n],r),f(i,t[n],r),e[n]=i}else e[n]=t[n]},c=(e,t,r,n=!1)=>{Object.defineProperty(e,t,{value:r,enumerable:n,writable:!0,configurable:!0})},p=(e,t)=>{r(e,t.prototype),c(e,"constructor",t)},d=(e,t,n)=>{e.prototype=Object.assign(Object.create(t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),n),r(e,t)},h=Symbol(),y=Symbol(),g=Symbol(),v=Symbol(),m=(e,t)=>{e.definition=t,e.assertions=[...e.assertions],c(e,"errors",[]),delete e.name},b=(e,t,r)=>(d(e,t,r),e.assertions.push(...t.assertions),e),j=(e,t,r,n,i)=>{e.push({expected:t,received:r,path:n,message:i})},O=(e,t=e.errorCollector)=>{let r=e.errors.length;if(r>0){let r=e.errors.map(e=>{if(!e.message){let t=Array.isArray(e.expected)?e.expected:[e.expected];e.message="expecting "+(e.path?e.path+" to be ":"")+t.map(e=>k(e)).join(" or ")+", got "+(null!=e.received?(e=>Object.prototype.toString.call(e).match(/\s([a-zA-Z]+)/)[1])(e.received)+" ":"")+k(e.received)}return e});e.errors=[],t.call(e,r)}return r},w=e=>e&&i(K,t(e).constructor),$=e=>{if(l(e))Object.keys(e).map(t=>{e[t]=$(e[t])});else{if(!Array.isArray(e))return[e];if(1===e.length)return[...e,void 0,null]}return e},S=(e,t)=>{let r=$(e).map(e=>k(e,t));return r.length>1?`(${r.join(" or ")})`:r[0]},P=(e,t=[])=>(Array.isArray(t)||(t=[t]),t.length>0&&(e=t.reduce((e,t)=>e.concat(t),Array.isArray(e)?e.slice():[e]).filter((e,t,r)=>r.indexOf(e)===t)),e),x=(e,t,r,n,o)=>{let s=o.indexOf(t);if(-1!==s&&-1!==o.indexOf(t,s+1))return e;if(e=D(e,t),i(K,t))t[y](e,r,n,o.concat(t));else if(l(t))Object.keys(t).map(i=>{let s=e?e[v]?e[v](i):e[i]:void 0;x(s,t[i],F(r,i),n,o)});else{if($(t).some(t=>A(e,t,r,o)))return e;j(n,t,e,r)}return e},A=(e,t,r,n)=>{if(null==e)return e===t;if(l(t)||i(K,t)){let i=[];return x(e,t,r,i,n),!i.length}return i(RegExp,t)?t.test(e):t===Number||t===Date?e.constructor===t&&!isNaN(e):e===t||o(t)&&i(t,e)||e.constructor===t},M=(e,t,r,n=t.errors)=>{for(let i of t.assertions){let s;try{s=i.call(t,e)}catch(e){s=e}if(!0!==s){let l=o(i.description)?i.description:(e,t)=>`assertion "${i.description}" returned ${k(e)} `+`for ${r?r+" =":"value"} ${k(t)}`;j(n,i,e,r,l.call(t,s,e,r))}}},k=(e,t=[])=>{if(t.length>15||t.includes(e))return"...";if(null==e)return String(e);if("string"==typeof e)return`"${e}"`;if(i(K,e))return e.toString(t);if(t.unshift(e),o(e))return e.name||e.toString();if(i(Map,e)||i(Set,e))return k([...e]);if(Array.isArray(e))return`[${e.map(e=>k(e,t)).join(", ")}]`;if(e.toString!==Object.prototype.toString)return e.toString();if(e&&s(e)){let r=Object.keys(e),n="\t".repeat(t.length);return`{${r.map(r=>`\n${n+r}: ${k(e[r],t.slice())}`).join(",")} ${r.length?`\n${n.slice(1)}`:""}}`}return String(e)},F=(e,t)=>e?e+"."+t:t,R=(e,t,r,i,o,s,l)=>{let a=F(r,o),u=e.conventionForPrivate(o),f=e.conventionForConstant(o),c=n(i,o),p=c&&Object.getOwnPropertyDescriptor(i,o);o in t&&(u&&!s||f&&void 0!==i[o])&&C(`modify ${u?"private":"constant"} property ${o}`,e);let d=n(t,o);d||!e.sealed?(l(a),d&&x(i[o],t[o],a,e.errors,[]),M(i,e,a)):E(a,i[o],e.errors);let h=e.errors.length;return h&&(c?Object.defineProperty(i,o,p):delete i[o],O(e)),!h},C=(e,t)=>{t.errors.push({message:"cannot "+e})},E=(e,t,r)=>{r.push({path:e,received:t,message:`property ${e} is not declared in the sealed model definition`})},D=(e,t=[])=>{if(!e||l(t)||w(e))return e;let r=$(t),n=[];for(let t of r)i(K,t)&&t.test(e)&&n.push(t);if(1===n.length){let t=n[0];return i(z,t)?new t(e):t(e)}return n.length>1&&console.warn(`Ambiguous model for value ${k(e)}, could be ${n.join(" or ")}`),e},N=(e,t,r,i)=>{Object.keys(e).map(o=>{let s=e[o],a=F(i,o);n(t,o)?l(s)&&N(s,t[o],r,a):E(a,s,r)})},_=(e,r,i,s,u)=>{if(!l(i))return D(r,i);const f=e=>a(e,(e,t,r)=>{u=!0;let n=Reflect.apply(e,t,r);return u=!1,n});return new Proxy(r,{getPrototypeOf:()=>s?Object.prototype:t(r),get(t,r){if(r===g)return t;if(r===v)return f(e=>t[e]);if("string"!=typeof r)return Reflect.get(t,r);let a=F(s,r),c=i[r];return!u&&r in i&&e.conventionForPrivate(r)?(C(`access to private property ${a}`,e),void O(e)):(t[r]&&n(t,r)&&!l(c)&&!w(t[r])&&(t[r]=D(t[r],c)),o(t[r])&&"constructor"!==r?f(t[r]):(l(c)&&!t[r]&&(t[r]={}),_(e,t[r],c,a,u)))},set:(t,r,n)=>R(e,i,s,t,r,u,o=>Reflect.set(t,r,_(e,n,i[r],o))),deleteProperty:(t,r)=>R(e,i,s,t,r,u,()=>Reflect.deleteProperty(t,r)),defineProperty:(t,r,n)=>R(e,i,s,t,r,u,()=>Reflect.defineProperty(t,r,n)),has:(t,r)=>Reflect.has(t,r)&&Reflect.has(i,r)&&!e.conventionForPrivate(r),ownKeys:t=>Reflect.ownKeys(t).filter(t=>Reflect.has(i,t)&&!e.conventionForPrivate(t)),getOwnPropertyDescriptor(t,r){let n;return e.conventionForPrivate(r)||void 0!==(n=Object.getOwnPropertyDescriptor(i,r))&&(n.value=t[r]),n}})};function K(e,t){return l(e)?new z(e,t):new T(e)}function T(e){let t=function(e=t.default){return t.validate(e)?e:void 0};return p(t,T),m(t,e),t}function z(e,t){let r=function(e=r.default){return i(r,this)?i(r,e)?e:(i(Object,e)||void 0===e||j(r.errors,Object,e),f(this,r[h](e),!0),r.validate(this)?_(r,this,r.definition):void 0):new r(e)};return Object.assign(r,t),d(r,Object),p(r,z),m(r,e),r}Object.assign(K.prototype,{name:"Model",assertions:[],conventionForConstant:e=>e.toUpperCase()===e,conventionForPrivate:e=>"_"===e[0],toString(e){return S(this.definition,e)},as(e){return c(this,"name",e),this},defaultTo(e){return this.default=e,this},[y](e,t,r,n){x(e,this.definition,t,r,n),M(e,this,t,r)},validate(e,t){return this[y](e,null,this.errors,[]),!O(this,t)},test(e){let r=this;for(;!n(r,"errorCollector");)r=t(r);let i,o=r.errorCollector;return r.errorCollector=(()=>{i=!0}),new this(e),r.errorCollector=o,!i},errorCollector(e){let t=new TypeError(e.map(e=>e.message).join("\n"));throw t.stack=t.stack.replace(/\n.*object-model(.|\n)*object-model.*/,""),t},assert(e,t=k(e)){return c(e,"description",t),this.assertions=this.assertions.concat(e),this}}),d(T,K,{extend(...e){let t=b(new T(P(this.definition,e)),this);for(let r of e)i(T,r)&&t.assertions.push(...r.assertions);return t}}),d(z,K,{sealed:!1,defaults(e){return Object.assign(this.prototype,e),this},toString(e){return k(this.definition,e)},extend(...e){let r=Object.assign({},this.definition),n=[],l={};f(l,this.prototype,!1);for(let t of e)i(K,t)&&(f(r,t.definition,!0),n.push(...t.assertions)),o(t)&&f(l,t.prototype,!0),s(t)&&f(r,t,!0);let a=b(new z(r),this,l);return a.assertions=[...this.assertions,...n],t(this)!==z.prototype&&(a[h]=(e=>{let t=new this(e);return f(e,t,!0),e})),a},[h]:e=>e,[y](e,t,r,n){if(s(e)){let i=this.definition;x(e,i,t,r,n),this.sealed&&N(e,i,r)}else j(r,this,e,t);M(e,this,t,r)}});let B=["pop","push","reverse","shift","sort","splice","unshift"];function I(e){let t=function(e=t.default){if(t.validate(e))return u(e,t,{get(r,n){if(n===g)return r;let i=r[n];return o(i)?a(i,(i,o,s)=>{if(B.includes(n)){let e=r.slice();i.apply(e,s),t.validate(e)}let l=i.apply(r,s);return e.forEach((e,n)=>r[n]=D(e,t.definition)),l}):i},set:(e,r,n)=>U(e,r,n,t),deleteProperty:(e,r)=>!(r in e)||U(e,r,void 0,t)})};return d(t,Array),p(t,I),m(t,e),t}d(I,K,{toString(e){return"Array of "+S(this.definition,e)},[y](e,t,r,n){Array.isArray(e)?e.forEach((i,o)=>{e[o]=x(i,this.definition,`${t||"Array"}[${o}]`,r,n)}):j(r,this,e,t),M(e,this,t,r)},extend(...e){return b(new I(P(this.definition,e)),this)}});let U=(e,t,r,n)=>{let i=`Array[${t}]`;parseInt(t)===+t&&t>=0&&(r=x(r,n.definition,i,n.errors,[]));let o=e.slice();o[t]=r,M(o,n,i);let s=!O(n);return s&&(e[t]=r),s};function Z(...e){let t=function(e=t.default){if(t.validate(e))return u(e,t,{get:(e,t)=>t===g?e:e[t],apply(e,r,n){let i,o=t.definition;return o.arguments.forEach((e,r)=>{n[r]=x(n[r],e,`arguments[${r}]`,t.errors,[])}),M(n,t,"arguments"),t.errors.length||(i=Reflect.apply(e,r,n),"return"in o&&(i=x(i,o.return,"return value",t.errors,[]))),O(t),i}})};return d(t,Function),p(t,Z),m(t,{arguments:e}),t}d(Z,K,{toString(e=[]){let t=`Function(${this.definition.arguments.map(t=>S(t,e.slice())).join(", ")})`;return"return"in this.definition&&(t+=" => "+S(this.definition.return,e)),t},return(e){return this.definition.return=e,this},extend(e,t){let r=this.definition.arguments,n=e.map((t,n)=>P(n in r?r[n]:[],e[n])),i=P(this.definition.return,t);return b(new Z(...n).return(i),this)},[y](e,t,r){o(e)||j(r,"Function",e,t)}}),Z.prototype.assert(function(e){return!(e.length>this.definition.arguments.length)||e},function(e){return`expecting ${this.definition.arguments.length} arguments for ${k(this)}, got ${e.length}`});let q=["set","delete","clear"];function G(e,t){let r=function(e=r.default){let t=e=>["key","value"].map((t,n)=>D(e[n],r.definition[t])),n=new Map([...e].map(t));if(r.validate(n))return u(n,r,{get(e,n){if(n===g)return e;let i=e[n];return o(i)?a(i,(i,o,s)=>{if("set"===n&&(s=t(s)),q.includes(n)){let t=new Map(e);i.apply(t,s),r.validate(t)}return i.apply(e,s)}):i}})};return d(r,Map),p(r,G),m(r,{key:e,value:t}),r}d(G,K,{toString(e){let{key:t,value:r}=this.definition;return`Map of ${S(t,e)} : ${S(r,e)}`},[y](e,t,r,n){if(i(Map,e)){t=t||"Map";for(let[i,o]of e)x(i,this.definition.key,`${t} key`,r,n),x(o,this.definition.value,`${t}[${k(i)}]`,r,n)}else j(r,this,e,t);M(e,this,t,r)},extend(e,t){let{key:r,value:n}=this.definition;return b(new G(P(r,e),P(n,t)),this)}});let H=["add","delete","clear"];function J(e){let t=function(e=t.default){let r=e=>D(e,t.definition),n=new Set([...e].map(r));if(t.validate(n))return u(n,t,{get(e,n){if(n===g)return e;let i=e[n];return o(i)?a(i,(i,o,s)=>{if("add"===n&&(s[0]=r(s[0])),H.includes(n)){let r=new Set(e);i.apply(r,s),t.validate(r)}return i.apply(e,s)}):i}})};return d(t,Set),p(t,J),m(t,e),t}d(J,K,{toString(e){return"Set of "+S(this.definition,e)},[y](e,t,r,n){if(i(Set,e))for(let i of e.values())x(i,this.definition,`${t||"Set"} value`,r,n);else j(r,this,e,t);M(e,this,t,r)},extend(...e){return b(new J(P(this.definition,e)),this)}}),e.Model=K,e.BasicModel=T,e.ObjectModel=z,e.ArrayModel=I,e.FunctionModel=Z,e.MapModel=G,e.SetModel=J,Object.defineProperty(e,"__esModule",{value:!0})}); +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.window=e.window||{})}(this,function(e){"use strict";const t=e=>Object.getPrototypeOf(e),r=(e,t)=>Object.setPrototypeOf(e,t),n=(e,t)=>e.hasOwnProperty(t),i=(e,t)=>t instanceof e,o=e=>"function"==typeof e,s=e=>"object"==typeof e,l=e=>e&&s(e)&&t(e)===Object.prototype,a=e=>e&&o(e[Symbol.iterator]),u=(e,t)=>new Proxy(e,{apply:t}),f=(e,t,r)=>new Proxy(e,Object.assign({getPrototypeOf:()=>t.prototype},r)),c=(e,t={},r)=>{for(let n in t)if(r&&l(t[n])){let i={};c(i,e[n],r),c(i,t[n],r),e[n]=i}else e[n]=t[n]},p=(e,t,r,n=!1)=>{Object.defineProperty(e,t,{value:r,enumerable:n,writable:!0,configurable:!0})},d=(e,t)=>{r(e,t.prototype),p(e,"constructor",t)},h=(e,t,n)=>{e.prototype=Object.assign(Object.create(t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),n),r(e,t)},y=Symbol(),g=Symbol(),m=Symbol(),v=Symbol(),b=(e,t)=>{e.definition=t,e.assertions=[...e.assertions],p(e,"errors",[]),delete e.name},j=(e,t,r)=>(h(e,t,r),e.assertions.push(...t.assertions),e),O=(e,t,r,n,i)=>{e.push({expected:t,received:r,path:n,message:i})},w=(e,t=e.errorCollector)=>{let r=e.errors.length;if(r>0){let r=e.errors.map(e=>{if(!e.message){let t=Array.isArray(e.expected)?e.expected:[e.expected];e.message="expecting "+(e.path?e.path+" to be ":"")+t.map(e=>k(e)).join(" or ")+", got "+(null!=e.received?(e=>Object.prototype.toString.call(e).match(/\s([a-zA-Z]+)/)[1])(e.received)+" ":"")+k(e.received)}return e});e.errors=[],t.call(e,r)}return r},$=e=>e&&i(T,t(e).constructor),S=e=>{if(l(e))Object.keys(e).map(t=>{e[t]=S(e[t])});else{if(!Array.isArray(e))return[e];if(1===e.length)return[...e,void 0,null]}return e},P=(e,t)=>{let r=S(e).map(e=>k(e,t));return r.length>1?`(${r.join(" or ")})`:r[0]},x=(e,t=[])=>(Array.isArray(t)||(t=[t]),t.length>0&&(e=t.reduce((e,t)=>e.concat(t),Array.isArray(e)?[...e]:[e]).filter((e,t,r)=>r.indexOf(e)===t)),e),A=(e,t,r,n,o)=>{let s=o.indexOf(t);if(-1!==s&&-1!==o.indexOf(t,s+1))return e;if(e=N(e,t),i(T,t))t[g](e,r,n,o.concat(t));else if(l(t))Object.keys(t).map(i=>{let s=e?e[v]?e[v](i):e[i]:void 0;A(s,t[i],R(r,i),n,o)});else{if(S(t).some(t=>M(e,t,r,o)))return e;O(n,t,e,r)}return e},M=(e,t,r,n)=>{if(null==e)return e===t;if(l(t)||i(T,t)){let i=[];return A(e,t,r,i,n),!i.length}return i(RegExp,t)?t.test(e):t===Number||t===Date?e.constructor===t&&!isNaN(e):e===t||o(t)&&i(t,e)||e.constructor===t},F=(e,t,r,n=t.errors)=>{for(let i of t.assertions){let s;try{s=i.call(t,e)}catch(e){s=e}if(!0!==s){let l=o(i.description)?i.description:(e,t)=>`assertion "${i.description}" returned ${k(e)} `+`for ${r?r+" =":"value"} ${k(t)}`;O(n,i,e,r,l.call(t,s,e,r))}}},k=(e,t=[])=>{if(t.length>15||t.includes(e))return"...";if(null==e)return String(e);if("string"==typeof e)return`"${e}"`;if(i(T,e))return e.toString(t);if(t.unshift(e),o(e))return e.name||e.toString();if(i(Map,e)||i(Set,e))return k([...e]);if(Array.isArray(e))return`[${e.map(e=>k(e,t)).join(", ")}]`;if(e.toString!==Object.prototype.toString)return e.toString();if(e&&s(e)){let r=Object.keys(e),n="\t".repeat(t.length);return`{${r.map(r=>`\n${n+r}: ${k(e[r],[...t])}`).join(",")} ${r.length?`\n${n.slice(1)}`:""}}`}return String(e)},R=(e,t)=>e?e+"."+t:t,C=(e,t,r,i,o,s,l)=>{let a=R(r,o),u=e.conventionForPrivate(o),f=e.conventionForConstant(o),c=n(i,o),p=c&&Object.getOwnPropertyDescriptor(i,o);o in t&&(u&&!s||f&&void 0!==i[o])&&D(`modify ${u?"private":"constant"} property ${o}`,e);let d=n(t,o);d||!e.sealed?(l(a),d&&A(i[o],t[o],a,e.errors,[]),F(i,e,a)):E(a,i[o],e.errors);let h=e.errors.length;return h&&(c?Object.defineProperty(i,o,p):delete i[o],w(e)),!h},D=(e,t)=>{t.errors.push({message:"cannot "+e})},E=(e,t,r)=>{r.push({path:e,received:t,message:`property ${e} is not declared in the sealed model definition`})},N=(e,t=[])=>{if(!e||l(t)||$(e))return e;let r=S(t),n=[];for(let t of r)i(T,t)&&t.test(e)&&n.push(t);if(1===n.length){let t=n[0];return i(B,t)?new t(e):t(e)}return n.length>1&&console.warn(`Ambiguous model for value ${k(e)}, could be ${n.join(" or ")}`),e},_=(e,t,r,i)=>{Object.keys(e).map(o=>{let s=e[o],a=R(i,o);n(t,o)?l(s)&&_(s,t[o],r,a):E(a,s,r)})},K=(e,r,i,s,a)=>{if(!l(i))return N(r,i);const f=e=>u(e,(e,t,r)=>{a=!0;let n=Reflect.apply(e,t,r);return a=!1,n});return new Proxy(r,{getPrototypeOf:()=>s?Object.prototype:t(r),get(t,r){if(r===m)return t;if(r===v)return f(e=>t[e]);if("string"!=typeof r)return Reflect.get(t,r);let u=R(s,r),c=i[r];return!a&&r in i&&e.conventionForPrivate(r)?(D(`access to private property ${u}`,e),void w(e)):(t[r]&&n(t,r)&&!l(c)&&!$(t[r])&&(t[r]=N(t[r],c)),o(t[r])&&"constructor"!==r?f(t[r]):(l(c)&&!t[r]&&(t[r]={}),K(e,t[r],c,u,a)))},set:(t,r,n)=>C(e,i,s,t,r,a,o=>Reflect.set(t,r,K(e,n,i[r],o))),deleteProperty:(t,r)=>C(e,i,s,t,r,a,()=>Reflect.deleteProperty(t,r)),defineProperty:(t,r,n)=>C(e,i,s,t,r,a,()=>Reflect.defineProperty(t,r,n)),has:(t,r)=>Reflect.has(t,r)&&Reflect.has(i,r)&&!e.conventionForPrivate(r),ownKeys:t=>Reflect.ownKeys(t).filter(t=>Reflect.has(i,t)&&!e.conventionForPrivate(t)),getOwnPropertyDescriptor(t,r){let n;return e.conventionForPrivate(r)||void 0!==(n=Object.getOwnPropertyDescriptor(i,r))&&(n.value=t[r]),n}})};function T(e,t){return l(e)?new B(e,t):new z(e)}function z(e){let t=function(e=t.default){return t.validate(e)?e:void 0};return d(t,z),b(t,e),t}function B(e,t){let r=function(e=r.default){return i(r,this)?i(r,e)?e:(i(Object,e)||void 0===e||O(r.errors,Object,e),c(this,r[y](e),!0),r.validate(this)?K(r,this,r.definition):void 0):new r(e)};return Object.assign(r,t),h(r,Object),d(r,B),b(r,e),r}Object.assign(T.prototype,{name:"Model",assertions:[],conventionForConstant:e=>e.toUpperCase()===e,conventionForPrivate:e=>"_"===e[0],toString(e){return P(this.definition,e)},as(e){return p(this,"name",e),this},defaultTo(e){return this.default=e,this},[g](e,t,r,n){A(e,this.definition,t,r,n),F(e,this,t,r)},validate(e,t){return this[g](e,null,this.errors,[]),!w(this,t)},test(e){let r=this;for(;!n(r,"errorCollector");)r=t(r);let i,o=r.errorCollector;return r.errorCollector=(()=>{i=!0}),new this(e),r.errorCollector=o,!i},errorCollector(e){let t=new TypeError(e.map(e=>e.message).join("\n"));throw t.stack=t.stack.replace(/\n.*object-model(.|\n)*object-model.*/,""),t},assert(e,t=k(e)){return p(e,"description",t),this.assertions=this.assertions.concat(e),this}}),h(z,T,{extend(...e){let t=j(new z(x(this.definition,e)),this);for(let r of e)i(z,r)&&t.assertions.push(...r.assertions);return t}}),h(B,T,{sealed:!1,defaults(e){return Object.assign(this.prototype,e),this},toString(e){return k(this.definition,e)},extend(...e){let r=Object.assign({},this.definition),n=[],l={};c(l,this.prototype,!1);for(let t of e)i(T,t)&&(c(r,t.definition,!0),n.push(...t.assertions)),o(t)&&c(l,t.prototype,!0),s(t)&&c(r,t,!0);let a=j(new B(r),this,l);return a.assertions=[...this.assertions,...n],t(this)!==B.prototype&&(a[y]=(e=>{let t=new this(e);return c(e,t,!0),e})),a},[y]:e=>e,[g](e,t,r,n){if(s(e)){let i=this.definition;A(e,i,t,r,n),this.sealed&&_(e,i,r)}else O(r,this,e,t);F(e,this,t,r)}});const I=(e,t,r,i,s,l,a={})=>{let c=function(e=c.default){if(e=i(e),c.validate(e))return f(e,c,Object.assign({get(e,t){if(t===m)return e;let r=e[t];return o(r)?u(r,(r,i,o)=>{if(n(l,t)){l[t]&&(o=l[t](o));let n=s(e);r.apply(n,o),c.validate(n)}return r.apply(e,o)}):r}},a))};return h(c,e),d(c,t),b(c,r),c};function U(e){let t=t=>t.map(t=>N(t,e)),r=I(Array,U,e,e=>Array.isArray(e)?t(e):e,e=>[...e],{copyWithin:0,fill:([t,...r])=>[N(t,e),...r],pop:0,push:t,reverse:0,shift:0,sort:0,splice:([e,r,...n])=>[e,r,...t(n)],unshift:t},{set:(e,t,n)=>W(e,t,n,r),deleteProperty:(e,t)=>!(t in e)||W(e,t,void 0,r)});return r}h(U,T,{toString(e){return"Array of "+P(this.definition,e)},[g](e,t,r,n){Array.isArray(e)?e.forEach((i,o)=>{e[o]=A(i,this.definition,`${t||"Array"}[${o}]`,r,n)}):O(r,this,e,t),F(e,this,t,r)},extend(...e){return j(new U(x(this.definition,e)),this)}});let W=(e,t,r,n)=>{let i=`Array[${t}]`;parseInt(t)===+t&&t>=0&&(r=A(r,n.definition,i,n.errors,[]));let o=[...e];o[t]=r,F(o,n,i);let s=!w(n);return s&&(e[t]=r),s};function Z(...e){let t=function(e=t.default){if(t.validate(e))return f(e,t,{get:(e,t)=>t===m?e:e[t],apply(e,r,n){let i,o=t.definition;return o.arguments.forEach((e,r)=>{n[r]=A(n[r],e,`arguments[${r}]`,t.errors,[])}),F(n,t,"arguments"),t.errors.length||(i=Reflect.apply(e,r,n),"return"in o&&(i=A(i,o.return,"return value",t.errors,[]))),w(t),i}})};return h(t,Function),d(t,Z),b(t,{arguments:e}),t}function q(e,t){let r=([r,n])=>[N(r,e),N(n,t)];return I(Map,q,{key:e,value:t},e=>a(e)?new Map([...e].map(r)):e,e=>new Map(e),{set:r,delete:0,clear:0})}function G(e){return I(Set,G,e,t=>a(t)?new Set([...t].map(t=>N(t,e))):t,e=>new Set(e),{add:([t])=>[N(t,e)],delete:0,clear:0})}h(Z,T,{toString(e=[]){let t=`Function(${this.definition.arguments.map(t=>P(t,[...e])).join(", ")})`;return"return"in this.definition&&(t+=" => "+P(this.definition.return,e)),t},return(e){return this.definition.return=e,this},extend(e,t){let r=this.definition.arguments,n=e.map((t,n)=>x(n in r?r[n]:[],e[n])),i=x(this.definition.return,t);return j(new Z(...n).return(i),this)},[g](e,t,r){o(e)||O(r,"Function",e,t)}}),Z.prototype.assert(function(e){return!(e.length>this.definition.arguments.length)||e},function(e){return`expecting ${this.definition.arguments.length} arguments for ${k(this)}, got ${e.length}`}),h(q,T,{toString(e){let{key:t,value:r}=this.definition;return`Map of ${P(t,e)} : ${P(r,e)}`},[g](e,t,r,n){if(i(Map,e)){t=t||"Map";for(let[i,o]of e)A(i,this.definition.key,`${t} key`,r,n),A(o,this.definition.value,`${t}[${k(i)}]`,r,n)}else O(r,this,e,t);F(e,this,t,r)},extend(e,t){let{key:r,value:n}=this.definition;return j(new q(x(r,e),x(n,t)),this)}}),h(G,T,{toString(e){return"Set of "+P(this.definition,e)},[g](e,t,r,n){if(i(Set,e))for(let i of e.values())A(i,this.definition,`${t||"Set"} value`,r,n);else O(r,this,e,t);F(e,this,t,r)},extend(...e){return j(new G(x(this.definition,e)),this)}}),e.Model=T,e.BasicModel=z,e.ObjectModel=B,e.ArrayModel=U,e.FunctionModel=Z,e.MapModel=q,e.SetModel=G,Object.defineProperty(e,"__esModule",{value:!0})}); //# sourceMappingURL=object-model.min.js.map diff --git a/dist/object-model.min.js.map b/dist/object-model.min.js.map index 01e09f6..5b13b33 100644 --- a/dist/object-model.min.js.map +++ b/dist/object-model.min.js.map @@ -1 +1 @@ -{"version":3,"file":"object-model.min.js","sources":["../src/helpers.js","../src/object-model.js","../src/array-model.js","../src/function-model.js","../src/map-model.js","../src/set-model.js"],"sourcesContent":["export const\r\n\tbettertypeof = x => Object.prototype.toString.call(x).match(/\\s([a-zA-Z]+)/)[1],\r\n\tgetProto = x => Object.getPrototypeOf(x),\r\n\tsetProto = (x,p) => Object.setPrototypeOf(x,p),\r\n\r\n\thas = (o, prop) => o.hasOwnProperty(prop),\r\n\tis = (Constructor, obj) => obj instanceof Constructor,\r\n\tisFunction = f => typeof f === \"function\",\r\n\tisObject = o => typeof o === \"object\",\r\n\tisPlainObject = o => o && isObject(o) && getProto(o) === Object.prototype,\r\n\r\n\tproxifyFn = (fn, apply) => new Proxy(fn, {apply}),\r\n\tproxifyModel = (val, model, traps) => new Proxy(val, Object.assign({getPrototypeOf: () => model.prototype}, traps)),\r\n\r\n\tmerge = (target, src = {}, deep) => {\r\n\t\tfor (let key in src) {\r\n\t\t\tif (deep && isPlainObject(src[key])) {\r\n\t\t\t\tlet o = {}\r\n\t\t\t\tmerge(o, target[key], deep)\r\n\t\t\t\tmerge(o, src[key], deep)\r\n\t\t\t\ttarget[key] = o\r\n\t\t\t} else {\r\n\t\t\t\ttarget[key] = src[key]\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\tdefine = (obj, key, value, enumerable = false) => {\r\n\t\tObject.defineProperty(obj, key, {value, enumerable, writable: true, configurable: true})\r\n\t},\r\n\r\n\tsetConstructor = (model, constructor) => {\r\n\t\tsetProto(model, constructor.prototype)\r\n\t\tdefine(model, \"constructor\", constructor)\r\n\t},\r\n\r\n\textend = (child, parent, props) => {\r\n\t\tchild.prototype = Object.assign(Object.create(parent.prototype, {\r\n\t\t\tconstructor: {\r\n\t\t\t\tvalue: child,\r\n\t\t\t\twritable: true,\r\n\t\t\t\tconfigurable: true\r\n\t\t\t}\r\n\t\t}), props)\r\n\t\tsetProto(child, parent)\r\n\t}","import {\r\n\tbettertypeof, define, extend, getProto, has, is, isFunction, isObject, isPlainObject,\r\n\tmerge, proxifyFn, setConstructor\r\n} from \"./helpers.js\"\r\n\r\nexport const\r\n\t_constructor = Symbol(),\r\n\t_validate = Symbol(),\r\n\t_original = Symbol(),\r\n\t_get = Symbol(), // used to bypass private access\r\n\r\n\tinitModel = (model, def) => {\r\n\t\tmodel.definition = def\r\n\t\tmodel.assertions = [...model.assertions]\r\n\t\tdefine(model, \"errors\", [])\r\n\t\tdelete model.name;\r\n\t},\r\n\r\n\textendModel = (child, parent, newProps) => {\r\n\t\textend(child, parent, newProps)\r\n\t\tchild.assertions.push(...parent.assertions)\r\n\t\treturn child\r\n\t},\r\n\r\n\tstackError = (errors, expected, received, path, message) => {\r\n\t\terrors.push({expected, received, path, message})\r\n\t},\r\n\r\n\tunstackErrors = (model, errorCollector = model.errorCollector) => {\r\n\t\tlet nbErrors = model.errors.length\r\n\t\tif (nbErrors > 0) {\r\n\t\t\tlet errors = model.errors.map(err => {\r\n\t\t\t\tif (!err.message) {\r\n\t\t\t\t\tlet def = Array.isArray(err.expected) ? err.expected : [err.expected]\r\n\t\t\t\t\terr.message = \"expecting \" + (err.path ? err.path + \" to be \" : \"\") + def.map(d => format(d)).join(\" or \")\r\n\t\t\t\t\t\t+ \", got \" + (err.received != null ? bettertypeof(err.received) + \" \" : \"\") + format(err.received)\r\n\t\t\t\t}\r\n\t\t\t\treturn err\r\n\t\t\t})\r\n\t\t\tmodel.errors = []\r\n\t\t\terrorCollector.call(model, errors) // throw all errors collected\r\n\t\t}\r\n\t\treturn nbErrors\r\n\t},\r\n\r\n\tisModelInstance = i => i && is(Model, getProto(i).constructor),\r\n\r\n\tparseDefinition = (def) => {\r\n\t\tif (isPlainObject(def)) {\r\n\t\t\tObject.keys(def).map(key => { def[key] = parseDefinition(def[key]) })\r\n\t\t}\r\n\t\telse if (!Array.isArray(def)) return [def]\r\n\t\telse if (def.length === 1) return [...def, undefined, null]\r\n\r\n\t\treturn def\r\n\t},\r\n\r\n\tformatDefinition = (def, stack) => {\r\n\t\tlet parts = parseDefinition(def).map(d => format(d, stack));\r\n\t\treturn parts.length > 1 ? `(${parts.join(\" or \")})` : parts[0]\r\n\t},\r\n\r\n\textendDefinition = (def, newParts = []) => {\r\n\t\tif (!Array.isArray(newParts)) newParts = [newParts]\r\n\t\tif (newParts.length > 0) {\r\n\t\t\tdef = newParts\r\n\t\t\t\t.reduce((def, ext) => def.concat(ext), Array.isArray(def) ? def.slice() : [def]) // clone to lose ref\r\n\t\t\t\t.filter((value, index, self) => self.indexOf(value) === index) // remove duplicates\r\n\t\t}\r\n\r\n\t\treturn def\r\n\t},\r\n\r\n\tcheckDefinition = (obj, def, path, errors, stack) => {\r\n\t\tlet indexFound = stack.indexOf(def)\r\n\t\tif (indexFound !== -1 && stack.indexOf(def, indexFound + 1) !== -1)\r\n\t\t\treturn obj //if found twice in call stack, cycle detected, skip validation\r\n\r\n\t\tobj = cast(obj, def)\r\n\r\n\t\tif (is(Model, def)) {\r\n\t\t\tdef[_validate](obj, path, errors, stack.concat(def))\r\n\t\t}\r\n\t\telse if (isPlainObject(def)) {\r\n\t\t\tObject.keys(def).map(key => {\r\n\t\t\t\tlet val = obj ? obj[_get] ? obj[_get](key) : obj[key] : undefined;\r\n\t\t\t\tcheckDefinition(val, def[key], formatPath(path, key), errors, stack)\r\n\t\t\t})\r\n\t\t}\r\n\t\telse {\r\n\t\t\tlet pdef = parseDefinition(def)\r\n\t\t\tif (pdef.some(part => checkDefinitionPart(obj, part, path, stack)))\r\n\t\t\t\treturn obj\r\n\r\n\t\t\tstackError(errors, def, obj, path)\r\n\t\t}\r\n\r\n\t\treturn obj\r\n\t},\r\n\r\n\tcheckDefinitionPart = (obj, def, path, stack) => {\r\n\t\tif (obj == null) return obj === def\r\n\t\tif (isPlainObject(def) || is(Model, def)) { // object or model as part of union type\r\n\t\t\tlet errors = []\r\n\t\t\tcheckDefinition(obj, def, path, errors, stack)\r\n\t\t\treturn !errors.length\r\n\t\t}\r\n\t\tif (is(RegExp, def)) return def.test(obj)\r\n\t\tif (def === Number || def === Date) return obj.constructor === def && !isNaN(obj)\r\n\t\treturn obj === def\r\n\t\t\t|| (isFunction(def) && is(def, obj))\r\n\t\t\t|| obj.constructor === def\r\n\t},\r\n\r\n\tcheckAssertions = (obj, model, path, errors = model.errors) => {\r\n\t\tfor (let assertion of model.assertions) {\r\n\t\t\tlet result\r\n\t\t\ttry {\r\n\t\t\t\tresult = assertion.call(model, obj)\r\n\t\t\t} catch (err) {\r\n\t\t\t\tresult = err\r\n\t\t\t}\r\n\t\t\tif (result !== true) {\r\n\t\t\t\tlet onFail = isFunction(assertion.description) ? assertion.description : (assertionResult, value) =>\r\n\t\t\t\t\t`assertion \"${assertion.description}\" returned ${format(assertionResult)} `\r\n\t\t\t\t\t+`for ${path ? path+\" =\" : \"value\"} ${format(value)}`\r\n\t\t\t\tstackError(errors, assertion, obj, path, onFail.call(model, result, obj, path))\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\r\n\tformat = (obj, stack = []) => {\r\n\t\tif (stack.length > 15 || stack.includes(obj)) return '...'\r\n\t\tif (obj === null || obj === undefined) return String(obj)\r\n\t\tif (typeof obj === 'string') return `\"${obj}\"`\r\n\t\tif (is(Model, obj)) return obj.toString(stack)\r\n\r\n\t\tstack.unshift(obj)\r\n\r\n\t\tif (isFunction(obj)) return obj.name || obj.toString()\r\n\t\tif (is(Map, obj) || is(Set, obj)) return format([...obj])\r\n\t\tif (Array.isArray(obj)) return `[${obj.map(item => format(item, stack)).join(', ')}]`\r\n\t\tif (obj.toString !== Object.prototype.toString) return obj.toString()\r\n\t\tif (obj && isObject(obj)) {\r\n\t\t\tlet props = Object.keys(obj),\r\n\t\t\t indent = '\\t'.repeat(stack.length)\r\n\t\t\treturn `{${props.map(\r\n\t\t\t\tkey => `\\n${indent + key}: ${format(obj[key], stack.slice())}`\r\n\t\t\t).join(',')} ${props.length ? `\\n${indent.slice(1)}` : ''}}`\r\n\t\t}\r\n\r\n\t\treturn String(obj)\r\n\t},\r\n\r\n\tformatPath = (path, key) => path ? path + '.' + key : key,\r\n\r\n\tcontrolMutation = (model, def, path, o, key, privateAccess, applyMutation) => {\r\n\t\tlet newPath = formatPath(path, key),\r\n\t\t isPrivate = model.conventionForPrivate(key),\r\n\t\t isConstant = model.conventionForConstant(key),\r\n\t\t isOwnProperty = has(o, key),\r\n\t\t initialPropDescriptor = isOwnProperty && Object.getOwnPropertyDescriptor(o, key)\r\n\r\n\t\tif (key in def && ((isPrivate && !privateAccess) || (isConstant && o[key] !== undefined)))\r\n\t\t\tcannot(`modify ${isPrivate ? \"private\" : \"constant\"} property ${key}`, model)\r\n\r\n\t\tlet isInDefinition = has(def, key);\r\n\t\tif (isInDefinition || !model.sealed) {\r\n\t\t\tapplyMutation(newPath)\r\n\t\t\tif (isInDefinition) checkDefinition(o[key], def[key], newPath, model.errors, [])\r\n\t\t\tcheckAssertions(o, model, newPath)\r\n\t\t}\r\n\t\telse rejectUndeclaredProp(newPath, o[key], model.errors)\r\n\r\n\t\tlet nbErrors = model.errors.length\r\n\t\tif (nbErrors) {\r\n\t\t\tif (isOwnProperty) Object.defineProperty(o, key, initialPropDescriptor)\r\n\t\t\telse delete o[key] // back to the initial property defined in prototype chain\r\n\r\n\t\t\tunstackErrors(model)\r\n\t\t}\r\n\r\n\t\treturn !nbErrors\r\n\t},\r\n\r\n\tcannot = (msg, model) => {\r\n\t\tmodel.errors.push({ message: \"cannot \" + msg })\r\n\t},\r\n\r\n\trejectUndeclaredProp = (path, received, errors) => {\r\n\t\terrors.push({\r\n\t\t\tpath,\r\n\t\t\treceived,\r\n\t\t\tmessage: `property ${path} is not declared in the sealed model definition`\r\n\t\t})\r\n\t},\r\n\r\n\tcast = (obj, defNode = []) => {\r\n\t\tif (!obj || isPlainObject(defNode) || isModelInstance(obj))\r\n\t\t\treturn obj // no value or not leaf or already a model instance\r\n\r\n\t\tlet def = parseDefinition(defNode),\r\n\t\t suitableModels = []\r\n\r\n\t\tfor (let part of def) {\r\n\t\t\tif (is(Model, part) && part.test(obj))\r\n\t\t\t\tsuitableModels.push(part)\r\n\t\t}\r\n\r\n\t\tif (suitableModels.length === 1) {\r\n\t\t\t// automatically cast to suitable model when explicit (duck typing)\r\n\t\t\tlet duck = suitableModels[0];\r\n\t\t\treturn is(ObjectModel, duck) ? new duck(obj) : duck(obj)\r\n\t\t}\r\n\r\n\t\tif (suitableModels.length > 1)\r\n\t\t\tconsole.warn(`Ambiguous model for value ${format(obj)}, could be ${suitableModels.join(\" or \")}`)\r\n\r\n\t\treturn obj\r\n\t},\r\n\r\n\tcheckUndeclaredProps = (obj, def, errors, path) => {\r\n\t\tObject.keys(obj).map(key => {\r\n\t\t\tlet val = obj[key],\r\n\t\t\t subpath = formatPath(path, key)\r\n\t\t\tif (!has(def, key)) rejectUndeclaredProp(subpath, val, errors)\r\n\t\t\telse if (isPlainObject(val))\tcheckUndeclaredProps(val, def[key], errors, subpath)\r\n\t\t})\r\n\t},\r\n\r\n\tgetProxy = (model, obj, def, path, privateAccess) => {\r\n\t\tif (!isPlainObject(def)) return cast(obj, def)\r\n\r\n\t\tconst grantTemporaryPrivateAccess = f => proxifyFn(f, (fn, ctx, args) => {\r\n\t\t\tprivateAccess = true;\r\n\t\t\tlet result = Reflect.apply(fn, ctx, args);\r\n\t\t\tprivateAccess = false;\r\n\t\t\treturn result\r\n\t\t})\r\n\r\n\t\treturn new Proxy(obj, {\r\n\r\n\t\t\tgetPrototypeOf: () => path ? Object.prototype : getProto(obj),\r\n\r\n\t\t\tget(o, key) {\r\n\t\t\t\tif (key === _original) return o\r\n\t\t\t\tif (key === _get) return grantTemporaryPrivateAccess(prop => o[prop])\r\n\r\n\t\t\t\tif (typeof key !== \"string\") return Reflect.get(o, key)\r\n\r\n\t\t\t\tlet newPath = formatPath(path, key),\r\n\t\t\t\t\tdefPart = def[key];\r\n\r\n\t\t\t\tif (!privateAccess && key in def && model.conventionForPrivate(key)) {\r\n\t\t\t\t\tcannot(`access to private property ${newPath}`, model)\r\n\t\t\t\t\tunstackErrors(model)\r\n\t\t\t\t\treturn\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (o[key] && has(o, key) && !isPlainObject(defPart) && !isModelInstance(o[key])) {\r\n\t\t\t\t\to[key] = cast(o[key], defPart) // cast nested models\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (isFunction(o[key]) && key !== \"constructor\") {\r\n\t\t\t\t\treturn grantTemporaryPrivateAccess(o[key])\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (isPlainObject(defPart) && !o[key]) {\r\n\t\t\t\t\to[key] = {} // null-safe traversal\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn getProxy(model, o[key], defPart, newPath, privateAccess)\r\n\t\t\t},\r\n\r\n\t\t\tset(o, key, val) {\r\n\t\t\t\treturn controlMutation(model, def, path, o, key, privateAccess,\r\n\t\t\t\t\tnewPath => Reflect.set(o, key, getProxy(model, val, def[key], newPath))\r\n\t\t\t\t)\r\n\t\t\t},\r\n\r\n\t\t\tdeleteProperty(o, key) {\r\n\t\t\t\treturn controlMutation(model, def, path, o, key, privateAccess, () => Reflect.deleteProperty(o, key))\r\n\t\t\t},\r\n\r\n\t\t\tdefineProperty(o, key, args) {\r\n\t\t\t\treturn controlMutation(model, def, path, o, key, privateAccess, () => Reflect.defineProperty(o, key, args))\r\n\t\t\t},\r\n\r\n\t\t\thas(o, key) {\r\n\t\t\t\treturn Reflect.has(o, key) && Reflect.has(def, key) && !model.conventionForPrivate(key)\r\n\t\t\t},\r\n\r\n\t\t\townKeys(o) {\r\n\t\t\t\treturn Reflect.ownKeys(o).filter(key => Reflect.has(def, key) && !model.conventionForPrivate(key))\r\n\t\t\t},\r\n\r\n\t\t\tgetOwnPropertyDescriptor(o, key) {\r\n\t\t\t\tlet descriptor;\r\n\t\t\t\tif (!model.conventionForPrivate(key)) {\r\n\t\t\t\t\tdescriptor = Object.getOwnPropertyDescriptor(def, key);\r\n\t\t\t\t\tif (descriptor !== undefined) descriptor.value = o[key];\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn descriptor\r\n\t\t\t}\r\n\t\t})\r\n\t}\r\n\r\n\r\nexport function Model(def, params) {\r\n\treturn isPlainObject(def) ? new ObjectModel(def, params) : new BasicModel(def)\r\n}\r\n\r\nObject.assign(Model.prototype, {\r\n\tname: \"Model\",\r\n\tassertions: [],\r\n\r\n\tconventionForConstant: key => key.toUpperCase() === key,\r\n\tconventionForPrivate: key => key[0] === \"_\",\r\n\r\n\ttoString(stack) {\r\n\t\treturn formatDefinition(this.definition, stack)\r\n\t},\r\n\r\n\tas(name) {\r\n\t\tdefine(this, \"name\", name);\r\n\t\treturn this\r\n\t},\r\n\r\n\tdefaultTo(val) {\r\n\t\tthis.default = val\r\n\t\treturn this\r\n\t},\r\n\r\n\t[_validate](obj, path, errors, stack) {\r\n\t\tcheckDefinition(obj, this.definition, path, errors, stack)\r\n\t\tcheckAssertions(obj, this, path, errors)\r\n\t},\r\n\r\n\tvalidate(obj, errorCollector) {\r\n\t\tthis[_validate](obj, null, this.errors, [])\r\n\t\treturn !unstackErrors(this, errorCollector)\r\n\t},\r\n\r\n\ttest(obj) {\r\n\t\tlet model = this;\r\n\t\twhile(!has(model, \"errorCollector\")) {\r\n\t\t\tmodel = getProto(model)\r\n\t\t}\r\n\r\n\t\tlet initialErrorCollector = model.errorCollector,\r\n\t\t failed;\r\n\r\n\t\tmodel.errorCollector = () => {\r\n\t\t\tfailed = true\r\n\t\t}\r\n\r\n\t\tnew this(obj) // may trigger this.errorCollector\r\n\r\n\t\tmodel.errorCollector = initialErrorCollector\r\n\t\treturn !failed\r\n\t},\r\n\r\n\terrorCollector(errors) {\r\n\t\tlet e = new TypeError(errors.map(e => e.message).join('\\n'))\r\n\t\te.stack = e.stack.replace(/\\n.*object-model(.|\\n)*object-model.*/, \"\") // blackbox objectmodel in stacktrace\r\n\t\tthrow e\r\n\t},\r\n\r\n\tassert(assertion, description = format(assertion)) {\r\n\t\tdefine(assertion, \"description\", description)\r\n\t\tthis.assertions = this.assertions.concat(assertion)\r\n\t\treturn this\r\n\t}\r\n})\r\n\r\n\r\nexport function BasicModel(def) {\r\n\tlet model = function (val = model.default) {\r\n\t\treturn model.validate(val) ? val : undefined\r\n\t}\r\n\r\n\tsetConstructor(model, BasicModel)\r\n\tinitModel(model, def)\r\n\treturn model\r\n}\r\n\r\nextend(BasicModel, Model, {\r\n\textend(...newParts) {\r\n\t\tlet child = extendModel(new BasicModel(extendDefinition(this.definition, newParts)), this)\r\n\t\tfor (let part of newParts) {\r\n\t\t\tif (is(BasicModel, part)) child.assertions.push(...part.assertions)\r\n\t\t}\r\n\r\n\t\treturn child\r\n\t}\r\n})\r\n\r\n\r\nexport function ObjectModel(def, params) {\r\n\tlet model = function (obj = model.default) {\r\n\t\tif (!is(model, this)) return new model(obj)\r\n\t\tif (is(model, obj)) return obj\r\n\r\n\t\tif (!is(Object, obj) && obj !== undefined) {\r\n\t\t\tstackError(model.errors, Object, obj);\r\n\t\t}\r\n\r\n\t\tmerge(this, model[_constructor](obj), true)\r\n\r\n\t\tif (!model.validate(this)) return\r\n\t\treturn getProxy(model, this, model.definition)\r\n\t}\r\n\r\n\tObject.assign(model, params)\r\n\textend(model, Object)\r\n\tsetConstructor(model, ObjectModel)\r\n\tinitModel(model, def)\r\n\treturn model\r\n}\r\n\r\nextend(ObjectModel, Model, {\r\n\tsealed: false,\r\n\r\n\tdefaults(p) {\r\n\t\tObject.assign(this.prototype, p)\r\n\t\treturn this\r\n\t},\r\n\r\n\ttoString(stack) {\r\n\t\treturn format(this.definition, stack)\r\n\t},\r\n\r\n\textend(...newParts) {\r\n\t\tlet def = Object.assign({}, this.definition),\r\n\t\t newAssertions = [],\r\n\t\t proto = {}\r\n\r\n\t\tmerge(proto, this.prototype, false)\r\n\r\n\t\tfor (let part of newParts) {\r\n\t\t\tif (is(Model, part)) {\r\n\t\t\t\tmerge(def, part.definition, true)\r\n\t\t\t\tnewAssertions.push(...part.assertions)\r\n\t\t\t}\r\n\t\t\tif (isFunction(part)) merge(proto, part.prototype, true)\r\n\t\t\tif (isObject(part)) merge(def, part, true)\r\n\t\t}\r\n\r\n\t\tlet submodel = extendModel(new ObjectModel(def), this, proto)\r\n\t\tsubmodel.assertions = [...this.assertions, ...newAssertions]\r\n\r\n\t\tif (getProto(this) !== ObjectModel.prototype) { // extended class\r\n\t\t\tsubmodel[_constructor] = (obj) => {\r\n\t\t\t\tlet parentInstance = new this(obj)\r\n\t\t\t\tmerge(obj, parentInstance, true) // get modified props from parent class constructor\r\n\t\t\t\treturn obj\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn submodel\r\n\t},\r\n\r\n\t[_constructor]: o => o,\r\n\r\n\t[_validate](obj, path, errors, stack) {\r\n\t\tif (isObject(obj)) {\r\n\t\t\tlet def = this.definition\r\n\t\t\tcheckDefinition(obj, def, path, errors, stack)\r\n\t\t\tif (this.sealed) checkUndeclaredProps(obj, def, errors)\r\n\t\t}\r\n\t\telse stackError(errors, this, obj, path)\r\n\r\n\t\tcheckAssertions(obj, this, path, errors)\r\n\t}\r\n})","import {_original, _validate, cast, checkAssertions, checkDefinition, extendDefinition, extendModel, formatDefinition, initModel, Model, stackError, unstackErrors} from \"./object-model.js\"\r\nimport {extend, isFunction, proxifyFn, proxifyModel, setConstructor} from \"./helpers.js\"\r\n\r\nlet ARRAY_MUTATORS = [\"pop\", \"push\", \"reverse\", \"shift\", \"sort\", \"splice\", \"unshift\"]\r\n\r\nexport default function ArrayModel(def) {\r\n\r\n\tlet model = function (array = model.default) {\r\n\t\tif (model.validate(array)) return proxifyModel(array, model, {\r\n\t\t\tget(arr, key) {\r\n\t\t\t\tif (key === _original) return arr\r\n\r\n\t\t\t\tlet val = arr[key];\r\n\t\t\t\treturn isFunction(val) ? proxifyFn(val, (fn, ctx, args) => {\r\n\t\t\t\t\tif (ARRAY_MUTATORS.includes(key)) {\r\n\t\t\t\t\t\tlet testArray = arr.slice()\r\n\t\t\t\t\t\tfn.apply(testArray, args)\r\n\t\t\t\t\t\tmodel.validate(testArray)\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tlet returnValue = fn.apply(arr, args)\r\n\t\t\t\t\tarray.forEach((a, i) => arr[i] = cast(a, model.definition))\r\n\t\t\t\t\treturn returnValue\r\n\t\t\t\t}) : val\r\n\t\t\t},\r\n\r\n\t\t\tset(arr, key, val) {\r\n\t\t\t\treturn setArrayKey(arr, key, val, model)\r\n\t\t\t},\r\n\r\n\t\t\tdeleteProperty(arr, key) {\r\n\t\t\t\treturn !(key in arr) || setArrayKey(arr, key, undefined, model)\r\n\t\t\t}\r\n\t\t})\r\n\t}\r\n\r\n\textend(model, Array)\r\n\tsetConstructor(model, ArrayModel)\r\n\tinitModel(model, def)\r\n\treturn model\r\n}\r\n\r\nextend(ArrayModel, Model, {\r\n\ttoString(stack) {\r\n\t\treturn 'Array of ' + formatDefinition(this.definition, stack)\r\n\t},\r\n\r\n\t[_validate](arr, path, errors, stack) {\r\n\t\tif (Array.isArray(arr))\r\n\t\t\tarr.forEach((a, i) => {\r\n\t\t\t\tarr[i] = checkDefinition(a, this.definition, `${path || \"Array\"}[${i}]`, errors, stack)\r\n\t\t\t})\r\n\t\telse stackError(errors, this, arr, path)\r\n\r\n\t\tcheckAssertions(arr, this, path, errors)\r\n\t},\r\n\r\n\textend(...newParts) {\r\n\t\treturn extendModel(new ArrayModel(extendDefinition(this.definition, newParts)), this)\r\n\t}\r\n})\r\n\r\nlet setArrayKey = (array, key, value, model) => {\r\n\tlet path = `Array[${key}]`;\r\n\tif (parseInt(key) === +key && key >= 0)\r\n\t\tvalue = checkDefinition(value, model.definition, path, model.errors, [])\r\n\r\n\tlet testArray = array.slice()\r\n\ttestArray[key] = value\r\n\tcheckAssertions(testArray, model, path)\r\n\tlet isSuccess = !unstackErrors(model)\r\n\tif (isSuccess) array[key] = value\r\n\treturn isSuccess\r\n}","import {_original, _validate, checkAssertions, checkDefinition, extendDefinition, extendModel, format, formatDefinition, initModel, Model, stackError, unstackErrors} from \"./object-model.js\"\r\nimport {extend, isFunction, proxifyModel, setConstructor} from \"./helpers.js\"\r\n\r\n\r\nexport default function FunctionModel(...argsDef) {\r\n\r\n\tlet model = function (fn = model.default) {\r\n\t\tif (!model.validate(fn)) return\r\n\t\treturn proxifyModel(fn, model, {\r\n\t\t\tget(fn, key) {\r\n\t\t\t\tif (key === _original) return fn\r\n\t\t\t\treturn fn[key]\r\n\t\t\t},\r\n\r\n\t\t\tapply (fn, ctx, args) {\r\n\t\t\t\tlet def = model.definition\r\n\r\n\t\t\t\tdef.arguments.forEach((argDef, i) => {\r\n\t\t\t\t\targs[i] = checkDefinition(args[i], argDef, `arguments[${i}]`, model.errors, [])\r\n\t\t\t\t})\r\n\r\n\t\t\t\tcheckAssertions(args, model, \"arguments\")\r\n\r\n\t\t\t\tlet result\r\n\t\t\t\tif (!model.errors.length) {\r\n\t\t\t\t\tresult = Reflect.apply(fn, ctx, args)\r\n\t\t\t\t\tif (\"return\" in def)\r\n\t\t\t\t\t\tresult = checkDefinition(result, def.return, \"return value\", model.errors, [])\r\n\t\t\t\t}\r\n\t\t\t\tunstackErrors(model)\r\n\t\t\t\treturn result\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\r\n\textend(model, Function)\r\n\tsetConstructor(model, FunctionModel)\r\n\tinitModel(model, {arguments: argsDef})\r\n\r\n\treturn model\r\n}\r\n\r\nextend(FunctionModel, Model, {\r\n\ttoString(stack = []) {\r\n\t\tlet out = `Function(${this.definition.arguments.map(\r\n\t\t\targDef => formatDefinition(argDef, stack.slice())\r\n\t\t).join(\", \")})`\r\n\r\n\t\tif (\"return\" in this.definition) {\r\n\t\t\tout += \" => \" + formatDefinition(this.definition.return, stack)\r\n\t\t}\r\n\t\treturn out\r\n\t},\r\n\r\n\treturn(def) {\r\n\t\tthis.definition.return = def\r\n\t\treturn this\r\n\t},\r\n\r\n\textend(newArgs, newReturns) {\r\n\t\tlet args = this.definition.arguments,\r\n\t\t mixedArgs = newArgs.map((a, i) => extendDefinition(i in args ? args[i] : [], newArgs[i])),\r\n\t\t mixedReturns = extendDefinition(this.definition.return, newReturns)\r\n\t\treturn extendModel(new FunctionModel(...mixedArgs).return(mixedReturns), this)\r\n\t},\r\n\r\n\t[_validate](f, path, errors) {\r\n\t\tif (!isFunction(f)) stackError(errors, \"Function\", f, path)\r\n\t}\r\n})\r\n\r\nFunctionModel.prototype.assert(function numberOfArgs(args) {\r\n\treturn (args.length > this.definition.arguments.length) ? args : true\r\n}, function (args) {\r\n\treturn `expecting ${this.definition.arguments.length} arguments for ${format(this)}, got ${args.length}`\r\n})","import {_original, _validate, cast, checkAssertions, checkDefinition, extendDefinition, extendModel, format, formatDefinition, initModel, Model, stackError} from \"./object-model.js\";\r\nimport {extend, is, isFunction, proxifyFn, proxifyModel, setConstructor} from \"./helpers.js\"\r\n\r\nlet MAP_MUTATORS = [\"set\", \"delete\", \"clear\"]\r\n\r\nexport default function MapModel(key, value) {\r\n\r\n\tlet model = function (iterable = model.default) {\r\n\t\tlet castKeyValue = pair => [\"key\", \"value\"].map((prop, i) => cast(pair[i], model.definition[prop])),\r\n\t\t map = new Map([...iterable].map(castKeyValue))\r\n\r\n\t\tif (!model.validate(map)) return\r\n\r\n\t\treturn proxifyModel(map, model, {\r\n\t\t\tget(map, key) {\r\n\t\t\t\tif (key === _original) return map\r\n\r\n\t\t\t\tlet val = map[key];\r\n\t\t\t\treturn isFunction(val) ? proxifyFn(val, (fn, ctx, args) => {\r\n\t\t\t\t\tif (key === \"set\") {\r\n\t\t\t\t\t\targs = castKeyValue(args)\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (MAP_MUTATORS.includes(key)) {\r\n\t\t\t\t\t\tlet testMap = new Map(map)\r\n\t\t\t\t\t\tfn.apply(testMap, args)\r\n\t\t\t\t\t\tmodel.validate(testMap)\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\treturn fn.apply(map, args)\r\n\t\t\t\t}) : val\r\n\t\t\t}\r\n\t\t})\r\n\t}\r\n\r\n\textend(model, Map)\r\n\tsetConstructor(model, MapModel)\r\n\tinitModel(model, {key, value})\r\n\treturn model\r\n}\r\n\r\nextend(MapModel, Model, {\r\n\ttoString(stack) {\r\n\t\tlet {key, value} = this.definition\r\n\t\treturn `Map of ${formatDefinition(key, stack)} : ${formatDefinition(value, stack)}`\r\n\t},\r\n\r\n\t[_validate](map, path, errors, stack) {\r\n\t\tif (is(Map, map)) {\r\n\t\t\tpath = path || 'Map'\r\n\t\t\tfor (let [key, value] of map) {\r\n\t\t\t\tcheckDefinition(key, this.definition.key, `${path} key`, errors, stack)\r\n\t\t\t\tcheckDefinition(value, this.definition.value, `${path}[${format(key)}]`, errors, stack)\r\n\t\t\t}\r\n\t\t} else stackError(errors, this, map, path)\r\n\r\n\t\tcheckAssertions(map, this, path, errors)\r\n\t},\r\n\r\n\textend(keyPart, valuePart) {\r\n\t\tlet {key, value} = this.definition\r\n\t\treturn extendModel(new MapModel(extendDefinition(key, keyPart), extendDefinition(value, valuePart)), this)\r\n\t}\r\n})","import {_original, _validate, cast, checkAssertions, checkDefinition, extendDefinition, extendModel, formatDefinition, initModel, Model, stackError} from \"./object-model.js\"\r\nimport {extend, is, isFunction, proxifyFn, proxifyModel, setConstructor} from \"./helpers.js\"\r\n\r\nlet SET_MUTATORS = [\"add\", \"delete\", \"clear\"]\r\n\r\nexport default function SetModel(def) {\r\n\r\n\tlet model = function (iterable = model.default) {\r\n\t\tlet castValue = val => cast(val, model.definition),\r\n\t\t set = new Set([...iterable].map(castValue))\r\n\r\n\t\tif (!model.validate(set)) return\r\n\r\n\t\treturn proxifyModel(set, model, {\r\n\t\t\tget(set, key) {\r\n\t\t\t\tif (key === _original) return set\r\n\r\n\t\t\t\tlet val = set[key]\r\n\t\t\t\treturn isFunction(val) ? proxifyFn(val, (fn, ctx, args) => {\r\n\t\t\t\t\tif (key === \"add\") {\r\n\t\t\t\t\t\targs[0] = castValue(args[0])\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (SET_MUTATORS.includes(key)) {\r\n\t\t\t\t\t\tlet testSet = new Set(set)\r\n\t\t\t\t\t\tfn.apply(testSet, args)\r\n\t\t\t\t\t\tmodel.validate(testSet)\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\treturn fn.apply(set, args)\r\n\t\t\t\t}) : val\r\n\t\t\t}\r\n\t\t})\r\n\t}\r\n\r\n\textend(model, Set)\r\n\tsetConstructor(model, SetModel)\r\n\tinitModel(model, def)\r\n\treturn model\r\n}\r\n\r\nextend(SetModel, Model, {\r\n\ttoString(stack) {\r\n\t\treturn \"Set of \" + formatDefinition(this.definition, stack)\r\n\t},\r\n\r\n\t[_validate](set, path, errors, stack) {\r\n\t\tif (is(Set, set)) {\r\n\t\t\tfor (let item of set.values()) {\r\n\t\t\t\tcheckDefinition(item, this.definition, `${path || \"Set\"} value`, errors, stack)\r\n\t\t\t}\r\n\t\t} else stackError(errors, this, set, path)\r\n\t\tcheckAssertions(set, this, path, errors)\r\n\t},\r\n\r\n\textend(...newParts) {\r\n\t\treturn extendModel(new SetModel(extendDefinition(this.definition, newParts)), this)\r\n\t}\r\n})"],"names":["getProto","x","Object","getPrototypeOf","setProto","p","setPrototypeOf","has","o","prop","hasOwnProperty","is","Constructor","obj","isFunction","f","isObject","isPlainObject","prototype","proxifyFn","fn","apply","Proxy","proxifyModel","val","model","traps","assign","merge","target","src","deep","key","define","value","enumerable","defineProperty","writable","configurable","setConstructor","constructor","extend","child","parent","props","create","_constructor","Symbol","_validate","_original","_get","initModel","def","definition","assertions","name","extendModel","newProps","push","stackError","errors","expected","received","path","message","unstackErrors","errorCollector","nbErrors","length","map","err","Array","isArray","d","format","join","toString","call","match","bettertypeof","isModelInstance","i","Model","parseDefinition","keys","undefined","formatDefinition","stack","parts","extendDefinition","newParts","reduce","ext","concat","slice","filter","index","self","indexOf","checkDefinition","indexFound","cast","formatPath","some","part","checkDefinitionPart","RegExp","test","Number","Date","isNaN","checkAssertions","assertion","result","onFail","description","assertionResult","includes","String","unshift","Map","Set","item","indent","repeat","controlMutation","privateAccess","applyMutation","newPath","isPrivate","conventionForPrivate","isConstant","conventionForConstant","isOwnProperty","initialPropDescriptor","getOwnPropertyDescriptor","cannot","isInDefinition","sealed","rejectUndeclaredProp","msg","defNode","suitableModels","duck","ObjectModel","console","warn","checkUndeclaredProps","subpath","getProxy","grantTemporaryPrivateAccess","ctx","args","Reflect","[object Object]","get","defPart","set","deleteProperty","ownKeys","descriptor","params","BasicModel","default","validate","this","toUpperCase","failed","initialErrorCollector","e","TypeError","replace","newAssertions","proto","submodel","parentInstance","ARRAY_MUTATORS","ArrayModel","array","arr","testArray","returnValue","forEach","a","setArrayKey","parseInt","isSuccess","FunctionModel","argsDef","arguments","argDef","return","Function","out","newArgs","newReturns","mixedArgs","mixedReturns","assert","MAP_MUTATORS","MapModel","iterable","castKeyValue","pair","testMap","keyPart","valuePart","SET_MUTATORS","SetModel","castValue","testSet","values"],"mappings":"mMAAO,MAENA,EAAeC,GAAKC,OAAOC,eAAeF,GAC1CG,EAAe,CAACH,EAAEI,IAAM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QiB,EAAW,OAAO4G,EAE9B,IAAIrI,EAAMqI,EAAI7H,GACd,OAAOlB,EAAWU,GAAOL,EAAUK,EAAK,CAACJ,EAAImI,EAAKC,KAKjD,GAJY,QAARxH,IACHwH,EAAK,GAAKyD,EAAUzD,EAAK,KAGtBuD,EAAa1F,SAASrF,GAAM,CAC/B,IAAIkL,EAAU,IAAIzF,IAAIoC,GACtBzI,EAAGC,MAAM6L,EAAS1D,GAClB/H,EAAM2I,SAAS8C,GAGhB,OAAO9L,EAAGC,MAAMwI,EAAKL,KACjBhI,MAQR,OAHAiB,EAAOhB,EAAOgG,KACdlF,EAAed,EAAOuL,GACtB7J,EAAU1B,EAAO2B,GACV3B,EAGRgB,EAAOuK,EAAU9H,GAChBwE,SAASnE,GACR,MAAO,UAAYD,EAAiB+E,KAAKhH,WAAYkC,IAGtDmE,CAAC1G,GAAW6G,EAAK9F,EAAMH,EAAQ2B,GAC9B,GAAI5E,EAAG8G,IAAKoC,GACX,IAAK,IAAInC,KAAQmC,EAAIsD,SACpBhH,EAAgBuB,EAAM2C,KAAKhH,cAAeU,GAAQ,cAAeH,EAAQ2B,QAEpE5B,EAAWC,EAAQyG,KAAMR,EAAK9F,GACrCgD,EAAgB8C,EAAKQ,KAAMtG,EAAMH,IAGlC8F,UAAUhE,GACT,OAAOlC,EAAY,IAAIwJ,EAASvH,EAAiB4E,KAAKhH,WAAYqC,IAAY2E"} \ No newline at end of file +{"version":3,"file":"object-model.min.js","sources":["../src/helpers.js","../src/object-model.js","../src/list-model.js","../src/array-model.js","../src/function-model.js","../src/map-model.js","../src/set-model.js"],"sourcesContent":["export const\n\tbettertypeof = x => Object.prototype.toString.call(x).match(/\\s([a-zA-Z]+)/)[1],\n\tgetProto = x => Object.getPrototypeOf(x),\n\tsetProto = (x, p) => Object.setPrototypeOf(x, p),\n\n\thas = (o, prop) => o.hasOwnProperty(prop),\n\tis = (Constructor, obj) => obj instanceof Constructor,\n\tisFunction = f => typeof f === \"function\",\n\tisObject = o => typeof o === \"object\",\n\tisPlainObject = o => o && isObject(o) && getProto(o) === Object.prototype,\n\tisIterable = x => x && isFunction(x[Symbol.iterator]),\n\n\tproxifyFn = (fn, apply) => new Proxy(fn, { apply }),\n\tproxifyModel = (val, model, traps) => new Proxy(val, Object.assign({ getPrototypeOf: () => model.prototype }, traps)),\n\n\tmerge = (target, src = {}, deep) => {\n\t\tfor (let key in src) {\n\t\t\tif (deep && isPlainObject(src[key])) {\n\t\t\t\tlet o = {}\n\t\t\t\tmerge(o, target[key], deep)\n\t\t\t\tmerge(o, src[key], deep)\n\t\t\t\ttarget[key] = o\n\t\t\t} else {\n\t\t\t\ttarget[key] = src[key]\n\t\t\t}\n\t\t}\n\t},\n\n\tdefine = (obj, key, value, enumerable = false) => {\n\t\tObject.defineProperty(obj, key, { value, enumerable, writable: true, configurable: true })\n\t},\n\n\tsetConstructor = (model, constructor) => {\n\t\tsetProto(model, constructor.prototype)\n\t\tdefine(model, \"constructor\", constructor)\n\t},\n\n\textend = (child, parent, props) => {\n\t\tchild.prototype = Object.assign(Object.create(parent.prototype, {\n\t\t\tconstructor: {\n\t\t\t\tvalue: child,\n\t\t\t\twritable: true,\n\t\t\t\tconfigurable: true\n\t\t\t}\n\t\t}), props)\n\t\tsetProto(child, parent)\n\t}","import {\n\tbettertypeof, define, extend, getProto, has, is, isFunction, isObject, isPlainObject,\n\tmerge, proxifyFn, setConstructor\n} from \"./helpers.js\"\n\nexport const\n\t_constructor = Symbol(),\n\t_validate = Symbol(),\n\t_original = Symbol(),\n\t_get = Symbol(), // used to bypass private access\n\n\tinitModel = (model, def) => {\n\t\tmodel.definition = def\n\t\tmodel.assertions = [...model.assertions]\n\t\tdefine(model, \"errors\", [])\n\t\tdelete model.name;\n\t},\n\n\textendModel = (child, parent, newProps) => {\n\t\textend(child, parent, newProps)\n\t\tchild.assertions.push(...parent.assertions)\n\t\treturn child\n\t},\n\n\tstackError = (errors, expected, received, path, message) => {\n\t\terrors.push({ expected, received, path, message })\n\t},\n\n\tunstackErrors = (model, errorCollector = model.errorCollector) => {\n\t\tlet nbErrors = model.errors.length\n\t\tif (nbErrors > 0) {\n\t\t\tlet errors = model.errors.map(err => {\n\t\t\t\tif (!err.message) {\n\t\t\t\t\tlet def = Array.isArray(err.expected) ? err.expected : [err.expected]\n\t\t\t\t\terr.message = \"expecting \" + (err.path ? err.path + \" to be \" : \"\") + def.map(d => format(d)).join(\" or \")\n\t\t\t\t\t\t+ \", got \" + (err.received != null ? bettertypeof(err.received) + \" \" : \"\") + format(err.received)\n\t\t\t\t}\n\t\t\t\treturn err\n\t\t\t})\n\t\t\tmodel.errors = []\n\t\t\terrorCollector.call(model, errors) // throw all errors collected\n\t\t}\n\t\treturn nbErrors\n\t},\n\n\tisModelInstance = i => i && is(Model, getProto(i).constructor),\n\n\tparseDefinition = (def) => {\n\t\tif (isPlainObject(def)) {\n\t\t\tObject.keys(def).map(key => { def[key] = parseDefinition(def[key]) })\n\t\t}\n\t\telse if (!Array.isArray(def)) return [def]\n\t\telse if (def.length === 1) return [...def, undefined, null]\n\n\t\treturn def\n\t},\n\n\tformatDefinition = (def, stack) => {\n\t\tlet parts = parseDefinition(def).map(d => format(d, stack));\n\t\treturn parts.length > 1 ? `(${parts.join(\" or \")})` : parts[0]\n\t},\n\n\textendDefinition = (def, newParts = []) => {\n\t\tif (!Array.isArray(newParts)) newParts = [newParts]\n\t\tif (newParts.length > 0) {\n\t\t\tdef = newParts\n\t\t\t\t.reduce((def, ext) => def.concat(ext), Array.isArray(def) ? [...def] : [def]) // clone to lose ref\n\t\t\t\t.filter((value, index, self) => self.indexOf(value) === index) // remove duplicates\n\t\t}\n\n\t\treturn def\n\t},\n\n\tcheckDefinition = (obj, def, path, errors, stack) => {\n\t\tlet indexFound = stack.indexOf(def)\n\t\tif (indexFound !== -1 && stack.indexOf(def, indexFound + 1) !== -1)\n\t\t\treturn obj //if found twice in call stack, cycle detected, skip validation\n\n\t\tobj = cast(obj, def)\n\n\t\tif (is(Model, def)) {\n\t\t\tdef[_validate](obj, path, errors, stack.concat(def))\n\t\t}\n\t\telse if (isPlainObject(def)) {\n\t\t\tObject.keys(def).map(key => {\n\t\t\t\tlet val = obj ? obj[_get] ? obj[_get](key) : obj[key] : undefined;\n\t\t\t\tcheckDefinition(val, def[key], formatPath(path, key), errors, stack)\n\t\t\t})\n\t\t}\n\t\telse {\n\t\t\tlet pdef = parseDefinition(def)\n\t\t\tif (pdef.some(part => checkDefinitionPart(obj, part, path, stack)))\n\t\t\t\treturn obj\n\n\t\t\tstackError(errors, def, obj, path)\n\t\t}\n\n\t\treturn obj\n\t},\n\n\tcheckDefinitionPart = (obj, def, path, stack) => {\n\t\tif (obj == null) return obj === def\n\t\tif (isPlainObject(def) || is(Model, def)) { // object or model as part of union type\n\t\t\tlet errors = []\n\t\t\tcheckDefinition(obj, def, path, errors, stack)\n\t\t\treturn !errors.length\n\t\t}\n\t\tif (is(RegExp, def)) return def.test(obj)\n\t\tif (def === Number || def === Date) return obj.constructor === def && !isNaN(obj)\n\t\treturn obj === def\n\t\t\t|| (isFunction(def) && is(def, obj))\n\t\t\t|| obj.constructor === def\n\t},\n\n\tcheckAssertions = (obj, model, path, errors = model.errors) => {\n\t\tfor (let assertion of model.assertions) {\n\t\t\tlet result\n\t\t\ttry {\n\t\t\t\tresult = assertion.call(model, obj)\n\t\t\t} catch (err) {\n\t\t\t\tresult = err\n\t\t\t}\n\t\t\tif (result !== true) {\n\t\t\t\tlet onFail = isFunction(assertion.description) ? assertion.description : (assertionResult, value) =>\n\t\t\t\t\t`assertion \"${assertion.description}\" returned ${format(assertionResult)} `\n\t\t\t\t\t+ `for ${path ? path + \" =\" : \"value\"} ${format(value)}`\n\t\t\t\tstackError(errors, assertion, obj, path, onFail.call(model, result, obj, path))\n\t\t\t}\n\t\t}\n\t},\n\n\tformat = (obj, stack = []) => {\n\t\tif (stack.length > 15 || stack.includes(obj)) return '...'\n\t\tif (obj === null || obj === undefined) return String(obj)\n\t\tif (typeof obj === 'string') return `\"${obj}\"`\n\t\tif (is(Model, obj)) return obj.toString(stack)\n\n\t\tstack.unshift(obj)\n\n\t\tif (isFunction(obj)) return obj.name || obj.toString()\n\t\tif (is(Map, obj) || is(Set, obj)) return format([...obj])\n\t\tif (Array.isArray(obj)) return `[${obj.map(item => format(item, stack)).join(', ')}]`\n\t\tif (obj.toString !== Object.prototype.toString) return obj.toString()\n\t\tif (obj && isObject(obj)) {\n\t\t\tlet props = Object.keys(obj),\n\t\t\t\tindent = '\\t'.repeat(stack.length)\n\t\t\treturn `{${props.map(\n\t\t\t\tkey => `\\n${indent + key}: ${format(obj[key], [...stack])}`\n\t\t\t).join(',')} ${props.length ? `\\n${indent.slice(1)}` : ''}}`\n\t\t}\n\n\t\treturn String(obj)\n\t},\n\n\tformatPath = (path, key) => path ? path + '.' + key : key,\n\n\tcontrolMutation = (model, def, path, o, key, privateAccess, applyMutation) => {\n\t\tlet newPath = formatPath(path, key),\n\t\t\tisPrivate = model.conventionForPrivate(key),\n\t\t\tisConstant = model.conventionForConstant(key),\n\t\t\tisOwnProperty = has(o, key),\n\t\t\tinitialPropDescriptor = isOwnProperty && Object.getOwnPropertyDescriptor(o, key)\n\n\t\tif (key in def && ((isPrivate && !privateAccess) || (isConstant && o[key] !== undefined)))\n\t\t\tcannot(`modify ${isPrivate ? \"private\" : \"constant\"} property ${key}`, model)\n\n\t\tlet isInDefinition = has(def, key);\n\t\tif (isInDefinition || !model.sealed) {\n\t\t\tapplyMutation(newPath)\n\t\t\tif (isInDefinition) checkDefinition(o[key], def[key], newPath, model.errors, [])\n\t\t\tcheckAssertions(o, model, newPath)\n\t\t}\n\t\telse rejectUndeclaredProp(newPath, o[key], model.errors)\n\n\t\tlet nbErrors = model.errors.length\n\t\tif (nbErrors) {\n\t\t\tif (isOwnProperty) Object.defineProperty(o, key, initialPropDescriptor)\n\t\t\telse delete o[key] // back to the initial property defined in prototype chain\n\n\t\t\tunstackErrors(model)\n\t\t}\n\n\t\treturn !nbErrors\n\t},\n\n\tcannot = (msg, model) => {\n\t\tmodel.errors.push({ message: \"cannot \" + msg })\n\t},\n\n\trejectUndeclaredProp = (path, received, errors) => {\n\t\terrors.push({\n\t\t\tpath,\n\t\t\treceived,\n\t\t\tmessage: `property ${path} is not declared in the sealed model definition`\n\t\t})\n\t},\n\n\tcast = (obj, defNode = []) => {\n\t\tif (!obj || isPlainObject(defNode) || isModelInstance(obj))\n\t\t\treturn obj // no value or not leaf or already a model instance\n\n\t\tlet def = parseDefinition(defNode),\n\t\t\tsuitableModels = []\n\n\t\tfor (let part of def) {\n\t\t\tif (is(Model, part) && part.test(obj))\n\t\t\t\tsuitableModels.push(part)\n\t\t}\n\n\t\tif (suitableModels.length === 1) {\n\t\t\t// automatically cast to suitable model when explicit (duck typing)\n\t\t\tlet duck = suitableModels[0];\n\t\t\treturn is(ObjectModel, duck) ? new duck(obj) : duck(obj)\n\t\t}\n\n\t\tif (suitableModels.length > 1)\n\t\t\tconsole.warn(`Ambiguous model for value ${format(obj)}, could be ${suitableModels.join(\" or \")}`)\n\n\t\treturn obj\n\t},\n\n\tcheckUndeclaredProps = (obj, def, errors, path) => {\n\t\tObject.keys(obj).map(key => {\n\t\t\tlet val = obj[key],\n\t\t\t\tsubpath = formatPath(path, key)\n\t\t\tif (!has(def, key)) rejectUndeclaredProp(subpath, val, errors)\n\t\t\telse if (isPlainObject(val)) checkUndeclaredProps(val, def[key], errors, subpath)\n\t\t})\n\t},\n\n\tgetProxy = (model, obj, def, path, privateAccess) => {\n\t\tif (!isPlainObject(def)) return cast(obj, def)\n\n\t\tconst grantTemporaryPrivateAccess = f => proxifyFn(f, (fn, ctx, args) => {\n\t\t\tprivateAccess = true;\n\t\t\tlet result = Reflect.apply(fn, ctx, args);\n\t\t\tprivateAccess = false;\n\t\t\treturn result\n\t\t})\n\n\t\treturn new Proxy(obj, {\n\n\t\t\tgetPrototypeOf: () => path ? Object.prototype : getProto(obj),\n\n\t\t\tget(o, key) {\n\t\t\t\tif (key === _original) return o\n\t\t\t\tif (key === _get) return grantTemporaryPrivateAccess(prop => o[prop])\n\n\t\t\t\tif (typeof key !== \"string\") return Reflect.get(o, key)\n\n\t\t\t\tlet newPath = formatPath(path, key),\n\t\t\t\t\tdefPart = def[key];\n\n\t\t\t\tif (!privateAccess && key in def && model.conventionForPrivate(key)) {\n\t\t\t\t\tcannot(`access to private property ${newPath}`, model)\n\t\t\t\t\tunstackErrors(model)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif (o[key] && has(o, key) && !isPlainObject(defPart) && !isModelInstance(o[key])) {\n\t\t\t\t\to[key] = cast(o[key], defPart) // cast nested models\n\t\t\t\t}\n\n\t\t\t\tif (isFunction(o[key]) && key !== \"constructor\") {\n\t\t\t\t\treturn grantTemporaryPrivateAccess(o[key])\n\t\t\t\t}\n\n\t\t\t\tif (isPlainObject(defPart) && !o[key]) {\n\t\t\t\t\to[key] = {} // null-safe traversal\n\t\t\t\t}\n\n\t\t\t\treturn getProxy(model, o[key], defPart, newPath, privateAccess)\n\t\t\t},\n\n\t\t\tset(o, key, val) {\n\t\t\t\treturn controlMutation(model, def, path, o, key, privateAccess,\n\t\t\t\t\tnewPath => Reflect.set(o, key, getProxy(model, val, def[key], newPath))\n\t\t\t\t)\n\t\t\t},\n\n\t\t\tdeleteProperty(o, key) {\n\t\t\t\treturn controlMutation(model, def, path, o, key, privateAccess, () => Reflect.deleteProperty(o, key))\n\t\t\t},\n\n\t\t\tdefineProperty(o, key, args) {\n\t\t\t\treturn controlMutation(model, def, path, o, key, privateAccess, () => Reflect.defineProperty(o, key, args))\n\t\t\t},\n\n\t\t\thas(o, key) {\n\t\t\t\treturn Reflect.has(o, key) && Reflect.has(def, key) && !model.conventionForPrivate(key)\n\t\t\t},\n\n\t\t\townKeys(o) {\n\t\t\t\treturn Reflect.ownKeys(o).filter(key => Reflect.has(def, key) && !model.conventionForPrivate(key))\n\t\t\t},\n\n\t\t\tgetOwnPropertyDescriptor(o, key) {\n\t\t\t\tlet descriptor;\n\t\t\t\tif (!model.conventionForPrivate(key)) {\n\t\t\t\t\tdescriptor = Object.getOwnPropertyDescriptor(def, key);\n\t\t\t\t\tif (descriptor !== undefined) descriptor.value = o[key];\n\t\t\t\t}\n\n\t\t\t\treturn descriptor\n\t\t\t}\n\t\t})\n\t}\n\n\nexport function Model(def, params) {\n\treturn isPlainObject(def) ? new ObjectModel(def, params) : new BasicModel(def)\n}\n\nObject.assign(Model.prototype, {\n\tname: \"Model\",\n\tassertions: [],\n\n\tconventionForConstant: key => key.toUpperCase() === key,\n\tconventionForPrivate: key => key[0] === \"_\",\n\n\ttoString(stack) {\n\t\treturn formatDefinition(this.definition, stack)\n\t},\n\n\tas(name) {\n\t\tdefine(this, \"name\", name);\n\t\treturn this\n\t},\n\n\tdefaultTo(val) {\n\t\tthis.default = val\n\t\treturn this\n\t},\n\n\t[_validate](obj, path, errors, stack) {\n\t\tcheckDefinition(obj, this.definition, path, errors, stack)\n\t\tcheckAssertions(obj, this, path, errors)\n\t},\n\n\tvalidate(obj, errorCollector) {\n\t\tthis[_validate](obj, null, this.errors, [])\n\t\treturn !unstackErrors(this, errorCollector)\n\t},\n\n\ttest(obj) {\n\t\tlet model = this;\n\t\twhile (!has(model, \"errorCollector\")) {\n\t\t\tmodel = getProto(model)\n\t\t}\n\n\t\tlet initialErrorCollector = model.errorCollector,\n\t\t\tfailed;\n\n\t\tmodel.errorCollector = () => {\n\t\t\tfailed = true\n\t\t}\n\n\t\tnew this(obj) // may trigger this.errorCollector\n\n\t\tmodel.errorCollector = initialErrorCollector\n\t\treturn !failed\n\t},\n\n\terrorCollector(errors) {\n\t\tlet e = new TypeError(errors.map(e => e.message).join('\\n'))\n\t\te.stack = e.stack.replace(/\\n.*object-model(.|\\n)*object-model.*/, \"\") // blackbox objectmodel in stacktrace\n\t\tthrow e\n\t},\n\n\tassert(assertion, description = format(assertion)) {\n\t\tdefine(assertion, \"description\", description)\n\t\tthis.assertions = this.assertions.concat(assertion)\n\t\treturn this\n\t}\n})\n\n\nexport function BasicModel(def) {\n\tlet model = function (val = model.default) {\n\t\treturn model.validate(val) ? val : undefined\n\t}\n\n\tsetConstructor(model, BasicModel)\n\tinitModel(model, def)\n\treturn model\n}\n\nextend(BasicModel, Model, {\n\textend(...newParts) {\n\t\tlet child = extendModel(new BasicModel(extendDefinition(this.definition, newParts)), this)\n\t\tfor (let part of newParts) {\n\t\t\tif (is(BasicModel, part)) child.assertions.push(...part.assertions)\n\t\t}\n\n\t\treturn child\n\t}\n})\n\n\nexport function ObjectModel(def, params) {\n\tlet model = function (obj = model.default) {\n\t\tif (!is(model, this)) return new model(obj)\n\t\tif (is(model, obj)) return obj\n\n\t\tif (!is(Object, obj) && obj !== undefined) {\n\t\t\tstackError(model.errors, Object, obj);\n\t\t}\n\n\t\tmerge(this, model[_constructor](obj), true)\n\n\t\tif (!model.validate(this)) return\n\t\treturn getProxy(model, this, model.definition)\n\t}\n\n\tObject.assign(model, params)\n\textend(model, Object)\n\tsetConstructor(model, ObjectModel)\n\tinitModel(model, def)\n\treturn model\n}\n\nextend(ObjectModel, Model, {\n\tsealed: false,\n\n\tdefaults(p) {\n\t\tObject.assign(this.prototype, p)\n\t\treturn this\n\t},\n\n\ttoString(stack) {\n\t\treturn format(this.definition, stack)\n\t},\n\n\textend(...newParts) {\n\t\tlet def = Object.assign({}, this.definition),\n\t\t\tnewAssertions = [],\n\t\t\tproto = {}\n\n\t\tmerge(proto, this.prototype, false)\n\n\t\tfor (let part of newParts) {\n\t\t\tif (is(Model, part)) {\n\t\t\t\tmerge(def, part.definition, true)\n\t\t\t\tnewAssertions.push(...part.assertions)\n\t\t\t}\n\t\t\tif (isFunction(part)) merge(proto, part.prototype, true)\n\t\t\tif (isObject(part)) merge(def, part, true)\n\t\t}\n\n\t\tlet submodel = extendModel(new ObjectModel(def), this, proto)\n\t\tsubmodel.assertions = [...this.assertions, ...newAssertions]\n\n\t\tif (getProto(this) !== ObjectModel.prototype) { // extended class\n\t\t\tsubmodel[_constructor] = (obj) => {\n\t\t\t\tlet parentInstance = new this(obj)\n\t\t\t\tmerge(obj, parentInstance, true) // get modified props from parent class constructor\n\t\t\t\treturn obj\n\t\t\t}\n\t\t}\n\n\t\treturn submodel\n\t},\n\n\t[_constructor]: o => o,\n\n\t[_validate](obj, path, errors, stack) {\n\t\tif (isObject(obj)) {\n\t\t\tlet def = this.definition\n\t\t\tcheckDefinition(obj, def, path, errors, stack)\n\t\t\tif (this.sealed) checkUndeclaredProps(obj, def, errors)\n\t\t}\n\t\telse stackError(errors, this, obj, path)\n\n\t\tcheckAssertions(obj, this, path, errors)\n\t}\n})","import { _original, initModel } from \"./object-model.js\"\nimport { extend, has, isFunction, proxifyFn, proxifyModel, setConstructor } from \"./helpers.js\"\n\nexport const initListModel = (base, constructor, def, init, clone, mutators, otherTraps = {}) => {\n\n\tlet model = function (list = model.default) {\n\t\tlist = init(list)\n\n\t\tif (model.validate(list)) return proxifyModel(list, model, Object.assign({\n\t\t\tget(l, key) {\n\t\t\t\tif (key === _original) return l\n\n\t\t\t\tlet val = l[key];\n\t\t\t\treturn isFunction(val) ? proxifyFn(val, (fn, ctx, args) => {\n\t\t\t\t\tif (has(mutators, key)) {\n\t\t\t\t\t\tif (mutators[key]) args = mutators[key](args) // autocast method args\n\n\t\t\t\t\t\tlet testingClone = clone(l)\n\t\t\t\t\t\tfn.apply(testingClone, args)\n\t\t\t\t\t\tmodel.validate(testingClone)\n\t\t\t\t\t}\n\n\t\t\t\t\treturn fn.apply(l, args)\n\t\t\t\t}) : val\n\t\t\t}\n\t\t}, otherTraps))\n\t}\n\n\textend(model, base)\n\tsetConstructor(model, constructor)\n\tinitModel(model, def)\n\treturn model\n}","import { _validate, cast, checkAssertions, checkDefinition, extendDefinition, extendModel, formatDefinition, Model, stackError, unstackErrors } from \"./object-model.js\"\nimport { extend } from \"./helpers.js\"\nimport { initListModel } from \"./list-model.js\";\n\nexport default function ArrayModel(def) {\n\tlet castAll = args => args.map(arg => cast(arg, def))\n\n\tlet model = initListModel(\n\t\tArray,\n\t\tArrayModel,\n\t\tdef,\n\t\ta => Array.isArray(a) ? castAll(a) : a,\n\t\ta => [...a],\n\t\t{\n\t\t\t\"copyWithin\": 0,\n\t\t\t\"fill\": ([val, ...rest]) => [cast(val, def), ...rest],\n\t\t\t\"pop\": 0,\n\t\t\t\"push\": castAll,\n\t\t\t\"reverse\": 0,\n\t\t\t\"shift\": 0,\n\t\t\t\"sort\": 0,\n\t\t\t\"splice\": ([start, end, ...vals]) => [start, end, ...castAll(vals)],\n\t\t\t\"unshift\": castAll,\n\t\t},\n\t\t{\n\t\t\tset(arr, key, val) {\n\t\t\t\treturn setArrayKey(arr, key, val, model)\n\t\t\t},\n\n\t\t\tdeleteProperty(arr, key) {\n\t\t\t\treturn !(key in arr) || setArrayKey(arr, key, undefined, model)\n\t\t\t}\n\t\t}\n\t)\n\n\treturn model\n}\n\nextend(ArrayModel, Model, {\n\ttoString(stack) {\n\t\treturn 'Array of ' + formatDefinition(this.definition, stack)\n\t},\n\n\t[_validate](arr, path, errors, stack) {\n\t\tif (Array.isArray(arr))\n\t\t\tarr.forEach((a, i) => {\n\t\t\t\tarr[i] = checkDefinition(a, this.definition, `${path || \"Array\"}[${i}]`, errors, stack)\n\t\t\t})\n\t\telse stackError(errors, this, arr, path)\n\n\t\tcheckAssertions(arr, this, path, errors)\n\t},\n\n\textend(...newParts) {\n\t\treturn extendModel(new ArrayModel(extendDefinition(this.definition, newParts)), this)\n\t}\n})\n\nlet setArrayKey = (array, key, value, model) => {\n\tlet path = `Array[${key}]`;\n\tif (parseInt(key) === +key && key >= 0)\n\t\tvalue = checkDefinition(value, model.definition, path, model.errors, [])\n\n\tlet testArray = [...array]\n\ttestArray[key] = value\n\tcheckAssertions(testArray, model, path)\n\tlet isSuccess = !unstackErrors(model)\n\tif (isSuccess) array[key] = value\n\treturn isSuccess\n}","import { _original, _validate, checkAssertions, checkDefinition, extendDefinition, extendModel, format, formatDefinition, initModel, Model, stackError, unstackErrors } from \"./object-model.js\"\nimport { extend, isFunction, proxifyModel, setConstructor } from \"./helpers.js\"\n\n\nexport default function FunctionModel(...argsDef) {\n\n\tlet model = function (fn = model.default) {\n\t\tif (!model.validate(fn)) return\n\t\treturn proxifyModel(fn, model, {\n\t\t\tget(fn, key) {\n\t\t\t\tif (key === _original) return fn\n\t\t\t\treturn fn[key]\n\t\t\t},\n\n\t\t\tapply(fn, ctx, args) {\n\t\t\t\tlet def = model.definition\n\n\t\t\t\tdef.arguments.forEach((argDef, i) => {\n\t\t\t\t\targs[i] = checkDefinition(args[i], argDef, `arguments[${i}]`, model.errors, [])\n\t\t\t\t})\n\n\t\t\t\tcheckAssertions(args, model, \"arguments\")\n\n\t\t\t\tlet result\n\t\t\t\tif (!model.errors.length) {\n\t\t\t\t\tresult = Reflect.apply(fn, ctx, args)\n\t\t\t\t\tif (\"return\" in def)\n\t\t\t\t\t\tresult = checkDefinition(result, def.return, \"return value\", model.errors, [])\n\t\t\t\t}\n\t\t\t\tunstackErrors(model)\n\t\t\t\treturn result\n\t\t\t}\n\t\t});\n\t}\n\n\textend(model, Function)\n\tsetConstructor(model, FunctionModel)\n\tinitModel(model, { arguments: argsDef })\n\n\treturn model\n}\n\nextend(FunctionModel, Model, {\n\ttoString(stack = []) {\n\t\tlet out = `Function(${this.definition.arguments.map(\n\t\t\targDef => formatDefinition(argDef, [...stack])\n\t\t).join(\", \")})`\n\n\t\tif (\"return\" in this.definition) {\n\t\t\tout += \" => \" + formatDefinition(this.definition.return, stack)\n\t\t}\n\t\treturn out\n\t},\n\n\treturn(def) {\n\t\tthis.definition.return = def\n\t\treturn this\n\t},\n\n\textend(newArgs, newReturns) {\n\t\tlet args = this.definition.arguments,\n\t\t\tmixedArgs = newArgs.map((a, i) => extendDefinition(i in args ? args[i] : [], newArgs[i])),\n\t\t\tmixedReturns = extendDefinition(this.definition.return, newReturns)\n\t\treturn extendModel(new FunctionModel(...mixedArgs).return(mixedReturns), this)\n\t},\n\n\t[_validate](f, path, errors) {\n\t\tif (!isFunction(f)) stackError(errors, \"Function\", f, path)\n\t}\n})\n\nFunctionModel.prototype.assert(function numberOfArgs(args) {\n\treturn (args.length > this.definition.arguments.length) ? args : true\n}, function (args) {\n\treturn `expecting ${this.definition.arguments.length} arguments for ${format(this)}, got ${args.length}`\n})","import { _validate, cast, checkAssertions, checkDefinition, extendDefinition, extendModel, format, formatDefinition, Model, stackError } from \"./object-model.js\";\nimport { initListModel } from \"./list-model.js\"\nimport { extend, is, isIterable } from \"./helpers.js\"\n\nexport default function MapModel(key, value) {\n\n\tlet castKeyValue = ([k, v]) => [cast(k, key), cast(v, value)]\n\n\treturn initListModel(\n\t\tMap,\n\t\tMapModel,\n\t\t{ key, value },\n\t\tit => isIterable(it) ? new Map([...it].map(castKeyValue)) : it,\n\t\tmap => new Map(map),\n\t\t{\n\t\t\t\"set\": castKeyValue,\n\t\t\t\"delete\": 0,\n\t\t\t\"clear\": 0\n\t\t}\n\t)\n}\n\nextend(MapModel, Model, {\n\ttoString(stack) {\n\t\tlet { key, value } = this.definition\n\t\treturn `Map of ${formatDefinition(key, stack)} : ${formatDefinition(value, stack)}`\n\t},\n\n\t[_validate](map, path, errors, stack) {\n\t\tif (is(Map, map)) {\n\t\t\tpath = path || 'Map'\n\t\t\tfor (let [key, value] of map) {\n\t\t\t\tcheckDefinition(key, this.definition.key, `${path} key`, errors, stack)\n\t\t\t\tcheckDefinition(value, this.definition.value, `${path}[${format(key)}]`, errors, stack)\n\t\t\t}\n\t\t} else stackError(errors, this, map, path)\n\n\t\tcheckAssertions(map, this, path, errors)\n\t},\n\n\textend(keyPart, valuePart) {\n\t\tlet { key, value } = this.definition\n\t\treturn extendModel(new MapModel(extendDefinition(key, keyPart), extendDefinition(value, valuePart)), this)\n\t}\n})","import { _validate, cast, checkAssertions, checkDefinition, extendDefinition, extendModel, formatDefinition, Model, stackError } from \"./object-model.js\"\nimport { initListModel } from \"./list-model.js\"\nimport { extend, is, isIterable } from \"./helpers.js\"\n\nexport default function SetModel(def) {\n\treturn initListModel(\n\t\tSet,\n\t\tSetModel,\n\t\tdef,\n\t\tit => isIterable(it) ? new Set([...it].map(val => cast(val, def))) : it,\n\t\tset => new Set(set),\n\t\t{\n\t\t\t\"add\": ([val]) => [cast(val, def)],\n\t\t\t\"delete\": 0,\n\t\t\t\"clear\": 0\n\t\t}\n\t)\n}\n\nextend(SetModel, Model, {\n\ttoString(stack) {\n\t\treturn \"Set of \" + formatDefinition(this.definition, stack)\n\t},\n\n\t[_validate](set, path, errors, stack) {\n\t\tif (is(Set, set)) {\n\t\t\tfor (let item of set.values()) {\n\t\t\t\tcheckDefinition(item, this.definition, `${path || \"Set\"} value`, errors, stack)\n\t\t\t}\n\t\t} else stackError(errors, this, set, path)\n\t\tcheckAssertions(set, this, path, errors)\n\t},\n\n\textend(...newParts) {\n\t\treturn extendModel(new SetModel(extendDefinition(this.definition, newParts)), this)\n\t}\n})"],"names":["getProto","x","Object","getPrototypeOf","setProto","p","setPrototypeOf","has","o","prop","hasOwnProperty","is","Constructor","obj","isFunction","f","isObject","isPlainObject","prototype","isIterable","Symbol","iterator","proxifyFn","fn","apply","Proxy","proxifyModel","val","model","traps","assign","merge","target","src","deep","key","define","value","enumerable","defineProperty","writable","configurable","setConstructor","constructor","extend","child","parent","props","create","_constructor","_validate","_original","_get","initModel","def","definition","assertions","name","extendModel","newProps","push","stackError","errors","expected","received","path","message","unstackErrors","errorCollector","nbErrors","length","map","err","Array","isArray","d","format","join","toString","call","match","bettertypeof","isModelInstance","i","Model","parseDefinition","keys","undefined","formatDefinition","stack","parts","extendDefinition","newParts","reduce","ext","concat","filter","index","self","indexOf","checkDefinition","indexFound","cast","formatPath","some","part","checkDefinitionPart","RegExp","test","Number","Date","isNaN","checkAssertions","assertion","result","onFail","description","assertionResult","includes","String","unshift","Map","Set","item","indent","repeat","slice","controlMutation","privateAccess","applyMutation","newPath","isPrivate","conventionForPrivate","isConstant","conventionForConstant","isOwnProperty","initialPropDescriptor","getOwnPropertyDescriptor","cannot","isInDefinition","sealed","rejectUndeclaredProp","msg","defNode","suitableModels","duck","ObjectModel","console","warn","checkUndeclaredProps","subpath","getProxy","grantTemporaryPrivateAccess","ctx","args","Reflect","[object Object]","get","defPart","set","deleteProperty","ownKeys","descriptor","params","BasicModel","default","validate","this","toUpperCase","failed","initialErrorCollector","e","TypeError","replace","newAssertions","proto","submodel","parentInstance","initListModel","base","init","clone","mutators","otherTraps","list","l","testingClone","ArrayModel","castAll","arg","a","copyWithin","fill","rest","pop","reverse","shift","sort","splice","start","end","vals","arr","setArrayKey","forEach","array","parseInt","testArray","isSuccess","FunctionModel","argsDef","arguments","argDef","return","Function","MapModel","castKeyValue","k","v","it","delete","clear","SetModel","add","out","newArgs","newReturns","mixedArgs","mixedReturns","assert","keyPart","valuePart","values"],"mappings":"mMAAO,MAENA,EAAWC,GAAKC,OAAOC,eAAeF,GACtCG,EAAW,CAACH,EAAGI,IAAMH,OAAOI,eAAeL,EAAGI,GAE9CE,EAAM,CAACC,EAAGC,IAASD,EAAEE,eAAeD,GACpCE,EAAK,CAACC,EAAaC,IAAQA,aAAeD,EAC1CE,EAAaC,GAAkB,mBAANA,EACzBC,EAAWR,GAAkB,iBAANA,EACvBS,EAAgBT,GAAKA,GAAKQ,EAASR,IAAMR,EAASQ,KAAON,OAAOgB,UAChEC,EAAalB,GAAKA,GAAKa,EAAWb,EAAEmB,OAAOC,WAE3CC,EAAY,CAACC,EAAIC,IAAU,IAAIC,MAAMF,GAAMC,MAAAA,IAC3CE,EAAe,CAACC,EAAKC,EAAOC,IAAU,IAAIJ,MAAME,EAAKzB,OAAO4B,QAAS3B,eAAgB,IAAMyB,EAAMV,WAAaW,IAE9GE,EAAQ,CAACC,EAAQC,KAAUC,KAC1B,IAAK,IAAIC,KAAOF,EACf,GAAIC,GAAQjB,EAAcgB,EAAIE,IAAO,CACpC,IAAI3B,KACJuB,EAAMvB,EAAGwB,EAAOG,GAAMD,GACtBH,EAAMvB,EA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B,EAAKN,EAAMH,EAAQ2B,GAC9B,GAAI9E,EAAG8G,IAAKlD,GAAM,CACjBN,EAAOA,GAAQ,MACf,IAAK,IAAK9B,EAAKE,KAAUkC,EACxB6B,EAAgBjE,EAAKoI,KAAKhH,WAAWpB,OAAQ8B,QAAYH,EAAQ2B,GACjEW,EAAgB/D,EAAOkI,KAAKhH,WAAWlB,SAAU4B,KAAQW,EAAOzC,MAAS2B,EAAQ2B,QAE5E5B,EAAWC,EAAQyG,KAAMhG,EAAKN,GAErC+C,EAAgBzC,EAAKgG,KAAMtG,EAAMH,IAGlC8F,OAAO0E,EAASC,GACf,IAAIpM,IAAEA,EAAGE,MAAEA,GAAUkI,KAAKhH,WAC1B,OAAOG,EAAY,IAAI6J,EAAS5H,EAAiBxD,EAAKmM,GAAU3I,EAAiBtD,EAAOkM,IAAahE,SCvBvG3H,EAAOkL,EAAU1I,GAChBwE,SAASnE,GACR,MAAO,UAAYD,EAAiB+E,KAAKhH,WAAYkC,IAGtDmE,CAAC1G,GAAW6G,EAAK9F,EAAMH,EAAQ2B,GAC9B,GAAI9E,EAAG+G,IAAKqC,GACX,IAAK,IAAIpC,KAAQoC,EAAIyE,SACpBpI,EAAgBuB,EAAM4C,KAAKhH,cAAeU,GAAQ,cAAeH,EAAQ2B,QAEpE5B,EAAWC,EAAQyG,KAAMR,EAAK9F,GACrC+C,EAAgB+C,EAAKQ,KAAMtG,EAAMH,IAGlC8F,UAAUhE,GACT,OAAOlC,EAAY,IAAIoK,EAASnI,EAAiB4E,KAAKhH,WAAYqC,IAAY2E"} \ No newline at end of file diff --git a/index.html b/index.html index c2d38d6..e95258a 100644 --- a/index.html +++ b/index.html @@ -128,7 +128,7 @@

What's inside the box ?

Download

-

Current version: v3.5.4

+

Current version: v3.6.0

diff --git a/package-lock.json b/package-lock.json index be99c58..1c3ccff 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "objectmodel", - "version": "3.5.4", + "version": "3.6.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -31,9 +31,9 @@ "dev": true }, "@types/node": { - "version": "10.5.4", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.5.4.tgz", - "integrity": "sha512-8TqvB0ReZWwtcd3LXq3YSrBoLyXFgBX/sBZfGye9+YS8zH7/g+i6QRIuiDmwBoTzcQ/pk89nZYTYU4c5akKkzw==", + "version": "10.5.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.5.5.tgz", + "integrity": "sha512-6Qnb1gXbp3g1JX9QVJj3A6ORzc9XCyhokxUKaoonHgNXcQhmk8adhotxfkeK8El9TnFeUuH72yI6jQ5nDJKS6w==", "dev": true }, "acorn": { @@ -3142,9 +3142,9 @@ } }, "rollup": { - "version": "0.63.4", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-0.63.4.tgz", - "integrity": "sha512-IGTH7u0P6bmu7cXL0g11UDYTR9WKku70cYlqVyOYdqLoQopBGmCbGC3SMeheqHymnehHe/5yf6BJ6BEoxQBVTQ==", + "version": "0.63.5", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-0.63.5.tgz", + "integrity": "sha512-dFf8LpUNzIj3oE0vCvobX6rqOzHzLBoblyFp+3znPbjiSmSvOoK2kMKx+Fv9jYduG1rvcCfCveSgEaQHjWRF6g==", "dev": true, "requires": { "@types/estree": "0.0.39", @@ -3872,4 +3872,4 @@ } } } -} +} \ No newline at end of file