@tndhuy/create-app 1.2.7 → 1.2.8
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/package.json
CHANGED
|
@@ -2,7 +2,6 @@ import { CallHandler, ExecutionContext, Injectable, NestInterceptor } from '@nes
|
|
|
2
2
|
import { Reflector } from '@nestjs/core';
|
|
3
3
|
import { Observable } from 'rxjs';
|
|
4
4
|
import { map } from 'rxjs/operators';
|
|
5
|
-
import { PUBLIC_API_KEY } from '../decorators/public-api.decorator';
|
|
6
5
|
|
|
7
6
|
export const RAW_RESPONSE_KEY = 'raw_response';
|
|
8
7
|
|
|
@@ -20,17 +19,7 @@ export class TransformInterceptor<T> implements NestInterceptor<T, unknown> {
|
|
|
20
19
|
return next.handle();
|
|
21
20
|
}
|
|
22
21
|
|
|
23
|
-
|
|
24
|
-
context.getHandler(),
|
|
25
|
-
context.getClass(),
|
|
26
|
-
]);
|
|
27
|
-
|
|
28
|
-
// Internal first: If not explicitly marked as Public API, return RAW data
|
|
29
|
-
if (!isPublic) {
|
|
30
|
-
return next.handle();
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// Public API: Wrap response in a standardized success object
|
|
22
|
+
// Wrap all responses in a standardized success object
|
|
34
23
|
return next.handle().pipe(
|
|
35
24
|
map((data) => {
|
|
36
25
|
// Handle paginated results: { items: [], meta: {} }
|
|
@@ -2,7 +2,6 @@ import { CallHandler, ExecutionContext, Injectable, NestInterceptor } from '@nes
|
|
|
2
2
|
import { Reflector } from '@nestjs/core';
|
|
3
3
|
import { Observable } from 'rxjs';
|
|
4
4
|
import { map } from 'rxjs/operators';
|
|
5
|
-
import { PUBLIC_API_KEY } from '../decorators/public-api.decorator';
|
|
6
5
|
|
|
7
6
|
export const RAW_RESPONSE_KEY = 'raw_response';
|
|
8
7
|
|
|
@@ -20,17 +19,7 @@ export class TransformInterceptor<T> implements NestInterceptor<T, unknown> {
|
|
|
20
19
|
return next.handle();
|
|
21
20
|
}
|
|
22
21
|
|
|
23
|
-
|
|
24
|
-
context.getHandler(),
|
|
25
|
-
context.getClass(),
|
|
26
|
-
]);
|
|
27
|
-
|
|
28
|
-
// Internal first: If not explicitly marked as Public API, return RAW data
|
|
29
|
-
if (!isPublic) {
|
|
30
|
-
return next.handle();
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// Public API: Wrap response in a standardized success object
|
|
22
|
+
// Wrap all responses in a standardized success object
|
|
34
23
|
return next.handle().pipe(
|
|
35
24
|
map((data) => {
|
|
36
25
|
// Handle paginated results: { items: [], meta: {} }
|