Skip to content

ClientContextEnv

reference
1 min readUpdated

Kind: Interface

Source: src/adapter/aws-lambda/types.ts

Part of: Adapter

ClientContextEnv describes device and platform details from an AWS Lambda client context. It stores the platform version, platform name, device make and model, and locale for request-aware processing.

Properties

PropertyType
platformVersionstring
platformstring
makestring
modelstring
localestring

Diagram

mermaid
graph LR
  ClientContextEnv --> platformVersion
  ClientContextEnv --> platform
  ClientContextEnv --> make
  ClientContextEnv --> model
  ClientContextEnv --> locale

Usage

ts
import type { ClientContextEnv } from './types';

const environment: ClientContextEnv = {
  platformVersion: '17.0',
  platform: 'iOS',
  make: 'Apple',
  model: 'iPhone',
  locale: 'en-US',
};

function getDeviceLabel(env: ClientContextEnv): string {
  return `${env.make} ${env.model} (${env.platform} ${env.platformVersion})`;
}

console.log(getDeviceLabel(environment));

AI Coding Instructions

  • Keep all ClientContextEnv fields as strings when mapping AWS Lambda client context data.
  • Handle missing client context before creating a ClientContextEnv object.
  • Preserve the source locale value rather than converting it during request parsing.
  • Use this interface for device and platform metadata passed between the AWS Lambda adapter and request handling code.

How it works

ClientContextEnv is an exported TypeScript interface that declares the environment portion of a Lambda client context. It contains five required string fields: platformVersion, platform, make, model, and locale. [src/adapter/aws-lambda/types.ts:23-29]

It is the type of the required env property on ClientContext. [src/adapter/aws-lambda/types.ts:8-13] A ClientContext can appear as the optional clientContext property of LambdaContext, which is passed to handlers as their context argument. [src/adapter/aws-lambda/types.ts:35-56]

The interface declares no methods, runtime validation, error handling, or side effects. [src/adapter/aws-lambda/types.ts:23-29]

Was this page helpful?

Download as PDF
ClientContextEnv — Hono (narrator proof)