Skip to main content

gateway-nginx/src

Type Aliases

FieldRef

FieldRef = object
Defined in: packages/gateway-nginx/src/types.ts:5

Properties

path
path: string
Defined in: packages/gateway-nginx/src/types.ts:6
source
source: "body" | "headers" | "status"
Defined in: packages/gateway-nginx/src/types.ts:7

GeneratorInput

GeneratorInput = object
Defined in: packages/gateway-nginx/src/types.ts:21

Properties

extraDirectives?
optional extraDirectives: string[]
Defined in: packages/gateway-nginx/src/types.ts:27
routes
routes: RouteConfig[]
Defined in: packages/gateway-nginx/src/types.ts:22
sidecarURL
sidecarURL: string
Defined in: packages/gateway-nginx/src/types.ts:23
sitePrefix?
optional sitePrefix: string
Defined in: packages/gateway-nginx/src/types.ts:26
specRoot?
optional specRoot: string
Defined in: packages/gateway-nginx/src/types.ts:25
upstreamURL
upstreamURL: string
Defined in: packages/gateway-nginx/src/types.ts:24

GeneratorOutput

GeneratorOutput = object
Defined in: packages/gateway-nginx/src/types.ts:30

Properties

locationsConf
locationsConf: string
Defined in: packages/gateway-nginx/src/types.ts:31
luaFiles
luaFiles: Map<string, string>
Defined in: packages/gateway-nginx/src/types.ts:32
warnings
warnings: string[]
Defined in: packages/gateway-nginx/src/types.ts:33

PricingMode

PricingMode = "two-phase" | "one-phase"
Defined in: packages/gateway-nginx/src/types.ts:10

RouteConfig

RouteConfig = object
Defined in: packages/gateway-nginx/src/types.ts:12

Properties

captureFields
captureFields: FieldRef[]
Defined in: packages/gateway-nginx/src/types.ts:18
method
method: string
Defined in: packages/gateway-nginx/src/types.ts:14
path
path: string
Defined in: packages/gateway-nginx/src/types.ts:13
pricingMode
pricingMode: PricingMode
Defined in: packages/gateway-nginx/src/types.ts:17
pricingRules
pricingRules: Record<string, string>
Defined in: packages/gateway-nginx/src/types.ts:15
transportType
transportType: TransportType
Defined in: packages/gateway-nginx/src/types.ts:16

TransportType

TransportType = "json" | "sse" | "websocket"
Defined in: packages/middleware-openapi/dist/src/types.d.ts:21

Functions

analyzeRule()

analyzeRule(rule): AnalysisResult
Defined in: packages/gateway-nginx/src/analyzer.ts:193

Parameters

rule
AnalyzedRule

Returns

AnalysisResult

convertPath()

convertPath(path): LocationDirective
Defined in: packages/gateway-nginx/src/path.ts:108

Parameters

path
string

Returns

LocationDirective

detectOverlaps()

detectOverlaps(paths): string[]
Defined in: packages/gateway-nginx/src/path.ts:119

Parameters

paths
string[]

Returns

string[]

extractGatewaySpec()

extractGatewaySpec(doc): ParsedSpec
Defined in: packages/gateway-nginx/src/parser.ts:72 Convert an already-dereferenced OpenAPI document into an nginx-ready route set. Runs the same validation as loadGatewaySpec.

Parameters

doc
Record<string, unknown>

Returns

ParsedSpec

generateConfig()

generateConfig(input): GeneratorOutput
Defined in: packages/gateway-nginx/src/index.ts:24 Generate nginx location blocks and a bundled Lua module for a set of parsed routes. Produces:
  • locationsConf — the location block text. The operator includes this inside their own server { } block via include locations.conf;.
  • luaFiles — standalone Lua modules that the generated config will require() at runtime. The operator places these in their lua_package_path. Currently produces a single faremeter.lua bundle.
  • warnings — non-fatal concerns detected at generation time.
Pure function: does no I/O, no network calls, no filesystem access. Safe to call in tests.

Parameters

input
GeneratorInput

Returns

GeneratorOutput

generateLuaFiles()

generateLuaFiles(): Map<string, string>
Defined in: packages/gateway-nginx/src/lua/index.ts:21

Returns

Map<string, string>

generateNginxConf()

generateNginxConf(opts): NginxGeneratorResult
Defined in: packages/gateway-nginx/src/nginx/index.ts:18

Parameters

opts
NginxGeneratorOpts

Returns

NginxGeneratorResult

loadGatewaySpec()

loadGatewaySpec(filePath): Promise<ParsedSpec>
Defined in: packages/gateway-nginx/src/parser.ts:63 Load and parse an OpenAPI spec file into an nginx-ready route set.

Parameters

filePath
string

Returns

Promise<ParsedSpec>