@pristine-ts/core 0.0.403 → 0.0.404
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/lib/cjs/core.module.js.map +1 -1
- package/dist/lib/cjs/dispatchers/event.dispatcher.js.map +1 -1
- package/dist/lib/cjs/enums/execution-context-keyname.enum.js.map +1 -1
- package/dist/lib/cjs/errors/error-response-interception-execution.error.js.map +1 -1
- package/dist/lib/cjs/errors/event-dispatcher-no-event-handlers.error.js.map +1 -1
- package/dist/lib/cjs/errors/event-dispatching.error.js.map +1 -1
- package/dist/lib/cjs/errors/event-interception-execution.error.js.map +1 -1
- package/dist/lib/cjs/errors/event-mapping.error.js.map +1 -1
- package/dist/lib/cjs/errors/event-post-mapping-interception.error.js.map +1 -1
- package/dist/lib/cjs/errors/event-post-response-mapping-interception.error.js.map +1 -1
- package/dist/lib/cjs/errors/event-pre-mapping-interception.error.js.map +1 -1
- package/dist/lib/cjs/errors/event-pre-response-mapping-interception.error.js.map +1 -1
- package/dist/lib/cjs/errors/kernel-initialization.error.js.map +1 -1
- package/dist/lib/cjs/errors/path-already-contains-filename.error.js.map +1 -1
- package/dist/lib/cjs/errors/provider-registration.error.js.map +1 -1
- package/dist/lib/cjs/errors/runtime.error.js.map +1 -1
- package/dist/lib/cjs/handlers/default-event.handler.js.map +1 -1
- package/dist/lib/cjs/interceptors/event-logging.interceptor.js.map +1 -1
- package/dist/lib/cjs/kernel.js +31 -31
- package/dist/lib/cjs/kernel.js.map +1 -1
- package/dist/lib/cjs/listeners/default-event.listener.js.map +1 -1
- package/dist/lib/cjs/managers/path.manager.js.map +1 -1
- package/dist/lib/cjs/mappers/default-event.mapper.js.map +1 -1
- package/dist/lib/cjs/models/event.js.map +1 -1
- package/dist/lib/cjs/models/event.response.js.map +1 -1
- package/dist/lib/cjs/pipelines/event.pipeline.js +119 -119
- package/dist/lib/cjs/pipelines/event.pipeline.js.map +1 -1
- package/dist/lib/esm/core.module.js.map +1 -1
- package/dist/lib/esm/dispatchers/event.dispatcher.js +1 -1
- package/dist/lib/esm/dispatchers/event.dispatcher.js.map +1 -1
- package/dist/lib/esm/enums/execution-context-keyname.enum.js.map +1 -1
- package/dist/lib/esm/errors/error-response-interception-execution.error.js.map +1 -1
- package/dist/lib/esm/errors/event-dispatcher-no-event-handlers.error.js.map +1 -1
- package/dist/lib/esm/errors/event-dispatching.error.js.map +1 -1
- package/dist/lib/esm/errors/event-interception-execution.error.js.map +1 -1
- package/dist/lib/esm/errors/event-mapping.error.js.map +1 -1
- package/dist/lib/esm/errors/event-post-mapping-interception.error.js.map +1 -1
- package/dist/lib/esm/errors/event-post-response-mapping-interception.error.js.map +1 -1
- package/dist/lib/esm/errors/event-pre-mapping-interception.error.js.map +1 -1
- package/dist/lib/esm/errors/event-pre-response-mapping-interception.error.js.map +1 -1
- package/dist/lib/esm/errors/kernel-initialization.error.js.map +1 -1
- package/dist/lib/esm/errors/path-already-contains-filename.error.js.map +1 -1
- package/dist/lib/esm/errors/provider-registration.error.js.map +1 -1
- package/dist/lib/esm/errors/runtime.error.js.map +1 -1
- package/dist/lib/esm/handlers/default-event.handler.js.map +1 -1
- package/dist/lib/esm/interceptors/event-logging.interceptor.js +1 -1
- package/dist/lib/esm/interceptors/event-logging.interceptor.js.map +1 -1
- package/dist/lib/esm/kernel.js +31 -31
- package/dist/lib/esm/kernel.js.map +1 -1
- package/dist/lib/esm/listeners/default-event.listener.js.map +1 -1
- package/dist/lib/esm/managers/path.manager.js.map +1 -1
- package/dist/lib/esm/mappers/default-event.mapper.js.map +1 -1
- package/dist/lib/esm/models/event.js.map +1 -1
- package/dist/lib/esm/models/event.response.js.map +1 -1
- package/dist/lib/esm/pipelines/event.pipeline.js +120 -120
- package/dist/lib/esm/pipelines/event.pipeline.js.map +1 -1
- package/dist/types/errors/error-response-interception-execution.error.d.ts +1 -2
- package/dist/types/kernel.d.ts +11 -11
- package/dist/types/pipelines/event.pipeline.d.ts +7 -7
- package/package.json +7 -7
|
@@ -19,7 +19,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
19
19
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
20
|
});
|
|
21
21
|
};
|
|
22
|
-
import { injectable, injectAll
|
|
22
|
+
import { inject, injectable, injectAll } from "tsyringe";
|
|
23
23
|
import { Event } from "../models/event";
|
|
24
24
|
import { ServiceDefinitionTagEnum } from "@pristine-ts/common";
|
|
25
25
|
import { EventMappingError } from "../errors/event-mapping.error";
|
|
@@ -38,6 +38,125 @@ let EventPipeline = class EventPipeline {
|
|
|
38
38
|
this.tracingManager = tracingManager;
|
|
39
39
|
this.breadcrumbHandler = breadcrumbHandler;
|
|
40
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
*
|
|
43
|
+
* @param event
|
|
44
|
+
* @param executionContext
|
|
45
|
+
* @param container
|
|
46
|
+
*/
|
|
47
|
+
execute(event, executionContext, container) {
|
|
48
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
const eventExecutions = [];
|
|
50
|
+
// If the event passed is already properly typed, we simply execute it, without mapping and without calling the pre-mapping interceptors
|
|
51
|
+
if (event instanceof Event) {
|
|
52
|
+
eventExecutions.push({
|
|
53
|
+
events: [event],
|
|
54
|
+
executionOrder: "sequential",
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
// 1- We have the raw event, we start by executing the PreMapping Interceptors
|
|
59
|
+
const interceptedEvent = yield this.preMappingIntercept(event, executionContext);
|
|
60
|
+
// 2- With the intercepted raw event, run the Events Mapping to get all the Events and the EventsExecutionOptions.
|
|
61
|
+
// For each event mapper that supports the event, we batch the executions for each mapper. So it's possible to execute the same
|
|
62
|
+
// event twice. This is up to the EventMappers to properly identify when they map or don't map an event. Pristine
|
|
63
|
+
// isn't responsible to determine if two events are executed twice, so be careful.
|
|
64
|
+
let numberOfEventMappers = 0;
|
|
65
|
+
try {
|
|
66
|
+
const span = this.tracingManager.startSpan(SpanKeynameEnum.EventMapping);
|
|
67
|
+
this.eventMappers.forEach(eventMapper => {
|
|
68
|
+
if (eventMapper.supportsMapping(interceptedEvent, executionContext)) {
|
|
69
|
+
eventExecutions.push(eventMapper.map(interceptedEvent, executionContext));
|
|
70
|
+
numberOfEventMappers++;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
span.end();
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
throw new EventMappingError("There was an error mapping the event into an Event object", event, interceptedEvent, executionContext, error);
|
|
77
|
+
}
|
|
78
|
+
if (numberOfEventMappers === 0) {
|
|
79
|
+
throw new EventMappingError("There are no Event Mappers that support the event", event, interceptedEvent, executionContext);
|
|
80
|
+
}
|
|
81
|
+
if (eventExecutions.length === 0 || eventExecutions.reduce((agg, eventExecution) => {
|
|
82
|
+
return agg + eventExecution.events.length;
|
|
83
|
+
}, 0) === 0) {
|
|
84
|
+
throw new EventMappingError("There are no events to execute.", event, interceptedEvent, executionContext);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
const eventsExecutionPromises = [];
|
|
88
|
+
// 3- Loop over the EventExecutionOptions array and start executing the events
|
|
89
|
+
eventExecutions.forEach(eventExecutionOptions => {
|
|
90
|
+
switch (eventExecutionOptions.executionOrder) {
|
|
91
|
+
case 'sequential':
|
|
92
|
+
eventsExecutionPromises.push(new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
93
|
+
// await all events and then resolve.
|
|
94
|
+
const eventResponses = [];
|
|
95
|
+
for (const event of eventExecutionOptions.events) {
|
|
96
|
+
let span = this.tracingManager.startSpan(SpanKeynameEnum.ChildContainerCreation);
|
|
97
|
+
const childContainer = container.createChildContainer();
|
|
98
|
+
span.end();
|
|
99
|
+
// It's important to register the CurrentChildContainer since even though it's not 100% recommended,
|
|
100
|
+
// some handlers might want to retrieve the container. For example, the RequestHandler needs this mechanism
|
|
101
|
+
// to dynamically load the controllers and not load all the containers all the time.
|
|
102
|
+
span = this.tracingManager.startSpan(SpanKeynameEnum.ChildContainerRegistration);
|
|
103
|
+
childContainer.register(ServiceDefinitionTagEnum.CurrentChildContainer, {
|
|
104
|
+
useValue: childContainer,
|
|
105
|
+
});
|
|
106
|
+
span.end();
|
|
107
|
+
span = this.tracingManager.startSpan(SpanKeynameEnum.EventDispatcherResolver);
|
|
108
|
+
const eventDispatcher = childContainer.resolve("EventDispatcherInterface");
|
|
109
|
+
span.end();
|
|
110
|
+
try {
|
|
111
|
+
eventResponses.push(yield this.executeEvent(event, eventDispatcher));
|
|
112
|
+
}
|
|
113
|
+
catch (error) {
|
|
114
|
+
return reject(error);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return resolve(eventResponses);
|
|
118
|
+
})));
|
|
119
|
+
break;
|
|
120
|
+
case 'parallel':
|
|
121
|
+
for (const event of eventExecutionOptions.events) {
|
|
122
|
+
eventsExecutionPromises.push(new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
123
|
+
let span = this.tracingManager.startSpan(SpanKeynameEnum.ChildContainerCreation);
|
|
124
|
+
const childContainer = container.createChildContainer();
|
|
125
|
+
span.end();
|
|
126
|
+
// It's important to register the CurrentChildContainer since even though it's not 100% recommended,
|
|
127
|
+
// some handlers might want to retrieve the container. For example, the RequestHandler needs this mechanism
|
|
128
|
+
// to dynamically load the controllers and not load all the containers all the time.
|
|
129
|
+
span = this.tracingManager.startSpan(SpanKeynameEnum.ChildContainerRegistration);
|
|
130
|
+
childContainer.register(ServiceDefinitionTagEnum.CurrentChildContainer, {
|
|
131
|
+
useValue: childContainer,
|
|
132
|
+
});
|
|
133
|
+
span.end();
|
|
134
|
+
span = this.tracingManager.startSpan(SpanKeynameEnum.EventDispatcherResolver);
|
|
135
|
+
const eventDispatcher = childContainer.resolve("EventDispatcherInterface");
|
|
136
|
+
span.end();
|
|
137
|
+
this.executeEvent(event, eventDispatcher).then(eventResponse => resolve(eventResponse)).catch(error => reject(error));
|
|
138
|
+
})));
|
|
139
|
+
}
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
// 4- For each event, call the PreResponseMapping Interceptors
|
|
144
|
+
const eventResponses = yield Promise.all((yield Promise.all(eventsExecutionPromises)).flat().map((eventResponse) => __awaiter(this, void 0, void 0, function* () { return yield this.preResponseMappingIntercept(eventResponse); })));
|
|
145
|
+
let finalResponse = {};
|
|
146
|
+
// 5 - Construct the final response by calling the events mapper (reverse map method) for each eventResponse;
|
|
147
|
+
// This method updates the response object that will be returned from the kernel.
|
|
148
|
+
eventResponses.forEach(eventResponse => {
|
|
149
|
+
this.eventMappers.forEach(eventMapper => {
|
|
150
|
+
if (eventMapper.supportsReverseMapping(eventResponse, finalResponse, executionContext)) {
|
|
151
|
+
finalResponse = eventMapper.reverseMap(eventResponse, finalResponse, executionContext);
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
// 6 - Call the PostResponseMapping interceptors and return the final intercepted response.
|
|
156
|
+
const postResponseMappingInterceptedResponse = yield this.postResponseMappingIntercept(finalResponse);
|
|
157
|
+
return postResponseMappingInterceptedResponse;
|
|
158
|
+
});
|
|
159
|
+
}
|
|
41
160
|
/**
|
|
42
161
|
* This method calls the interceptors that are to be executed just before the EventMappers are executed. It allows
|
|
43
162
|
* for changing the raw event coming directly into the kernel.
|
|
@@ -175,125 +294,6 @@ let EventPipeline = class EventPipeline {
|
|
|
175
294
|
}
|
|
176
295
|
});
|
|
177
296
|
}
|
|
178
|
-
/**
|
|
179
|
-
*
|
|
180
|
-
* @param event
|
|
181
|
-
* @param executionContext
|
|
182
|
-
* @param container
|
|
183
|
-
*/
|
|
184
|
-
execute(event, executionContext, container) {
|
|
185
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
186
|
-
const eventExecutions = [];
|
|
187
|
-
// If the event passed is already properly typed, we simply execute it, without mapping and without calling the pre-mapping interceptors
|
|
188
|
-
if (event instanceof Event) {
|
|
189
|
-
eventExecutions.push({
|
|
190
|
-
events: [event],
|
|
191
|
-
executionOrder: "sequential",
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
else {
|
|
195
|
-
// 1- We have the raw event, we start by executing the PreMapping Interceptors
|
|
196
|
-
const interceptedEvent = yield this.preMappingIntercept(event, executionContext);
|
|
197
|
-
// 2- With the intercepted raw event, run the Events Mapping to get all the Events and the EventsExecutionOptions.
|
|
198
|
-
// For each event mapper that supports the event, we batch the executions for each mapper. So it's possible to execute the same
|
|
199
|
-
// event twice. This is up to the EventMappers to properly identify when they map or don't map an event. Pristine
|
|
200
|
-
// isn't responsible to determine if two events are executed twice, so be careful.
|
|
201
|
-
let numberOfEventMappers = 0;
|
|
202
|
-
try {
|
|
203
|
-
const span = this.tracingManager.startSpan(SpanKeynameEnum.EventMapping);
|
|
204
|
-
this.eventMappers.forEach(eventMapper => {
|
|
205
|
-
if (eventMapper.supportsMapping(interceptedEvent, executionContext)) {
|
|
206
|
-
eventExecutions.push(eventMapper.map(interceptedEvent, executionContext));
|
|
207
|
-
numberOfEventMappers++;
|
|
208
|
-
}
|
|
209
|
-
});
|
|
210
|
-
span.end();
|
|
211
|
-
}
|
|
212
|
-
catch (error) {
|
|
213
|
-
throw new EventMappingError("There was an error mapping the event into an Event object", event, interceptedEvent, executionContext, error);
|
|
214
|
-
}
|
|
215
|
-
if (numberOfEventMappers === 0) {
|
|
216
|
-
throw new EventMappingError("There are no Event Mappers that support the event", event, interceptedEvent, executionContext);
|
|
217
|
-
}
|
|
218
|
-
if (eventExecutions.length === 0 || eventExecutions.reduce((agg, eventExecution) => {
|
|
219
|
-
return agg + eventExecution.events.length;
|
|
220
|
-
}, 0) === 0) {
|
|
221
|
-
throw new EventMappingError("There are no events to execute.", event, interceptedEvent, executionContext);
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
const eventsExecutionPromises = [];
|
|
225
|
-
// 3- Loop over the EventExecutionOptions array and start executing the events
|
|
226
|
-
eventExecutions.forEach(eventExecutionOptions => {
|
|
227
|
-
switch (eventExecutionOptions.executionOrder) {
|
|
228
|
-
case 'sequential':
|
|
229
|
-
eventsExecutionPromises.push(new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
230
|
-
// await all events and then resolve.
|
|
231
|
-
const eventResponses = [];
|
|
232
|
-
for (const event of eventExecutionOptions.events) {
|
|
233
|
-
let span = this.tracingManager.startSpan(SpanKeynameEnum.ChildContainerCreation);
|
|
234
|
-
const childContainer = container.createChildContainer();
|
|
235
|
-
span.end();
|
|
236
|
-
// It's important to register the CurrentChildContainer since even though it's not 100% recommended,
|
|
237
|
-
// some handlers might want to retrieve the container. For example, the RequestHandler needs this mechanism
|
|
238
|
-
// to dynamically load the controllers and not load all the containers all the time.
|
|
239
|
-
span = this.tracingManager.startSpan(SpanKeynameEnum.ChildContainerRegistration);
|
|
240
|
-
childContainer.register(ServiceDefinitionTagEnum.CurrentChildContainer, {
|
|
241
|
-
useValue: childContainer,
|
|
242
|
-
});
|
|
243
|
-
span.end();
|
|
244
|
-
span = this.tracingManager.startSpan(SpanKeynameEnum.EventDispatcherResolver);
|
|
245
|
-
const eventDispatcher = childContainer.resolve("EventDispatcherInterface");
|
|
246
|
-
span.end();
|
|
247
|
-
try {
|
|
248
|
-
eventResponses.push(yield this.executeEvent(event, eventDispatcher));
|
|
249
|
-
}
|
|
250
|
-
catch (error) {
|
|
251
|
-
return reject(error);
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
return resolve(eventResponses);
|
|
255
|
-
})));
|
|
256
|
-
break;
|
|
257
|
-
case 'parallel':
|
|
258
|
-
for (const event of eventExecutionOptions.events) {
|
|
259
|
-
eventsExecutionPromises.push(new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
260
|
-
let span = this.tracingManager.startSpan(SpanKeynameEnum.ChildContainerCreation);
|
|
261
|
-
const childContainer = container.createChildContainer();
|
|
262
|
-
span.end();
|
|
263
|
-
// It's important to register the CurrentChildContainer since even though it's not 100% recommended,
|
|
264
|
-
// some handlers might want to retrieve the container. For example, the RequestHandler needs this mechanism
|
|
265
|
-
// to dynamically load the controllers and not load all the containers all the time.
|
|
266
|
-
span = this.tracingManager.startSpan(SpanKeynameEnum.ChildContainerRegistration);
|
|
267
|
-
childContainer.register(ServiceDefinitionTagEnum.CurrentChildContainer, {
|
|
268
|
-
useValue: childContainer,
|
|
269
|
-
});
|
|
270
|
-
span.end();
|
|
271
|
-
span = this.tracingManager.startSpan(SpanKeynameEnum.EventDispatcherResolver);
|
|
272
|
-
const eventDispatcher = childContainer.resolve("EventDispatcherInterface");
|
|
273
|
-
span.end();
|
|
274
|
-
this.executeEvent(event, eventDispatcher).then(eventResponse => resolve(eventResponse)).catch(error => reject(error));
|
|
275
|
-
})));
|
|
276
|
-
}
|
|
277
|
-
break;
|
|
278
|
-
}
|
|
279
|
-
});
|
|
280
|
-
// 4- For each event, call the PreResponseMapping Interceptors
|
|
281
|
-
const eventResponses = yield Promise.all((yield Promise.all(eventsExecutionPromises)).flat().map((eventResponse) => __awaiter(this, void 0, void 0, function* () { return yield this.preResponseMappingIntercept(eventResponse); })));
|
|
282
|
-
let finalResponse = {};
|
|
283
|
-
// 5 - Construct the final response by calling the events mapper (reverse map method) for each eventResponse;
|
|
284
|
-
// This method updates the response object that will be returned from the kernel.
|
|
285
|
-
eventResponses.forEach(eventResponse => {
|
|
286
|
-
this.eventMappers.forEach(eventMapper => {
|
|
287
|
-
if (eventMapper.supportsReverseMapping(eventResponse, finalResponse, executionContext)) {
|
|
288
|
-
finalResponse = eventMapper.reverseMap(eventResponse, finalResponse, executionContext);
|
|
289
|
-
}
|
|
290
|
-
});
|
|
291
|
-
});
|
|
292
|
-
// 6 - Call the PostResponseMapping interceptors and return the final intercepted response.
|
|
293
|
-
const postResponseMappingInterceptedResponse = yield this.postResponseMappingIntercept(finalResponse);
|
|
294
|
-
return postResponseMappingInterceptedResponse;
|
|
295
|
-
});
|
|
296
|
-
}
|
|
297
297
|
};
|
|
298
298
|
EventPipeline = __decorate([
|
|
299
299
|
injectable(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event.pipeline.js","sourceRoot":"","sources":["../../../../src/pipelines/event.pipeline.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"event.pipeline.js","sourceRoot":"","sources":["../../../../src/pipelines/event.pipeline.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAsB,MAAM,EAAE,UAAU,EAAE,SAAS,EAAC,MAAM,UAAU,CAAC;AAI5E,OAAO,EAAC,KAAK,EAAC,MAAM,iBAAiB,CAAC;AAKtC,OAAO,EAAC,wBAAwB,EAAC,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAC,iBAAiB,EAAC,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAC,gCAAgC,EAAC,MAAM,gDAAgD,CAAC;AAChG,OAAO,EAAC,iCAAiC,EAAC,MAAM,iDAAiD,CAAC;AAClG,OAAO,EAAC,qBAAqB,EAAC,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAC,wCAAwC,EAAC,MAAM,yDAAyD,CAAC;AACjH,OAAO,EAAC,yCAAyC,EAAC,MAAM,0DAA0D,CAAC;AACnH,OAAO,EAAC,eAAe,EAA0B,MAAM,wBAAwB,CAAC;AAChF,OAAO,EAAC,iBAAiB,EAAC,MAAM,wBAAwB,CAAC;AAGlD,IAAM,aAAa,GAAnB,MAAM,aAAa;IAExB,YACyE,iBAA8C,EACnD,YAA8C,EAChE,UAA+B,EAC3B,cAAuC,EACpC,iBAA6C;QAJ7B,sBAAiB,GAAjB,iBAAiB,CAA6B;QACnD,iBAAY,GAAZ,YAAY,CAAkC;QAChE,eAAU,GAAV,UAAU,CAAqB;QAC3B,mBAAc,GAAd,cAAc,CAAyB;QACpC,sBAAiB,GAAjB,iBAAiB,CAA4B;IAEtG,CAAC;IAED;;;;;OAK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AAgB,CAAC,CAAC;YAClI,CAAC;QACH,CAAC;KAAA;CACF,CAAA;AApSY,aAAa;IADzB,UAAU,EAAE;IAIR,WAAA,SAAS,CAAC,wBAAwB,CAAC,gBAAgB,CAAC,CAAA;IACpD,WAAA,SAAS,CAAC,wBAAwB,CAAC,WAAW,CAAC,CAAA;IAC/C,WAAA,MAAM,CAAC,qBAAqB,CAAC,CAAA;IAC7B,WAAA,MAAM,CAAC,yBAAyB,CAAC,CAAA;IACjC,WAAA,MAAM,CAAC,4BAA4B,CAAC,CAAA;;GAP5B,aAAa,CAoSzB"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { LoggableError } from "@pristine-ts/common";
|
|
2
|
-
import { Request } from "@pristine-ts/common";
|
|
1
|
+
import { LoggableError, Request } from "@pristine-ts/common";
|
|
3
2
|
/**
|
|
4
3
|
* This Error is thrown when an error happens in the execution of an error response interceptor.
|
|
5
4
|
*/
|
package/dist/types/kernel.d.ts
CHANGED
|
@@ -12,6 +12,11 @@ export declare class Kernel {
|
|
|
12
12
|
* Contains a reference to the root Dependency Injection Container.
|
|
13
13
|
*/
|
|
14
14
|
container: DependencyContainer;
|
|
15
|
+
/**
|
|
16
|
+
* Contains the unique instantiation identifier of this specific kernel instance.
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
instantiationId: string;
|
|
15
20
|
/**
|
|
16
21
|
* Contains a map of all the modules that were instantiated indexed by the modules names.
|
|
17
22
|
* @private
|
|
@@ -27,11 +32,6 @@ export declare class Kernel {
|
|
|
27
32
|
* @private
|
|
28
33
|
*/
|
|
29
34
|
private initializationSpan?;
|
|
30
|
-
/**
|
|
31
|
-
* Contains the unique instantiation identifier of this specific kernel instance.
|
|
32
|
-
* @public
|
|
33
|
-
*/
|
|
34
|
-
instantiationId: string;
|
|
35
35
|
/**
|
|
36
36
|
* This function is the entry point of the Kernel. It initializes the module for your application (AppModule) as well as its the dependencies,
|
|
37
37
|
* it registers the services, registers the configurations and runs the afterInit for each module.
|
|
@@ -41,6 +41,12 @@ export declare class Kernel {
|
|
|
41
41
|
start(module: AppModuleInterface, moduleConfigurationValues?: {
|
|
42
42
|
[key: string]: ModuleConfigurationValue;
|
|
43
43
|
}): Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
*
|
|
46
|
+
* @param event
|
|
47
|
+
* @param executionContext
|
|
48
|
+
*/
|
|
49
|
+
handle<T>(event: any | Request | Event<any>, executionContext: ExecutionContextInterface<T>): Promise<object>;
|
|
44
50
|
/**
|
|
45
51
|
* Registers the provider registration in the container.
|
|
46
52
|
* @param providerRegistration
|
|
@@ -85,10 +91,4 @@ export declare class Kernel {
|
|
|
85
91
|
* @private
|
|
86
92
|
*/
|
|
87
93
|
private registerNonModuleScopedServiceTags;
|
|
88
|
-
/**
|
|
89
|
-
*
|
|
90
|
-
* @param event
|
|
91
|
-
* @param executionContext
|
|
92
|
-
*/
|
|
93
|
-
handle<T>(event: any | Request | Event<any>, executionContext: ExecutionContextInterface<T>): Promise<object>;
|
|
94
94
|
}
|
|
@@ -11,6 +11,13 @@ export declare class EventPipeline {
|
|
|
11
11
|
private readonly tracingManager;
|
|
12
12
|
private readonly breadcrumbHandler;
|
|
13
13
|
constructor(eventInterceptors: EventInterceptorInterface[], eventMappers: EventMapperInterface<any, any>[], logHandler: LogHandlerInterface, tracingManager: TracingManagerInterface, breadcrumbHandler: BreadcrumbHandlerInterface);
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
* @param event
|
|
17
|
+
* @param executionContext
|
|
18
|
+
* @param container
|
|
19
|
+
*/
|
|
20
|
+
execute(event: object, executionContext: ExecutionContextInterface<any>, container: DependencyContainer): Promise<any>;
|
|
14
21
|
/**
|
|
15
22
|
* This method calls the interceptors that are to be executed just before the EventMappers are executed. It allows
|
|
16
23
|
* for changing the raw event coming directly into the kernel.
|
|
@@ -52,11 +59,4 @@ export declare class EventPipeline {
|
|
|
52
59
|
* @private
|
|
53
60
|
*/
|
|
54
61
|
private executeEvent;
|
|
55
|
-
/**
|
|
56
|
-
*
|
|
57
|
-
* @param event
|
|
58
|
-
* @param executionContext
|
|
59
|
-
* @param container
|
|
60
|
-
*/
|
|
61
|
-
execute(event: object, executionContext: ExecutionContextInterface<any>, container: DependencyContainer): Promise<any>;
|
|
62
62
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pristine-ts/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.404",
|
|
4
4
|
"description": "",
|
|
5
5
|
"module": "dist/lib/esm/core.module.js",
|
|
6
6
|
"main": "dist/lib/cjs/core.module.js",
|
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
"access": "public"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@pristine-ts/common": "^0.0.
|
|
24
|
-
"@pristine-ts/configuration": "^0.0.
|
|
25
|
-
"@pristine-ts/logging": "^0.0.
|
|
26
|
-
"@pristine-ts/security": "^0.0.
|
|
27
|
-
"@pristine-ts/telemetry": "^0.0.
|
|
23
|
+
"@pristine-ts/common": "^0.0.404",
|
|
24
|
+
"@pristine-ts/configuration": "^0.0.404",
|
|
25
|
+
"@pristine-ts/logging": "^0.0.404",
|
|
26
|
+
"@pristine-ts/security": "^0.0.404",
|
|
27
|
+
"@pristine-ts/telemetry": "^0.0.404",
|
|
28
28
|
"uuid": "^9.0.1"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"src/*.{js,ts}"
|
|
65
65
|
]
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "9abf20c5f2fd4b22b1295f6465ec0b7d19c1724e"
|
|
68
68
|
}
|