@karmaniverous/smoz
    Preparing search index...

    Class App<GlobalParamsSchema, StageParamsSchema, EventTypeMapSchema>

    Application class. *

    Type Parameters

    • GlobalParamsSchema extends ZodObj

      Zod object schema for global parameters

    • StageParamsSchema extends ZodObj

      Zod object schema for per‑stage parameters

    • EventTypeMapSchema extends ZodObj

      Zod object schema mapping event tokens to runtime types

    Index

    Properties

    appRootAbs: string
    buildFnEnv: (fnEnvKeys?: readonly string[]) => Record<string, string>
    environment: Record<string, string>
    eventTypeMapSchema: EventTypeMapSchema
    globalParamsSchema: GlobalParamsSchema
    httpEventTypeTokens: readonly string[]
    serverless: {
        defaultHandlerFileExport: string;
        defaultHandlerFileName: string;
        httpContextEventMap: SecurityContextHttpEventMap;
    }

    Type Declaration

    • defaultHandlerFileExport: string
    • defaultHandlerFileName: string

      Used to construct default handler string if missing on a function

    • httpContextEventMap: SecurityContextHttpEventMap

      Context -> event fragment to merge into generated http events

    stageParamsSchema: StageParamsSchema
    stages: { default: { params: GlobalParams } } & {
        [key: string]: { params: StageParams };
    }

    Methods

    • Aggregate OpenAPI path items across the registry.

      Returns ZodOpenApiPathsObject

      ZodOpenApiPathsObject to be embedded in a full OpenAPI document

    • Aggregate Serverless function definitions across the registry.

      Returns undefined | { [k: string]: {} }

      An AWS['functions'] object suitable for serverless.ts

      • undefined
      • { [k: string]: {} }
        • [k: string]: {}

          This interface was referenced by undefined's JSON-Schema definition via the patternProperty "^[a-zA-Z0-9-_]+$".

    • Register a function (HTTP or non‑HTTP).

      Type Parameters

      • EventType extends string

        A key from your eventTypeMapSchema (e.g., 'rest' | 'http' | 'sqs' | 'step')

      • EventSchema extends undefined | ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>

        Optional Zod schema validated BEFORE the handler (refines event shape) *

      • ResponseSchema extends undefined | ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>

        Optional Zod schema validated AFTER the handler (refines response shape) *

      Parameters

      • options: {
            basePath?: string;
            callerModuleUrl: string;
            contentType?: string;
            endpointsRootAbs: string;
            eventSchema?: EventSchema;
            eventType: EventType;
            fnEnvKeys?: readonly (
                keyof output<GlobalParamsSchema>
                | keyof output<StageParamsSchema>
            )[];
            functionName?: string;
            httpContexts?: readonly HttpContext[];
            method?:
                | "options"
                | "head"
                | "trace"
                | "get"
                | "put"
                | "post"
                | "delete"
                | "patch"
                | `x-${string}`
                | "$ref"
                | "summary"
                | "description"
                | "servers"
                | "parameters";
            responseSchema?: ResponseSchema;
        }

        per‑function configuration (method/basePath/httpContexts for HTTP; serverless extras for non‑HTTP)

      Returns {
          handler: (
              business: Handler<
                  EventSchema,
                  ResponseSchema,
                  (
                      output<EventTypeMapSchema> & {
                          alb: ALBEvent;
                          cloudfront: CloudFrontRequestEvent;
                          "cloudwatch-logs": CloudWatchLogsEvent;
                          "cognito-userpool": CognitoUserPoolTriggerEvent;
                          dynamodb: DynamoDBStreamEvent;
                          eventbridge: EventBridgeEvent<string, unknown>;
                          firehose: FirehoseTransformationEvent;
                          http: APIGatewayProxyEventV2;
                          kinesis: KinesisStreamEvent;
                          rest: APIGatewayProxyEvent;
                          s3: S3Event;
                          ses: SESEvent;
                          sns: SNSEvent;
                          sqs: SQSEvent;
                          step: { Payload?: unknown; [key: string]: unknown };
                      }
                  )[EventType],
              >,
          ) => (
              event: unknown,
              context: Context,
          ) => Promise<
              ResponseSchema extends ZodType<
                  unknown,
                  unknown,
                  $ZodTypeInternals<unknown, unknown>,
              >
                  ? output<ResponseSchema<ResponseSchema>>
                  : unknown,
          >;
          openapi: (baseOperation: BaseOperation) => void;
          serverless: (extras: unknown) => void;
      }

      a per‑function API: { handler(business), openapi(baseOperation), serverless(extras) }

    • Type Parameters

      • GlobalParamsSchema extends ZodObj
      • StageParamsSchema extends ZodObj
      • EventTypeMapSchema extends ZodObj

      Returns App<GlobalParamsSchema, StageParamsSchema, EventTypeMapSchema>

    • Type Parameters

      • GlobalParamsSchema extends ZodObj
      • StageParamsSchema extends ZodObj

      Parameters

      • init: Omit<
            AppInit<
                GlobalParamsSchema,
                StageParamsSchema,
                ZodObject<
                    {
                        alb: ZodCustom<ALBEvent, ALBEvent>;
                        cloudfront: ZodCustom<CloudFrontRequestEvent, CloudFrontRequestEvent>;
                        "cloudwatch-logs": ZodCustom<CloudWatchLogsEvent, CloudWatchLogsEvent>;
                        "cognito-userpool": ZodCustom<
                            CognitoUserPoolTriggerEvent,
                            CognitoUserPoolTriggerEvent,
                        >;
                        dynamodb: ZodCustom<DynamoDBStreamEvent, DynamoDBStreamEvent>;
                        eventbridge: ZodCustom<
                            EventBridgeEvent<string, unknown>,
                            EventBridgeEvent<string, unknown>,
                        >;
                        firehose: ZodCustom<
                            FirehoseTransformationEvent,
                            FirehoseTransformationEvent,
                        >;
                        http: ZodCustom<APIGatewayProxyEventV2, APIGatewayProxyEventV2>;
                        kinesis: ZodCustom<KinesisStreamEvent, KinesisStreamEvent>;
                        rest: ZodCustom<APIGatewayProxyEvent, APIGatewayProxyEvent>;
                        s3: ZodCustom<S3Event, S3Event>;
                        ses: ZodCustom<SESEvent, SESEvent>;
                        sns: ZodCustom<SNSEvent, SNSEvent>;
                        sqs: ZodCustom<SQSEvent, SQSEvent>;
                        step: ZodObject<
                            { Payload: ZodOptional<ZodUnknown> },
                            $catchall<ZodUnknown>,
                        >;
                    },
                    $strip,
                >,
            >,
            "eventTypeMapSchema",
        > & { eventTypeMapSchema?: undefined }

      Returns App<
          GlobalParamsSchema,
          StageParamsSchema,
          ZodObject<
              {
                  alb: ZodCustom<ALBEvent, ALBEvent>;
                  cloudfront: ZodCustom<CloudFrontRequestEvent, CloudFrontRequestEvent>;
                  "cloudwatch-logs": ZodCustom<CloudWatchLogsEvent, CloudWatchLogsEvent>;
                  "cognito-userpool": ZodCustom<
                      CognitoUserPoolTriggerEvent,
                      CognitoUserPoolTriggerEvent,
                  >;
                  dynamodb: ZodCustom<DynamoDBStreamEvent, DynamoDBStreamEvent>;
                  eventbridge: ZodCustom<
                      EventBridgeEvent<string, unknown>,
                      EventBridgeEvent<string, unknown>,
                  >;
                  firehose: ZodCustom<
                      FirehoseTransformationEvent,
                      FirehoseTransformationEvent,
                  >;
                  http: ZodCustom<APIGatewayProxyEventV2, APIGatewayProxyEventV2>;
                  kinesis: ZodCustom<KinesisStreamEvent, KinesisStreamEvent>;
                  rest: ZodCustom<APIGatewayProxyEvent, APIGatewayProxyEvent>;
                  s3: ZodCustom<S3Event, S3Event>;
                  ses: ZodCustom<SESEvent, SESEvent>;
                  sns: ZodCustom<SNSEvent, SNSEvent>;
                  sqs: ZodCustom<SQSEvent, SQSEvent>;
                  step: ZodObject<
                      { Payload: ZodOptional<ZodUnknown> },
                      $catchall<ZodUnknown>,
                  >;
              },
              $strip,
          >,
      >