@quick-qui/model-core
Advanced tools
@@ -1,5 +0,5 @@ | ||
| export { Log, } from "./Log"; | ||
| export { Model, } from "./Model"; | ||
| export { ModelDefineConfig, ModelDefine, } from "./ModelDefine"; | ||
| export { ModelValidator, ValidateError, } from "./ModelValidator"; | ||
| export { ModelWeaver, ModelWeaveLog, ModelWeaverConfig, } from "./ModelWeaver"; | ||
| export { Log } from "./Log"; | ||
| export { Model } from "./Model"; | ||
| export { ModelDefineConfig, ModelDefine, NormalizeLog } from "./ModelDefine"; | ||
| export { ModelValidator, ValidateLog } from "./ModelValidator"; | ||
| export { ModelWeaver, WeaveLog, ModelWeaverConfig } from "./ModelWeaver"; |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.ModelWeaveLog = exports.ValidateError = void 0; | ||
| exports.WeaveLog = exports.ValidateLog = exports.NormalizeLog = void 0; | ||
| var ModelDefine_1 = require("./ModelDefine"); | ||
| Object.defineProperty(exports, "NormalizeLog", { enumerable: true, get: function () { return ModelDefine_1.NormalizeLog; } }); | ||
| var ModelValidator_1 = require("./ModelValidator"); | ||
| Object.defineProperty(exports, "ValidateError", { enumerable: true, get: function () { return ModelValidator_1.ValidateError; } }); | ||
| Object.defineProperty(exports, "ValidateLog", { enumerable: true, get: function () { return ModelValidator_1.ValidateLog; } }); | ||
| var ModelWeaver_1 = require("./ModelWeaver"); | ||
| Object.defineProperty(exports, "ModelWeaveLog", { enumerable: true, get: function () { return ModelWeaver_1.ModelWeaveLog; } }); | ||
| Object.defineProperty(exports, "WeaveLog", { enumerable: true, get: function () { return ModelWeaver_1.WeaveLog; } }); | ||
| //# sourceMappingURL=index.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/model/index.ts"],"names":[],"mappings":";;;AAUA,mDAG0B;AADtB,+GAAA,aAAa,OAAA;AAEjB,6CAIuB;AAFnB,4GAAA,aAAa,OAAA"} | ||
| {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/model/index.ts"],"names":[],"mappings":";;;AAEA,6CAA6E;AAApC,2GAAA,YAAY,OAAA;AACrD,mDAA+D;AAAtC,6GAAA,WAAW,OAAA;AACpC,6CAAyE;AAAnD,uGAAA,QAAQ,OAAA"} |
@@ -1,4 +0,4 @@ | ||
| import { ValidateError } from "./ModelValidator"; | ||
| import { ValidateLog } from "./ModelValidator"; | ||
| import { Model } from "./Model"; | ||
| import { ModelWeaver } from "."; | ||
| import { Log, ModelWeaver } from "."; | ||
| export interface ModelDefineConfig { | ||
@@ -10,2 +10,9 @@ name: string; | ||
| } | ||
| export declare class NormalizeLog implements Log { | ||
| category: string; | ||
| level: string; | ||
| message: string; | ||
| context: string; | ||
| constructor(context: string, message: string, level?: string); | ||
| } | ||
| export interface ModelDefine { | ||
@@ -15,8 +22,8 @@ name: string; | ||
| objectPattern?: string; | ||
| validatePiece(piece: any, model: Model, buildingContext?: any): ValidateError[]; | ||
| normalize?(model: Model, piece: any): any; | ||
| validatePiece(piece: any, model: Model, buildingContext?: any): ValidateLog[]; | ||
| normalize?(model: Model, piece: any): [any, NormalizeLog[]]; | ||
| merge(model: Model, piece: any, buildingContext?: any): Model; | ||
| validateAfterMerge(model: Model): ValidateError[]; | ||
| validateAfterWeave(model: Model): ValidateError[]; | ||
| validateAfterMerge(model: Model): ValidateLog[]; | ||
| validateAfterWeave(model: Model): ValidateLog[]; | ||
| weavers: ModelWeaver[]; | ||
| } |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| // export const modelDefineRuntimeType = t.type({ | ||
| // name: t.string, | ||
| // filePattern: t.string, | ||
| // objectPattern: t.optional(t.string), | ||
| // validatePiece: t.Function, | ||
| // merge: t.Function, | ||
| // validateAfterMerge: t.Function, | ||
| // validateAfterWeave: t.Function, | ||
| // weavers: t.array(modelWeaverRT), | ||
| // }); | ||
| exports.NormalizeLog = void 0; | ||
| var NormalizeLog = /** @class */ (function () { | ||
| function NormalizeLog(context, message, level) { | ||
| if (level === void 0) { level = "info"; } | ||
| this.category = "model-normalize"; | ||
| this.message = ""; | ||
| this.context = ""; | ||
| this.message = message; | ||
| this.context = context; | ||
| this.level = level; | ||
| } | ||
| return NormalizeLog; | ||
| }()); | ||
| exports.NormalizeLog = NormalizeLog; | ||
| //# sourceMappingURL=ModelDefine.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"ModelDefine.js","sourceRoot":"","sources":["../../src/model/ModelDefine.ts"],"names":[],"mappings":";;AA8BA,iDAAiD;AACjD,oBAAoB;AACpB,2BAA2B;AAC3B,yCAAyC;AACzC,+BAA+B;AAC/B,uBAAuB;AACvB,oCAAoC;AACpC,oCAAoC;AACpC,qCAAqC;AACrC,MAAM"} | ||
| {"version":3,"file":"ModelDefine.js","sourceRoot":"","sources":["../../src/model/ModelDefine.ts"],"names":[],"mappings":";;;AAWA;IAKE,sBAAY,OAAe,EAAE,OAAe,EAAE,KAAsB;QAAtB,sBAAA,EAAA,cAAsB;QAJpE,aAAQ,GAAW,iBAAiB,CAAC;QAErC,YAAO,GAAW,EAAE,CAAC;QACrB,YAAO,GAAW,EAAE,CAAC;QAEnB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IACH,mBAAC;AAAD,CAAC,AAVD,IAUC;AAVY,oCAAY"} |
@@ -1,7 +0,7 @@ | ||
| import { Model } from './Model'; | ||
| import { Log } from './Log'; | ||
| import { Model } from "./Model"; | ||
| import { Log } from "./Log"; | ||
| export interface ModelValidator { | ||
| validate(model: Model): ValidateError[]; | ||
| validate(model: Model): ValidateLog[]; | ||
| } | ||
| export declare class ValidateError implements Log { | ||
| export declare class ValidateLog implements Log { | ||
| category: string; | ||
@@ -11,3 +11,3 @@ level: string; | ||
| context: string; | ||
| constructor(context: string, message: string); | ||
| constructor(context: string, message: string, level?: string); | ||
| } |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.ValidateError = void 0; | ||
| var ValidateError = /** @class */ (function () { | ||
| function ValidateError(context, message) { | ||
| this.category = 'model-validate'; | ||
| this.level = 'error'; | ||
| this.message = ''; | ||
| this.context = ''; | ||
| exports.ValidateLog = void 0; | ||
| var ValidateLog = /** @class */ (function () { | ||
| function ValidateLog(context, message, level) { | ||
| if (level === void 0) { level = "error"; } | ||
| this.category = "model-validate"; | ||
| this.message = ""; | ||
| this.context = ""; | ||
| this.message = message; | ||
| this.context = context; | ||
| this.level = level; | ||
| } | ||
| return ValidateError; | ||
| return ValidateLog; | ||
| }()); | ||
| exports.ValidateError = ValidateError; | ||
| exports.ValidateLog = ValidateLog; | ||
| //# sourceMappingURL=ModelValidator.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"ModelValidator.js","sourceRoot":"","sources":["../../src/model/ModelValidator.ts"],"names":[],"mappings":";;;AAMA;IAKI,uBAAY,OAAc,EAAC,OAAe;QAJ1C,aAAQ,GAAW,gBAAgB,CAAA;QACnC,UAAK,GAAW,OAAO,CAAA;QACvB,YAAO,GAAW,EAAE,CAAA;QACpB,YAAO,GAAU,EAAE,CAAA;QAEf,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IAC1B,CAAC;IACL,oBAAC;AAAD,CAAC,AATD,IASC;AATY,sCAAa"} | ||
| {"version":3,"file":"ModelValidator.js","sourceRoot":"","sources":["../../src/model/ModelValidator.ts"],"names":[],"mappings":";;;AAMA;IAKE,qBAAY,OAAe,EAAE,OAAe,EAAE,KAAuB;QAAvB,sBAAA,EAAA,eAAuB;QAJrE,aAAQ,GAAW,gBAAgB,CAAC;QAEpC,YAAO,GAAW,EAAE,CAAC;QACrB,YAAO,GAAW,EAAE,CAAC;QAEnB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IACH,kBAAC;AAAD,CAAC,AAVD,IAUC;AAVY,kCAAW"} |
| import { Log } from "./Log"; | ||
| import { Model } from "./Model"; | ||
| import * as t from 'io-ts'; | ||
| export interface ModelWeaver { | ||
| name: string; | ||
| order?: number; | ||
| weave(model: Model): [Model, ModelWeaveLog[]]; | ||
| weave(model: Model): [Model, WeaveLog[]]; | ||
| } | ||
| export declare class ModelWeaveLog implements Log { | ||
| export declare class WeaveLog implements Log { | ||
| level: string; | ||
@@ -20,4 +19,1 @@ category: string; | ||
| } | ||
| export declare const modelWeaverRT: t.TypeC<{ | ||
| name: t.StringC; | ||
| }>; |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.modelWeaverRT = exports.ModelWeaveLog = void 0; | ||
| var t = require("io-ts"); | ||
| var ModelWeaveLog = /** @class */ (function () { | ||
| function ModelWeaveLog(context, message, error) { | ||
| exports.WeaveLog = void 0; | ||
| var WeaveLog = /** @class */ (function () { | ||
| function WeaveLog(context, message, error) { | ||
| if (error === void 0) { error = false; } | ||
@@ -18,10 +17,5 @@ this.level = 'info'; | ||
| } | ||
| return ModelWeaveLog; | ||
| return WeaveLog; | ||
| }()); | ||
| exports.ModelWeaveLog = ModelWeaveLog; | ||
| exports.modelWeaverRT = t.type({ | ||
| name: t.string, | ||
| // TODO, instance的方法不是这样的。https://github.com/gcanti/io-ts/issues/272 | ||
| // weave:t.Function | ||
| }); | ||
| exports.WeaveLog = WeaveLog; | ||
| //# sourceMappingURL=ModelWeaver.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"ModelWeaver.js","sourceRoot":"","sources":["../../src/model/ModelWeaver.ts"],"names":[],"mappings":";;;AAEA,yBAA2B;AAS3B;IAKI,uBAAY,OAAc,EAAC,OAAe,EAAC,KAAmB;QAAnB,sBAAA,EAAA,aAAmB;QAJ9D,UAAK,GAAW,MAAM,CAAA;QACtB,aAAQ,GAAW,aAAa,CAAA;QAChC,YAAO,GAAW,EAAE,CAAA;QACpB,YAAO,GAAU,EAAE,CAAA;QAEf,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAG,KAAK,EAAC;YACL,IAAI,CAAC,KAAK,GAAG,OAAO,CAAA;SACvB;IACL,CAAC;IACL,oBAAC;AAAD,CAAC,AAZD,IAYC;AAZY,sCAAa;AAkBb,QAAA,aAAa,GAAG,CAAC,CAAC,IAAI,CAAC;IAChC,IAAI,EAAC,CAAC,CAAC,MAAM;IACb,oEAAoE;IACpE,mBAAmB;CACtB,CAAC,CAAA"} | ||
| {"version":3,"file":"ModelWeaver.js","sourceRoot":"","sources":["../../src/model/ModelWeaver.ts"],"names":[],"mappings":";;;AAWA;IAKI,kBAAY,OAAc,EAAC,OAAe,EAAC,KAAmB;QAAnB,sBAAA,EAAA,aAAmB;QAJ9D,UAAK,GAAW,MAAM,CAAA;QACtB,aAAQ,GAAW,aAAa,CAAA;QAChC,YAAO,GAAW,EAAE,CAAA;QACpB,YAAO,GAAU,EAAE,CAAA;QAEf,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAG,KAAK,EAAC;YACL,IAAI,CAAC,KAAK,GAAG,OAAO,CAAA;SACvB;IACL,CAAC;IACL,eAAC;AAAD,CAAC,AAZD,IAYC;AAZY,4BAAQ"} |
+1
-1
| { | ||
| "name": "@quick-qui/model-core", | ||
| "version": "2.3.0", | ||
| "version": "2.4.0", | ||
| "description": "model core", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
8766
4.17%147
2.8%