Skip to main content

RPC Resources

When vef.IntegrationModule is enabled, the framework registers the management resources below. All of them are RPC resources mounted under /api, using the standard envelope (resource, action, version, params, meta) documented in API. None of the operations are public: callers must be authenticated, and every operation declares the permission listed in its table.

Conventions used on this page:

  • CRUD read operations declare search structs embedding crud.Sortable — a meta struct — so their filter fields decode from the request's meta object; find_page additionally reads meta.page and meta.size (page.Pageable), and meta.sort carries sort specs.
  • find_page responds with page.Page[T]: page, size, total, items.
  • Mutations decode from params. Fields marked required are enforced by validation; the rest are optional.
  • All definition models carry the standard audited-model columns (id, createdAt, createdBy, updatedAt, updatedBy) in responses; they are omitted from the field tables below.

integration/contract

Contract definitions. Schemas are compiled at save time so a broken contract never reaches an invocation.

ActionPermissionInputOutput
find_pageintegration.contract.queryContractSearch + pageable metapage.Page[Contract]
find_allintegration.contract.queryContractSearchContract[]
createintegration.contract.createContractParamscreated Contract
updateintegration.contract.updateContractParamsupdated Contract
deleteintegration.contract.deleteprimary-key params (params.id)success

ContractSearch (query filters):

FieldTypeMatchDescription
codestringcontainsfilter by contract code fragment
namestringcontainsfilter by name fragment
isEnabledboolequalsfilter by enablement; omit to match both
labelsobject (string→string)equality on every pairhost-driven label filter (business-side contract pickers select by labels)

ContractParams (create/update):

FieldTypeRequiredDescription
idstringupdate onlyprimary key of the row to update
codestringYesunique contract code business code invokes
namestringYesdisplay name
descriptionstringNofree-text description
labelsobject (string→string)Nohost-owned selection metadata; keys must match ^[A-Za-z0-9]([A-Za-z0-9_-]*[A-Za-z0-9])?$ (63 characters max), values are bounded to 256 characters (ErrInvalidLabel)
inputSchemaJSON Schema objectNoself-contained draft 2020-12 schema for the invocation input; empty skips input validation
outputSchemaJSON Schema objectNoself-contained schema for the adapter's return value; empty skips output validation
isEnabledboolNodisabled contracts refuse invocation (ErrContractDisabled)

Deleting a contract still referenced by routes fails with the standard foreign-key violation error (the route table's contract column carries the empty-string wildcard sentinel, so this check is enforced by the resource).

integration/system

External system definitions. Writes encrypt sensitive auth parameters and the data source password; reads always mask them as "******". Submitting the mask back keeps the stored value unchanged.

ActionPermissionInputOutput
find_pageintegration.system.querySystemSearch + pageable metapage.Page[System] (masked)
find_allintegration.system.querySystemSearchSystem[] (masked)
createintegration.system.createSystemParamscreated System
updateintegration.system.updateSystemParamsupdated System
deleteintegration.system.deleteprimary-key params (params.id)success

Deleting a system — or removing/renaming its data source on update — releases its data source registry entry.

SystemSearch (query filters):

FieldTypeMatchDescription
codestringcontainsfilter by system code fragment
namestringcontainsfilter by name fragment
isEnabledboolequalsfilter by enablement

SystemParams (create/update):

FieldTypeRequiredDescription
idstringupdate onlyprimary key
codestringYesunique system code
namestringYesdisplay name
baseUrlstringNoabsolute base URL; enables the scoped http library for this system's scripts. Validated at save time (ErrInvalidBaseURL)
outboundAuthOutboundAuthConfigNooutbound authentication (below); null sends requests unauthenticated
outboundEnvelopeOutboundEnvelopeConfigNosystem-level request/response wrap scripts (below); null passes adapter requests through untouched
inboundAuthInboundAuthConfigNoinbound verification (below); null refuses inbound delivery entirely
dataSourceDataSourceConfigNodirect database connection (below); enables the scoped sql library
paramsobject (string→string)Nonon-sensitive system-specific values, exposed to scripts as system.params
timeoutMsintNoper-HTTP-call bound; zero applies the framework default
retryRetryPolicyNooutbound retry policy (below)
isEnabledboolNodisabled systems refuse both flows (ErrSystemDisabled; inbound denies uniformly as auth failure)

OutboundAuthConfig / InboundAuthConfig:

FieldTypeDescription
schemestringscheme name. Outbound: none, http_basic, bearer, header, query, signature, script, or custom. Inbound additionally: ip
paramsobject (string→string)scheme parameters; values of scheme-declared sensitive parameters are stored encrypted and masked in responses
scriptstringcustom signing/verification body for the script scheme; runs in a zero-IO runtime

See Outbound Calls and Inbound Delivery for each scheme's parameter reference.

OutboundEnvelopeConfig:

FieldTypeDescription
requeststringwrap script: receives the adapter's request as request ({ method, path, headers, query, body }) and returns the request to put on the wire; omitted fields keep the adapter's values
responsestringunwrap script: receives the completed HTTP response as response (fetch Response shape); its return value is what the adapter's call yields

When the envelope is present, at least one of the two scripts is required, each supplied script must compile, and the system must have an HTTP transport (ErrInvalidEnvelope).

DataSourceConfig:

FieldTypeDescription
kindstringdatabase kind, required when the data source is present (ErrInvalidDataSource); same vocabulary as vef.data_sources.type: postgres, mysql, sqlite, sqlserver, oracle
modestringscript write access: read_only (default; sql.execute throws) or read_write (enables sql.execute)
hoststringserver host
portintserver port
userstringlogin user
passwordstringlogin password — stored encrypted, masked in responses
databasestringdatabase name
schemastringschema name (where the kind supports it)
pathstringfile path (sqlite)
sslModestringSSL mode (same vocabulary as vef.data_sources.ssl_mode)
sslRootCertstringCA certificate path

RetryPolicy:

FieldTypeDescription
maxAttemptsinttotal number of attempts, the first call included
initialBackoffMsintbase delay before the first retry; zero applies the httpx default
maxBackoffMsintcap on the delay between attempts; zero applies the httpx default

integration/adapter

Adapter bindings. Scripts are compile-checked at save time; the database's unique and foreign keys guard the binding itself.

ActionPermissionInputOutput
find_pageintegration.adapter.queryAdapterSearch + pageable metapage.Page[Adapter]
find_allintegration.adapter.queryAdapterSearchAdapter[]
createintegration.adapter.createAdapterParamscreated Adapter
updateintegration.adapter.updateAdapterParamsupdated Adapter
deleteintegration.adapter.deleteprimary-key params (params.id)success

AdapterSearch (query filters):

FieldTypeMatchDescription
systemIdstringequalsfilter by owning system
contractIdstringequalsfilter by bound contract
directionstringequalsoutbound or inbound
isEnabledboolequalsfilter by enablement

AdapterParams (create/update):

FieldTypeRequiredDescription
idstringupdate onlyprimary key
systemIdstringYesthe system this adapter belongs to
contractIdstringYesthe contract this adapter implements
directionstringNooutbound (default when omitted) or inbound; anything else fails with ErrInvalidDirection
scriptstringYesthe translation script; must compile (ErrInvalidScript)
timeoutMsintNoscript run timeout override; zero inherits vef.integration.run_timeout
isEnabledboolNodisabled adapters refuse invocation (ErrAdapterDisabled)

integration/route

Routing rules. Contract and system references are validated at save time — the contract column carries the empty-string wildcard sentinel and has no foreign key (ErrInvalidRouteRef).

ActionPermissionInputOutput
find_pageintegration.route.queryRouteSearch + pageable metapage.Page[Route]
find_allintegration.route.queryRouteSearchRoute[]
createintegration.route.createRouteParamscreated Route
updateintegration.route.updateRouteParamsupdated Route
deleteintegration.route.deleteprimary-key params (params.id)success

RouteSearch (query filters):

FieldTypeMatchDescription
routeKeystringcontainsfilter by route key fragment
contractIdstringequalsfilter by scoped contract
systemIdstringequalsfilter by target system
isEnabledboolequalsfilter by enablement

RouteParams (create/update):

FieldTypeRequiredDescription
idstringupdate onlyprimary key
routeKeystringNothe key (tenant, branch, hospital area) this rule serves; empty is the default route
contractIdstringNoscopes the rule to one contract; empty applies to every contract. Exact (key, contract) matches win over contract-wildcard matches
systemIdstringYesthe system serving matched invocations
isEnabledboolNodisabled rules never match

integration/code_map

Per-system value translation tables. Entries are index-built at save time so a colliding or malformed map never reaches a lookup; when the host registers an enumerable code set catalog, the codeSet identifier must also be one of its registered sets.

ActionPermissionInputOutput
find_pageintegration.code_map.queryCodeMapSearch + pageable metapage.Page[CodeMap]
find_allintegration.code_map.queryCodeMapSearchCodeMap[]
createintegration.code_map.createCodeMapParamscreated CodeMap
updateintegration.code_map.updateCodeMapParamsupdated CodeMap
deleteintegration.code_map.deleteprimary-key params (params.id)success

CodeMapSearch (query filters):

FieldTypeMatchDescription
systemIdstringequalsfilter by owning system
codeSetstringcontainsfilter by code set identifier fragment
namestringcontainsfilter by name fragment
isEnabledboolequalsfilter by enablement

CodeMapParams (create/update):

FieldTypeRequiredDescription
idstringupdate onlyprimary key
systemIdstringYesthe owning system
codeSetstringYestranslated code set identifier (e.g. gender); constrained to the host catalog when one is registered; must match ^[A-Za-z0-9]([A-Za-z0-9_.-]*[A-Za-z0-9])?$ with at most 128 characters (ErrInvalidCodeMap)
namestringYesdisplay name
entriesCodeMapEntry[]Nomapping pairs (below); duplicate lookup values per side are rejected (ErrInvalidCodeMap)
onUnmappedstringNoreject (default when omitted — fail closed), passthrough, or fallback; any other value is rejected (ErrInvalidCodeMap)
fallbackCanonicalany JSON valueNovalue toCanonical yields for unmapped input under the fallback policy; required when onUnmapped is fallback, forbidden otherwise (ErrInvalidCodeMap)
fallbackExternalany JSON valueNovalue toExternal yields for unmapped input under the fallback policy; required when onUnmapped is fallback, forbidden otherwise (ErrInvalidCodeMap)
isEnabledboolNodisabled maps behave as missing (ErrMissingCodeMap)

CodeMapEntry:

FieldTypeRequiredDescription
canonicalstring / number / booleanYeshost-side primary value, emitted by toCanonical lookups
externalstring / number / booleanYesexternal-side primary value, emitted by toExternal lookups
canonicalAliasesarrayNoadditional host-side values matching this entry (matched, never emitted)
externalAliasesarrayNoadditional external-side values matching this entry

integration/code_set

Read-only view of the host's canonical code catalog, for the mapping editor's pickers. Present only in the sense that it degrades: without a mold.CodeSetInspector both operations answer supported: false. With an inspector present, a catalog that fails to answer rejects both operations with ErrCodeSetCatalogFailed — as does a code map save whose identifier cannot be confirmed against it.

ActionPermissionInputOutput
list_code_setsintegration.code_map.querynoneCodeSetCatalog
list_codesintegration.code_map.queryListCodesParamsCodeCatalog

ListCodesParams:

FieldTypeRequiredDescription
codeSetstringYesthe code set to enumerate

CodeSetCatalog response:

FieldTypeDescription
supportedboolfalse when the host registered no enumerable catalog (editor falls back to free-text input)
codeSetsCodeSetInfo[]entries with codeSet (identifier) and name (display name)

CodeCatalog response:

FieldTypeDescription
supportedboolas above
codesCodeInfo[]entries with code (canonical value) and label (display name)

integration/log

Read-only invocation log: the paged view for browsing and the single-record view for the full captures.

ActionPermissionInputOutput
find_pageintegration.log.queryLogSearch + pageable metapage.Page[InvocationLog]
find_oneintegration.log.queryLogSearchone InvocationLog

LogSearch (query filters):

FieldTypeMatchDescription
systemCodestringequalsfilter by system code
contractCodestringequalsfilter by contract code
directionstringequalsoutbound or inbound
failureKindstringequalsone of the failure kinds; empty rows are successes
requestIdstringequalscorrelate with the API request that triggered the invocation

InvocationLog response fields:

FieldTypeDescription
idstringlog row ID
systemCodestringsystem that served (or rejected) the invocation
contractCodestringinvoked contract
directionstringoutbound or inbound
failureKindstringfailure classification; empty for success
durationMsintwall time of the invocation
inputJSONcaptured standard input (masked, truncated per vef.integration.log)
outputJSONcaptured standard output (masked, truncated)
httpTraceHTTPExchange[]wire exchanges captured while the script ran (below)
errorstringfailure message; absent on success
requestIdstringoriginating API request ID
createdAt / createdBytimestamp / stringcreation audit columns

HTTPExchange (shared by the log and the dry-run trace):

FieldTypeDescription
methodstringHTTP method
urlstringrequest URL (masked)
requestHeadersobjectrequest headers (credential headers always masked)
requestBodystringcaptured request body (masked, truncated)
statusintresponse status; 0 when the call never completed
responseHeadersobjectresponse headers
responseBodystringcaptured response body (masked, truncated)
durationMsintexchange duration
errorstringtransport error message when the call failed

integration/ops

Operational endpoints: the script test consoles, the connection probe, and the routing diagnosis. Dry run and probing operate on disabled definitions too — testing precedes enabling.

ActionPermissionInputOutput
dry_runintegration.ops.dry_runDryRunParamsDryRunResult
dry_run_inboundintegration.ops.dry_run_inboundDryRunInboundParamsInboundDryRunResult
test_connectionintegration.ops.test_connectionTestConnectionParamsConnectionCheck
diagnose_routesintegration.ops.diagnose_routesnoneRouteDiagnostics

dry_run

Executes a script against a system under a contract and returns the output, the failure classification, and the full wire trace. The calls it makes are real; nothing is recorded to statistics or the invocation log.

Request (DryRunParams):

FieldTypeRequiredDescription
systemCodestringYestarget system (disabled systems are allowed)
contractCodestringYescontract whose schemas gate the run
scriptstringNounsaved editor content; empty falls back to the saved outbound adapter script (ErrAdapterNotFound when none exists)
inputany JSON valueNoinvocation input, validated against the contract's input schema

Response (DryRunResult):

FieldTypeDescription
outputany JSON valuethe script's return value (schema-validated); null when the run failed
traceHTTPExchange[]wire exchanges, populated even when the run failed — operators see how far the script got
failureKindstringfailure classification; absent on success
errorstringfailure message; absent on success

dry_run_inbound

Executes an inbound script against a synthetic external request with the business handler stubbed to return the supplied sample output. Verification is bypassed (the console tests translation, not credentials), no business code runs, and nothing is recorded; the contract schemas are enforced for real on both sides of the dispatch.

Request (DryRunInboundParams):

FieldTypeRequiredDescription
systemCodestringYestarget system
contractCodestringYescontract whose schemas gate the dispatch
scriptstringNounsaved editor content; empty falls back to the saved inbound adapter script
requestInboundRequestParamsNothe synthetic external request (below)
handlerOutputany JSON valueNothe sample the stubbed business handler returns; validated against the output schema

InboundRequestParams (all optional):

FieldTypeDescription
methodstringHTTP method of the synthetic request
pathstringrequest path
headersobject (string→string)header names are normalized to lowercase, as a real gateway would deliver them
queryobject (string→string)query parameters
bodystringraw request payload

Response (InboundDryRunResult):

FieldTypeDescription
replyany JSON valuethe reply the external system would receive (including a $response envelope when the script returns one)
dispatchedInputany JSON valuewhat the script dispatched to the (stubbed) handler — one value, or an array when the script dispatched multiple times
failureKindstringfailure classification; absent on success
errorstringfailure message; absent on success

test_connection

Probes a saved system on every transport it configures. Probe failures are data (reachable: false), not errors — the probe answered the question. Configuration faults (unknown auth scheme, undecryptable credential) return an error instead.

Request (TestConnectionParams):

FieldTypeRequiredDescription
systemCodestringYessystem to probe
methodstringNoprobe HTTP method; defaults to GET
pathstringNoprobe path relative to the base URL; defaults to /

Response (ConnectionCheck; each probe present iff the system configures that transport):

FieldTypeDescription
httpHTTPProbepresent when the system has a baseUrl
http.reachableboolwhether the request completed
http.statusintresponse status when reachable
http.statusTextstringstatus text when reachable
http.durationMsintprobe duration
http.errorstringtransport error when unreachable
databaseDatabaseProbepresent when the system has a dataSource
database.reachableboolwhether a throwaway connection succeeded
database.versionstringserver version on success
database.durationMsintprobe duration
database.errorstringconnection error when unreachable

diagnose_routes

Reports the routing table's configuration gaps — dangling adapters, disabled targets, uncovered contracts — before they surface as runtime errors. Computed on demand; takes no parameters.

Response (RouteDiagnostics):

FieldTypeDescription
findingsRouteFinding[]one entry per gap (below); empty means the table is coherent

RouteFinding:

FieldTypeDescription
kindstringfinding classification (below)
routeIdstringinvolved route row, when one exists
routeKeystringalways meaningful — "" is the default route
contractCode / contractNamestringinvolved contract, by code and display name
systemCode / systemNamestringinvolved system, by code and display name

kind vocabulary:

ConstantKindMeaning
RouteFindingDanglingAdapterdangling_adaptera contract-scoped route whose target system has no enabled adapter for that contract — invoking through this rule fails with ErrAdapterNotFound
RouteFindingWildcardGapwildcard_gapan enabled contract a wildcard (or default) route cannot serve because its target system has no enabled adapter for it. Informational
RouteFindingDisabledSystemdisabled_systeman enabled route targeting a disabled system — invocations through it fail with ErrSystemDisabled
RouteFindingDisabledContractdisabled_contractan enabled route scoped to a disabled contract — the rule can never match a successful invocation
RouteFindingUncoveredContractuncovered_contractan enabled contract that resolves to no rule under a route key present in the table — invoking it with that key fails with ErrRouteNotFound. Informational when the key intentionally routes a subset

See also