AshTypescript.Rpc.Codegen.TypeGenerators.PaginationTypes (ash_typescript v0.17.3)

Copy Markdown View Source

Generates TypeScript pagination result types for RPC actions.

Supports:

  • Offset pagination (limit/offset)
  • Keyset pagination (limit/after/before)
  • Mixed pagination (both offset and keyset)
  • Conditional pagination (optional pagination)

Summary

Functions

Generates a conditional pagination result type (pagination is optional).

Generates the pagination result type based on the action's pagination support.

Functions

generate_conditional_pagination_result_type(resource, action, rpc_action_name_pascal, schema_ref, has_metadata)

Generates a conditional pagination result type (pagination is optional).

Uses TypeScript conditional types to return either a plain array (no pagination) or a paginated result based on the presence of the page config parameter.

Parameters

  • _resource - The Ash resource (unused but kept for consistency)
  • action - The Ash action
  • rpc_action_name_pascal - The PascalCase name of the RPC action
  • schema_ref - The TypeScript resource type name
  • has_metadata - Boolean indicating if metadata is enabled

Returns

A string containing the TypeScript conditional result type definition.

generate_pagination_result_type(resource, action, rpc_action_name_pascal, schema_ref, has_metadata)

Generates the pagination result type based on the action's pagination support.

This function is used when pagination is required (not optional).

Parameters

  • _resource - The Ash resource (unused but kept for consistency)
  • action - The Ash action
  • rpc_action_name_pascal - The PascalCase name of the RPC action
  • schema_ref - The TypeScript resource type name
  • has_metadata - Boolean indicating if metadata is enabled

Returns

A string containing the TypeScript result type definition for the appropriate pagination type.