@decaf-ts/core 0.8.17 → 0.8.19

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.
@@ -21,7 +21,7 @@ export * from "./persistence";
21
21
  * @const VERSION
22
22
  * @memberOf module:core
23
23
  */
24
- export declare const VERSION = "0.8.16";
24
+ export declare const VERSION = "0.8.19";
25
25
  /**
26
26
  * @description Stores the current package version
27
27
  * @summary A constant representing the version of the core package
package/lib/esm/index.js CHANGED
@@ -31,7 +31,7 @@ export * from "./persistence/index.js";
31
31
  * @const VERSION
32
32
  * @memberOf module:core
33
33
  */
34
- export const VERSION = "0.8.16";
34
+ export const VERSION = "0.8.19";
35
35
  /**
36
36
  * @description Stores the current package version
37
37
  * @summary A constant representing the version of the core package
@@ -55,7 +55,10 @@ export declare enum PersistenceKeys {
55
55
  TAG_FOR_DELETION = "tag_for_deletion",
56
56
  INITIALIZATION = "initialization",
57
57
  SHUTDOWN = "shutdown",
58
- BY_KEY = "by-key"
58
+ BY_KEY = "by-key",
59
+ AUTH = "auth",
60
+ AUTH_ROLE = "auth-role",
61
+ DECAF_ROUTE = "DecafRoute"
59
62
  }
60
63
  export declare const DefaultContextFlags: ContextFlags<any>;
61
64
  export declare const DefaultAdapterFlags: AdapterFlags;
@@ -58,6 +58,9 @@ export var PersistenceKeys;
58
58
  PersistenceKeys["INITIALIZATION"] = "initialization";
59
59
  PersistenceKeys["SHUTDOWN"] = "shutdown";
60
60
  PersistenceKeys["BY_KEY"] = "by-key";
61
+ PersistenceKeys["AUTH"] = "auth";
62
+ PersistenceKeys["AUTH_ROLE"] = "auth-role";
63
+ PersistenceKeys["DECAF_ROUTE"] = "DecafRoute";
61
64
  })(PersistenceKeys || (PersistenceKeys = {}));
62
65
  export const DefaultContextFlags = Object.assign({}, {
63
66
  ignoreDevSafeGuards: false,
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/persistence/constants.ts"],"names":[],"mappings":"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MAAM,CAAC,MAAM,CAC5D,EAAE,EACF,sBAAsB,EACtB;IACE,uBAAuB,EAAE,IAAI;IAC7B,kBAAkB,EAAE,IAAI;IACxB,yBAAyB,EAAE,KAAK;IAChC,0BAA0B,EAAE,KAAK;IACjC,gBAAgB,EAAE,EAAE;IACpB,MAAM,EAAE,KAAK;IACb,YAAY,EAAE,KAAK;IACnB,UAAU,EAAE,KAAK;IACjB,iBAAiB,EAAE,IAAI;IACvB,kBAAkB,EAAE,KAAK;IACzB,MAAM,EAAE,KAAK;CACd,CACc,CAAC;AAElB,MAAM,CAAC,MAAM,wBAAwB,GAM/B;IACJ,aAAa,CAAC,MAAM;IACpB,aAAa,CAAC,MAAM;IACpB,aAAa,CAAC,MAAM;IACpB,qBAAqB,CAAC,UAAU;IAChC,qBAAqB,CAAC,UAAU;IAChC,qBAAqB,CAAC,UAAU;CACjC,CAAC;AAEF,MAAM,CAAC,MAAM,2BAA2B,GAMlC,CAAC,aAAa,CAAC,IAAI,EAAE,qBAAqB,CAAC,QAAQ,CAAC,CAAC;AAE3D,MAAM,CAAC,MAAM,mBAAmB,GAM1B,CAAC,eAAe,CAAC,SAAS,EAAE,qBAAqB,CAAC,WAAW,CAAC,CAAC;AAErE,MAAM,CAAC,MAAM,2BAA2B,GAMlC;IACJ,eAAe,CAAC,KAAK;IACrB,qBAAqB,CAAC,OAAO;IAC7B,qBAAqB,CAAC,OAAO;IAC7B,qBAAqB,CAAC,OAAO;CAC9B,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAM9B,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC"}
@@ -1,6 +1,27 @@
1
+ import { Constructor } from "@decaf-ts/decoration";
1
2
  import type { ModelConstructor } from "@decaf-ts/decorator-validation";
3
+ import { HttpVerbs } from "./types";
2
4
  export declare const create: () => (target: any, _propertyKey?: any, descriptor?: any) => any;
3
5
  export declare const read: () => (target: any, _propertyKey?: any, descriptor?: any) => any;
4
6
  export declare const update: () => (target: any, _propertyKey?: any, descriptor?: any) => any;
5
7
  export declare const del: () => (target: any, _propertyKey?: any, descriptor?: any) => any;
6
8
  export declare function service(key?: string | ModelConstructor<any>): (target: any, prop?: any, descriptor?: any) => void;
9
+ export declare function auth(model: string | Constructor): (target: any, propertyKey?: any, descriptor?: TypedPropertyDescriptor<any>) => any;
10
+ /**
11
+ * A decorator function that sets the roles required for authentication and authorization to the model in NestJS.
12
+ *
13
+ * @param roles - An array of role names required for access.
14
+ *
15
+ * @returns - A function that applies the role decorators to the target.
16
+ *
17
+ * @example
18
+ * ```typescript
19
+ * @model('users')
20
+ * @Roles(['admin'])
21
+ * export class UserModel {
22
+ * //...
23
+ * }
24
+ *
25
+ */
26
+ export declare const roles: (roles: string[]) => (model: any, prop?: any, descriptor?: PropertyDescriptor | number) => void;
27
+ export declare function route(httpMethod: HttpVerbs, path: string): (target: any, propertyKey?: any, descriptor?: TypedPropertyDescriptor<any>) => any;
@@ -1,4 +1,4 @@
1
- import { apply, Metadata, prop as property } from "@decaf-ts/decoration";
1
+ import { apply, Decoration, metadata, Metadata, methodMetadata, prop as property } from "@decaf-ts/decoration";
2
2
  import { inject, injectable } from "@decaf-ts/injectable-decorators";
3
3
  import { PersistenceKeys } from "./../persistence/constants.js";
4
4
  import { injectableServiceKey, isOperationBlocked } from "./utils.js";
@@ -58,4 +58,54 @@ export function service(key) {
58
58
  return apply(...decs)(target, prop, descriptor);
59
59
  };
60
60
  }
61
+ export function auth(model) {
62
+ const decorationKey = PersistenceKeys.AUTH;
63
+ function auth(model) {
64
+ return metadata(decorationKey, model);
65
+ }
66
+ return Decoration.for(decorationKey)
67
+ .define({
68
+ decorator: auth,
69
+ args: [model],
70
+ })
71
+ .apply();
72
+ }
73
+ /**
74
+ * A decorator function that sets the roles required for authentication and authorization to the model in NestJS.
75
+ *
76
+ * @param roles - An array of role names required for access.
77
+ *
78
+ * @returns - A function that applies the role decorators to the target.
79
+ *
80
+ * @example
81
+ * ```typescript
82
+ * @model('users')
83
+ * @Roles(['admin'])
84
+ * export class UserModel {
85
+ * //...
86
+ * }
87
+ *
88
+ */
89
+ export const roles = (roles) => {
90
+ return metadata(PersistenceKeys.AUTH_ROLE, roles);
91
+ };
92
+ export function route(httpMethod, path) {
93
+ const key = PersistenceKeys.DECAF_ROUTE;
94
+ function route() {
95
+ return function route(obj, prop, descriptor) {
96
+ const options = {
97
+ path: path,
98
+ httpMethod: httpMethod,
99
+ handler: descriptor,
100
+ };
101
+ return apply(methodMetadata(Metadata.key(key, prop), options))(obj, prop, descriptor);
102
+ };
103
+ }
104
+ return Decoration.for(key)
105
+ .define({
106
+ decorator: route,
107
+ args: [],
108
+ })
109
+ .apply();
110
+ }
61
111
  //# sourceMappingURL=decorators.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../../src/utils/decorators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,sCAAkC;AAG5D,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,mBAAgB;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAGxD,SAAS,cAAc,CAAC,EAAkB;IACxC,OAAO,UAAU,MAAW,EAAE,YAAkB,EAAE,UAAgB;QAChE,MAAM,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC;QAClC,UAAU,CAAC,KAAK,GAAG,UAAU,GAAG,IAAW;YACzC,MAAM,WAAW,GAAI,IAA+B,CAAC,KAAK,CAAC;YAC3D,IAAI,WAAW,IAAI,kBAAkB,CAAC,WAAW,EAAE,EAAE,CAAC,EAAE,CAAC;gBACvD,MAAM,IAAI,GAAG,WAAW,EAAE,IAAI,IAAI,OAAO,CAAC;gBAC1C,MAAM,IAAI,KAAK,CAC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,aAAa,EAAC,KAAK,CAAC,CAAA;IACtC,CAAC;IAED,OAAO,UAAU,CAAC,GAAG,CAAC,aAAa,CAAC;SACjC,MAAM,CAAC;QACN,SAAS,EAAE,IAAI;QACf,IAAI,EAAE,CAAC,KAAK,CAAC;KACd,CAAC;SACD,KAAK,EAAE,CAAC;AACb,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,KAAe,EAAE,EAAE;IACvC,OAAO,QAAQ,CAAC,eAAe,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;AACpD,CAAC,CAAC;AAEF,MAAM,UAAU,KAAK,CAAC,UAAqB,EAAE,IAAY;IACvD,MAAM,GAAG,GAAG,eAAe,CAAC,WAAW,CAAC;IACxC,SAAS,KAAK;QACZ,OAAO,SAAS,KAAK,CAAC,GAAW,EAAE,IAAU,EAAE,UAAgB;YAC7D,MAAM,OAAO,GAAyB;gBACpC,IAAI,EAAE,IAAI;gBACV,UAAU,EAAE,UAAU;gBACtB,OAAO,EAAE,UAAU;aACpB,CAAC;YAEF,OAAO,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC,CAC5D,GAAG,EACH,IAAI,EACJ,UAAU,CACX,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;IAED,OAAO,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC;SACvB,MAAM,CAAC;QACN,SAAS,EAAE,KAAK;QAChB,IAAI,EAAE,EAAE;KACT,CAAC;SACD,KAAK,EAAE,CAAC;AACb,CAAC"}
@@ -2,3 +2,4 @@ export * from "./ContextualLoggedClass";
2
2
  export * from "./decorators";
3
3
  export * from "./errors";
4
4
  export * from "./utils";
5
+ export * from "./types";
@@ -2,4 +2,5 @@ export * from "./ContextualLoggedClass.js";
2
2
  export * from "./decorators.js";
3
3
  export * from "./errors.js";
4
4
  export * from "./utils.js";
5
+ export * from "./types.js";
5
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,2CAAwC;AACxC,gCAA6B;AAC7B,4BAAyB;AACzB,2BAAwB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,2CAAwC;AACxC,gCAA6B;AAC7B,4BAAyB;AACzB,2BAAwB;AACxB,2BAAuB"}
@@ -0,0 +1,23 @@
1
+ export type HttpVerbs = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
2
+ export type DecafApiProperty = {
3
+ name: string;
4
+ description?: string;
5
+ required?: boolean;
6
+ type?: any;
7
+ };
8
+ export type DecafModelRoute = {
9
+ path: string;
10
+ description?: string;
11
+ apiProperties: DecafApiProperty[];
12
+ getPK: (...args: Array<string | number>) => string;
13
+ };
14
+ export type DecafParamProps = {
15
+ raw: Record<string, string | number>;
16
+ keysInOrder: Array<string>;
17
+ valuesInOrder: Array<string | number>;
18
+ };
19
+ export interface DecafRouteDecOptions {
20
+ path: string;
21
+ httpMethod: HttpVerbs;
22
+ handler: PropertyDescriptor;
23
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/utils/types.ts"],"names":[],"mappings":""}
package/lib/index.cjs CHANGED
@@ -48,7 +48,7 @@ __exportStar(require("./persistence/index.cjs"), exports);
48
48
  * @const VERSION
49
49
  * @memberOf module:core
50
50
  */
51
- exports.VERSION = "0.8.16";
51
+ exports.VERSION = "0.8.19";
52
52
  /**
53
53
  * @description Stores the current package version
54
54
  * @summary A constant representing the version of the core package
package/lib/index.d.ts CHANGED
@@ -21,7 +21,7 @@ export * from "./persistence";
21
21
  * @const VERSION
22
22
  * @memberOf module:core
23
23
  */
24
- export declare const VERSION = "0.8.16";
24
+ export declare const VERSION = "0.8.19";
25
25
  /**
26
26
  * @description Stores the current package version
27
27
  * @summary A constant representing the version of the core package
@@ -61,6 +61,9 @@ var PersistenceKeys;
61
61
  PersistenceKeys["INITIALIZATION"] = "initialization";
62
62
  PersistenceKeys["SHUTDOWN"] = "shutdown";
63
63
  PersistenceKeys["BY_KEY"] = "by-key";
64
+ PersistenceKeys["AUTH"] = "auth";
65
+ PersistenceKeys["AUTH_ROLE"] = "auth-role";
66
+ PersistenceKeys["DECAF_ROUTE"] = "DecafRoute";
64
67
  })(PersistenceKeys || (exports.PersistenceKeys = PersistenceKeys = {}));
65
68
  exports.DefaultContextFlags = Object.assign({}, {
66
69
  ignoreDevSafeGuards: false,
@@ -55,7 +55,10 @@ export declare enum PersistenceKeys {
55
55
  TAG_FOR_DELETION = "tag_for_deletion",
56
56
  INITIALIZATION = "initialization",
57
57
  SHUTDOWN = "shutdown",
58
- BY_KEY = "by-key"
58
+ BY_KEY = "by-key",
59
+ AUTH = "auth",
60
+ AUTH_ROLE = "auth-role",
61
+ DECAF_ROUTE = "DecafRoute"
59
62
  }
60
63
  export declare const DefaultContextFlags: ContextFlags<any>;
61
64
  export declare const DefaultAdapterFlags: AdapterFlags;
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/persistence/constants.ts"],"names":[],"mappings":";;;AAAA,2DAIiC;AAEjC,wDAA2D;AAE3D;;;;;;GAMG;AACH,IAAY,eAwEX;AAxED,WAAY,eAAe;IACzB,8CAA2B,CAAA;IAC3B,0CAA0C;IAC1C,kCAAe,CAAA;IAEf,sDAAsD;IACtD,oCAAiB,CAAA;IAEjB,4CAA4C;IAC5C,sCAAmB,CAAA;IAEnB,yDAAyD;IACzD,2DAAwC,CAAA;IAExC,sCAAmB,CAAA;IACnB,+CAA+C;IAC/C,kCAAe,CAAA;IAEf,gDAAgD;IAChD,oCAAiB,CAAA;IAEjB,oDAAoD;IACpD,0CAAuB,CAAA;IAEvB,YAAY;IACZ,y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B,CAAC,WAAW,CAAC,CAAC;AAExD,QAAA,2BAA2B,GAMlC;IACJ,eAAe,CAAC,KAAK;IACrB,iCAAqB,CAAC,OAAO;IAC7B,iCAAqB,CAAC,OAAO;IAC7B,iCAAqB,CAAC,OAAO;CAC9B,CAAC;AAEW,QAAA,uBAAuB,GAM9B,CAAC,iCAAqB,CAAC,OAAO,CAAC,CAAC"}
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.del = exports.update = exports.read = exports.create = void 0;
3
+ exports.roles = exports.del = exports.update = exports.read = exports.create = void 0;
4
4
  exports.service = service;
5
+ exports.auth = auth;
6
+ exports.route = route;
5
7
  const decoration_1 = require("@decaf-ts/decoration");
6
8
  const injectable_decorators_1 = require("@decaf-ts/injectable-decorators");
7
9
  const constants_1 = require("./../persistence/constants.cjs");
@@ -66,4 +68,55 @@ function service(key) {
66
68
  return (0, decoration_1.apply)(...decs)(target, prop, descriptor);
67
69
  };
68
70
  }
71
+ function auth(model) {
72
+ const decorationKey = constants_1.PersistenceKeys.AUTH;
73
+ function auth(model) {
74
+ return (0, decoration_1.metadata)(decorationKey, model);
75
+ }
76
+ return decoration_1.Decoration.for(decorationKey)
77
+ .define({
78
+ decorator: auth,
79
+ args: [model],
80
+ })
81
+ .apply();
82
+ }
83
+ /**
84
+ * A decorator function that sets the roles required for authentication and authorization to the model in NestJS.
85
+ *
86
+ * @param roles - An array of role names required for access.
87
+ *
88
+ * @returns - A function that applies the role decorators to the target.
89
+ *
90
+ * @example
91
+ * ```typescript
92
+ * @model('users')
93
+ * @Roles(['admin'])
94
+ * export class UserModel {
95
+ * //...
96
+ * }
97
+ *
98
+ */
99
+ const roles = (roles) => {
100
+ return (0, decoration_1.metadata)(constants_1.PersistenceKeys.AUTH_ROLE, roles);
101
+ };
102
+ exports.roles = roles;
103
+ function route(httpMethod, path) {
104
+ const key = constants_1.PersistenceKeys.DECAF_ROUTE;
105
+ function route() {
106
+ return function route(obj, prop, descriptor) {
107
+ const options = {
108
+ path: path,
109
+ httpMethod: httpMethod,
110
+ handler: descriptor,
111
+ };
112
+ return (0, decoration_1.apply)((0, decoration_1.methodMetadata)(decoration_1.Metadata.key(key, prop), options))(obj, prop, descriptor);
113
+ };
114
+ }
115
+ return decoration_1.Decoration.for(key)
116
+ .define({
117
+ decorator: route,
118
+ args: [],
119
+ })
120
+ .apply();
121
+ }
69
122
  //# sourceMappingURL=decorators.js.map
@@ -1,6 +1,27 @@
1
+ import { Constructor } from "@decaf-ts/decoration";
1
2
  import type { ModelConstructor } from "@decaf-ts/decorator-validation";
3
+ import { HttpVerbs } from "./types";
2
4
  export declare const create: () => (target: any, _propertyKey?: any, descriptor?: any) => any;
3
5
  export declare const read: () => (target: any, _propertyKey?: any, descriptor?: any) => any;
4
6
  export declare const update: () => (target: any, _propertyKey?: any, descriptor?: any) => any;
5
7
  export declare const del: () => (target: any, _propertyKey?: any, descriptor?: any) => any;
6
8
  export declare function service(key?: string | ModelConstructor<any>): (target: any, prop?: any, descriptor?: any) => void;
9
+ export declare function auth(model: string | Constructor): (target: any, propertyKey?: any, descriptor?: TypedPropertyDescriptor<any>) => any;
10
+ /**
11
+ * A decorator function that sets the roles required for authentication and authorization to the model in NestJS.
12
+ *
13
+ * @param roles - An array of role names required for access.
14
+ *
15
+ * @returns - A function that applies the role decorators to the target.
16
+ *
17
+ * @example
18
+ * ```typescript
19
+ * @model('users')
20
+ * @Roles(['admin'])
21
+ * export class UserModel {
22
+ * //...
23
+ * }
24
+ *
25
+ */
26
+ export declare const roles: (roles: string[]) => (model: any, prop?: any, descriptor?: PropertyDescriptor | number) => void;
27
+ export declare function route(httpMethod: HttpVerbs, path: string): (target: any, propertyKey?: any, descriptor?: TypedPropertyDescriptor<any>) => any;
@@ -1 +1 @@
1
- {"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../src/utils/decorators.ts"],"names":[],"mappings":";;;AA+BA,0BAqCC;AApED,qDAAyE;AACzE,2EA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IAAI,CAAC,EAAE,OAAO,CAAC,CAAC,CAC5D,GAAG,EACH,IAAI,EACJ,UAAU,CACX,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;IAED,OAAO,uBAAU,CAAC,GAAG,CAAC,GAAG,CAAC;SACvB,MAAM,CAAC;QACN,SAAS,EAAE,KAAK;QAChB,IAAI,EAAE,EAAE;KACT,CAAC;SACD,KAAK,EAAE,CAAC;AACb,CAAC"}
@@ -18,4 +18,5 @@ __exportStar(require("./ContextualLoggedClass.cjs"), exports);
18
18
  __exportStar(require("./decorators.cjs"), exports);
19
19
  __exportStar(require("./errors.cjs"), exports);
20
20
  __exportStar(require("./utils.cjs"), exports);
21
+ __exportStar(require("./types.cjs"), exports);
21
22
  //# sourceMappingURL=index.js.map
@@ -2,3 +2,4 @@ export * from "./ContextualLoggedClass";
2
2
  export * from "./decorators";
3
3
  export * from "./errors";
4
4
  export * from "./utils";
5
+ export * from "./types";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8DAAwC;AACxC,mDAA6B;AAC7B,+CAAyB;AACzB,8CAAwB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8DAAwC;AACxC,mDAA6B;AAC7B,+CAAyB;AACzB,8CAAwB;AACxB,8CAAuB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,23 @@
1
+ export type HttpVerbs = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
2
+ export type DecafApiProperty = {
3
+ name: string;
4
+ description?: string;
5
+ required?: boolean;
6
+ type?: any;
7
+ };
8
+ export type DecafModelRoute = {
9
+ path: string;
10
+ description?: string;
11
+ apiProperties: DecafApiProperty[];
12
+ getPK: (...args: Array<string | number>) => string;
13
+ };
14
+ export type DecafParamProps = {
15
+ raw: Record<string, string | number>;
16
+ keysInOrder: Array<string>;
17
+ valuesInOrder: Array<string | number>;
18
+ };
19
+ export interface DecafRouteDecOptions {
20
+ path: string;
21
+ httpMethod: HttpVerbs;
22
+ handler: PropertyDescriptor;
23
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/utils/types.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decaf-ts/core",
3
- "version": "0.8.17",
3
+ "version": "0.8.19",
4
4
  "description": "Core persistence module for the decaf framework",
5
5
  "type": "module",
6
6
  "exports": {