@noony-serverless/core 0.2.1 → 0.2.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/build/core/core.d.ts
CHANGED
|
@@ -71,7 +71,7 @@ export interface HandlerOptions {
|
|
|
71
71
|
export interface Context<T = unknown> {
|
|
72
72
|
readonly req: NoonyRequest<T>;
|
|
73
73
|
readonly res: NoonyResponse;
|
|
74
|
-
container
|
|
74
|
+
container: ContainerInstance;
|
|
75
75
|
error?: Error | null;
|
|
76
76
|
readonly businessData: Map<string, unknown>;
|
|
77
77
|
user?: unknown;
|
|
@@ -312,7 +312,9 @@ class ProcessingMiddleware {
|
|
|
312
312
|
}
|
|
313
313
|
extractContentLength(req) {
|
|
314
314
|
const contentLength = req.headers?.['content-length'] || req.headers?.['Content-Length'];
|
|
315
|
-
const lengthValue = Array.isArray(contentLength)
|
|
315
|
+
const lengthValue = Array.isArray(contentLength)
|
|
316
|
+
? contentLength[0]
|
|
317
|
+
: contentLength;
|
|
316
318
|
return lengthValue ? parseInt(lengthValue, 10) : undefined;
|
|
317
319
|
}
|
|
318
320
|
extractAcceptLanguage(req) {
|
|
@@ -421,7 +421,9 @@ let PermissionGuardFactory = class PermissionGuardFactory {
|
|
|
421
421
|
return this.createExpressionGuard(permissions, config);
|
|
422
422
|
default:
|
|
423
423
|
// Fallback to plain guard
|
|
424
|
-
return this.createPlainGuard(Array.isArray(permissions)
|
|
424
|
+
return this.createPlainGuard(Array.isArray(permissions)
|
|
425
|
+
? permissions
|
|
426
|
+
: [permissions], config);
|
|
425
427
|
}
|
|
426
428
|
}
|
|
427
429
|
/**
|
|
@@ -534,7 +536,8 @@ let PermissionGuardFactory = class PermissionGuardFactory {
|
|
|
534
536
|
checkCount: acc.checkCount + (stats.checkCount || 0),
|
|
535
537
|
successCount: acc.successCount + (stats.successCount || 0),
|
|
536
538
|
failureCount: acc.failureCount + (stats.failureCount || 0),
|
|
537
|
-
totalProcessingTimeUs: acc.totalProcessingTimeUs +
|
|
539
|
+
totalProcessingTimeUs: acc.totalProcessingTimeUs +
|
|
540
|
+
(stats.totalProcessingTimeUs || 0),
|
|
538
541
|
}), {
|
|
539
542
|
checkCount: 0,
|
|
540
543
|
successCount: 0,
|
|
@@ -546,10 +549,12 @@ let PermissionGuardFactory = class PermissionGuardFactory {
|
|
|
546
549
|
totalSuccesses: totals.successCount,
|
|
547
550
|
totalFailures: totals.failureCount,
|
|
548
551
|
overallSuccessRate: totals.checkCount > 0
|
|
549
|
-
? (totals.successCount / totals.checkCount) *
|
|
552
|
+
? (totals.successCount / totals.checkCount) *
|
|
553
|
+
100
|
|
550
554
|
: 100,
|
|
551
555
|
averageProcessingTimeUs: totals.checkCount > 0
|
|
552
|
-
? totals.totalProcessingTimeUs /
|
|
556
|
+
? totals.totalProcessingTimeUs /
|
|
557
|
+
totals.checkCount
|
|
553
558
|
: 0,
|
|
554
559
|
};
|
|
555
560
|
}
|
package/package.json
CHANGED