Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ! function(e, t) {
- if ("object" == typeof exports && "object" == typeof module) module.exports = t();
- else if ("function" == typeof define && define.amd) define([], t);
- else {
- var r = t();
- for (var a in r)("object" == typeof exports ? exports : e)[a] = r[a]
- }
- }(global, (function() {
- return function(e) {
- var t = {};
- function r(a) {
- if (t[a]) return t[a].exports;
- var i = t[a] = {
- i: a,
- l: !1,
- exports: {}
- };
- return e[a].call(i.exports, i, i.exports, r), i.l = !0, i.exports
- }
- return r.m = e, r.c = t, r.d = function(e, t, a) {
- r.o(e, t) || Object.defineProperty(e, t, {
- enumerable: !0,
- get: a
- })
- }, r.r = function(e) {
- "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, {
- value: "Module"
- }), Object.defineProperty(e, "__esModule", {
- value: !0
- })
- }, r.t = function(e, t) {
- if (1 & t && (e = r(e)), 8 & t) return e;
- if (4 & t && "object" == typeof e && e && e.__esModule) return e;
- var a = Object.create(null);
- if (r.r(a), Object.defineProperty(a, "default", {
- enumerable: !0,
- value: e
- }), 2 & t && "string" != typeof e)
- for (var i in e) r.d(a, i, function(t) {
- return e[t]
- }.bind(null, i));
- return a
- }, r.n = function(e) {
- var t = e && e.__esModule ? function() {
- return e.default
- } : function() {
- return e
- };
- return r.d(t, "a", t), t
- }, r.o = function(e, t) {
- return Object.prototype.hasOwnProperty.call(e, t)
- }, r.p = "", r(r.s = 1)
- }([function(e, t, r) {
- window,
- e.exports = function(e) {
- var t = {};
- function r(a) {
- if (t[a]) return t[a].exports;
- var i = t[a] = {
- i: a,
- l: !1,
- exports: {}
- };
- return e[a].call(i.exports, i, i.exports, r), i.l = !0, i.exports
- }
- return r.m = e, r.c = t, r.d = function(e, t, a) {
- r.o(e, t) || Object.defineProperty(e, t, {
- enumerable: !0,
- get: a
- })
- }, r.r = function(e) {
- "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, {
- value: "Module"
- }), Object.defineProperty(e, "__esModule", {
- value: !0
- })
- }, r.t = function(e, t) {
- if (1 & t && (e = r(e)), 8 & t) return e;
- if (4 & t && "object" == typeof e && e && e.__esModule) return e;
- var a = Object.create(null);
- if (r.r(a), Object.defineProperty(a, "default", {
- enumerable: !0,
- value: e
- }), 2 & t && "string" != typeof e)
- for (var i in e) r.d(a, i, function(t) {
- return e[t]
- }.bind(null, i));
- return a
- }, r.n = function(e) {
- var t = e && e.__esModule ? function() {
- return e.default
- } : function() {
- return e
- };
- return r.d(t, "a", t), t
- }, r.o = function(e, t) {
- return Object.prototype.hasOwnProperty.call(e, t)
- }, r.p = "", r(r.s = 0)
- }([function(e, t, r) {
- "use strict";
- function a(e) {
- return e.replace(/\\/gu, "/")
- }
- function i(e) {
- return e.replace(/<br\s*\/*>/gu, "\n")
- }
- function n(e) {
- return e.replace(/\r?\n/gu, "<br />")
- }
- r.r(t);
- const o = /^[A-Z]:(?:[\\/][a-z0-9\s_@\-^!#$%&+={}[\]]+)+$/u,
- c = /^[A-Z]:(?:[\\/][a-z0-9\s_@\-^!#$%&+={}[\]]+)*[\\/](?:[a-z0-9\s_@\-^!#$%&+={}[\]]+)?(?:\.[0-9a-z]+)+$/u;
- function s(e) {
- return o.test(e)
- }
- function l(e) {
- return c.test(e)
- }
- function u(e) {
- return o.test(e) || c.test(e)
- }
- function p(e) {
- return /[/\\]_(?:[^/|\\]*)$/u.test(e)
- }
- function d(e, t) {
- const r = e.indexOf(t),
- a = Array.from(e);
- return r > -1 ? (a.splice(r, 1), a) : a
- }
- function f(e, t) {
- const r = e.indexOf(t); - 1 !== r && e.splice(r, 1)
- }
- function g(e, t) {
- const r = e.findIndex(t),
- a = Array.from(e);
- return r > -1 ? (a.splice(r, 1), a) : a
- }
- function y(e, t) {
- const r = e.findIndex(t); - 1 !== r && e.splice(r, 1)
- }
- function b(e) {
- return "number" == typeof e
- }
- function P(e) {
- return "number" == typeof e && /^-?\d+\.\d+$/u.test(e.toString())
- }
- function O(e) {
- return "number" == typeof e && /^\d+\.\d+$/u.test(e.toString())
- }
- function E(e) {
- return "number" == typeof e && /^-\d+\.\d+$/u.test(e.toString())
- }
- function D(e) {
- return "string" == typeof e
- }
- function N(e) {
- return "string" == typeof e && e.length > 0
- }
- function m(e) {
- return "boolean" == typeof e
- }
- function v(e) {
- return "object" == typeof e
- }
- function S(e) {
- return !!Array.isArray(e) && e.length > 0
- }
- function A(e, t) {
- return !!Array.isArray(e) && e.length === t
- }
- function j(e, t, r) {
- return !!Array.isArray(e) && e.length <= t && e.length >= r
- }
- function h(e) {
- let t = !0;
- for (const r of e)
- if ("string" != typeof r) {
- t = !1;
- break
- } return t
- }
- function I(e) {
- return void 0 === e
- }
- const V = e => e;
- class T {
- static createSubstituteBasedOnDataSpecification(e) {
- const t = {};
- for (const [r, a] of Object.entries(e.properties)) t[r] = a.invalidValueSubstitution;
- return t
- }
- }
- var _;
- ! function(e) {
- let t, r;
- ! function(e) {
- e.NUMBER = "数(number)", e.STRING = "文字列(string)", e.BOOLEAN = "ブーリアン(boolean)", e.NESTED_OBJECT = "オブジェクト(object)", e.ARRAY_OF_OBJECTS = "オブジェクトの配列(Array<object>)"
- }(t = e.PROPERTIES_TYPES || (e.PROPERTIES_TYPES = {})),
- function(e) {
- 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 = "実数"
- }(r = e.NUMBER_TYPES || (e.NUMBER_TYPES = {}))
- }(_ || (_ = {}));
- var M = _,
- w = {
- rawDataIsNotObject: (e, t) => `データ:「${t.nameForLogging}」の型は"object"ではなく、${typeof e}と成っている。\n` + `値:${e}`,
- rawDataIsObjectButUnexpectedlyArray: (e, t) => `データ:「${t.nameForLogging}」の型は"object"だが、ECMAScriptの配列と成っている。` + "'ObjectDataValidator'は配列専用ではないが、配列を検問する事が必要な場合、'ExternalArrayedDataValidator'を御利用。\n" + `値:${e}`,
- requiredPropertyMissing: ({
- targetPropertyObjectPath: e,
- targetPropertyNewName: t,
- targetPropertySpecification: r,
- fullDataSpecification: a
- }) => `データー:「${a.nameForLogging}」、プロパティ:「${t}」(以前名:「` + `${e}」)は必須だと指定してあるが、実際値は「undefined」と成っている。プロパティ仕様:\n` + `${JSON.stringify(r,null,2)}`,
- nonNullablePropertyValueIsNull: ({
- targetPropertyObjectPath: e,
- targetPropertyNewName: t,
- targetPropertySpecification: r,
- fullDataSpecification: a
- }) => `データー:「${a.nameForLogging}」、プロパティ:「${t}」(以前名:「` + `${e}」)は'null'に成っているが、'null'が仕様に許可されていない:プロパティ仕様:\n` + `${r}`,
- propertyValueTypeDoesNotMatchWithExpected: ({
- targetPropertyObjectPath: e,
- targetPropertyNewName: t,
- targetPropertyValue: r,
- targetPropertySpecification: a,
- fullDataSpecification: i
- }) => `データー:「${i.nameForLogging}」、プロパティ:「${e}」(新名:「` + `${t}」)の型は「${a.type}」だと期待された、` + `事実上「${typeof r}」に成っている。`,
- propertyValueIsEmptyStringAlthoughEmptyStringIsNotAllowed: ({
- targetPropertyObjectPath: e,
- targetPropertyNewName: t,
- targetPropertySpecification: r,
- fullDataSpecification: a
- }) => `データー:「${a.nameForLogging}」、プロパティ:「${e}」(新名:「` + `${t}」)の型は文字列と成っているが、仕様上空文字列は許可されていない:\n${r}`,
- propertyValueIsNotAmongAllowedOnes: ({
- targetPropertyObjectPath: e,
- targetPropertyNewName: t,
- targetPropertyValue: r,
- targetPropertySpecification: a,
- fullDataSpecification: i
- }) => `データー:「${i.nameForLogging}」、プロパティ:「${e}」(新名:「` + `${t}」)の値:「${r}」は許可されている値の中には無い。\n${a}`,
- propertyValueDoesNotMatchWithRegularExpression: ({
- targetPropertyObjectPath: e,
- targetPropertyNewName: t,
- targetPropertyValue: r,
- targetPropertySpecification: a,
- fullDataSpecification: i
- }) => `データー:「${i.nameForLogging}」、プロパティ:「${e}」(新名:「` + `${t}」)の値:「${r}」は正規表現:` + `「${a.mustMatchRegularExpression}」\n${a}`,
- propertyValueDoesNotMatchWithExpectedNumberKind: ({
- targetPropertyObjectPath: e,
- targetPropertyNewName: t,
- targetPropertyValue: r,
- targetPropertySpecification: a,
- fullDataSpecification: i
- }) => `データー:「${i.nameForLogging}」、プロパティ:「${e}」(新名:「` + `${t}」)の値は${a.numberType}だと期待されたが、事実上値は:` + `「${r}」と成っている。`
- },
- x = {
- get substituteDataWasGeneratedBecauseRawDataIsNotObject() {
- return "源データはオブジェクトではない為、'validData'は仕様に基づいて作られた代替オブジェクトである。"
- },
- get substituteDataWasGeneratedBecauseRawDataIsNotObjectButUnexpectedlyArray() {
- return "源データはオブジェクトだが、期待と違って配列に成っている為'validData'は仕様に基づいて作られた代替オブジェクトである。"
- }
- },
- R = M.NUMBER_TYPES,
- $ = M.PROPERTIES_TYPES;
- class L {
- constructor(e) {
- this.currentlyIteratedObjectPropertyNameForCurrentObjectDepthLevel = "", this.currentlyIteratedObjectPropertyNameSegments = [], this.validationErrors = {
- rawDataIsNotObject: !1,
- rawDataIsObjectButUnexpectedlyArray: !1,
- oneOrMoreOfRequiredPropertiesMissing: !1,
- oneOrMoreNonNullablePropertiesAreNull: !1,
- oneOrMorePropertiesTypesDoesNotMatchWithExpected: !1,
- notAllowedEmptyStringFound: !1
- }, this.validationErrorMessages = [], this.notifications = [], this.missingRequiredPropertiesNames = [], this.rawDataIsInvalid = !1, this.fullDataSpecification = e
- }
- static validateData(e, t) {
- const r = new L(t),
- a = {};
- if (!v(e)) return r.validationErrors.rawDataIsNotObject = !0, Object.assign(Object.assign({
- rawData: e,
- validData: L.createMockValidDataBasedOnDataSpecification(t),
- rawDataIsInvalid: !0
- }, r.validationErrors), {
- errorMessages: [w.rawDataIsNotObject(e, t)],
- notifications: [x.substituteDataWasGeneratedBecauseRawDataIsNotObject]
- });
- if (Array.isArray(e)) return r.validationErrors.rawDataIsObjectButUnexpectedlyArray = !0, Object.assign(Object.assign({
- rawData: e,
- validData: L.createMockValidDataBasedOnDataSpecification(t),
- rawDataIsInvalid: !0
- }, r.validationErrors), {
- errorMessages: [w.rawDataIsObjectButUnexpectedlyArray(e, t)],
- notifications: [x.substituteDataWasGeneratedBecauseRawDataIsNotObjectButUnexpectedlyArray]
- });
- const i = e;
- for (const [e, n] of Object.entries(t.properties)) r.currentlyIteratedObjectPropertyNameForCurrentObjectDepthLevel = e, r.currentlyIteratedObjectPropertyNameSegments = [e], L.validateSinglePropertyAndAssignValidValueToObjectWorkpiece({
- rawData__certainObjectDepthLevel: i,
- validDataObjectWorkpiece__certainObjectDepthLevel: a,
- targetPropertyName: e,
- targetPropertySpecification: n,
- dataHoldingSelfInstance: r
- });
- return I(t.extendValidData) || t.extendValidData(a), Object.assign(Object.assign({
- rawData: e,
- validData: a,
- rawDataIsInvalid: r.rawDataIsInvalid
- }, r.validationErrors), {
- errorMessages: r.validationErrorMessages,
- notifications: r.notifications
- })
- }
- static logValidationErrors(e) {
- e.forEach(e => {
- console.error(e)
- })
- }
- static validateSinglePropertyAndAssignValidValueToObjectWorkpiece({
- rawData__certainObjectDepthLevel: e,
- validDataObjectWorkpiece__certainObjectDepthLevel: t,
- targetPropertyName: r,
- targetPropertySpecification: a,
- dataHoldingSelfInstance: i
- }) {
- const n = e[r],
- o = I(a.newName) ? r : a.newName;
- if (I(n)) return a.required ? (i.validationErrorMessages.push(w.requiredPropertyMissing({
- fullDataSpecification: i.fullDataSpecification,
- targetPropertyObjectPath: i.currentObjectPropertyNamesPath,
- targetPropertyNewName: o,
- targetPropertySpecification: a
- })), 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);
- if (null === n) return !0 !== a.nullable ? (i.validationErrorMessages.push(w.nonNullablePropertyValueIsNull({
- fullDataSpecification: i.fullDataSpecification,
- targetPropertyObjectPath: i.currentObjectPropertyNamesPath,
- targetPropertyNewName: o,
- targetPropertySpecification: a
- })), i.rawDataIsInvalid = !0, i.validationErrors.oneOrMoreNonNullablePropertiesAreNull = !0, void(t[o] = a.invalidValueSubstitution)) : void(t[o] = null);
- switch (a.type) {
- case $.NUMBER:
- L.validateNumberPropertyAndAssignValidValueToValidDataObjectWorkpiece({
- validDataObjectWorkpiece__certainObjectDepthLevel: t,
- potentiallyNumberTargetPropertyValue: n,
- targetPropertySpecification: a,
- targetPropertyFinalName: o,
- dataHoldingSelfInstance: i
- });
- break;
- case $.STRING:
- L.validateStringPropertyAndAssignValidValueToValidDataObjectWorkpiece({
- validDataObjectWorkpiece__certainObjectDepthLevel: t,
- potentiallyStringTargetPropertyValue: n,
- targetPropertySpecification: a,
- targetPropertyFinalName: o,
- dataHoldingSelfInstance: i
- });
- break;
- case $.BOOLEAN:
- L.validateBooleanPropertyAndAssignValidValueToValidDataObjectWorkpiece({
- validDataObjectWorkpiece__certainObjectDepthLevel: t,
- potentiallyBooleanTargetPropertyValue: n,
- targetPropertySpecification: a,
- targetPropertyFinalName: o,
- dataHoldingSelfInstance: i
- });
- break;
- case $.NESTED_OBJECT:
- L.validateNestedObjectPropertyAndAssignValidValueToValidDataObjectWorkpiece({
- validDataObjectWorkpiece__certainObjectDepthLevel: t,
- potentiallyNestedObjectTargetPropertyValue: n,
- targetPropertySpecification: a,
- targetPropertyFinalName: o,
- dataHoldingSelfInstance: i
- })
- }
- }
- static validateNumberPropertyAndAssignValidValueToValidDataObjectWorkpiece({
- validDataObjectWorkpiece__certainObjectDepthLevel: e,
- potentiallyNumberTargetPropertyValue: t,
- targetPropertySpecification: r,
- targetPropertyFinalName: a,
- dataHoldingSelfInstance: i
- }) {
- if (!b(t)) return i.rawDataIsInvalid = !0, i.validationErrors.oneOrMorePropertiesTypesDoesNotMatchWithExpected = !0, e[a] = r.invalidValueSubstitution, void i.validationErrorMessages.push(w.propertyValueTypeDoesNotMatchWithExpected({
- targetPropertyObjectPath: i.currentObjectPropertyNamesPath,
- targetPropertyNewName: a,
- targetPropertyValue: t,
- targetPropertySpecification: r,
- fullDataSpecification: i.fullDataSpecification
- }));
- switch (r.numberType) {
- case R.DECIMAL_FRACTION_OF_ANY_SIGN:
- 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);
- break;
- case R.POSITIVE_DECIMAL_FRACTION:
- 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);
- break;
- case R.ANY_INTEGER:
- if (!Number.isInteger(t)) return console.log("ObjectDataValidator error n-4"), i.rawDataIsInvalid = !0, i.validationErrors.oneOrMorePropertiesTypesDoesNotMatchWithExpected = !0, void(e[a] = r.invalidValueSubstitution);
- break;
- case R.NON_NEGATIVE_INTEGER:
- 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);
- break;
- case R.NATURAL_NUMBER:
- 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);
- break;
- case R.ANY_REAL_NUMBER:
- break;
- default:
- e[a] = r.invalidValueSubstitution
- }
- if (!I(r.allowedValues) && !r.allowedValues.includes(t)) return i.validationErrorMessages.push(w.propertyValueIsNotAmongAllowedOnes({
- targetPropertyObjectPath: i.currentObjectPropertyNamesPath,
- targetPropertyNewName: a,
- targetPropertyValue: t,
- targetPropertySpecification: r,
- fullDataSpecification: i.fullDataSpecification
- })), i.rawDataIsInvalid = !0, void(e[a] = r.invalidValueSubstitution);
- e[a] = t
- }
- static validateStringPropertyAndAssignValidValueToValidDataObjectWorkpiece({
- validDataObjectWorkpiece__certainObjectDepthLevel: e,
- potentiallyStringTargetPropertyValue: t,
- targetPropertySpecification: r,
- targetPropertyFinalName: a,
- dataHoldingSelfInstance: i
- }) {
- return D(t) ? 0 === t.length ? r.emptyStringIsAllowed ? void(e[a] = t) : (i.validationErrorMessages.push(w.propertyValueIsEmptyStringAlthoughEmptyStringIsNotAllowed({
- targetPropertyObjectPath: i.currentObjectPropertyNamesPath,
- targetPropertyNewName: a,
- targetPropertySpecification: r,
- fullDataSpecification: i.fullDataSpecification
- })), 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({
- targetPropertyObjectPath: i.currentObjectPropertyNamesPath,
- targetPropertyNewName: a,
- targetPropertyValue: t,
- targetPropertySpecification: r,
- fullDataSpecification: i.fullDataSpecification
- })), i.rawDataIsInvalid = !0, void(e[a] = r.invalidValueSubstitution)) : (i.validationErrorMessages.push(w.propertyValueIsNotAmongAllowedOnes({
- targetPropertyObjectPath: i.currentObjectPropertyNamesPath,
- targetPropertyNewName: a,
- targetPropertyValue: t,
- targetPropertySpecification: r,
- fullDataSpecification: i.fullDataSpecification
- })), i.rawDataIsInvalid = !0, void(e[a] = r.invalidValueSubstitution)) : (i.validationErrorMessages.push(w.propertyValueTypeDoesNotMatchWithExpected({
- targetPropertyObjectPath: i.currentObjectPropertyNamesPath,
- targetPropertyNewName: a,
- targetPropertyValue: t,
- targetPropertySpecification: r,
- fullDataSpecification: i.fullDataSpecification
- })), i.rawDataIsInvalid = !0, i.validationErrors.oneOrMorePropertiesTypesDoesNotMatchWithExpected = !0, void(e[a] = r.invalidValueSubstitution))
- }
- static validateBooleanPropertyAndAssignValidValueToValidDataObjectWorkpiece({
- validDataObjectWorkpiece__certainObjectDepthLevel: e,
- potentiallyBooleanTargetPropertyValue: t,
- targetPropertySpecification: r,
- targetPropertyFinalName: a,
- dataHoldingSelfInstance: i
- }) {
- if (!m(t)) return i.validationErrorMessages.push(w.propertyValueTypeDoesNotMatchWithExpected({
- targetPropertyObjectPath: i.currentObjectPropertyNamesPath,
- targetPropertyNewName: a,
- targetPropertyValue: t,
- targetPropertySpecification: r,
- fullDataSpecification: i.fullDataSpecification
- })), i.rawDataIsInvalid = !0, i.validationErrors.oneOrMorePropertiesTypesDoesNotMatchWithExpected = !0, void(e[a] = r.invalidValueSubstitution);
- e[a] = t
- }
- static validateNestedObjectPropertyAndAssignValidValueToValidDataObjectWorkpiece({
- validDataObjectWorkpiece__certainObjectDepthLevel: e,
- potentiallyNestedObjectTargetPropertyValue: t,
- targetPropertySpecification: r,
- targetPropertyFinalName: a,
- dataHoldingSelfInstance: i
- }) {
- if (!v(t)) return i.validationErrorMessages.push(w.propertyValueTypeDoesNotMatchWithExpected({
- targetPropertyObjectPath: i.currentObjectPropertyNamesPath,
- targetPropertyNewName: a,
- targetPropertyValue: t,
- targetPropertySpecification: r,
- fullDataSpecification: i.fullDataSpecification
- })), i.rawDataIsInvalid = !0, i.validationErrors.oneOrMorePropertiesTypesDoesNotMatchWithExpected = !0, void(e[a] = r.invalidValueSubstitution);
- const n = {},
- o = i.currentlyIteratedObjectPropertyNameSegments.length;
- for (const [e, a] of Object.entries(r.nestedDataSpecification.properties)) i.currentlyIteratedObjectPropertyNameForCurrentObjectDepthLevel = e, i.currentlyIteratedObjectPropertyNameSegments[o] = e, L.validateSinglePropertyAndAssignValidValueToObjectWorkpiece({
- rawData__certainObjectDepthLevel: t,
- validDataObjectWorkpiece__certainObjectDepthLevel: n,
- targetPropertyName: e,
- targetPropertySpecification: a,
- dataHoldingSelfInstance: i
- }), i.currentlyIteratedObjectPropertyNameSegments.splice(-1, 1);
- e[a] = n
- }
- static createMockValidDataBasedOnDataSpecification(e) {
- const t = T.createSubstituteBasedOnDataSpecification(e);
- return I(e.extendValidData) || e.extendValidData(t), t
- }
- get currentObjectPropertyNamesPath() {
- return this.currentlyIteratedObjectPropertyNameSegments.join(".")
- }
- }
- class B {}
- B.ErrorTypes = V({
- ALGORITHMIC_ERROR: "算法と実際振る舞いの不一致",
- REQUIRED_PARAMETER_ABSENCE: "必須パラメータ見つけられず",
- INVALID_PARAMETER_TYPE: "パラメータ不正型",
- INVALID_PARAMETER_VALUE: "パラメータ不正値",
- EXTERNAL_DATA_DOES_NOT_MATCH_WITH_EXPECTED: "外部から取得されたデータは仕様と合っていない"
- });
- class W extends B {
- static buildErrorMessage({
- errorType: e,
- functionInvocationExpression: t,
- description: r,
- possibleCauses: a,
- recommendedChecklist: i
- }) {
- let n = ` 〔${e} 〕` + ` "${t}"でのエラー発生。\n\n${r}`;
- return void 0 !== a && (n = `${n}\n\n=== 推定原因 ======\n`, a.forEach(e => {
- n = `${n}\n● ${e}`
- })), void 0 !== i && (n = `${n}\n\n=== 先ず確認するべき ======\n`, i.forEach(e => {
- n = `${n}\n□ ${e}`
- })), `${n}\n\n`
- }
- }
- r.d(t, "replaceDoubleBackslashesWithForwardSlashes", (function() {
- return a
- })), r.d(t, "replaceHtmlBrToNewLineEscapeSequence", (function() {
- return i
- })), r.d(t, "replaceNewLineEscapeSequenceToHtmlBr", (function() {
- return n
- })), r.d(t, "isValidFileOrDirectoryAbsolutePath", (function() {
- return u
- })), r.d(t, "isValidDirectoryAbsolutePath", (function() {
- return s
- })), r.d(t, "isValidFileAbsolutePath", (function() {
- return l
- })), r.d(t, "isLastPathSegmentBeginsFromUnderscore", (function() {
- return p
- })), r.d(t, "removeSingleElementFromArrayOfStringsOrNumbersImmutably", (function() {
- return d
- })), r.d(t, "removeSingleElementFromArrayOfStringsOrNumbersMutably", (function() {
- return f
- })), r.d(t, "removeSingleElementFromArrayByPredicateImmutably", (function() {
- return g
- })), r.d(t, "removeSingleElementFromArrayByPredicateMutably", (function() {
- return y
- })), r.d(t, "isNumber", (function() {
- return b
- })), r.d(t, "isDecimalFractionOfAnySign", (function() {
- return P
- })), r.d(t, "isPositiveDecimalFraction", (function() {
- return O
- })), r.d(t, "isNegativeDecimalFraction", (function() {
- return E
- })), r.d(t, "isString", (function() {
- return D
- })), r.d(t, "isNonEmptyString", (function() {
- return N
- })), r.d(t, "isBoolean", (function() {
- return m
- })), r.d(t, "isObject", (function() {
- return v
- })), r.d(t, "inNonEmptyArray", (function() {
- return S
- })), r.d(t, "isArrayOfLength", (function() {
- return A
- })), r.d(t, "isArrayOfSpecifiedLengthsRange", (function() {
- return j
- })), r.d(t, "isAllArrayElementsAreString", (function() {
- return h
- })), r.d(t, "isUndefined", (function() {
- return I
- })), r.d(t, "createEnumerableStaticClassField", (function() {
- return V
- })), r.d(t, "ObjectDataValidator", (function() {
- return L
- })), r.d(t, "ObjectDataValidatorTypes", (function() {
- return M
- })), r.d(t, "CrossEnvironmentErrorMessageBuilder", (function() {
- return W
- }))
- }])
- }, function(e, t, r) {
- "use strict";
- r.r(t), r.d(t, "MixinArgumentsValidator", (function() {
- return i
- }));
- var a = r(0);
- r.d(t, "ObjectDataValidatorTypes", (function() {
- return a.ObjectDataValidatorTypes
- }));
- class i {
- static getValidatedArguments(e, t) {
- const r = i.mapMixinArgumentToOneDepthLevelObject(e),
- n = a.ObjectDataValidator.validateData(r, t);
- if (n.rawDataIsInvalid) throw new Error(a.CrossEnvironmentErrorMessageBuilder.buildErrorMessage({
- errorType: a.CrossEnvironmentErrorMessageBuilder.ErrorTypes.EXTERNAL_DATA_DOES_NOT_MATCH_WITH_EXPECTED,
- functionInvocationExpression: "(Pug内論理)->MixinArgumentsValidator.getValidatedArguments(rawArgumentsObject, mixinArgumentsSpecification)",
- description: `ミクスインのアーギュメントは仕様と合っていなく、下記の間違いを含めている:\n ${JSON.stringify(n.errorMessages,null,2)}`
- }));
- const o = {},
- c = {};
- for (const [e, r] of Object.entries(n.validData)) t.properties[e].required ? o[e] = r : c[e] = r;
- return {
- requires: o,
- optionals: c
- }
- }
- static mapMixinArgumentToOneDepthLevelObject(e) {
- if (!Object(a.isObject)(e)) throw new Error(a.CrossEnvironmentErrorMessageBuilder.buildErrorMessage({
- errorType: a.CrossEnvironmentErrorMessageBuilder.ErrorTypes.EXTERNAL_DATA_DOES_NOT_MATCH_WITH_EXPECTED,
- functionInvocationExpression: "(Pug内論理)->MixinArgumentsValidator.getValidatedArguments(rawArguments, mixinArgumentsSpecification)",
- description: "未処理エラーA1"
- }));
- const t = {};
- if (Object.prototype.hasOwnProperty.call(e, "requires")) {
- if (!Object(a.isObject)(e)) throw new Error(a.CrossEnvironmentErrorMessageBuilder.buildErrorMessage({
- errorType: a.CrossEnvironmentErrorMessageBuilder.ErrorTypes.EXTERNAL_DATA_DOES_NOT_MATCH_WITH_EXPECTED,
- functionInvocationExpression: "(Pug内論理)->MixinArgumentsValidator.getValidatedArguments(rawArguments, mixinArgumentsSpecification)",
- description: "未処理エラーA2"
- }));
- const r = e;
- for (const [e, a] of Object.entries(r.requires)) t[e] = a
- }
- if (Object.prototype.hasOwnProperty.call(e, "optionals")) {
- if (!Object(a.isObject)(e)) throw new Error(a.CrossEnvironmentErrorMessageBuilder.buildErrorMessage({
- errorType: a.CrossEnvironmentErrorMessageBuilder.ErrorTypes.EXTERNAL_DATA_DOES_NOT_MATCH_WITH_EXPECTED,
- functionInvocationExpression: "(Pug内論理)->MixinArgumentsValidator.getValidatedArguments(rawArguments, mixinArgumentsSpecification)",
- description: "未処理エラーA3"
- }));
- const r = e;
- for (const [e, a] of Object.entries(r.optionals)) t[e] = a
- }
- return t
- }
- }
- }])
- }));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement