@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.
Files changed (154) hide show
  1. package/CHANGELOG.md +177 -0
  2. package/License.txt +13 -0
  3. package/README.md +242 -0
  4. package/bin/cli.js +10 -0
  5. package/lib/background/background-dynamo-log-table-handler.d.ts +11 -0
  6. package/lib/background/background-entry.d.ts +4 -0
  7. package/lib/background/background-execution-event-type.d.ts +7 -0
  8. package/lib/background/background-execution-event.d.ts +8 -0
  9. package/lib/background/background-execution-listener.d.ts +5 -0
  10. package/lib/background/background-handler.d.ts +29 -0
  11. package/lib/background/background-http-adapter-handler.d.ts +22 -0
  12. package/lib/background/background-meta-response-internal.d.ts +5 -0
  13. package/lib/background/background-process-handling.d.ts +4 -0
  14. package/lib/background/background-process-log-table-entry.d.ts +11 -0
  15. package/lib/background/background-queue-response-internal.d.ts +8 -0
  16. package/lib/background/background-validator.d.ts +17 -0
  17. package/lib/background/epsilon-background-process-error.d.ts +30 -0
  18. package/lib/background/internal-background-entry.d.ts +7 -0
  19. package/lib/background/manager/abstract-background-manager.d.ts +19 -0
  20. package/lib/background/manager/aws-sqs-sns-background-manager.d.ts +23 -0
  21. package/lib/background/manager/background-manager-like.d.ts +17 -0
  22. package/lib/background/manager/background-manager.spec.d.ts +1 -0
  23. package/lib/background/manager/single-thread-local-background-manager.d.ts +15 -0
  24. package/lib/background/s3-background-transaction-logger.d.ts +17 -0
  25. package/lib/build/ratchet-epsilon-common-info.d.ts +5 -0
  26. package/lib/built-in/background/echo-processor.d.ts +7 -0
  27. package/lib/built-in/background/log-and-enqueue-echo-processor.d.ts +6 -0
  28. package/lib/built-in/background/log-message-background-error-processor.d.ts +5 -0
  29. package/lib/built-in/background/no-op-processor.d.ts +6 -0
  30. package/lib/built-in/background/retry-processor.d.ts +16 -0
  31. package/lib/built-in/background/sample-delay-processor.d.ts +6 -0
  32. package/lib/built-in/background/sample-input-validated-processor-data.d.ts +4 -0
  33. package/lib/built-in/background/sample-input-validated-processor.d.ts +8 -0
  34. package/lib/built-in/built-in-trace-id-generators.d.ts +5 -0
  35. package/lib/built-in/daemon/daemon-authorizer-function.d.ts +5 -0
  36. package/lib/built-in/daemon/daemon-config.d.ts +8 -0
  37. package/lib/built-in/daemon/daemon-group-selection-function.d.ts +4 -0
  38. package/lib/built-in/daemon/daemon-handler.d.ts +16 -0
  39. package/lib/built-in/daemon/daemon-process-state-list.d.ts +5 -0
  40. package/lib/built-in/http/apollo-filter.d.ts +10 -0
  41. package/lib/built-in/http/built-in-auth-filters.d.ts +9 -0
  42. package/lib/built-in/http/built-in-authorizers.d.ts +8 -0
  43. package/lib/built-in/http/built-in-filters.d.ts +25 -0
  44. package/lib/built-in/http/built-in-handlers.d.ts +9 -0
  45. package/lib/built-in/http/log-level-manipulation-filter.d.ts +6 -0
  46. package/lib/built-in/http/run-handler-as-filter.d.ts +12 -0
  47. package/lib/built-in/http/run-handler-as-filter.spec.d.ts +1 -0
  48. package/lib/cli/ratchet-cli-handler.d.ts +6 -0
  49. package/lib/cli/run-background-process-from-command-line.d.ts +3 -0
  50. package/lib/config/background/background-aws-config.d.ts +7 -0
  51. package/lib/config/background/background-config.d.ts +14 -0
  52. package/lib/config/background/background-error-processor.d.ts +4 -0
  53. package/lib/config/background/background-processor.d.ts +6 -0
  54. package/lib/config/background/background-transaction-log.d.ts +8 -0
  55. package/lib/config/background/background-transaction-logger.d.ts +5 -0
  56. package/lib/config/cron/abstract-cron-entry.d.ts +12 -0
  57. package/lib/config/cron/cron-background-entry.d.ts +6 -0
  58. package/lib/config/cron/cron-config.d.ts +6 -0
  59. package/lib/config/dynamo-db-config.d.ts +5 -0
  60. package/lib/config/epsilon-config.d.ts +21 -0
  61. package/lib/config/epsilon-lambda-event-handler.d.ts +7 -0
  62. package/lib/config/epsilon-logger-config.d.ts +13 -0
  63. package/lib/config/generic-aws-event-handler-function.d.ts +3 -0
  64. package/lib/config/http/authorizer-function.d.ts +6 -0
  65. package/lib/config/http/epsilon-authorization-context.d.ts +5 -0
  66. package/lib/config/http/extended-api-gateway-event.d.ts +7 -0
  67. package/lib/config/http/filter-chain-context.d.ts +14 -0
  68. package/lib/config/http/filter-function.d.ts +4 -0
  69. package/lib/config/http/handler-function.d.ts +5 -0
  70. package/lib/config/http/http-config.d.ts +15 -0
  71. package/lib/config/http/http-processing-config.d.ts +11 -0
  72. package/lib/config/http/mapped-http-processing-config.d.ts +7 -0
  73. package/lib/config/http/null-returned-object-handling.d.ts +5 -0
  74. package/lib/config/inter-api/inter-api-aws-config.d.ts +5 -0
  75. package/lib/config/inter-api/inter-api-config.d.ts +6 -0
  76. package/lib/config/inter-api/inter-api-process-mapping.d.ts +6 -0
  77. package/lib/config/logging-trace-id-generator.d.ts +4 -0
  78. package/lib/config/open-api/open-api-document-components.d.ts +4 -0
  79. package/lib/config/open-api/open-api-document-path.d.ts +2 -0
  80. package/lib/config/open-api/open-api-document.d.ts +6 -0
  81. package/lib/config/s3-config.d.ts +6 -0
  82. package/lib/config/sns-config.d.ts +5 -0
  83. package/lib/epsilon-build-properties.d.ts +9 -0
  84. package/lib/epsilon-constants.d.ts +16 -0
  85. package/lib/epsilon-global-handler.d.ts +20 -0
  86. package/lib/epsilon-instance.d.ts +14 -0
  87. package/lib/epsilon-logging-extension-processor.d.ts +6 -0
  88. package/lib/http/auth/api-gateway-adapter-authentication-handler.d.ts +8 -0
  89. package/lib/http/auth/auth0-web-token-manipulator.d.ts +13 -0
  90. package/lib/http/auth/basic-auth-token.d.ts +4 -0
  91. package/lib/http/auth/google-web-token-manipulator.d.ts +14 -0
  92. package/lib/http/auth/google-web-token-manipulator.spec.d.ts +1 -0
  93. package/lib/http/auth/jwt-ratchet-local-web-token-manipulator.d.ts +11 -0
  94. package/lib/http/auth/local-web-token-manipulator.d.ts +19 -0
  95. package/lib/http/auth/local-web-token-manipulator.spec.d.ts +1 -0
  96. package/lib/http/auth/web-token-manipulator.d.ts +4 -0
  97. package/lib/http/error/bad-gateway.d.ts +5 -0
  98. package/lib/http/error/bad-request-error.d.ts +5 -0
  99. package/lib/http/error/conflict-error.d.ts +5 -0
  100. package/lib/http/error/epsilon-http-error.d.ts +41 -0
  101. package/lib/http/error/epsilon-http-error.spec.d.ts +1 -0
  102. package/lib/http/error/forbidden-error.d.ts +5 -0
  103. package/lib/http/error/gateway-timeout.d.ts +5 -0
  104. package/lib/http/error/method-not-allowed-error.d.ts +5 -0
  105. package/lib/http/error/misconfigured-error.d.ts +5 -0
  106. package/lib/http/error/not-found-error.d.ts +5 -0
  107. package/lib/http/error/not-implemented.d.ts +5 -0
  108. package/lib/http/error/request-timeout-error.d.ts +5 -0
  109. package/lib/http/error/service-unavailable.d.ts +5 -0
  110. package/lib/http/error/too-many-requests-error.d.ts +5 -0
  111. package/lib/http/error/unauthorized-error.d.ts +5 -0
  112. package/lib/http/event-util.d.ts +25 -0
  113. package/lib/http/event-util.spec.d.ts +1 -0
  114. package/lib/http/response-util.d.ts +11 -0
  115. package/lib/http/response-util.spec.d.ts +1 -0
  116. package/lib/http/route/epsilon-router.d.ts +8 -0
  117. package/lib/http/route/extended-auth-response-context.d.ts +6 -0
  118. package/lib/http/route/route-mapping.d.ts +12 -0
  119. package/lib/http/route/route-validator-config.d.ts +5 -0
  120. package/lib/http/route/router-util.d.ts +23 -0
  121. package/lib/http/route/router-util.spec.d.ts +1 -0
  122. package/lib/http/web-handler.d.ts +23 -0
  123. package/lib/http/web-handler.spec.d.ts +1 -0
  124. package/lib/http/web-v2-handler.d.ts +10 -0
  125. package/lib/index.d.ts +132 -0
  126. package/lib/index.mjs +344 -0
  127. package/lib/index.mjs.map +1 -0
  128. package/lib/inter-api/inter-api-entry.d.ts +7 -0
  129. package/lib/inter-api/inter-api-util.d.ts +10 -0
  130. package/lib/inter-api/inter-api-util.spec.d.ts +1 -0
  131. package/lib/inter-api-manager.d.ts +14 -0
  132. package/lib/lambda-event-handler/cron-epsilon-lambda-event-handler.d.ts +14 -0
  133. package/lib/lambda-event-handler/cron-epsilon-lambda-event-handler.spec.d.ts +1 -0
  134. package/lib/lambda-event-handler/dynamo-epsilon-lambda-event-handler.d.ts +11 -0
  135. package/lib/lambda-event-handler/generic-sns-epsilon-lambda-event-handler.d.ts +10 -0
  136. package/lib/lambda-event-handler/inter-api-epsilon-lambda-event-handler.d.ts +10 -0
  137. package/lib/lambda-event-handler/s3-epsilon-lambda-event-handler.d.ts +10 -0
  138. package/lib/local-container-server.d.ts +11 -0
  139. package/lib/local-server-cert.d.ts +5 -0
  140. package/lib/local-server.d.ts +18 -0
  141. package/lib/open-api-util/open-api-doc-modifications.d.ts +8 -0
  142. package/lib/open-api-util/open-api-doc-modifier.d.ts +7 -0
  143. package/lib/open-api-util/open-api-doc-modifier.spec.d.ts +1 -0
  144. package/lib/open-api-util/yaml-combiner.d.ts +3 -0
  145. package/lib/open-api-util/yaml-combiner.spec.d.ts +1 -0
  146. package/lib/sample/sample-server-components.d.ts +10 -0
  147. package/lib/sample/sample-server-static-files.d.ts +5 -0
  148. package/lib/sample/test-error-server.d.ts +11 -0
  149. package/lib/util/aws-util.d.ts +8 -0
  150. package/lib/util/context-util.d.ts +33 -0
  151. package/lib/util/cron-util.d.ts +11 -0
  152. package/lib/util/cron-util.spec.d.ts +1 -0
  153. package/lib/util/epsilon-config-parser.d.ts +14 -0
  154. package/package.json +129 -0
@@ -0,0 +1,7 @@
1
+ export interface InterApiEntry<T> {
2
+ source: string;
3
+ type: string;
4
+ data: T;
5
+ traceId?: string;
6
+ traceDepth?: number;
7
+ }
@@ -0,0 +1,10 @@
1
+ import { SNSEvent } from 'aws-lambda';
2
+ import { InterApiEntry } from './inter-api-entry.js';
3
+ import { InterApiConfig } from '../config/inter-api/inter-api-config.js';
4
+ import { BackgroundManagerLike } from '../background/manager/background-manager-like.js';
5
+ export declare class InterApiUtil {
6
+ static isInterApiSnsEvent(event: any): boolean;
7
+ static extractEntryFromEvent(evt: SNSEvent): InterApiEntry<any>;
8
+ static processInterApiEvent(evt: SNSEvent, cfg: InterApiConfig, mgr: BackgroundManagerLike): Promise<string[]>;
9
+ static addTraceToInterApiEntry(ent: InterApiEntry<any>): InterApiEntry<any>;
10
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,14 @@
1
+ import { InterApiEntry } from './inter-api/inter-api-entry.js';
2
+ import { InterApiAwsConfig } from './config/inter-api/inter-api-aws-config.js';
3
+ import { SNSClient } from '@aws-sdk/client-sns';
4
+ export declare class InterApiManager {
5
+ private _aws;
6
+ private _sns;
7
+ constructor(_aws: InterApiAwsConfig, _sns: SNSClient);
8
+ get config(): InterApiAwsConfig;
9
+ get sns(): SNSClient;
10
+ createEntry<T>(type: string, data?: T): InterApiEntry<T>;
11
+ fireInterApiEventByParts<T>(type: string, data?: T): Promise<string>;
12
+ fireInterApiEvent<T>(entry: InterApiEntry<T>): Promise<string>;
13
+ writeMessageToSnsTopic(message: string): Promise<string>;
14
+ }
@@ -0,0 +1,14 @@
1
+ import { EpsilonLambdaEventHandler } from '../config/epsilon-lambda-event-handler.js';
2
+ import { Context, ProxyResult, ScheduledEvent } from 'aws-lambda';
3
+ import { EpsilonInstance } from '../epsilon-instance.js';
4
+ import { CronConfig } from '../config/cron/cron-config.js';
5
+ import { BackgroundHandler } from '../background/background-handler.js';
6
+ import { BackgroundManagerLike } from '../background/manager/background-manager-like.js';
7
+ export declare class CronEpsilonLambdaEventHandler implements EpsilonLambdaEventHandler<ScheduledEvent> {
8
+ private _epsilon;
9
+ constructor(_epsilon: EpsilonInstance);
10
+ extractLabel(evt: ScheduledEvent, context: Context): string;
11
+ handlesEvent(evt: any): boolean;
12
+ processEvent(evt: ScheduledEvent, context: Context): Promise<ProxyResult>;
13
+ static processCronEvent(evt: ScheduledEvent, cronConfig: CronConfig, backgroundManager: BackgroundManagerLike, background: BackgroundHandler): Promise<boolean>;
14
+ }
@@ -0,0 +1,11 @@
1
+ import { EpsilonLambdaEventHandler } from '../config/epsilon-lambda-event-handler.js';
2
+ import { Context, DynamoDBStreamEvent, ProxyResult } from 'aws-lambda';
3
+ import { EpsilonInstance } from '../epsilon-instance.js';
4
+ export declare class DynamoEpsilonLambdaEventHandler implements EpsilonLambdaEventHandler<DynamoDBStreamEvent> {
5
+ private _epsilon;
6
+ constructor(_epsilon: EpsilonInstance);
7
+ extractLabel(evt: DynamoDBStreamEvent, context: Context): string;
8
+ handlesEvent(evt: any): boolean;
9
+ processEvent(evt: DynamoDBStreamEvent, context: Context): Promise<ProxyResult>;
10
+ processUncaughtError(event: DynamoDBStreamEvent, context: Context, err: any): Promise<ProxyResult>;
11
+ }
@@ -0,0 +1,10 @@
1
+ import { EpsilonLambdaEventHandler } from '../config/epsilon-lambda-event-handler.js';
2
+ import { Context, ProxyResult, SNSEvent } from 'aws-lambda';
3
+ import { EpsilonInstance } from '../epsilon-instance.js';
4
+ export declare class GenericSnsEpsilonLambdaEventHandler implements EpsilonLambdaEventHandler<SNSEvent> {
5
+ private _epsilon;
6
+ constructor(_epsilon: EpsilonInstance);
7
+ extractLabel(evt: SNSEvent, context: Context): string;
8
+ handlesEvent(evt: any): boolean;
9
+ processEvent(evt: SNSEvent, context: Context): Promise<ProxyResult>;
10
+ }
@@ -0,0 +1,10 @@
1
+ import { EpsilonLambdaEventHandler } from '../config/epsilon-lambda-event-handler.js';
2
+ import { Context, ProxyResult, SNSEvent } from 'aws-lambda';
3
+ import { EpsilonInstance } from '../epsilon-instance.js';
4
+ export declare class InterApiEpsilonLambdaEventHandler implements EpsilonLambdaEventHandler<SNSEvent> {
5
+ private _epsilon;
6
+ constructor(_epsilon: EpsilonInstance);
7
+ extractLabel(evt: SNSEvent, context: Context): string;
8
+ handlesEvent(evt: any): boolean;
9
+ processEvent(evt: SNSEvent, context: Context): Promise<ProxyResult>;
10
+ }
@@ -0,0 +1,10 @@
1
+ import { EpsilonLambdaEventHandler } from '../config/epsilon-lambda-event-handler.js';
2
+ import { Context, ProxyResult, S3Event } from 'aws-lambda';
3
+ import { EpsilonInstance } from '../epsilon-instance.js';
4
+ export declare class S3EpsilonLambdaEventHandler implements EpsilonLambdaEventHandler<S3Event> {
5
+ private _epsilon;
6
+ constructor(_epsilon: EpsilonInstance);
7
+ extractLabel(evt: S3Event, context: Context): string;
8
+ handlesEvent(evt: any): boolean;
9
+ processEvent(evt: S3Event, context: Context): Promise<ProxyResult>;
10
+ }
@@ -0,0 +1,11 @@
1
+ /// <reference types="node" />
2
+ import { IncomingMessage, ServerResponse } from 'http';
3
+ export declare class LocalContainerServer {
4
+ private port;
5
+ private server;
6
+ private aborted;
7
+ constructor(port?: number);
8
+ runServer(): Promise<boolean>;
9
+ requestHandler(request: IncomingMessage, response: ServerResponse): Promise<any>;
10
+ static runFromCliArgs(args: string[]): Promise<void>;
11
+ }
@@ -0,0 +1,5 @@
1
+ export declare class LocalServerCert {
2
+ static readonly CLIENT_CSR: string;
3
+ static readonly CLIENT_CERT_PEM: string;
4
+ static readonly CLIENT_KEY_PEM: string;
5
+ }
@@ -0,0 +1,18 @@
1
+ /// <reference types="node" />
2
+ import { APIGatewayEvent, Context, ProxyResult } from 'aws-lambda';
3
+ import { IncomingMessage, ServerResponse } from 'http';
4
+ import { EpsilonGlobalHandler } from './epsilon-global-handler.js';
5
+ export declare class LocalServer {
6
+ private globalHandler;
7
+ private port;
8
+ private server;
9
+ private aborted;
10
+ constructor(globalHandler: EpsilonGlobalHandler, port?: number, https?: boolean);
11
+ runServer(): Promise<boolean>;
12
+ requestHandler(request: IncomingMessage, response: ServerResponse): Promise<any>;
13
+ static bodyAsBase64String(request: IncomingMessage): Promise<string>;
14
+ static messageToApiGatewayEvent(request: IncomingMessage, context: Context): Promise<APIGatewayEvent>;
15
+ static writeProxyResultToServerResponse(proxyResult: ProxyResult, response: ServerResponse): Promise<boolean>;
16
+ static runSampleBatchOnlyServerFromCliArgs(args: string[]): Promise<void>;
17
+ static runSampleLocalServerFromCliArgs(args: string[]): Promise<void>;
18
+ }
@@ -0,0 +1,8 @@
1
+ export interface OpenApiDocModifications {
2
+ newServerPath: string;
3
+ removeEndpoints: RegExp[];
4
+ removeTags: string[];
5
+ removeSchemas: string[];
6
+ sortEndpoints: boolean;
7
+ sortSchemas: boolean;
8
+ }
@@ -0,0 +1,7 @@
1
+ import { OpenApiDocModifications } from './open-api-doc-modifications.js';
2
+ export declare class OpenApiDocModifier {
3
+ private options;
4
+ constructor(options: OpenApiDocModifications);
5
+ modifyOpenApiDoc(yamlString: string): string;
6
+ private matchNone;
7
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ export declare class YamlCombiner {
2
+ static combine(files: string[], inRootPath?: string[]): string;
3
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ import { ApolloServer } from 'apollo-server-lambda';
2
+ import { EpsilonGlobalHandler } from '../epsilon-global-handler.js';
3
+ import { EpsilonConfig } from '../config/epsilon-config.js';
4
+ export declare class SampleServerComponents {
5
+ private constructor();
6
+ static createSampleApollo(): Promise<ApolloServer>;
7
+ static createSampleEpsilonConfig(label: string): Promise<EpsilonConfig>;
8
+ static createSampleEpsilonGlobalHandler(label: string): Promise<EpsilonGlobalHandler>;
9
+ static createSampleBatchOnlyEpsilonGlobalHandler(label: string): Promise<EpsilonGlobalHandler>;
10
+ }
@@ -0,0 +1,5 @@
1
+ export declare class SampleServerStaticFiles {
2
+ private constructor();
3
+ static readonly SAMPLE_OPEN_API_DOC: string;
4
+ static readonly SAMPLE_SERVER_GRAPHQL: string;
5
+ }
@@ -0,0 +1,11 @@
1
+ /// <reference types="node" />
2
+ import { IncomingMessage, ServerResponse } from 'http';
3
+ export declare class TestErrorServer {
4
+ private port;
5
+ private server;
6
+ private aborted;
7
+ constructor(port?: number);
8
+ runServer(): Promise<boolean>;
9
+ requestHandler(request: IncomingMessage, response: ServerResponse): Promise<any>;
10
+ static runFromCliArgs(args: string[]): Promise<void>;
11
+ }
@@ -0,0 +1,8 @@
1
+ import { APIGatewayEvent, APIGatewayEventRequestContextV2, APIGatewayEventRequestContextWithAuthorizer, APIGatewayProxyEventV2 } from 'aws-lambda';
2
+ export declare class AwsUtil {
3
+ static apiGatewayV2ToApiGatewayV1(srcEvt: APIGatewayProxyEventV2): APIGatewayEvent;
4
+ static apiGatewayV2RequestContextToApiGatewayV1RequestContext(srcEvt: APIGatewayEventRequestContextV2): APIGatewayEventRequestContextWithAuthorizer<any>;
5
+ static findInMap<T>(toFind: string, map: Map<string, T>): T;
6
+ static matchExact(r: any, str: any): boolean;
7
+ static resolvePotentialFunctionToResult<T>(src: any, def: T): T;
8
+ }
@@ -0,0 +1,33 @@
1
+ import { Context, ProxyResult } from 'aws-lambda';
2
+ import { EpsilonInstance } from '../epsilon-instance.js';
3
+ import { InternalBackgroundEntry } from '../background/internal-background-entry.js';
4
+ import { InterApiEntry } from '../inter-api/inter-api-entry.js';
5
+ export declare class ContextUtil {
6
+ private static CURRENT_EPSILON_REFERENCE;
7
+ private static CURRENT_CONTEXT;
8
+ private static CURRENT_EVENT;
9
+ private static CURRENT_LOG_VARS;
10
+ private static CURRENT_PROCESS_LABEL;
11
+ private static CURRENT_OVERRIDE_TRACE_ID;
12
+ private static CURRENT_OVERRIDE_TRACE_DEPTH;
13
+ private constructor();
14
+ static initContext(epsilon: EpsilonInstance, evt: any, ctx: Context, processLabel: string): void;
15
+ static clearContext(): void;
16
+ static setOverrideTrace(traceId: string, traceDepth: number): void;
17
+ static setOverrideTraceFromInternalBackgroundEntry(entry: InternalBackgroundEntry<any>): void;
18
+ static setOverrideTraceFromInterApiEntry(interApiEntry: InterApiEntry<any>): void;
19
+ static addHeadersToRecord(input: Record<string, any>, depthOffset?: number): void;
20
+ static addTraceToProxyResult(pr: ProxyResult): void;
21
+ static addTraceToHttpRequestInit(ri: RequestInit): void;
22
+ static setProcessLabel(processLabel: string): void;
23
+ static currentRequestId(): string;
24
+ static remainingTimeMS(): number;
25
+ static currentProcessLabel(): string;
26
+ private static traceHeaderName;
27
+ private static traceDepthHeaderName;
28
+ static currentTraceId(): string;
29
+ static currentTraceDepth(): number;
30
+ static addLogVariable(name: string, val: string | number | boolean): void;
31
+ static fetchLogVariable(name: string): string | number | boolean;
32
+ static fetchLogVariables(): Record<string, string | number | boolean>;
33
+ }
@@ -0,0 +1,11 @@
1
+ import { ScheduledEvent } from 'aws-lambda';
2
+ import { AbstractCronEntry } from '../config/cron/abstract-cron-entry.js';
3
+ import { CronConfig } from '../config/cron/cron-config.js';
4
+ export declare class CronUtil {
5
+ static everyNMinuteFilter(n: number): number[];
6
+ static everyNDaysOfYearFilter(n: number): number[];
7
+ static everyNElementFilter(n: number, m: number): number[];
8
+ static numberMatchesFilter(num: number, filter: number[]): boolean;
9
+ static eventMatchesEntry(event: ScheduledEvent, entry: AbstractCronEntry, cfg: CronConfig, testTimeEpochMS?: number): boolean;
10
+ static cronEntryName(entry: AbstractCronEntry, idx?: number): string;
11
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,14 @@
1
+ import { ModelValidator } from '@bitblit/ratchet-misc';
2
+ import { OpenApiDocument } from '../config/open-api/open-api-document.js';
3
+ import { EpsilonConfig } from '../config/epsilon-config.js';
4
+ import { EpsilonInstance } from '../epsilon-instance.js';
5
+ import { EpsilonGlobalHandler } from '../epsilon-global-handler.js';
6
+ import { BackgroundManagerLike } from '../background/manager/background-manager-like.js';
7
+ export declare class EpsilonConfigParser {
8
+ constructor();
9
+ static epsilonConfigToEpsilonGlobalHandler(config: EpsilonConfig, backgroundManager?: BackgroundManagerLike): EpsilonGlobalHandler;
10
+ static epsilonConfigToEpsilonInstance(config: EpsilonConfig, backgroundManager?: BackgroundManagerLike): EpsilonInstance;
11
+ static parseOpenApiDocument(yamlString: string): OpenApiDocument;
12
+ static openApiDocToValidator(doc: OpenApiDocument): ModelValidator;
13
+ static validateGlobalConfig(config: EpsilonConfig): void;
14
+ }
package/package.json ADDED
@@ -0,0 +1,129 @@
1
+ {
2
+ "name": "@bitblit/ratchet-epsilon-common",
3
+ "version": "4.0.1-alpha",
4
+ "description": "Tiny adapter to simplify building API gateway Lambda APIS",
5
+ "sideEffects": false,
6
+ "bin": {
7
+ "epsilon-cli": "./bin/cli.js"
8
+ },
9
+ "type": "module",
10
+ "files": [
11
+ "lib/*",
12
+ "bin/*"
13
+ ],
14
+ "exports": {
15
+ ".": {
16
+ "types": "./lib/index.d.ts",
17
+ "import": "./lib/index.mjs"
18
+ }
19
+ },
20
+ "contributors": [
21
+ "Christopher Weiss <bitblit@gmail.com>",
22
+ "Benn Linger <benn@bennlinger.com>",
23
+ "Lucas Myers <veganbeef@protonmail.com>",
24
+ "Zach Herridge"
25
+ ],
26
+ "husky": {
27
+ "hooks": {
28
+ "pre-commit": "pretty-quick --staged"
29
+ }
30
+ },
31
+ "prettier": {
32
+ "printWidth": 140,
33
+ "singleQuote": true,
34
+ "arrowParens": "always"
35
+ },
36
+ "config": {},
37
+ "scripts": {
38
+ "watch": "tsc-watch",
39
+ "clean": "shx rm -Rf lib",
40
+ "test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest",
41
+ "lint": "eslint src/**/*.ts",
42
+ "lint-fix": "eslint --fix src/**/*.ts",
43
+ "generate-barrels": "barrelsby -q --delete -d src -e .*\\.spec\\.ts && sed -i 's/\\x27;/.js\\x27;/' src/index.ts",
44
+ "build": "yarn clean && yarn generate-barrels && rollup -c rollup.config.js",
45
+ "force-build": "tsc --build --force",
46
+ "run-local-container-server": "yarn build && node bin/cli.js run-local-container-server",
47
+ "run-sample-server": "yarn build && node bin/cli.js run-sample-local-server",
48
+ "run-test-error-server": "yarn build && node bin/cli.js run-test-error-server",
49
+ "run-batch-sample-server": "yarn build && node bin/cli.js run-sample-local-batch-server",
50
+ "run-background-process-from-command-line-dry-run": "yarn build && node bin/cli.js run-background-process"
51
+ },
52
+ "repository": {
53
+ "type": "git",
54
+ "url": "https://github.com/bitblit/Ratchet"
55
+ },
56
+ "keywords": [
57
+ "epsilon",
58
+ "lambda",
59
+ "api gateway"
60
+ ],
61
+ "bugs": {
62
+ "url": "https://github.com/bitblit/Ratchet/issues"
63
+ },
64
+ "homepage": "https://github.com/bitblit/Ratchet#readme",
65
+ "engines": {
66
+ "node": ">=14.18"
67
+ },
68
+ "license": "Apache-2.0",
69
+ "dependencies": {
70
+ "@aws-sdk/client-s3": "3.332.0",
71
+ "@aws-sdk/client-sns": "3.332.0",
72
+ "@aws-sdk/client-sqs": "3.332.0",
73
+ "@bitblit/ratchet-aws": "4.0.1-alpha",
74
+ "@bitblit/ratchet-common": "4.0.1-alpha",
75
+ "@bitblit/ratchet-misc": "4.0.1-alpha",
76
+ "@bitblit/ratchet-node-only": "4.0.1-alpha",
77
+ "clear": "0.1.0",
78
+ "commander": "10.0.1",
79
+ "cross-fetch": "3.1.5",
80
+ "js-yaml": "4.1.0",
81
+ "jsonwebtoken": "9.0.0",
82
+ "jwks-rsa": "3.0.1",
83
+ "luxon": "3.3.0",
84
+ "reflect-metadata": "0.1.13",
85
+ "route-parser": "0.0.5",
86
+ "rxjs": "7.8.1",
87
+ "strip-js": "1.2.0",
88
+ "swagger-model-validator": "3.0.21"
89
+ },
90
+ "resolutions": {
91
+ "ansi-regex": "^5.0.1",
92
+ "ajv": "^6.12.6",
93
+ "axios": "^1.2.3",
94
+ "browserslist": "^4.21.4",
95
+ "express": "^4.18.2",
96
+ "follow-redirects": "^1.15.2",
97
+ "glob-parent": "^6.0.2",
98
+ "hosted-git-info": "^6.1.1",
99
+ "jose": "^4.11.2",
100
+ "json5": "^1.0.2",
101
+ "lodash": "^4.17.21",
102
+ "minimist": "^1.2.7",
103
+ "nanoid": "^4.0.0",
104
+ "node-fetch": "^2.6.7",
105
+ "nth-check": "^2.1.1",
106
+ "object-path": "^0.11.8",
107
+ "path-parse": "^1.0.7",
108
+ "shelljs": "^0.8.5",
109
+ "sanitize-html": "^2.8.0",
110
+ "semver-regex": "^4.0.5",
111
+ "tmpl": "^1.0.5",
112
+ "ws": "^8.12.0",
113
+ "y18n": "^5.0.8"
114
+ },
115
+ "peerDependencies": {
116
+ },
117
+ "peerDependenciesMeta": {
118
+ "graphql": {
119
+ "optional": true
120
+ }
121
+ },
122
+ "devDependencies": {
123
+ "@bitblit/ratchet-jest": "4.0.1-alpha",
124
+ "@types/aws-lambda": "8.10.115",
125
+ "apollo-server-lambda": "3.12.0",
126
+ "aws-sdk-client-mock": "2.1.1",
127
+ "graphql": "16.6.0"
128
+ }
129
+ }