@bitblit/ratchet-epsilon-common 4.0.134-alpha → 4.0.136-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 CHANGED
@@ -22,6 +22,7 @@ package without knowing why it is alpha you'll get exactly what you deserve.
22
22
 
23
23
  - Added ability to serve HTTPS from the sample local server
24
24
  - Switched to AWS SDK version 3
25
+ - Switched to Apollo version 4
25
26
 
26
27
  ## [3.3.x] - 2023-01-02
27
28
 
@@ -0,0 +1,8 @@
1
+ import { BaseContext } from '@apollo/server';
2
+ import { EpsilonLambdaApolloContextFunctionArgument } from './epsilon-lambda-apollo-context-function-argument.js';
3
+ import { DefaultEpsilonApolloContext } from './default-epsilon-apollo-context.js';
4
+ export declare class ApolloUtil {
5
+ private constructor();
6
+ static emptyContext<T extends BaseContext>(): Promise<T>;
7
+ static defaultEpsilonApolloContext(args: EpsilonLambdaApolloContextFunctionArgument): Promise<DefaultEpsilonApolloContext<any>>;
8
+ }
@@ -0,0 +1,10 @@
1
+ import { APIGatewayEvent, Context } from 'aws-lambda';
2
+ import { JwtTokenBase } from '@bitblit/ratchet-common';
3
+ export interface DefaultEpsilonApolloContext<T extends JwtTokenBase> {
4
+ user?: T;
5
+ bearerTokenString?: string;
6
+ headers: Record<string, string>;
7
+ functionName: string;
8
+ lambdaEvent: APIGatewayEvent;
9
+ lambdaContext: Context;
10
+ }
@@ -0,0 +1,5 @@
1
+ export declare enum EpsilonApolloCorsMethod {
2
+ None = "None",
3
+ All = "All",
4
+ Reflective = "Reflective"
5
+ }
@@ -0,0 +1,5 @@
1
+ import { APIGatewayEvent, Context } from 'aws-lambda';
2
+ export interface EpsilonLambdaApolloContextFunctionArgument {
3
+ lambdaEvent: APIGatewayEvent;
4
+ lambdaContext: Context;
5
+ }
@@ -0,0 +1,8 @@
1
+ import { BaseContext, ContextFunction } from '@apollo/server';
2
+ import { EpsilonLambdaApolloContextFunctionArgument } from './epsilon-lambda-apollo-context-function-argument.js';
3
+ import { EpsilonApolloCorsMethod } from './epsilon-apollo-cors-method.js';
4
+ export interface EpsilonLambdaApolloOptions<TContext extends BaseContext> {
5
+ context?: ContextFunction<[EpsilonLambdaApolloContextFunctionArgument], TContext>;
6
+ timeoutMS?: number;
7
+ corsMethod?: EpsilonApolloCorsMethod;
8
+ }
@@ -1,10 +1,10 @@
1
1
  import { APIGatewayEvent, Context, ProxyResult } from 'aws-lambda';
2
- import { ApolloServer, CreateHandlerOptions } from 'apollo-server-lambda';
3
2
  import { FilterFunction } from '../../config/http/filter-function.js';
4
3
  import { FilterChainContext } from '../../config/http/filter-chain-context.js';
4
+ import { ApolloServer, BaseContext } from '@apollo/server';
5
+ import { EpsilonLambdaApolloOptions } from './apollo/epsilon-lambda-apollo-options.js';
5
6
  export declare class ApolloFilter {
6
- private static CACHE_APOLLO_HANDLER;
7
- static handlePathWithApollo(fCtx: FilterChainContext, apolloPathRegex: RegExp, apolloServer: ApolloServer, createHandlerOptions: CreateHandlerOptions): Promise<boolean>;
8
- static processApolloRequest(event: APIGatewayEvent, context: Context, apolloServer: ApolloServer, createHandlerOptions: CreateHandlerOptions): Promise<ProxyResult>;
9
- static addApolloFilterToList(filters: FilterFunction[], apolloPathRegex: RegExp, apolloServer: ApolloServer, createHandlerOptions: CreateHandlerOptions): void;
7
+ static handlePathWithApollo<T>(fCtx: FilterChainContext, apolloPathRegex: RegExp, apolloServer: ApolloServer<T>, options?: EpsilonLambdaApolloOptions<T>): Promise<boolean>;
8
+ static processApolloRequest<T>(event: APIGatewayEvent, context: Context, apolloServer: ApolloServer<T>, options?: EpsilonLambdaApolloOptions<T>): Promise<ProxyResult>;
9
+ static addApolloFilterToList(filters: FilterFunction[], apolloPathRegex: RegExp, apolloServer: ApolloServer, options?: EpsilonLambdaApolloOptions<BaseContext>): void;
10
10
  }
package/lib/index.d.ts CHANGED
@@ -48,6 +48,11 @@ export * from './built-in/http/built-in-filters.js';
48
48
  export * from './built-in/http/built-in-handlers.js';
49
49
  export * from './built-in/http/log-level-manipulation-filter.js';
50
50
  export * from './built-in/http/run-handler-as-filter.js';
51
+ export * from './built-in/http/apollo/apollo-util.js';
52
+ export * from './built-in/http/apollo/default-epsilon-apollo-context.js';
53
+ export * from './built-in/http/apollo/epsilon-apollo-cors-method.js';
54
+ export * from './built-in/http/apollo/epsilon-lambda-apollo-context-function-argument.js';
55
+ export * from './built-in/http/apollo/epsilon-lambda-apollo-options.js';
51
56
  export * from './cli/ratchet-cli-handler.js';
52
57
  export * from './cli/run-background-process-from-command-line.js';
53
58
  export * from './config/dynamo-db-config.js';