This version (v0.7) has not been published to npm yet.
Skip to content

Reference / @getenginex/sdk/extension / ExtensionRequestSpec

ExtensionRequestSpec<T> ​

Description of a request made by a product package via ExtensionTransport.request. Stable contract: new fields only come in as optional.

Example ​

ts
transport.request({
  method: 'POST',
  path: `/casino/games/${encodeURIComponent(gameId)}/launch`,
  body: { mode: 'real' },
  auth: 'required',
  validation: 'strict',
  schema: launchSchema(),
  options,
})

Type Parameters ​

T ​

T

Properties ​

auth? ​

optional auth?: ExtensionAuthMode

Session use. Default: 'none'.


body? ​

optional body?: unknown

Body, in wire format (snake_case), serialized as JSON. A FormData goes as multipart (the runtime sets the Content-Type with the boundary; the hooks receive only the field names and the type and size of the files) — requires core >=0.4.0.


idempotent? ​

optional idempotent?: boolean

true sends an Idempotency-Key header: the one from options.idempotencyKey (the app passes it to repeat the operation without duplicating it) or, without it, one generated per call; either way it is reused on the retry after a renewed 401. With false, options.idempotencyKey is ignored. For routes that move money or create resources and that the gateway protects with the idempotency middleware. Default: false.


method ​

method: HttpMethod

HTTP method.


options? ​

optional options?: CallOptions

Call options received by the public method (signal, fetchOptions), passed on as they are.


path ​

path: string

Path after /api/v1, starting with /, e.g. /casino/games. Segments coming from the app (ids) must go through encodeURIComponent. No query string: use query. A segment that, decoded and trimmed, is . or .. (the URL would normalize it to another route) rejects with INVALID_ARGUMENT (status: 0) before any fetch.


query? ​

optional query?: Record<string, ExtensionQueryValue>

Query string, in wire format (snake_case). undefined/null values are omitted.


schema ​

schema: ZodMiniType<T>

Response schema, without the { success, data, meta } envelope (see wire).


validation? ​

optional validation?: "strict"

'strict' makes this request throw VALIDATION_ERROR when the response does not match the schema, even with the client on validation: 'warn'. Use it on routes that return tokens, secrets or session URLs (e.g. a game's launch). Without it, the client's validation applies.