Skip to Content

Registry and fnKey

fnKey format

Every QA-callable unit gets one stable string id: the fnKey. The catalog, executeRPC, and wire clients all use this same string.

Shape: ClassName.methodName — a short namespace, a dot, then the method or export name.

// Valid keys (what tools show in the catalog) 'OrdersService.placeOrder' 'Billing.refund' 'UserService.findById' // Invalid for RPC — no dot → INVALID_FN_KEY 'placeOrder'

Think of the part before . as the group (class or module) and the part after as the member QA invokes.

How each registration path sets the key

1. cat(fnKey, fn) — you pass the full key:

import { cat, Return } from '@gloocan/cat-inspector' export const refund = cat('Billing.refund', async (orderId: string) => { return Return('OK', { orderId }) }) // fnKey → "Billing.refund"

2. catModule(moduleName, fns) — the SDK prefixes each export:

import { catModule, Return } from '@gloocan/cat-inspector' catModule('Billing', { refund: async (orderId: string) => Return('OK', { orderId }), }) // fnKey → "Billing.refund"

3. @Cat — key is ClassName.methodName from the class and property:

import { Cat, Return } from '@gloocan/cat-inspector' class UserService { @Cat async findById(id: string) { return Return('FOUND', { id }) } } // fnKey → "UserService.findById"

Calling by fnKey

RPC and transports pass the key unchanged; args are a positional array matching catalog params:

import { executeRPC } from '@gloocan/cat-inspector' const resp = await executeRPC({ requestId: '1', fnKey: 'UserService.findById', args: ['user-42'], }) // resp.status === 'ok' | 'error'; errors use codes like FN_NOT_FOUND, INVALID_FN_KEY

executeRPC returns INVALID_FN_KEY when the string has no . (message: must be ClassName.methodName). Keys with extra dots (e.g. My.Namespace.method) are accepted by validation but uncommon—prefer a single dot and a simple prefix.

Catalog row (RegistryEntry)

Each key maps to one RegistryEntry. Tools and transports serialize a snapshot of these rows (with optional body redaction). Important public fields:

FieldMeaning
modeservice, api_candidate, or api — see Cat modes.
styleclass (instance method) or function (standalone cat / catModule).
className, methodDisplay split of the fnKey.
paramsPositional parameters: name, type, optional kind / filePaths / fileArrayPaths, wire hints.
declaredReturnType string for the handler return.
returns, errors, apiResponsesLabel rows for Return / Throw / ApiReturn paths.
route, httpMethod, pipelineId, pipelineIndexPopulated when registered through an Express pipeline.
paramsJsonSchema, returnJsonSchemaOptional JSON Schemas for validation.
invokeKindrpc (default) or http_synthetic when an HTTP bridge is registered.

The handler reference lives on originalFn on the host; QA clients never receive executable code—only metadata and wire messages.