framework-do-dede 0.0.19 → 0.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/decorators/entity.d.ts +1 -0
- package/dist/decorators/entity.js +8 -0
- package/dist/decorators/index.d.ts +2 -1
- package/dist/decorators/index.js +2 -1
- package/dist/domain/Entity.d.ts +4 -0
- package/dist/domain/Entity.js +10 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +3 -2
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function Restrict(): (target: any, propertyKey: string) => void;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Controller, Post, Get, Put, Delete, Patch, Validator, Middleware } from './controller';
|
|
2
2
|
import { Auth } from './usecase';
|
|
3
3
|
import { Inject } from './di';
|
|
4
|
-
|
|
4
|
+
import { Restrict } from './entity';
|
|
5
|
+
export { Controller, Middleware, Validator, Post, Get, Put, Delete, Patch, Auth, Inject, Restrict };
|
package/dist/decorators/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Controller, Post, Get, Put, Delete, Patch, Validator, Middleware } from './controller';
|
|
2
2
|
import { Auth } from './usecase';
|
|
3
3
|
import { Inject } from './di';
|
|
4
|
-
|
|
4
|
+
import { Restrict } from './entity';
|
|
5
|
+
export { Controller, Middleware, Validator, Post, Get, Put, Delete, Patch, Auth, Inject, Restrict };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export class Entity {
|
|
2
|
+
attributes() {
|
|
3
|
+
const ctor = this.constructor;
|
|
4
|
+
const restrictedProps = ctor._restrictedProperties || new Set();
|
|
5
|
+
return Object.fromEntries(Object.entries(this).filter(([key]) => !restrictedProps.has(key)));
|
|
6
|
+
}
|
|
7
|
+
toSave() {
|
|
8
|
+
return Object.fromEntries(Object.entries(this).filter(([, value]) => value != undefined));
|
|
9
|
+
}
|
|
10
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Dede, Register as DedeRegister, Options as DedeOptions } from './dede';
|
|
2
|
-
import { Controller, Post, Put, Get, Delete, Patch, Validator, Middleware, Auth, Inject } from './decorators';
|
|
2
|
+
import { Controller, Post, Put, Get, Delete, Patch, Validator, Middleware, Auth, Inject, Restrict } from './decorators';
|
|
3
3
|
import { BadRequest, Conflict, Forbidden, HttpServer, NotFound, ServerError, Unauthorized, UnprocessableEntity } from './http';
|
|
4
4
|
import { Validation, HttpMiddleware, UseCase } from './protocols';
|
|
5
|
+
import { Entity } from './domain/Entity';
|
|
5
6
|
declare class RequestData {
|
|
6
7
|
headers: any;
|
|
7
8
|
data: any;
|
|
@@ -11,4 +12,4 @@ declare class RequestData {
|
|
|
11
12
|
declare class UseCaseHandler {
|
|
12
13
|
static load<T extends UseCase<any, any>>(useCaseClass: new (...args: any[]) => T, request?: RequestData): T;
|
|
13
14
|
}
|
|
14
|
-
export { UseCase, HttpMiddleware, Validation, RequestData, Dede, DedeRegister, DedeOptions, UseCaseHandler, ServerError, BadRequest, Conflict, Forbidden, HttpServer, NotFound, Unauthorized, UnprocessableEntity, Controller, Post, Put, Get, Delete, Patch, Validator, Middleware, Auth, Inject };
|
|
15
|
+
export { UseCase, HttpMiddleware, Validation, RequestData, Dede, DedeRegister, DedeOptions, UseCaseHandler, ServerError, BadRequest, Conflict, Forbidden, HttpServer, NotFound, Unauthorized, UnprocessableEntity, Controller, Post, Put, Get, Delete, Patch, Validator, Middleware, Auth, Inject, Entity, Restrict };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Dede } from './dede';
|
|
2
|
-
import { Controller, Post, Put, Get, Delete, Patch, Validator, Middleware, Auth, Inject } from './decorators';
|
|
2
|
+
import { Controller, Post, Put, Get, Delete, Patch, Validator, Middleware, Auth, Inject, Restrict } from './decorators';
|
|
3
3
|
import { BadRequest, Conflict, Forbidden, HttpServer, NotFound, ServerError, Unauthorized, UnprocessableEntity } from './http';
|
|
4
4
|
import { Registry } from './di/registry';
|
|
5
|
+
import { Entity } from './domain/Entity';
|
|
5
6
|
class RequestData {
|
|
6
7
|
headers;
|
|
7
8
|
data;
|
|
@@ -23,4 +24,4 @@ class UseCaseHandler {
|
|
|
23
24
|
return instance;
|
|
24
25
|
}
|
|
25
26
|
}
|
|
26
|
-
export { RequestData, Dede, UseCaseHandler, ServerError, BadRequest, Conflict, Forbidden, HttpServer, NotFound, Unauthorized, UnprocessableEntity, Controller, Post, Put, Get, Delete, Patch, Validator, Middleware, Auth, Inject };
|
|
27
|
+
export { RequestData, Dede, UseCaseHandler, ServerError, BadRequest, Conflict, Forbidden, HttpServer, NotFound, Unauthorized, UnprocessableEntity, Controller, Post, Put, Get, Delete, Patch, Validator, Middleware, Auth, Inject, Entity, Restrict };
|