typedconverter
Advanced tools
Comparing version 1.0.0-beta.0 to 1.0.0-beta.1
@@ -23,2 +23,3 @@ declare type Class = new (...args: any[]) => any; | ||
type: T; | ||
name: string; | ||
parent?: { | ||
@@ -59,3 +60,4 @@ type: Class; | ||
decorators: any[]; | ||
constructor({ type, parent, path, converters, visitors, decorators, ...opts }: ObjectInfo<Function | Function[] | undefined>); | ||
name: string; | ||
constructor({ type, parent, path, name, converters, visitors, decorators, ...opts }: ObjectInfo<Function | Function[] | undefined>); | ||
abstract proceed(): Promise<ConversionResult>; | ||
@@ -62,0 +64,0 @@ } |
@@ -42,3 +42,3 @@ "use strict"; | ||
constructor(_a) { | ||
var { type, parent, path, converters, visitors, decorators } = _a, opts = tslib_1.__rest(_a, ["type", "parent", "path", "converters", "visitors", "decorators"]); | ||
var { type, parent, path, name, converters, visitors, decorators } = _a, opts = tslib_1.__rest(_a, ["type", "parent", "path", "name", "converters", "visitors", "decorators"]); | ||
this.type = type; | ||
@@ -50,2 +50,3 @@ this.parent = parent; | ||
this.decorators = decorators; | ||
this.name = name; | ||
Object.assign(this, opts); | ||
@@ -180,3 +181,3 @@ } | ||
for (let x of reflection.properties) { | ||
const propResult = await convert(value[x.name], Object.assign({ path: path.concat(x.name), type: x.type }, restInfo, { decorators: x.decorators.concat(restInfo.decorators) })); | ||
const propResult = await convert(value[x.name], Object.assign({ path: path.concat(x.name), type: x.type }, restInfo, { name: x.name, decorators: x.decorators.concat(restInfo.decorators) })); | ||
if (propResult.messages.length > 0) | ||
@@ -195,3 +196,3 @@ result.messages = mergeIssue(result.messages, propResult.messages); | ||
var { type, path } = _a, restInfo = tslib_1.__rest(_a, ["type", "path"]); | ||
const result = await Promise.all(value.map((x, i) => convert(x, Object.assign({ path: path.concat(i.toString()), type: type[0] }, restInfo)))); | ||
const result = await Promise.all(value.map((x, i) => convert(x, Object.assign({ path: path.concat(i.toString()), type: type[0] }, restInfo, { name: i.toString() })))); | ||
const returnedResult = new ConversionResult(result.map(x => x.value)); | ||
@@ -254,3 +255,3 @@ for (const item of result) { | ||
const { type = factoryOption.type, path = [], decorators = [], errorStatus = 400 } = opt, restOpt = tslib_1.__rest(opt, ["type", "path", "decorators", "errorStatus"]); | ||
const result = await convert(value, Object.assign({ visitors: factoryOption.visitors || [], converters: mergedConverters, path, type, decorators }, restOpt)); | ||
const result = await convert(value, Object.assign({ visitors: factoryOption.visitors || [], converters: mergedConverters, name: path[0] || "", path, type, decorators }, restOpt)); | ||
if (result.messages.length > 0) | ||
@@ -257,0 +258,0 @@ throw new ConversionError(result.messages, errorStatus); |
{ | ||
"name": "typedconverter", | ||
"version": "1.0.0-beta.0", | ||
"version": "1.0.0-beta.1", | ||
"description": "Convert object into classes match with TypeScript type annotation", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20624
334