@lerianstudio/sindarian-server 1.0.0-beta.1 → 1.0.0-beta.12
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 +5 -0
- package/dist/constants/keys.d.ts.map +1 -1
- package/dist/constants/keys.js +6 -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 +12 -17
- package/dist/controllers/decorators/body-decorator.d.ts.map +1 -1
- package/dist/controllers/decorators/body-decorator.js +55 -43
- package/dist/controllers/decorators/body-decorator.js.map +1 -1
- package/dist/controllers/decorators/controller-decorator.d.ts +5 -8
- package/dist/controllers/decorators/controller-decorator.d.ts.map +1 -1
- package/dist/controllers/decorators/controller-decorator.js +30 -66
- package/dist/controllers/decorators/controller-decorator.js.map +1 -1
- package/dist/controllers/decorators/param-decorator.d.ts +4 -9
- package/dist/controllers/decorators/param-decorator.d.ts.map +1 -1
- package/dist/controllers/decorators/param-decorator.js +33 -29
- package/dist/controllers/decorators/param-decorator.js.map +1 -1
- package/dist/controllers/decorators/query-decorator.d.ts +11 -15
- package/dist/controllers/decorators/query-decorator.d.ts.map +1 -1
- package/dist/controllers/decorators/query-decorator.js +24 -38
- package/dist/controllers/decorators/query-decorator.js.map +1 -1
- package/dist/controllers/decorators/request-decorator.d.ts +8 -12
- package/dist/controllers/decorators/request-decorator.d.ts.map +1 -1
- package/dist/controllers/decorators/request-decorator.js +21 -17
- package/dist/controllers/decorators/request-decorator.js.map +1 -1
- package/dist/controllers/decorators/route-decorator.d.ts +12 -1
- package/dist/controllers/decorators/route-decorator.d.ts.map +1 -1
- package/dist/controllers/decorators/route-decorator.js +24 -16
- package/dist/controllers/decorators/route-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/api-exception.d.ts +4 -7
- package/dist/exceptions/api-exception.d.ts.map +1 -1
- package/dist/exceptions/api-exception.js +8 -4
- package/dist/exceptions/api-exception.js.map +1 -1
- 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 +21 -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 +15 -0
- package/dist/exceptions/decorators/use-filters-decorator.d.ts.map +1 -0
- package/dist/exceptions/decorators/use-filters-decorator.js +47 -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 +10 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -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 +15 -0
- package/dist/interceptor/decorators/use-interceptor-decorator.d.ts.map +1 -0
- package/dist/interceptor/decorators/use-interceptor-decorator.js +76 -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 +5 -3
- package/dist/modules/module-decorator.d.ts.map +1 -1
- package/dist/modules/module-decorator.js +78 -24
- package/dist/modules/module-decorator.js.map +1 -1
- package/dist/pipes/decorators/index.d.ts +2 -0
- package/dist/pipes/decorators/index.d.ts.map +1 -0
- package/dist/pipes/decorators/index.js +6 -0
- package/dist/pipes/decorators/index.js.map +1 -0
- package/dist/pipes/decorators/use-pipes.d.ts +19 -0
- package/dist/pipes/decorators/use-pipes.d.ts.map +1 -0
- package/dist/pipes/decorators/use-pipes.js +118 -0
- package/dist/pipes/decorators/use-pipes.js.map +1 -0
- package/dist/pipes/index.d.ts +3 -0
- package/dist/pipes/index.d.ts.map +1 -0
- package/dist/pipes/index.js +18 -0
- package/dist/pipes/index.js.map +1 -0
- package/dist/pipes/pipe-transform.d.ts +46 -0
- package/dist/pipes/pipe-transform.d.ts.map +1 -0
- package/dist/pipes/pipe-transform.js +3 -0
- package/dist/pipes/pipe-transform.js.map +1 -0
- package/dist/server/server-factory.d.ts +23 -6
- package/dist/server/server-factory.d.ts.map +1 -1
- package/dist/server/server-factory.js +114 -48
- 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/services/pipes.d.ts +2 -0
- package/dist/services/pipes.d.ts.map +1 -0
- package/dist/services/pipes.js +5 -0
- package/dist/services/pipes.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/dist/zod/create-zod-dto.d.ts +16 -0
- package/dist/zod/create-zod-dto.d.ts.map +1 -0
- package/dist/zod/create-zod-dto.js +14 -0
- package/dist/zod/create-zod-dto.js.map +1 -0
- package/dist/zod/index.d.ts +3 -0
- package/dist/zod/index.d.ts.map +1 -0
- package/dist/zod/index.js +8 -0
- package/dist/zod/index.js.map +1 -0
- package/dist/zod/zod-validation-pipe.d.ts +5 -0
- package/dist/zod/zod-validation-pipe.d.ts.map +1 -0
- package/dist/zod/zod-validation-pipe.js +35 -0
- package/dist/zod/zod-validation-pipe.js.map +1 -0
- package/package.json +7 -6
- 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,21 +1,40 @@
|
|
|
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");
|
|
21
|
+
const pipes_1 = require("../services/pipes");
|
|
22
|
+
const use_pipes_1 = require("../pipes/decorators/use-pipes");
|
|
23
|
+
const route_decorator_1 = require("../controllers/decorators/route-decorator");
|
|
10
24
|
class ServerFactory {
|
|
11
25
|
constructor(module, container, routes) {
|
|
12
26
|
this.globalPrefix = '';
|
|
27
|
+
this.globalFilters = [new base_exception_filter_1.BaseExceptionFilter()];
|
|
28
|
+
this.globalInterceptors = [];
|
|
29
|
+
this.globalPipes = [];
|
|
13
30
|
this.module = module;
|
|
14
31
|
this.container = container;
|
|
15
32
|
this.routes = routes;
|
|
33
|
+
logger_1.Logger.log('Application Started.');
|
|
16
34
|
}
|
|
17
|
-
static create(module) {
|
|
35
|
+
static create(module, options) {
|
|
18
36
|
const container = new container_1.Container();
|
|
37
|
+
this._registerLogger(options?.logger);
|
|
19
38
|
container.load(module.prototype[keys_1.MODULE_PROPERTY]);
|
|
20
39
|
const routes = (0, module_decorator_1.moduleHandler)(module);
|
|
21
40
|
return new ServerFactory(module, container, routes);
|
|
@@ -27,6 +46,15 @@ class ServerFactory {
|
|
|
27
46
|
setGlobalPrefix(prefix) {
|
|
28
47
|
this.globalPrefix = prefix;
|
|
29
48
|
}
|
|
49
|
+
useGlobalFilters(...filters) {
|
|
50
|
+
this.globalFilters.push(...filters);
|
|
51
|
+
}
|
|
52
|
+
useGlobalInterceptors(...interceptors) {
|
|
53
|
+
this.globalInterceptors.push(...interceptors);
|
|
54
|
+
}
|
|
55
|
+
useGlobalPipes(...pipes) {
|
|
56
|
+
this.globalPipes.push(...pipes);
|
|
57
|
+
}
|
|
30
58
|
/**
|
|
31
59
|
* Handle a request
|
|
32
60
|
* @param request - The request to handle
|
|
@@ -34,47 +62,52 @@ class ServerFactory {
|
|
|
34
62
|
* @returns The response from the handler
|
|
35
63
|
*/
|
|
36
64
|
async handler(request, { params }) {
|
|
65
|
+
const host = new arguments_host_1.ArgumentsHost([request]);
|
|
66
|
+
let controller;
|
|
37
67
|
try {
|
|
38
68
|
// Bind the current request to the container for this request lifecycle
|
|
39
69
|
(0, request_1.bindRequest)(this.container, request);
|
|
40
70
|
const { pathname, method } = this._parseRequest(request);
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
params: Promise.resolve(combinedParams)
|
|
71
|
+
const match = this._fetchRoute(pathname, method);
|
|
72
|
+
controller = await this.container.getAsync(match?.controller);
|
|
73
|
+
const handler = this._fetchHandler(controller, match?.methodName);
|
|
74
|
+
const executionContext = new execution_context_1.ExecutionContext(controller.constructor, handler, [request]);
|
|
75
|
+
// Check if there's any interceptors to execute
|
|
76
|
+
const interceptors = await this._fetchInterceptors(controller);
|
|
77
|
+
// Check if there's any pipes to execute
|
|
78
|
+
const pipes = await this._fetchPipes(controller, match?.methodName);
|
|
79
|
+
return await use_interceptor_decorator_1.InterceptorHandler.execute(executionContext, interceptors, async () => {
|
|
80
|
+
// Parse args
|
|
81
|
+
const args = await route_decorator_1.RouteHandler.getArgs(controller, match?.methodName, [request, { params }]);
|
|
82
|
+
// Run registered pipes
|
|
83
|
+
const pipedArgs = await use_pipes_1.PipeHandler.execute(controller, match?.methodName, pipes, args);
|
|
84
|
+
// Execute controller
|
|
85
|
+
return await handler.call(controller, ...pipedArgs);
|
|
57
86
|
});
|
|
58
87
|
}
|
|
59
88
|
catch (error) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
89
|
+
const filters = await this._fetchExceptionFilters(controller);
|
|
90
|
+
for (const filter of filters) {
|
|
91
|
+
// Fetch filter metadata
|
|
92
|
+
const metadata = (0, catch_decorator_1.catchHandler)(filter.constructor);
|
|
93
|
+
const type = metadata?.type;
|
|
94
|
+
// Check if any specific type is registered, if none, it's a catch all filter
|
|
95
|
+
if (!type || error instanceof type) {
|
|
96
|
+
const response = await filter.catch(error, host);
|
|
97
|
+
// If a response is returned from the filter, use it
|
|
98
|
+
if (response) {
|
|
99
|
+
return response;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
65
102
|
}
|
|
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
103
|
return server_1.NextResponse.json({ message: 'Internal server error' }, { status: 500 });
|
|
76
104
|
}
|
|
77
105
|
}
|
|
106
|
+
static _registerLogger(logger) {
|
|
107
|
+
if (logger !== false && !(0, lodash_1.isNil)(logger)) {
|
|
108
|
+
logger_1.Logger.overrideLogger(logger);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
78
111
|
/**
|
|
79
112
|
* Parse the request
|
|
80
113
|
* @param request - The request to parse
|
|
@@ -102,29 +135,62 @@ class ServerFactory {
|
|
|
102
135
|
}
|
|
103
136
|
});
|
|
104
137
|
if (!route) {
|
|
105
|
-
|
|
138
|
+
logger_1.Logger.error(`Route not found for ${method} ${pathname}`);
|
|
139
|
+
throw new api_exception_1.NotFoundApiException(`Route ${pathname} not found`);
|
|
106
140
|
}
|
|
107
141
|
return route;
|
|
108
142
|
}
|
|
143
|
+
async _fetchInterceptors(controller) {
|
|
144
|
+
const interceptors = [...this.globalInterceptors];
|
|
145
|
+
// Fetch any registered global interceptor
|
|
146
|
+
const appInterceptor = this.container.isBound(interceptor_1.APP_INTERCEPTOR);
|
|
147
|
+
if (appInterceptor) {
|
|
148
|
+
interceptors.push(await this.container.getAsync(interceptor_1.APP_INTERCEPTOR));
|
|
149
|
+
}
|
|
150
|
+
if (controller) {
|
|
151
|
+
// Fetch controller interceptors
|
|
152
|
+
interceptors.push(...(await use_interceptor_decorator_1.InterceptorHandler.fetch(this.container, controller)));
|
|
153
|
+
}
|
|
154
|
+
return interceptors.reverse();
|
|
155
|
+
}
|
|
156
|
+
_fetchHandler(controller, methodName) {
|
|
157
|
+
const originalHandler = controller[methodName];
|
|
158
|
+
// Create a named function wrapper to preserve the method name for logging/debugging
|
|
159
|
+
const handler = Object.defineProperty(function namedHandler(...args) {
|
|
160
|
+
return originalHandler.apply(controller, args);
|
|
161
|
+
}, 'name', { value: methodName, configurable: true });
|
|
162
|
+
return handler;
|
|
163
|
+
}
|
|
164
|
+
async _fetchExceptionFilters(controller) {
|
|
165
|
+
const filters = [...this.globalFilters];
|
|
166
|
+
// Fetch any registered global filter
|
|
167
|
+
const appFilter = this.container.isBound(filters_1.APP_FILTER);
|
|
168
|
+
if (appFilter) {
|
|
169
|
+
filters.push(await this.container.getAsync(filters_1.APP_FILTER));
|
|
170
|
+
}
|
|
171
|
+
if (controller) {
|
|
172
|
+
filters.push(...(await use_filters_decorator_1.FilterHandler.fetch(this.container, controller)));
|
|
173
|
+
}
|
|
174
|
+
return filters.reverse();
|
|
175
|
+
}
|
|
109
176
|
/**
|
|
110
|
-
*
|
|
111
|
-
* @param
|
|
112
|
-
* @param
|
|
113
|
-
* @returns
|
|
177
|
+
* Fetch the pipes for a controller method
|
|
178
|
+
* @param controller
|
|
179
|
+
* @param methodName
|
|
180
|
+
* @returns
|
|
114
181
|
*/
|
|
115
|
-
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}
|
|
182
|
+
async _fetchPipes(controller, methodName) {
|
|
183
|
+
const pipes = [...this.globalPipes];
|
|
184
|
+
// Fetch any registered global pipes
|
|
185
|
+
const appPipe = this.container.isBound(pipes_1.APP_PIPE);
|
|
186
|
+
if (appPipe) {
|
|
187
|
+
pipes.push(await this.container.getAsync(pipes_1.APP_PIPE));
|
|
188
|
+
}
|
|
189
|
+
// Fetch controller pipes
|
|
190
|
+
if (controller) {
|
|
191
|
+
pipes.push(...(await use_pipes_1.PipeHandler.fetch(this.container, controller, methodName)));
|
|
126
192
|
}
|
|
127
|
-
return
|
|
193
|
+
return pipes.reverse();
|
|
128
194
|
}
|
|
129
195
|
}
|
|
130
196
|
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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I,CAAC,MAAM,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAkB,oBAAU,CAAC,CAAC,CAAA;QAC1E,CAAC;QAED,IAAI,UAAU,EAAE,CAAC;YACf,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,qCAAa,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC,CAAA;QAC1E,CAAC;QAED,OAAO,OAAO,CAAC,OAAO,EAAE,CAAA;IAC1B,CAAC;IAED;;;;;OAKG;IACK,KAAK,CAAC,WAAW,CACvB,UAA0B,EAC1B,UAA2B;QAE3B,MAAM,KAAK,GAAG,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,CAAA;QAEnC,oCAAoC;QACpC,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,gBAAQ,CAAC,CAAA;QAChD,IAAI,OAAO,EAAE,CAAC;YACZ,KAAK,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAgB,gBAAQ,CAAC,CAAC,CAAA;QACpE,CAAC;QAED,yBAAyB;QACzB,IAAI,UAAU,EAAE,CAAC;YACf,KAAK,CAAC,IAAI,CACR,GAAG,CAAC,MAAM,uBAAW,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CACrE,CAAA;QACH,CAAC;QAED,OAAO,KAAK,CAAC,OAAO,EAAE,CAAA;IACxB,CAAC;CACF;AAvQD,sCAuQC"}
|
|
@@ -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
|
+
protected createRequest(url: URL | string, options: FetchModuleOptions): Promise<Request>;
|
|
14
|
+
protected createRequestFormData(url: URL | string, options: FetchModuleOptions): Promise<Request>;
|
|
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,WAAW;c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ACH,OAAO,CAAC,gBAAgB;IA8BxB;;;;;;;;OAQG;IACG,YAAY,CAAC,CAAC,EAClB,GAAG,EAAE,GAAG,GAAG,MAAM,EACjB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,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,YAA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AAG,EAAE;YACpD,GAAG,OAAO;YACV,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,QAAQ;SACf,CAAC,CAAA;QAEF,OAAO,IAAI,CAAC,OAAO,CAAI,OAAO,CAAC,CAAA;IACjC,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,aAAa,CACjB,GAAiB,EACjB,IAAyB,EACzB,UAA8B,EAAE;QAEhC,MAAM,QAAQ,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAA;QAE5C,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,qBAAqB,CAAC,GAAG,EAAE;YACpD,GAAG,OAAO;YACV,MAAM,EAAE,OAAO;YACf,IAAI,EAAE,QAAQ;SACf,CAAC,CAAA;QAEF,OAAO,IAAI,CAAC,OAAO,CAAI,OAAO,CAAC,CAAA;IACjC,CAAC;CACF;AA5RD,kCA4RC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interceptor.d.ts","sourceRoot":"","sources":["../../src/services/interceptor.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,eAA4B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interceptor.js","sourceRoot":"","sources":["../../src/services/interceptor.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipes.d.ts","sourceRoot":"","sources":["../../src/services/pipes.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,eAAqB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipes.js","sourceRoot":"","sources":["../../src/services/pipes.ts"],"names":[],"mappings":";;;AAAa,QAAA,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-form-data.d.ts","sourceRoot":"","sources":["../../../src/utils/form-data/get-form-data.ts"],"names":[],"mappings":"AAAA,wBAAgB,WAAW,CAAC,IAAI,EAAE,QAAQ,uBAMzC"}
|