Advertisement
Guest User

Untitled

a guest
Dec 22nd, 2019
381
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ! function(e, t) {
  2.   if ("object" == typeof exports && "object" == typeof module) module.exports = t();
  3.   else if ("function" == typeof define && define.amd) define([], t);
  4.   else {
  5.     var r = t();
  6.     for (var a in r)("object" == typeof exports ? exports : e)[a] = r[a]
  7.   }
  8. }(global, (function() {
  9.   return function(e) {
  10.     var t = {};
  11.  
  12.     function r(a) {
  13.       if (t[a]) return t[a].exports;
  14.       var i = t[a] = {
  15.         i: a,
  16.         l: !1,
  17.         exports: {}
  18.       };
  19.       return e[a].call(i.exports, i, i.exports, r), i.l = !0, i.exports
  20.     }
  21.     return r.m = e, r.c = t, r.d = function(e, t, a) {
  22.       r.o(e, t) || Object.defineProperty(e, t, {
  23.         enumerable: !0,
  24.         get: a
  25.       })
  26.     }, r.r = function(e) {
  27.       "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, {
  28.         value: "Module"
  29.       }), Object.defineProperty(e, "__esModule", {
  30.         value: !0
  31.       })
  32.     }, r.t = function(e, t) {
  33.       if (1 & t && (e = r(e)), 8 & t) return e;
  34.       if (4 & t && "object" == typeof e && e && e.__esModule) return e;
  35.       var a = Object.create(null);
  36.       if (r.r(a), Object.defineProperty(a, "default", {
  37.           enumerable: !0,
  38.           value: e
  39.         }), 2 & t && "string" != typeof e)
  40.         for (var i in e) r.d(a, i, function(t) {
  41.           return e[t]
  42.         }.bind(null, i));
  43.       return a
  44.     }, r.n = function(e) {
  45.       var t = e && e.__esModule ? function() {
  46.         return e.default
  47.       } : function() {
  48.         return e
  49.       };
  50.       return r.d(t, "a", t), t
  51.     }, r.o = function(e, t) {
  52.       return Object.prototype.hasOwnProperty.call(e, t)
  53.     }, r.p = "", r(r.s = 1)
  54.   }([function(e, t, r) {
  55.     window,
  56.     e.exports = function(e) {
  57.       var t = {};
  58.  
  59.       function r(a) {
  60.         if (t[a]) return t[a].exports;
  61.         var i = t[a] = {
  62.           i: a,
  63.           l: !1,
  64.           exports: {}
  65.         };
  66.         return e[a].call(i.exports, i, i.exports, r), i.l = !0, i.exports
  67.       }
  68.       return r.m = e, r.c = t, r.d = function(e, t, a) {
  69.         r.o(e, t) || Object.defineProperty(e, t, {
  70.           enumerable: !0,
  71.           get: a
  72.         })
  73.       }, r.r = function(e) {
  74.         "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, {
  75.           value: "Module"
  76.         }), Object.defineProperty(e, "__esModule", {
  77.           value: !0
  78.         })
  79.       }, r.t = function(e, t) {
  80.         if (1 & t && (e = r(e)), 8 & t) return e;
  81.         if (4 & t && "object" == typeof e && e && e.__esModule) return e;
  82.         var a = Object.create(null);
  83.         if (r.r(a), Object.defineProperty(a, "default", {
  84.             enumerable: !0,
  85.             value: e
  86.           }), 2 & t && "string" != typeof e)
  87.           for (var i in e) r.d(a, i, function(t) {
  88.             return e[t]
  89.           }.bind(null, i));
  90.         return a
  91.       }, r.n = function(e) {
  92.         var t = e && e.__esModule ? function() {
  93.           return e.default
  94.         } : function() {
  95.           return e
  96.         };
  97.         return r.d(t, "a", t), t
  98.       }, r.o = function(e, t) {
  99.         return Object.prototype.hasOwnProperty.call(e, t)
  100.       }, r.p = "", r(r.s = 0)
  101.     }([function(e, t, r) {
  102.       "use strict";
  103.  
  104.       function a(e) {
  105.         return e.replace(/\\/gu, "/")
  106.       }
  107.  
  108.       function i(e) {
  109.         return e.replace(/<br\s*\/*>/gu, "\n")
  110.       }
  111.  
  112.       function n(e) {
  113.         return e.replace(/\r?\n/gu, "<br />")
  114.       }
  115.       r.r(t);
  116.       const o = /^[A-Z]:(?:[\\/][a-z0-9\s_@\-^!#$%&+={}[\]]+)+$/u,
  117.         c = /^[A-Z]:(?:[\\/][a-z0-9\s_@\-^!#$%&+={}[\]]+)*[\\/](?:[a-z0-9\s_@\-^!#$%&+={}[\]]+)?(?:\.[0-9a-z]+)+$/u;
  118.  
  119.       function s(e) {
  120.         return o.test(e)
  121.       }
  122.  
  123.       function l(e) {
  124.         return c.test(e)
  125.       }
  126.  
  127.       function u(e) {
  128.         return o.test(e) || c.test(e)
  129.       }
  130.  
  131.       function p(e) {
  132.         return /[/\\]_(?:[^/|\\]*)$/u.test(e)
  133.       }
  134.  
  135.       function d(e, t) {
  136.         const r = e.indexOf(t),
  137.           a = Array.from(e);
  138.         return r > -1 ? (a.splice(r, 1), a) : a
  139.       }
  140.  
  141.       function f(e, t) {
  142.         const r = e.indexOf(t); - 1 !== r && e.splice(r, 1)
  143.       }
  144.  
  145.       function g(e, t) {
  146.         const r = e.findIndex(t),
  147.           a = Array.from(e);
  148.         return r > -1 ? (a.splice(r, 1), a) : a
  149.       }
  150.  
  151.       function y(e, t) {
  152.         const r = e.findIndex(t); - 1 !== r && e.splice(r, 1)
  153.       }
  154.  
  155.       function b(e) {
  156.         return "number" == typeof e
  157.       }
  158.  
  159.       function P(e) {
  160.         return "number" == typeof e && /^-?\d+\.\d+$/u.test(e.toString())
  161.       }
  162.  
  163.       function O(e) {
  164.         return "number" == typeof e && /^\d+\.\d+$/u.test(e.toString())
  165.       }
  166.  
  167.       function E(e) {
  168.         return "number" == typeof e && /^-\d+\.\d+$/u.test(e.toString())
  169.       }
  170.  
  171.       function D(e) {
  172.         return "string" == typeof e
  173.       }
  174.  
  175.       function N(e) {
  176.         return "string" == typeof e && e.length > 0
  177.       }
  178.  
  179.       function m(e) {
  180.         return "boolean" == typeof e
  181.       }
  182.  
  183.       function v(e) {
  184.         return "object" == typeof e
  185.       }
  186.  
  187.       function S(e) {
  188.         return !!Array.isArray(e) && e.length > 0
  189.       }
  190.  
  191.       function A(e, t) {
  192.         return !!Array.isArray(e) && e.length === t
  193.       }
  194.  
  195.       function j(e, t, r) {
  196.         return !!Array.isArray(e) && e.length <= t && e.length >= r
  197.       }
  198.  
  199.       function h(e) {
  200.         let t = !0;
  201.         for (const r of e)
  202.           if ("string" != typeof r) {
  203.             t = !1;
  204.             break
  205.           } return t
  206.       }
  207.  
  208.       function I(e) {
  209.         return void 0 === e
  210.       }
  211.       const V = e => e;
  212.       class T {
  213.         static createSubstituteBasedOnDataSpecification(e) {
  214.           const t = {};
  215.           for (const [r, a] of Object.entries(e.properties)) t[r] = a.invalidValueSubstitution;
  216.           return t
  217.         }
  218.       }
  219.       var _;
  220.       ! function(e) {
  221.         let t, r;
  222.         ! function(e) {
  223.           e.NUMBER = "数(number)", e.STRING = "文字列(string)", e.BOOLEAN = "ブーリアン(boolean)", e.NESTED_OBJECT = "オブジェクト(object)", e.ARRAY_OF_OBJECTS = "オブジェクトの配列(Array<object>)"
  224.         }(t = e.PROPERTIES_TYPES || (e.PROPERTIES_TYPES = {})),
  225.         function(e) {
  226.           e.NATURAL_NUMBER = "自然数", e.NON_NEGATIVE_INTEGER = "非負整数", e.ANY_INTEGER = "陽負不問整数", e.POSITIVE_DECIMAL_FRACTION = "陽号少数", e.NEGATIVE_DECIMAL_FRACTION = "負号少数", e.DECIMAL_FRACTION_OF_ANY_SIGN = "陽負不問少数", e.ANY_REAL_NUMBER = "実数"
  227.         }(r = e.NUMBER_TYPES || (e.NUMBER_TYPES = {}))
  228.       }(_ || (_ = {}));
  229.       var M = _,
  230.         w = {
  231.           rawDataIsNotObject: (e, t) => `データ:「${t.nameForLogging}」の型は"object"ではなく、${typeof e}と成っている。\n` + `値:${e}`,
  232.           rawDataIsObjectButUnexpectedlyArray: (e, t) => `データ:「${t.nameForLogging}」の型は"object"だが、ECMAScriptの配列と成っている。` + "'ObjectDataValidator'は配列専用ではないが、配列を検問する事が必要な場合、'ExternalArrayedDataValidator'を御利用。\n" + `値:${e}`,
  233.           requiredPropertyMissing: ({
  234.             targetPropertyObjectPath: e,
  235.             targetPropertyNewName: t,
  236.             targetPropertySpecification: r,
  237.             fullDataSpecification: a
  238.           }) => `データー:「${a.nameForLogging}」、プロパティ:「${t}」(以前名:「` + `${e}」)は必須だと指定してあるが、実際値は「undefined」と成っている。プロパティ仕様:\n` + `${JSON.stringify(r,null,2)}`,
  239.           nonNullablePropertyValueIsNull: ({
  240.             targetPropertyObjectPath: e,
  241.             targetPropertyNewName: t,
  242.             targetPropertySpecification: r,
  243.             fullDataSpecification: a
  244.           }) => `データー:「${a.nameForLogging}」、プロパティ:「${t}」(以前名:「` + `${e}」)は'null'に成っているが、'null'が仕様に許可されていない:プロパティ仕様:\n` + `${r}`,
  245.           propertyValueTypeDoesNotMatchWithExpected: ({
  246.             targetPropertyObjectPath: e,
  247.             targetPropertyNewName: t,
  248.             targetPropertyValue: r,
  249.             targetPropertySpecification: a,
  250.             fullDataSpecification: i
  251.           }) => `データー:「${i.nameForLogging}」、プロパティ:「${e}」(新名:「` + `${t}」)の型は「${a.type}」だと期待された、` + `事実上「${typeof r}」に成っている。`,
  252.           propertyValueIsEmptyStringAlthoughEmptyStringIsNotAllowed: ({
  253.             targetPropertyObjectPath: e,
  254.             targetPropertyNewName: t,
  255.             targetPropertySpecification: r,
  256.             fullDataSpecification: a
  257.           }) => `データー:「${a.nameForLogging}」、プロパティ:「${e}」(新名:「` + `${t}」)の型は文字列と成っているが、仕様上空文字列は許可されていない:\n${r}`,
  258.           propertyValueIsNotAmongAllowedOnes: ({
  259.             targetPropertyObjectPath: e,
  260.             targetPropertyNewName: t,
  261.             targetPropertyValue: r,
  262.             targetPropertySpecification: a,
  263.             fullDataSpecification: i
  264.           }) => `データー:「${i.nameForLogging}」、プロパティ:「${e}」(新名:「` + `${t}」)の値:「${r}」は許可されている値の中には無い。\n${a}`,
  265.           propertyValueDoesNotMatchWithRegularExpression: ({
  266.             targetPropertyObjectPath: e,
  267.             targetPropertyNewName: t,
  268.             targetPropertyValue: r,
  269.             targetPropertySpecification: a,
  270.             fullDataSpecification: i
  271.           }) => `データー:「${i.nameForLogging}」、プロパティ:「${e}」(新名:「` + `${t}」)の値:「${r}」は正規表現:` + `「${a.mustMatchRegularExpression}」\n${a}`,
  272.           propertyValueDoesNotMatchWithExpectedNumberKind: ({
  273.             targetPropertyObjectPath: e,
  274.             targetPropertyNewName: t,
  275.             targetPropertyValue: r,
  276.             targetPropertySpecification: a,
  277.             fullDataSpecification: i
  278.           }) => `データー:「${i.nameForLogging}」、プロパティ:「${e}」(新名:「` + `${t}」)の値は${a.numberType}だと期待されたが、事実上値は:` + `「${r}」と成っている。`
  279.         },
  280.         x = {
  281.           get substituteDataWasGeneratedBecauseRawDataIsNotObject() {
  282.             return "源データはオブジェクトではない為、'validData'は仕様に基づいて作られた代替オブジェクトである。"
  283.           },
  284.           get substituteDataWasGeneratedBecauseRawDataIsNotObjectButUnexpectedlyArray() {
  285.             return "源データはオブジェクトだが、期待と違って配列に成っている為'validData'は仕様に基づいて作られた代替オブジェクトである。"
  286.           }
  287.         },
  288.         R = M.NUMBER_TYPES,
  289.         $ = M.PROPERTIES_TYPES;
  290.       class L {
  291.         constructor(e) {
  292.           this.currentlyIteratedObjectPropertyNameForCurrentObjectDepthLevel = "", this.currentlyIteratedObjectPropertyNameSegments = [], this.validationErrors = {
  293.             rawDataIsNotObject: !1,
  294.             rawDataIsObjectButUnexpectedlyArray: !1,
  295.             oneOrMoreOfRequiredPropertiesMissing: !1,
  296.             oneOrMoreNonNullablePropertiesAreNull: !1,
  297.             oneOrMorePropertiesTypesDoesNotMatchWithExpected: !1,
  298.             notAllowedEmptyStringFound: !1
  299.           }, this.validationErrorMessages = [], this.notifications = [], this.missingRequiredPropertiesNames = [], this.rawDataIsInvalid = !1, this.fullDataSpecification = e
  300.         }
  301.         static validateData(e, t) {
  302.           const r = new L(t),
  303.             a = {};
  304.           if (!v(e)) return r.validationErrors.rawDataIsNotObject = !0, Object.assign(Object.assign({
  305.             rawData: e,
  306.             validData: L.createMockValidDataBasedOnDataSpecification(t),
  307.             rawDataIsInvalid: !0
  308.           }, r.validationErrors), {
  309.             errorMessages: [w.rawDataIsNotObject(e, t)],
  310.             notifications: [x.substituteDataWasGeneratedBecauseRawDataIsNotObject]
  311.           });
  312.           if (Array.isArray(e)) return r.validationErrors.rawDataIsObjectButUnexpectedlyArray = !0, Object.assign(Object.assign({
  313.             rawData: e,
  314.             validData: L.createMockValidDataBasedOnDataSpecification(t),
  315.             rawDataIsInvalid: !0
  316.           }, r.validationErrors), {
  317.             errorMessages: [w.rawDataIsObjectButUnexpectedlyArray(e, t)],
  318.             notifications: [x.substituteDataWasGeneratedBecauseRawDataIsNotObjectButUnexpectedlyArray]
  319.           });
  320.           const i = e;
  321.           for (const [e, n] of Object.entries(t.properties)) r.currentlyIteratedObjectPropertyNameForCurrentObjectDepthLevel = e, r.currentlyIteratedObjectPropertyNameSegments = [e], L.validateSinglePropertyAndAssignValidValueToObjectWorkpiece({
  322.             rawData__certainObjectDepthLevel: i,
  323.             validDataObjectWorkpiece__certainObjectDepthLevel: a,
  324.             targetPropertyName: e,
  325.             targetPropertySpecification: n,
  326.             dataHoldingSelfInstance: r
  327.           });
  328.           return I(t.extendValidData) || t.extendValidData(a), Object.assign(Object.assign({
  329.             rawData: e,
  330.             validData: a,
  331.             rawDataIsInvalid: r.rawDataIsInvalid
  332.           }, r.validationErrors), {
  333.             errorMessages: r.validationErrorMessages,
  334.             notifications: r.notifications
  335.           })
  336.         }
  337.         static logValidationErrors(e) {
  338.           e.forEach(e => {
  339.             console.error(e)
  340.           })
  341.         }
  342.         static validateSinglePropertyAndAssignValidValueToObjectWorkpiece({
  343.           rawData__certainObjectDepthLevel: e,
  344.           validDataObjectWorkpiece__certainObjectDepthLevel: t,
  345.           targetPropertyName: r,
  346.           targetPropertySpecification: a,
  347.           dataHoldingSelfInstance: i
  348.         }) {
  349.           const n = e[r],
  350.             o = I(a.newName) ? r : a.newName;
  351.           if (I(n)) return a.required ? (i.validationErrorMessages.push(w.requiredPropertyMissing({
  352.             fullDataSpecification: i.fullDataSpecification,
  353.             targetPropertyObjectPath: i.currentObjectPropertyNamesPath,
  354.             targetPropertyNewName: o,
  355.             targetPropertySpecification: a
  356.           })), i.rawDataIsInvalid = !0, i.validationErrors.oneOrMoreOfRequiredPropertiesMissing = !0, i.missingRequiredPropertiesNames.push(r), void(t[o] = a.invalidValueSubstitution)) : I(a.defaultValue) ? void 0 : void(t[o] = a.defaultValue);
  357.           if (null === n) return !0 !== a.nullable ? (i.validationErrorMessages.push(w.nonNullablePropertyValueIsNull({
  358.             fullDataSpecification: i.fullDataSpecification,
  359.             targetPropertyObjectPath: i.currentObjectPropertyNamesPath,
  360.             targetPropertyNewName: o,
  361.             targetPropertySpecification: a
  362.           })), i.rawDataIsInvalid = !0, i.validationErrors.oneOrMoreNonNullablePropertiesAreNull = !0, void(t[o] = a.invalidValueSubstitution)) : void(t[o] = null);
  363.           switch (a.type) {
  364.             case $.NUMBER:
  365.               L.validateNumberPropertyAndAssignValidValueToValidDataObjectWorkpiece({
  366.                 validDataObjectWorkpiece__certainObjectDepthLevel: t,
  367.                 potentiallyNumberTargetPropertyValue: n,
  368.                 targetPropertySpecification: a,
  369.                 targetPropertyFinalName: o,
  370.                 dataHoldingSelfInstance: i
  371.               });
  372.               break;
  373.             case $.STRING:
  374.               L.validateStringPropertyAndAssignValidValueToValidDataObjectWorkpiece({
  375.                 validDataObjectWorkpiece__certainObjectDepthLevel: t,
  376.                 potentiallyStringTargetPropertyValue: n,
  377.                 targetPropertySpecification: a,
  378.                 targetPropertyFinalName: o,
  379.                 dataHoldingSelfInstance: i
  380.               });
  381.               break;
  382.             case $.BOOLEAN:
  383.               L.validateBooleanPropertyAndAssignValidValueToValidDataObjectWorkpiece({
  384.                 validDataObjectWorkpiece__certainObjectDepthLevel: t,
  385.                 potentiallyBooleanTargetPropertyValue: n,
  386.                 targetPropertySpecification: a,
  387.                 targetPropertyFinalName: o,
  388.                 dataHoldingSelfInstance: i
  389.               });
  390.               break;
  391.             case $.NESTED_OBJECT:
  392.               L.validateNestedObjectPropertyAndAssignValidValueToValidDataObjectWorkpiece({
  393.                 validDataObjectWorkpiece__certainObjectDepthLevel: t,
  394.                 potentiallyNestedObjectTargetPropertyValue: n,
  395.                 targetPropertySpecification: a,
  396.                 targetPropertyFinalName: o,
  397.                 dataHoldingSelfInstance: i
  398.               })
  399.           }
  400.         }
  401.         static validateNumberPropertyAndAssignValidValueToValidDataObjectWorkpiece({
  402.           validDataObjectWorkpiece__certainObjectDepthLevel: e,
  403.           potentiallyNumberTargetPropertyValue: t,
  404.           targetPropertySpecification: r,
  405.           targetPropertyFinalName: a,
  406.           dataHoldingSelfInstance: i
  407.         }) {
  408.           if (!b(t)) return i.rawDataIsInvalid = !0, i.validationErrors.oneOrMorePropertiesTypesDoesNotMatchWithExpected = !0, e[a] = r.invalidValueSubstitution, void i.validationErrorMessages.push(w.propertyValueTypeDoesNotMatchWithExpected({
  409.             targetPropertyObjectPath: i.currentObjectPropertyNamesPath,
  410.             targetPropertyNewName: a,
  411.             targetPropertyValue: t,
  412.             targetPropertySpecification: r,
  413.             fullDataSpecification: i.fullDataSpecification
  414.           }));
  415.           switch (r.numberType) {
  416.             case R.DECIMAL_FRACTION_OF_ANY_SIGN:
  417.               if (!/^-?\d+\.\d+$/u.test(t.toString())) return console.log("ObjectDataValidator error n-2"), i.rawDataIsInvalid = !0, i.validationErrors.oneOrMorePropertiesTypesDoesNotMatchWithExpected = !0, void(e[a] = r.invalidValueSubstitution);
  418.               break;
  419.             case R.POSITIVE_DECIMAL_FRACTION:
  420.               if (!/^\d+\.\d+$/u.test(t.toString())) return console.log("ObjectDataValidator error n-3"), i.rawDataIsInvalid = !0, i.validationErrors.oneOrMorePropertiesTypesDoesNotMatchWithExpected = !0, void(e[a] = r.invalidValueSubstitution);
  421.               break;
  422.             case R.ANY_INTEGER:
  423.               if (!Number.isInteger(t)) return console.log("ObjectDataValidator error n-4"), i.rawDataIsInvalid = !0, i.validationErrors.oneOrMorePropertiesTypesDoesNotMatchWithExpected = !0, void(e[a] = r.invalidValueSubstitution);
  424.               break;
  425.             case R.NON_NEGATIVE_INTEGER:
  426.               if (!Number.isInteger(t) && t >= 0) return console.log("ObjectDataValidator error n-5"), i.rawDataIsInvalid = !0, i.validationErrors.oneOrMorePropertiesTypesDoesNotMatchWithExpected = !0, void(e[a] = r.invalidValueSubstitution);
  427.               break;
  428.             case R.NATURAL_NUMBER:
  429.               if (!Number.isInteger(t) && t > 0) return console.log("ObjectDataValidator error n-6"), i.rawDataIsInvalid = !0, i.validationErrors.oneOrMorePropertiesTypesDoesNotMatchWithExpected = !0, void(e[a] = r.invalidValueSubstitution);
  430.               break;
  431.             case R.ANY_REAL_NUMBER:
  432.               break;
  433.             default:
  434.               e[a] = r.invalidValueSubstitution
  435.           }
  436.           if (!I(r.allowedValues) && !r.allowedValues.includes(t)) return i.validationErrorMessages.push(w.propertyValueIsNotAmongAllowedOnes({
  437.             targetPropertyObjectPath: i.currentObjectPropertyNamesPath,
  438.             targetPropertyNewName: a,
  439.             targetPropertyValue: t,
  440.             targetPropertySpecification: r,
  441.             fullDataSpecification: i.fullDataSpecification
  442.           })), i.rawDataIsInvalid = !0, void(e[a] = r.invalidValueSubstitution);
  443.           e[a] = t
  444.         }
  445.         static validateStringPropertyAndAssignValidValueToValidDataObjectWorkpiece({
  446.           validDataObjectWorkpiece__certainObjectDepthLevel: e,
  447.           potentiallyStringTargetPropertyValue: t,
  448.           targetPropertySpecification: r,
  449.           targetPropertyFinalName: a,
  450.           dataHoldingSelfInstance: i
  451.         }) {
  452.           return D(t) ? 0 === t.length ? r.emptyStringIsAllowed ? void(e[a] = t) : (i.validationErrorMessages.push(w.propertyValueIsEmptyStringAlthoughEmptyStringIsNotAllowed({
  453.             targetPropertyObjectPath: i.currentObjectPropertyNamesPath,
  454.             targetPropertyNewName: a,
  455.             targetPropertySpecification: r,
  456.             fullDataSpecification: i.fullDataSpecification
  457.           })), i.rawDataIsInvalid = !0, i.validationErrors.notAllowedEmptyStringFound = !0, void(e[a] = r.invalidValueSubstitution)) : I(r.allowedValues) || r.allowedValues.includes(t) ? I(r.mustMatchRegularExpression) || r.mustMatchRegularExpression.test(t) ? void(e[a] = t) : (i.validationErrorMessages.push(w.propertyValueDoesNotMatchWithRegularExpression({
  458.             targetPropertyObjectPath: i.currentObjectPropertyNamesPath,
  459.             targetPropertyNewName: a,
  460.             targetPropertyValue: t,
  461.             targetPropertySpecification: r,
  462.             fullDataSpecification: i.fullDataSpecification
  463.           })), i.rawDataIsInvalid = !0, void(e[a] = r.invalidValueSubstitution)) : (i.validationErrorMessages.push(w.propertyValueIsNotAmongAllowedOnes({
  464.             targetPropertyObjectPath: i.currentObjectPropertyNamesPath,
  465.             targetPropertyNewName: a,
  466.             targetPropertyValue: t,
  467.             targetPropertySpecification: r,
  468.             fullDataSpecification: i.fullDataSpecification
  469.           })), i.rawDataIsInvalid = !0, void(e[a] = r.invalidValueSubstitution)) : (i.validationErrorMessages.push(w.propertyValueTypeDoesNotMatchWithExpected({
  470.             targetPropertyObjectPath: i.currentObjectPropertyNamesPath,
  471.             targetPropertyNewName: a,
  472.             targetPropertyValue: t,
  473.             targetPropertySpecification: r,
  474.             fullDataSpecification: i.fullDataSpecification
  475.           })), i.rawDataIsInvalid = !0, i.validationErrors.oneOrMorePropertiesTypesDoesNotMatchWithExpected = !0, void(e[a] = r.invalidValueSubstitution))
  476.         }
  477.         static validateBooleanPropertyAndAssignValidValueToValidDataObjectWorkpiece({
  478.           validDataObjectWorkpiece__certainObjectDepthLevel: e,
  479.           potentiallyBooleanTargetPropertyValue: t,
  480.           targetPropertySpecification: r,
  481.           targetPropertyFinalName: a,
  482.           dataHoldingSelfInstance: i
  483.         }) {
  484.           if (!m(t)) return i.validationErrorMessages.push(w.propertyValueTypeDoesNotMatchWithExpected({
  485.             targetPropertyObjectPath: i.currentObjectPropertyNamesPath,
  486.             targetPropertyNewName: a,
  487.             targetPropertyValue: t,
  488.             targetPropertySpecification: r,
  489.             fullDataSpecification: i.fullDataSpecification
  490.           })), i.rawDataIsInvalid = !0, i.validationErrors.oneOrMorePropertiesTypesDoesNotMatchWithExpected = !0, void(e[a] = r.invalidValueSubstitution);
  491.           e[a] = t
  492.         }
  493.         static validateNestedObjectPropertyAndAssignValidValueToValidDataObjectWorkpiece({
  494.           validDataObjectWorkpiece__certainObjectDepthLevel: e,
  495.           potentiallyNestedObjectTargetPropertyValue: t,
  496.           targetPropertySpecification: r,
  497.           targetPropertyFinalName: a,
  498.           dataHoldingSelfInstance: i
  499.         }) {
  500.           if (!v(t)) return i.validationErrorMessages.push(w.propertyValueTypeDoesNotMatchWithExpected({
  501.             targetPropertyObjectPath: i.currentObjectPropertyNamesPath,
  502.             targetPropertyNewName: a,
  503.             targetPropertyValue: t,
  504.             targetPropertySpecification: r,
  505.             fullDataSpecification: i.fullDataSpecification
  506.           })), i.rawDataIsInvalid = !0, i.validationErrors.oneOrMorePropertiesTypesDoesNotMatchWithExpected = !0, void(e[a] = r.invalidValueSubstitution);
  507.           const n = {},
  508.             o = i.currentlyIteratedObjectPropertyNameSegments.length;
  509.           for (const [e, a] of Object.entries(r.nestedDataSpecification.properties)) i.currentlyIteratedObjectPropertyNameForCurrentObjectDepthLevel = e, i.currentlyIteratedObjectPropertyNameSegments[o] = e, L.validateSinglePropertyAndAssignValidValueToObjectWorkpiece({
  510.             rawData__certainObjectDepthLevel: t,
  511.             validDataObjectWorkpiece__certainObjectDepthLevel: n,
  512.             targetPropertyName: e,
  513.             targetPropertySpecification: a,
  514.             dataHoldingSelfInstance: i
  515.           }), i.currentlyIteratedObjectPropertyNameSegments.splice(-1, 1);
  516.           e[a] = n
  517.         }
  518.         static createMockValidDataBasedOnDataSpecification(e) {
  519.           const t = T.createSubstituteBasedOnDataSpecification(e);
  520.           return I(e.extendValidData) || e.extendValidData(t), t
  521.         }
  522.         get currentObjectPropertyNamesPath() {
  523.           return this.currentlyIteratedObjectPropertyNameSegments.join(".")
  524.         }
  525.       }
  526.       class B {}
  527.       B.ErrorTypes = V({
  528.         ALGORITHMIC_ERROR: "算法と実際振る舞いの不一致",
  529.         REQUIRED_PARAMETER_ABSENCE: "必須パラメータ見つけられず",
  530.         INVALID_PARAMETER_TYPE: "パラメータ不正型",
  531.         INVALID_PARAMETER_VALUE: "パラメータ不正値",
  532.         EXTERNAL_DATA_DOES_NOT_MATCH_WITH_EXPECTED: "外部から取得されたデータは仕様と合っていない"
  533.       });
  534.       class W extends B {
  535.         static buildErrorMessage({
  536.           errorType: e,
  537.           functionInvocationExpression: t,
  538.           description: r,
  539.           possibleCauses: a,
  540.           recommendedChecklist: i
  541.         }) {
  542.           let n = ` 〔${e} 〕` + ` "${t}"でのエラー発生。\n\n${r}`;
  543.           return void 0 !== a && (n = `${n}\n\n=== 推定原因 ======\n`, a.forEach(e => {
  544.             n = `${n}\n● ${e}`
  545.           })), void 0 !== i && (n = `${n}\n\n=== 先ず確認するべき ======\n`, i.forEach(e => {
  546.             n = `${n}\n□ ${e}`
  547.           })), `${n}\n\n`
  548.         }
  549.       }
  550.       r.d(t, "replaceDoubleBackslashesWithForwardSlashes", (function() {
  551.         return a
  552.       })), r.d(t, "replaceHtmlBrToNewLineEscapeSequence", (function() {
  553.         return i
  554.       })), r.d(t, "replaceNewLineEscapeSequenceToHtmlBr", (function() {
  555.         return n
  556.       })), r.d(t, "isValidFileOrDirectoryAbsolutePath", (function() {
  557.         return u
  558.       })), r.d(t, "isValidDirectoryAbsolutePath", (function() {
  559.         return s
  560.       })), r.d(t, "isValidFileAbsolutePath", (function() {
  561.         return l
  562.       })), r.d(t, "isLastPathSegmentBeginsFromUnderscore", (function() {
  563.         return p
  564.       })), r.d(t, "removeSingleElementFromArrayOfStringsOrNumbersImmutably", (function() {
  565.         return d
  566.       })), r.d(t, "removeSingleElementFromArrayOfStringsOrNumbersMutably", (function() {
  567.         return f
  568.       })), r.d(t, "removeSingleElementFromArrayByPredicateImmutably", (function() {
  569.         return g
  570.       })), r.d(t, "removeSingleElementFromArrayByPredicateMutably", (function() {
  571.         return y
  572.       })), r.d(t, "isNumber", (function() {
  573.         return b
  574.       })), r.d(t, "isDecimalFractionOfAnySign", (function() {
  575.         return P
  576.       })), r.d(t, "isPositiveDecimalFraction", (function() {
  577.         return O
  578.       })), r.d(t, "isNegativeDecimalFraction", (function() {
  579.         return E
  580.       })), r.d(t, "isString", (function() {
  581.         return D
  582.       })), r.d(t, "isNonEmptyString", (function() {
  583.         return N
  584.       })), r.d(t, "isBoolean", (function() {
  585.         return m
  586.       })), r.d(t, "isObject", (function() {
  587.         return v
  588.       })), r.d(t, "inNonEmptyArray", (function() {
  589.         return S
  590.       })), r.d(t, "isArrayOfLength", (function() {
  591.         return A
  592.       })), r.d(t, "isArrayOfSpecifiedLengthsRange", (function() {
  593.         return j
  594.       })), r.d(t, "isAllArrayElementsAreString", (function() {
  595.         return h
  596.       })), r.d(t, "isUndefined", (function() {
  597.         return I
  598.       })), r.d(t, "createEnumerableStaticClassField", (function() {
  599.         return V
  600.       })), r.d(t, "ObjectDataValidator", (function() {
  601.         return L
  602.       })), r.d(t, "ObjectDataValidatorTypes", (function() {
  603.         return M
  604.       })), r.d(t, "CrossEnvironmentErrorMessageBuilder", (function() {
  605.         return W
  606.       }))
  607.     }])
  608.   }, function(e, t, r) {
  609.     "use strict";
  610.     r.r(t), r.d(t, "MixinArgumentsValidator", (function() {
  611.       return i
  612.     }));
  613.     var a = r(0);
  614.     r.d(t, "ObjectDataValidatorTypes", (function() {
  615.       return a.ObjectDataValidatorTypes
  616.     }));
  617.     class i {
  618.       static getValidatedArguments(e, t) {
  619.         const r = i.mapMixinArgumentToOneDepthLevelObject(e),
  620.           n = a.ObjectDataValidator.validateData(r, t);
  621.         if (n.rawDataIsInvalid) throw new Error(a.CrossEnvironmentErrorMessageBuilder.buildErrorMessage({
  622.           errorType: a.CrossEnvironmentErrorMessageBuilder.ErrorTypes.EXTERNAL_DATA_DOES_NOT_MATCH_WITH_EXPECTED,
  623.           functionInvocationExpression: "(Pug内論理)->MixinArgumentsValidator.getValidatedArguments(rawArgumentsObject, mixinArgumentsSpecification)",
  624.           description: `ミクスインのアーギュメントは仕様と合っていなく、下記の間違いを含めている:\n ${JSON.stringify(n.errorMessages,null,2)}`
  625.         }));
  626.         const o = {},
  627.           c = {};
  628.         for (const [e, r] of Object.entries(n.validData)) t.properties[e].required ? o[e] = r : c[e] = r;
  629.         return {
  630.           requires: o,
  631.           optionals: c
  632.         }
  633.       }
  634.       static mapMixinArgumentToOneDepthLevelObject(e) {
  635.         if (!Object(a.isObject)(e)) throw new Error(a.CrossEnvironmentErrorMessageBuilder.buildErrorMessage({
  636.           errorType: a.CrossEnvironmentErrorMessageBuilder.ErrorTypes.EXTERNAL_DATA_DOES_NOT_MATCH_WITH_EXPECTED,
  637.           functionInvocationExpression: "(Pug内論理)->MixinArgumentsValidator.getValidatedArguments(rawArguments, mixinArgumentsSpecification)",
  638.           description: "未処理エラーA1"
  639.         }));
  640.         const t = {};
  641.         if (Object.prototype.hasOwnProperty.call(e, "requires")) {
  642.           if (!Object(a.isObject)(e)) throw new Error(a.CrossEnvironmentErrorMessageBuilder.buildErrorMessage({
  643.             errorType: a.CrossEnvironmentErrorMessageBuilder.ErrorTypes.EXTERNAL_DATA_DOES_NOT_MATCH_WITH_EXPECTED,
  644.             functionInvocationExpression: "(Pug内論理)->MixinArgumentsValidator.getValidatedArguments(rawArguments, mixinArgumentsSpecification)",
  645.             description: "未処理エラーA2"
  646.           }));
  647.           const r = e;
  648.           for (const [e, a] of Object.entries(r.requires)) t[e] = a
  649.         }
  650.         if (Object.prototype.hasOwnProperty.call(e, "optionals")) {
  651.           if (!Object(a.isObject)(e)) throw new Error(a.CrossEnvironmentErrorMessageBuilder.buildErrorMessage({
  652.             errorType: a.CrossEnvironmentErrorMessageBuilder.ErrorTypes.EXTERNAL_DATA_DOES_NOT_MATCH_WITH_EXPECTED,
  653.             functionInvocationExpression: "(Pug内論理)->MixinArgumentsValidator.getValidatedArguments(rawArguments, mixinArgumentsSpecification)",
  654.             description: "未処理エラーA3"
  655.           }));
  656.           const r = e;
  657.           for (const [e, a] of Object.entries(r.optionals)) t[e] = a
  658.         }
  659.         return t
  660.       }
  661.     }
  662.   }])
  663. }));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement