@forklaunch/core 1.5.1 → 1.5.3
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/lib/cache/{index.d.mts → cacheKey.d.ts} +2 -6
- package/lib/cache/cacheKey.d.ts.map +1 -0
- package/lib/cache/index.d.ts +4 -15
- package/lib/cache/index.d.ts.map +1 -0
- package/lib/{ttlCache.interface-B3xaLT00.d.ts → cache/interfaces/ttlCache.interface.d.ts} +3 -5
- package/lib/cache/interfaces/ttlCache.interface.d.ts.map +1 -0
- package/lib/{ttlCacheRecord.types-oX0ti5SP.d.mts → cache/types/ttlCacheRecord.types.d.ts} +3 -4
- package/lib/cache/types/ttlCacheRecord.types.d.ts.map +1 -0
- package/lib/controllers/index.d.ts +2 -13
- package/lib/controllers/index.d.ts.map +1 -0
- package/lib/controllers/{index.d.mts → interfaces/controller.interface.d.ts} +2 -3
- package/lib/controllers/interfaces/controller.interface.d.ts.map +1 -0
- package/lib/environment/index.d.ts +2 -28
- package/lib/environment/index.d.ts.map +1 -0
- package/lib/environment/{index.d.mts → loadCascadingEnv.d.ts} +4 -5
- package/lib/environment/loadCascadingEnv.d.ts.map +1 -0
- package/lib/http/application/expressLikeApplication.d.ts +34 -0
- package/lib/http/application/expressLikeApplication.d.ts.map +1 -0
- package/lib/http/bootstrap/listen.d.ts +2 -0
- package/lib/http/bootstrap/listen.d.ts.map +1 -0
- package/lib/http/cluster/cluster.types.d.ts +17 -0
- package/lib/http/cluster/cluster.types.d.ts.map +1 -0
- package/lib/http/cluster/isPortBound.d.ts +2 -0
- package/lib/http/cluster/isPortBound.d.ts.map +1 -0
- package/lib/http/createHmacToken.d.ts +19 -0
- package/lib/http/createHmacToken.d.ts.map +1 -0
- package/lib/http/discriminateAuthMethod.d.ts +85 -0
- package/lib/http/discriminateAuthMethod.d.ts.map +1 -0
- package/lib/http/generateHmacAuthHeaders.d.ts +31 -0
- package/lib/http/generateHmacAuthHeaders.d.ts.map +1 -0
- package/lib/http/guards/hasFeatureChecks.d.ts +2 -0
- package/lib/http/guards/hasFeatureChecks.d.ts.map +1 -0
- package/lib/http/guards/hasPermissionChecks.d.ts +2 -0
- package/lib/http/guards/hasPermissionChecks.d.ts.map +1 -0
- package/lib/http/guards/hasRoleChecks.d.ts +2 -0
- package/lib/http/guards/hasRoleChecks.d.ts.map +1 -0
- package/lib/http/guards/hasScopeChecks.d.ts +2 -0
- package/lib/http/guards/hasScopeChecks.d.ts.map +1 -0
- package/lib/http/guards/hasSend.d.ts +17 -0
- package/lib/http/guards/hasSend.d.ts.map +1 -0
- package/lib/http/guards/hasSubscriptionChecks.d.ts +2 -0
- package/lib/http/guards/hasSubscriptionChecks.d.ts.map +1 -0
- package/lib/http/guards/hasVersionedSchema.d.ts +2 -0
- package/lib/http/guards/hasVersionedSchema.d.ts.map +1 -0
- package/lib/http/guards/isBasicAuthMethod.d.ts +3 -0
- package/lib/http/guards/isBasicAuthMethod.d.ts.map +1 -0
- package/lib/http/guards/isConstrainedForklaunchRouter.d.ts +21 -0
- package/lib/http/guards/isConstrainedForklaunchRouter.d.ts.map +1 -0
- package/lib/http/guards/isExpressLikeSchemaHandler.d.ts +32 -0
- package/lib/http/guards/isExpressLikeSchemaHandler.d.ts.map +1 -0
- package/lib/http/guards/isForklaunchExpressLikeRouter.d.ts +28 -0
- package/lib/http/guards/isForklaunchExpressLikeRouter.d.ts.map +1 -0
- package/lib/http/guards/isForklaunchRequest.d.ts +26 -0
- package/lib/http/guards/isForklaunchRequest.d.ts.map +1 -0
- package/lib/http/guards/isForklaunchResponse.d.ts +23 -0
- package/lib/http/guards/isForklaunchResponse.d.ts.map +1 -0
- package/lib/http/guards/isForklaunchRouter.d.ts +21 -0
- package/lib/http/guards/isForklaunchRouter.d.ts.map +1 -0
- package/lib/http/guards/isHmacMethod.d.ts +9 -0
- package/lib/http/guards/isHmacMethod.d.ts.map +1 -0
- package/lib/http/guards/isHttpContractDetails.d.ts +29 -0
- package/lib/http/guards/isHttpContractDetails.d.ts.map +1 -0
- package/lib/http/guards/isJwtAuthMethod.d.ts +3 -0
- package/lib/http/guards/isJwtAuthMethod.d.ts.map +1 -0
- package/lib/http/guards/isLoggerMeta.d.ts +3 -0
- package/lib/http/guards/isLoggerMeta.d.ts.map +1 -0
- package/lib/http/guards/isPath.d.ts +2 -0
- package/lib/http/guards/isPath.d.ts.map +1 -0
- package/lib/http/guards/isPathParamContractDetails.d.ts +4 -0
- package/lib/http/guards/isPathParamContractDetails.d.ts.map +1 -0
- package/lib/http/guards/isRequestShape.d.ts +3 -0
- package/lib/http/guards/isRequestShape.d.ts.map +1 -0
- package/lib/http/guards/isResponseCompiledSchema.d.ts +3 -0
- package/lib/http/guards/isResponseCompiledSchema.d.ts.map +1 -0
- package/lib/http/guards/isSdkHandler.d.ts +9 -0
- package/lib/http/guards/isSdkHandler.d.ts.map +1 -0
- package/lib/http/guards/isSdkRouter.d.ts +9 -0
- package/lib/http/guards/isSdkRouter.d.ts.map +1 -0
- package/lib/http/guards/isTypedHandler.d.ts +5 -0
- package/lib/http/guards/isTypedHandler.d.ts.map +1 -0
- package/lib/http/guards/isVersionedInputSchema.d.ts +3 -0
- package/lib/http/guards/isVersionedInputSchema.d.ts.map +1 -0
- package/lib/http/handlers/delete.d.ts +5 -0
- package/lib/http/handlers/delete.d.ts.map +1 -0
- package/lib/http/handlers/get.d.ts +5 -0
- package/lib/http/handlers/get.d.ts.map +1 -0
- package/lib/http/handlers/head.d.ts +5 -0
- package/lib/http/handlers/head.d.ts.map +1 -0
- package/lib/http/handlers/middleware.d.ts +10 -0
- package/lib/http/handlers/middleware.d.ts.map +1 -0
- package/lib/http/handlers/options.d.ts +5 -0
- package/lib/http/handlers/options.d.ts.map +1 -0
- package/lib/http/handlers/patch.d.ts +5 -0
- package/lib/http/handlers/patch.d.ts.map +1 -0
- package/lib/http/handlers/post.d.ts +5 -0
- package/lib/http/handlers/post.d.ts.map +1 -0
- package/lib/http/handlers/put.d.ts +5 -0
- package/lib/http/handlers/put.d.ts.map +1 -0
- package/lib/http/handlers/trace.d.ts +5 -0
- package/lib/http/handlers/trace.d.ts.map +1 -0
- package/lib/http/handlers/typedAuthHandler.d.ts +5 -0
- package/lib/http/handlers/typedAuthHandler.d.ts.map +1 -0
- package/lib/http/handlers/typedHandler.d.ts +14 -0
- package/lib/http/handlers/typedHandler.d.ts.map +1 -0
- package/lib/http/httpStatusCodes.d.ts +75 -0
- package/lib/http/httpStatusCodes.d.ts.map +1 -0
- package/lib/http/index.d.ts +47 -1244
- package/lib/http/index.d.ts.map +1 -0
- package/lib/http/index.js +445 -410
- package/lib/http/index.js.map +1 -1
- package/lib/http/index.mjs +439 -407
- package/lib/http/index.mjs.map +1 -1
- package/lib/http/interfaces/expressLikeRouter.interface.d.ts +25 -0
- package/lib/http/interfaces/expressLikeRouter.interface.d.ts.map +1 -0
- package/lib/http/mcpGenerator/mcpGenerator.d.ts +17 -0
- package/lib/http/mcpGenerator/mcpGenerator.d.ts.map +1 -0
- package/lib/http/middleware/request/auth.middleware.d.ts +16 -0
- package/lib/http/middleware/request/auth.middleware.d.ts.map +1 -0
- package/lib/http/middleware/request/cors.middleware.d.ts +13 -0
- package/lib/http/middleware/request/cors.middleware.d.ts.map +1 -0
- package/lib/http/middleware/request/createContext.middleware.d.ts +15 -0
- package/lib/http/middleware/request/createContext.middleware.d.ts.map +1 -0
- package/lib/http/middleware/request/enrichDetails.middleware.d.ts +18 -0
- package/lib/http/middleware/request/enrichDetails.middleware.d.ts.map +1 -0
- package/lib/http/middleware/request/parse.middleware.d.ts +17 -0
- package/lib/http/middleware/request/parse.middleware.d.ts.map +1 -0
- package/lib/http/middleware/request/tenantContext.middleware.d.ts +41 -0
- package/lib/http/middleware/request/tenantContext.middleware.d.ts.map +1 -0
- package/lib/http/middleware/response/enrichExpressLikeSend.middleware.d.ts +32 -0
- package/lib/http/middleware/response/enrichExpressLikeSend.middleware.d.ts.map +1 -0
- package/lib/http/middleware/response/parse.middleware.d.ts +31 -0
- package/lib/http/middleware/response/parse.middleware.d.ts.map +1 -0
- package/lib/http/openApiV3Generator/openApiV3Generator.d.ts +17 -0
- package/lib/http/openApiV3Generator/openApiV3Generator.d.ts.map +1 -0
- package/lib/http/rateLimit/index.d.ts +2 -0
- package/lib/http/rateLimit/index.d.ts.map +1 -0
- package/lib/http/rateLimit/rateLimiter.d.ts +66 -0
- package/lib/http/rateLimit/rateLimiter.d.ts.map +1 -0
- package/lib/http/router/discriminateBody.d.ts +43 -0
- package/lib/http/router/discriminateBody.d.ts.map +1 -0
- package/lib/http/router/expressLikeRouter.d.ts +240 -0
- package/lib/http/router/expressLikeRouter.d.ts.map +1 -0
- package/lib/http/router/routerSharedLogic.d.ts +50 -0
- package/lib/http/router/routerSharedLogic.d.ts.map +1 -0
- package/lib/http/router/unpackRouters.d.ts +7 -0
- package/lib/http/router/unpackRouters.d.ts.map +1 -0
- package/lib/http/telemetry/auditLogger.d.ts +21 -0
- package/lib/http/telemetry/auditLogger.d.ts.map +1 -0
- package/lib/http/telemetry/constants.d.ts +6 -0
- package/lib/http/telemetry/constants.d.ts.map +1 -0
- package/lib/http/telemetry/evaluateTelemetryOptions.d.ts +11 -0
- package/lib/http/telemetry/evaluateTelemetryOptions.d.ts.map +1 -0
- package/lib/http/telemetry/metricsDefinition.d.ts +3 -0
- package/lib/http/telemetry/metricsDefinition.d.ts.map +1 -0
- package/lib/http/telemetry/openTelemetryCollector.d.ts +53 -0
- package/lib/http/telemetry/openTelemetryCollector.d.ts.map +1 -0
- package/lib/http/telemetry/pinoLogger.d.ts +20 -0
- package/lib/http/telemetry/pinoLogger.d.ts.map +1 -0
- package/lib/http/telemetry/recordMetric.d.ts +5 -0
- package/lib/http/telemetry/recordMetric.d.ts.map +1 -0
- package/lib/http/types/apiDefinition.types.d.ts +471 -0
- package/lib/http/types/apiDefinition.types.d.ts.map +1 -0
- package/lib/http/types/contractDetails.types.d.ts +404 -0
- package/lib/http/types/contractDetails.types.d.ts.map +1 -0
- package/lib/http/types/docsConfiguration.types.d.ts +7 -0
- package/lib/http/types/docsConfiguration.types.d.ts.map +1 -0
- package/lib/http/types/expressLikeOptions.d.ts +224 -0
- package/lib/http/types/expressLikeOptions.d.ts.map +1 -0
- package/lib/http/types/expressLikeRouter.types.d.ts +127 -0
- package/lib/http/types/expressLikeRouter.types.d.ts.map +1 -0
- package/lib/http/types/openTelemetryCollector.types.d.ts +21 -0
- package/lib/http/types/openTelemetryCollector.types.d.ts.map +1 -0
- package/lib/http/types/router.types.d.ts +52 -0
- package/lib/http/types/router.types.d.ts.map +1 -0
- package/lib/http/types/sdk.types.d.ts +259 -0
- package/lib/http/types/sdk.types.d.ts.map +1 -0
- package/lib/http/types/typedHandler.types.d.ts +18 -0
- package/lib/http/types/typedHandler.types.d.ts.map +1 -0
- package/lib/mappers/guards/isSchemaResolutionFunction.d.ts +10 -0
- package/lib/mappers/guards/isSchemaResolutionFunction.d.ts.map +1 -0
- package/lib/mappers/index.d.ts +3 -68
- package/lib/mappers/index.d.ts.map +1 -0
- package/lib/mappers/mapServiceSchemas.d.ts +33 -0
- package/lib/mappers/mapServiceSchemas.d.ts.map +1 -0
- package/lib/mappers/mapper.d.ts +26 -0
- package/lib/mappers/mapper.d.ts.map +1 -0
- package/lib/mappers/types/schemaResolution.types.d.ts +9 -0
- package/lib/mappers/types/schemaResolution.types.d.ts.map +1 -0
- package/lib/objectstore/index.d.ts +3 -71
- package/lib/objectstore/index.d.ts.map +1 -0
- package/lib/objectstore/{index.d.mts → interfaces/objectstore.interface.d.ts} +3 -16
- package/lib/objectstore/interfaces/objectstore.interface.d.ts.map +1 -0
- package/lib/objectstore/objectstoreKey.d.ts +11 -0
- package/lib/objectstore/objectstoreKey.d.ts.map +1 -0
- package/lib/persistence/complianceEventSubscriber.d.ts +13 -0
- package/lib/persistence/complianceEventSubscriber.d.ts.map +1 -0
- package/lib/persistence/compliancePropertyBuilder.d.ts +26 -0
- package/lib/persistence/compliancePropertyBuilder.d.ts.map +1 -0
- package/lib/persistence/complianceTypes.d.ts +64 -0
- package/lib/persistence/complianceTypes.d.ts.map +1 -0
- package/lib/persistence/defineComplianceEntity.d.ts +19 -0
- package/lib/persistence/defineComplianceEntity.d.ts.map +1 -0
- package/lib/persistence/encryptedType.d.ts +85 -0
- package/lib/persistence/encryptedType.d.ts.map +1 -0
- package/lib/persistence/fieldEncryptor.d.ts +48 -0
- package/lib/persistence/fieldEncryptor.d.ts.map +1 -0
- package/lib/persistence/index.d.ts +10 -403
- package/lib/persistence/index.d.ts.map +1 -0
- package/lib/persistence/index.js.map +1 -1
- package/lib/persistence/index.mjs.map +1 -1
- package/lib/persistence/rls.d.ts +56 -0
- package/lib/persistence/rls.d.ts.map +1 -0
- package/lib/persistence/tenantEm.d.ts +60 -0
- package/lib/persistence/tenantEm.d.ts.map +1 -0
- package/lib/persistence/tenantFilter.d.ts +47 -0
- package/lib/persistence/tenantFilter.d.ts.map +1 -0
- package/lib/secrets/index.d.ts +2 -0
- package/lib/secrets/index.d.ts.map +1 -0
- package/lib/secrets/secretsAccessor.d.ts +17 -0
- package/lib/secrets/secretsAccessor.d.ts.map +1 -0
- package/lib/services/complianceDataService.d.ts +47 -0
- package/lib/services/complianceDataService.d.ts.map +1 -0
- package/lib/services/configInjector.d.ts +43 -0
- package/lib/services/configInjector.d.ts.map +1 -0
- package/lib/services/guards/isConstructed.d.ts +3 -0
- package/lib/services/guards/isConstructed.d.ts.map +1 -0
- package/lib/services/guards/isConstructedSingleton.d.ts +3 -0
- package/lib/services/guards/isConstructedSingleton.d.ts.map +1 -0
- package/lib/services/guards/isConstructor.d.ts +3 -0
- package/lib/services/guards/isConstructor.d.ts.map +1 -0
- package/lib/services/index.d.ts +10 -184
- package/lib/services/index.d.ts.map +1 -0
- package/lib/services/retentionService.d.ts +31 -0
- package/lib/services/retentionService.d.ts.map +1 -0
- package/lib/services/runRetentionEnforcement.d.ts +19 -0
- package/lib/services/runRetentionEnforcement.d.ts.map +1 -0
- package/lib/services/types/configInjector.types.d.ts +39 -0
- package/lib/services/types/configInjector.types.d.ts.map +1 -0
- package/lib/services/types/entityManager.types.d.ts +4 -0
- package/lib/services/types/entityManager.types.d.ts.map +1 -0
- package/lib/services/types/service.types.d.ts +5 -0
- package/lib/services/types/service.types.d.ts.map +1 -0
- package/lib/ws/asyncApiV3Generator/asyncApiV3Generator.d.ts +12 -0
- package/lib/ws/asyncApiV3Generator/asyncApiV3Generator.d.ts.map +1 -0
- package/lib/ws/index.d.ts +4 -67
- package/lib/ws/index.d.ts.map +1 -0
- package/lib/ws/index.js.map +1 -1
- package/lib/ws/index.mjs.map +1 -1
- package/lib/ws/types/eventSchema.types.d.ts +28 -0
- package/lib/ws/types/eventSchema.types.d.ts.map +1 -0
- package/lib/ws/webSocketLike.d.ts +18 -0
- package/lib/ws/webSocketLike.d.ts.map +1 -0
- package/package.json +47 -46
- package/LICENSE +0 -21
- package/lib/apiDefinition.types-DF_crhB0.d.mts +0 -1092
- package/lib/apiDefinition.types-DW4lfZqy.d.ts +0 -1092
- package/lib/http/index.d.mts +0 -1244
- package/lib/mappers/index.d.mts +0 -68
- package/lib/openTelemetryCollector-BS-ej09T.d.mts +0 -70
- package/lib/openTelemetryCollector-BS-ej09T.d.ts +0 -70
- package/lib/persistence/index.d.mts +0 -403
- package/lib/services/index.d.mts +0 -185
- package/lib/ttlCache.interface-CEOkrt8d.d.mts +0 -77
- package/lib/ttlCacheRecord.types-oX0ti5SP.d.ts +0 -25
- package/lib/ws/index.d.mts +0 -67
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
export { T as TtlCache } from '../ttlCache.interface-CEOkrt8d.mjs';
|
|
2
|
-
export { C as ComplianceContext, T as TtlCacheRecord } from '../ttlCacheRecord.types-oX0ti5SP.mjs';
|
|
3
|
-
|
|
4
1
|
/**
|
|
5
2
|
* Creates a function that generates cache keys with a given prefix.
|
|
6
3
|
*
|
|
@@ -10,6 +7,5 @@ export { C as ComplianceContext, T as TtlCacheRecord } from '../ttlCacheRecord.t
|
|
|
10
7
|
* const createUserCacheKey = createCacheKey('user');
|
|
11
8
|
* const key = createUserCacheKey('123'); // Returns 'user:123'
|
|
12
9
|
*/
|
|
13
|
-
declare const createCacheKey: (cacheKeyPrefix: string) => (id: string) => string;
|
|
14
|
-
|
|
15
|
-
export { createCacheKey };
|
|
10
|
+
export declare const createCacheKey: (cacheKeyPrefix: string) => (id: string) => string;
|
|
11
|
+
//# sourceMappingURL=cacheKey.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cacheKey.d.ts","sourceRoot":"","sources":["../../src/cache/cacheKey.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,mBAAoB,MAAM,UAAU,MAAM,WAEpE,CAAC"}
|
package/lib/cache/index.d.ts
CHANGED
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* Creates a function that generates cache keys with a given prefix.
|
|
6
|
-
*
|
|
7
|
-
* @param {string} cacheKeyPrefix - The prefix to use for all cache keys
|
|
8
|
-
* @returns {Function} A function that takes an ID and returns a formatted cache key
|
|
9
|
-
* @example
|
|
10
|
-
* const createUserCacheKey = createCacheKey('user');
|
|
11
|
-
* const key = createUserCacheKey('123'); // Returns 'user:123'
|
|
12
|
-
*/
|
|
13
|
-
declare const createCacheKey: (cacheKeyPrefix: string) => (id: string) => string;
|
|
14
|
-
|
|
15
|
-
export { createCacheKey };
|
|
1
|
+
export * from './cacheKey';
|
|
2
|
+
export * from './interfaces/ttlCache.interface';
|
|
3
|
+
export * from './types/ttlCacheRecord.types';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cache/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { ComplianceContext, TtlCacheRecord } from '../types/ttlCacheRecord.types';
|
|
3
2
|
/**
|
|
4
3
|
* Interface representing a TTL (Time-To-Live) cache.
|
|
5
4
|
*
|
|
@@ -7,7 +6,7 @@ import { T as TtlCacheRecord, C as ComplianceContext } from './ttlCacheRecord.ty
|
|
|
7
6
|
* When provided, values are encrypted on write and decrypted on read using
|
|
8
7
|
* the tenant ID for key derivation. When omitted, values are stored as plaintext.
|
|
9
8
|
*/
|
|
10
|
-
interface TtlCache {
|
|
9
|
+
export interface TtlCache {
|
|
11
10
|
/**
|
|
12
11
|
* Puts a record into the cache.
|
|
13
12
|
*/
|
|
@@ -73,5 +72,4 @@ interface TtlCache {
|
|
|
73
72
|
*/
|
|
74
73
|
listKeys(pattern_prefix: string): Promise<string[]>;
|
|
75
74
|
}
|
|
76
|
-
|
|
77
|
-
export type { TtlCache as T };
|
|
75
|
+
//# sourceMappingURL=ttlCache.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ttlCache.interface.d.ts","sourceRoot":"","sources":["../../../src/cache/interfaces/ttlCache.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,cAAc,EACf,MAAM,+BAA+B,CAAC;AAEvC;;;;;;GAMG;AACH,MAAM,WAAW,QAAQ;IACvB;;OAEG;IACH,SAAS,CAAC,CAAC,EACT,WAAW,EAAE,cAAc,CAAC,CAAC,CAAC,EAC9B,UAAU,CAAC,EAAE,iBAAiB,GAC7B,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjB;;OAEG;IACH,eAAe,CAAC,CAAC,EACf,YAAY,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,EACjC,UAAU,CAAC,EAAE,iBAAiB,GAC7B,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjB;;OAEG;IACH,aAAa,CAAC,CAAC,EACb,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,CAAC,EACd,UAAU,CAAC,EAAE,iBAAiB,GAC7B,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjB;;OAEG;IACH,mBAAmB,CAAC,CAAC,EACnB,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,CAAC,EAAE,EACjB,UAAU,CAAC,EAAE,iBAAiB,GAC7B,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjB;;OAEG;IACH,YAAY,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEpD;;OAEG;IACH,kBAAkB,CAAC,eAAe,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE7D;;OAEG;IACH,aAAa,CAAC,CAAC,EACb,SAAS,EAAE,MAAM,EACjB,UAAU,CAAC,EAAE,iBAAiB,GAC7B,OAAO,CAAC,CAAC,CAAC,CAAC;IAEd;;OAEG;IACH,mBAAmB,CAAC,CAAC,EACnB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,iBAAiB,GAC7B,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;IAEhB;;OAEG;IACH,UAAU,CAAC,CAAC,EACV,cAAc,EAAE,MAAM,EACtB,UAAU,CAAC,EAAE,iBAAiB,GAC7B,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;IAE9B;;OAEG;IACH,gBAAgB,CAAC,CAAC,EAChB,uBAAuB,EAAE,MAAM,EAAE,GAAG,MAAM,EAC1C,UAAU,CAAC,EAAE,iBAAiB,GAC7B,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAEhC;;OAEG;IACH,UAAU,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAErD;;OAEG;IACH,gBAAgB,CACd,uBAAuB,EAAE,MAAM,EAAE,GAAG,MAAM,GACzC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IAEtB;;OAEG;IACH,eAAe,CAAC,CAAC,EACf,SAAS,EAAE,MAAM,EACjB,UAAU,CAAC,EAAE,iBAAiB,GAC7B,OAAO,CAAC,CAAC,CAAC,CAAC;IAEd;;OAEG;IACH,gBAAgB,CAAC,CAAC,EAChB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,iBAAiB,GAC7B,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;IAEhB;;OAEG;IACH,kBAAkB,IAAI,MAAM,CAAC;IAE7B;;OAEG;IACH,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;CACrD"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @property {any} value - The value of the cache record.
|
|
7
7
|
* @property {number} ttlMilliseconds - The time-to-live of the cache record in milliseconds.
|
|
8
8
|
*/
|
|
9
|
-
type TtlCacheRecord<T> = {
|
|
9
|
+
export type TtlCacheRecord<T> = {
|
|
10
10
|
key: string;
|
|
11
11
|
value: T;
|
|
12
12
|
ttlMilliseconds: number;
|
|
@@ -18,8 +18,7 @@ type TtlCacheRecord<T> = {
|
|
|
18
18
|
*
|
|
19
19
|
* Used by both TtlCache (Redis) and ObjectStore (S3).
|
|
20
20
|
*/
|
|
21
|
-
interface ComplianceContext {
|
|
21
|
+
export interface ComplianceContext {
|
|
22
22
|
tenantId: string;
|
|
23
23
|
}
|
|
24
|
-
|
|
25
|
-
export type { ComplianceContext as C, TtlCacheRecord as T };
|
|
24
|
+
//# sourceMappingURL=ttlCacheRecord.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ttlCacheRecord.types.d.ts","sourceRoot":"","sources":["../../../src/cache/types/ttlCacheRecord.types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,CAAC,CAAC;IACT,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;CAClB"}
|
|
@@ -1,13 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* @template Service - The service type that this controller wraps
|
|
5
|
-
*
|
|
6
|
-
*/
|
|
7
|
-
type Controller<Service> = {
|
|
8
|
-
[K in keyof Service]: unknown;
|
|
9
|
-
} & {
|
|
10
|
-
[K: string]: unknown;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export type { Controller };
|
|
1
|
+
export * from './interfaces/controller.interface';
|
|
2
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/controllers/index.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC"}
|
|
@@ -4,10 +4,9 @@
|
|
|
4
4
|
* @template Service - The service type that this controller wraps
|
|
5
5
|
*
|
|
6
6
|
*/
|
|
7
|
-
type Controller<Service> = {
|
|
7
|
+
export type Controller<Service> = {
|
|
8
8
|
[K in keyof Service]: unknown;
|
|
9
9
|
} & {
|
|
10
10
|
[K: string]: unknown;
|
|
11
11
|
};
|
|
12
|
-
|
|
13
|
-
export type { Controller };
|
|
12
|
+
//# sourceMappingURL=controller.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controller.interface.d.ts","sourceRoot":"","sources":["../../../src/controllers/interfaces/controller.interface.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,UAAU,CAAC,OAAO,IAAI;KAC/B,CAAC,IAAI,MAAM,OAAO,GAAG,OAAO;CAC9B,GAAG;IACF,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtB,CAAC"}
|
|
@@ -1,28 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* Root detection uses: .forklaunch/manifest.toml
|
|
4
|
-
*/
|
|
5
|
-
declare function getCascadingEnvPaths(projectEnvPath: string | undefined, projectRoot?: string): {
|
|
6
|
-
rootEnvExists: boolean;
|
|
7
|
-
projectEnvExists: boolean;
|
|
8
|
-
rootEnvPath?: string;
|
|
9
|
-
projectEnvFilePath?: string;
|
|
10
|
-
loadOrder: string[];
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Loads environment variables with cascading precedence: all .env.local files from root to project, then project env file
|
|
14
|
-
*/
|
|
15
|
-
declare function loadCascadingEnv(projectEnvPath: string | undefined, projectRoot?: string): {
|
|
16
|
-
rootEnvLoaded: boolean;
|
|
17
|
-
projectEnvLoaded: boolean;
|
|
18
|
-
rootEnvPath?: string;
|
|
19
|
-
projectEnvFilePath?: string;
|
|
20
|
-
envFilesLoaded: string[];
|
|
21
|
-
totalEnvFilesLoaded: number;
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* Finds application root by looking for .forklaunch/manifest.toml
|
|
25
|
-
*/
|
|
26
|
-
declare function findApplicationRoot(startPath: string): string;
|
|
27
|
-
|
|
28
|
-
export { findApplicationRoot, getCascadingEnvPaths, loadCascadingEnv };
|
|
1
|
+
export * from './loadCascadingEnv';
|
|
2
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/environment/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Gets cascading environment file paths: collects all .env.local files from project directory up to root
|
|
3
3
|
* Root detection uses: .forklaunch/manifest.toml
|
|
4
4
|
*/
|
|
5
|
-
declare function getCascadingEnvPaths(projectEnvPath: string | undefined, projectRoot?: string): {
|
|
5
|
+
export declare function getCascadingEnvPaths(projectEnvPath: string | undefined, projectRoot?: string): {
|
|
6
6
|
rootEnvExists: boolean;
|
|
7
7
|
projectEnvExists: boolean;
|
|
8
8
|
rootEnvPath?: string;
|
|
@@ -12,7 +12,7 @@ declare function getCascadingEnvPaths(projectEnvPath: string | undefined, projec
|
|
|
12
12
|
/**
|
|
13
13
|
* Loads environment variables with cascading precedence: all .env.local files from root to project, then project env file
|
|
14
14
|
*/
|
|
15
|
-
declare function loadCascadingEnv(projectEnvPath: string | undefined, projectRoot?: string): {
|
|
15
|
+
export declare function loadCascadingEnv(projectEnvPath: string | undefined, projectRoot?: string): {
|
|
16
16
|
rootEnvLoaded: boolean;
|
|
17
17
|
projectEnvLoaded: boolean;
|
|
18
18
|
rootEnvPath?: string;
|
|
@@ -23,6 +23,5 @@ declare function loadCascadingEnv(projectEnvPath: string | undefined, projectRoo
|
|
|
23
23
|
/**
|
|
24
24
|
* Finds application root by looking for .forklaunch/manifest.toml
|
|
25
25
|
*/
|
|
26
|
-
declare function findApplicationRoot(startPath: string): string;
|
|
27
|
-
|
|
28
|
-
export { findApplicationRoot, getCascadingEnvPaths, loadCascadingEnv };
|
|
26
|
+
export declare function findApplicationRoot(startPath: string): string;
|
|
27
|
+
//# sourceMappingURL=loadCascadingEnv.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loadCascadingEnv.d.ts","sourceRoot":"","sources":["../../src/environment/loadCascadingEnv.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,cAAc,EAAE,MAAM,GAAG,SAAS,EAClC,WAAW,GAAE,MAAsB,GAClC;IACD,aAAa,EAAE,OAAO,CAAC;IACvB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAgCA;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,cAAc,EAAE,MAAM,GAAG,SAAS,EAClC,WAAW,GAAE,MAAsB,GAClC;IACD,aAAa,EAAE,OAAO,CAAC;IACvB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,mBAAmB,EAAE,MAAM,CAAC;CAC7B,CAqCA;AAoCD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CA0B7D"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { EmptyObject } from '@forklaunch/common';
|
|
2
|
+
import { AnySchemaValidator } from '@forklaunch/validator';
|
|
3
|
+
import { ExpressLikeRouter } from '../interfaces/expressLikeRouter.interface';
|
|
4
|
+
import { ForklaunchExpressLikeRouter } from '../router/expressLikeRouter';
|
|
5
|
+
import { OpenTelemetryCollector } from '../telemetry/openTelemetryCollector';
|
|
6
|
+
import { SessionObject } from '../types/contractDetails.types';
|
|
7
|
+
import { ExpressLikeApplicationOptions } from '../types/expressLikeOptions';
|
|
8
|
+
import { MetricsDefinition } from '../types/openTelemetryCollector.types';
|
|
9
|
+
/**
|
|
10
|
+
* ForklaunchExpressLikeApplication class that sets up routes and middleware for an Express-like application, for use with controller/routes pattern.
|
|
11
|
+
*
|
|
12
|
+
* @template SV - A type that extends AnySchemaValidator.
|
|
13
|
+
* @template Server - The server type.
|
|
14
|
+
*/
|
|
15
|
+
export declare abstract class ForklaunchExpressLikeApplication<SV extends AnySchemaValidator, Server extends ExpressLikeRouter<RouterHandler, Server>, RouterHandler, BaseRequest, BaseResponse, NextFunction, Session extends SessionObject<SV>, FetchMap extends Record<string, unknown> = EmptyObject, Sdk extends Record<string, unknown> = EmptyObject> extends ForklaunchExpressLikeRouter<SV, '/', RouterHandler, Server, BaseRequest, BaseResponse, NextFunction, Session, FetchMap, Sdk> {
|
|
16
|
+
readonly schemaValidator: SV;
|
|
17
|
+
readonly internal: Server;
|
|
18
|
+
readonly postEnrichMiddleware: RouterHandler[];
|
|
19
|
+
readonly openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>;
|
|
20
|
+
readonly appOptions?: ExpressLikeApplicationOptions<SV, Session> | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Creates an instance of the Application class.
|
|
23
|
+
*
|
|
24
|
+
* @param {SV} schemaValidator - The schema validator.
|
|
25
|
+
*/
|
|
26
|
+
constructor(schemaValidator: SV, internal: Server, postEnrichMiddleware: RouterHandler[], openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>, appOptions?: ExpressLikeApplicationOptions<SV, Session> | undefined);
|
|
27
|
+
/**
|
|
28
|
+
* Validates all registered routes across the app and all mounted routers.
|
|
29
|
+
* Call this at the start of listen() to fail fast at startup.
|
|
30
|
+
*/
|
|
31
|
+
protected validateAllRoutes(): void;
|
|
32
|
+
abstract listen(...args: unknown[]): void;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=expressLikeApplication.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expressLikeApplication.d.ts","sourceRoot":"","sources":["../../../src/http/application/expressLikeApplication.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAE9E,OAAO,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,6BAA6B,EAAE,MAAM,6BAA6B,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAE1E;;;;;GAKG;AACH,8BAAsB,gCAAgC,CACpD,EAAE,SAAS,kBAAkB,EAC7B,MAAM,SAAS,iBAAiB,CAAC,aAAa,EAAE,MAAM,CAAC,EACvD,aAAa,EACb,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,OAAO,SAAS,aAAa,CAAC,EAAE,CAAC,EACjC,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,WAAW,EACtD,GAAG,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,WAAW,CACjD,SAAQ,2BAA2B,CACnC,EAAE,EACF,GAAG,EACH,aAAa,EACb,MAAM,EACN,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,OAAO,EACP,QAAQ,EACR,GAAG,CACJ;IAOG,QAAQ,CAAC,eAAe,EAAE,EAAE;IAC5B,QAAQ,CAAC,QAAQ,EAAE,MAAM;IACzB,QAAQ,CAAC,oBAAoB,EAAE,aAAa,EAAE;IAC9C,QAAQ,CAAC,sBAAsB,EAAE,sBAAsB,CAAC,iBAAiB,CAAC;IAC1E,QAAQ,CAAC,UAAU,CAAC,EAAE,6BAA6B,CAAC,EAAE,EAAE,OAAO,CAAC;IAVlE;;;;OAIG;IACH,YACW,eAAe,EAAE,EAAE,EACnB,QAAQ,EAAE,MAAM,EAChB,oBAAoB,EAAE,aAAa,EAAE,EACrC,sBAAsB,EAAE,sBAAsB,CAAC,iBAAiB,CAAC,EACjE,UAAU,CAAC,EAAE,6BAA6B,CAAC,EAAE,EAAE,OAAO,CAAC,YAAA,EAgBjE;IAED;;;OAGG;IACH,SAAS,CAAC,iBAAiB,SAE1B;IAED,QAAQ,CAAC,MAAM,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;CAC3C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listen.d.ts","sourceRoot":"","sources":["../../../src/http/bootstrap/listen.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { OpenTelemetryCollector } from '../telemetry/openTelemetryCollector';
|
|
2
|
+
import { MetricsDefinition } from '../types/openTelemetryCollector.types';
|
|
3
|
+
export type RoutingStrategy = 'round-robin' | 'sticky' | 'random';
|
|
4
|
+
export interface ClusterConfig<ExpressApp> {
|
|
5
|
+
port: number;
|
|
6
|
+
host: string;
|
|
7
|
+
workerCount: number;
|
|
8
|
+
routingStrategy?: RoutingStrategy;
|
|
9
|
+
expressApp: ExpressApp;
|
|
10
|
+
openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>;
|
|
11
|
+
ssl?: {
|
|
12
|
+
keyFile: string;
|
|
13
|
+
certFile: string;
|
|
14
|
+
caFile: string;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=cluster.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cluster.types.d.ts","sourceRoot":"","sources":["../../../src/http/cluster/cluster.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAE1E,MAAM,MAAM,eAAe,GAAG,aAAa,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAElE,MAAM,WAAW,aAAa,CAAC,UAAU;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,UAAU,EAAE,UAAU,CAAC;IACvB,sBAAsB,EAAE,sBAAsB,CAAC,iBAAiB,CAAC,CAAC;IAClE,GAAG,CAAC,EAAE;QACJ,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;CACH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isPortBound.d.ts","sourceRoot":"","sources":["../../../src/http/cluster/isPortBound.ts"],"names":[],"mappings":"AAEA,wBAAgB,WAAW,CACzB,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE,MAAoB,GACzB,OAAO,CAAC,OAAO,CAAC,CAsBlB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates an HMAC token for a given method, path, body, timestamp, nonce, and secret key.
|
|
3
|
+
* @param method - The HTTP method to use.
|
|
4
|
+
* @param path - The path to use.
|
|
5
|
+
* @param body - The body to use.
|
|
6
|
+
* @param timestamp - The timestamp to use.
|
|
7
|
+
* @param nonce - The nonce to use.
|
|
8
|
+
* @param secretKey - The secret key to use.
|
|
9
|
+
* @returns The HMAC token.
|
|
10
|
+
*/
|
|
11
|
+
export declare function createHmacToken({ method, path, body, timestamp, nonce, secretKey }: {
|
|
12
|
+
method: string;
|
|
13
|
+
path: string;
|
|
14
|
+
body?: unknown;
|
|
15
|
+
timestamp: Date;
|
|
16
|
+
nonce: string;
|
|
17
|
+
secretKey: string;
|
|
18
|
+
}): string;
|
|
19
|
+
//# sourceMappingURL=createHmacToken.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createHmacToken.d.ts","sourceRoot":"","sources":["../../src/http/createHmacToken.ts"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,EAC9B,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,SAAS,EACT,KAAK,EACL,SAAS,EACV,EAAE;IACD,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,SAAS,EAAE,IAAI,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB,UAOA"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { AnySchemaValidator } from '@forklaunch/validator';
|
|
2
|
+
import { JWK, JWTPayload } from 'jose';
|
|
3
|
+
import { ParsedQs } from 'qs';
|
|
4
|
+
import { OpenTelemetryCollector } from './telemetry/openTelemetryCollector';
|
|
5
|
+
import { VersionedRequests } from './types/apiDefinition.types';
|
|
6
|
+
import { AuthMethods, BasicAuthMethods, DecodeResource, ParamsDictionary } from './types/contractDetails.types';
|
|
7
|
+
import { MetricsDefinition } from './types/openTelemetryCollector.types';
|
|
8
|
+
/**
|
|
9
|
+
* Retrieves and caches the JSON Web Key Set (JWKS) from a given public key URL.
|
|
10
|
+
*
|
|
11
|
+
* This function fetches the JWKS from the specified URL and caches the result in memory
|
|
12
|
+
* to avoid unnecessary network requests. The cache is considered valid for a duration
|
|
13
|
+
* specified by the `cache-control` header in the JWKS HTTP response (in seconds), or
|
|
14
|
+
* falls back to a default TTL if the header is not present. If the cache is still valid,
|
|
15
|
+
* the cached keys are returned immediately.
|
|
16
|
+
*
|
|
17
|
+
* @param {string} jwksPublicKeyUrl - The URL to fetch the JWKS from.
|
|
18
|
+
* @returns {Promise<JWK[]>} A promise that resolves to an array of JWK objects.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* const jwks = await getCachedJwks('https://example.com/.well-known/jwks.json');
|
|
22
|
+
* // Use jwks for JWT verification, etc.
|
|
23
|
+
*/
|
|
24
|
+
export declare function getCachedJwks(jwksPublicKeyUrl: string): Promise<JWK[]>;
|
|
25
|
+
/**
|
|
26
|
+
* Discriminates between different authentication methods and returns a typed result.
|
|
27
|
+
*
|
|
28
|
+
* This function analyzes the provided authentication configuration and determines
|
|
29
|
+
* whether it uses basic authentication or JWT authentication. It returns a
|
|
30
|
+
* discriminated union type that includes the authentication type and the
|
|
31
|
+
* corresponding authentication configuration.
|
|
32
|
+
*
|
|
33
|
+
* @template SV - A type that extends AnySchemaValidator
|
|
34
|
+
* @template P - A type that extends ParamsDictionary
|
|
35
|
+
* @template ReqBody - A type that extends Record<string, unknown>
|
|
36
|
+
* @template ReqQuery - A type that extends ParsedQs
|
|
37
|
+
* @template ReqHeaders - A type that extends Record<string, unknown>
|
|
38
|
+
* @template BaseRequest - The base request type
|
|
39
|
+
*
|
|
40
|
+
* @param auth - The authentication methods configuration object
|
|
41
|
+
* @returns A discriminated union object with either:
|
|
42
|
+
* - `{ type: 'basic', auth: BasicAuthMethods['basic'] }` for basic authentication
|
|
43
|
+
* - `{ type: 'jwt', auth?: JwtAuthMethods['jwt'] }` for JWT authentication (auth is optional)
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```typescript
|
|
47
|
+
* const authConfig = {
|
|
48
|
+
* basic: {
|
|
49
|
+
* login: (username: string, password: string) => boolean
|
|
50
|
+
* }
|
|
51
|
+
* };
|
|
52
|
+
* const result = discriminateAuthMethod(authConfig);
|
|
53
|
+
* // result.type === 'basic'
|
|
54
|
+
* // result.auth === authConfig.basic
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export declare function discriminateAuthMethod<SV extends AnySchemaValidator, P extends ParamsDictionary, ReqBody extends Record<string, unknown>, ReqQuery extends ParsedQs, ReqHeaders extends Record<string, string>, VersionedReqs extends VersionedRequests, BaseRequest>(auth: AuthMethods<SV, P, ReqBody, ReqQuery, ReqHeaders, VersionedReqs, BaseRequest>, openTelemetryCollector?: OpenTelemetryCollector<MetricsDefinition>): Promise<{
|
|
58
|
+
type: 'basic';
|
|
59
|
+
auth: {
|
|
60
|
+
decodeResource?: DecodeResource;
|
|
61
|
+
login: BasicAuthMethods['basic']['login'];
|
|
62
|
+
};
|
|
63
|
+
} | {
|
|
64
|
+
type: 'jwt';
|
|
65
|
+
auth: {
|
|
66
|
+
decodeResource?: DecodeResource;
|
|
67
|
+
} | {
|
|
68
|
+
verificationFunction: (token: string) => Promise<JWTPayload | undefined>;
|
|
69
|
+
};
|
|
70
|
+
} | {
|
|
71
|
+
type: 'hmac';
|
|
72
|
+
auth: {
|
|
73
|
+
secretKeys: Record<string, string>;
|
|
74
|
+
verificationFunction: ({ body, path, method, timestamp, nonce, signature, secretKey }: {
|
|
75
|
+
method: string;
|
|
76
|
+
path: string;
|
|
77
|
+
body?: unknown;
|
|
78
|
+
timestamp: Date;
|
|
79
|
+
nonce: string;
|
|
80
|
+
signature: string;
|
|
81
|
+
secretKey: string;
|
|
82
|
+
}) => Promise<boolean | undefined>;
|
|
83
|
+
};
|
|
84
|
+
}>;
|
|
85
|
+
//# sourceMappingURL=discriminateAuthMethod.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discriminateAuthMethod.d.ts","sourceRoot":"","sources":["../../src/http/discriminateAuthMethod.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,GAAG,EAAE,UAAU,EAAa,MAAM,MAAM,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAK9B,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EACjB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAYzE;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,aAAa,CAAC,gBAAgB,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CA4B5E;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAsB,sBAAsB,CAC1C,EAAE,SAAS,kBAAkB,EAC7B,CAAC,SAAS,gBAAgB,EAC1B,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACvC,QAAQ,SAAS,QAAQ,EACzB,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACzC,aAAa,SAAS,iBAAiB,EACvC,WAAW,EAEX,IAAI,EAAE,WAAW,CACf,EAAE,EACF,CAAC,EACD,OAAO,EACP,QAAQ,EACR,UAAU,EACV,aAAa,EACb,WAAW,CACZ,EACD,sBAAsB,CAAC,EAAE,sBAAsB,CAAC,iBAAiB,CAAC,GACjE,OAAO,CACN;IACE,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE;QACJ,cAAc,CAAC,EAAE,cAAc,CAAC;QAChC,KAAK,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC;KAC3C,CAAC;CACH,GACD;IACE,IAAI,EAAE,KAAK,CAAC;IACZ,IAAI,EACA;QACE,cAAc,CAAC,EAAE,cAAc,CAAC;KACjC,GACD;QACE,oBAAoB,EAAE,CACpB,KAAK,EAAE,MAAM,KACV,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC;KACtC,CAAC;CACP,GACD;IACE,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE;QACJ,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACnC,oBAAoB,EAAE,CAAC,EACrB,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,SAAS,EACT,KAAK,EACL,SAAS,EACT,SAAS,EACV,EAAE;YACD,MAAM,EAAE,MAAM,CAAC;YACf,IAAI,EAAE,MAAM,CAAC;YACb,IAAI,CAAC,EAAE,OAAO,CAAC;YACf,SAAS,EAAE,IAAI,CAAC;YAChB,KAAK,EAAE,MAAM,CAAC;YACd,SAAS,EAAE,MAAM,CAAC;YAClB,SAAS,EAAE,MAAM,CAAC;SACnB,KAAK,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,CAAC;KACpC,CAAC;CACH,CACJ,CA+GA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate HMAC authorization headers for service-to-service authentication.
|
|
3
|
+
*
|
|
4
|
+
* @param secretKey - The shared HMAC secret key
|
|
5
|
+
* @param method - HTTP method (GET, POST, etc.)
|
|
6
|
+
* @param path - The API path
|
|
7
|
+
* @param body - Optional request body
|
|
8
|
+
* @param keyId - Optional key identifier (defaults to 'default')
|
|
9
|
+
* @returns Authorization header object
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* const headers = generateHmacAuthHeaders({
|
|
14
|
+
* secretKey: 'my-secret-key',
|
|
15
|
+
* method: 'POST',
|
|
16
|
+
* path: '/api/users',
|
|
17
|
+
* body: { name: 'John' }
|
|
18
|
+
* });
|
|
19
|
+
* // headers.authorization = 'HMAC keyId=default ts=2024-01-16T12:00:00.000Z nonce=... signature=...'
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare function generateHmacAuthHeaders({ secretKey, method, path, body, keyId }: {
|
|
23
|
+
secretKey: string;
|
|
24
|
+
method: string;
|
|
25
|
+
path: string;
|
|
26
|
+
body?: unknown;
|
|
27
|
+
keyId?: string;
|
|
28
|
+
}): {
|
|
29
|
+
authorization: `HMAC keyId=${string} ts=${string} nonce=${string} signature=${string}`;
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=generateHmacAuthHeaders.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateHmacAuthHeaders.d.ts","sourceRoot":"","sources":["../../src/http/generateHmacAuthHeaders.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,SAAS,EACT,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,KAAiB,EAClB,EAAE;IACD,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,GAAG;IACF,aAAa,EAAE,cAAc,MAAM,OAAO,MAAM,UAAU,MAAM,cAAc,MAAM,EAAE,CAAC;CACxF,CAgBA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hasFeatureChecks.d.ts","sourceRoot":"","sources":["../../../src/http/guards/hasFeatureChecks.ts"],"names":[],"mappings":"AAAA,wBAAgB,gBAAgB,CAAC,gBAAgB,EAAE,OAAO,WAQzD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hasPermissionChecks.d.ts","sourceRoot":"","sources":["../../../src/http/guards/hasPermissionChecks.ts"],"names":[],"mappings":"AAAA,wBAAgB,mBAAmB,CAAC,qBAAqB,EAAE,OAAO,WAmBjE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hasRoleChecks.d.ts","sourceRoot":"","sources":["../../../src/http/guards/hasRoleChecks.ts"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,CAAC,cAAc,EAAE,OAAO,GAAG,OAAO,CAgB9D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hasScopeChecks.d.ts","sourceRoot":"","sources":["../../../src/http/guards/hasScopeChecks.ts"],"names":[],"mappings":"AAAA,wBAAgB,cAAc,CAAC,qBAAqB,EAAE,OAAO,WAO5D"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type guard that checks if an object has a `send` method.
|
|
3
|
+
*
|
|
4
|
+
* @param res - The object to check for the presence of a `send` method
|
|
5
|
+
* @returns A type predicate indicating whether the object has a `send` method
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* if (hasSend(response)) {
|
|
10
|
+
* response.send('Hello World');
|
|
11
|
+
* }
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export declare function hasSend(res: unknown): res is {
|
|
15
|
+
send: (body: unknown) => void;
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=hasSend.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hasSend.d.ts","sourceRoot":"","sources":["../../../src/http/guards/hasSend.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,wBAAgB,OAAO,CACrB,GAAG,EAAE,OAAO,GACX,GAAG,IAAI;IAAE,IAAI,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;CAAE,CAE1C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hasSubscriptionChecks.d.ts","sourceRoot":"","sources":["../../../src/http/guards/hasSubscriptionChecks.ts"],"names":[],"mappings":"AAAA,wBAAgB,qBAAqB,CAAC,qBAAqB,EAAE,OAAO,WAOnE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hasVersionedSchema.d.ts","sourceRoot":"","sources":["../../../src/http/guards/hasVersionedSchema.ts"],"names":[],"mappings":"AAAA,wBAAgB,kBAAkB,CAAC,eAAe,EAAE,OAAO,WAO1D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isBasicAuthMethod.d.ts","sourceRoot":"","sources":["../../../src/http/guards/isBasicAuthMethod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE,wBAAgB,iBAAiB,CAC/B,oBAAoB,EAAE,OAAO,GAC5B,oBAAoB,IAAI,gBAAgB,CAO1C"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { AnySchemaValidator } from '@forklaunch/validator';
|
|
2
|
+
import { ConstrainedForklaunchRouter } from '../types/router.types';
|
|
3
|
+
/**
|
|
4
|
+
* Type guard that checks if an object is a constrained Forklaunch router.
|
|
5
|
+
* A constrained router is one that has both the basic router properties and a request handler.
|
|
6
|
+
*
|
|
7
|
+
* @template SV - A type that extends AnySchemaValidator
|
|
8
|
+
* @template RouterHandler - The type of the router handler
|
|
9
|
+
* @param maybeForklaunchExpressLikeRouter - The object to check
|
|
10
|
+
* @returns A type predicate indicating whether the object is a ConstrainedForklaunchRouter
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* if (isConstrainedForklaunchRouter(router)) {
|
|
15
|
+
* // router is now typed as ConstrainedForklaunchRouter
|
|
16
|
+
* router.requestHandler(...);
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare function isConstrainedForklaunchRouter<SV extends AnySchemaValidator, RouterHandler>(maybeForklaunchExpressLikeRouter: unknown): maybeForklaunchExpressLikeRouter is ConstrainedForklaunchRouter<SV, RouterHandler>;
|
|
21
|
+
//# sourceMappingURL=isConstrainedForklaunchRouter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isConstrainedForklaunchRouter.d.ts","sourceRoot":"","sources":["../../../src/http/guards/isConstrainedForklaunchRouter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AAGpE;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,6BAA6B,CAC3C,EAAE,SAAS,kBAAkB,EAC7B,aAAa,EAEb,gCAAgC,EAAE,OAAO,GACxC,gCAAgC,IAAI,2BAA2B,CAChE,EAAE,EACF,aAAa,CACd,CAKA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { AnySchemaValidator } from '@forklaunch/validator';
|
|
2
|
+
import { ExpressLikeSchemaHandler } from '../types/apiDefinition.types';
|
|
3
|
+
import { Body, HeadersObject, Method, ParamsObject, QueryObject, ResponsesObject, SessionObject, VersionSchema } from '../types/contractDetails.types';
|
|
4
|
+
/**
|
|
5
|
+
* Type guard that checks if an object is an Express-like schema handler.
|
|
6
|
+
* A schema handler is a function that takes up to 3 arguments (request, response, next)
|
|
7
|
+
* and is used for middleware or route handlers in an Express-like application.
|
|
8
|
+
*
|
|
9
|
+
* @template SV - A type that extends AnySchemaValidator
|
|
10
|
+
* @template P - The type of route parameters
|
|
11
|
+
* @template ResBodyMap - The type of response body mapping
|
|
12
|
+
* @template ReqBody - The type of request body
|
|
13
|
+
* @template ReqQuery - The type of request query parameters
|
|
14
|
+
* @template ReqHeaders - The type of request headers
|
|
15
|
+
* @template ResHeaders - The type of response headers
|
|
16
|
+
* @template LocalsObj - The type of locals object
|
|
17
|
+
* @template BaseRequest - The base request type
|
|
18
|
+
* @template BaseResponse - The base response type
|
|
19
|
+
* @template NextFunction - The type of next function
|
|
20
|
+
* @param {unknown} middleware - The object to check
|
|
21
|
+
* @returns {boolean} A type predicate indicating whether the object is an ExpressLikeSchemaHandler
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* if (isExpressLikeSchemaHandler(middleware)) {
|
|
26
|
+
* // middleware is now typed as ExpressLikeSchemaHandler
|
|
27
|
+
* middleware(req, res, next);
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare function isExpressLikeSchemaHandler<SV extends AnySchemaValidator, ContractMethod extends Method, P extends ParamsObject<SV>, ResBodyMap extends ResponsesObject<SV>, ReqBody extends Body<SV>, ReqQuery extends QueryObject<SV>, ReqHeaders extends HeadersObject<SV>, ResHeaders extends HeadersObject<SV>, LocalsObj extends Record<string, unknown>, VersionedApi extends VersionSchema<SV, ContractMethod>, Session extends SessionObject<SV>, BaseRequest, BaseResponse, NextFunction>(middleware: unknown): middleware is ExpressLikeSchemaHandler<SV, P, ResBodyMap, ReqBody, ReqQuery, ReqHeaders, ResHeaders, LocalsObj, VersionedApi, Session, BaseRequest, BaseResponse, NextFunction>;
|
|
32
|
+
//# sourceMappingURL=isExpressLikeSchemaHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isExpressLikeSchemaHandler.d.ts","sourceRoot":"","sources":["../../../src/http/guards/isExpressLikeSchemaHandler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EACL,IAAI,EACJ,aAAa,EACb,MAAM,EACN,YAAY,EACZ,WAAW,EACX,eAAe,EACf,aAAa,EACb,aAAa,EACd,MAAM,gCAAgC,CAAC;AAExC;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,0BAA0B,CACxC,EAAE,SAAS,kBAAkB,EAC7B,cAAc,SAAS,MAAM,EAC7B,CAAC,SAAS,YAAY,CAAC,EAAE,CAAC,EAC1B,UAAU,SAAS,eAAe,CAAC,EAAE,CAAC,EACtC,OAAO,SAAS,IAAI,CAAC,EAAE,CAAC,EACxB,QAAQ,SAAS,WAAW,CAAC,EAAE,CAAC,EAChC,UAAU,SAAS,aAAa,CAAC,EAAE,CAAC,EACpC,UAAU,SAAS,aAAa,CAAC,EAAE,CAAC,EACpC,SAAS,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACzC,YAAY,SAAS,aAAa,CAAC,EAAE,EAAE,cAAc,CAAC,EACtD,OAAO,SAAS,aAAa,CAAC,EAAE,CAAC,EACjC,WAAW,EACX,YAAY,EACZ,YAAY,EAEZ,UAAU,EAAE,OAAO,GAClB,UAAU,IAAI,wBAAwB,CACvC,EAAE,EACF,CAAC,EACD,UAAU,EACV,OAAO,EACP,QAAQ,EACR,UAAU,EACV,UAAU,EACV,SAAS,EACT,YAAY,EACZ,OAAO,EACP,WAAW,EACX,YAAY,EACZ,YAAY,CACb,CASA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { AnySchemaValidator } from '@forklaunch/validator';
|
|
2
|
+
import { ExpressLikeRouter } from '../interfaces/expressLikeRouter.interface';
|
|
3
|
+
import { ForklaunchExpressLikeRouter } from '../router/expressLikeRouter';
|
|
4
|
+
/**
|
|
5
|
+
* Type guard that checks if an object is a Forklaunch Express-like router.
|
|
6
|
+
* A Forklaunch Express-like router is a constrained router that has both a base path and an internal router.
|
|
7
|
+
*
|
|
8
|
+
* @template SV - A type that extends AnySchemaValidator
|
|
9
|
+
* @template Path - A type that extends `/${string}` representing the base path
|
|
10
|
+
* @template RouterHandler - The type of the router handler
|
|
11
|
+
* @template Internal - The type of the internal router that extends ExpressLikeRouter
|
|
12
|
+
* @template BaseRequest - The base request type
|
|
13
|
+
* @template BaseResponse - The base response type
|
|
14
|
+
* @template NextFunction - The type of next function
|
|
15
|
+
* @param {unknown} maybeForklaunchExpressLikeRouter - The object to check
|
|
16
|
+
* @returns {boolean} A type predicate indicating whether the object is a ForklaunchExpressLikeRouter
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* if (isForklaunchExpressLikeRouter(router)) {
|
|
21
|
+
* // router is now typed as ForklaunchExpressLikeRouter
|
|
22
|
+
* router.basePath; // '/api'
|
|
23
|
+
* router.internal; // ExpressLikeRouter
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare function isForklaunchExpressLikeRouter<SV extends AnySchemaValidator, Path extends `/${string}`, RouterHandler, Internal extends ExpressLikeRouter<RouterHandler, Internal>, BaseRequest, BaseResponse, NextFunction, FetchMap extends Record<string, unknown>, Sdk extends Record<string, unknown>>(maybeForklaunchExpressLikeRouter: unknown): maybeForklaunchExpressLikeRouter is ForklaunchExpressLikeRouter<SV, Path, RouterHandler, Internal, BaseRequest, BaseResponse, NextFunction, FetchMap, Sdk>;
|
|
28
|
+
//# sourceMappingURL=isForklaunchExpressLikeRouter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isForklaunchExpressLikeRouter.d.ts","sourceRoot":"","sources":["../../../src/http/guards/isForklaunchExpressLikeRouter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAC9E,OAAO,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAG1E;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,6BAA6B,CAC3C,EAAE,SAAS,kBAAkB,EAC7B,IAAI,SAAS,IAAI,MAAM,EAAE,EACzB,aAAa,EACb,QAAQ,SAAS,iBAAiB,CAAC,aAAa,EAAE,QAAQ,CAAC,EAC3D,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACxC,GAAG,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAEnC,gCAAgC,EAAE,OAAO,GACxC,gCAAgC,IAAI,2BAA2B,CAChE,EAAE,EACF,IAAI,EACJ,aAAa,EACb,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,GAAG,CACJ,CAQA"}
|