@lerianstudio/sindarian-server 1.0.0-beta.1 → 1.0.0-beta.2
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/README.md +367 -0
- package/dist/constants/index.d.ts +1 -0
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/constants/index.js +1 -0
- package/dist/constants/index.js.map +1 -1
- package/dist/constants/keys.d.ts +4 -0
- package/dist/constants/keys.d.ts.map +1 -1
- package/dist/constants/keys.js +5 -1
- package/dist/constants/keys.js.map +1 -1
- package/dist/constants/scopes.d.ts +6 -0
- package/dist/constants/scopes.d.ts.map +1 -0
- package/dist/constants/scopes.js +10 -0
- package/dist/constants/scopes.js.map +1 -0
- package/dist/context/arguments-host.d.ts +14 -0
- package/dist/context/arguments-host.d.ts.map +1 -0
- package/dist/context/arguments-host.js +28 -0
- package/dist/context/arguments-host.js.map +1 -0
- package/dist/context/execution-context.d.ts +10 -0
- package/dist/context/execution-context.d.ts.map +1 -0
- package/dist/context/execution-context.js +19 -0
- package/dist/context/execution-context.js.map +1 -0
- package/dist/context/http-arguments-host.d.ts +8 -0
- package/dist/context/http-arguments-host.d.ts.map +1 -0
- package/dist/context/http-arguments-host.js +17 -0
- package/dist/context/http-arguments-host.js.map +1 -0
- package/dist/context/index.d.ts +4 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/context/index.js +20 -0
- package/dist/context/index.js.map +1 -0
- package/dist/controllers/base-controller.d.ts +0 -2
- package/dist/controllers/base-controller.d.ts.map +1 -1
- package/dist/controllers/base-controller.js +0 -15
- package/dist/controllers/base-controller.js.map +1 -1
- package/dist/controllers/decorators/body-decorator.d.ts +2 -3
- package/dist/controllers/decorators/body-decorator.d.ts.map +1 -1
- package/dist/controllers/decorators/body-decorator.js +31 -13
- package/dist/controllers/decorators/body-decorator.js.map +1 -1
- package/dist/controllers/decorators/controller-decorator.d.ts +0 -4
- package/dist/controllers/decorators/controller-decorator.d.ts.map +1 -1
- package/dist/controllers/decorators/controller-decorator.js +1 -44
- package/dist/controllers/decorators/controller-decorator.js.map +1 -1
- package/dist/dependency-injection/container.js +1 -1
- package/dist/dependency-injection/container.js.map +1 -1
- package/dist/dependency-injection/index.d.ts +2 -1
- package/dist/dependency-injection/index.d.ts.map +1 -1
- package/dist/dependency-injection/index.js +3 -2
- package/dist/dependency-injection/index.js.map +1 -1
- package/dist/dependency-injection/injectable-decorator.d.ts +7 -0
- package/dist/dependency-injection/injectable-decorator.d.ts.map +1 -0
- package/dist/dependency-injection/injectable-decorator.js +21 -0
- package/dist/dependency-injection/injectable-decorator.js.map +1 -0
- package/dist/exceptions/base-exception-filter.d.ts +8 -0
- package/dist/exceptions/base-exception-filter.d.ts.map +1 -0
- package/dist/exceptions/base-exception-filter.js +14 -0
- package/dist/exceptions/base-exception-filter.js.map +1 -0
- package/dist/exceptions/decorators/catch-decorator.d.ts +8 -0
- package/dist/exceptions/decorators/catch-decorator.d.ts.map +1 -0
- package/dist/exceptions/decorators/catch-decorator.js +14 -0
- package/dist/exceptions/decorators/catch-decorator.js.map +1 -0
- package/dist/exceptions/decorators/index.d.ts +3 -0
- package/dist/exceptions/decorators/index.d.ts.map +1 -0
- package/dist/exceptions/decorators/index.js +8 -0
- package/dist/exceptions/decorators/index.js.map +1 -0
- package/dist/exceptions/decorators/use-filters-decorator.d.ts +4 -0
- package/dist/exceptions/decorators/use-filters-decorator.d.ts.map +1 -0
- package/dist/exceptions/decorators/use-filters-decorator.js +16 -0
- package/dist/exceptions/decorators/use-filters-decorator.js.map +1 -0
- package/dist/exceptions/exception-filter.d.ts +6 -0
- package/dist/exceptions/exception-filter.d.ts.map +1 -0
- package/dist/exceptions/exception-filter.js +7 -0
- package/dist/exceptions/exception-filter.js.map +1 -0
- package/dist/exceptions/index.d.ts +3 -0
- package/dist/exceptions/index.d.ts.map +1 -1
- package/dist/exceptions/index.js +3 -0
- package/dist/exceptions/index.js.map +1 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -1
- package/dist/index.js.map +1 -1
- package/dist/interceptor/call-handler.d.ts +4 -0
- package/dist/interceptor/call-handler.d.ts.map +1 -0
- package/dist/interceptor/call-handler.js +3 -0
- package/dist/interceptor/call-handler.js.map +1 -0
- package/dist/interceptor/decorators/index.d.ts +2 -0
- package/dist/interceptor/decorators/index.d.ts.map +1 -0
- package/dist/interceptor/decorators/index.js +6 -0
- package/dist/interceptor/decorators/index.js.map +1 -0
- package/dist/interceptor/decorators/use-interceptor-decorator.d.ts +8 -0
- package/dist/interceptor/decorators/use-interceptor-decorator.d.ts.map +1 -0
- package/dist/interceptor/decorators/use-interceptor-decorator.js +38 -0
- package/dist/interceptor/decorators/use-interceptor-decorator.js.map +1 -0
- package/dist/interceptor/index.d.ts +4 -0
- package/dist/interceptor/index.d.ts.map +1 -0
- package/dist/interceptor/index.js +20 -0
- package/dist/interceptor/index.js.map +1 -0
- package/dist/interceptor/interceptor.d.ts +3 -5
- package/dist/interceptor/interceptor.d.ts.map +1 -1
- package/dist/interceptor/interceptor.js.map +1 -1
- package/dist/logger/console-logger.d.ts +24 -0
- package/dist/logger/console-logger.d.ts.map +1 -0
- package/dist/logger/console-logger.js +78 -0
- package/dist/logger/console-logger.js.map +1 -0
- package/dist/logger/index.d.ts +4 -0
- package/dist/logger/index.d.ts.map +1 -0
- package/dist/logger/index.js +8 -0
- package/dist/logger/index.js.map +1 -0
- package/dist/logger/logger-service.d.ts +34 -0
- package/dist/logger/logger-service.d.ts.map +1 -0
- package/dist/logger/logger-service.js +12 -0
- package/dist/logger/logger-service.js.map +1 -0
- package/dist/logger/logger.d.ts +21 -0
- package/dist/logger/logger.d.ts.map +1 -0
- package/dist/logger/logger.js +86 -0
- package/dist/logger/logger.js.map +1 -0
- package/dist/modules/module-decorator.d.ts +3 -1
- package/dist/modules/module-decorator.d.ts.map +1 -1
- package/dist/modules/module-decorator.js +83 -23
- package/dist/modules/module-decorator.js.map +1 -1
- package/dist/server/server-factory.d.ts +15 -8
- package/dist/server/server-factory.d.ts.map +1 -1
- package/dist/server/server-factory.js +95 -49
- package/dist/server/server-factory.js.map +1 -1
- package/dist/services/filters.d.ts +2 -0
- package/dist/services/filters.d.ts.map +1 -0
- package/dist/services/filters.js +5 -0
- package/dist/services/filters.js.map +1 -0
- package/dist/services/http-service.d.ts +68 -0
- package/dist/services/http-service.d.ts.map +1 -0
- package/dist/services/http-service.js +233 -0
- package/dist/services/http-service.js.map +1 -0
- package/dist/services/interceptor.d.ts +2 -0
- package/dist/services/interceptor.d.ts.map +1 -0
- package/dist/services/interceptor.js +5 -0
- package/dist/services/interceptor.js.map +1 -0
- package/dist/utils/form-data/get-form-data.d.ts +2 -0
- package/dist/utils/form-data/get-form-data.d.ts.map +1 -0
- package/dist/utils/form-data/get-form-data.js +11 -0
- package/dist/utils/form-data/get-form-data.js.map +1 -0
- package/dist/utils/search/create-query-string.d.ts +9 -0
- package/dist/utils/search/create-query-string.d.ts.map +1 -0
- package/dist/utils/search/create-query-string.js +26 -0
- package/dist/utils/search/create-query-string.js.map +1 -0
- package/package.json +2 -5
- package/dist/interceptor/decorators/use-interceptor.d.ts +0 -3
- package/dist/interceptor/decorators/use-interceptor.d.ts.map +0 -1
- package/dist/interceptor/decorators/use-interceptor.js +0 -9
- package/dist/interceptor/decorators/use-interceptor.js.map +0 -1
|
@@ -1,19 +1,29 @@
|
|
|
1
1
|
import { Container } from '../dependency-injection/container';
|
|
2
|
+
import { ExceptionFilter } from '../exceptions/exception-filter';
|
|
3
|
+
import { Interceptor } from '../interceptor/interceptor';
|
|
2
4
|
import { ModuleMetadata } from '../modules/module-decorator';
|
|
3
5
|
import { Class } from '../types/class';
|
|
4
6
|
import { NextRequest } from 'next/server';
|
|
7
|
+
import { LoggerService } from '../logger/logger-service';
|
|
8
|
+
export type ServerFactoryOptions = {
|
|
9
|
+
logger?: LoggerService | boolean;
|
|
10
|
+
};
|
|
5
11
|
export declare class ServerFactory {
|
|
6
12
|
private globalPrefix;
|
|
13
|
+
private globalFilters;
|
|
14
|
+
private globalInterceptors;
|
|
7
15
|
private readonly module;
|
|
8
16
|
private readonly container;
|
|
9
17
|
private readonly routes;
|
|
10
18
|
constructor(module: Class, container: Container, routes: ModuleMetadata[]);
|
|
11
|
-
static create(module: Class): ServerFactory;
|
|
19
|
+
static create(module: Class, options?: ServerFactoryOptions): ServerFactory;
|
|
12
20
|
/**
|
|
13
21
|
* Set the global prefix for the server
|
|
14
22
|
* @param prefix - The global prefix to set
|
|
15
23
|
*/
|
|
16
24
|
setGlobalPrefix(prefix: string): void;
|
|
25
|
+
useGlobalFilters(...filters: ExceptionFilter[]): void;
|
|
26
|
+
useGlobalInterceptors(...interceptors: Interceptor[]): void;
|
|
17
27
|
/**
|
|
18
28
|
* Handle a request
|
|
19
29
|
* @param request - The request to handle
|
|
@@ -23,6 +33,7 @@ export declare class ServerFactory {
|
|
|
23
33
|
handler(request: NextRequest, { params }: {
|
|
24
34
|
params: Promise<any>;
|
|
25
35
|
}): Promise<any>;
|
|
36
|
+
private static _registerLogger;
|
|
26
37
|
/**
|
|
27
38
|
* Parse the request
|
|
28
39
|
* @param request - The request to parse
|
|
@@ -36,12 +47,8 @@ export declare class ServerFactory {
|
|
|
36
47
|
* @returns The route
|
|
37
48
|
*/
|
|
38
49
|
private _fetchRoute;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
* @param routePattern - The route pattern with :param syntax
|
|
43
|
-
* @returns The extracted parameters
|
|
44
|
-
*/
|
|
45
|
-
private _extractParams;
|
|
50
|
+
private _fetchInterceptors;
|
|
51
|
+
private _fetchHandler;
|
|
52
|
+
private _fetchExceptionFilters;
|
|
46
53
|
}
|
|
47
54
|
//# sourceMappingURL=server-factory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-factory.d.ts","sourceRoot":"","sources":["../../src/server/server-factory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"server-factory.d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9B;;;;OAIG;IACH,OAAO,CAAC,aAAa;IAUrB;;;;;OAKG;IACH,OAAO,CAAC,WAAW;YAiBL,kBAAkB;IAgChC,OAAO,CAAC,aAAa;YAiBP,sBAAsB;CAmBrC"}
|
|
@@ -1,21 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ServerFactory = void 0;
|
|
4
|
+
const arguments_host_1 = require("../context/arguments-host");
|
|
5
|
+
const execution_context_1 = require("../context/execution-context");
|
|
4
6
|
const keys_1 = require("../constants/keys");
|
|
5
7
|
const container_1 = require("../dependency-injection/container");
|
|
8
|
+
const base_exception_filter_1 = require("../exceptions/base-exception-filter");
|
|
9
|
+
const catch_decorator_1 = require("../exceptions/decorators/catch-decorator");
|
|
10
|
+
const use_filters_decorator_1 = require("../exceptions/decorators/use-filters-decorator");
|
|
11
|
+
const use_interceptor_decorator_1 = require("../interceptor/decorators/use-interceptor-decorator");
|
|
6
12
|
const module_decorator_1 = require("../modules/module-decorator");
|
|
13
|
+
const filters_1 = require("../services/filters");
|
|
14
|
+
const interceptor_1 = require("../services/interceptor");
|
|
7
15
|
const request_1 = require("../services/request");
|
|
8
16
|
const url_match_1 = require("../utils/url/url-match");
|
|
9
17
|
const server_1 = require("next/server");
|
|
18
|
+
const logger_1 = require("../logger/logger");
|
|
19
|
+
const api_exception_1 = require("../exceptions/api-exception");
|
|
20
|
+
const lodash_1 = require("lodash");
|
|
10
21
|
class ServerFactory {
|
|
11
22
|
constructor(module, container, routes) {
|
|
12
23
|
this.globalPrefix = '';
|
|
24
|
+
this.globalFilters = [new base_exception_filter_1.BaseExceptionFilter()];
|
|
25
|
+
this.globalInterceptors = [];
|
|
13
26
|
this.module = module;
|
|
14
27
|
this.container = container;
|
|
15
28
|
this.routes = routes;
|
|
29
|
+
logger_1.Logger.log('Application Started.');
|
|
16
30
|
}
|
|
17
|
-
static create(module) {
|
|
31
|
+
static create(module, options) {
|
|
18
32
|
const container = new container_1.Container();
|
|
33
|
+
this._registerLogger(options?.logger);
|
|
19
34
|
container.load(module.prototype[keys_1.MODULE_PROPERTY]);
|
|
20
35
|
const routes = (0, module_decorator_1.moduleHandler)(module);
|
|
21
36
|
return new ServerFactory(module, container, routes);
|
|
@@ -27,6 +42,12 @@ class ServerFactory {
|
|
|
27
42
|
setGlobalPrefix(prefix) {
|
|
28
43
|
this.globalPrefix = prefix;
|
|
29
44
|
}
|
|
45
|
+
useGlobalFilters(...filters) {
|
|
46
|
+
this.globalFilters.push(...filters);
|
|
47
|
+
}
|
|
48
|
+
useGlobalInterceptors(...interceptors) {
|
|
49
|
+
this.globalInterceptors.push(...interceptors);
|
|
50
|
+
}
|
|
30
51
|
/**
|
|
31
52
|
* Handle a request
|
|
32
53
|
* @param request - The request to handle
|
|
@@ -34,47 +55,45 @@ class ServerFactory {
|
|
|
34
55
|
* @returns The response from the handler
|
|
35
56
|
*/
|
|
36
57
|
async handler(request, { params }) {
|
|
58
|
+
const host = new arguments_host_1.ArgumentsHost([request]);
|
|
59
|
+
let controller;
|
|
37
60
|
try {
|
|
38
61
|
// Bind the current request to the container for this request lifecycle
|
|
39
62
|
(0, request_1.bindRequest)(this.container, request);
|
|
40
63
|
const { pathname, method } = this._parseRequest(request);
|
|
41
64
|
const routeMatch = this._fetchRoute(pathname, method);
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
const handler = controller[routeMatch?.methodName];
|
|
52
|
-
if (!handler) {
|
|
53
|
-
return server_1.NextResponse.json({ message: 'Method not found' }, { status: 500 });
|
|
54
|
-
}
|
|
55
|
-
return await handler.call(controller, request, {
|
|
56
|
-
params: Promise.resolve(combinedParams)
|
|
57
|
-
});
|
|
65
|
+
controller = await this.container.getAsync(routeMatch?.controller);
|
|
66
|
+
const handler = this._fetchHandler(controller, routeMatch?.methodName);
|
|
67
|
+
const executionContext = new execution_context_1.ExecutionContext(controller.constructor, handler, [request]);
|
|
68
|
+
// Check if there's any interceptors to execute
|
|
69
|
+
const interceptors = await this._fetchInterceptors(controller);
|
|
70
|
+
return await (0, use_interceptor_decorator_1.interceptorExecute)(executionContext, interceptors, () => handler.call(controller, request, {
|
|
71
|
+
params
|
|
72
|
+
}));
|
|
58
73
|
}
|
|
59
74
|
catch (error) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
75
|
+
const filters = await this._fetchExceptionFilters(controller);
|
|
76
|
+
for (const filter of filters) {
|
|
77
|
+
// Fetch filter metadata
|
|
78
|
+
const metadata = (0, catch_decorator_1.catchHandler)(filter.constructor);
|
|
79
|
+
const type = metadata?.type;
|
|
80
|
+
// Check if any specific type is registered, if none, it's a catch all filter
|
|
81
|
+
if (!type || error instanceof type) {
|
|
82
|
+
const response = await filter.catch(error, host);
|
|
83
|
+
// If a response is returned from the filter, use it
|
|
84
|
+
if (response) {
|
|
85
|
+
return response;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
65
88
|
}
|
|
66
|
-
// Handle validation errors
|
|
67
|
-
if (error.message &&
|
|
68
|
-
(error.message.includes('Invalid param') ||
|
|
69
|
-
error.message.includes('Invalid body') ||
|
|
70
|
-
error.message.includes('Invalid query'))) {
|
|
71
|
-
return server_1.NextResponse.json({ message: error.message }, { status: 400 });
|
|
72
|
-
}
|
|
73
|
-
// Handle other errors
|
|
74
|
-
console.error('Server error:', error);
|
|
75
89
|
return server_1.NextResponse.json({ message: 'Internal server error' }, { status: 500 });
|
|
76
90
|
}
|
|
77
91
|
}
|
|
92
|
+
static _registerLogger(logger) {
|
|
93
|
+
if (logger !== false && !(0, lodash_1.isNil)(logger)) {
|
|
94
|
+
logger_1.Logger.overrideLogger(logger);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
78
97
|
/**
|
|
79
98
|
* Parse the request
|
|
80
99
|
* @param request - The request to parse
|
|
@@ -102,29 +121,56 @@ class ServerFactory {
|
|
|
102
121
|
}
|
|
103
122
|
});
|
|
104
123
|
if (!route) {
|
|
105
|
-
|
|
124
|
+
logger_1.Logger.error(`Route not found for ${method} ${pathname}`);
|
|
125
|
+
throw new api_exception_1.NotFoundApiException(`Route ${pathname} not found`);
|
|
106
126
|
}
|
|
107
127
|
return route;
|
|
108
128
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
129
|
+
async _fetchInterceptors(controller) {
|
|
130
|
+
const interceptors = [...this.globalInterceptors];
|
|
131
|
+
// Fetch any registered global interceptor
|
|
132
|
+
const appInterceptor = this.container.isBound(interceptor_1.APP_INTERCEPTOR);
|
|
133
|
+
if (appInterceptor) {
|
|
134
|
+
interceptors.push(await this.container.getAsync(interceptor_1.APP_INTERCEPTOR));
|
|
135
|
+
}
|
|
136
|
+
// Fetch controller interceptors
|
|
137
|
+
const metadata = (0, use_interceptor_decorator_1.interceptorHandler)(controller.constructor);
|
|
138
|
+
if (metadata.length > 0) {
|
|
139
|
+
const resolvedInterceptors = await Promise.all(metadata.map((interceptor) => {
|
|
140
|
+
// If it's a class constructor (function), resolve from container
|
|
141
|
+
if (typeof interceptor === 'function') {
|
|
142
|
+
return this.container.getAsync(interceptor);
|
|
143
|
+
}
|
|
144
|
+
// If it's an instance, resolve from container using its constructor
|
|
145
|
+
return this.container.getAsync(interceptor.constructor);
|
|
146
|
+
}));
|
|
147
|
+
interceptors.push(...resolvedInterceptors);
|
|
148
|
+
}
|
|
149
|
+
return interceptors.reverse();
|
|
150
|
+
}
|
|
151
|
+
_fetchHandler(controller, methodName) {
|
|
152
|
+
const originalHandler = controller[methodName];
|
|
153
|
+
// Create a named function wrapper to preserve the method name for logging/debugging
|
|
154
|
+
const handler = Object.defineProperty(function namedHandler(...args) {
|
|
155
|
+
return originalHandler.apply(controller, args);
|
|
156
|
+
}, 'name', { value: methodName, configurable: true });
|
|
157
|
+
return handler;
|
|
158
|
+
}
|
|
159
|
+
async _fetchExceptionFilters(controller) {
|
|
160
|
+
const filters = [...this.globalFilters];
|
|
161
|
+
// Fetch any registered global filter
|
|
162
|
+
const appFilter = this.container.isBound(filters_1.APP_FILTER);
|
|
163
|
+
if (appFilter) {
|
|
164
|
+
filters.push(await this.container.getAsync(filters_1.APP_FILTER));
|
|
165
|
+
}
|
|
166
|
+
if (controller) {
|
|
167
|
+
// Fetch controller filters
|
|
168
|
+
const controllerFilters = (0, use_filters_decorator_1.filterHandler)(controller.constructor);
|
|
169
|
+
if (controllerFilters.length > 0) {
|
|
170
|
+
filters.push(...controllerFilters);
|
|
125
171
|
}
|
|
126
172
|
}
|
|
127
|
-
return
|
|
173
|
+
return filters.reverse();
|
|
128
174
|
}
|
|
129
175
|
}
|
|
130
176
|
exports.ServerFactory = ServerFactory;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-factory.js","sourceRoot":"","sources":["../../src/server/server-factory.ts"],"names":[],"mappings":";;;AAAA,2CAAkD;AAElD,gEAA4D;AAC5D,iEAA0E;AAC1E,gDAAgD;AAEhD,qDAAgD;AAChD,wCAAuD;AAEvD,MAAa,aAAa;
|
|
1
|
+
{"version":3,"file":"server-factory.js","sourceRoot":"","sources":["../../src/server/server-factory.ts"],"names":[],"mappings":";;;AAAA,6DAAwD;AACxD,mEAA8D;AAC9D,2CAAkD;AAElD,gEAA4D;AAC5D,8EAAwE;AACxE,6EAAsE;AACtE,yFAA6E;AAE7E,kGAG2D;AAE3D,iEAA0E;AAC1E,gDAA+C;AAC/C,wDAAwD;AACxD,gDAAgD;AAEhD,qDAAgD;AAChD,wCAAuD;AAEvD,4CAAwC;AACxC,8DAAiE;AACjE,mCAA8B;AAM9B,MAAa,aAA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kB;QAClE,MAAM,eAAe,GAAG,UAAW,CACjC,UAAkC,CACvB,CAAA;QAEb,oFAAoF;QACpF,MAAM,OAAO,GAAG,MAAM,CAAC,cAAc,CACnC,SAAS,YAAY,CAAC,GAAG,IAAW;YAClC,OAAO,eAAe,CAAC,KAAK,CAAC,UAAW,EAAE,IAAI,CAAC,CAAA;QACjD,CAAC,EACD,MAAM,EACN,EAAE,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,IAAI,EAAE,CAC1C,CAAA;QAED,OAAO,OAAO,CAAA;IAChB,CAAC;IAEO,KAAK,CAAC,sBAAsB,CAAC,UAA2B;QAC9D,MAAM,OAAO,GAAG,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,CAAA;QAEvC,qCAAqC;QACrC,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,oBAAU,CAAC,CAAA;QACpD,IAAI,SAAS,EAAE,CAAC;YACd,OAAO,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAkB,oBAAU,CAAC,CAAC,CAAA;QAC1E,CAAC;QAED,IAAI,UAAU,EAAE,CAAC;YACf,2BAA2B;YAC3B,MAAM,iBAAiB,GAAG,IAAA,qCAAa,EAAC,UAAU,CAAC,WAAW,CAAC,CAAA;YAC/D,IAAI,iBAAiB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACjC,OAAO,CAAC,IAAI,CAAC,GAAG,iBAAiB,CAAC,CAAA;YACpC,CAAC;QACH,CAAC;QAED,OAAO,OAAO,CAAC,OAAO,EAAE,CAAA;IAC1B,CAAC;CACF;AAhOD,sCAgOC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filters.d.ts","sourceRoot":"","sources":["../../src/services/filters.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,eAAuB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filters.js","sourceRoot":"","sources":["../../src/services/filters.ts"],"names":[],"mappings":";;;AAAa,QAAA,UAAU,GAAG,MAAM,CAAC,YAAY,CAAC,CAAA"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export interface FetchModuleOptions extends RequestInit {
|
|
2
|
+
baseUrl?: URL | string;
|
|
3
|
+
search?: object;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* HTTP service class to allow easy implementation of custom API repositories
|
|
7
|
+
*
|
|
8
|
+
* Code based from nestjs-fetch:
|
|
9
|
+
* https://github.com/mikehall314/nestjs-fetch/blob/main/lib/fetch.service.ts
|
|
10
|
+
*/
|
|
11
|
+
export declare abstract class HttpService {
|
|
12
|
+
protected request<T>(request: Request): Promise<T>;
|
|
13
|
+
private createRequest;
|
|
14
|
+
private createRequestFormData;
|
|
15
|
+
protected createDefaults(): Promise<{}>;
|
|
16
|
+
/**
|
|
17
|
+
* Event triggered before the request is sent
|
|
18
|
+
* @param request The request to be sent
|
|
19
|
+
*/
|
|
20
|
+
protected onBeforeFetch(request: Request): void;
|
|
21
|
+
/**
|
|
22
|
+
* Event triggered after the request is sent, but before response JSON parsing
|
|
23
|
+
* @param request The request that was sent
|
|
24
|
+
* @param response The raw response received from the server
|
|
25
|
+
*/
|
|
26
|
+
protected onAfterFetch(request: Request, response: Response): void;
|
|
27
|
+
/**
|
|
28
|
+
* Catch function to handle errors from the native fetch API
|
|
29
|
+
* @param request The request that was sent
|
|
30
|
+
* @param response The raw response received from the server
|
|
31
|
+
* @param error Parsed error response from the server
|
|
32
|
+
*/
|
|
33
|
+
protected catch(request: Request, response: Response, error: any): Promise<void>;
|
|
34
|
+
get<T>(url: URL | string, options?: FetchModuleOptions): Promise<T>;
|
|
35
|
+
head(url: URL | string, options?: FetchModuleOptions): Promise<Response>;
|
|
36
|
+
delete(url: URL | string, options?: FetchModuleOptions): Promise<Response>;
|
|
37
|
+
patch<T>(url: URL | string, options?: FetchModuleOptions): Promise<T>;
|
|
38
|
+
put<T>(url: URL | string, options?: FetchModuleOptions): Promise<T>;
|
|
39
|
+
post<T>(url: URL | string, options?: FetchModuleOptions): Promise<T>;
|
|
40
|
+
/**
|
|
41
|
+
* Convert an object to FormData, handling File objects and nested data
|
|
42
|
+
* Uses lodash utilities for better type checking and iteration
|
|
43
|
+
* @param data Object to convert to FormData
|
|
44
|
+
* @returns FormData instance
|
|
45
|
+
*/
|
|
46
|
+
private objectToFormData;
|
|
47
|
+
/**
|
|
48
|
+
* POST method with automatic FormData conversion
|
|
49
|
+
* Accepts any object and converts it to FormData, handling File objects properly
|
|
50
|
+
* Automatically removes Content-Type header to let browser set multipart boundary
|
|
51
|
+
* @param url URL to send the request to
|
|
52
|
+
* @param data Object to convert to FormData
|
|
53
|
+
* @param options Additional request options
|
|
54
|
+
* @returns Promise resolving to the response data
|
|
55
|
+
*/
|
|
56
|
+
postFormData<T>(url: URL | string, data: Record<string, any>, options?: FetchModuleOptions): Promise<T>;
|
|
57
|
+
/**
|
|
58
|
+
* PATCH method with automatic FormData conversion
|
|
59
|
+
* Accepts any object and converts it to FormData, handling File objects properly
|
|
60
|
+
* Automatically removes Content-Type header to let browser set multipart boundary
|
|
61
|
+
* @param url URL to send the request to
|
|
62
|
+
* @param data Object to convert to FormData
|
|
63
|
+
* @param options Additional request options
|
|
64
|
+
* @returns Promise resolving to the response data
|
|
65
|
+
*/
|
|
66
|
+
patchFormData<T>(url: URL | string, data: Record<string, any>, options?: FetchModuleOptions): Promise<T>;
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=http-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-service.d.ts","sourceRoot":"","sources":["../../src/services/http-service.ts"],"names":[],"mappings":"AAoBA,MAAM,WAAW,kBAAmB,SAAQ,WAAW;IACrD,OAAO,CAAC,EAAE,GAAG,GAAG,MAAM,CAAA;IACtB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;;;;GAKG;AACH,8BAAsB,WA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G,CAAC,EACzB,OAAO,GAAE,kBAAuB,GAC/B,OAAO,CAAC,CAAC,CAAC;IAYb;;;;;;;;OAQG;IACG,aAAa,CAAC,CAAC,EACnB,GAAG,EAAE,GAAG,GAAG,MAAM,EACjB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACzB,OAAO,GAAE,kBAAuB,GAC/B,OAAO,CAAC,CAAC,CAAC;CAWd"}
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HttpService = void 0;
|
|
4
|
+
const lodash_1 = require("lodash");
|
|
5
|
+
const create_query_string_1 = require("../utils/search/create-query-string");
|
|
6
|
+
const http_status_1 = require("../constants/http-status");
|
|
7
|
+
const api_exception_1 = require("../exceptions/api-exception");
|
|
8
|
+
/**
|
|
9
|
+
* HTTP service class to allow easy implementation of custom API repositories
|
|
10
|
+
*
|
|
11
|
+
* Code based from nestjs-fetch:
|
|
12
|
+
* https://github.com/mikehall314/nestjs-fetch/blob/main/lib/fetch.service.ts
|
|
13
|
+
*/
|
|
14
|
+
class HttpService {
|
|
15
|
+
async request(request) {
|
|
16
|
+
try {
|
|
17
|
+
this.onBeforeFetch(request);
|
|
18
|
+
const response = await fetch(request);
|
|
19
|
+
this.onAfterFetch(request, response);
|
|
20
|
+
// Parse text/plain error responses
|
|
21
|
+
if (response?.headers?.get('content-type')?.includes('text/plain')) {
|
|
22
|
+
const message = await response.text();
|
|
23
|
+
await this.catch(request, response, { message });
|
|
24
|
+
if (response.status === http_status_1.HttpStatus.UNAUTHORIZED) {
|
|
25
|
+
throw new api_exception_1.UnauthorizedApiException(message);
|
|
26
|
+
}
|
|
27
|
+
else if (response.status === http_status_1.HttpStatus.NOT_FOUND) {
|
|
28
|
+
throw new api_exception_1.NotFoundApiException(message);
|
|
29
|
+
}
|
|
30
|
+
else if (response.status === http_status_1.HttpStatus.UNPROCESSABLE_ENTITY) {
|
|
31
|
+
throw new api_exception_1.UnprocessableEntityApiException(message);
|
|
32
|
+
}
|
|
33
|
+
else if (response.status === http_status_1.HttpStatus.INTERNAL_SERVER_ERROR) {
|
|
34
|
+
throw new api_exception_1.InternalServerErrorApiException(message);
|
|
35
|
+
}
|
|
36
|
+
throw new api_exception_1.ServiceUnavailableApiException(message);
|
|
37
|
+
}
|
|
38
|
+
// Parse application/json error responses
|
|
39
|
+
// NodeJS native fetch does not throw for logic errors
|
|
40
|
+
if (!response.ok) {
|
|
41
|
+
const error = await response.json();
|
|
42
|
+
await this.catch(request, response, error);
|
|
43
|
+
if (response.status === http_status_1.HttpStatus.UNAUTHORIZED) {
|
|
44
|
+
throw new api_exception_1.UnauthorizedApiException(error);
|
|
45
|
+
}
|
|
46
|
+
else if (response.status === http_status_1.HttpStatus.NOT_FOUND) {
|
|
47
|
+
throw new api_exception_1.NotFoundApiException(error);
|
|
48
|
+
}
|
|
49
|
+
else if (response.status === http_status_1.HttpStatus.UNPROCESSABLE_ENTITY) {
|
|
50
|
+
throw new api_exception_1.UnprocessableEntityApiException(error);
|
|
51
|
+
}
|
|
52
|
+
else if (response.status === http_status_1.HttpStatus.INTERNAL_SERVER_ERROR) {
|
|
53
|
+
throw new api_exception_1.InternalServerErrorApiException(error);
|
|
54
|
+
}
|
|
55
|
+
throw new api_exception_1.ServiceUnavailableApiException(error);
|
|
56
|
+
}
|
|
57
|
+
// Handle 204 Success No Content response
|
|
58
|
+
if (response.status === http_status_1.HttpStatus.NO_CONTENT) {
|
|
59
|
+
return {};
|
|
60
|
+
}
|
|
61
|
+
return await response.json();
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
if (error instanceof api_exception_1.ApiException) {
|
|
65
|
+
throw error;
|
|
66
|
+
}
|
|
67
|
+
throw new api_exception_1.ServiceUnavailableApiException(error);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
async createRequest(url, options) {
|
|
71
|
+
const defaults = (await this.createDefaults());
|
|
72
|
+
const { baseUrl, search, ...requestOptions } = {
|
|
73
|
+
...defaults,
|
|
74
|
+
...options,
|
|
75
|
+
headers: {
|
|
76
|
+
...defaults.headers,
|
|
77
|
+
...options.headers
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
return new Request(new URL(url + (0, create_query_string_1.createQueryString)(search), baseUrl), requestOptions);
|
|
81
|
+
}
|
|
82
|
+
async createRequestFormData(url, options) {
|
|
83
|
+
const defaults = (await this.createDefaults());
|
|
84
|
+
const { baseUrl, search, ...requestOptions } = {
|
|
85
|
+
...defaults,
|
|
86
|
+
...options,
|
|
87
|
+
headers: {
|
|
88
|
+
...defaults.headers,
|
|
89
|
+
...options.headers
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
if (requestOptions.headers) {
|
|
93
|
+
delete requestOptions.headers['Content-Type'];
|
|
94
|
+
delete requestOptions.headers['content-type'];
|
|
95
|
+
}
|
|
96
|
+
return new Request(new URL(url + (0, create_query_string_1.createQueryString)(search), baseUrl), requestOptions);
|
|
97
|
+
}
|
|
98
|
+
async createDefaults() {
|
|
99
|
+
return {};
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Event triggered before the request is sent
|
|
103
|
+
* @param request The request to be sent
|
|
104
|
+
*/
|
|
105
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
106
|
+
onBeforeFetch(request) { }
|
|
107
|
+
/**
|
|
108
|
+
* Event triggered after the request is sent, but before response JSON parsing
|
|
109
|
+
* @param request The request that was sent
|
|
110
|
+
* @param response The raw response received from the server
|
|
111
|
+
*/
|
|
112
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
113
|
+
onAfterFetch(request, response) { }
|
|
114
|
+
/**
|
|
115
|
+
* Catch function to handle errors from the native fetch API
|
|
116
|
+
* @param request The request that was sent
|
|
117
|
+
* @param response The raw response received from the server
|
|
118
|
+
* @param error Parsed error response from the server
|
|
119
|
+
*/
|
|
120
|
+
async catch(request, response, error) {
|
|
121
|
+
console.error('Request error', { response, error });
|
|
122
|
+
}
|
|
123
|
+
async get(url, options = {}) {
|
|
124
|
+
const request = await this.createRequest(url, { ...options, method: 'GET' });
|
|
125
|
+
return this.request(request);
|
|
126
|
+
}
|
|
127
|
+
async head(url, options = {}) {
|
|
128
|
+
const request = await this.createRequest(url, {
|
|
129
|
+
...options,
|
|
130
|
+
method: 'HEAD'
|
|
131
|
+
});
|
|
132
|
+
return this.request(request);
|
|
133
|
+
}
|
|
134
|
+
async delete(url, options = {}) {
|
|
135
|
+
const request = await this.createRequest(url, {
|
|
136
|
+
...options,
|
|
137
|
+
method: 'DELETE'
|
|
138
|
+
});
|
|
139
|
+
return this.request(request);
|
|
140
|
+
}
|
|
141
|
+
async patch(url, options = {}) {
|
|
142
|
+
const request = await this.createRequest(url, {
|
|
143
|
+
...options,
|
|
144
|
+
method: 'PATCH'
|
|
145
|
+
});
|
|
146
|
+
return this.request(request);
|
|
147
|
+
}
|
|
148
|
+
async put(url, options = {}) {
|
|
149
|
+
const request = await this.createRequest(url, { ...options, method: 'PUT' });
|
|
150
|
+
return this.request(request);
|
|
151
|
+
}
|
|
152
|
+
async post(url, options = {}) {
|
|
153
|
+
const request = await this.createRequest(url, {
|
|
154
|
+
...options,
|
|
155
|
+
method: 'POST'
|
|
156
|
+
});
|
|
157
|
+
return this.request(request);
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Convert an object to FormData, handling File objects and nested data
|
|
161
|
+
* Uses lodash utilities for better type checking and iteration
|
|
162
|
+
* @param data Object to convert to FormData
|
|
163
|
+
* @returns FormData instance
|
|
164
|
+
*/
|
|
165
|
+
objectToFormData(data) {
|
|
166
|
+
const formData = new FormData();
|
|
167
|
+
(0, lodash_1.forOwn)(data, (value, key) => {
|
|
168
|
+
// Skip null/undefined values using lodash utilities
|
|
169
|
+
if ((0, lodash_1.isNull)(value) || (0, lodash_1.isUndefined)(value)) {
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
if (value instanceof File) {
|
|
173
|
+
formData.append(key, value);
|
|
174
|
+
}
|
|
175
|
+
else if ((0, lodash_1.isArray)(value)) {
|
|
176
|
+
(0, lodash_1.forEach)(value, (item, index) => {
|
|
177
|
+
if (item instanceof File) {
|
|
178
|
+
formData.append(`${key}[${index}]`, item);
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
formData.append(`${key}[${index}]`, (0, lodash_1.toString)(item));
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
else if ((0, lodash_1.isObject)(value)) {
|
|
186
|
+
// Convert nested objects to JSON strings
|
|
187
|
+
formData.append(key, JSON.stringify(value));
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
formData.append(key, (0, lodash_1.toString)(value));
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
return formData;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* POST method with automatic FormData conversion
|
|
197
|
+
* Accepts any object and converts it to FormData, handling File objects properly
|
|
198
|
+
* Automatically removes Content-Type header to let browser set multipart boundary
|
|
199
|
+
* @param url URL to send the request to
|
|
200
|
+
* @param data Object to convert to FormData
|
|
201
|
+
* @param options Additional request options
|
|
202
|
+
* @returns Promise resolving to the response data
|
|
203
|
+
*/
|
|
204
|
+
async postFormData(url, data, options = {}) {
|
|
205
|
+
const formData = this.objectToFormData(data);
|
|
206
|
+
const request = await this.createRequestFormData(url, {
|
|
207
|
+
...options,
|
|
208
|
+
method: 'POST',
|
|
209
|
+
body: formData
|
|
210
|
+
});
|
|
211
|
+
return this.request(request);
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* PATCH method with automatic FormData conversion
|
|
215
|
+
* Accepts any object and converts it to FormData, handling File objects properly
|
|
216
|
+
* Automatically removes Content-Type header to let browser set multipart boundary
|
|
217
|
+
* @param url URL to send the request to
|
|
218
|
+
* @param data Object to convert to FormData
|
|
219
|
+
* @param options Additional request options
|
|
220
|
+
* @returns Promise resolving to the response data
|
|
221
|
+
*/
|
|
222
|
+
async patchFormData(url, data, options = {}) {
|
|
223
|
+
const formData = this.objectToFormData(data);
|
|
224
|
+
const request = await this.createRequestFormData(url, {
|
|
225
|
+
...options,
|
|
226
|
+
method: 'PATCH',
|
|
227
|
+
body: formData
|
|
228
|
+
});
|
|
229
|
+
return this.request(request);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
exports.HttpService = HttpService;
|
|
233
|
+
//# sourceMappingURL=http-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-service.js","sourceRoot":"","sources":["../../src/services/http-service.ts"],"names":[],"mappings":";;;AAAA,mCAQe;AACf,4EAAsE;AACtE,yDAAoD;AACpD,8DAOmC;AAOnC;;;;;GAKG;AACH,MAAsB,WAAW;IACrB,KAAK,CAAC,OAAO,CAAI,OAAgB;QACzC,IAAI,CAAC;YACH,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAA;YAE3B,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,CAAA;YAErC,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAA;YAEpC,mCAAmC;YACnC,IAAI,QAAQ,EAAE,OAAO,EAAE,GAAG,CAAC,cAAc,CAAC,EAAE,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;gBACnE,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;gBAErC,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,OAAO,EAAE,CAAC,CAAA;gBAEhD,IAAI,QAAQ,CAAC,MAAM,KAAK,wBAAU,CAAC,YAAY,EAAE,CAAC;oBAChD,MAAM,IAAI,wCAAwB,CAAC,OAAO,CAAC,CAAA;gBAC7C,CAAC;qBAAM,IAAI,QAAQ,CAAC,MAAM,KAAK,wBAAU,CAAC,SAAS,EAAE,CAAC;o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