@adaas/a-server 0.0.29 → 0.0.31

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 (84) hide show
  1. package/dist/browser/index.d.mts +123 -69
  2. package/dist/browser/index.mjs +211 -69
  3. package/dist/browser/index.mjs.map +1 -1
  4. package/dist/node/controllers/A-EntityController/A-EntityController.component.d.mts +2 -5
  5. package/dist/node/controllers/A-EntityController/A-EntityController.component.d.ts +2 -5
  6. package/dist/node/controllers/A-EntityController/A-EntityController.component.js +66 -88
  7. package/dist/node/controllers/A-EntityController/A-EntityController.component.js.map +1 -1
  8. package/dist/node/controllers/A-EntityController/A-EntityController.component.mjs +67 -89
  9. package/dist/node/controllers/A-EntityController/A-EntityController.component.mjs.map +1 -1
  10. package/dist/node/controllers/A-ListingController/A-ListingController.component.js +20 -18
  11. package/dist/node/controllers/A-ListingController/A-ListingController.component.js.map +1 -1
  12. package/dist/node/controllers/A-ListingController/A-ListingController.component.mjs +20 -18
  13. package/dist/node/controllers/A-ListingController/A-ListingController.component.mjs.map +1 -1
  14. package/dist/node/controllers/A-ServerHealthMonitor/A-ServerHealthMonitor.component.d.mts +0 -2
  15. package/dist/node/controllers/A-ServerHealthMonitor/A-ServerHealthMonitor.component.d.ts +0 -2
  16. package/dist/node/controllers/A-ServerHealthMonitor/A-ServerHealthMonitor.component.js +10 -1
  17. package/dist/node/controllers/A-ServerHealthMonitor/A-ServerHealthMonitor.component.js.map +1 -1
  18. package/dist/node/controllers/A-ServerHealthMonitor/A-ServerHealthMonitor.component.mjs +10 -1
  19. package/dist/node/controllers/A-ServerHealthMonitor/A-ServerHealthMonitor.component.mjs.map +1 -1
  20. package/dist/node/index.d.mts +3 -1
  21. package/dist/node/index.d.ts +3 -1
  22. package/dist/node/index.js +14 -0
  23. package/dist/node/index.mjs +2 -0
  24. package/dist/node/lib/A-Server/A-HttpServer.container.d.mts +4 -6
  25. package/dist/node/lib/A-Server/A-HttpServer.container.d.ts +4 -6
  26. package/dist/node/lib/A-ServerController/A-ServerController.component.js +17 -4
  27. package/dist/node/lib/A-ServerController/A-ServerController.component.js.map +1 -1
  28. package/dist/node/lib/A-ServerController/A-ServerController.component.mjs +17 -4
  29. package/dist/node/lib/A-ServerController/A-ServerController.component.mjs.map +1 -1
  30. package/dist/node/lib/A-ServerEntityList/A-EntityList.entity.d.mts +52 -28
  31. package/dist/node/lib/A-ServerEntityList/A-EntityList.entity.d.ts +52 -28
  32. package/dist/node/lib/A-ServerEntityList/A-EntityList.entity.js +117 -44
  33. package/dist/node/lib/A-ServerEntityList/A-EntityList.entity.js.map +1 -1
  34. package/dist/node/lib/A-ServerEntityList/A-EntityList.entity.mjs +118 -45
  35. package/dist/node/lib/A-ServerEntityList/A-EntityList.entity.mjs.map +1 -1
  36. package/dist/node/lib/A-ServerEntityList/A-EntityList.types.d.mts +14 -6
  37. package/dist/node/lib/A-ServerEntityList/A-EntityList.types.d.ts +14 -6
  38. package/dist/node/lib/A-ServerEntityList/A-EntityList.types.js.map +1 -1
  39. package/dist/node/lib/A-ServerEntityList/A-EntityList.types.mjs.map +1 -1
  40. package/dist/node/lib/A-ServerEntityList/A-EntityListCacheState.context.d.mts +12 -0
  41. package/dist/node/lib/A-ServerEntityList/A-EntityListCacheState.context.d.ts +12 -0
  42. package/dist/node/lib/A-ServerEntityList/A-EntityListCacheState.context.js +25 -0
  43. package/dist/node/lib/A-ServerEntityList/A-EntityListCacheState.context.js.map +1 -0
  44. package/dist/node/lib/A-ServerEntityList/A-EntityListCacheState.context.mjs +24 -0
  45. package/dist/node/lib/A-ServerEntityList/A-EntityListCacheState.context.mjs.map +1 -0
  46. package/dist/node/lib/A-ServerEntityList/A-EntityListPagination.context.d.mts +18 -0
  47. package/dist/node/lib/A-ServerEntityList/A-EntityListPagination.context.d.ts +18 -0
  48. package/dist/node/lib/A-ServerEntityList/A-EntityListPagination.context.js +48 -0
  49. package/dist/node/lib/A-ServerEntityList/A-EntityListPagination.context.js.map +1 -0
  50. package/dist/node/lib/A-ServerEntityList/A-EntityListPagination.context.mjs +47 -0
  51. package/dist/node/lib/A-ServerEntityList/A-EntityListPagination.context.mjs.map +1 -0
  52. package/dist/node/lib/A-ServerLogger/A-ServerLogger.component.d.mts +6 -8
  53. package/dist/node/lib/A-ServerLogger/A-ServerLogger.component.d.ts +6 -8
  54. package/dist/node/lib/A-ServerLogger/A-ServerLogger.component.js +3 -4
  55. package/dist/node/lib/A-ServerLogger/A-ServerLogger.component.js.map +1 -1
  56. package/dist/node/lib/A-ServerLogger/A-ServerLogger.component.mjs +4 -5
  57. package/dist/node/lib/A-ServerLogger/A-ServerLogger.component.mjs.map +1 -1
  58. package/dist/node/lib/A-ServerRouter/A-ServerRouter.component.d.mts +0 -2
  59. package/dist/node/lib/A-ServerRouter/A-ServerRouter.component.d.ts +0 -2
  60. package/dist/node/middlewares/A-ServerCORS/A_ServerCORS.component.js +1 -1
  61. package/dist/node/middlewares/A-ServerCORS/A_ServerCORS.component.js.map +1 -1
  62. package/dist/node/middlewares/A-ServerCORS/A_ServerCORS.component.mjs +1 -1
  63. package/dist/node/middlewares/A-ServerCORS/A_ServerCORS.component.mjs.map +1 -1
  64. package/dist/node/repositories/A-EntityRepository/A-EntityRepository.component.d.mts +1 -0
  65. package/dist/node/repositories/A-EntityRepository/A-EntityRepository.component.d.ts +1 -0
  66. package/examples/simple-server/components/Users.repository.ts +2 -2
  67. package/jest.config.ts +1 -0
  68. package/package.json +5 -5
  69. package/src/controllers/A-EntityController/A-EntityController.component.ts +69 -109
  70. package/src/controllers/A-ListingController/A-ListingController.component.ts +22 -20
  71. package/src/controllers/A-ServerHealthMonitor/A-ServerHealthMonitor.component.ts +11 -1
  72. package/src/index.ts +2 -0
  73. package/src/lib/A-ServerController/A-ServerController.component.ts +17 -8
  74. package/src/lib/A-ServerEntityList/A-EntityList.entity.ts +159 -55
  75. package/src/lib/A-ServerEntityList/A-EntityList.types.ts +17 -7
  76. package/src/lib/A-ServerEntityList/A-EntityListCacheState.context.ts +27 -0
  77. package/src/lib/A-ServerEntityList/A-EntityListPagination.context.ts +48 -0
  78. package/src/lib/A-ServerLogger/A-ServerLogger.component.ts +3 -4
  79. package/src/middlewares/A-ServerCORS/A_ServerCORS.component.ts +1 -1
  80. package/tests/A-Server-CORS.test.ts +542 -0
  81. package/tests/A-Server-Entity.test.ts +205 -0
  82. package/tests/A-Server-Health.test.ts +89 -0
  83. package/tests/A-Server-Routes.test.ts +113 -0
  84. package/tests/A-ServerEntityList.test.ts +416 -0
@@ -1,5 +1,6 @@
1
1
  import {
2
- A_Context, A_Entity,
2
+ A_Context, A_Entity, A_Scope,
3
+ A_TYPES__Entity_Constructor,
3
4
  ASEID,
4
5
  } from "@adaas/a-concept";
5
6
  import {
@@ -7,118 +8,221 @@ import {
7
8
  A_SERVER_TYPES__A_EntityListPagination,
8
9
  A_SERVER_TYPES__A_EntityListSerialized
9
10
  } from "./A-EntityList.types";
11
+ import { A_ServerEntityListPagination } from "./A-EntityListPagination.context";
12
+ import { A_ServerEntityListCacheState } from "./A-EntityListCacheState.context";
10
13
 
11
14
 
12
15
 
13
16
  /**
14
17
  * A-EntityList
15
- *
16
- * Entity that represents a list of entities with pagination of particular type
18
+ *
19
+ * Typed, paginated list of A-Concept entities.
20
+ *
21
+ * Construction (user-facing):
22
+ * new A_ServerEntityList<User>({ entity: User, pagination: { page: 1, pageSize: 20 } })
23
+ *
24
+ * Construction (controller-internal, backward-compat):
25
+ * new A_ServerEntityList({ name: 'user', scope: 'my-scope', constructor: User })
17
26
  */
18
27
  export class A_ServerEntityList<
19
28
  EntityType extends A_Entity = A_Entity,
20
29
  > extends A_Entity<
21
- A_SERVER_TYPES__A_EntityListConstructor,
22
- A_SERVER_TYPES__A_EntityListSerialized
30
+ A_SERVER_TYPES__A_EntityListConstructor<EntityType>,
31
+ A_SERVER_TYPES__A_EntityListSerialized<EntityType>
23
32
  > {
24
33
 
25
34
  static get scope(): string {
26
35
  return 'a-server';
27
36
  }
28
37
 
29
- protected _entityConstructor!: new (...args: ConstructorParameters<typeof A_Entity>) => EntityType;
38
+ protected _entityConstructor!: A_TYPES__Entity_Constructor<EntityType>;
39
+
40
+ /**
41
+ * Ordered item references for O(1) positional access.
42
+ * The list's own scope is the authoritative store (enables @A_Inject and
43
+ * feature chains on items); this array mirrors the same items in order.
44
+ */
30
45
  protected _items: Array<EntityType> = [];
31
- protected _pagination: A_SERVER_TYPES__A_EntityListPagination = {
32
- total: 0,
33
- page: 1,
34
- pageSize: 10
35
- };
36
46
 
47
+ /** Lazily allocated private scope — pagination and cache state live here. */
48
+ private _ownScope?: A_Scope;
49
+
50
+
51
+ // ── Getters ──────────────────────────────────────────────────────────────
37
52
 
38
53
  /**
39
- * Returns the entity constructor used for the list
54
+ * The list's own scope, created on first access and bound to this entity
55
+ * via A_Context.allocate. Items, pagination and cache state are registered
56
+ * here so they participate in feature chains and @A_Inject resolution.
40
57
  */
41
- get entityConstructor(): new (...args: ConstructorParameters<typeof A_Entity>) => EntityType {
58
+ get ownScope(): A_Scope {
59
+ if (!this._ownScope) {
60
+ this._ownScope = A_Context.allocate(
61
+ this,
62
+ new A_Scope({ name: `${this.aseid.id}-scope` })
63
+ );
64
+ }
65
+ return this._ownScope;
66
+ }
67
+
68
+ get entityConstructor(): A_TYPES__Entity_Constructor<EntityType> {
42
69
  return this._entityConstructor;
43
70
  }
44
71
 
45
- /**
46
- * Returns the list of items contained in the entity list
47
- */
48
72
  get items(): Array<EntityType> {
49
73
  return this._items;
50
74
  }
51
75
 
52
- /**
53
- * Returns pagination information about the entity list
54
- */
55
- get pagination(): A_SERVER_TYPES__A_EntityListPagination {
56
- return this._pagination;
76
+ /** Pagination state — lives as a Fragment in the list's own scope. */
77
+ get pagination(): A_ServerEntityListPagination {
78
+ return this.ownScope.resolveFlatOnce(A_ServerEntityListPagination)!;
79
+ }
80
+
81
+ private get cacheState(): A_ServerEntityListCacheState {
82
+ return this.ownScope.resolveFlatOnce(A_ServerEntityListCacheState)!;
57
83
  }
58
84
 
85
+ /** Total number of items currently held in memory. */
86
+ get length(): number {
87
+ return this._items.length;
88
+ }
59
89
 
60
90
 
91
+ // ── Initialisation ───────────────────────────────────────────────────────
61
92
 
62
- /**
63
- * Creates a new instance of A_EntityList
64
- *
65
- * @param newEntity
66
- */
67
- fromNew(newEntity: A_SERVER_TYPES__A_EntityListConstructor): void {
68
- this.aseid = new ASEID({
93
+ fromNew(newEntity: A_SERVER_TYPES__A_EntityListConstructor<EntityType>): void {
94
+ this.aseid = this.generateASEID({
69
95
  concept: A_Context.root.name,
70
- scope: 'default',
71
- entity: 'a-list' + (newEntity.name ? `.${newEntity.name}` : ''),
72
- id: (new Date()).getTime().toString(),
96
+ entity: 'a-list.' + newEntity.entity.name,
73
97
  });
74
98
 
75
- this._entityConstructor = newEntity.constructor as new (...args: any[]) => EntityType;
76
- }
99
+ this._entityConstructor = newEntity.entity;
77
100
 
101
+ // Initialise state Fragments in the list's own scope
102
+ this.ownScope.register(new A_ServerEntityListPagination(newEntity.pagination));
103
+ this.ownScope.register(new A_ServerEntityListCacheState());
104
+ }
78
105
 
79
106
 
80
107
  /**
81
- * Allows to convert Repository Response data to EntityList instance
82
- *
83
- * [!] This method does not load the data from the repository, it only converts the data to the EntityList instance
84
- *
85
- * @param items
86
- * @param pagination
108
+ * Populate the list from raw repository data.
109
+ * Items are registered in the list's own scope so they participate in
110
+ * feature chains and @A_Inject resolution.
87
111
  */
88
112
  fromList(
89
113
  items: Array<EntityType> | Array<ReturnType<EntityType['toJSON']>>,
90
114
  pagination?: A_SERVER_TYPES__A_EntityListPagination
91
115
  ) {
116
+ // Deregister previous items from own scope
117
+ this._items.forEach(item => {
118
+ try { this.ownScope.deregister(item); } catch { /* already gone */ }
119
+ });
120
+
92
121
  this._items = items.map(item => {
93
- if (item instanceof A_Entity) {
94
- return item as EntityType;
95
- } else {
96
- const entity = new this._entityConstructor(item);
97
- return entity;
98
- }
122
+ const entity = item instanceof A_Entity
123
+ ? item as EntityType
124
+ : new this._entityConstructor(item as any);
125
+ this.ownScope.register(entity);
126
+ return entity;
99
127
  });
100
128
 
101
129
  if (pagination) {
102
- this._pagination = {
103
- total: pagination.total,
104
- page: pagination.page,
105
- pageSize: pagination.pageSize
106
- }
130
+ this.pagination.update(pagination);
131
+ }
132
+ }
133
+
134
+
135
+ // ── Collection access ────────────────────────────────────────────────────
136
+
137
+ /** Return the item at `index`, or `undefined` if out of range. */
138
+ at(index: number): EntityType | undefined {
139
+ return this._items[index];
140
+ }
141
+
142
+ /** Replace the item at `index` in place. Accepts a live entity or a plain serialised object. */
143
+ replace(index: number, item: EntityType | ReturnType<EntityType['toJSON']>): this {
144
+ const next = item instanceof A_Entity
145
+ ? item as EntityType
146
+ : new this._entityConstructor(item as any);
147
+ try { this.ownScope.deregister(this._items[index]); } catch { /* ok */ }
148
+ this.ownScope.register(next);
149
+ this._items[index] = next;
150
+ return this;
151
+ }
152
+
153
+ /** Append an item to the end of the list. */
154
+ push(item: EntityType | ReturnType<EntityType['toJSON']>): this {
155
+ const next = item instanceof A_Entity
156
+ ? item as EntityType
157
+ : new this._entityConstructor(item as any);
158
+ this.ownScope.register(next);
159
+ this._items.push(next);
160
+ return this;
161
+ }
162
+
163
+ /** Prepend an item to the beginning of the list. */
164
+ unshift(item: EntityType | ReturnType<EntityType['toJSON']>): this {
165
+ const next = item instanceof A_Entity
166
+ ? item as EntityType
167
+ : new this._entityConstructor(item as any);
168
+ this.ownScope.register(next);
169
+ this._items.unshift(next);
170
+ return this;
171
+ }
172
+
173
+ /** Remove the item at `index` from the list. */
174
+ remove(index: number): this {
175
+ const [removed] = this._items.splice(index, 1);
176
+ if (removed) {
177
+ try { this.ownScope.deregister(removed); } catch { /* ok */ }
107
178
  }
179
+ return this;
108
180
  }
109
181
 
182
+ /** Return the first item that satisfies `predicate`, or `undefined`. */
183
+ find(predicate: (item: EntityType, index: number) => boolean): EntityType | undefined {
184
+ return this._items.find(predicate);
185
+ }
110
186
 
187
+ /** Return all items that satisfy `predicate` without mutating the list. */
188
+ filter(predicate: (item: EntityType, index: number) => boolean): EntityType[] {
189
+ return this._items.filter(predicate);
190
+ }
191
+
192
+
193
+ // ── Caching ──────────────────────────────────────────────────────────────
111
194
 
112
195
  /**
113
- * Serializes the EntityList to a JSON object
114
- *
115
- * @returns
196
+ * Mark this list as cached for `ttlMs` milliseconds from now.
197
+ * Callers can check `isCached()` to decide whether to skip `load()`.
116
198
  */
199
+ setCache(ttlMs: number): this {
200
+ this.cacheState.set(ttlMs);
201
+ return this;
202
+ }
203
+
204
+ /** Returns `true` if the cache is still valid. */
205
+ isCached(): boolean {
206
+ return this.cacheState.isValid();
207
+ }
208
+
209
+ /** Invalidate the cache so the next `load()` call fetches fresh data. */
210
+ invalidateCache(): this {
211
+ this.cacheState.invalidate();
212
+ return this;
213
+ }
214
+
215
+
216
+ // ── Serialisation ────────────────────────────────────────────────────────
217
+
117
218
  toJSON(): A_SERVER_TYPES__A_EntityListSerialized<EntityType> {
219
+ const { total, page, pageSize } = this.pagination;
118
220
  return {
119
221
  ...super.toJSON(),
120
222
  items: this._items.map(i => i.toJSON()) as ReturnType<EntityType['toJSON']>[],
121
- pagination: this._pagination
122
- }
223
+ type: (this._entityConstructor as any).entity ?? 'unknown',
224
+ pagination: { total, page, pageSize },
225
+ };
123
226
  }
124
227
  }
228
+
@@ -1,11 +1,17 @@
1
1
  import { A_Entity, A_TYPES__Entity_Constructor, A_TYPES__Entity_Serialized } from "@adaas/a-concept";
2
2
 
3
3
 
4
- export type A_SERVER_TYPES__A_EntityListConstructor = {
5
- name: string,
6
- scope: string,
7
- constructor: A_TYPES__Entity_Constructor,
8
- }
4
+ export type A_SERVER_TYPES__A_EntityListConstructor<
5
+ T extends A_Entity = A_Entity
6
+ > = {
7
+ /** User-facing: the entity class (e.g. `User`). Name and scope are derived from its statics. */
8
+ entity: A_TYPES__Entity_Constructor<T>;
9
+ /** Initial pagination request parameters. Defaults to page 1, pageSize 10. */
10
+ pagination?: {
11
+ page?: number;
12
+ pageSize?: number;
13
+ };
14
+ };
9
15
 
10
16
  export enum A_SERVER_TYPES__A_EntityListEvent {
11
17
  Load = 'load',
@@ -18,10 +24,14 @@ export type A_SERVER_TYPES__A_EntityListSerialized<EntityTypes extends A_Entity
18
24
  } & A_TYPES__Entity_Serialized;
19
25
 
20
26
 
21
-
22
27
  export type A_SERVER_TYPES__A_EntityListPagination = {
23
28
  total: number,
24
29
  page: number,
25
30
  pageSize: number,
26
- }
31
+ };
32
+
33
+ export type A_SERVER_TYPES__A_EntityListCacheEntry = {
34
+ timestamp: number;
35
+ ttl: number;
36
+ };
27
37
 
@@ -0,0 +1,27 @@
1
+ import { A_Fragment, A_TYPES__Fragment_Serialized } from "@adaas/a-concept";
2
+
3
+
4
+ export class A_ServerEntityListCacheState extends A_Fragment<A_TYPES__Fragment_Serialized> {
5
+
6
+ protected _timestamp?: number;
7
+ protected _ttl?: number;
8
+
9
+ set(ttlMs: number): void {
10
+ this._timestamp = Date.now();
11
+ this._ttl = ttlMs;
12
+ }
13
+
14
+ invalidate(): void {
15
+ this._timestamp = undefined;
16
+ this._ttl = undefined;
17
+ }
18
+
19
+ isValid(): boolean {
20
+ if (this._timestamp === undefined || this._ttl === undefined) return false;
21
+ return (Date.now() - this._timestamp) < this._ttl;
22
+ }
23
+
24
+ toJSON(): A_TYPES__Fragment_Serialized {
25
+ return { name: this.name };
26
+ }
27
+ }
@@ -0,0 +1,48 @@
1
+ import { A_Fragment, A_TYPES__Fragment_Serialized } from "@adaas/a-concept";
2
+ import { A_SERVER_TYPES__A_EntityListPagination } from "./A-EntityList.types";
3
+
4
+
5
+ export type A_SERVER_TYPES__A_EntityListPaginationSerialized =
6
+ A_SERVER_TYPES__A_EntityListPagination & A_TYPES__Fragment_Serialized;
7
+
8
+
9
+ export class A_ServerEntityListPagination extends A_Fragment<A_SERVER_TYPES__A_EntityListPaginationSerialized> {
10
+
11
+ protected _total: number = 0;
12
+ protected _page: number = 1;
13
+ protected _pageSize: number = 10;
14
+
15
+ constructor(init?: Partial<A_SERVER_TYPES__A_EntityListPagination>) {
16
+ super();
17
+ if (init) {
18
+ if (init.total !== undefined) this._total = init.total;
19
+ if (init.page !== undefined) this._page = init.page;
20
+ if (init.pageSize !== undefined) this._pageSize = init.pageSize;
21
+ }
22
+ }
23
+
24
+ get total(): number { return this._total; }
25
+ get page(): number { return this._page; }
26
+ get pageSize(): number { return this._pageSize; }
27
+
28
+ update(data: Partial<A_SERVER_TYPES__A_EntityListPagination>): void {
29
+ if (data.total !== undefined) this._total = data.total;
30
+ if (data.page !== undefined) this._page = data.page;
31
+ if (data.pageSize !== undefined) this._pageSize = data.pageSize;
32
+ }
33
+
34
+ fromJSON(serialized: A_SERVER_TYPES__A_EntityListPaginationSerialized): void {
35
+ this._total = serialized.total;
36
+ this._page = serialized.page;
37
+ this._pageSize = serialized.pageSize;
38
+ }
39
+
40
+ toJSON(): A_SERVER_TYPES__A_EntityListPaginationSerialized {
41
+ return {
42
+ name: this.name,
43
+ total: this._total,
44
+ page: this._page,
45
+ pageSize: this._pageSize,
46
+ };
47
+ }
48
+ }
@@ -1,5 +1,4 @@
1
- import { A_Error, A_Feature, A_Inject, } from "@adaas/a-concept";
2
- import { A_Server } from "@adaas/a-server/server/A-Server.context";
1
+ import { A_Error, A_Feature, A_Inject, A_Scope, } from "@adaas/a-concept";
3
2
  import { A_Request } from "@adaas/a-server/request/A-Request.entity";
4
3
  import { A_Response } from "@adaas/a-server/response/A-Response.entity";
5
4
  import { A_ResponseFeatures } from "@adaas/a-server/response/A-Response.constants";
@@ -69,9 +68,9 @@ export class A_ServerLogger extends A_Logger {
69
68
  scope: [A_Service]
70
69
  })
71
70
  logStop(
72
- @A_Inject(A_Server) server: A_Server,
71
+ @A_Inject(A_Scope) scope: A_Scope,
73
72
  ) {
74
- this.log('red', `Server ${server.name} stopped`);
73
+ this.info('red', `Server ${scope.name} stopped`);
75
74
  }
76
75
 
77
76
 
@@ -32,7 +32,7 @@ export class A_ServerCORS extends A_ServerMiddleware {
32
32
  }
33
33
 
34
34
 
35
- @A_HttpServer.onAfterRequest
35
+ @A_HttpServer.onBeforeRequest
36
36
  public apply(
37
37
  @A_Inject(A_Request) aReq: A_Request,
38
38
  @A_Inject(A_Response) aRes: A_Response,