@adaas/a-server 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/index.d.mts +739 -0
- package/dist/index.d.ts +739 -36
- package/dist/index.js +1904 -102
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1862 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +5 -3
- package/src/components/A-ServerLogger/A_ServerLogger.component.ts +1 -1
- package/src/index.ts +75 -0
- package/tsconfig.build.json +9 -43
- package/tsconfig.json +1 -1
- package/tsup.config.ts +15 -0
- package/dist/src/channels/A-Http/A-Http.channel.constants.d.ts +0 -5
- package/dist/src/channels/A-Http/A-Http.channel.constants.js +0 -10
- package/dist/src/channels/A-Http/A-Http.channel.constants.js.map +0 -1
- package/dist/src/channels/A-Http/A-Http.channel.d.ts +0 -29
- package/dist/src/channels/A-Http/A-Http.channel.error.d.ts +0 -4
- package/dist/src/channels/A-Http/A-Http.channel.error.js +0 -9
- package/dist/src/channels/A-Http/A-Http.channel.error.js.map +0 -1
- package/dist/src/channels/A-Http/A-Http.channel.js +0 -154
- package/dist/src/channels/A-Http/A-Http.channel.js.map +0 -1
- package/dist/src/channels/A-Http/A-Http.channel.types.d.ts +0 -59
- package/dist/src/channels/A-Http/A-Http.channel.types.js +0 -3
- package/dist/src/channels/A-Http/A-Http.channel.types.js.map +0 -1
- package/dist/src/channels/A-Websockets/A-Websockets.channel.d.ts +0 -4
- package/dist/src/channels/A-Websockets/A-Websockets.channel.js +0 -22
- package/dist/src/channels/A-Websockets/A-Websockets.channel.js.map +0 -1
- package/dist/src/components/A-CommandController/A-CommandController.component.d.ts +0 -8
- package/dist/src/components/A-CommandController/A-CommandController.component.js +0 -55
- package/dist/src/components/A-CommandController/A-CommandController.component.js.map +0 -1
- package/dist/src/components/A-Controller/A-Controller.component.d.ts +0 -9
- package/dist/src/components/A-Controller/A-Controller.component.js +0 -60
- package/dist/src/components/A-Controller/A-Controller.component.js.map +0 -1
- package/dist/src/components/A-Controller/A-Controller.component.types.d.ts +0 -0
- package/dist/src/components/A-Controller/A-Controller.component.types.js +0 -2
- package/dist/src/components/A-Controller/A-Controller.component.types.js.map +0 -1
- package/dist/src/components/A-EntityController/A-EntityController.component.d.ts +0 -26
- package/dist/src/components/A-EntityController/A-EntityController.component.js +0 -226
- package/dist/src/components/A-EntityController/A-EntityController.component.js.map +0 -1
- package/dist/src/components/A-EntityController/A-EntityController.component.types.d.ts +0 -0
- package/dist/src/components/A-EntityController/A-EntityController.component.types.js +0 -2
- package/dist/src/components/A-EntityController/A-EntityController.component.types.js.map +0 -1
- package/dist/src/components/A-EntityRepository/A-EntityRepository.component.d.ts +0 -9
- package/dist/src/components/A-EntityRepository/A-EntityRepository.component.js +0 -118
- package/dist/src/components/A-EntityRepository/A-EntityRepository.component.js.map +0 -1
- package/dist/src/components/A-EntityRepository/A-EntityRepository.error.d.ts +0 -0
- package/dist/src/components/A-EntityRepository/A-EntityRepository.error.js +0 -2
- package/dist/src/components/A-EntityRepository/A-EntityRepository.error.js.map +0 -1
- package/dist/src/components/A-EntityRepository/A-EntityRepository.types.d.ts +0 -0
- package/dist/src/components/A-EntityRepository/A-EntityRepository.types.js +0 -2
- package/dist/src/components/A-EntityRepository/A-EntityRepository.types.js.map +0 -1
- package/dist/src/components/A-ListingController/A-ListingController.component.d.ts +0 -10
- package/dist/src/components/A-ListingController/A-ListingController.component.js +0 -72
- package/dist/src/components/A-ListingController/A-ListingController.component.js.map +0 -1
- package/dist/src/components/A-ListingController/A-ListingController.component.types.d.ts +0 -0
- package/dist/src/components/A-ListingController/A-ListingController.component.types.js +0 -2
- package/dist/src/components/A-ListingController/A-ListingController.component.types.js.map +0 -1
- package/dist/src/components/A-Router/A-Router.component.d.ts +0 -63
- package/dist/src/components/A-Router/A-Router.component.js +0 -221
- package/dist/src/components/A-Router/A-Router.component.js.map +0 -1
- package/dist/src/components/A-Router/A-Router.component.types.d.ts +0 -26
- package/dist/src/components/A-Router/A-Router.component.types.js +0 -17
- package/dist/src/components/A-Router/A-Router.component.types.js.map +0 -1
- package/dist/src/components/A-ServerCORS/A_ServerCORS.component.d.ts +0 -9
- package/dist/src/components/A-ServerCORS/A_ServerCORS.component.defaults.d.ts +0 -2
- package/dist/src/components/A-ServerCORS/A_ServerCORS.component.defaults.js +0 -11
- package/dist/src/components/A-ServerCORS/A_ServerCORS.component.defaults.js.map +0 -1
- package/dist/src/components/A-ServerCORS/A_ServerCORS.component.js +0 -70
- package/dist/src/components/A-ServerCORS/A_ServerCORS.component.js.map +0 -1
- package/dist/src/components/A-ServerCORS/A_ServerCORS.component.types.d.ts +0 -7
- package/dist/src/components/A-ServerCORS/A_ServerCORS.component.types.js +0 -3
- package/dist/src/components/A-ServerCORS/A_ServerCORS.component.types.js.map +0 -1
- package/dist/src/components/A-ServerError/A-ServerError.class.d.ts +0 -7
- package/dist/src/components/A-ServerError/A-ServerError.class.js +0 -88
- package/dist/src/components/A-ServerError/A-ServerError.class.js.map +0 -1
- package/dist/src/components/A-ServerError/A-ServerError.constants.d.ts +0 -0
- package/dist/src/components/A-ServerError/A-ServerError.constants.js +0 -2
- package/dist/src/components/A-ServerError/A-ServerError.constants.js.map +0 -1
- package/dist/src/components/A-ServerError/A-ServerError.types.d.ts +0 -13
- package/dist/src/components/A-ServerError/A-ServerError.types.js +0 -3
- package/dist/src/components/A-ServerError/A-ServerError.types.js.map +0 -1
- package/dist/src/components/A-ServerHealthMonitor/A-ServerHealthMonitor.component.d.ts +0 -7
- package/dist/src/components/A-ServerHealthMonitor/A-ServerHealthMonitor.component.js +0 -81
- package/dist/src/components/A-ServerHealthMonitor/A-ServerHealthMonitor.component.js.map +0 -1
- package/dist/src/components/A-ServerHealthMonitor/A-ServerHealthMonitor.component.types.d.ts +0 -0
- package/dist/src/components/A-ServerHealthMonitor/A-ServerHealthMonitor.component.types.js +0 -2
- package/dist/src/components/A-ServerHealthMonitor/A-ServerHealthMonitor.component.types.js.map +0 -1
- package/dist/src/components/A-ServerLogger/A-ServerLogger.constants.d.ts +0 -22
- package/dist/src/components/A-ServerLogger/A-ServerLogger.constants.js +0 -31
- package/dist/src/components/A-ServerLogger/A-ServerLogger.constants.js.map +0 -1
- package/dist/src/components/A-ServerLogger/A_ServerLogger.component.d.ts +0 -43
- package/dist/src/components/A-ServerLogger/A_ServerLogger.component.js +0 -167
- package/dist/src/components/A-ServerLogger/A_ServerLogger.component.js.map +0 -1
- package/dist/src/components/A-ServerLogger/A_ServerLogger.component.types.d.ts +0 -9
- package/dist/src/components/A-ServerLogger/A_ServerLogger.component.types.js +0 -3
- package/dist/src/components/A-ServerLogger/A_ServerLogger.component.types.js.map +0 -1
- package/dist/src/components/A-ServerProxy/A-ServerProxy.component.d.ts +0 -9
- package/dist/src/components/A-ServerProxy/A-ServerProxy.component.js +0 -88
- package/dist/src/components/A-ServerProxy/A-ServerProxy.component.js.map +0 -1
- package/dist/src/components/A-StaticLoader/A-StaticLoader.component.d.ts +0 -12
- package/dist/src/components/A-StaticLoader/A-StaticLoader.component.js +0 -126
- package/dist/src/components/A-StaticLoader/A-StaticLoader.component.js.map +0 -1
- package/dist/src/components/A-StaticLoader/A-StaticLoader.component.types.d.ts +0 -10
- package/dist/src/components/A-StaticLoader/A-StaticLoader.component.types.js +0 -109
- package/dist/src/components/A-StaticLoader/A-StaticLoader.component.types.js.map +0 -1
- package/dist/src/constants/env.constants.d.ts +0 -10
- package/dist/src/constants/env.constants.js +0 -20
- package/dist/src/constants/env.constants.js.map +0 -1
- package/dist/src/containers/A-Service/A-Service.container.d.ts +0 -30
- package/dist/src/containers/A-Service/A-Service.container.js +0 -200
- package/dist/src/containers/A-Service/A-Service.container.js.map +0 -1
- package/dist/src/containers/A-Service/A-Service.container.types.d.ts +0 -36
- package/dist/src/containers/A-Service/A-Service.container.types.js +0 -27
- package/dist/src/containers/A-Service/A-Service.container.types.js.map +0 -1
- package/dist/src/context/A-EntityFactory/A-EntityFactory.context.d.ts +0 -39
- package/dist/src/context/A-EntityFactory/A-EntityFactory.context.js +0 -69
- package/dist/src/context/A-EntityFactory/A-EntityFactory.context.js.map +0 -1
- package/dist/src/context/A-EntityFactory/A-EntityFactory.context.types.d.ts +0 -5
- package/dist/src/context/A-EntityFactory/A-EntityFactory.context.types.js +0 -3
- package/dist/src/context/A-EntityFactory/A-EntityFactory.context.types.js.map +0 -1
- package/dist/src/context/A-HttpChannel/A-HttpChannel.context.d.ts +0 -12
- package/dist/src/context/A-HttpChannel/A-HttpChannel.context.js +0 -16
- package/dist/src/context/A-HttpChannel/A-HttpChannel.context.js.map +0 -1
- package/dist/src/context/A-ListQueryFilter/A_ListQueryFilter.context.d.ts +0 -10
- package/dist/src/context/A-ListQueryFilter/A_ListQueryFilter.context.js +0 -30
- package/dist/src/context/A-ListQueryFilter/A_ListQueryFilter.context.js.map +0 -1
- package/dist/src/context/A-ProxyConfig/A_ProxyConfig.constants.d.ts +0 -2
- package/dist/src/context/A-ProxyConfig/A_ProxyConfig.constants.js +0 -12
- package/dist/src/context/A-ProxyConfig/A_ProxyConfig.constants.js.map +0 -1
- package/dist/src/context/A-ProxyConfig/A_ProxyConfig.context.d.ts +0 -29
- package/dist/src/context/A-ProxyConfig/A_ProxyConfig.context.js +0 -60
- package/dist/src/context/A-ProxyConfig/A_ProxyConfig.context.js.map +0 -1
- package/dist/src/context/A-ProxyConfig/A_ProxyConfig.types.d.ts +0 -18
- package/dist/src/context/A-ProxyConfig/A_ProxyConfig.types.js +0 -3
- package/dist/src/context/A-ProxyConfig/A_ProxyConfig.types.js.map +0 -1
- package/dist/src/context/A-Server/A_Server.context.d.ts +0 -17
- package/dist/src/context/A-Server/A_Server.context.js +0 -22
- package/dist/src/context/A-Server/A_Server.context.js.map +0 -1
- package/dist/src/context/A-Server/A_Server.context.types.d.ts +0 -7
- package/dist/src/context/A-Server/A_Server.context.types.js +0 -3
- package/dist/src/context/A-Server/A_Server.context.types.js.map +0 -1
- package/dist/src/context/A-StaticConfig/A-StaticConfig.context.d.ts +0 -16
- package/dist/src/context/A-StaticConfig/A-StaticConfig.context.js +0 -28
- package/dist/src/context/A-StaticConfig/A-StaticConfig.context.js.map +0 -1
- package/dist/src/context/A-StaticConfig/A-StaticConfig.context.types.d.ts +0 -0
- package/dist/src/context/A-StaticConfig/A-StaticConfig.context.types.js +0 -2
- package/dist/src/context/A-StaticConfig/A-StaticConfig.context.types.js.map +0 -1
- package/dist/src/entities/A-Request/A-Request.entity.d.ts +0 -31
- package/dist/src/entities/A-Request/A-Request.entity.js +0 -125
- package/dist/src/entities/A-Request/A-Request.entity.js.map +0 -1
- package/dist/src/entities/A-Request/A-Request.entity.types.d.ts +0 -21
- package/dist/src/entities/A-Request/A-Request.entity.types.js +0 -12
- package/dist/src/entities/A-Request/A-Request.entity.types.js.map +0 -1
- package/dist/src/entities/A-Response/A-Response.entity.d.ts +0 -28
- package/dist/src/entities/A-Response/A-Response.entity.js +0 -141
- package/dist/src/entities/A-Response/A-Response.entity.js.map +0 -1
- package/dist/src/entities/A-Response/A-Response.entity.types.d.ts +0 -19
- package/dist/src/entities/A-Response/A-Response.entity.types.js +0 -12
- package/dist/src/entities/A-Response/A-Response.entity.types.js.map +0 -1
- package/dist/src/entities/A-Route/A-Route.entity.d.ts +0 -17
- package/dist/src/entities/A-Route/A-Route.entity.js +0 -76
- package/dist/src/entities/A-Route/A-Route.entity.js.map +0 -1
- package/dist/src/entities/A-Route/A-Route.entity.types.d.ts +0 -0
- package/dist/src/entities/A-Route/A-Route.entity.types.js +0 -2
- package/dist/src/entities/A-Route/A-Route.entity.types.js.map +0 -1
- package/dist/src/entities/A_EntityList/A_EntityList.entity.d.ts +0 -46
- package/dist/src/entities/A_EntityList/A_EntityList.entity.js +0 -91
- package/dist/src/entities/A_EntityList/A_EntityList.entity.js.map +0 -1
- package/dist/src/entities/A_EntityList/A_EntityList.entity.types.d.ts +0 -21
- package/dist/src/entities/A_EntityList/A_EntityList.entity.types.js +0 -8
- package/dist/src/entities/A_EntityList/A_EntityList.entity.types.js.map +0 -1
- package/index.ts +0 -75
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.A_Response = void 0;
|
|
13
|
-
const a_concept_1 = require("@adaas/a-concept");
|
|
14
|
-
const A_Response_entity_types_1 = require("./A-Response.entity.types");
|
|
15
|
-
const A_ServerError_class_1 = require("../../components/A-ServerError/A-ServerError.class");
|
|
16
|
-
const a_utils_1 = require("@adaas/a-utils");
|
|
17
|
-
class A_Response extends a_concept_1.A_Entity {
|
|
18
|
-
constructor() {
|
|
19
|
-
super(...arguments);
|
|
20
|
-
/**
|
|
21
|
-
* Duration of the request in milliseconds
|
|
22
|
-
*/
|
|
23
|
-
this.duration = 0;
|
|
24
|
-
this.data = new Map();
|
|
25
|
-
}
|
|
26
|
-
fromNew(newEntity) {
|
|
27
|
-
this.res = newEntity.response;
|
|
28
|
-
this.aseid = new a_concept_1.ASEID({
|
|
29
|
-
concept: a_concept_1.A_Context.root.name,
|
|
30
|
-
scope: newEntity.scope,
|
|
31
|
-
entity: this.constructor.entity,
|
|
32
|
-
id: newEntity.id
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
get headersSent() {
|
|
36
|
-
return this.res.headersSent;
|
|
37
|
-
}
|
|
38
|
-
get original() {
|
|
39
|
-
return this.res;
|
|
40
|
-
}
|
|
41
|
-
get statusCode() {
|
|
42
|
-
return this.res.statusCode;
|
|
43
|
-
}
|
|
44
|
-
init() {
|
|
45
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
-
const startTime = process.hrtime();
|
|
47
|
-
this.res.on('finish', () => __awaiter(this, void 0, void 0, function* () {
|
|
48
|
-
const elapsedTime = process.hrtime(startTime);
|
|
49
|
-
const elapsedMilliseconds = elapsedTime[0] * 1000 + elapsedTime[1] / 1e6;
|
|
50
|
-
this.duration = elapsedMilliseconds;
|
|
51
|
-
yield this.call(A_Response_entity_types_1.A_SERVER_TYPES__ResponseEvent.Finish);
|
|
52
|
-
}));
|
|
53
|
-
this.res.on('close', () => __awaiter(this, void 0, void 0, function* () {
|
|
54
|
-
yield this.call(A_Response_entity_types_1.A_SERVER_TYPES__ResponseEvent.Close);
|
|
55
|
-
}));
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
failed(error) {
|
|
59
|
-
switch (true) {
|
|
60
|
-
case error instanceof A_ServerError_class_1.A_ServerError:
|
|
61
|
-
this.error = error;
|
|
62
|
-
break;
|
|
63
|
-
case error instanceof a_concept_1.A_Error:
|
|
64
|
-
this.error = new A_ServerError_class_1.A_ServerError(error);
|
|
65
|
-
break;
|
|
66
|
-
default:
|
|
67
|
-
this.error = new A_ServerError_class_1.A_ServerError(error);
|
|
68
|
-
break;
|
|
69
|
-
}
|
|
70
|
-
return this.status(this.error.status).json(this.error);
|
|
71
|
-
}
|
|
72
|
-
// Send a plain text or JSON response
|
|
73
|
-
send(data = this.toResponse()) {
|
|
74
|
-
const logger = a_concept_1.A_Context.scope(this).resolve(a_utils_1.A_Logger);
|
|
75
|
-
if (this.headersSent) {
|
|
76
|
-
logger.warning('Response headers already sent, cannot send response again.');
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
try {
|
|
80
|
-
switch (true) {
|
|
81
|
-
case !!data && typeof data === 'object':
|
|
82
|
-
return this.json(data);
|
|
83
|
-
case !!data && typeof data === 'string':
|
|
84
|
-
this.res.setHeader('Content-Type', 'text/plain');
|
|
85
|
-
this.res.writeHead(this.statusCode);
|
|
86
|
-
this.res.end(data);
|
|
87
|
-
return;
|
|
88
|
-
default:
|
|
89
|
-
this.res.writeHead(this.statusCode);
|
|
90
|
-
this.res.end(data);
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
catch (error) {
|
|
95
|
-
logger.warning('Response send error:', error);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
destroy(error, scope) {
|
|
99
|
-
this.res.end();
|
|
100
|
-
return super.destroy(scope);
|
|
101
|
-
}
|
|
102
|
-
// Explicit JSON response
|
|
103
|
-
json(data = this.toResponse()) {
|
|
104
|
-
const logger = a_concept_1.A_Context.scope(this).resolve(a_utils_1.A_Logger);
|
|
105
|
-
if (this.headersSent) {
|
|
106
|
-
logger.warning('Response headers already sent, cannot send response again.');
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
this.res.setHeader('Content-Type', 'application/json');
|
|
110
|
-
this.res.writeHead(this.statusCode);
|
|
111
|
-
this.res.end(JSON.stringify(data));
|
|
112
|
-
}
|
|
113
|
-
// Set HTTP status code
|
|
114
|
-
status(code) {
|
|
115
|
-
this.res.statusCode = code;
|
|
116
|
-
return this;
|
|
117
|
-
}
|
|
118
|
-
writeHead(statusCode, headers) {
|
|
119
|
-
this.res.writeHead(statusCode, headers);
|
|
120
|
-
}
|
|
121
|
-
setHeader(key, value) {
|
|
122
|
-
this.res.setHeader(key, value);
|
|
123
|
-
}
|
|
124
|
-
getHeader(key) {
|
|
125
|
-
return this.res.getHeader(key);
|
|
126
|
-
}
|
|
127
|
-
add(key, data) {
|
|
128
|
-
this.data.set(key, data);
|
|
129
|
-
}
|
|
130
|
-
toResponse() {
|
|
131
|
-
return Array.from(this.data.entries()).reduce((acc, [key, value]) => {
|
|
132
|
-
if (value instanceof a_concept_1.A_Entity)
|
|
133
|
-
acc[key] = value.toJSON();
|
|
134
|
-
else
|
|
135
|
-
acc[key] = value;
|
|
136
|
-
return acc;
|
|
137
|
-
}, {});
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
exports.A_Response = A_Response;
|
|
141
|
-
//# sourceMappingURL=A-Response.entity.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"A-Response.entity.js","sourceRoot":"","sources":["../../../../src/entities/A-Response/A-Response.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gDAM0B;AAK1B,uEAKmC;AACnC,sGAA6F;AAC7F,4CAA0C;AAK1C,MAAa,UAEX,SAAQ,oBAGT;IALD;;QASI;;WAEG;QACH,aAAQ,GAAW,CAAC,CAAC;QAGb,SAAI,GAA+B,IAAI,GAAG,EAAE,CAAC;IA2JzD,CAAC;IAvJG,OAAO,CAAC,SAA8C;QAClD,IAAI,CAAC,GAAG,GAAG,SAAS,CAAC,QAAQ,CAAC;QAE9B,IAAI,CAAC,KAAK,GAAG,IAAI,iBAAK,CAAC;YACnB,OAAO,EAAE,qBAAS,CAAC,IAAI,CAAC,IAAI;YAC5B,KAAK,EAAE,SAAS,CAAC,KAAK;YACtB,MAAM,EAAG,IAAI,CAAC,WAAiC,CAAC,MAAM;YACtD,EAAE,EAAE,SAAS,CAAC,EAAE;SACnB,CAAC,CAAC;IACP,CAAC;IAED,IAAI,WAAW;QACX,OAAO,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC;IAChC,CAAC;IAED,IAAI,QAAQ;QACR,OAAO,IAAI,CAAC,GAAG,CAAC;IACpB,CAAC;IAED,IAAI,UAAU;QACV,OAAO,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC;IAC/B,CAAC;IAEK,IAAI;;YACN,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;YAEnC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,QAAQ,EAAE,GAA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AC;CACJ;AA1KD,gCA0KC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { A_TYPES__Entity_Serialized } from "@adaas/a-concept";
|
|
2
|
-
import { ServerResponse } from "http";
|
|
3
|
-
export type A_SERVER_TYPES__ResponseConstructor = {
|
|
4
|
-
/**
|
|
5
|
-
* Should correspond to Request id
|
|
6
|
-
*/
|
|
7
|
-
id: string;
|
|
8
|
-
scope: string;
|
|
9
|
-
response: ServerResponse;
|
|
10
|
-
};
|
|
11
|
-
export declare enum A_SERVER_TYPES__ResponseEvent {
|
|
12
|
-
Error = "error",
|
|
13
|
-
Finish = "finish",
|
|
14
|
-
Data = "data",
|
|
15
|
-
End = "end",
|
|
16
|
-
Close = "close"
|
|
17
|
-
}
|
|
18
|
-
export type A_SERVER_TYPES__ResponseSerialized = A_TYPES__Entity_Serialized;
|
|
19
|
-
export type A_SERVER_TYPES__SendResponseObject<_ResponseType = any> = Record<string, _ResponseType>;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.A_SERVER_TYPES__ResponseEvent = void 0;
|
|
4
|
-
var A_SERVER_TYPES__ResponseEvent;
|
|
5
|
-
(function (A_SERVER_TYPES__ResponseEvent) {
|
|
6
|
-
A_SERVER_TYPES__ResponseEvent["Error"] = "error";
|
|
7
|
-
A_SERVER_TYPES__ResponseEvent["Finish"] = "finish";
|
|
8
|
-
A_SERVER_TYPES__ResponseEvent["Data"] = "data";
|
|
9
|
-
A_SERVER_TYPES__ResponseEvent["End"] = "end";
|
|
10
|
-
A_SERVER_TYPES__ResponseEvent["Close"] = "close";
|
|
11
|
-
})(A_SERVER_TYPES__ResponseEvent || (exports.A_SERVER_TYPES__ResponseEvent = A_SERVER_TYPES__ResponseEvent = {}));
|
|
12
|
-
//# sourceMappingURL=A-Response.entity.types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"A-Response.entity.types.js","sourceRoot":"","sources":["../../../../src/entities/A-Response/A-Response.entity.types.ts"],"names":[],"mappings":";;;AAaA,IAAY,6BAMX;AAND,WAAY,6BAA6B;IACrC,gDAAe,CAAA;IACf,kDAAiB,CAAA;IACjB,8CAAa,CAAA;IACb,4CAAW,CAAA;IACX,gDAAe,CAAA;AACnB,CAAC,EANW,6BAA6B,6CAA7B,6BAA6B,QAMxC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { A_SERVER_TYPES__RequestMethods } from '../A-Request/A-Request.entity.types';
|
|
2
|
-
export declare class A_Route {
|
|
3
|
-
url: string;
|
|
4
|
-
method: A_SERVER_TYPES__RequestMethods;
|
|
5
|
-
constructor(url: string | RegExp, method: A_SERVER_TYPES__RequestMethods);
|
|
6
|
-
constructor(url: string | RegExp);
|
|
7
|
-
/**
|
|
8
|
-
* returns path only without query and hash
|
|
9
|
-
*/
|
|
10
|
-
get path(): string;
|
|
11
|
-
get params(): string[];
|
|
12
|
-
extractParams(url: string): Record<string, string>;
|
|
13
|
-
extractQuery(url: string): Record<string, string>;
|
|
14
|
-
toString(): string;
|
|
15
|
-
toRegExp(): RegExp;
|
|
16
|
-
toAFeatureExtension(extensionScope?: Array<string>): RegExp;
|
|
17
|
-
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.A_Route = void 0;
|
|
4
|
-
class A_Route {
|
|
5
|
-
constructor(param1, param2) {
|
|
6
|
-
this.url = param1 instanceof RegExp ? param1.source : param1;
|
|
7
|
-
this.method = param2 || 'GET';
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* returns path only without query and hash
|
|
11
|
-
*/
|
|
12
|
-
get path() {
|
|
13
|
-
const p = this.url.split('?')[0].split('#')[0];
|
|
14
|
-
// ensure that last char is not /
|
|
15
|
-
return p.endsWith('/') ? p.slice(0, -1) : p;
|
|
16
|
-
}
|
|
17
|
-
get params() {
|
|
18
|
-
var _a;
|
|
19
|
-
return ((_a = this.path
|
|
20
|
-
.match(/:([^\/]+)/g)) === null || _a === void 0 ? void 0 : _a.map((param) => param.slice(1)))
|
|
21
|
-
|| [];
|
|
22
|
-
}
|
|
23
|
-
extractParams(url) {
|
|
24
|
-
// Remove query string (anything after ?)
|
|
25
|
-
const cleanUrl = url.split('?')[0];
|
|
26
|
-
const urlSegments = cleanUrl.split('/').filter(Boolean);
|
|
27
|
-
const maskSegments = this.path.split('/').filter(Boolean);
|
|
28
|
-
const params = {};
|
|
29
|
-
for (let i = 0; i < maskSegments.length; i++) {
|
|
30
|
-
const maskSegment = maskSegments[i];
|
|
31
|
-
const urlSegment = urlSegments[i];
|
|
32
|
-
if (maskSegment.startsWith(':')) {
|
|
33
|
-
const paramName = maskSegment.slice(1); // Remove ':' from mask
|
|
34
|
-
params[paramName] = urlSegment;
|
|
35
|
-
}
|
|
36
|
-
else if (maskSegment !== urlSegment) {
|
|
37
|
-
// If static segments don’t match → fail
|
|
38
|
-
return {};
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return params;
|
|
42
|
-
}
|
|
43
|
-
extractQuery(url) {
|
|
44
|
-
const query = {};
|
|
45
|
-
// Take only the part after "?"
|
|
46
|
-
const queryString = url.split('?')[1];
|
|
47
|
-
if (!queryString)
|
|
48
|
-
return query;
|
|
49
|
-
// Remove fragment (#...) if present
|
|
50
|
-
const cleanQuery = queryString.split('#')[0];
|
|
51
|
-
// Split into key=value pairs
|
|
52
|
-
for (const pair of cleanQuery.split('&')) {
|
|
53
|
-
if (!pair)
|
|
54
|
-
continue;
|
|
55
|
-
const [key, value = ''] = pair.split('=');
|
|
56
|
-
query[decodeURIComponent(key)] = decodeURIComponent(value);
|
|
57
|
-
}
|
|
58
|
-
return query;
|
|
59
|
-
}
|
|
60
|
-
toString() {
|
|
61
|
-
// path can be like /api/v1/users/:id
|
|
62
|
-
// and because of that :id we need to replace it with regex that matches chars and numbers only
|
|
63
|
-
return `${this.method}::${this.path}`;
|
|
64
|
-
// .replace(/\/:([^\/]+)/g, '\\/([^\/]+)')
|
|
65
|
-
}
|
|
66
|
-
toRegExp() {
|
|
67
|
-
return new RegExp(`^${this.method}::${this.path.replace(/\/:([^\/]+)/g, '/([^/]+)')}$`);
|
|
68
|
-
}
|
|
69
|
-
toAFeatureExtension(extensionScope = []) {
|
|
70
|
-
return new RegExp(`^${extensionScope.length
|
|
71
|
-
? `(${extensionScope.join('|')})`
|
|
72
|
-
: '.*'}\\.${this.method}::${this.path.replace(/\/:([^\/]+)/g, '/([^/]+)')}$`);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
exports.A_Route = A_Route;
|
|
76
|
-
//# sourceMappingURL=A-Route.entity.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"A-Route.entity.js","sourceRoot":"","sources":["../../../../src/entities/A-Route/A-Route.entity.ts"],"names":[],"mappings":";;;AAIA,MAAa,OAAO;IAahB,YACI,MAAuB,EACvB,MAAuC;QAGvC,IAAI,CAAC,GAAG,GAAG,MAAM,YAAY,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;QAC7D,IAAI,CAAC,MAAM,GAAG,MAAM,IAAI,KAAK,CAAC;IAElC,CAAC;IAGD;;OAEG;IACH,IAAI,IAAI;QACJ,MAAM,CAAC,GAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAEhD,kCAAkC;QAClC,OAAO,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAChD,CAAC;IAGD,IAAI,MAAM;;QACN,OAAO,CAAA,MAA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file":"A-Route.entity.types.js","sourceRoot":"","sources":["../../../../src/entities/A-Route/A-Route.entity.types.ts"],"names":[],"mappings":""}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { A_Entity } from "@adaas/a-concept";
|
|
2
|
-
import { A_SERVER_TYPES__A_EntityListConstructor, A_SERVER_TYPES__A_EntityListPagination, A_SERVER_TYPES__A_EntityListSerialized } from "./A_EntityList.entity.types";
|
|
3
|
-
/**
|
|
4
|
-
* A-EntityList
|
|
5
|
-
*
|
|
6
|
-
* Entity that represents a list of entities with pagination of particular type
|
|
7
|
-
*/
|
|
8
|
-
export declare class A_EntityList<EntityType extends A_Entity = A_Entity> extends A_Entity<A_SERVER_TYPES__A_EntityListConstructor, A_SERVER_TYPES__A_EntityListSerialized> {
|
|
9
|
-
static get scope(): string;
|
|
10
|
-
protected _entityConstructor: new (...args: ConstructorParameters<typeof A_Entity>) => EntityType;
|
|
11
|
-
protected _items: Array<EntityType>;
|
|
12
|
-
protected _pagination: A_SERVER_TYPES__A_EntityListPagination;
|
|
13
|
-
/**
|
|
14
|
-
* Returns the entity constructor used for the list
|
|
15
|
-
*/
|
|
16
|
-
get entityConstructor(): new (...args: ConstructorParameters<typeof A_Entity>) => EntityType;
|
|
17
|
-
/**
|
|
18
|
-
* Returns the list of items contained in the entity list
|
|
19
|
-
*/
|
|
20
|
-
get items(): Array<EntityType>;
|
|
21
|
-
/**
|
|
22
|
-
* Returns pagination information about the entity list
|
|
23
|
-
*/
|
|
24
|
-
get pagination(): A_SERVER_TYPES__A_EntityListPagination;
|
|
25
|
-
/**
|
|
26
|
-
* Creates a new instance of A_EntityList
|
|
27
|
-
*
|
|
28
|
-
* @param newEntity
|
|
29
|
-
*/
|
|
30
|
-
fromNew(newEntity: A_SERVER_TYPES__A_EntityListConstructor): void;
|
|
31
|
-
/**
|
|
32
|
-
* Allows to convert Repository Response data to EntityList instance
|
|
33
|
-
*
|
|
34
|
-
* [!] This method does not load the data from the repository, it only converts the data to the EntityList instance
|
|
35
|
-
*
|
|
36
|
-
* @param items
|
|
37
|
-
* @param pagination
|
|
38
|
-
*/
|
|
39
|
-
fromList(items: Array<EntityType> | Array<ReturnType<EntityType['toJSON']>>, pagination?: A_SERVER_TYPES__A_EntityListPagination): void;
|
|
40
|
-
/**
|
|
41
|
-
* Serializes the EntityList to a JSON object
|
|
42
|
-
*
|
|
43
|
-
* @returns
|
|
44
|
-
*/
|
|
45
|
-
toJSON(): A_SERVER_TYPES__A_EntityListSerialized<EntityType>;
|
|
46
|
-
}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.A_EntityList = void 0;
|
|
4
|
-
const a_concept_1 = require("@adaas/a-concept");
|
|
5
|
-
/**
|
|
6
|
-
* A-EntityList
|
|
7
|
-
*
|
|
8
|
-
* Entity that represents a list of entities with pagination of particular type
|
|
9
|
-
*/
|
|
10
|
-
class A_EntityList extends a_concept_1.A_Entity {
|
|
11
|
-
constructor() {
|
|
12
|
-
super(...arguments);
|
|
13
|
-
this._items = [];
|
|
14
|
-
this._pagination = {
|
|
15
|
-
total: 0,
|
|
16
|
-
page: 1,
|
|
17
|
-
pageSize: 10
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
static get scope() {
|
|
21
|
-
return 'a-server';
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Returns the entity constructor used for the list
|
|
25
|
-
*/
|
|
26
|
-
get entityConstructor() {
|
|
27
|
-
return this._entityConstructor;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Returns the list of items contained in the entity list
|
|
31
|
-
*/
|
|
32
|
-
get items() {
|
|
33
|
-
return this._items;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Returns pagination information about the entity list
|
|
37
|
-
*/
|
|
38
|
-
get pagination() {
|
|
39
|
-
return this._pagination;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Creates a new instance of A_EntityList
|
|
43
|
-
*
|
|
44
|
-
* @param newEntity
|
|
45
|
-
*/
|
|
46
|
-
fromNew(newEntity) {
|
|
47
|
-
this.aseid = new a_concept_1.ASEID({
|
|
48
|
-
concept: a_concept_1.A_Context.root.name,
|
|
49
|
-
scope: 'default',
|
|
50
|
-
entity: 'a-list' + (newEntity.name ? `.${newEntity.name}` : ''),
|
|
51
|
-
id: (new Date()).getTime().toString(),
|
|
52
|
-
});
|
|
53
|
-
this._entityConstructor = newEntity.constructor;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Allows to convert Repository Response data to EntityList instance
|
|
57
|
-
*
|
|
58
|
-
* [!] This method does not load the data from the repository, it only converts the data to the EntityList instance
|
|
59
|
-
*
|
|
60
|
-
* @param items
|
|
61
|
-
* @param pagination
|
|
62
|
-
*/
|
|
63
|
-
fromList(items, pagination) {
|
|
64
|
-
this._items = items.map(item => {
|
|
65
|
-
if (item instanceof a_concept_1.A_Entity) {
|
|
66
|
-
return item;
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
const entity = new this._entityConstructor(item);
|
|
70
|
-
return entity;
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
if (pagination) {
|
|
74
|
-
this._pagination = {
|
|
75
|
-
total: pagination.total,
|
|
76
|
-
page: pagination.page,
|
|
77
|
-
pageSize: pagination.pageSize
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Serializes the EntityList to a JSON object
|
|
83
|
-
*
|
|
84
|
-
* @returns
|
|
85
|
-
*/
|
|
86
|
-
toJSON() {
|
|
87
|
-
return Object.assign(Object.assign({}, super.toJSON()), { items: this._items.map(i => i.toJSON()), pagination: this._pagination });
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
exports.A_EntityList = A_EntityList;
|
|
91
|
-
//# sourceMappingURL=A_EntityList.entity.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"A_EntityList.entity.js","sourceRoot":"","sources":["../../../../src/entities/A_EntityList/A_EntityList.entity.ts"],"names":[],"mappings":";;;AAAA,gDAG0B;AAS1B;;;;GAIG;AACH,MAAa,YAEX,SAAQ,oBAGT;IALD;;QAYc,WAAM,GAAsB,EAAE,CAAC;QAC/B,gBAAW,GAA2C;YAC5D,KAAK,EAAE,CAAC;YACR,IAAI,EAAE,CAAC;YACP,QAAQ,EAAE,EAAE;SACf,CAAC;IAyFN,CAAC;IAnGG,MAAM,KAAK,KAAK;QACZ,OAAO,UAAU,CAAC;IACtB,CAAC;IAWD;;OAEG;IACH,IAAI,iBAAiB;QACjB,OAAO,IAAI,CAAC,kBAAkB,CAAC;IACnC,CAAC;IAED;;OAEG;IACH,IAAI,KAAK;QACL,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,IAAI,UAAU;QACV,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IAKD;;;;OAIG;IACH,OAAO,CAAC,SAAkD;QACtD,IAAI,CAAC,KAAK,GAAG,IAAI,iBAAK,CAAC;YACnB,OAAO,EAAE,qBAAS,CAAC,IAAI,CAAC,IAAI;YAC5B,KAAK,EAAE,SAAS;YAChB,MAAM,EAAE,QAAQ,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC/D,EAAE,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;SACxC,CAAC,CAAC;QAEH,IAAI,CAAC,kBAAkB,GAAG,SAAS,CAAC,WAAiD,CAAC;IAC1F,CAAC;IAID;;;;;;;OAOG;IACH,QAAQ,CACJ,KAAkE,EAClE,UAAmD;QAEnD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YAC3B,IAAI,IAAI,YAAY,oBAAQ,EAAE,CAAC;gBAC3B,OAAO,IAAkB,CAAC;YAC9B,CAAC;iBAAM,CAAC;gBACJ,MAAM,MAAM,GAAG,IAAI,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;gBACjD,OAAO,MAAM,CAAC;YAClB,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,IAAI,UAAU,EAAE,CAAC;YACb,IAAI,CAAC,WAAW,GAAG;gBACf,KAAK,EAAE,UAAU,CAAC,KAAK;gBACvB,IAAI,EAAE,UAAU,CAAC,IAAI;gBACrB,QAAQ,EAAE,UAAU,CAAC,QAAQ;aAChC,CAAA;QACL,CAAC;IACL,CAAC;IAID;;;;OAIG;IACH,MAAM;QACF,uCACO,KAAK,CAAC,MAAM,EAAE,KACjB,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,CAAuC,EAC7E,UAAU,EAAE,IAAI,CAAC,WAAW,IAC/B;IACL,CAAC;CACJ;AA1GD,oCA0GC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { A_Entity, A_TYPES__Entity_Serialized } from "@adaas/a-concept";
|
|
2
|
-
export type A_SERVER_TYPES__A_EntityListConstructor = {
|
|
3
|
-
name: string;
|
|
4
|
-
scope: string;
|
|
5
|
-
constructor: {
|
|
6
|
-
new (...args: any[]): A_Entity;
|
|
7
|
-
};
|
|
8
|
-
};
|
|
9
|
-
export declare enum A_SERVER_TYPES__A_EntityListEvent {
|
|
10
|
-
Load = "load"
|
|
11
|
-
}
|
|
12
|
-
export type A_SERVER_TYPES__A_EntityListSerialized<EntityTypes extends A_Entity = A_Entity> = {
|
|
13
|
-
items: Array<ReturnType<EntityTypes['toJSON']>>;
|
|
14
|
-
type: string;
|
|
15
|
-
pagination: A_SERVER_TYPES__A_EntityListPagination;
|
|
16
|
-
} & A_TYPES__Entity_Serialized;
|
|
17
|
-
export type A_SERVER_TYPES__A_EntityListPagination = {
|
|
18
|
-
total: number;
|
|
19
|
-
page: number;
|
|
20
|
-
pageSize: number;
|
|
21
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.A_SERVER_TYPES__A_EntityListEvent = void 0;
|
|
4
|
-
var A_SERVER_TYPES__A_EntityListEvent;
|
|
5
|
-
(function (A_SERVER_TYPES__A_EntityListEvent) {
|
|
6
|
-
A_SERVER_TYPES__A_EntityListEvent["Load"] = "load";
|
|
7
|
-
})(A_SERVER_TYPES__A_EntityListEvent || (exports.A_SERVER_TYPES__A_EntityListEvent = A_SERVER_TYPES__A_EntityListEvent = {}));
|
|
8
|
-
//# sourceMappingURL=A_EntityList.entity.types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"A_EntityList.entity.types.js","sourceRoot":"","sources":["../../../../src/entities/A_EntityList/A_EntityList.entity.types.ts"],"names":[],"mappings":";;;AASA,IAAY,iCAEX;AAFD,WAAY,iCAAiC;IACzC,kDAAa,CAAA;AACjB,CAAC,EAFW,iCAAiC,iDAAjC,iCAAiC,QAE5C"}
|
package/index.ts
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
// ============================================================================
|
|
4
|
-
// ADAAS A-Server SDK - Complete Export Manifest
|
|
5
|
-
// ============================================================================
|
|
6
|
-
|
|
7
|
-
// ============================================================================
|
|
8
|
-
// Channels Export
|
|
9
|
-
// ============================================================================
|
|
10
|
-
export { A_HTTPChannel } from './src/channels/A-Http/A-Http.channel';
|
|
11
|
-
export { A_HTTPChannelError } from './src/channels/A-Http/A-Http.channel.error';
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
// ============================================================================
|
|
15
|
-
// Constants Export
|
|
16
|
-
// ============================================================================
|
|
17
|
-
export * from './src/constants/env.constants';
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
// ============================================================================
|
|
21
|
-
// Containers Export
|
|
22
|
-
// ============================================================================
|
|
23
|
-
export { A_Service } from './src/containers/A-Service/A-Service.container';
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
// ============================================================================
|
|
27
|
-
// Contexts Export
|
|
28
|
-
// ============================================================================
|
|
29
|
-
export { A_Server } from './src/context/A-Server/A_Server.context';
|
|
30
|
-
export { A_ProxyConfig } from './src/context/A-ProxyConfig/A_ProxyConfig.context';
|
|
31
|
-
export { A_StaticConfig } from './src/context/A-StaticConfig/A-StaticConfig.context';
|
|
32
|
-
export { A_ListQueryFilter } from './src/context/A-ListQueryFilter/A_ListQueryFilter.context';
|
|
33
|
-
export { A_EntityFactory } from './src/context/A-EntityFactory/A-EntityFactory.context';
|
|
34
|
-
export { A_HTTPChannel_RequestContext } from './src/context/A-HttpChannel/A-HttpChannel.context';
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
// ============================================================================
|
|
38
|
-
// Entities Export
|
|
39
|
-
// ============================================================================
|
|
40
|
-
export { A_Request } from './src/entities/A-Request/A-Request.entity';
|
|
41
|
-
export { A_Response } from './src/entities/A-Response/A-Response.entity';
|
|
42
|
-
export { A_Route } from './src/entities/A-Route/A-Route.entity';
|
|
43
|
-
export { A_EntityList } from './src/entities/A_EntityList/A_EntityList.entity';
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
// ============================================================================
|
|
47
|
-
// Components Export
|
|
48
|
-
// ============================================================================
|
|
49
|
-
export { A_ServerLogger } from './src/components/A-ServerLogger/A_ServerLogger.component';
|
|
50
|
-
export { A_EntityController } from './src/components/A-EntityController/A-EntityController.component';
|
|
51
|
-
export { A_Router } from './src/components/A-Router/A-Router.component';
|
|
52
|
-
export { A_ServerHealthMonitor } from './src/components/A-ServerHealthMonitor/A-ServerHealthMonitor.component';
|
|
53
|
-
export { A_ServerProxy } from './src/components/A-ServerProxy/A-ServerProxy.component';
|
|
54
|
-
export { A_ServerCORS } from './src/components/A-ServerCORS/A_ServerCORS.component';
|
|
55
|
-
export { A_StaticLoader } from './src/components/A-StaticLoader/A-StaticLoader.component';
|
|
56
|
-
export { A_Controller } from './src/components/A-Controller/A-Controller.component';
|
|
57
|
-
export { A_ListingController } from './src/components/A-ListingController/A-ListingController.component';
|
|
58
|
-
export { A_CommandController } from './src/components/A-CommandController/A-CommandController.component';
|
|
59
|
-
export { A_EntityRepository } from './src/components/A-EntityRepository/A-EntityRepository.component';
|
|
60
|
-
export { A_ServerError } from './src/components/A-ServerError/A-ServerError.class';
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
// ============================================================================
|
|
64
|
-
// Types Export
|
|
65
|
-
// ============================================================================
|
|
66
|
-
export * from './src/containers/A-Service/A-Service.container.types';
|
|
67
|
-
export * from './src/context/A-ProxyConfig/A_ProxyConfig.types';
|
|
68
|
-
export * from './src/context/A-EntityFactory/A-EntityFactory.context.types';
|
|
69
|
-
export * from './src/entities/A-Request/A-Request.entity.types';
|
|
70
|
-
export * from './src/entities/A-Response/A-Response.entity.types';
|
|
71
|
-
export * from './src/components/A-ServerCORS/A_ServerCORS.component.types';
|
|
72
|
-
export * from './src/components/A-Router/A-Router.component.types';
|
|
73
|
-
export * from './src/components/A-ServerError/A-ServerError.types';
|
|
74
|
-
export * from './src/channels/A-Http/A-Http.channel.types';
|
|
75
|
-
export * from './src/channels/A-Http/A-Http.channel.constants';
|