@aeriajs/server 0.0.270 → 0.0.271

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/init.js CHANGED
@@ -71,6 +71,9 @@ const init = (_options = {}) => {
71
71
  return {
72
72
  options,
73
73
  listen: async () => {
74
+ if (!options.config.server) {
75
+ throw new Error;
76
+ }
74
77
  const parentContext = await (0, core_1.createContext)({
75
78
  config: options.config,
76
79
  });
@@ -94,10 +97,6 @@ const init = (_options = {}) => {
94
97
  parentContext,
95
98
  token,
96
99
  });
97
- Object.assign(context, {
98
- request,
99
- response,
100
- });
101
100
  if (options.callback) {
102
101
  const result = await options.callback(context);
103
102
  if (result !== undefined) {
@@ -105,12 +104,12 @@ const init = (_options = {}) => {
105
104
  }
106
105
  }
107
106
  if (options.router) {
108
- const result = await options.router.install(context);
107
+ const result = await options.router.handle(request, response, context);
109
108
  if (result !== undefined) {
110
109
  return result;
111
110
  }
112
111
  }
113
- return apiRouter.install(context);
112
+ return apiRouter.handle(request, response, context);
114
113
  });
115
114
  });
116
115
  if (!options.config.database?.noDatabase) {
package/dist/init.mjs CHANGED
@@ -65,6 +65,9 @@ export const init = (_options = {}) => {
65
65
  return {
66
66
  options,
67
67
  listen: async () => {
68
+ if (!options.config.server) {
69
+ throw new Error();
70
+ }
68
71
  const parentContext = await createContext({
69
72
  config: options.config
70
73
  });
@@ -88,10 +91,6 @@ export const init = (_options = {}) => {
88
91
  parentContext,
89
92
  token
90
93
  });
91
- Object.assign(context, {
92
- request,
93
- response
94
- });
95
94
  if (options.callback) {
96
95
  const result = await options.callback(context);
97
96
  if (result !== void 0) {
@@ -99,12 +98,12 @@ export const init = (_options = {}) => {
99
98
  }
100
99
  }
101
100
  if (options.router) {
102
- const result = await options.router.install(context);
101
+ const result = await options.router.handle(request, response, context);
103
102
  if (result !== void 0) {
104
103
  return result;
105
104
  }
106
105
  }
107
- return apiRouter.install(context);
106
+ return apiRouter.handle(request, response, context);
108
107
  });
109
108
  });
110
109
  if (!options.config.database?.noDatabase) {
package/dist/routes.d.ts CHANGED
@@ -15,8 +15,8 @@ export declare const registerRoutes: () => import("@aeriajs/http").ProxiedRouter
15
15
  routes: ((_: unknown, context: RouteContext, groupOptions?: import("@aeriajs/http").RouteGroupOptions) => unknown)[];
16
16
  routesMeta: import("@aeriajs/http").RoutesMeta;
17
17
  group: <TRouter extends {
18
- install: (context: RouteContext, options?: import("@aeriajs/http").RouterOptions) => unknown;
18
+ handle: (request: import("@aeriajs/types").GenericRequest, response: import("@aeriajs/types").GenericResponse, context: RouteContext, options?: import("@aeriajs/http").RouterOptions) => unknown;
19
19
  routesMeta: import("@aeriajs/http").RoutesMeta;
20
20
  }>(exp: import("@aeriajs/types").RouteUri, router: TRouter, middleware?: (context: RouteContext) => unknown) => void;
21
- install: (_context: RouteContext, _options?: import("@aeriajs/http").RouterOptions) => Promise<unknown>;
21
+ handle: (request: import("@aeriajs/types").GenericRequest, response: import("@aeriajs/types").GenericResponse, context: RouteContext, options?: import("@aeriajs/http").RouterOptions) => Promise<unknown>;
22
22
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aeriajs/server",
3
- "version": "0.0.270",
3
+ "version": "0.0.271",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -33,13 +33,13 @@
33
33
  "mongodb": "^6.17.0"
34
34
  },
35
35
  "peerDependencies": {
36
- "@aeriajs/core": "^0.0.268",
37
- "@aeriajs/builtins": "^0.0.268",
36
+ "@aeriajs/core": "^0.0.269",
37
+ "@aeriajs/builtins": "^0.0.269",
38
38
  "@aeriajs/common": "^0.0.151",
39
39
  "@aeriajs/entrypoint": "^0.0.157",
40
- "@aeriajs/http": "^0.0.184",
41
- "@aeriajs/node-http": "^0.0.184",
42
- "@aeriajs/server": "^0.0.270",
40
+ "@aeriajs/http": "^0.0.185",
41
+ "@aeriajs/node-http": "^0.0.185",
42
+ "@aeriajs/server": "^0.0.271",
43
43
  "@aeriajs/types": "^0.0.129",
44
44
  "mongodb": "^6.17.0"
45
45
  },