@plumier/core
Advanced tools
Comparing version 1.0.5 to 1.0.6-canary.3
@@ -103,3 +103,3 @@ "use strict"; | ||
} | ||
if (common_1.hasKeyOf(context, "route")) { | ||
if ((0, common_1.hasKeyOf)(context, "route")) { | ||
const middlewares = [ | ||
@@ -106,0 +106,0 @@ // 1. global middlewares |
@@ -52,3 +52,3 @@ "use strict"; | ||
function checkMistypedPoliciesOnRoute(route, policies, globalAuthorize) { | ||
const authDecorators = authorization_1.getRouteAuthorizeDecorators(route, globalAuthorize); | ||
const authDecorators = (0, authorization_1.getRouteAuthorizeDecorators)(route, globalAuthorize); | ||
const mistyped = getPolicyInfo(authDecorators, policies) | ||
@@ -67,4 +67,4 @@ .filter(x => x.type === "Mistyped") | ||
const type = Array.isArray(par.type) ? par.type[0] : par.type; | ||
if (common_1.isCustomClass(type)) { | ||
const meta = reflect_1.reflect(type); | ||
if ((0, common_1.isCustomClass)(type)) { | ||
const meta = (0, reflect_1.reflect)(type); | ||
const mistyped = getMistypedMultiple(meta.properties, policies, x => x.type === "Mistyped"); | ||
@@ -81,4 +81,4 @@ messages.push(...mistyped.map(x => ({ | ||
const type = Array.isArray(route.action.returnType) ? route.action.returnType[0] : route.action.returnType; | ||
if (common_1.isCustomClass(type)) { | ||
const meta = reflect_1.reflect(type); | ||
if ((0, common_1.isCustomClass)(type)) { | ||
const meta = (0, reflect_1.reflect)(type); | ||
const mistyped = getMistypedMultiple(meta.properties, policies, x => x.type === "Mistyped"); | ||
@@ -101,3 +101,3 @@ return mistyped.map(x => ({ | ||
function checkMissingEntityProviderOnRoute(route, policies, globalAuthorize) { | ||
const authDecorators = authorization_1.getRouteAuthorizeDecorators(route, globalAuthorize); | ||
const authDecorators = (0, authorization_1.getRouteAuthorizeDecorators)(route, globalAuthorize); | ||
const provider = getEntityProvider(route); | ||
@@ -131,4 +131,4 @@ if (!!provider) | ||
const type = Array.isArray(par.type) ? par.type[0] : par.type; | ||
if (common_1.isCustomClass(type)) { | ||
const meta = reflect_1.reflect(type); | ||
if ((0, common_1.isCustomClass)(type)) { | ||
const meta = (0, reflect_1.reflect)(type); | ||
for (const prop of meta.properties) { | ||
@@ -153,3 +153,3 @@ const decs = prop.decorators.filter((x) => x.type === "plumier-meta:authorize"); | ||
function checkMissingEntityPolicyOnRoute(route, policies, globalAuthorize) { | ||
const authDecorators = authorization_1.getRouteAuthorizeDecorators(route, globalAuthorize); | ||
const authDecorators = (0, authorization_1.getRouteAuthorizeDecorators)(route, globalAuthorize); | ||
const provider = getEntityProvider(route); | ||
@@ -182,4 +182,4 @@ if (!provider) | ||
const type = Array.isArray(par.type) ? par.type[0] : par.type; | ||
if (common_1.isCustomClass(type)) { | ||
const meta = reflect_1.reflect(type); | ||
if ((0, common_1.isCustomClass)(type)) { | ||
const meta = (0, reflect_1.reflect)(type); | ||
for (const prop of meta.properties) { | ||
@@ -201,3 +201,3 @@ const decs = prop.decorators.filter((x) => x.type === "plumier-meta:authorize"); | ||
if (x.kind === "ActionRoute") { | ||
const decorators = authorization_1.getRouteAuthorizeDecorators(x, config.globalAuthorizations); | ||
const decorators = (0, authorization_1.getRouteAuthorizeDecorators)(x, config.globalAuthorizations); | ||
x.access = decorators.map(x => x.tag).join("|"); | ||
@@ -204,0 +204,0 @@ } |
@@ -6,3 +6,3 @@ "use strict"; | ||
const reflect_1 = require("@plumier/reflect"); | ||
const debug_1 = tslib_1.__importDefault(require("debug")); | ||
const debug_1 = (0, tslib_1.__importDefault)(require("debug")); | ||
const common_1 = require("./common"); | ||
@@ -15,3 +15,3 @@ const http_status_1 = require("./http-status"); | ||
const log = { | ||
debug: debug_1.default("@plumier/core:authorization"), | ||
debug: (0, debug_1.default)("@plumier/core:authorization"), | ||
}; | ||
@@ -59,3 +59,3 @@ /* ------------------------------------------------------------------------------- */ | ||
function throwAuthError(ctx, msg) { | ||
if (!ctx.user) | ||
if (ctx.user) | ||
throw new types_1.HttpStatusError(http_status_1.HttpStatus.Forbidden, msg !== null && msg !== void 0 ? msg : "Forbidden"); | ||
@@ -353,4 +353,4 @@ else | ||
// loop through custom class properties | ||
if (common_1.isCustomClass(meta.type)) { | ||
const classMeta = reflect_1.reflect(meta.type); | ||
if ((0, common_1.isCustomClass)(meta.type)) { | ||
const classMeta = (0, reflect_1.reflect)(meta.type); | ||
const values = classMeta.properties.map(x => value[x.name]); | ||
@@ -389,7 +389,7 @@ return checkParameters(classMeta.properties, values, Object.assign(Object.assign({}, ctx), { parent: meta.type, parentValue: value })); | ||
return { kind: "Array", child: await compileType(type[0], authPolicies, parentTypes) }; | ||
if (common_1.isCustomClass(type)) { | ||
if ((0, common_1.isCustomClass)(type)) { | ||
// CIRCULAR: just return basic node if circular dependency happened | ||
if (parentTypes.some(x => x === type)) | ||
return { kind: "Class", properties: [] }; | ||
const meta = reflect_1.reflect(type); | ||
const meta = (0, reflect_1.reflect)(type); | ||
const properties = []; | ||
@@ -396,0 +396,0 @@ for (const prop of meta.properties) { |
@@ -20,3 +20,3 @@ "use strict"; | ||
return; | ||
return common_1.isCustomClass(par.type) || !!(par.type && par.type[0]) ? ctx.request.body : undefined; | ||
return (0, common_1.isCustomClass)(par.type) || !!(par.type && par.type[0]) ? ctx.request.body : undefined; | ||
} | ||
@@ -23,0 +23,0 @@ function bindDecorator(ctx, par) { |
@@ -6,9 +6,9 @@ "use strict"; | ||
const fs_1 = require("fs"); | ||
const glob_1 = tslib_1.__importDefault(require("glob")); | ||
const reflect_1 = tslib_1.__importStar(require("@plumier/reflect")); | ||
const glob_1 = (0, tslib_1.__importDefault)(require("glob")); | ||
const reflect_1 = (0, tslib_1.__importStar)(require("@plumier/reflect")); | ||
const util_1 = require("util"); | ||
const types_1 = require("./types"); | ||
const path_1 = require("path"); | ||
const lstatAsync = util_1.promisify(fs_1.lstat); | ||
const existsAsync = util_1.promisify(fs_1.exists); | ||
const lstatAsync = (0, util_1.promisify)(fs_1.lstat); | ||
const existsAsync = (0, util_1.promisify)(fs_1.exists); | ||
String.prototype.format = function (...args) { | ||
@@ -67,3 +67,3 @@ return this.replace(/{(\d+)}/g, (m, i) => args[i]); | ||
const cache = new Map(); | ||
return reflect_1.useCache(cache, fn, getKey); | ||
return (0, reflect_1.useCache)(cache, fn, getKey); | ||
} | ||
@@ -79,3 +79,3 @@ exports.memoize = memoize; | ||
return new Promise((resolve) => { | ||
glob_1.default(path, Object.assign({}, opts), (e, match) => resolve(match)); | ||
(0, glob_1.default)(path, Object.assign({}, opts), (e, match) => resolve(match)); | ||
}); | ||
@@ -131,3 +131,3 @@ } | ||
if (typeof path === "string") { | ||
const absPath = path_1.isAbsolute(path) ? path : path_1.join(opt.rootDir, path); | ||
const absPath = (0, path_1.isAbsolute)(path) ? path : (0, path_1.join)(opt.rootDir, path); | ||
//read all files and get module reflection | ||
@@ -138,3 +138,3 @@ const files = await findFilesRecursive(absPath); | ||
const root = !!opt.directoryAsPath ? ((_a = getRoot(absPath, file)) !== null && _a !== void 0 ? _a : "") : ""; | ||
for (const member of reflect_1.default(file).members) { | ||
for (const member of (0, reflect_1.default)(file).members) { | ||
if (member.kind === "Class") | ||
@@ -199,3 +199,3 @@ result.push({ root, type: member.type }); | ||
return []; | ||
const meta = reflect_1.default(type); | ||
const meta = (0, reflect_1.default)(type); | ||
if (meta.properties.length === 0) | ||
@@ -220,3 +220,3 @@ return [{ location: type.name, issue: "NoProperties" }]; | ||
function getIdProp(entity) { | ||
const meta = reflect_1.default(entity); | ||
const meta = (0, reflect_1.default)(entity); | ||
for (const prop of meta.properties) { | ||
@@ -235,3 +235,3 @@ const decorator = prop.decorators.find((x) => x.kind === "plumier-meta:entity-id"); | ||
function getRelationInfo([entity, relation]) { | ||
const meta = reflect_1.default(entity); | ||
const meta = (0, reflect_1.default)(entity); | ||
const prop = meta.properties.find(x => x.name === relation); | ||
@@ -258,3 +258,3 @@ if (!prop) | ||
throw new Error(types_1.errorMessage.UnableToGetMemberDataType.format(entity.name, prop.name)); | ||
const parentMeta = reflect_1.default(parent); | ||
const parentMeta = (0, reflect_1.default)(parent); | ||
let parentProperty; | ||
@@ -261,0 +261,0 @@ for (const prop of parentMeta.properties) { |
@@ -15,3 +15,3 @@ "use strict"; | ||
function response(status, mime, type) { | ||
return reflect_1.decorateMethod({ kind: "ApiResponse", status, mime, type }); | ||
return (0, reflect_1.decorateMethod)({ kind: "ApiResponse", status, mime, type }); | ||
} | ||
@@ -24,3 +24,3 @@ api.response = response; | ||
function description(desc) { | ||
return reflect_1.decorate({ kind: "ApiDescription", desc }); | ||
return (0, reflect_1.decorate)({ kind: "ApiDescription", desc }); | ||
} | ||
@@ -33,3 +33,3 @@ api.description = description; | ||
function tag(tag) { | ||
return reflect_1.decorate({ [reflect_1.DecoratorId]: apiTagId, kind: "ApiTag", tag }, ["Class", "Property"]); | ||
return (0, reflect_1.decorate)({ [reflect_1.DecoratorId]: apiTagId, kind: "ApiTag", tag }, ["Class", "Property"]); | ||
} | ||
@@ -41,3 +41,3 @@ api.tag = tag; | ||
function readonly() { | ||
return reflect_1.decorateProperty({ kind: "ApiReadonly" }); | ||
return (0, reflect_1.decorateProperty)({ kind: "ApiReadonly" }); | ||
} | ||
@@ -49,3 +49,3 @@ api.readonly = readonly; | ||
function writeonly() { | ||
return reflect_1.decorateProperty({ kind: "ApiWriteOnly" }); | ||
return (0, reflect_1.decorateProperty)({ kind: "ApiWriteOnly" }); | ||
} | ||
@@ -57,3 +57,3 @@ api.writeonly = writeonly; | ||
function required() { | ||
return reflect_1.decorateProperty({ kind: "ApiRequired" }); | ||
return (0, reflect_1.decorateProperty)({ kind: "ApiRequired" }); | ||
} | ||
@@ -66,3 +66,3 @@ api.required = required; | ||
function name(alias) { | ||
return reflect_1.decorateProperty({ kind: "ApiFieldName", alias }); | ||
return (0, reflect_1.decorateProperty)({ kind: "ApiFieldName", alias }); | ||
} | ||
@@ -75,3 +75,3 @@ api.name = name; | ||
function enums(...enums) { | ||
return reflect_1.decorateProperty({ kind: "ApiEnum", enums }); | ||
return (0, reflect_1.decorateProperty)({ kind: "ApiEnum", enums }); | ||
} | ||
@@ -87,3 +87,3 @@ api.enums = enums; | ||
function hideRelations() { | ||
return reflect_1.decorate({ kind: "ApiNoRelation" }, ["Method", "Parameter", "Property"]); | ||
return (0, reflect_1.decorate)({ kind: "ApiNoRelation" }, ["Method", "Parameter", "Property"]); | ||
} | ||
@@ -90,0 +90,0 @@ api.hideRelations = hideRelations; |
@@ -16,3 +16,3 @@ "use strict"; | ||
const option = Object.assign({ tag: "Custom", evaluation: "Dynamic" }, opt); | ||
return reflect_1.decorate((...args) => { | ||
return (0, reflect_1.decorate)((...args) => { | ||
const location = args.length === 1 ? "Class" : args.length === 2 ? "Method" : "Parameter"; | ||
@@ -56,3 +56,3 @@ return { | ||
readWrite(...policies) { | ||
return reflect_1.mergeDecorator(this.byPolicies(policies, "read"), this.byPolicies(policies, "write")); | ||
return (0, reflect_1.mergeDecorator)(this.byPolicies(policies, "read"), this.byPolicies(policies, "write")); | ||
} | ||
@@ -63,3 +63,3 @@ /** | ||
readonly() { | ||
return reflect_1.mergeDecorator(this.write(authorization_1.AuthorizeReadonly), api_1.api.readonly()); | ||
return (0, reflect_1.mergeDecorator)(this.write(authorization_1.AuthorizeReadonly), api_1.api.readonly()); | ||
} | ||
@@ -70,3 +70,3 @@ /** | ||
writeonly() { | ||
return reflect_1.mergeDecorator(this.read(authorization_1.AuthorizeWriteonly), api_1.api.writeonly()); | ||
return (0, reflect_1.mergeDecorator)(this.read(authorization_1.AuthorizeWriteonly), api_1.api.writeonly()); | ||
} | ||
@@ -77,3 +77,3 @@ /** | ||
none() { | ||
return reflect_1.mergeDecorator(this.write(authorization_1.AuthorizeReadonly), api_1.api.readonly(), this.read(authorization_1.AuthorizeWriteonly), api_1.api.writeonly()); | ||
return (0, reflect_1.mergeDecorator)(this.write(authorization_1.AuthorizeReadonly), api_1.api.readonly(), this.read(authorization_1.AuthorizeWriteonly), api_1.api.writeonly()); | ||
} | ||
@@ -80,0 +80,0 @@ } |
@@ -10,3 +10,3 @@ "use strict"; | ||
function ctxDecorator(name, part) { | ||
return custom(ctx => part ? common_1.getChildValue(ctx, part) : ctx, name); | ||
return custom(ctx => part ? (0, common_1.getChildValue)(ctx, part) : ctx, name); | ||
} | ||
@@ -117,3 +117,3 @@ /** | ||
function formFile(name) { | ||
return reflect_1.mergeDecorator(bind.custom(ctx => { var _a; return (_a = ctx.request.files) === null || _a === void 0 ? void 0 : _a[name]; }, "formFile"), api_1.api.name(name)); | ||
return (0, reflect_1.mergeDecorator)(bind.custom(ctx => { var _a; return (_a = ctx.request.files) === null || _a === void 0 ? void 0 : _a[name]; }, "formFile"), api_1.api.name(name)); | ||
} | ||
@@ -141,5 +141,5 @@ bind.formFile = formFile; | ||
function custom(process, name = "custom") { | ||
return reflect_1.decorateParameter({ type: "ParameterBinding", process, name }); | ||
return (0, reflect_1.decorateParameter)({ type: "ParameterBinding", process, name }); | ||
} | ||
bind.custom = custom; | ||
})(bind = exports.bind || (exports.bind = {})); |
@@ -5,3 +5,3 @@ "use strict"; | ||
const tslib_1 = require("tslib"); | ||
const reflect_1 = tslib_1.__importStar(require("@plumier/reflect")); | ||
const reflect_1 = (0, tslib_1.__importStar)(require("@plumier/reflect")); | ||
// --------------------------------------------------------------------- // | ||
@@ -19,3 +19,3 @@ // ------------------------------- DOMAIN ------------------------------ // | ||
const value = { name: "Middleware", value: middleware }; | ||
return reflect_1.decorate((...args) => { | ||
return (0, reflect_1.decorate)((...args) => { | ||
if (args.length === 1) | ||
@@ -32,8 +32,8 @@ return Object.assign(Object.assign({}, value), { target: "Controller" }); | ||
function entityProvider(entity, idParam, opt) { | ||
return reflect_1.decorate({ kind: "plumier-meta:entity-policy-provider", entity, idParam }, ["Class", "Method"], opt); | ||
return (0, reflect_1.decorate)({ kind: "plumier-meta:entity-policy-provider", entity, idParam }, ["Class", "Method"], opt); | ||
} | ||
exports.entityProvider = entityProvider; | ||
function responseType(type, opt) { | ||
return reflect_1.decorate({ kind: "plumier-meta:response-type", type }, ["Class", "Method"], opt); | ||
return (0, reflect_1.decorate)({ kind: "plumier-meta:response-type", type }, ["Class", "Method"], opt); | ||
} | ||
exports.responseType = responseType; |
@@ -11,3 +11,3 @@ "use strict"; | ||
function primaryId() { | ||
return reflect_1.decorateProperty({ kind: "plumier-meta:entity-id" }); | ||
return (0, reflect_1.decorateProperty)({ kind: "plumier-meta:entity-id" }); | ||
} | ||
@@ -19,3 +19,3 @@ entity.primaryId = primaryId; | ||
function relation(opt) { | ||
return reflect_1.decorateProperty({ kind: "plumier-meta:relation", inverseProperty: opt === null || opt === void 0 ? void 0 : opt.inverseProperty }); | ||
return (0, reflect_1.decorateProperty)({ kind: "plumier-meta:relation", inverseProperty: opt === null || opt === void 0 ? void 0 : opt.inverseProperty }); | ||
} | ||
@@ -27,3 +27,3 @@ entity.relation = relation; | ||
function deleteColumn() { | ||
return reflect_1.decorateProperty({ kind: "plumier-meta:delete-column" }); | ||
return (0, reflect_1.decorateProperty)({ kind: "plumier-meta:delete-column" }); | ||
} | ||
@@ -30,0 +30,0 @@ entity.deleteColumn = deleteColumn; |
@@ -5,3 +5,3 @@ "use strict"; | ||
const tslib_1 = require("tslib"); | ||
const reflect_1 = tslib_1.__importDefault(require("@plumier/reflect")); | ||
const reflect_1 = (0, tslib_1.__importDefault)(require("@plumier/reflect")); | ||
var meta; | ||
@@ -8,0 +8,0 @@ (function (meta) { |
@@ -10,3 +10,3 @@ "use strict"; | ||
function preSave(...method) { | ||
return reflect_1.decorateMethod({ kind: "plumier-meta:request-hook", type: "preSave", method }); | ||
return (0, reflect_1.decorateMethod)({ kind: "plumier-meta:request-hook", type: "preSave", method }); | ||
} | ||
@@ -19,4 +19,4 @@ exports.preSave = preSave; | ||
function postSave(...method) { | ||
return reflect_1.decorateMethod({ kind: "plumier-meta:request-hook", type: "postSave", method }); | ||
return (0, reflect_1.decorateMethod)({ kind: "plumier-meta:request-hook", type: "postSave", method }); | ||
} | ||
exports.postSave = postSave; |
@@ -9,3 +9,3 @@ "use strict"; | ||
const opt = !!option ? Object.assign({ path: pathOrOption }, option) : typeof pathOrOption === "string" ? { path: pathOrOption } : pathOrOption; | ||
return reflect_1.decorate({ name: "plumier-meta:route", method, url: opt === null || opt === void 0 ? void 0 : opt.path, map: opt === null || opt === void 0 ? void 0 : opt.map }, ["Class", "Method"], { applyTo: (_a = opt === null || opt === void 0 ? void 0 : opt.applyTo) !== null && _a !== void 0 ? _a : [] }); | ||
return (0, reflect_1.decorate)({ name: "plumier-meta:route", method, url: opt === null || opt === void 0 ? void 0 : opt.path, map: opt === null || opt === void 0 ? void 0 : opt.map }, ["Class", "Method"], { applyTo: (_a = opt === null || opt === void 0 ? void 0 : opt.applyTo) !== null && _a !== void 0 ? _a : [] }); | ||
} | ||
@@ -41,3 +41,3 @@ post(url, option) { return this.decorateRoute("post", url, option); } | ||
*/ | ||
root(url, option) { return reflect_1.decorateClass({ name: "plumier-meta:root", url, map: option === null || option === void 0 ? void 0 : option.map }); } | ||
root(url, option) { return (0, reflect_1.decorateClass)({ name: "plumier-meta:root", url, map: option === null || option === void 0 ? void 0 : option.map }); } | ||
/** | ||
@@ -56,3 +56,3 @@ * Ignore method from route generation | ||
*/ | ||
ignore(opt) { return reflect_1.decorate({ [reflect_1.DecoratorId]: "route:ignore", name: "plumier-meta:ignore" }, ["Class", "Method", "Property", "Parameter"], Object.assign({ allowMultiple: false }, opt)); } | ||
ignore(opt) { return (0, reflect_1.decorate)({ [reflect_1.DecoratorId]: "route:ignore", name: "plumier-meta:ignore" }, ["Class", "Method", "Property", "Parameter"], Object.assign({ allowMultiple: false }, opt)); } | ||
} | ||
@@ -59,0 +59,0 @@ exports.RouteDecoratorImpl = RouteDecoratorImpl; |
@@ -5,6 +5,6 @@ "use strict"; | ||
const reflect_1 = require("@plumier/reflect"); | ||
const tc = tslib_1.__importStar(require("@plumier/validator")); | ||
const tc = (0, tslib_1.__importStar)(require("@plumier/validator")); | ||
const api_1 = require("./api"); | ||
tc.val.custom = (...val) => { | ||
return reflect_1.mergeDecorator(...val.map(x => reflect_1.decorate({ type: "ValidatorDecorator", validator: x }, ["Class", "Property", "Parameter"]))); | ||
return (0, reflect_1.mergeDecorator)(...val.map(x => (0, reflect_1.decorate)({ type: "ValidatorDecorator", validator: x }, ["Class", "Property", "Parameter"]))); | ||
}; | ||
@@ -19,3 +19,3 @@ tc.val.result = (a, b) => { | ||
const opt = Array.isArray(op) ? { enums: op, message: undefined } : op; | ||
return reflect_1.mergeDecorator(tc.val.custom(x => { | ||
return (0, reflect_1.mergeDecorator)(tc.val.custom(x => { | ||
if (!opt.enums.some(y => x === y)) | ||
@@ -27,3 +27,3 @@ return opt.message || `Value must be one of ${opt.enums.join(", ")}`; | ||
tc.val.required = () => { | ||
return reflect_1.mergeDecorator(originalRequired(), api_1.api.required()); | ||
return (0, reflect_1.mergeDecorator)(originalRequired(), api_1.api.required()); | ||
}; |
@@ -5,3 +5,3 @@ "use strict"; | ||
const tslib_1 = require("tslib"); | ||
const chalk_1 = tslib_1.__importDefault(require("chalk")); | ||
const chalk_1 = (0, tslib_1.__importDefault)(require("chalk")); | ||
const common_1 = require("./common"); | ||
@@ -59,3 +59,3 @@ const types_1 = require("./types"); | ||
else { | ||
const iss = common_1.analyzeModel(prop.type).map(x => toRouteAnalyzerIssue(x)); | ||
const iss = (0, common_1.analyzeModel)(prop.type).map(x => toRouteAnalyzerIssue(x)); | ||
issues.push(...iss); | ||
@@ -82,3 +82,3 @@ } | ||
if (origin.length > 40) | ||
return `${common_1.ellipsis(route.controller.name, 25)}.${common_1.ellipsis(route.action.name, 15)}`; | ||
return `${(0, common_1.ellipsis)(route.controller.name, 25)}.${(0, common_1.ellipsis)(route.action.name, 15)}`; | ||
else | ||
@@ -88,3 +88,3 @@ return origin; | ||
else { | ||
return common_1.ellipsis(origin, 40); | ||
return (0, common_1.ellipsis)(origin, 40); | ||
} | ||
@@ -128,6 +128,6 @@ } | ||
const issues = x.issues.map(issue => ` - ${issue.type} ${issue.message}`); | ||
return { method, url: common_1.ellipsis(x.route.url, 60), action, issues, access: x.route.access }; | ||
return { method, url: (0, common_1.ellipsis)(x.route.url, 60), action, issues, access: x.route.access }; | ||
}); | ||
const hasAccess = data.every(x => !!x.access); | ||
common_1.printTable([ | ||
(0, common_1.printTable)([ | ||
"action", | ||
@@ -134,0 +134,0 @@ { property: x => `->` }, |
@@ -24,3 +24,3 @@ "use strict"; | ||
else { | ||
return [{ root: common_1.appendRoute(root, striveController(controller.name)), map: {} }]; | ||
return [{ root: (0, common_1.appendRoute)(root, striveController(controller.name)), map: {} }]; | ||
} | ||
@@ -54,3 +54,3 @@ } | ||
else { | ||
return common_1.appendRoute(root, actionDecorator.url || actionName.toLowerCase()); | ||
return (0, common_1.appendRoute)(root, actionDecorator.url || actionName.toLowerCase()); | ||
} | ||
@@ -75,3 +75,3 @@ } | ||
group, method: "get", | ||
url: common_1.appendRoute(root.root, method.name), | ||
url: (0, common_1.appendRoute)(root.root, method.name), | ||
controller, | ||
@@ -83,3 +83,3 @@ action: method, | ||
function isController(controller) { | ||
const meta = reflect_1.reflect(controller); | ||
const meta = (0, reflect_1.reflect)(controller); | ||
return !!meta.name.match(/controller$/i) | ||
@@ -89,3 +89,3 @@ || !!meta.decorators.find((x) => x.name === "plumier-meta:root"); | ||
function transformController(object, opt) { | ||
const controller = reflect_1.reflect(object); | ||
const controller = (0, reflect_1.reflect)(object); | ||
const rootRoutes = getRootRoutes(opt.rootPath, controller); | ||
@@ -109,3 +109,3 @@ const infos = []; | ||
async function extractController(controller, option) { | ||
const classes = await common_1.findClassRecursive(controller, option); | ||
const classes = await (0, common_1.findClassRecursive)(controller, option); | ||
return classes.filter(x => isController(x.type)); | ||
@@ -118,3 +118,3 @@ } | ||
for (const controller of controllers) { | ||
routes.push(...transformController(controller.type, Object.assign(Object.assign({}, opt), { rootPath: common_1.appendRoute(controller.root, opt.rootPath) }))); | ||
routes.push(...transformController(controller.type, Object.assign(Object.assign({}, opt), { rootPath: (0, common_1.appendRoute)(controller.root, opt.rootPath) }))); | ||
} | ||
@@ -121,0 +121,0 @@ return routes; |
@@ -20,3 +20,3 @@ "use strict"; | ||
const keys = []; | ||
const regexp = path_to_regexp_1.pathToRegexp(route.url, keys); | ||
const regexp = (0, path_to_regexp_1.pathToRegexp)(route.url, keys); | ||
const match = regexp.exec(ctx.path); | ||
@@ -38,4 +38,4 @@ if (match) | ||
const getKey = (ctx) => `${ctx.method}${ctx.path}`; | ||
const getHandlerCached = common_1.memoize(getHandler, getKey); | ||
const createPipe = common_1.memoize(application_pipeline_1.createPipes, getKey); | ||
const getHandlerCached = (0, common_1.memoize)(getHandler, getKey); | ||
const createPipe = (0, common_1.memoize)(application_pipeline_1.createPipes, getKey); | ||
return async (ctx) => { | ||
@@ -42,0 +42,0 @@ try { |
@@ -7,6 +7,6 @@ "use strict"; | ||
const path_1 = require("path"); | ||
const reflect_1 = tslib_1.__importStar(require("@plumier/reflect")); | ||
const reflect_1 = (0, tslib_1.__importStar)(require("@plumier/reflect")); | ||
const util_1 = require("util"); | ||
const http_status_1 = require("./http-status"); | ||
const copyFileAsync = util_1.promisify(fs_1.copyFile); | ||
const copyFileAsync = (0, util_1.promisify)(fs_1.copyFile); | ||
class ActionResult { | ||
@@ -109,3 +109,3 @@ constructor(body, status) { | ||
register(id) { | ||
return reflect_1.decorateClass(cls => { | ||
return (0, reflect_1.decorateClass)(cls => { | ||
this.registry.set(id, cls); | ||
@@ -167,4 +167,4 @@ return { type: "RegistryDecorator", id }; | ||
const time = new Date().getTime().toString(36); | ||
const name = time + random + path_1.extname(this.name); | ||
const fullPath = path_1.join(dir, name); | ||
const name = time + random + (0, path_1.extname)(this.name); | ||
const fullPath = (0, path_1.join)(dir, name); | ||
await copyFileAsync(this.path, fullPath); | ||
@@ -174,5 +174,5 @@ return { fullPath, name }; | ||
}; | ||
FormFile = tslib_1.__decorate([ | ||
FormFile = (0, tslib_1.__decorate)([ | ||
reflect_1.default.parameterProperties(), | ||
tslib_1.__metadata("design:paramtypes", [Number, String, String, String, String]) | ||
(0, tslib_1.__metadata)("design:paramtypes", [Number, String, String, String, String]) | ||
], FormFile); | ||
@@ -179,0 +179,0 @@ exports.FormFile = FormFile; |
@@ -5,4 +5,4 @@ "use strict"; | ||
const tslib_1 = require("tslib"); | ||
const reflect_1 = tslib_1.__importDefault(require("@plumier/reflect")); | ||
const tc = tslib_1.__importStar(require("@plumier/validator")); | ||
const reflect_1 = (0, tslib_1.__importDefault)(require("@plumier/reflect")); | ||
const tc = (0, tslib_1.__importStar)(require("@plumier/validator")); | ||
const common_1 = require("./common"); | ||
@@ -26,4 +26,4 @@ const types_1 = require("./types"); | ||
const decorators = i.decorators.filter((x) => x.type === "ValidatorDecorator"); | ||
if (common_1.isCustomClass(i.type)) { | ||
const meta = reflect_1.default(i.type); | ||
if ((0, common_1.isCustomClass)(i.type)) { | ||
const meta = (0, reflect_1.default)(i.type); | ||
const classDecorators = meta.decorators.filter((x) => x.type === "ValidatorDecorator"); | ||
@@ -39,3 +39,3 @@ decorators.push(...classDecorators); | ||
if (node.parent) { | ||
return reflect_1.default(node.parent.type).properties.find(x => x.name === getName(node.path)); | ||
return (0, reflect_1.default)(node.parent.type).properties.find(x => x.name === getName(node.path)); | ||
} | ||
@@ -56,3 +56,3 @@ else { | ||
validator = { validate: node.validator }; | ||
else if (common_1.hasKeyOf(node.validator, "validate")) | ||
else if ((0, common_1.hasKeyOf)(node.validator, "validate")) | ||
validator = node.validator; | ||
@@ -59,0 +59,0 @@ else |
{ | ||
"name": "@plumier/core", | ||
"version": "1.0.5", | ||
"version": "1.0.6-canary.3+b235819", | ||
"description": "Delightful Node.js Rest Framework", | ||
@@ -23,11 +23,11 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@plumier/reflect": "^1.0.5", | ||
"@plumier/validator": "^1.0.5", | ||
"@types/debug": "^4.1.6", | ||
"@types/glob": "^7.1.3", | ||
"chalk": "^4.1.1", | ||
"@plumier/reflect": "1.0.6-canary.3+b235819", | ||
"@plumier/validator": "1.0.6-canary.3+b235819", | ||
"@types/debug": "^4.1.7", | ||
"@types/glob": "^7.1.4", | ||
"chalk": "^4.1.2", | ||
"debug": "^4.3.2", | ||
"glob": "^7.1.7", | ||
"path-to-regexp": "^6.2.0", | ||
"tslib": "^2.3.0" | ||
"tslib": "^2.3.1" | ||
}, | ||
@@ -50,3 +50,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "5f6d204483657909bac31851522176b2b500e583" | ||
"gitHead": "b2358195477eaafb0654e92c8605bc1ecf7a8350" | ||
} |
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
212913
2
1
- Removed@plumier/reflect@1.1.3(transitive)
- Removed@plumier/validator@1.1.3(transitive)
- Removed@types/acorn@4.0.6(transitive)
- Removed@types/estree@1.0.6(transitive)
- Removed@types/validator@13.12.2(transitive)
- Removedacorn@8.8.1(transitive)
- Removedreflect-metadata@0.1.14(transitive)
- Removedvalidator@13.12.0(transitive)
Updated@types/debug@^4.1.7
Updated@types/glob@^7.1.4
Updatedchalk@^4.1.2
Updatedtslib@^2.3.1