@adaas/a-server 0.0.13 → 0.0.15

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 (88) hide show
  1. package/.nvmrc +1 -1
  2. package/dist/index.d.ts +5 -4
  3. package/dist/index.js +7 -6
  4. package/dist/index.js.map +1 -1
  5. package/dist/src/components/A-CommandController/A-CommandController.component.d.ts +8 -0
  6. package/dist/src/components/A-CommandController/A-CommandController.component.js +53 -0
  7. package/dist/src/components/A-CommandController/A-CommandController.component.js.map +1 -0
  8. package/dist/src/components/{A_Controller/A_Controller.component.js → A-Controller/A-Controller.component.js} +1 -1
  9. package/dist/src/components/{A_Controller/A_Controller.component.js.map → A-Controller/A-Controller.component.js.map} +1 -1
  10. package/dist/src/components/A-Controller/A-Controller.component.types.js +2 -0
  11. package/dist/src/components/A-Controller/A-Controller.component.types.js.map +1 -0
  12. package/dist/src/components/A-EntityController/A-EntityController.component.js +1 -2
  13. package/dist/src/components/A-EntityController/A-EntityController.component.js.map +1 -1
  14. package/dist/src/components/A-ListingController/A-ListingController.component.d.ts +1 -1
  15. package/dist/src/components/A-ListingController/A-ListingController.component.js.map +1 -1
  16. package/dist/src/components/A-Router/A-Router.component.js +13 -10
  17. package/dist/src/components/A-Router/A-Router.component.js.map +1 -1
  18. package/dist/src/components/A-Router/A-Router.component.types.d.ts +7 -2
  19. package/dist/src/components/A-Router/A-Router.component.types.js.map +1 -1
  20. package/dist/src/components/A-ServerCORS/A_ServerCORS.component.d.ts +1 -1
  21. package/dist/src/components/A-ServerCORS/A_ServerCORS.component.js +3 -3
  22. package/dist/src/components/A-ServerCORS/A_ServerCORS.component.js.map +1 -1
  23. package/dist/src/components/A-ServerHealthMonitor/A-ServerHealthMonitor.component.d.ts +1 -1
  24. package/dist/src/components/A-ServerHealthMonitor/A-ServerHealthMonitor.component.js +1 -1
  25. package/dist/src/components/A-ServerHealthMonitor/A-ServerHealthMonitor.component.js.map +1 -1
  26. package/dist/src/components/A-ServerLogger/A-ServerLogger.constants.d.ts +22 -0
  27. package/dist/src/components/A-ServerLogger/A-ServerLogger.constants.js +31 -0
  28. package/dist/src/components/A-ServerLogger/A-ServerLogger.constants.js.map +1 -0
  29. package/dist/src/components/A-ServerLogger/A_ServerLogger.component.d.ts +2 -2
  30. package/dist/src/components/A-ServerLogger/A_ServerLogger.component.js +6 -6
  31. package/dist/src/components/A-ServerLogger/A_ServerLogger.component.js.map +1 -1
  32. package/dist/src/components/A-ServerLogger/A_ServerLogger.component.types.d.ts +2 -0
  33. package/dist/src/components/A-ServerProxy/A-ServerProxy.component.js +2 -2
  34. package/dist/src/components/A-ServerProxy/A-ServerProxy.component.js.map +1 -1
  35. package/dist/src/components/A-StaticLoader/A-StaticLoader.component.js +2 -2
  36. package/dist/src/components/A-StaticLoader/A-StaticLoader.component.js.map +1 -1
  37. package/dist/src/components/A-StaticLoader/A-StaticLoader.component.types.js +2 -2
  38. package/dist/src/components/A-StaticLoader/A-StaticLoader.component.types.js.map +1 -1
  39. package/dist/src/constants/env.constants.d.ts +10 -0
  40. package/dist/src/constants/env.constants.js +20 -0
  41. package/dist/src/constants/env.constants.js.map +1 -0
  42. package/dist/src/containers/{A-Server/A-Server.container.d.ts → A-Service/A-Service.container.d.ts} +6 -1
  43. package/dist/src/containers/{A-Server/A-Server.container.js → A-Service/A-Service.container.js} +40 -28
  44. package/dist/src/containers/A-Service/A-Service.container.js.map +1 -0
  45. package/dist/src/containers/{A-Server/A-Server.container.types.d.ts → A-Service/A-Service.container.types.d.ts} +3 -1
  46. package/dist/src/containers/{A-Server/A-Server.container.types.js → A-Service/A-Service.container.types.js} +3 -1
  47. package/dist/src/containers/A-Service/A-Service.container.types.js.map +1 -0
  48. package/dist/src/entities/A-Response/A-Response.entity.js.map +1 -1
  49. package/dist/src/entities/A_EntityList/A_EntityList.entity.d.ts +1 -0
  50. package/dist/src/entities/A_EntityList/A_EntityList.entity.js +3 -0
  51. package/dist/src/entities/A_EntityList/A_EntityList.entity.js.map +1 -1
  52. package/examples/microservices-server/components/repositories/Memory.repository.ts +2 -2
  53. package/examples/microservices-server/concept.ts +1 -1
  54. package/examples/simple-server/commands/SignIn.command.ts +10 -0
  55. package/examples/simple-server/concept.ts +10 -5
  56. package/index.ts +5 -4
  57. package/jest.config.ts +1 -1
  58. package/package.json +3 -3
  59. package/src/components/A-CommandController/A-CommandController.component.ts +40 -0
  60. package/src/components/A-EntityController/A-EntityController.component.ts +1 -6
  61. package/src/components/A-ListingController/A-ListingController.component.ts +1 -1
  62. package/src/components/A-Router/A-Router.component.ts +15 -11
  63. package/src/components/A-Router/A-Router.component.types.ts +9 -2
  64. package/src/components/A-ServerCORS/A_ServerCORS.component.ts +3 -3
  65. package/src/components/A-ServerHealthMonitor/A-ServerHealthMonitor.component.ts +2 -2
  66. package/src/components/A-ServerLogger/A-ServerLogger.constants.ts +27 -0
  67. package/src/components/A-ServerLogger/A_ServerLogger.component.ts +7 -13
  68. package/src/components/A-ServerLogger/A_ServerLogger.component.types.ts +14 -1
  69. package/src/components/A-ServerProxy/A-ServerProxy.component.ts +1 -1
  70. package/src/components/A-StaticLoader/A-StaticLoader.component.ts +1 -1
  71. package/src/components/A-StaticLoader/A-StaticLoader.component.types.ts +1 -1
  72. package/src/constants/env.constants.ts +26 -0
  73. package/src/containers/{A-Server/A-Server.container.ts → A-Service/A-Service.container.ts} +31 -20
  74. package/src/containers/{A-Server/A-Server.container.types.ts → A-Service/A-Service.container.types.ts} +2 -0
  75. package/src/entities/A-Response/A-Response.entity.ts +0 -2
  76. package/src/entities/A_EntityList/A_EntityList.entity.ts +5 -0
  77. package/tests/A-Service.test.ts +20 -0
  78. package/dist/src/components/A_Controller/A_Controller.component.types.js +0 -2
  79. package/dist/src/components/A_Controller/A_Controller.component.types.js.map +0 -1
  80. package/dist/src/containers/A-Server/A-Server.container.js.map +0 -1
  81. package/dist/src/containers/A-Server/A-Server.container.types.js.map +0 -1
  82. package/tests/app.test.ts +0 -29
  83. package/tests/decorator.test.ts +0 -33
  84. package/tests/default.test.ts +0 -121
  85. /package/dist/src/components/{A_Controller/A_Controller.component.d.ts → A-Controller/A-Controller.component.d.ts} +0 -0
  86. /package/dist/src/components/{A_Controller/A_Controller.component.types.d.ts → A-Controller/A-Controller.component.types.d.ts} +0 -0
  87. /package/src/components/{A_Controller/A_Controller.component.ts → A-Controller/A-Controller.component.ts} +0 -0
  88. /package/src/components/{A_Controller/A_Controller.component.types.ts → A-Controller/A-Controller.component.types.ts} +0 -0
@@ -1,121 +0,0 @@
1
- import { config } from 'dotenv';
2
- config();
3
- jest.retryTimes(0);
4
- import { A_EXPRESS_Access } from '../src/decorators/A_EXPRESS_Access.decorator';
5
- import { A_SDK_Error } from '@adaas/a-sdk-types';
6
- import { createServer } from 'http';
7
- import express from 'express';
8
- import axios from 'axios';
9
- import { A_EXPRESS_Context } from '@adaas/a-sdk/global/A_EXPRESS_Context.class';
10
- import { A_EXPRESS_TYPES__INextFunction, A_EXPRESS_TYPES__IRequest } from '@adaas/a-sdk/types/A_EXPRESS_Controller.types';
11
- import { A_EXPRESS_Routes } from '@adaas/a-sdk/decorators/A_EXPRESS_Routes.decorator';
12
- import { A_EXPRESS_TYPES__SERVER_COMMANDS_IResponse } from '@adaas/a-sdk/types/A_EXPRESS_ServerCommandsController.types';
13
- import { A_EXPRESS_Controller, A_EXPRESS_ServerDelegate } from '@adaas/a-sdk/decorators/A_EXPRESS_Controller.decorator';
14
- import { A_EXPRESS_Get } from '@adaas/a-sdk/decorators/A_EXPRESS_Methods.decorator';
15
-
16
- describe('Defaults', () => {
17
- it('Should Assign Router', async () => {
18
-
19
- try {
20
-
21
- @A_EXPRESS_Controller()
22
- class Test {
23
-
24
- @A_EXPRESS_Get({
25
- path: '/test',
26
- config: {
27
- identity: false,
28
- auth: false
29
- }
30
- })
31
- @A_EXPRESS_Access<Test, A_EXPRESS_TYPES__IRequest, ['default', 'test']>({
32
- acl: {
33
- default: (qb, self, req) => {
34
- return qb.action('read');
35
- },
36
- test: (qb, self, req) => {
37
- return qb.action('test');
38
- }
39
- }
40
- })
41
- async test(req: any, res: any, next: any) {
42
- console.log('test')
43
-
44
- return res.status(200).send({
45
- message: 'test'
46
- });
47
- }
48
- }
49
-
50
- const app = express();
51
-
52
- app.use(A_EXPRESS_Routes([Test]));
53
-
54
- const port = 3000;
55
-
56
- (async () => {
57
- const server = createServer(app);
58
-
59
- await server.listen(
60
- port,
61
- () => console.info(`Server running on port ${port}`)
62
- );
63
- })();
64
-
65
-
66
- const resp = await axios.get(`http://localhost:${port}/test`);
67
-
68
- console.log(resp.data);
69
-
70
- } catch (error) {
71
- A_EXPRESS_Context.Logger.error(new A_SDK_Error(error));
72
- }
73
- });
74
-
75
-
76
- it('Should Assign Router', async () => {
77
-
78
- try {
79
- type foo = ({
80
- magic: string;
81
- } & {
82
- id: string;
83
- }) | ({
84
- aseid: string;
85
- } & { scope: string });
86
-
87
-
88
-
89
- @A_EXPRESS_ServerDelegate('users', (() => { }) as any, {
90
- id: 'ID',
91
- auth: {
92
- enable: true,
93
- },
94
- get: {
95
- where: async (self, req) => ({ id: parseInt(req.params.id) })
96
- }
97
- })
98
- class Test {
99
- async post(
100
- req: A_EXPRESS_TYPES__IRequest<foo>,
101
- res: A_EXPRESS_TYPES__SERVER_COMMANDS_IResponse,
102
- next: A_EXPRESS_TYPES__INextFunction
103
- ) {
104
- const body = req.body;
105
-
106
- if ('aseid' in body) {
107
- console.log(body.aseid)
108
- }
109
- }
110
-
111
- }
112
-
113
- }
114
- catch (error) {
115
- A_EXPRESS_Context.Logger.error(new A_SDK_Error(error));
116
- }
117
-
118
- })
119
-
120
-
121
- });