@bitblit/ratchet-epsilon-common 4.0.1-alpha
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/CHANGELOG.md +177 -0
- package/License.txt +13 -0
- package/README.md +242 -0
- package/bin/cli.js +10 -0
- package/lib/background/background-dynamo-log-table-handler.d.ts +11 -0
- package/lib/background/background-entry.d.ts +4 -0
- package/lib/background/background-execution-event-type.d.ts +7 -0
- package/lib/background/background-execution-event.d.ts +8 -0
- package/lib/background/background-execution-listener.d.ts +5 -0
- package/lib/background/background-handler.d.ts +29 -0
- package/lib/background/background-http-adapter-handler.d.ts +22 -0
- package/lib/background/background-meta-response-internal.d.ts +5 -0
- package/lib/background/background-process-handling.d.ts +4 -0
- package/lib/background/background-process-log-table-entry.d.ts +11 -0
- package/lib/background/background-queue-response-internal.d.ts +8 -0
- package/lib/background/background-validator.d.ts +17 -0
- package/lib/background/epsilon-background-process-error.d.ts +30 -0
- package/lib/background/internal-background-entry.d.ts +7 -0
- package/lib/background/manager/abstract-background-manager.d.ts +19 -0
- package/lib/background/manager/aws-sqs-sns-background-manager.d.ts +23 -0
- package/lib/background/manager/background-manager-like.d.ts +17 -0
- package/lib/background/manager/background-manager.spec.d.ts +1 -0
- package/lib/background/manager/single-thread-local-background-manager.d.ts +15 -0
- package/lib/background/s3-background-transaction-logger.d.ts +17 -0
- package/lib/build/ratchet-epsilon-common-info.d.ts +5 -0
- package/lib/built-in/background/echo-processor.d.ts +7 -0
- package/lib/built-in/background/log-and-enqueue-echo-processor.d.ts +6 -0
- package/lib/built-in/background/log-message-background-error-processor.d.ts +5 -0
- package/lib/built-in/background/no-op-processor.d.ts +6 -0
- package/lib/built-in/background/retry-processor.d.ts +16 -0
- package/lib/built-in/background/sample-delay-processor.d.ts +6 -0
- package/lib/built-in/background/sample-input-validated-processor-data.d.ts +4 -0
- package/lib/built-in/background/sample-input-validated-processor.d.ts +8 -0
- package/lib/built-in/built-in-trace-id-generators.d.ts +5 -0
- package/lib/built-in/daemon/daemon-authorizer-function.d.ts +5 -0
- package/lib/built-in/daemon/daemon-config.d.ts +8 -0
- package/lib/built-in/daemon/daemon-group-selection-function.d.ts +4 -0
- package/lib/built-in/daemon/daemon-handler.d.ts +16 -0
- package/lib/built-in/daemon/daemon-process-state-list.d.ts +5 -0
- package/lib/built-in/http/apollo-filter.d.ts +10 -0
- package/lib/built-in/http/built-in-auth-filters.d.ts +9 -0
- package/lib/built-in/http/built-in-authorizers.d.ts +8 -0
- package/lib/built-in/http/built-in-filters.d.ts +25 -0
- package/lib/built-in/http/built-in-handlers.d.ts +9 -0
- package/lib/built-in/http/log-level-manipulation-filter.d.ts +6 -0
- package/lib/built-in/http/run-handler-as-filter.d.ts +12 -0
- package/lib/built-in/http/run-handler-as-filter.spec.d.ts +1 -0
- package/lib/cli/ratchet-cli-handler.d.ts +6 -0
- package/lib/cli/run-background-process-from-command-line.d.ts +3 -0
- package/lib/config/background/background-aws-config.d.ts +7 -0
- package/lib/config/background/background-config.d.ts +14 -0
- package/lib/config/background/background-error-processor.d.ts +4 -0
- package/lib/config/background/background-processor.d.ts +6 -0
- package/lib/config/background/background-transaction-log.d.ts +8 -0
- package/lib/config/background/background-transaction-logger.d.ts +5 -0
- package/lib/config/cron/abstract-cron-entry.d.ts +12 -0
- package/lib/config/cron/cron-background-entry.d.ts +6 -0
- package/lib/config/cron/cron-config.d.ts +6 -0
- package/lib/config/dynamo-db-config.d.ts +5 -0
- package/lib/config/epsilon-config.d.ts +21 -0
- package/lib/config/epsilon-lambda-event-handler.d.ts +7 -0
- package/lib/config/epsilon-logger-config.d.ts +13 -0
- package/lib/config/generic-aws-event-handler-function.d.ts +3 -0
- package/lib/config/http/authorizer-function.d.ts +6 -0
- package/lib/config/http/epsilon-authorization-context.d.ts +5 -0
- package/lib/config/http/extended-api-gateway-event.d.ts +7 -0
- package/lib/config/http/filter-chain-context.d.ts +14 -0
- package/lib/config/http/filter-function.d.ts +4 -0
- package/lib/config/http/handler-function.d.ts +5 -0
- package/lib/config/http/http-config.d.ts +15 -0
- package/lib/config/http/http-processing-config.d.ts +11 -0
- package/lib/config/http/mapped-http-processing-config.d.ts +7 -0
- package/lib/config/http/null-returned-object-handling.d.ts +5 -0
- package/lib/config/inter-api/inter-api-aws-config.d.ts +5 -0
- package/lib/config/inter-api/inter-api-config.d.ts +6 -0
- package/lib/config/inter-api/inter-api-process-mapping.d.ts +6 -0
- package/lib/config/logging-trace-id-generator.d.ts +4 -0
- package/lib/config/open-api/open-api-document-components.d.ts +4 -0
- package/lib/config/open-api/open-api-document-path.d.ts +2 -0
- package/lib/config/open-api/open-api-document.d.ts +6 -0
- package/lib/config/s3-config.d.ts +6 -0
- package/lib/config/sns-config.d.ts +5 -0
- package/lib/epsilon-build-properties.d.ts +9 -0
- package/lib/epsilon-constants.d.ts +16 -0
- package/lib/epsilon-global-handler.d.ts +20 -0
- package/lib/epsilon-instance.d.ts +14 -0
- package/lib/epsilon-logging-extension-processor.d.ts +6 -0
- package/lib/http/auth/api-gateway-adapter-authentication-handler.d.ts +8 -0
- package/lib/http/auth/auth0-web-token-manipulator.d.ts +13 -0
- package/lib/http/auth/basic-auth-token.d.ts +4 -0
- package/lib/http/auth/google-web-token-manipulator.d.ts +14 -0
- package/lib/http/auth/google-web-token-manipulator.spec.d.ts +1 -0
- package/lib/http/auth/jwt-ratchet-local-web-token-manipulator.d.ts +11 -0
- package/lib/http/auth/local-web-token-manipulator.d.ts +19 -0
- package/lib/http/auth/local-web-token-manipulator.spec.d.ts +1 -0
- package/lib/http/auth/web-token-manipulator.d.ts +4 -0
- package/lib/http/error/bad-gateway.d.ts +5 -0
- package/lib/http/error/bad-request-error.d.ts +5 -0
- package/lib/http/error/conflict-error.d.ts +5 -0
- package/lib/http/error/epsilon-http-error.d.ts +41 -0
- package/lib/http/error/epsilon-http-error.spec.d.ts +1 -0
- package/lib/http/error/forbidden-error.d.ts +5 -0
- package/lib/http/error/gateway-timeout.d.ts +5 -0
- package/lib/http/error/method-not-allowed-error.d.ts +5 -0
- package/lib/http/error/misconfigured-error.d.ts +5 -0
- package/lib/http/error/not-found-error.d.ts +5 -0
- package/lib/http/error/not-implemented.d.ts +5 -0
- package/lib/http/error/request-timeout-error.d.ts +5 -0
- package/lib/http/error/service-unavailable.d.ts +5 -0
- package/lib/http/error/too-many-requests-error.d.ts +5 -0
- package/lib/http/error/unauthorized-error.d.ts +5 -0
- package/lib/http/event-util.d.ts +25 -0
- package/lib/http/event-util.spec.d.ts +1 -0
- package/lib/http/response-util.d.ts +11 -0
- package/lib/http/response-util.spec.d.ts +1 -0
- package/lib/http/route/epsilon-router.d.ts +8 -0
- package/lib/http/route/extended-auth-response-context.d.ts +6 -0
- package/lib/http/route/route-mapping.d.ts +12 -0
- package/lib/http/route/route-validator-config.d.ts +5 -0
- package/lib/http/route/router-util.d.ts +23 -0
- package/lib/http/route/router-util.spec.d.ts +1 -0
- package/lib/http/web-handler.d.ts +23 -0
- package/lib/http/web-handler.spec.d.ts +1 -0
- package/lib/http/web-v2-handler.d.ts +10 -0
- package/lib/index.d.ts +132 -0
- package/lib/index.mjs +344 -0
- package/lib/index.mjs.map +1 -0
- package/lib/inter-api/inter-api-entry.d.ts +7 -0
- package/lib/inter-api/inter-api-util.d.ts +10 -0
- package/lib/inter-api/inter-api-util.spec.d.ts +1 -0
- package/lib/inter-api-manager.d.ts +14 -0
- package/lib/lambda-event-handler/cron-epsilon-lambda-event-handler.d.ts +14 -0
- package/lib/lambda-event-handler/cron-epsilon-lambda-event-handler.spec.d.ts +1 -0
- package/lib/lambda-event-handler/dynamo-epsilon-lambda-event-handler.d.ts +11 -0
- package/lib/lambda-event-handler/generic-sns-epsilon-lambda-event-handler.d.ts +10 -0
- package/lib/lambda-event-handler/inter-api-epsilon-lambda-event-handler.d.ts +10 -0
- package/lib/lambda-event-handler/s3-epsilon-lambda-event-handler.d.ts +10 -0
- package/lib/local-container-server.d.ts +11 -0
- package/lib/local-server-cert.d.ts +5 -0
- package/lib/local-server.d.ts +18 -0
- package/lib/open-api-util/open-api-doc-modifications.d.ts +8 -0
- package/lib/open-api-util/open-api-doc-modifier.d.ts +7 -0
- package/lib/open-api-util/open-api-doc-modifier.spec.d.ts +1 -0
- package/lib/open-api-util/yaml-combiner.d.ts +3 -0
- package/lib/open-api-util/yaml-combiner.spec.d.ts +1 -0
- package/lib/sample/sample-server-components.d.ts +10 -0
- package/lib/sample/sample-server-static-files.d.ts +5 -0
- package/lib/sample/test-error-server.d.ts +11 -0
- package/lib/util/aws-util.d.ts +8 -0
- package/lib/util/context-util.d.ts +33 -0
- package/lib/util/cron-util.d.ts +11 -0
- package/lib/util/cron-util.spec.d.ts +1 -0
- package/lib/util/epsilon-config-parser.d.ts +14 -0
- package/package.json +129 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { GenericAwsEventHandlerFunction } from './generic-aws-event-handler-function.js';
|
|
2
|
+
import { S3Event } from 'aws-lambda';
|
|
3
|
+
export interface S3Config {
|
|
4
|
+
createHandlers: Map<string, GenericAwsEventHandlerFunction<S3Event>>;
|
|
5
|
+
removeHandlers: Map<string, GenericAwsEventHandlerFunction<S3Event>>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare class EpsilonBuildProperties {
|
|
2
|
+
private constructor();
|
|
3
|
+
static get buildVersion(): string;
|
|
4
|
+
static get buildHash(): string;
|
|
5
|
+
static get buildBranch(): string;
|
|
6
|
+
static get buildTag(): string;
|
|
7
|
+
static get buildBranchOrTag(): string;
|
|
8
|
+
static get buildTime(): string;
|
|
9
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { EpsilonGlobalHandler } from './epsilon-global-handler.js';
|
|
2
|
+
export declare class EpsilonConstants {
|
|
3
|
+
static readonly EPSILON_FINDER_DYNAMIC_IMPORT_PATH_ENV_NAME = "EPSILON_FINDER_DYNAMIC_IMPORT_PATH";
|
|
4
|
+
static readonly EPSILON_FINDER_FUNCTION_NAME_ENV_NAME = "EPSILON_FINDER_FUNCTION_NAME";
|
|
5
|
+
static readonly DEFAULT_EPSILON_FINDER_DYNAMIC_IMPORT_PATH = "epsilon-global-handler-provider.js";
|
|
6
|
+
static readonly DEFAULT_EPSILON_FINDER_FUNCTION_NAME = "findEpsilonGlobalHandler";
|
|
7
|
+
static readonly AUTH_HEADER_PREFIX: string;
|
|
8
|
+
static readonly AUTH_HEADER_NAME: string;
|
|
9
|
+
static readonly BACKGROUND_SQS_TYPE_FIELD = "BACKGROUND_TYPE";
|
|
10
|
+
static readonly BACKGROUND_SNS_START_MARKER = "BACKGROUND_START_MARKER";
|
|
11
|
+
static readonly BACKGROUND_SNS_IMMEDIATE_RUN_FLAG = "BACKGROUND_IMMEDIATE_RUN_FLAG";
|
|
12
|
+
static readonly INTER_API_SNS_EVENT = "EPSILON_INTER_API_EVENT";
|
|
13
|
+
private static load;
|
|
14
|
+
static findDynamicImportEpsilonGlobalHandlerProvider(): Promise<EpsilonGlobalHandler>;
|
|
15
|
+
private constructor();
|
|
16
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Context, ProxyResult } from 'aws-lambda';
|
|
2
|
+
import { BackgroundEntry } from './background/background-entry.js';
|
|
3
|
+
import { EpsilonInstance } from './epsilon-instance.js';
|
|
4
|
+
import { LoggerOptions } from '@bitblit/ratchet-common';
|
|
5
|
+
export declare class EpsilonGlobalHandler {
|
|
6
|
+
private _epsilon;
|
|
7
|
+
private static LOGGER_CONFIGURED;
|
|
8
|
+
private static GLOBAL_INSTANCE_PROVIDER;
|
|
9
|
+
static set globalInstanceProvider(input: () => Promise<EpsilonGlobalHandler>);
|
|
10
|
+
static get globalInstanceProvider(): () => Promise<EpsilonGlobalHandler>;
|
|
11
|
+
private handlers;
|
|
12
|
+
constructor(_epsilon: EpsilonInstance);
|
|
13
|
+
static configureDefaultLogger(overrides?: LoggerOptions): void;
|
|
14
|
+
get epsilon(): EpsilonInstance;
|
|
15
|
+
processSingleBackgroundByParts<T>(type: string, data?: T, overrideTraceId?: string, overrideTraceDepth?: number): Promise<boolean>;
|
|
16
|
+
processSingleBackgroundEntry(e: BackgroundEntry<any>, overrideTraceId?: string, overrideTraceDepth?: number): Promise<boolean>;
|
|
17
|
+
lambdaHandler(event: any, context: Context): Promise<any>;
|
|
18
|
+
innerLambdaHandler(event: any, context: Context): Promise<any>;
|
|
19
|
+
static defaultProcessUncaughtError(event: any, context: Context, err: any): Promise<ProxyResult>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { EpsilonConfig } from './config/epsilon-config.js';
|
|
2
|
+
import { WebHandler } from './http/web-handler.js';
|
|
3
|
+
import { BackgroundHandler } from './background/background-handler.js';
|
|
4
|
+
import { OpenApiDocument } from './config/open-api/open-api-document.js';
|
|
5
|
+
import { ModelValidator } from '@bitblit/ratchet-misc';
|
|
6
|
+
import { BackgroundManagerLike } from './background/manager/background-manager-like.js';
|
|
7
|
+
export interface EpsilonInstance {
|
|
8
|
+
config: EpsilonConfig;
|
|
9
|
+
parsedOpenApiDoc: OpenApiDocument;
|
|
10
|
+
modelValidator: ModelValidator;
|
|
11
|
+
webHandler: WebHandler;
|
|
12
|
+
backgroundHandler: BackgroundHandler;
|
|
13
|
+
backgroundManager: BackgroundManagerLike;
|
|
14
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { LogMessage } from '@bitblit/ratchet-common';
|
|
2
|
+
import { LogMessageProcessor } from '@bitblit/ratchet-common';
|
|
3
|
+
export declare class EpsilonLoggingExtensionProcessor implements LogMessageProcessor {
|
|
4
|
+
process(msg: LogMessage): LogMessage;
|
|
5
|
+
label(): string;
|
|
6
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Callback, Context, CustomAuthorizerEvent } from 'aws-lambda';
|
|
2
|
+
export declare class ApiGatewayAdapterAuthenticationHandler {
|
|
3
|
+
private webTokenManipulator;
|
|
4
|
+
constructor(issuer: string, encryptionKeys: string);
|
|
5
|
+
lambdaHandler(event: CustomAuthorizerEvent, context: Context, callback: Callback): void;
|
|
6
|
+
private createPolicy;
|
|
7
|
+
static extractTokenStringFromAuthorizerEvent(event: CustomAuthorizerEvent): string;
|
|
8
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { JwtTokenBase } from '@bitblit/ratchet-common';
|
|
2
|
+
import { WebTokenManipulator } from './web-token-manipulator.js';
|
|
3
|
+
export declare class Auth0WebTokenManipulator implements WebTokenManipulator<JwtTokenBase> {
|
|
4
|
+
private clientId;
|
|
5
|
+
private jwksUri;
|
|
6
|
+
private issuer;
|
|
7
|
+
private jwksClient;
|
|
8
|
+
constructor(clientId: string, jwksUri: string, issuer: string);
|
|
9
|
+
extractTokenFromAuthorizationHeader<T>(authHeader: string): Promise<JwtTokenBase>;
|
|
10
|
+
parseAndValidateAuth0Token<T>(auth0Token: string, allowExpired?: boolean): Promise<JwtTokenBase>;
|
|
11
|
+
private fetchSigningKey;
|
|
12
|
+
private fetchJwksClient;
|
|
13
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { WebTokenManipulator } from './web-token-manipulator.js';
|
|
2
|
+
import { JwtTokenBase } from '@bitblit/ratchet-common';
|
|
3
|
+
export declare class GoogleWebTokenManipulator implements WebTokenManipulator<JwtTokenBase> {
|
|
4
|
+
private clientId;
|
|
5
|
+
private static readonly GOOGLE_DISCOVERY_DOCUMENT;
|
|
6
|
+
private cacheGoogleDiscoveryDocument;
|
|
7
|
+
private jwksClient;
|
|
8
|
+
constructor(clientId: string);
|
|
9
|
+
extractTokenFromAuthorizationHeader<T extends JwtTokenBase>(authHeader: string): Promise<JwtTokenBase>;
|
|
10
|
+
parseAndValidateGoogleToken<T extends JwtTokenBase>(googleToken: string, allowExpired?: boolean): Promise<JwtTokenBase>;
|
|
11
|
+
private fetchSigningKey;
|
|
12
|
+
private fetchJwksClient;
|
|
13
|
+
private fetchGoogleDiscoveryDocument;
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { WebTokenManipulator } from './web-token-manipulator.js';
|
|
2
|
+
import { JwtTokenBase } from '@bitblit/ratchet-common';
|
|
3
|
+
import { JwtRatchetLike } from '@bitblit/ratchet-common';
|
|
4
|
+
export declare class JwtRatchetLocalWebTokenManipulator<T extends JwtTokenBase> implements WebTokenManipulator<T> {
|
|
5
|
+
private _jwtRatchet;
|
|
6
|
+
private _issuer;
|
|
7
|
+
constructor(_jwtRatchet: JwtRatchetLike, _issuer: string);
|
|
8
|
+
get jwtRatchet(): JwtRatchetLike;
|
|
9
|
+
get issuer(): string;
|
|
10
|
+
extractTokenFromAuthorizationHeader<T>(header: string): Promise<T>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { WebTokenManipulator } from './web-token-manipulator.js';
|
|
2
|
+
import { LoggerLevelName } from '@bitblit/ratchet-common';
|
|
3
|
+
import { JwtTokenBase } from '@bitblit/ratchet-common';
|
|
4
|
+
import { JwtRatchet } from '@bitblit/ratchet-common';
|
|
5
|
+
export declare class LocalWebTokenManipulator<T extends JwtTokenBase> implements WebTokenManipulator<T> {
|
|
6
|
+
private encryptionKeys;
|
|
7
|
+
private issuer;
|
|
8
|
+
private _ratchet;
|
|
9
|
+
constructor(encryptionKeys: string[], issuer: string);
|
|
10
|
+
withExtraDecryptionKeys(keys: string[]): LocalWebTokenManipulator<T>;
|
|
11
|
+
withParseFailureLogLevel(logLevel: LoggerLevelName): LocalWebTokenManipulator<T>;
|
|
12
|
+
withOldKeyUseLogLevel(logLevel: LoggerLevelName): LocalWebTokenManipulator<T>;
|
|
13
|
+
get jwtRatchet(): JwtRatchet;
|
|
14
|
+
get selectRandomEncryptionKey(): Promise<string>;
|
|
15
|
+
createRefreshedJWTString(tokenString: string, expirationSeconds: number, allowExpired?: boolean): Promise<string>;
|
|
16
|
+
parseAndValidateJWTStringAsync<T extends JwtTokenBase>(tokenString: string): Promise<T>;
|
|
17
|
+
createJWTStringAsync<T>(principal: string, userObject: T, roles?: string[], expirationSeconds?: number, proxyUser?: T): Promise<string>;
|
|
18
|
+
extractTokenFromAuthorizationHeader<T extends JwtTokenBase>(header: string): Promise<T>;
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export declare class EpsilonHttpError<T = void> extends Error {
|
|
2
|
+
private static readonly EPSILON_HTTP_ERROR_FLAG_KEY;
|
|
3
|
+
private _httpStatusCode;
|
|
4
|
+
private _errors;
|
|
5
|
+
private _detailErrorCode;
|
|
6
|
+
private _endUserErrors;
|
|
7
|
+
private _details;
|
|
8
|
+
private _requestId;
|
|
9
|
+
private _wrappedError;
|
|
10
|
+
constructor(...errors: string[]);
|
|
11
|
+
static combineErrorStringsWithDefault(errors: string[], defMessage?: string): string;
|
|
12
|
+
setFormattedErrorMessage(format: string, ...input: any[]): void;
|
|
13
|
+
withFormattedErrorMessage(format: string, ...input: any[]): EpsilonHttpError<T>;
|
|
14
|
+
withHttpStatusCode(httpStatusCode: number): EpsilonHttpError<T>;
|
|
15
|
+
withErrors(errors: string[]): EpsilonHttpError<T>;
|
|
16
|
+
withDetailErrorCode(detailErrorCode: number): EpsilonHttpError<T>;
|
|
17
|
+
withEndUserErrors(endUserErrors: string[]): EpsilonHttpError<T>;
|
|
18
|
+
withDetails(details: T): EpsilonHttpError<T>;
|
|
19
|
+
withRequestId(requestId: string): EpsilonHttpError<T>;
|
|
20
|
+
withWrappedError(err: Error): EpsilonHttpError<T>;
|
|
21
|
+
isWrappedError(): boolean;
|
|
22
|
+
static wrapError<T = void>(err: Error): EpsilonHttpError<T>;
|
|
23
|
+
static objectIsEpsilonHttpError(obj: any): boolean;
|
|
24
|
+
get httpStatusCode(): number;
|
|
25
|
+
get errors(): string[];
|
|
26
|
+
get detailErrorCode(): number;
|
|
27
|
+
get endUserErrors(): string[];
|
|
28
|
+
get details(): T;
|
|
29
|
+
get requestId(): string;
|
|
30
|
+
get wrappedError(): Error;
|
|
31
|
+
set httpStatusCode(value: number);
|
|
32
|
+
set errors(value: string[]);
|
|
33
|
+
set detailErrorCode(value: number);
|
|
34
|
+
set endUserErrors(value: string[]);
|
|
35
|
+
set details(value: T);
|
|
36
|
+
set requestId(value: string);
|
|
37
|
+
set wrappedError(value: Error);
|
|
38
|
+
static errorIsX0x(errIn: Error, xClass: number): boolean;
|
|
39
|
+
static errorIs40x(err: Error): boolean;
|
|
40
|
+
static errorIs50x(err: Error): boolean;
|
|
41
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { APIGatewayEvent, APIGatewayEventRequestContext, AuthResponseContext } from 'aws-lambda';
|
|
2
|
+
import { EpsilonLoggerConfig } from '../config/epsilon-logger-config.js';
|
|
3
|
+
import { LoggerLevelName } from '@bitblit/ratchet-common';
|
|
4
|
+
import { BasicAuthToken } from './auth/basic-auth-token.js';
|
|
5
|
+
export declare class EventUtil {
|
|
6
|
+
private constructor();
|
|
7
|
+
static extractStage(event: APIGatewayEvent): string;
|
|
8
|
+
static extractHostHeader(event: APIGatewayEvent): string;
|
|
9
|
+
static extractProtocol(event: APIGatewayEvent): string;
|
|
10
|
+
static extractApiGatewayStage(event: APIGatewayEvent): string;
|
|
11
|
+
static extractRequestContext(event: APIGatewayEvent): APIGatewayEventRequestContext;
|
|
12
|
+
static extractAuthorizer(event: APIGatewayEvent): AuthResponseContext;
|
|
13
|
+
static ipAddressChain(event: APIGatewayEvent): string[];
|
|
14
|
+
static ipAddress(event: APIGatewayEvent): string;
|
|
15
|
+
static extractFullPath(event: APIGatewayEvent, overrideProtocol?: string): string;
|
|
16
|
+
static extractFullPrefix(event: APIGatewayEvent, overrideProtocol?: string): string;
|
|
17
|
+
static jsonBodyToObject(event: APIGatewayEvent): any;
|
|
18
|
+
static calcLogLevelViaEventOrEnvParam(curLevel: LoggerLevelName, event: APIGatewayEvent, rConfig: EpsilonLoggerConfig): LoggerLevelName;
|
|
19
|
+
static fixStillEncodedQueryParams(event: APIGatewayEvent): void;
|
|
20
|
+
static applyTokenToEventForTesting(event: APIGatewayEvent, jwtToken: string): void;
|
|
21
|
+
static extractBasicAuthenticationToken(event: APIGatewayEvent, throwErrorOnMissingBad?: boolean): BasicAuthToken;
|
|
22
|
+
static eventIsAGraphQLIntrospection(event: APIGatewayEvent): boolean;
|
|
23
|
+
static extractAuthorizationHeaderCaseInsensitive(evt: APIGatewayEvent): string;
|
|
24
|
+
static extractBearerTokenFromEvent(evt: APIGatewayEvent): string;
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { ProxyResult } from 'aws-lambda';
|
|
3
|
+
import { EpsilonHttpError } from './error/epsilon-http-error.js';
|
|
4
|
+
export declare class ResponseUtil {
|
|
5
|
+
private constructor();
|
|
6
|
+
static errorResponse<T>(err: EpsilonHttpError<T>): ProxyResult;
|
|
7
|
+
static redirect(target: string, code?: number, queryParams?: any): ProxyResult;
|
|
8
|
+
static coerceToProxyResult(input: any): ProxyResult;
|
|
9
|
+
static applyGzipIfPossible(encodingHeader: string, proxyResult: ProxyResult): Promise<ProxyResult>;
|
|
10
|
+
static gzip(input: Buffer): Promise<Buffer>;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { RouteMapping } from './route-mapping.js';
|
|
2
|
+
import { ModelValidator } from '@bitblit/ratchet-misc';
|
|
3
|
+
import { HttpConfig } from '../../config/http/http-config.js';
|
|
4
|
+
export interface EpsilonRouter {
|
|
5
|
+
routes: RouteMapping[];
|
|
6
|
+
openApiModelValidator: ModelValidator;
|
|
7
|
+
config: HttpConfig;
|
|
8
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { RouteValidatorConfig } from './route-validator-config.js';
|
|
2
|
+
import { HandlerFunction } from '../../config/http/handler-function.js';
|
|
3
|
+
import { HttpProcessingConfig } from '../../config/http/http-processing-config.js';
|
|
4
|
+
export interface RouteMapping {
|
|
5
|
+
method: string;
|
|
6
|
+
path: string;
|
|
7
|
+
function: HandlerFunction<any>;
|
|
8
|
+
metaProcessingConfig: HttpProcessingConfig;
|
|
9
|
+
validation: RouteValidatorConfig;
|
|
10
|
+
outboundValidation: RouteValidatorConfig;
|
|
11
|
+
authorizerName: string;
|
|
12
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { EpsilonRouter } from './epsilon-router.js';
|
|
2
|
+
import { JwtTokenBase } from '@bitblit/ratchet-common';
|
|
3
|
+
import { OpenApiDocument } from '../../config/open-api/open-api-document.js';
|
|
4
|
+
import { ModelValidator } from '@bitblit/ratchet-misc';
|
|
5
|
+
import { BackgroundHttpAdapterHandler } from '../../background/background-http-adapter-handler.js';
|
|
6
|
+
import { HttpConfig } from '../../config/http/http-config.js';
|
|
7
|
+
import { HttpProcessingConfig } from '../../config/http/http-processing-config.js';
|
|
8
|
+
import { WebTokenManipulator } from '../auth/web-token-manipulator.js';
|
|
9
|
+
import { FilterFunction } from '../../config/http/filter-function.js';
|
|
10
|
+
export declare class RouterUtil {
|
|
11
|
+
private constructor();
|
|
12
|
+
static defaultAuthenticationHeaderParsingEpsilonPreFilters(webTokenManipulator: WebTokenManipulator<JwtTokenBase>): FilterFunction[];
|
|
13
|
+
static defaultEpsilonPreFilters(): FilterFunction[];
|
|
14
|
+
static defaultEpsilonPostFilters(): FilterFunction[];
|
|
15
|
+
static defaultEpsilonErrorFilters(): FilterFunction[];
|
|
16
|
+
static defaultHttpMetaProcessingConfigWithAuthenticationHeaderParsing(webTokenManipulator: WebTokenManipulator<JwtTokenBase>): HttpProcessingConfig;
|
|
17
|
+
static defaultHttpMetaProcessingConfig(): HttpProcessingConfig;
|
|
18
|
+
static assignDefaultsOnHttpConfig(cfg: HttpConfig): HttpConfig;
|
|
19
|
+
static findApplicableMeta(httpConfig: HttpConfig, method: string, path: string): HttpProcessingConfig;
|
|
20
|
+
static openApiYamlToRouterConfig(httpConfig: HttpConfig, openApiDoc: OpenApiDocument, modelValidator: ModelValidator, backgroundHttpAdapterHandler: BackgroundHttpAdapterHandler): EpsilonRouter;
|
|
21
|
+
private static findAndValidateModelName;
|
|
22
|
+
static openApiPathToRouteParserPath(input: string): string;
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { EpsilonRouter } from './route/epsilon-router.js';
|
|
2
|
+
import { APIGatewayEvent, Context, ProxyResult } from 'aws-lambda';
|
|
3
|
+
import Route from 'route-parser';
|
|
4
|
+
import { RouteMapping } from './route/route-mapping.js';
|
|
5
|
+
import { ExtendedAPIGatewayEvent } from '../config/http/extended-api-gateway-event.js';
|
|
6
|
+
import { EpsilonLambdaEventHandler } from '../config/epsilon-lambda-event-handler.js';
|
|
7
|
+
export declare class WebHandler implements EpsilonLambdaEventHandler<APIGatewayEvent> {
|
|
8
|
+
private routerConfig;
|
|
9
|
+
static readonly MAXIMUM_LAMBDA_BODY_SIZE_BYTES: number;
|
|
10
|
+
constructor(routerConfig: EpsilonRouter);
|
|
11
|
+
get router(): EpsilonRouter;
|
|
12
|
+
extractLabel(evt: APIGatewayEvent, context: Context): string;
|
|
13
|
+
handlesEvent(evt: any): boolean;
|
|
14
|
+
processEvent(event: APIGatewayEvent, context: Context): Promise<ProxyResult>;
|
|
15
|
+
openApiLambdaHandler(evt: ExtendedAPIGatewayEvent, context: Context): Promise<ProxyResult>;
|
|
16
|
+
findBestMatchingRoute(event: APIGatewayEvent): RouteAndParse;
|
|
17
|
+
private cleanPath;
|
|
18
|
+
}
|
|
19
|
+
export interface RouteAndParse {
|
|
20
|
+
mapping: RouteMapping;
|
|
21
|
+
route: Route;
|
|
22
|
+
parsed: any;
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { APIGatewayProxyEventV2, Context, ProxyResult } from 'aws-lambda';
|
|
2
|
+
import { EpsilonLambdaEventHandler } from '../config/epsilon-lambda-event-handler.js';
|
|
3
|
+
import { WebHandler } from './web-handler.js';
|
|
4
|
+
export declare class WebV2Handler implements EpsilonLambdaEventHandler<APIGatewayProxyEventV2> {
|
|
5
|
+
private webHandler;
|
|
6
|
+
constructor(webHandler: WebHandler);
|
|
7
|
+
extractLabel(evt: APIGatewayProxyEventV2, context: Context): string;
|
|
8
|
+
handlesEvent(evt: any): boolean;
|
|
9
|
+
processEvent(evt: APIGatewayProxyEventV2, context: Context): Promise<ProxyResult>;
|
|
10
|
+
}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
export * from './epsilon-build-properties.js';
|
|
2
|
+
export * from './epsilon-constants.js';
|
|
3
|
+
export * from './epsilon-global-handler.js';
|
|
4
|
+
export * from './epsilon-instance.js';
|
|
5
|
+
export * from './epsilon-logging-extension-processor.js';
|
|
6
|
+
export * from './inter-api-manager.js';
|
|
7
|
+
export * from './local-container-server.js';
|
|
8
|
+
export * from './local-server-cert.js';
|
|
9
|
+
export * from './local-server.js';
|
|
10
|
+
export * from './background/background-dynamo-log-table-handler.js';
|
|
11
|
+
export * from './background/background-entry.js';
|
|
12
|
+
export * from './background/background-execution-event-type.js';
|
|
13
|
+
export * from './background/background-execution-event.js';
|
|
14
|
+
export * from './background/background-execution-listener.js';
|
|
15
|
+
export * from './background/background-handler.js';
|
|
16
|
+
export * from './background/background-http-adapter-handler.js';
|
|
17
|
+
export * from './background/background-meta-response-internal.js';
|
|
18
|
+
export * from './background/background-process-handling.js';
|
|
19
|
+
export * from './background/background-process-log-table-entry.js';
|
|
20
|
+
export * from './background/background-queue-response-internal.js';
|
|
21
|
+
export * from './background/background-validator.js';
|
|
22
|
+
export * from './background/epsilon-background-process-error.js';
|
|
23
|
+
export * from './background/internal-background-entry.js';
|
|
24
|
+
export * from './background/s3-background-transaction-logger.js';
|
|
25
|
+
export * from './background/manager/abstract-background-manager.js';
|
|
26
|
+
export * from './background/manager/aws-sqs-sns-background-manager.js';
|
|
27
|
+
export * from './background/manager/background-manager-like.js';
|
|
28
|
+
export * from './background/manager/single-thread-local-background-manager.js';
|
|
29
|
+
export * from './build/ratchet-epsilon-common-info.js';
|
|
30
|
+
export * from './built-in/built-in-trace-id-generators.js';
|
|
31
|
+
export * from './built-in/background/echo-processor.js';
|
|
32
|
+
export * from './built-in/background/log-and-enqueue-echo-processor.js';
|
|
33
|
+
export * from './built-in/background/log-message-background-error-processor.js';
|
|
34
|
+
export * from './built-in/background/no-op-processor.js';
|
|
35
|
+
export * from './built-in/background/retry-processor.js';
|
|
36
|
+
export * from './built-in/background/sample-delay-processor.js';
|
|
37
|
+
export * from './built-in/background/sample-input-validated-processor-data.js';
|
|
38
|
+
export * from './built-in/background/sample-input-validated-processor.js';
|
|
39
|
+
export * from './built-in/daemon/daemon-authorizer-function.js';
|
|
40
|
+
export * from './built-in/daemon/daemon-config.js';
|
|
41
|
+
export * from './built-in/daemon/daemon-group-selection-function.js';
|
|
42
|
+
export * from './built-in/daemon/daemon-handler.js';
|
|
43
|
+
export * from './built-in/daemon/daemon-process-state-list.js';
|
|
44
|
+
export * from './built-in/http/apollo-filter.js';
|
|
45
|
+
export * from './built-in/http/built-in-auth-filters.js';
|
|
46
|
+
export * from './built-in/http/built-in-authorizers.js';
|
|
47
|
+
export * from './built-in/http/built-in-filters.js';
|
|
48
|
+
export * from './built-in/http/built-in-handlers.js';
|
|
49
|
+
export * from './built-in/http/log-level-manipulation-filter.js';
|
|
50
|
+
export * from './built-in/http/run-handler-as-filter.js';
|
|
51
|
+
export * from './cli/ratchet-cli-handler.js';
|
|
52
|
+
export * from './cli/run-background-process-from-command-line.js';
|
|
53
|
+
export * from './config/dynamo-db-config.js';
|
|
54
|
+
export * from './config/epsilon-config.js';
|
|
55
|
+
export * from './config/epsilon-lambda-event-handler.js';
|
|
56
|
+
export * from './config/epsilon-logger-config.js';
|
|
57
|
+
export * from './config/generic-aws-event-handler-function.js';
|
|
58
|
+
export * from './config/logging-trace-id-generator.js';
|
|
59
|
+
export * from './config/s3-config.js';
|
|
60
|
+
export * from './config/sns-config.js';
|
|
61
|
+
export * from './config/background/background-aws-config.js';
|
|
62
|
+
export * from './config/background/background-config.js';
|
|
63
|
+
export * from './config/background/background-error-processor.js';
|
|
64
|
+
export * from './config/background/background-processor.js';
|
|
65
|
+
export * from './config/background/background-transaction-log.js';
|
|
66
|
+
export * from './config/background/background-transaction-logger.js';
|
|
67
|
+
export * from './config/cron/abstract-cron-entry.js';
|
|
68
|
+
export * from './config/cron/cron-background-entry.js';
|
|
69
|
+
export * from './config/cron/cron-config.js';
|
|
70
|
+
export * from './config/http/authorizer-function.js';
|
|
71
|
+
export * from './config/http/epsilon-authorization-context.js';
|
|
72
|
+
export * from './config/http/extended-api-gateway-event.js';
|
|
73
|
+
export * from './config/http/filter-chain-context.js';
|
|
74
|
+
export * from './config/http/filter-function.js';
|
|
75
|
+
export * from './config/http/handler-function.js';
|
|
76
|
+
export * from './config/http/http-config.js';
|
|
77
|
+
export * from './config/http/http-processing-config.js';
|
|
78
|
+
export * from './config/http/mapped-http-processing-config.js';
|
|
79
|
+
export * from './config/http/null-returned-object-handling.js';
|
|
80
|
+
export * from './config/inter-api/inter-api-aws-config.js';
|
|
81
|
+
export * from './config/inter-api/inter-api-config.js';
|
|
82
|
+
export * from './config/inter-api/inter-api-process-mapping.js';
|
|
83
|
+
export * from './config/open-api/open-api-document-components.js';
|
|
84
|
+
export * from './config/open-api/open-api-document-path.js';
|
|
85
|
+
export * from './config/open-api/open-api-document.js';
|
|
86
|
+
export * from './http/event-util.js';
|
|
87
|
+
export * from './http/response-util.js';
|
|
88
|
+
export * from './http/web-handler.js';
|
|
89
|
+
export * from './http/web-v2-handler.js';
|
|
90
|
+
export * from './http/auth/api-gateway-adapter-authentication-handler.js';
|
|
91
|
+
export * from './http/auth/auth0-web-token-manipulator.js';
|
|
92
|
+
export * from './http/auth/basic-auth-token.js';
|
|
93
|
+
export * from './http/auth/google-web-token-manipulator.js';
|
|
94
|
+
export * from './http/auth/jwt-ratchet-local-web-token-manipulator.js';
|
|
95
|
+
export * from './http/auth/local-web-token-manipulator.js';
|
|
96
|
+
export * from './http/auth/web-token-manipulator.js';
|
|
97
|
+
export * from './http/error/bad-gateway.js';
|
|
98
|
+
export * from './http/error/bad-request-error.js';
|
|
99
|
+
export * from './http/error/conflict-error.js';
|
|
100
|
+
export * from './http/error/epsilon-http-error.js';
|
|
101
|
+
export * from './http/error/forbidden-error.js';
|
|
102
|
+
export * from './http/error/gateway-timeout.js';
|
|
103
|
+
export * from './http/error/method-not-allowed-error.js';
|
|
104
|
+
export * from './http/error/misconfigured-error.js';
|
|
105
|
+
export * from './http/error/not-found-error.js';
|
|
106
|
+
export * from './http/error/not-implemented.js';
|
|
107
|
+
export * from './http/error/request-timeout-error.js';
|
|
108
|
+
export * from './http/error/service-unavailable.js';
|
|
109
|
+
export * from './http/error/too-many-requests-error.js';
|
|
110
|
+
export * from './http/error/unauthorized-error.js';
|
|
111
|
+
export * from './http/route/epsilon-router.js';
|
|
112
|
+
export * from './http/route/extended-auth-response-context.js';
|
|
113
|
+
export * from './http/route/route-mapping.js';
|
|
114
|
+
export * from './http/route/route-validator-config.js';
|
|
115
|
+
export * from './http/route/router-util.js';
|
|
116
|
+
export * from './inter-api/inter-api-entry.js';
|
|
117
|
+
export * from './inter-api/inter-api-util.js';
|
|
118
|
+
export * from './lambda-event-handler/cron-epsilon-lambda-event-handler.js';
|
|
119
|
+
export * from './lambda-event-handler/dynamo-epsilon-lambda-event-handler.js';
|
|
120
|
+
export * from './lambda-event-handler/generic-sns-epsilon-lambda-event-handler.js';
|
|
121
|
+
export * from './lambda-event-handler/inter-api-epsilon-lambda-event-handler.js';
|
|
122
|
+
export * from './lambda-event-handler/s3-epsilon-lambda-event-handler.js';
|
|
123
|
+
export * from './open-api-util/open-api-doc-modifications.js';
|
|
124
|
+
export * from './open-api-util/open-api-doc-modifier.js';
|
|
125
|
+
export * from './open-api-util/yaml-combiner.js';
|
|
126
|
+
export * from './sample/sample-server-components.js';
|
|
127
|
+
export * from './sample/sample-server-static-files.js';
|
|
128
|
+
export * from './sample/test-error-server.js';
|
|
129
|
+
export * from './util/aws-util.js';
|
|
130
|
+
export * from './util/context-util.js';
|
|
131
|
+
export * from './util/cron-util.js';
|
|
132
|
+
export * from './util/epsilon-config-parser.js';
|