@aom-js/api 0.0.1

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.
Files changed (156) hide show
  1. package/dist/cjs/classes/index.d.ts +3 -0
  2. package/dist/cjs/classes/index.d.ts.map +1 -0
  3. package/dist/cjs/classes/index.js +19 -0
  4. package/dist/cjs/classes/index.js.map +1 -0
  5. package/dist/cjs/classes/openapi.d.ts +17 -0
  6. package/dist/cjs/classes/openapi.d.ts.map +1 -0
  7. package/dist/cjs/classes/openapi.js +160 -0
  8. package/dist/cjs/classes/openapi.js.map +1 -0
  9. package/dist/cjs/classes/router.d.ts +10 -0
  10. package/dist/cjs/classes/router.d.ts.map +1 -0
  11. package/dist/cjs/classes/router.js +31 -0
  12. package/dist/cjs/classes/router.js.map +1 -0
  13. package/dist/cjs/common/classes.d.ts +104 -0
  14. package/dist/cjs/common/classes.d.ts.map +1 -0
  15. package/dist/cjs/common/classes.js +152 -0
  16. package/dist/cjs/common/classes.js.map +1 -0
  17. package/dist/cjs/common/index.d.ts +5 -0
  18. package/dist/cjs/common/index.d.ts.map +1 -0
  19. package/dist/cjs/common/index.js +21 -0
  20. package/dist/cjs/common/index.js.map +1 -0
  21. package/dist/cjs/common/openapi.d.ts +36 -0
  22. package/dist/cjs/common/openapi.d.ts.map +1 -0
  23. package/dist/cjs/common/openapi.js +3 -0
  24. package/dist/cjs/common/openapi.js.map +1 -0
  25. package/dist/cjs/common/references.d.ts +19 -0
  26. package/dist/cjs/common/references.d.ts.map +1 -0
  27. package/dist/cjs/common/references.js +30 -0
  28. package/dist/cjs/common/references.js.map +1 -0
  29. package/dist/cjs/common/types.d.ts +8 -0
  30. package/dist/cjs/common/types.d.ts.map +1 -0
  31. package/dist/cjs/common/types.js +3 -0
  32. package/dist/cjs/common/types.js.map +1 -0
  33. package/dist/cjs/constants/errors.d.ts +12 -0
  34. package/dist/cjs/constants/errors.d.ts.map +1 -0
  35. package/dist/cjs/constants/errors.js +15 -0
  36. package/dist/cjs/constants/errors.js.map +1 -0
  37. package/dist/cjs/constants/index.d.ts +2 -0
  38. package/dist/cjs/constants/index.d.ts.map +1 -0
  39. package/dist/cjs/constants/index.js +18 -0
  40. package/dist/cjs/constants/index.js.map +1 -0
  41. package/dist/cjs/decorators/arguments/index.d.ts +21 -0
  42. package/dist/cjs/decorators/arguments/index.d.ts.map +1 -0
  43. package/dist/cjs/decorators/arguments/index.js +248 -0
  44. package/dist/cjs/decorators/arguments/index.js.map +1 -0
  45. package/dist/cjs/decorators/controllers/index.d.ts +2 -0
  46. package/dist/cjs/decorators/controllers/index.d.ts.map +1 -0
  47. package/dist/cjs/decorators/controllers/index.js +43 -0
  48. package/dist/cjs/decorators/controllers/index.js.map +1 -0
  49. package/dist/cjs/decorators/docs/index.d.ts +3 -0
  50. package/dist/cjs/decorators/docs/index.d.ts.map +1 -0
  51. package/dist/cjs/decorators/docs/index.js +16 -0
  52. package/dist/cjs/decorators/docs/index.js.map +1 -0
  53. package/dist/cjs/decorators/endpoints/index.d.ts +20 -0
  54. package/dist/cjs/decorators/endpoints/index.d.ts.map +1 -0
  55. package/dist/cjs/decorators/endpoints/index.js +125 -0
  56. package/dist/cjs/decorators/endpoints/index.js.map +1 -0
  57. package/dist/cjs/decorators/index.d.ts +7 -0
  58. package/dist/cjs/decorators/index.d.ts.map +1 -0
  59. package/dist/cjs/decorators/index.js +23 -0
  60. package/dist/cjs/decorators/index.js.map +1 -0
  61. package/dist/cjs/decorators/middlewares/index.d.ts +9 -0
  62. package/dist/cjs/decorators/middlewares/index.d.ts.map +1 -0
  63. package/dist/cjs/decorators/middlewares/index.js +103 -0
  64. package/dist/cjs/decorators/middlewares/index.js.map +1 -0
  65. package/dist/cjs/decorators/openapi/index.d.ts +10 -0
  66. package/dist/cjs/decorators/openapi/index.d.ts.map +1 -0
  67. package/dist/cjs/decorators/openapi/index.js +61 -0
  68. package/dist/cjs/decorators/openapi/index.js.map +1 -0
  69. package/dist/cjs/decorators/openapi/tags.d.ts +6 -0
  70. package/dist/cjs/decorators/openapi/tags.d.ts.map +1 -0
  71. package/dist/cjs/decorators/openapi/tags.js +28 -0
  72. package/dist/cjs/decorators/openapi/tags.js.map +1 -0
  73. package/dist/cjs/index.d.ts +9 -0
  74. package/dist/cjs/index.d.ts.map +1 -0
  75. package/dist/cjs/index.js +25 -0
  76. package/dist/cjs/index.js.map +1 -0
  77. package/dist/cjs/specials/index.d.ts +2 -0
  78. package/dist/cjs/specials/index.d.ts.map +1 -0
  79. package/dist/cjs/specials/index.js +18 -0
  80. package/dist/cjs/specials/index.js.map +1 -0
  81. package/dist/cjs/specials/references.d.ts +5 -0
  82. package/dist/cjs/specials/references.d.ts.map +1 -0
  83. package/dist/cjs/specials/references.js +16 -0
  84. package/dist/cjs/specials/references.js.map +1 -0
  85. package/dist/cjs/types/index.d.ts +15 -0
  86. package/dist/cjs/types/index.d.ts.map +1 -0
  87. package/dist/cjs/types/index.js +3 -0
  88. package/dist/cjs/types/index.js.map +1 -0
  89. package/dist/mjs/classes/index.js +3 -0
  90. package/dist/mjs/classes/index.js.map +1 -0
  91. package/dist/mjs/classes/openapi.js +156 -0
  92. package/dist/mjs/classes/openapi.js.map +1 -0
  93. package/dist/mjs/classes/router.js +27 -0
  94. package/dist/mjs/classes/router.js.map +1 -0
  95. package/dist/mjs/common/classes.js +146 -0
  96. package/dist/mjs/common/classes.js.map +1 -0
  97. package/dist/mjs/common/index.js +5 -0
  98. package/dist/mjs/common/index.js.map +1 -0
  99. package/dist/mjs/common/openapi.js +2 -0
  100. package/dist/mjs/common/openapi.js.map +1 -0
  101. package/dist/mjs/common/references.js +24 -0
  102. package/dist/mjs/common/references.js.map +1 -0
  103. package/dist/mjs/common/types.js +2 -0
  104. package/dist/mjs/common/types.js.map +1 -0
  105. package/dist/mjs/constants/errors.js +12 -0
  106. package/dist/mjs/constants/errors.js.map +1 -0
  107. package/dist/mjs/constants/index.js +2 -0
  108. package/dist/mjs/constants/index.js.map +1 -0
  109. package/dist/mjs/decorators/arguments/index.js +197 -0
  110. package/dist/mjs/decorators/arguments/index.js.map +1 -0
  111. package/dist/mjs/decorators/controllers/index.js +40 -0
  112. package/dist/mjs/decorators/controllers/index.js.map +1 -0
  113. package/dist/mjs/decorators/docs/index.js +12 -0
  114. package/dist/mjs/decorators/docs/index.js.map +1 -0
  115. package/dist/mjs/decorators/endpoints/index.js +80 -0
  116. package/dist/mjs/decorators/endpoints/index.js.map +1 -0
  117. package/dist/mjs/decorators/index.js +7 -0
  118. package/dist/mjs/decorators/index.js.map +1 -0
  119. package/dist/mjs/decorators/middlewares/index.js +62 -0
  120. package/dist/mjs/decorators/middlewares/index.js.map +1 -0
  121. package/dist/mjs/decorators/openapi/index.js +38 -0
  122. package/dist/mjs/decorators/openapi/index.js.map +1 -0
  123. package/dist/mjs/decorators/openapi/tags.js +22 -0
  124. package/dist/mjs/decorators/openapi/tags.js.map +1 -0
  125. package/dist/mjs/index.js +9 -0
  126. package/dist/mjs/index.js.map +1 -0
  127. package/dist/mjs/specials/index.js +2 -0
  128. package/dist/mjs/specials/index.js.map +1 -0
  129. package/dist/mjs/specials/references.js +11 -0
  130. package/dist/mjs/specials/references.js.map +1 -0
  131. package/dist/mjs/types/index.js +2 -0
  132. package/dist/mjs/types/index.js.map +1 -0
  133. package/dist/types/classes/index.d.ts +2 -0
  134. package/dist/types/classes/openapi.d.ts +16 -0
  135. package/dist/types/classes/router.d.ts +9 -0
  136. package/dist/types/common/classes.d.ts +103 -0
  137. package/dist/types/common/index.d.ts +4 -0
  138. package/dist/types/common/openapi.d.ts +35 -0
  139. package/dist/types/common/references.d.ts +18 -0
  140. package/dist/types/common/types.d.ts +7 -0
  141. package/dist/types/constants/errors.d.ts +11 -0
  142. package/dist/types/constants/index.d.ts +1 -0
  143. package/dist/types/decorators/arguments/index.d.ts +20 -0
  144. package/dist/types/decorators/controllers/index.d.ts +1 -0
  145. package/dist/types/decorators/docs/index.d.ts +2 -0
  146. package/dist/types/decorators/endpoints/index.d.ts +19 -0
  147. package/dist/types/decorators/index.d.ts +6 -0
  148. package/dist/types/decorators/middlewares/index.d.ts +8 -0
  149. package/dist/types/decorators/openapi/index.d.ts +9 -0
  150. package/dist/types/decorators/openapi/tags.d.ts +5 -0
  151. package/dist/types/index.d.ts +8 -0
  152. package/dist/types/specials/index.d.ts +1 -0
  153. package/dist/types/specials/references.d.ts +4 -0
  154. package/dist/types/types/index.d.ts +14 -0
  155. package/package.json +54 -0
  156. package/readme.md +3 -0
@@ -0,0 +1,40 @@
1
+ import { DecoratorsQueueStore, hasOwnProperty, } from "@aom-js/core";
2
+ import { AomApi } from "../../common";
3
+ export function Controller() {
4
+ return AomApi.classDecorator(($) => {
5
+ $.element.isController = true;
6
+ const errors = [];
7
+ const inheritDecorators = (parent) => {
8
+ const $parent = $._.base.instance(parent);
9
+ const transferDescritorWithDecorators = (target, property, source, descriptor) => {
10
+ const curriedDescriptor = (...args) => Reflect.apply(descriptor.value, null, args);
11
+ Reflect.defineProperty(target, property, {
12
+ ...descriptor,
13
+ value: curriedDescriptor,
14
+ });
15
+ const $childInstance = $._.base.instance(target, property);
16
+ source._.callstack.transferTo($childInstance);
17
+ };
18
+ $parent._.origins.forEach((origin) => {
19
+ const $origin = $._.base.instance(origin.descriptor.value);
20
+ const isClassOrigin = origin.target === $origin._.target;
21
+ if (isClassOrigin && !hasOwnProperty($._.target, $origin._.property)) {
22
+ transferDescritorWithDecorators($._.target, $origin._.property, $origin, origin.descriptor);
23
+ }
24
+ else if (!isClassOrigin && !hasOwnProperty($._.target.prototype, $origin._.property)) {
25
+ transferDescritorWithDecorators($._.target.prototype, $origin._.property, $origin, origin.descriptor);
26
+ }
27
+ else {
28
+ errors.push(new Error(`same property exists ${$._.target.name}.${origin.property.toString()}`));
29
+ }
30
+ });
31
+ if (!$parent.element.isController &&
32
+ $._.base.instance(Object.getPrototypeOf(parent)).element.isController) {
33
+ inheritDecorators(Object.getPrototypeOf(parent));
34
+ }
35
+ };
36
+ inheritDecorators(Object.getPrototypeOf($._.target));
37
+ $._.apply();
38
+ }, DecoratorsQueueStore.INSTANT);
39
+ }
40
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/decorators/controllers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,oBAAoB,EACpB,cAAc,GAGf,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,MAAM,UAAU,UAAU;IACxB,OAAO,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,EAAE;QACjC,CAAC,CAAC,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;QAE9B,MAAM,MAAM,GAAY,EAAE,CAAC;QAE3B,MAAM,iBAAiB,GAAG,CAAC,MAAmB,EAAE,EAAE;YAChD,MAAM,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;YAE1C,MAAM,+BAA+B,GAAG,CACtC,MAAsB,EACtB,QAAkB,EAClB,MAAc,EACd,UAA8B,EAC9B,EAAE;gBAEF,MAAM,iBAAiB,GAAG,CAAC,GAAG,IAAS,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;gBAExF,OAAO,CAAC,cAAc,CAAC,MAAM,EAAE,QAAQ,EAAE;oBACvC,GAAG,UAAU;oBACb,KAAK,EAAE,iBAAiB;iBACzB,CAAC,CAAC;gBACH,MAAM,cAAc,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;gBAE3D,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;YAChD,CAAC,CAAC;YAgEF,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CA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C,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;YACnD,CAAC;QACH,CAAC,CAAC;QACF,iBAAiB,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;QACrD,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;IACd,CAAC,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAEnC,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { AomApi } from "../../common";
2
+ export function Title(value) {
3
+ return AomApi.combinedDecorator(($) => {
4
+ $.title = value;
5
+ });
6
+ }
7
+ export function Description(value) {
8
+ return AomApi.combinedDecorator(($) => {
9
+ $.description = value;
10
+ });
11
+ }
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/decorators/docs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,MAAM,UAAU,KAAK,CAAC,KAAa;IACjC,OAAO,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,EAAE;QACpC,CAAC,CAAC,KAAK,GAAG,KAAK,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,KAAa;IACvC,OAAO,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,EAAE;QACpC,CAAC,CAAC,WAAW,GAAG,KAAK,CAAC;IACxB,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,80 @@
1
+ import * as constants from "../../constants";
2
+ import { AomApi } from "../../common";
3
+ function defineEndpoint(method, path, handler) {
4
+ if (!handler) {
5
+ return Endpoint(method, path);
6
+ }
7
+ return AomApi.classDecorator(($) => {
8
+ const handlerOrigin = AomApi.instance(handler);
9
+ if (handlerOrigin.element.isNextpoint) {
10
+ $.element.endpoints.push({ method, prefix: path, $: handlerOrigin });
11
+ }
12
+ else {
13
+ throw new Error(constants.COMMON_ENDPOINT_ERROR);
14
+ }
15
+ });
16
+ }
17
+ export function Nextpoint() {
18
+ return AomApi.methodDecorator(($, descriptor) => {
19
+ if ($.element.isMiddleware) {
20
+ throw new Error(constants.NEXPOINT_DEFINE_ERROR);
21
+ }
22
+ else {
23
+ $.element.descriptor = descriptor;
24
+ $.element.isNextpoint = true;
25
+ }
26
+ });
27
+ }
28
+ export function WebSocketPoint(path) {
29
+ return AomApi.methodDecorator(($, descriptor) => {
30
+ if ($.element.isMiddleware || $.element.isNextpoint) {
31
+ throw new Error(constants.NEXPOINT_DEFINE_ERROR);
32
+ }
33
+ else {
34
+ $.element.descriptor = descriptor;
35
+ $.element.isWebsocket = true;
36
+ $._.root.element.websockets.push({ method: "sockets", prefix: path, $ });
37
+ }
38
+ });
39
+ }
40
+ export function Endpoint(method, path = "/") {
41
+ return AomApi.methodDecorator(($, descriptor) => {
42
+ if ($.element.isMiddleware || $.element.isWebsocket) {
43
+ throw new Error(constants.ENDPOINT_DEFINE_ERROR);
44
+ }
45
+ else {
46
+ $.element.descriptor = descriptor;
47
+ $.element.isEndpoint = true;
48
+ $._.root.element.endpoints.push({ method, prefix: path, $ });
49
+ }
50
+ });
51
+ }
52
+ export function Get(path = "/", handler) {
53
+ const method = "get";
54
+ return defineEndpoint(method, path, handler);
55
+ }
56
+ export function Post(path = "/", handler) {
57
+ const method = "post";
58
+ return defineEndpoint(method, path, handler);
59
+ }
60
+ export function Patch(path = "/", handler) {
61
+ const method = "patch";
62
+ return defineEndpoint(method, path, handler);
63
+ }
64
+ export function Put(path = "/", handler) {
65
+ const method = "put";
66
+ return defineEndpoint(method, path, handler);
67
+ }
68
+ export function Options(path = "/", handler) {
69
+ const method = "options";
70
+ return defineEndpoint(method, path, handler);
71
+ }
72
+ export function Delete(path = "/", handler) {
73
+ const method = "delete";
74
+ return defineEndpoint(method, path, handler);
75
+ }
76
+ export function All(path = "/", handler) {
77
+ const method = "all";
78
+ return defineEndpoint(method, path, handler);
79
+ }
80
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/decorators/endpoints/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,iBAAiB,CAAC;AAI7C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAMtC,SAAS,cAAc,CACrB,MAAmB,EACnB,IAAY,EACZ,OAAyB;IAEzB,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAChC,CAAC;IAED,OAAO,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,EAAE;QACjC,MAAM,aAAa,GAAG,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAC/C,IAAI,aAAa,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;YACtC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,aAAa,EAAE,CAAC,CAAC;QACvE,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,SAAS,CAAC,qBAAqB,CAAC,CAAC;QACnD,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAGD,MAAM,UAAU,SAAS;IACvB,OAAO,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,EAAE;QAC9C,IAAI,CAAC,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;YAC3B,MAAM,IAAI,KAAK,CAAC,SAAS,CAAC,qBAAqB,CAAC,CAAC;QACnD,CAAC;aAAM,CAAC;YACN,CAAC,CAAC,OAAO,CAAC,UAAU,GAAG,UAAU,CAAC;YAClC,CAAC,CAAC,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;QAC/B,CAAC;IACH,CAAC,CAAC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";
2
+ export * from "./controllers";
3
+ export * from "./middlewares";
4
+ export * from "./endpoints";
5
+ export * from "./docs";
6
+ export * from "./openapi";
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/decorators/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC"}
@@ -0,0 +1,62 @@
1
+ import { DecoratorsQueueStore } from "@aom-js/core";
2
+ import * as constants from "../../constants";
3
+ import { FwdContainer } from "../../common";
4
+ import { AomApi } from "../../common";
5
+ export function Use(...middlewares) {
6
+ return AomApi.combinedDecorator(($) => {
7
+ $.element.addMiddlewares(...middlewares
8
+ .map((middleware) => AomApi.instance(middleware))
9
+ .filter(($) => $.element.isMiddleware));
10
+ }, DecoratorsQueueStore.LAST);
11
+ }
12
+ export function Middleware() {
13
+ return AomApi.methodDecorator(($, descriptor) => {
14
+ if ($.element.isNextpoint || $.element.isEndpoint || $.element.isWebsocket) {
15
+ throw new Error(constants.MIDDLEWARE_DEFINE_ERROR);
16
+ }
17
+ else {
18
+ $.element.descriptor = descriptor;
19
+ $.element.isMiddleware = true;
20
+ }
21
+ });
22
+ }
23
+ export function Bridge(prefix, nextRoute) {
24
+ return AomApi.combinedDecorator(($, descriptor) => {
25
+ const next = AomApi.instance(nextRoute);
26
+ if (descriptor) {
27
+ $.element.descriptor = descriptor;
28
+ next.element.middlewares = [$, ...next.element.middlewares];
29
+ }
30
+ $._.root.element.bridges.push({ prefix, next, $ });
31
+ });
32
+ }
33
+ export function Marker() {
34
+ return AomApi.methodDecorator(($, descriptor) => {
35
+ $.element.isMarker = true;
36
+ $.element.descriptor = descriptor;
37
+ }, DecoratorsQueueStore.FIRST);
38
+ }
39
+ export function UseMarker(handler) {
40
+ return AomApi.methodDecorator(($, descriptor) => {
41
+ const marker = AomApi.instance(handler);
42
+ if (marker.element.isMarker) {
43
+ $.element.descriptor = descriptor;
44
+ $.element.markers.push(marker);
45
+ }
46
+ else {
47
+ throw new Error(constants.USE_MARKER_DEFINE_ERROR);
48
+ }
49
+ }, DecoratorsQueueStore.LAST);
50
+ }
51
+ export function UseNext(handler) {
52
+ return AomApi.methodDecorator(($, descriptor) => {
53
+ const handlerInstance = AomApi.instance(handler instanceof FwdContainer ? handler.exec() : handler);
54
+ if (handlerInstance.element.isNextpoint) {
55
+ $.element.addNextpoint(handlerInstance);
56
+ }
57
+ else {
58
+ throw new Error(constants.USE_NEXT_DEFINE_ERROR);
59
+ }
60
+ }, DecoratorsQueueStore.LAST);
61
+ }
62
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/decorators/middlewares/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEpF,OAAO,KAAK,SAAS,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAqD,MAAM,cAAc,CAAC;AAE/F,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAGtC,MAAM,UAAU,GAAG,CAAC,GAAG,WAAgC;IACrD,OAAO,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,EAAE;QACpC,CAAC,CAAC,OAAO,CAAC,cAAc,CACtB,GAAG,WAAW;aACX,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;aAChD,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CACzC,CAAC;IACJ,CAAC,EAAE,oBAAoB,CAAC,IAAI,CAAC,CAAC;AAChC,CAAC;AAGD,MAAM,UAAU,UAAU;IACxB,OAAO,MA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AAK,CAAC,CAAC;AACjC,CAAC;AAID,MAAM,UAAU,SAAS,CAAC,OAAsB;IAC9C,OAAO,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,EAAE;QAC9C,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACxC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;YAC5B,CAAC,CAAC,OAAO,CAAC,UAAU,GAAG,UAAU,CAAC;YAClC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACjC,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,SAAS,CAAC,uBAAuB,CAAC,CAAC;QACrD,CAAC;IACH,CAAC,EAAE,oBAAoB,CAAC,IAAI,CAAC,CAAC;AAChC,CAAC;AAGD,MAAM,UAAU,OAAO,CAAC,OAAuC;IAC7D,OAAO,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,EAAE;QAC9C,MAAM,eAAe,GAAG,MAAM,CAAC,QAAQ,CACrC,OAAO,YAAY,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,OAAO,CAC3D,CAAC;QACF,IAAI,eAAe,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;YACxC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC;QAC1C,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,SAAS,CAAC,qBAAqB,CAAC,CAAC;QACnD,CAAC;IACH,CAAC,EAAE,oBAAoB,CAAC,IAAI,CAAC,CAAC;AAChC,CAAC"}
@@ -0,0 +1,38 @@
1
+ import { AomApi, } from "../../common";
2
+ export * from "./tags";
3
+ export function Security(schema) {
4
+ return AomApi.combinedDecorator(($) => {
5
+ $.openApi.security = schema;
6
+ });
7
+ }
8
+ export function RequestBody(schema) {
9
+ return AomApi.methodDecorator(($) => {
10
+ $.openApi.requestBody = schema;
11
+ });
12
+ }
13
+ export function Responses(...schemas) {
14
+ return AomApi.methodDecorator(($) => {
15
+ $.openApi.responses.push(...schemas);
16
+ });
17
+ }
18
+ export function PathParameters(...schemas) {
19
+ return AomApi.methodDecorator(($) => {
20
+ $.openApi.path.push(...schemas);
21
+ });
22
+ }
23
+ export function QueryParameters(...schemas) {
24
+ return AomApi.methodDecorator(($) => {
25
+ $.openApi.parameters.push(...schemas.map((schema) => ({ ...schema, in: "query" })));
26
+ });
27
+ }
28
+ export function Parameters(...schemas) {
29
+ return AomApi.methodDecorator(($) => {
30
+ $.openApi.parameters.push(...schemas);
31
+ });
32
+ }
33
+ export function DelayRefStack(handler) {
34
+ return AomApi.methodDecorator(($) => {
35
+ $.openApi.delayStack.push(handler);
36
+ });
37
+ }
38
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/decorators/openapi/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,MAAM,GAUP,MAAM,cAAc,CAAC;AAEtB,cAAc,QAAQ,CAAC;AAEvB,MAAM,UAAU,QAAQ,CACtB,MAA6B;IAE7B,OAAO,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,EAAE;QACpC,CAAC,CAAC,OAAO,CAAC,QAAQ,GAAG,MAAM,CAAC;IAC9B,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,MAA0B;IACpD,OAAO,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,EAAE;QAClC,CAAC,CAAC,OAAO,CAAC,WAAW,GAAG,MAAM,CAAC;IACjC,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,SAAS,CACvB,GAAG,OAA0B;IAE7B,OAAO,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,EAAE;QAClC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,cAAc,CAC5B,GAAG,OAAgC;IAEnC,OAAO,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,EAAE;QAElC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,eAAe,CAC7B,GAAG,OAAqC;IAExC,OAAO,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,EAAE;QAClC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,EAAE,EAAO,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;IAC3F,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,UAAU,CACxB,GAAG,OAAiC;IAEpC,OAAO,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,EAAE;QAClC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,aAAa,CAC3B,OAA4D;IAE5D,OAAO,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,EAAE;QAClC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { AomApi, TagsRules } from "../../common";
2
+ export function UseTag(constructor) {
3
+ return AomApi.combinedDecorator(($) => {
4
+ $.openApi.tag.$ = AomApi.instance(constructor);
5
+ });
6
+ }
7
+ export function IgnoreNextTags() {
8
+ return AomApi.combinedDecorator(($) => {
9
+ $.openApi.tag.rule = TagsRules.IGNORE;
10
+ });
11
+ }
12
+ export function MergeNextTags() {
13
+ return AomApi.combinedDecorator(($) => {
14
+ $.openApi.tag.rule = TagsRules.MERGE;
15
+ });
16
+ }
17
+ export function ReplaceNextTags() {
18
+ return AomApi.combinedDecorator(($) => {
19
+ $.openApi.tag.rule = TagsRules.REPLACE;
20
+ });
21
+ }
22
+ //# sourceMappingURL=tags.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tags.js","sourceRoot":"","sources":["../../../../src/decorators/openapi/tags.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEjD,MAAM,UAAU,MAAM,CAAC,WAAwB;IAC7C,OAAO,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,EAAE;QACpC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,cAAc;IAC5B,OAAO,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,EAAE;QACpC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,SAAS,CAAC,MAAM,CAAC;IACxC,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,aAAa;IAC3B,OAAO,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,EAAE;QACpC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,SAAS,CAAC,KAAK,CAAC;IACvC,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,eAAe;IAC7B,OAAO,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,EAAE;QACpC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,SAAS,CAAC,OAAO,CAAC;IACzC,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,9 @@
1
+ import "reflect-metadata";
2
+ export * from "./decorators";
3
+ export * from "./specials";
4
+ export * from "./types";
5
+ export * from "./classes";
6
+ export * from "./common/openapi";
7
+ export * from "./common/classes";
8
+ export * from "./common/types";
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAE1B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./references";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/specials/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { FwdContainer, RouteRefContainer, ThisRefContainer, } from "../common";
2
+ export function FwdRef(fn) {
3
+ return new FwdContainer(fn);
4
+ }
5
+ export function ThisRef(fn) {
6
+ return new ThisRefContainer(fn);
7
+ }
8
+ export function RouteRef(fn) {
9
+ return new RouteRefContainer(fn);
10
+ }
11
+ //# sourceMappingURL=references.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"references.js","sourceRoot":"","sources":["../../../src/specials/references.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAGZ,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,WAAW,CAAC;AAEnB,MAAM,UAAU,MAAM,CAAC,EAAe;IACpC,OAAO,IAAI,YAAY,CAAC,EAAE,CAAC,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,EAAgB;IACtC,OAAO,IAAI,gBAAgB,CAAC,EAAE,CAAC,CAAC;AAClC,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,EAAgB;IACvC,OAAO,IAAI,iBAAiB,CAAC,EAAE,CAAC,CAAC;AACnC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export * from "./openapi";
2
+ export * from "./router";
@@ -0,0 +1,16 @@
1
+ import { OpenAPIObject } from "openapi3-ts/oas31";
2
+ import { AomRoute } from "../common";
3
+ export declare class OpenApi {
4
+ static readonly refPointerPrefix = "#/components/schemas/";
5
+ private tagsSeparator;
6
+ private data;
7
+ private tagsSet;
8
+ private securityMap;
9
+ private componentsMap;
10
+ private paths;
11
+ constructor(initData: OpenAPIObject);
12
+ registerPath(route: AomRoute): void;
13
+ private storeSecurityScheme;
14
+ private schemaExtract;
15
+ toJSON(): any;
16
+ }
@@ -0,0 +1,9 @@
1
+ import { Constructor } from "@aom-js/core";
2
+ import { AomRoute } from "../common";
3
+ import { OpenApi } from "./openapi";
4
+ export declare class Router {
5
+ routes: AomRoute[];
6
+ sockets: AomRoute[];
7
+ constructor(root: Constructor, docs: OpenApi);
8
+ private build;
9
+ }
@@ -0,0 +1,103 @@
1
+ import { ClassInstanceMap, AomCore } from "@aom-js/core";
2
+ import { HTTPMethods } from "./types";
3
+ import { OpenApiParameterObject, OpenApiPathParameters, OpenApiRequestBody, OpenApiResponse, OpenApiSecuritySchema } from "./openapi";
4
+ import { HttpContextValues } from "../types";
5
+ import { FwdContainer, RouteRefContainer, ThisRefContainer } from "./references";
6
+ export declare enum TagsRules {
7
+ IGNORE = "ignore",
8
+ MERGE = "merge",
9
+ REPLACE = "replace"
10
+ }
11
+ export declare type ArgumentsHandlerParameters = {
12
+ context: RxContext;
13
+ cursor: AomCursor;
14
+ route: AomRoute;
15
+ };
16
+ export declare type ArgumentsDecoratorHandler = (args: ArgumentsHandlerParameters) => any;
17
+ export declare type MarkerHandler = (route: AomRoute, cursor: AomCursor) => void | unknown;
18
+ export declare interface AomBridge {
19
+ prefix: string;
20
+ next: AomApi;
21
+ $: AomApi;
22
+ }
23
+ export declare interface AomEndpoint {
24
+ prefix: string;
25
+ method: HTTPMethods;
26
+ $: AomApi;
27
+ }
28
+ declare class AomHttpOpenApiTags {
29
+ $: AomApi;
30
+ rule: TagsRules;
31
+ }
32
+ declare class AomHttpOpenApi {
33
+ tag: AomHttpOpenApiTags;
34
+ path: OpenApiPathParameters[];
35
+ responses: OpenApiResponse[];
36
+ requestBody: OpenApiRequestBody;
37
+ parameters: OpenApiParameterObject[];
38
+ security: OpenApiSecuritySchema;
39
+ delayStack: Array<FwdContainer | RouteRefContainer | ThisRefContainer>;
40
+ private http;
41
+ constructor(http: AomApi);
42
+ }
43
+ declare class AomHttpParameters {
44
+ handlers: ArgumentsDecoratorHandler[];
45
+ private api;
46
+ constructor(api: AomApi);
47
+ apply(args: ArgumentsHandlerParameters): any[];
48
+ }
49
+ declare class AomApiElement {
50
+ descriptor?: PropertyDescriptor;
51
+ isController: boolean;
52
+ isMarker: boolean;
53
+ isNextpoint: boolean;
54
+ isMiddleware: boolean;
55
+ isEndpoint: boolean;
56
+ isWebsocket: boolean;
57
+ bridges: AomBridge[];
58
+ markers: AomApi[];
59
+ endpoints: AomEndpoint[];
60
+ websockets: AomEndpoint[];
61
+ parametersHandlers: ArgumentsDecoratorHandler[];
62
+ parameters: AomHttpParameters;
63
+ middlewares: AomApi[];
64
+ nextpoint: AomApi;
65
+ private api;
66
+ constructor(api: AomApi);
67
+ addMiddlewares(...middlewares: AomApi[]): void;
68
+ addNextpoint(nextpoint: AomApi): void;
69
+ }
70
+ export declare class AomApi extends AomCore {
71
+ openApi: AomHttpOpenApi;
72
+ element: AomApiElement;
73
+ title: string;
74
+ description: string;
75
+ toString(): string;
76
+ }
77
+ export declare class AomCursor {
78
+ endpoint: AomEndpoint;
79
+ origin: AomApi;
80
+ prefix: string;
81
+ index: number;
82
+ $: AomApi;
83
+ constructor($: AomApi, origin: AomApi, prefix: string, endpoint?: AomEndpoint);
84
+ setEndpoint(endpoint: AomEndpoint): this;
85
+ }
86
+ export declare class AomRoute {
87
+ endpoint: AomEndpoint;
88
+ path: string;
89
+ method: HTTPMethods;
90
+ markers: Record<string, any>;
91
+ cursors: AomCursor[];
92
+ constructor(prefix: string, endpoint: AomEndpoint, cursors: AomCursor[]);
93
+ private plain;
94
+ apply(context: HttpContextValues): any;
95
+ }
96
+ declare class RxContext {
97
+ values: HttpContextValues;
98
+ state: ClassInstanceMap;
99
+ route: AomRoute;
100
+ constructor(context: HttpContextValues, route: AomRoute);
101
+ run(cursors: AomCursor[]): any;
102
+ }
103
+ export {};
@@ -0,0 +1,4 @@
1
+ export * from "./classes";
2
+ export * from "./types";
3
+ export * from "./references";
4
+ export * from "./openapi";
@@ -0,0 +1,35 @@
1
+ import { Constructor } from "@aom-js/core";
2
+ import { ParameterLocation, SchemaObject, SecuritySchemeObject } from "openapi3-ts/oas31";
3
+ import { RouteRefContainer, ThisRefContainer } from "./references";
4
+ export declare type OpenApiPossibleSchema = OpenApiSchemaObject | Constructor | ThisRefContainer | RouteRefContainer | any;
5
+ export declare type OpenApiSchemaObject = Omit<SchemaObject, "type"> & {
6
+ type?: SchemaObject["type"] | string;
7
+ };
8
+ export declare type OpenApiSecuritySchema = Omit<SecuritySchemeObject, "type"> & {
9
+ type?: SecuritySchemeObject["type"] | string;
10
+ };
11
+ export declare interface OpenApiParameterObject {
12
+ name: string;
13
+ description?: string;
14
+ in: ParameterLocation;
15
+ required?: boolean;
16
+ schema: OpenApiPossibleSchema;
17
+ }
18
+ export declare interface OpenApiResponse {
19
+ status: number;
20
+ schema: OpenApiPossibleSchema;
21
+ description: string;
22
+ contentType?: string;
23
+ isArray?: boolean;
24
+ }
25
+ export declare interface OpenApiRequestBody {
26
+ description?: string;
27
+ contentType?: string;
28
+ schema: OpenApiPossibleSchema;
29
+ }
30
+ export declare type OpenApiPathParameterObject = Omit<OpenApiParameterObject, "in"> & {
31
+ in?: OpenApiParameterObject["in"];
32
+ };
33
+ export declare type OpenApiPathParameters = {
34
+ [parameter: string]: OpenApiPathParameterObject;
35
+ };
@@ -0,0 +1,18 @@
1
+ import { Constructor } from "@aom-js/core";
2
+ import { ContainerFunction, FwdFunction, RefFunction } from "./types";
3
+ declare class RefContainer {
4
+ protected fn: ContainerFunction;
5
+ constructor(fn?: RefFunction);
6
+ exec(constructor: Constructor): any;
7
+ static default: RefFunction;
8
+ }
9
+ export declare class FwdContainer extends RefContainer {
10
+ constructor(fn?: FwdFunction);
11
+ exec(): any;
12
+ static default: FwdFunction;
13
+ }
14
+ export declare class ThisRefContainer extends RefContainer {
15
+ }
16
+ export declare class RouteRefContainer extends RefContainer {
17
+ }
18
+ export {};
@@ -0,0 +1,7 @@
1
+ import { Constructor } from "@aom-js/core";
2
+ export declare type HTTPMethods = "get" | "post" | "put" | "patch" | "delete" | "options" | "all" | "sockets";
3
+ export declare type HandlerFunction = (...args: any[]) => any;
4
+ export declare type MiddlewareHandler = HandlerFunction;
5
+ export declare type FwdFunction = () => HandlerFunction | Constructor;
6
+ export declare type RefFunction = (constructor: Constructor) => any;
7
+ export declare type ContainerFunction = FwdFunction | RefFunction;
@@ -0,0 +1,11 @@
1
+ export declare const CONSTRUCTOR_TYPE_ERROR = "CONSTRUCTOR_TYPE_ERROR";
2
+ export declare const ERROR_CONSTRUCTOR_ERROR = "ERROR_CONSTRUCTOR_ERROR";
3
+ export declare const PARAMETER_HANDLER_ERROR = "PARAMETER_HANDLER_ERROR";
4
+ export declare const CONSTRUCTOR_PROPERTY_TYPE_ERROR = "CONSTRUCTOR_PROPERTY_TYPE_ERROR";
5
+ export declare const COMMON_ENDPOINT_ERROR = "COMMON_ENDPOINT_ERROR";
6
+ export declare const ENDPOINT_DEFINE_ERROR = "ENDPOINT_DEFINE_ERROR";
7
+ export declare const NEXPOINT_DEFINE_ERROR = "NEXPOINT_DEFINE_ERROR";
8
+ export declare const WEBSOCKET_DEFINE_ERROR = "WEBSOCKET_DEFINE_ERROR";
9
+ export declare const MIDDLEWARE_DEFINE_ERROR = "MIDDLEWARE_DEFINE_ERROR";
10
+ export declare const USE_NEXT_DEFINE_ERROR = "USE_NEXT_DEFINE_ERROR";
11
+ export declare const USE_MARKER_DEFINE_ERROR = "USE_MARKER_DEFINE_ERROR";
@@ -0,0 +1 @@
1
+ export * from "./errors";
@@ -0,0 +1,20 @@
1
+ import { ClassConstructor } from "@aom-js/core";
2
+ import { ArgumentsDecoratorHandler } from "../../common";
3
+ import { FwdContainer, ThisRefContainer, RouteRefContainer } from "../../common";
4
+ import { AomApi } from "../../common";
5
+ export declare function Args(handler?: ArgumentsDecoratorHandler): ReturnType<typeof AomApi.parameterDecorator>;
6
+ export declare function Query(queryHandler?: Function | ThisRefContainer | RouteRefContainer | string): ReturnType<typeof Args>;
7
+ export declare function Body(bodyHandler?: Function | ThisRefContainer | RouteRefContainer | string): ReturnType<typeof Args>;
8
+ export declare function Params(paramsHandler?: Function | ThisRefContainer | RouteRefContainer | string): ReturnType<typeof Args>;
9
+ export declare function Session(sessionName?: string): ReturnType<typeof Args>;
10
+ export declare function Files(fileName?: string): ReturnType<typeof Args>;
11
+ export declare function Headers(headerHandler?: Function | ThisRefContainer | RouteRefContainer | string): ReturnType<typeof Args>;
12
+ export declare function Next(): ReturnType<typeof Args>;
13
+ export declare function Ctx(): ParameterDecorator;
14
+ export declare function Err(ErrorConstructor?: ClassConstructor): ReturnType<typeof Args>;
15
+ export declare function Req(): ParameterDecorator;
16
+ export declare function Res(): ParameterDecorator;
17
+ export declare function Cursor(): ReturnType<typeof Args>;
18
+ export declare function Route(): ReturnType<typeof Args>;
19
+ export declare function State(constructor?: any): ReturnType<typeof Args>;
20
+ export declare function This(constructor?: ClassConstructor | FwdContainer | RouteRefContainer): ReturnType<typeof Args>;
@@ -0,0 +1 @@
1
+ export declare function Controller(): ClassDecorator;
@@ -0,0 +1,2 @@
1
+ export declare function Title(value: string): import("@aom-js/core").CombinedDecorator;
2
+ export declare function Description(value: string): import("@aom-js/core").CombinedDecorator;
@@ -0,0 +1,19 @@
1
+ import { HandlerFunction, HTTPMethods } from "../../common";
2
+ import { AomApi } from "../../common";
3
+ export declare function Nextpoint(): ReturnType<typeof AomApi.methodDecorator>;
4
+ export declare function WebSocketPoint(path?: string): ReturnType<typeof AomApi.methodDecorator>;
5
+ export declare function Endpoint(method: HTTPMethods, path?: string): ReturnType<typeof AomApi.methodDecorator>;
6
+ export declare function Get(path?: string): MethodDecorator;
7
+ export declare function Get(path: string, handler: HandlerFunction): ClassDecorator;
8
+ export declare function Post(path?: string): MethodDecorator;
9
+ export declare function Post(path: string, handler: HandlerFunction): ClassDecorator;
10
+ export declare function Patch(path?: string): MethodDecorator;
11
+ export declare function Patch(path: string, handler: HandlerFunction): ClassDecorator;
12
+ export declare function Put(path?: string): MethodDecorator;
13
+ export declare function Put(path: string, handler: HandlerFunction): ClassDecorator;
14
+ export declare function Options(path?: string): MethodDecorator;
15
+ export declare function Options(path: string, handler: HandlerFunction): ClassDecorator;
16
+ export declare function Delete(path?: string): MethodDecorator;
17
+ export declare function Delete(path: string, handler: HandlerFunction): ClassDecorator;
18
+ export declare function All(path?: string): MethodDecorator;
19
+ export declare function All(path: string, handler: HandlerFunction): ClassDecorator;
@@ -0,0 +1,6 @@
1
+ export * from "./arguments";
2
+ export * from "./controllers";
3
+ export * from "./middlewares";
4
+ export * from "./endpoints";
5
+ export * from "./docs";
6
+ export * from "./openapi";