@coasys/ad4m / Exports
@coasys/ad4m
Table of contents
Enumerations
Classes
- AIClient
- AIModel
- AIModelLoadingStatus
- AIPromptExamples
- AIPromptExamplesInput
- AITask
- AITaskInput
- Ad4mClient
- Ad4mModel
- Agent
- AgentClient
- AgentExpression
- AgentSignature
- AgentStatus
- Apps
- AuthInfo
- AuthInfoInput
- AutoProcessorConfig
- Capability
- CapabilityInput
- ComputeLogEntry
- EntanglementProof
- EntanglementProofInput
- ExceptionInfo
- Expression
- ExpressionProof
- ExpressionProofInput
- ExpressionRef
- ExpressionRendered
- FlowInstance
- FlowInstanceRecord
- FlowTransitionProposal
- HostingUserInfo
- IDBCache
- Icon
- ImportResult
- ImportStats
- InteractionCall
- InteractionMeta
- InteractionParameter
- InterpretationOverlay
- InterpretationRun
- LanguageExpression
- LanguageHandle
- LanguageLanguageInput
- LanguageMeta
- LanguageMetaInput
- LanguageMetaInternal
- LanguageRef
- Link
- LinkExpression
- LinkExpressionInput
- LinkExpressionMutations
- LinkExpressionUpdated
- LinkInput
- LinkMutations
- LinkQuery
- Literal
- LocalModel
- LocalModelInput
- ModelApi
- ModelApiInput
- ModelInput
- ModelQueryBuilder
- Neighbourhood
- NeighbourhoodExpression
- NeighbourhoodProxy
- Notification
- NotificationInput
- NullCache
- OnlineAgent
- PaymentRequestResult
- Perspective
- PerspectiveDiff
- PerspectiveDiffExpression
- PerspectiveExpression
- PerspectiveHandle
- PerspectiveInput
- PerspectiveProxy
- PerspectiveUnsignedInput
- QuerySubscriptionProxy
- Resource
- ResourceInput
- RpcError
- RuntimeInfo
- SHACLFlow
- SHACLShape
- SentMessage
- SmartLiteral
- TokenizerSource
- TokenizerSourceInput
- TriggeredNotification
- UserCreationResult
- UserStatistics
- VerificationRequestResult
- VoiceActivityParamsInput
- WakerSubscriptionManager
Interfaces
- AD4MAction
- Ad4mModelLike
- AddAutoProcessorConfig
- CallOptions
- ConformanceCondition
- ConsensusRule
- CountBinding
- EventFilter
- EventMap
- FlagOptions
- FlowFireOutcome
- FlowMintedReceipt
- FlowOutputRef
- FlowProposeResult
- FlowReceiptVerdict
- FlowState
- FlowTransition
- FlowValidOutput
- IncludeMap
- IncludeProjection
- InitializeArgs
- Interaction
- InterpretationOverlayInfo
- JSONSchema
- JSONSchemaProperty
- JSONSchemaToModelOptions
- LinkBinding
- LinkPattern
- LinkRow
- MentionMessage
- ModelConfig
- ModelMetadata
- ModelQuery
- PersistentCache
- PropertyMetadata
- PropertyMetadataEntry
- PropertyOptions
- RelationMetadata
- RelationMetadataEntry
- RelationOptions
- RpcMethods
- RunInterpretationObserveOptions
- SHACLPropertyShape
- TraverseByModel
- TraverseByPredicate
- TraverseOptions
- WakerLogger
- WakerSubscription
- WakerSubscriptionManagerOptions
Type Aliases
- AddLinkExpressionRequest
- AddLinkRequest
- AddLinksBulkRequest
- AddSdnaRequest
- Address
- AllInstancesResult
- ApplyTemplateRequest
- AuthorCondition
- AutoProcessorEvent
- AutoProcessorNeighbourhoodStateEvent
- AutoProcessorStep
- CommitBatchRequest
- ConformanceFilterFn
- CreateExpressionRequest
- CreatePerspectiveRequest
- CreateSubjectRequest
- DID
- EmbedRequest
- EventName
- ExecuteCommandsRequest
- ExportRequest
- ExpressionManyRequest
- ExpressionShape
- FriendSendMessageRequest
- FriendsListRequest
- GenerateAgentRequest
- GenerateJwtRequest
- GetOptions
- GetSubjectDataRequest
- HasManyMethods
- HostRate
- ImportAgentRequest
- ImportRequest
- IncludeExtras
- IncludeOf
- JoinNeighbourhoodRequest
- LinkLanguageTemplatesRequest
- LinkStatus
- LinksMap
- LiteralStorageMode
- LockAgentRequest
- ModelDataKeys
- ModelType
- NeighbourhoodPhase
- NodeExpression
- NumericWhereOps
- OpenLinkRequest
- Order
- PaginationResult
- PermitCapabilityRequest
- PerspectiveState
- ProducedByFlowFilter
- PromptRequest
- PropertyCondition
- PropertyKeysOf
- PublishLanguageRequest
- PublishNeighbourhoodRequest
- Query
- QueryRequest
- RawScope
- RelatedModel
- RelationKeysOf
- RelationSubQuery
- RemoveLinkRequest
- RemoveLinksBulkRequest
- ResultsWithTotalCount
- RpcMethod
- RunInterpretationRequest
- Scope
- ScopedEventName
- SetDefaultModelRequest
- SetFreeHostingEnabledRequest
- SetHostRatesRequest
- SetMultiUserRequest
- SetStatusRequest
- SetUnytMembraneProofRequest
- SignMessageRequest
- StringWhereOps
- TelepresenceSignalCallback
- TranscriptTurn
- TraverseScope
- TrustedAgentsRequest
- TypedIncludeMap
- TypedIncludeProjection
- TypedOrder
- TypedQuery
- TypedQueryWhere
- TypedRelationSubQuery
- TypedWhere
- TypedWhereCondition
- UnlockAgentRequest
- UnytVersionInfo
- UpdateLinkRequest
- UpdatePerspectiveRequest
- ValueTuple
- VerifySignatureRequest
- Where
- WhereCondition
- WhereOps
- WriteSettingsRequest
Variables
- ACCEPTED_BY_GETTER
- LONG_METHODS
- LONG_TIMEOUT_MS
- PROPOSER_GETTER
- PerspectiveState
- READ_METHODS
- SCOPED_EVENTS
- SMART_LITERAL_CONTENT_PREDICATE
- fileToDataUri
- typeDefsString
Decorators Functions
Other Functions
- ExpressionGeneric
- ExpressionGenericInput
- buildConformanceFilter
- buildModelFromJSONSchema
- buildSDNA
- buildSHACL
- buildSPARQLQuery
- buildWhereCondition
- capSentence
- clearQueryCache
- coalesce
- compileWhereClause
- concat
- createPersistentCache
- determineNamespace
- determinePredicate
- effectiveLiteralStorage
- escapeQueryString
- exists
- exprRef2String
- fn
- focus
- formatList
- formatQueryValue
- formatSPARQLValue
- getCachedResult
- getDefaultValueForType
- getMemoizedSHACL
- getPropertiesMetadata
- getPropertyOption
- getRelationsMetadata
- hasJsOnlyWhereFilters
- hintFor
- ifExpr
- invalidatePerspectiveCache
- isArrayType
- isExpression
- isIncludeProjection
- isLink
- isNodeExpression
- isNumericType
- isObjectType
- isSchemaType
- isTraverseScope
- linkEqual
- linkExpressionInputToWire
- linkExpressionToWire
- linkMutationsToWire
- literal
- looksLikeUri
- neighbourhoodExpressionFromWire
- normalizeNamespaceString
- normalizeSchemaType
- normalizeValue
- normalizeWhereForSparql
- parseExprUrl
- parseLit
- parseLitBoolean
- parseLitNumber
- parseSparqlCount
- path
- queryCacheSize
- requireSingleParent
- resolveParentPredicate
- setCachedResult
- setPropertyRegistryEntry
- setRelationRegistryEntry
- valueToLiteralIri
Type Aliases
AddLinkExpressionRequest
Ƭ AddLinkExpressionRequest: Object
Type declaration
| Name | Type |
|---|---|
batchId? | string |
link | LinkExpression |
status? | string |
Defined in
core/src/generated/api/AddLinkExpressionRequest.ts:4 (opens in a new tab)
AddLinkRequest
Ƭ AddLinkRequest: Object
Type declaration
| Name | Type |
|---|---|
batchId? | string |
link | LinkInput |
status? | string |
Defined in
core/src/generated/api/AddLinkRequest.ts:4 (opens in a new tab)
AddLinksBulkRequest
Ƭ AddLinksBulkRequest: Object
Type declaration
| Name | Type |
|---|---|
batchId? | string |
links | LinkInput[] |
status? | string |
Defined in
core/src/generated/api/AddLinksBulkRequest.ts:4 (opens in a new tab)
AddSdnaRequest
Ƭ AddSdnaRequest: Object
Type declaration
| Name | Type |
|---|---|
name | string |
sdnaCode? | string |
sdnaType | string |
shaclJson? | string |
Defined in
core/src/generated/api/AddSdnaRequest.ts:3 (opens in a new tab)
Address
Ƭ Address: string
Defined in
core/src/Address.ts:1 (opens in a new tab)
AllInstancesResult
Ƭ AllInstancesResult: Object
Type declaration
| Name | Type |
|---|---|
AllInstances | Ad4mModel[] |
TotalCount? | number |
Defined in
core/src/model/types.ts:707 (opens in a new tab)
ApplyTemplateRequest
Ƭ ApplyTemplateRequest: Object
Type declaration
| Name | Type |
|---|---|
sourceLanguageHash | string |
templateData | string |
Defined in
core/src/generated/api/ApplyTemplateRequest.ts:3 (opens in a new tab)
AuthorCondition
Ƭ AuthorCondition: string | string[] | { contains?: string ; not?: string | string[] }
Who wrote a link: a DID, any of several DIDs, or { not } / { contains }
over the author DID.
Defined in
core/src/model/types.ts:24 (opens in a new tab)
AutoProcessorEvent
Ƭ AutoProcessorEvent: Object
A single step-signal from one auto-processor pass on one perspective.
Type declaration
| Name | Type | Description |
|---|---|---|
agentDid | string | null | DID of the agent this executor ran the pass as — lets a multi-user / multi-executor observer see which peer claimed/processed vs backed off. |
bases | string[] | Instance base URIs written by the pass (present on Processed). |
batchKey | string | null | Content hash of the batch — the same [super::claim::batch_key] value the perspective-scoped [AutoProcessorNeighbourhoodState] carries. Present from BatchReady onward, and it is what makes the two streams joinable. Without it a consumer holding both has no way to say "this LlmRequestSent belongs to the row I opened on that Claimed" — the fine-grained stream carries item_ids and the neighbourhood stream carries only the hash of them, so correlating meant re-implementing this hash client-side and matching the Rust serialization exactly. A consumer that merges a peer's coarse phases with its own fine ones needs one shared key, and this is it. |
detail | string | null | Free-form context for the step (a holder/elected DID, an error, …). |
itemIds | string[] | The batch's source item ids (present from BatchReady onward). |
llmInput | string | null | Live-debug raw LLM prompt for this pass. Present ONLY on [AutoProcessorStep::LlmRequestSent] events, and only when the processor was configured with AutoProcessorConfig.emit_debug_events = true. Never carried on Processed (which carries bases only). Absent (None) in the normal path — LLM prompts are 10s of KB and would otherwise inflate every event. |
llmOutput | string | null | Live-debug raw LLM response for this pass. Present ONLY on [AutoProcessorStep::LlmResponseReceived] events, and only when the processor was configured with AutoProcessorConfig.emit_debug_events = true. Never carried on Processed. Same size / privacy rules as llm_input. |
perspectiveUuid | string | UUID of the perspective the processor runs on. |
processorId | string | The processor's id (AutoProcessorConfig::processor_id). |
step | AutoProcessorStep | Which step this event marks. |
toolArgsJson | string | null | JSON-encoded arguments the LLM sent to the tool. Present ONLY on [AutoProcessorStep::ToolCall]; absent on ToolResult (where tool_result carries the return text instead). Same size / gating rules as llm_input / llm_output. |
toolName | string | null | Name of the tool the harness LLM invoked (or that just returned). Present on [AutoProcessorStep::ToolCall] + [AutoProcessorStep::ToolResult] events; absent on every other step. Present only when the processor has emit_debug_events: true. |
toolResult | string | null | The tool's return text. Present ONLY on [AutoProcessorStep::ToolResult]; may be truncated by the emitter when the tool returns a large payload (e.g. a _query result). Same size / gating rules as llm_input / llm_output. |
Defined in
core/src/generated/api/AutoProcessorEvent.ts:7 (opens in a new tab)
AutoProcessorNeighbourhoodStateEvent
Ƭ AutoProcessorNeighbourhoodStateEvent: Object
One observation of an auto-processor pass by THIS executor. Small on
purpose: perspective + processor + claimant DID + batch key + phase.
Consumers merge these across ticks + across peers (via link-added on
has_claim) to render "who is currently processing what."
Type declaration
| Name | Type | Description |
|---|---|---|
batchKey | string | Content hash of the batch (see [super::claim::batch_key]) — lets a consumer merge Claimed and Finished events for the same batch without duplicating rows. |
claimantDid | string | DID that claimed the batch — the executor's own DID for locally initiated passes. |
perspectiveUuid | string | UUID of the perspective the pass runs on. |
phase | NeighbourhoodPhase | Which lifecycle transition this event marks. |
processorId | string | The processor's id (AutoProcessorConfig::processor_id). |
Defined in
core/src/generated/api/AutoProcessorNeighbourhoodState.ts:10 (opens in a new tab)
AutoProcessorStep
Ƭ AutoProcessorStep: "batchReady" | "claimed" | "backedOff" | "awaitingAuthor" | "notCandidate" | "gatheringTranscript" | "runningInterpretation" | "llmRequestSent" | "llmResponseReceived" | "toolCall" | "toolResult" | "processed" | "shapesMissing" | "emptyTranscript" | "failed"
One step in an auto-processor pass (serde camelCase of the Rust enum).
Lifecycle (winning peer, emitDebugEvents: true)
A pass on the winning executor emits, in order:
batchReady— debounced batch reached threshold, pass startingclaimed— this executor won thetry_claimgatheringTranscript— pulling the batch's transcript turnsrunningInterpretation— about to invoke the LLMllmRequestSent— prompt built + dispatched; carriesllmInput(only whenemitDebugEvents: true)llmResponseReceived— LLM response arrived; carriesllmOutput(only whenemitDebugEvents: true) — the UI can render "waiting on LLM" between steps 5-6processed— pass complete; carriesbases[](new/updated instance URIs)
Lifecycle (losing peer, or short-circuit)
batchReady→backedOff— another peer claimed the batch firstbatchReady→awaitingAuthor— no author of the batch is onlinebatchReady→notCandidate— this peer stood down for an earlier authorclaimed→shapesMissing— a configured class shape hasn't syncedclaimed→emptyTranscript— the batch drained empty- any →
failed— the model errored or timed out;detailcarries why. Distinct from the two above, which are the pass correctly finding nothing to do — reporting "nothing to extract" when the LLM endpoint was unreachable points someone at their transcript instead of at their model settings.
Lifecycle (one-shot runInterpretation)
A one-shot pass emits nothing unless the caller passes observe (see
runInterpretation). With it:
runningInterpretation → [llmRequestSent → llmResponseReceived] →
processed | failed
— plus claimed → finished/abandoned on the neighbourhood stream, so
one-shot and watch passes render through the same consumer code. There is
no batchReady, gatheringTranscript or claim: the caller supplied the
transcript, and processorId/batchKey both carry the caller's own
observationId.
Payload fields per step
All steps carry perspectiveUuid, processorId, agentDid, itemIds[]
and batchKey (the join key to the neighbourhood-state stream).
Additional payload:
backedOff,notCandidate→detail= holder / elected-author DIDshapesMissing→detail= comma-joined missing class URIsfailed→detail= the errorllmRequestSent→llmInput= raw promptllmResponseReceived→llmOutput= raw LLM responseprocessed→bases[]= new/updated instance URIs
Defined in
core/src/perspectives/AutoProcessor.ts:76 (opens in a new tab)
CommitBatchRequest
Ƭ CommitBatchRequest: Object
Type declaration
| Name | Type |
|---|---|
batchId | string |
Defined in
core/src/generated/api/CommitBatchRequest.ts:3 (opens in a new tab)
ConformanceFilterFn
Ƭ ConformanceFilterFn: (relationPredicate: string, targetClass: Ad4mModelLike) => { conformanceConditions: ConformanceCondition[] ; getter: string } | undefined
Type declaration
▸ (relationPredicate, targetClass): { conformanceConditions: ConformanceCondition[] ; getter: string } | undefined
Signature for the conformance-filter builder injected by the caller.
Parameters
| Name | Type |
|---|---|
relationPredicate | string |
targetClass | Ad4mModelLike |
Returns
{ conformanceConditions: ConformanceCondition[] ; getter: string } | undefined
Defined in
core/src/model/shacl-gen.ts:15 (opens in a new tab)
CreateExpressionRequest
Ƭ CreateExpressionRequest: Object
Type declaration
| Name | Type |
|---|---|
content | string |
languageAddress | string |
Defined in
core/src/generated/api/CreateExpressionRequest.ts:3 (opens in a new tab)
CreatePerspectiveRequest
Ƭ CreatePerspectiveRequest: Object
Type declaration
| Name | Type |
|---|---|
name | string |
Defined in
core/src/generated/api/CreatePerspectiveRequest.ts:3 (opens in a new tab)
CreateSubjectRequest
Ƭ CreateSubjectRequest: Object
Type declaration
| Name | Type |
|---|---|
batchId? | string |
expressionAddress | string |
initialValues? | string |
subjectClass | string |
Defined in
core/src/generated/api/CreateSubjectRequest.ts:3 (opens in a new tab)
DID
Ƭ DID: string
Defined in
core/src/DID.ts:1 (opens in a new tab)
EmbedRequest
Ƭ EmbedRequest: Object
Type declaration
| Name | Type |
|---|---|
modelId | string |
text | string |
Defined in
core/src/generated/api/EmbedRequest.ts:3 (opens in a new tab)
EventName
Ƭ EventName: keyof EventMap
Defined in
core/src/generated/api/Events.ts:47 (opens in a new tab)
ExecuteCommandsRequest
Ƭ ExecuteCommandsRequest: Object
Type declaration
| Name | Type |
|---|---|
batchId? | string |
commands | string |
expression | string |
parameters? | string |
Defined in
core/src/generated/api/ExecuteCommandsRequest.ts:3 (opens in a new tab)
ExportRequest
Ƭ ExportRequest: Object
Type declaration
| Name | Type |
|---|---|
filePath | string |
perspectiveUuid? | string |
type | string |
Defined in
core/src/generated/api/ExportRequest.ts:3 (opens in a new tab)
ExpressionManyRequest
Ƭ ExpressionManyRequest: Object
Type declaration
| Name | Type |
|---|---|
urls | string[] |
Defined in
core/src/generated/api/ExpressionManyRequest.ts:3 (opens in a new tab)
ExpressionShape
Ƭ ExpressionShape<DataType, Proof>: Object
The fields every expression carries, with DataType as its data.
Type parameters
| Name | Type |
|---|---|
DataType | DataType |
Proof | ExpressionProof |
Type declaration
| Name | Type |
|---|---|
author | string |
data | DataType |
proof | Proof |
timestamp | string |
Defined in
core/src/expression/Expression.ts:25 (opens in a new tab)
FriendSendMessageRequest
Ƭ FriendSendMessageRequest: Object
Type declaration
| Name | Type |
|---|---|
message | any |
Defined in
core/src/generated/api/FriendSendMessageRequest.ts:3 (opens in a new tab)
FriendsListRequest
Ƭ FriendsListRequest: Object
Type declaration
| Name | Type |
|---|---|
dids | string[] |
Defined in
core/src/generated/api/FriendsListRequest.ts:3 (opens in a new tab)
GenerateAgentRequest
Ƭ GenerateAgentRequest: Object
Type declaration
| Name | Type |
|---|---|
passphrase | string |
Defined in
core/src/generated/api/GenerateAgentRequest.ts:3 (opens in a new tab)
GenerateJwtRequest
Ƭ GenerateJwtRequest: Object
Type declaration
| Name | Type |
|---|---|
rand | string |
requestId | string |
Defined in
core/src/generated/api/GenerateJwtRequest.ts:3 (opens in a new tab)
GetOptions
Ƭ GetOptions: Pick<Query, "include" | "properties">
Options accepted by the instance get() method.
A subset of Query — only hydration controls apply to a single known instance.
Defined in
core/src/model/types.ts:701 (opens in a new tab)
GetSubjectDataRequest
Ƭ GetSubjectDataRequest: Object
Type declaration
| Name | Type |
|---|---|
expressionAddress | string |
subjectClass | string |
Defined in
core/src/generated/api/GetSubjectDataRequest.ts:3 (opens in a new tab)
HasManyMethods
Ƭ HasManyMethods<Keys>: { [K in Keys as `add${Capitalize<K>}`]: Function } & { [K in Keys as `remove${Capitalize<K>}`]: Function } & { [K in Keys as `set${Capitalize<K>}`]: Function }
Utility type that describes the auto-generated helper methods for a HasMany
relation. For a property named comments on a class Post, the following
methods will be available on instances:
post.addComment(value) post.removeComment(value) post.setComment(values)
Type parameters
| Name | Type |
|---|---|
Keys | extends string |
Defined in
core/src/model/decorators.ts:1032 (opens in a new tab)
HostRate
Ƭ HostRate: Object
Price in HOT the host charges for one metered operation.
Type declaration
| Name | Type |
|---|---|
description | string |
priceInHOT | number |
Defined in
core/src/generated/api/HostRate.ts:6 (opens in a new tab)
ImportAgentRequest
Ƭ ImportAgentRequest: Object
Type declaration
| Name | Type |
|---|---|
did | string |
didDocument | string |
keystore | string |
passphrase | string |
Defined in
core/src/generated/api/ImportAgentRequest.ts:3 (opens in a new tab)
ImportRequest
Ƭ ImportRequest: Object
Type declaration
| Name | Type |
|---|---|
filePath | string |
type | string |
Defined in
core/src/generated/api/ImportRequest.ts:3 (opens in a new tab)
IncludeExtras
Ƭ IncludeExtras<T, I>: I extends Record<string, any> ? Extract<keyof I, `$${string}`> extends never ? unknown : { [K in Extract<keyof I, `$${string}`>]: I[K] extends Object ? number : I[K] extends Object ? R extends RelationKeysOf<T> ? RelatedModel<T, R> | null : never : I[K] extends Object ? R extends RelationKeysOf<T> ? RelatedModel<T, R>[] : never : unknown } : unknown
Given a model T and an include literal I, compute the extra fields
contributed by $-prefixed projection keys.
{ count: true }→number{ from: R, limit: 1 }→RelatedModel<T,R> | null{ from: R }(no limit/1) →RelatedModel<T,R>[]
Returns unknown (intersection-neutral) when I has no $-keys, so that
T & IncludeExtras<T, I> collapses back to T and downstream type
predicates ((x): x is T => ...) keep working unchanged.
Type parameters
| Name | Type |
|---|---|
T | extends Ad4mModel |
I | I |
Defined in
core/src/model/types.ts:655 (opens in a new tab)
IncludeOf
Ƭ IncludeOf<Q>: Q extends { include?: infer I } ? I : undefined
Helper that extracts the include literal from a TypedQuery for use with IncludeExtras.
Type parameters
| Name |
|---|
Q |
Defined in
core/src/model/types.ts:694 (opens in a new tab)
JoinNeighbourhoodRequest
Ƭ JoinNeighbourhoodRequest: Object
Type declaration
| Name | Type |
|---|---|
url | string |
Defined in
core/src/generated/api/JoinNeighbourhoodRequest.ts:3 (opens in a new tab)
LinkLanguageTemplatesRequest
Ƭ LinkLanguageTemplatesRequest: Object
Type declaration
| Name | Type |
|---|---|
addresses | string[] |
Defined in
core/src/generated/api/LinkLanguageTemplatesRequest.ts:3 (opens in a new tab)
LinkStatus
Ƭ LinkStatus: "shared" | "local" | "SHARED" | "LOCAL"
Link status argument. The executor accepts either case and returns links
with the upper-case form (LinkExpression.status).
Defined in
core/src/perspectives/PerspectiveProxy.ts:530 (opens in a new tab)
LinksMap
Ƭ LinksMap: Record<string, LinkRow[]>
instance.__links: requested entry (spelled as requested) → its rows, oldest first.
Defined in
core/src/model/types.ts:454 (opens in a new tab)
LiteralStorageMode
Ƭ LiteralStorageMode: { kind: "deterministic" } | { kind: "envelope" } | { kind: "custom" ; language: string }
How a property's value is stored / resolved.
Defined in
core/src/model/query-sparql.ts:218 (opens in a new tab)
LockAgentRequest
Ƭ LockAgentRequest: Object
Type declaration
| Name | Type |
|---|---|
passphrase | string |
Defined in
core/src/generated/api/LockAgentRequest.ts:3 (opens in a new tab)
ModelDataKeys
Ƭ ModelDataKeys<T>: { [K in keyof T]: K extends keyof Ad4mModel ? never : T[K] extends Function ? never : K }[keyof T]
Keys of T that are user-declared (not methods, not inherited from Ad4mModel).
Type parameters
| Name | Type |
|---|---|
T | extends Ad4mModel |
Defined in
core/src/model/types.ts:482 (opens in a new tab)
ModelType
Ƭ ModelType: "LLM" | "EMBEDDING" | "TRANSCRIPTION"
Defined in
core/src/ai/AITypes.ts:26 (opens in a new tab)
NeighbourhoodPhase
Ƭ NeighbourhoodPhase: "claimed" | "finished" | "abandoned"
Coarse-grained phase of a neighbourhood-state event.
claimed — this executor just started a pass.
finished — the pass completed successfully.
abandoned — the pass short-circuited (missing shape / empty batch /
error); the claim will TTL-expire.
Defined in
core/src/perspectives/AutoProcessor.ts:101 (opens in a new tab)
NodeExpression
Ƭ NodeExpression: { type: "focus" } | { type: "literal" ; value: string | number | boolean } | { predicate: string ; type: "path" } | { expr: NodeExpression ; type: "exists" } | { cond: NodeExpression ; else?: NodeExpression ; then: NodeExpression ; type: "if" } | { args: NodeExpression[] ; type: "concat" } | { args: NodeExpression[] ; type: "coalesce" } | { args: NodeExpression[] ; iri: string ; type: "function" }
Union type representing all supported transform expressions. Each variant maps to a SHACL-AF §6 expression construct.
Defined in
core/src/shacl/NodeExpression.ts:15 (opens in a new tab)
NumericWhereOps
Ƭ NumericWhereOps: Object
Type declaration
| Name | Type | Description |
|---|---|---|
author? | AuthorCondition | See author. |
between? | [number, number] | - |
eq? | number | number[] | See eq. |
gt? | number | - |
gte? | number | - |
lt? | number | - |
lte? | number | - |
not? | number | number[] | - |
Defined in
core/src/model/types.ts:541 (opens in a new tab)
OpenLinkRequest
Ƭ OpenLinkRequest: Object
Type declaration
| Name | Type |
|---|---|
url | string |
Defined in
core/src/generated/api/OpenLinkRequest.ts:3 (opens in a new tab)
Order
Ƭ Order: Object
Index signature
▪ [propertyName: string]: "ASC" | "DESC"
Defined in
core/src/model/types.ts:82 (opens in a new tab)
PaginationResult
Ƭ PaginationResult<T>: Object
Type parameters
| Name |
|---|
T |
Type declaration
| Name | Type |
|---|---|
pageNumber | number |
pageSize | number |
results | T[] |
totalCount? | number |
Defined in
core/src/model/types.ts:709 (opens in a new tab)
PermitCapabilityRequest
Ƭ PermitCapabilityRequest: Object
Type declaration
| Name | Type |
|---|---|
auth | string |
Defined in
core/src/generated/api/PermitCapabilityRequest.ts:3 (opens in a new tab)
PerspectiveState
Ƭ PerspectiveState: typeof PerspectiveState[keyof typeof PerspectiveState]
Defined in
core/src/perspectives/PerspectiveHandle.ts:7 (opens in a new tab)
core/src/perspectives/PerspectiveHandle.ts:15 (opens in a new tab)
ProducedByFlowFilter
Ƭ ProducedByFlowFilter: Object
The where.producedByFlow filter — see producedByFlow.
Type declaration
| Name | Type |
|---|---|
flow | string |
state? | string |
Defined in
core/src/model/types.ts:81 (opens in a new tab)
PromptRequest
Ƭ PromptRequest: Object
Type declaration
| Name | Type |
|---|---|
prompt | string |
taskId | string |
Defined in
core/src/generated/api/PromptRequest.ts:3 (opens in a new tab)
PropertyCondition
Ƭ PropertyCondition: string | number | boolean | { equals: unknown } | { in: unknown[] } | { exists: true } | { matches: string }
Per-property condition for a ModelQuery. String / number / boolean
shorthands compile to an equality match; the object forms are the full
shape a ModelQuery engine consumer will evaluate against a class
instance's decoded property value.
Only the shorthand + equals / in / exists / matches operators are
declared in v1 (see design doc §4.1). More operators can land as
additional variants without a schema break.
Defined in
core/src/shacl/SHACLFlow.ts:31 (opens in a new tab)
PropertyKeysOf
Ƭ PropertyKeysOf<T>: { [K in keyof T]: K extends ModelDataKeys<T> ? NonNullable<T[K]> extends Ad4mModel ? never : NonNullable<T[K]> extends Ad4mModel[] ? never : K : never }[keyof T]
Keys of T that can appear in a where clause — scalars and scalar arrays.
Excludes typed Ad4mModel references (single or array); string[]/number[]
remain included because they're often filterable even when also used as
link targets.
Iterates over keyof T directly (not ModelDataKeys<T>) to preserve the
key constraint — mapped types over computed type aliases sometimes widen
to string | undefined in the key position, which then breaks indexing.
Type parameters
| Name | Type |
|---|---|
T | extends Ad4mModel |
Defined in
core/src/model/types.ts:496 (opens in a new tab)
PublishLanguageRequest
Ƭ PublishLanguageRequest: Object
Type declaration
| Name | Type |
|---|---|
languageMeta | LanguageMetaInput |
languagePath | string |
Defined in
core/src/generated/api/PublishLanguageRequest.ts:4 (opens in a new tab)
PublishNeighbourhoodRequest
Ƭ PublishNeighbourhoodRequest: Object
Type declaration
| Name | Type |
|---|---|
linkLanguage | string |
meta | Perspective |
perspectiveUuid | string |
Defined in
core/src/generated/api/PublishNeighbourhoodRequest.ts:4 (opens in a new tab)
Query
Ƭ Query: Object
Type declaration
| Name | Type | Description |
|---|---|---|
count? | boolean | - |
deepQuery? | boolean | When true, SPARQL property getters (@Property with getter) ARE evaluated during collection hydration. Defaults to true — getters run post-pagination via batched VALUES queries so the cost is O(getters), not O(instances × getters). Set to false to explicitly skip getter evaluation for performance-sensitive queries where getter-backed properties are not needed. |
include? | IncludeMap | - |
includeAll? | boolean | When true, eager-loads every declared forward relation on the model. Equivalent to listing all relation field names in include: {} explicitly. Useful for tree-walking and manifest-style inspections. Individual relations can still be overridden via include (explicit entries take precedence). |
includeUnverified? | boolean | Also hydrate from links whose signature did not verify. By default the executor withholds every link whose stored signature verdict is not valid, so a forged or tampered link never becomes a property value, a relation target, author or updatedAt. That includes a typed relation's generated conformance getter. A getter you write yourself runs as written, so it reads unverified links unless it joins the link's ad4m://ontology/proofValid itself. Set this to true only to display an unverified claim, e.g. a UI that marks a value as unverified. Anything that acts on the data, such as a vote counter or a role check, must leave it off. Included relations inherit the setting unless their sub-query sets its own. The same applies to the rows under __links and to what selects an instance: where (including a per-link author), the class's flags, count/totalCount, the order behind limit/offset, parent scopes and $ projections, transitive ones included. With true, selection reads unverified links too. |
limit? | number | - |
linkStatus? | LinkStatus | Read instances as they exist in links of one status only. 'shared' hydrates from Shared links only: every property, relation, author and updatedAt comes from links that are gossiped to the neighbourhood, and none from this executor's Local links. That is the read to use when showing data to another user (#1024). 'local' is the converse. Unset or null (the default) reads both, and a property declared local: true still reads only its Local links. Relations include typed @HasMany / @HasOne relations, which are filled by the conformance getter the SDK generates: the executor adds the status check to that getter's relation link. A hand-written getter is run as written, so it reads links of any status unless it checks <ad4m://ontology/status> itself. Included relations and the instances a $ projection hydrates inherit the setting, unless an include's sub-query sets its own. The __links rows (see links) are restricted the same way. Combines with includeUnverified: a link must have the requested status and pass the signature check, both on the same link. So a Local link whose signature did not verify is withheld under linkStatus: 'local' too, and comes back only with linkStatus: 'local', includeUnverified: true (or with no linkStatus and includeUnverified: true). Scope: this restricts the links that hydrate an instance and the links that select it (where, the class's flags, count/totalCount, $ projections, parent scopes and the order behind limit/offset). So an instance is returned under 'local' only when it is flagged in a Local link, and under 'shared' only when it is flagged in a Shared one. |
links? | string[] | Return the individual links behind each instance, with their own author, timestamp, signature and signature verdict, under instance.__links. For a collection this is per-item provenance: who added each member, when, and whether their signature holds. Each entry is a property or relation name the model declares, or an absolute predicate IRI — including one the model does not declare (an annotation such as a revocation tombstone). A name wins over the IRI reading. Every requested entry is present on every instance, as [] when it has no such link. An entry that is neither a declared name nor an IRI, or that names a reverse relation (@BelongsToOne / @BelongsToMany), makes the query fail rather than answer []. The rows are read by a second query after the instances are hydrated, so asking for them never changes createdAt, updatedAt or any property. See LinkRow. |
offset? | number | - |
order? | Order | - |
parent? | Scope | Filter to instances that are the target of a link from a given parent. |
properties? | string[] | - |
where? | Where | - |
Defined in
core/src/model/types.ts:326 (opens in a new tab)
QueryRequest
Ƭ QueryRequest: Object
Unified query request (harmonised: engine + query in one).
Type declaration
| Name | Type |
|---|---|
engine | string |
query | string |
Defined in
core/src/generated/api/QueryRequest.ts:6 (opens in a new tab)
RawScope
Ƭ RawScope: Object
Raw form of Scope (parent node + linking predicate) — the only variant
the WebSocket auto-processor config accepts. Scope's model form
({ model: typeof Ad4mModel, id, field? }) references a JS class
constructor, which JSON.stringify silently drops, so the executor would
receive { id } and the scope would be unresolvable. Client callers who
hold a model class should resolve its predicate via
ModelQueryBuilder.buildParentScope() first and pass the result here.
Type declaration
| Name | Type |
|---|---|
id | string |
predicate | string |
Defined in
core/src/perspectives/AutoProcessor.ts:15 (opens in a new tab)
RelatedModel
Ƭ RelatedModel<T, K>: NonNullable<T[K]> extends infer U[] ? U extends Ad4mModel ? U : Ad4mModel : NonNullable<T[K]> extends Ad4mModel ? NonNullable<T[K]> : Ad4mModel
The model type referenced by a relation field K on T.
Falls back to Ad4mModel (loose) for the string[] relation pattern,
since no target class is available at the type level.
Type parameters
| Name | Type |
|---|---|
T | extends Ad4mModel |
K | extends RelationKeysOf<T> |
Defined in
core/src/model/types.ts:521 (opens in a new tab)
RelationKeysOf
Ƭ RelationKeysOf<T>: { [K in keyof T]: K extends ModelDataKeys<T> ? NonNullable<T[K]> extends Ad4mModel ? K : NonNullable<T[K]> extends Ad4mModel[] ? K : NonNullable<T[K]> extends string[] ? K : never : never }[keyof T]
Keys of T that can appear in include — typed Ad4mModel references AND
string[] link-target arrays (the @HasMany + string[] pattern that
AD4M uses for relations without a target class thunk). Handles both
?: Foo (optional → Foo | undefined) and Foo | null field shapes, and
optional/nullable array variants (?: Foo[], Foo[] | null).
Type parameters
| Name | Type |
|---|---|
T | extends Ad4mModel |
Defined in
core/src/model/types.ts:509 (opens in a new tab)
RelationSubQuery
Ƭ RelationSubQuery: Omit<Query, "parent" | "count">
Sub-query options for a specific relation inside an IncludeMap.
Equivalent to Query without top-level scoping (parent) or count,
since the result set is already constrained to the linked relation.
Example
await post.get({ include: { comments: { order: { createdAt: 'DESC' }, limit: 5 } } });Defined in
core/src/model/types.ts:467 (opens in a new tab)
RemoveLinkRequest
Ƭ RemoveLinkRequest: Object
Type declaration
| Name | Type |
|---|---|
batchId? | string |
link | LinkExpressionInput |
Defined in
core/src/generated/api/RemoveLinkRequest.ts:4 (opens in a new tab)
RemoveLinksBulkRequest
Ƭ RemoveLinksBulkRequest: Object
Type declaration
| Name | Type |
|---|---|
batchId? | string |
links | LinkExpressionInput[] |
Defined in
core/src/generated/api/RemoveLinksBulkRequest.ts:4 (opens in a new tab)
ResultsWithTotalCount
Ƭ ResultsWithTotalCount<T>: Object
Type parameters
| Name |
|---|
T |
Type declaration
| Name | Type |
|---|---|
results | T[] |
totalCount? | number |
Defined in
core/src/model/types.ts:708 (opens in a new tab)
RpcMethod
Ƭ RpcMethod: keyof RpcMethods
Defined in
core/src/generated/api/RpcMethods.ts:333 (opens in a new tab)
RunInterpretationRequest
Ƭ RunInterpretationRequest: Object
Run generic LLM interpretation over a transcript into the perspective's own SHACL subject classes. Shapes are resolved server-side from the perspective's registered classes, so callers pass only the transcript.
Type declaration
| Name | Type | Description |
|---|---|---|
basePrefix | string | URI namespace new instance identities are minted under, e.g. soa://ext/. |
classes? | string[] | Local names of the subject classes to extract into (e.g. ["Task","Belief"]). None/empty selects all subject classes registered in the perspective. |
emitDebugEvents? | boolean | Emit LlmRequestSent / LlmResponseReceived (carrying the raw prompt and response) for this pass. Ignored without observation_id — there would be nothing to correlate the payloads to. Same switch, same reasons, as AutoProcessorConfig.emit_debug_events. |
existingScope? | any | Optional parent-scope filter for the dedup lookup: when set, only existing instances of the target classes that live under this scope are candidates for upsert. None = whole-perspective dedup set (the pre-scope default). Same semantics as AutoProcessorConfig.existingScope. |
mintScope? | any | Optional parent-scope target for newly minted instances: when set, every base URI the pass CREATES is additionally linked as a child of mintScope.id via the scope's predicate. Upserts of pre-existing instances are NOT linked (would multi-parent unrelated graph state). Must be the Raw variant of Scope (id + predicate). Same semantics as AutoProcessorConfig.mintScope. |
observationId? | string | Opt into live observability for this one-shot pass, under an id the caller chooses. A watch pass is identified by its batch_key — a hash of the source items the watcher gathered. A one-shot pass has neither: the caller supplies the transcript directly, so there are no source item ids to hash and no claim to key off. Rather than invent a server-side id the caller would then have to correlate by guesswork (the pass is one blocking RPC, so there is no earlier response to carry it), the caller names the pass and gets its own id back on every event. Present: the pass emits RunningInterpretation → Processed on the auto-processor-event topic, plus Claimed → Finished/Abandoned on the neighbourhood topic, all carrying this value as both processor_id and batch_key. Absent: the pass is silent, exactly as before — no existing caller changes behaviour. |
transcript | TranscriptTurn[] | - |
uuid | string | - |
Defined in
core/src/generated/api/RunInterpretationRequest.ts:9 (opens in a new tab)
Scope
Ƭ Scope: { field?: string ; id: string ; model: typeof Ad4mModel } | { id: string ; predicate: string } | TraverseScope
A named subgraph scope: a parent node + linking predicate.
Reusable across contexts that need to identify "the subtree under node X
linked via predicate P": query-time filtering as a parent filter on a
ModelQuery (the "all Messages belonging to Channel X" case) AND
AutoProcessor's existingScope / mintScope fields — the former
constrains dedup lookups; the latter turns each new mint into a child
link under the given node.
Model form (preferred for parent-filter queries) — predicate
auto-resolved from the parent model's relation metadata. Use field to
disambiguate when the parent has multiple relations targeting the same
child class. AutoProcessor mintScope requires the Raw form because
only Raw carries an explicit linking predicate; Model scopes have no
predicate to write.
Raw form — explicit predicate string, no metadata lookup.
Traverse form — bounded traversal from one or more anchors, for reading a tree rather than one node's children. Read-only: AutoProcessor's write scopes reject it, because it names no single parent to write under.
Defined in
core/src/model/types.ts:107 (opens in a new tab)
ScopedEventName
Ƭ ScopedEventName: "perspective-added" | "perspective-removed" | "perspective-updated" | "sync-state-change" | "link-added" | "link-removed" | "link-updated" | "signal" | "notification-triggered" | "query-subscription-update" | "auto-processor-event" | "auto-processor-neighbourhood-state"
Events about one perspective: they carry perspectiveUuid.
Defined in
core/src/generated/api/Events.ts:50 (opens in a new tab)
SetDefaultModelRequest
Ƭ SetDefaultModelRequest: Object
Type declaration
| Name | Type |
|---|---|
modelType | ModelType |
Defined in
core/src/generated/api/SetDefaultModelRequest.ts:4 (opens in a new tab)
SetFreeHostingEnabledRequest
Ƭ SetFreeHostingEnabledRequest: Object
Type declaration
| Name | Type |
|---|---|
enabled | boolean |
Defined in
core/src/generated/api/SetFreeHostingEnabledRequest.ts:3 (opens in a new tab)
SetHostRatesRequest
Ƭ SetHostRatesRequest: Object
Type declaration
| Name | Type |
|---|---|
rates | HostRate[] |
Defined in
core/src/generated/api/SetHostRatesRequest.ts:4 (opens in a new tab)
SetMultiUserRequest
Ƭ SetMultiUserRequest: Object
Type declaration
| Name | Type |
|---|---|
enabled | boolean |
Defined in
core/src/generated/api/SetMultiUserRequest.ts:3 (opens in a new tab)
SetStatusRequest
Ƭ SetStatusRequest: Object
Type declaration
| Name | Type |
|---|---|
status | any |
Defined in
core/src/generated/api/SetStatusRequest.ts:3 (opens in a new tab)
SetUnytMembraneProofRequest
Ƭ SetUnytMembraneProofRequest: Object
Type declaration
| Name | Type | Description |
|---|---|---|
proof | string | Base64-encoded membrane proof from the hosting joining service. |
Defined in
core/src/generated/api/SetUnytMembraneProofRequest.ts:3 (opens in a new tab)
SignMessageRequest
Ƭ SignMessageRequest: Object
Type declaration
| Name | Type |
|---|---|
message | string |
Defined in
core/src/generated/api/SignMessageRequest.ts:3 (opens in a new tab)
StringWhereOps
Ƭ StringWhereOps: Object
Type declaration
| Name | Type | Description |
|---|---|---|
author? | AuthorCondition | See author. |
contains? | string | - |
eq? | string | string[] | See eq. |
not? | string | string[] | - |
Defined in
core/src/model/types.ts:532 (opens in a new tab)
TelepresenceSignalCallback
Ƭ TelepresenceSignalCallback: (payload: PerspectiveExpression, recipientDid?: string) => void
Type declaration
▸ (payload, recipientDid?): void
Callback shape used by the client to receive telepresence signals from a Neighbourhood's link Language.
Parameters
| Name | Type |
|---|---|
payload | PerspectiveExpression |
recipientDid? | string |
Returns
void
Defined in
core/src/language/Language.ts:78 (opens in a new tab)
TranscriptTurn
Ƭ TranscriptTurn: Object
One conversation turn fed to the extractor.
Type declaration
| Name | Type |
|---|---|
speaker | string |
text | string |
Defined in
core/src/generated/api/TranscriptTurn.ts:6 (opens in a new tab)
TraverseScope
Ƭ TraverseScope: TraverseByPredicate | TraverseByModel
Walk a predicate from several anchors at once, and optionally all the way down.
This exists because a tree read one level at a time costs a round trip per level and — under a subscription — one subscription per parent. Asking for every anchor in one query makes both proportional to depth instead.
The predicate is named the same two ways the other scopes name it: literally, or by the model and relation that own it. See TraverseByPredicate and TraverseByModel.
Defined in
core/src/model/types.ts:124 (opens in a new tab)
TrustedAgentsRequest
Ƭ TrustedAgentsRequest: Object
Type declaration
| Name | Type |
|---|---|
agents | string[] |
Defined in
core/src/generated/api/TrustedAgentsRequest.ts:3 (opens in a new tab)
TypedIncludeMap
Ƭ TypedIncludeMap<T>: HasNoTypedFields<T> extends true ? IncludeMap : StrictTypedIncludeMap<T>
Type parameters
| Name | Type |
|---|---|
T | extends Ad4mModel |
Defined in
core/src/model/types.ts:638 (opens in a new tab)
TypedIncludeProjection
Ƭ TypedIncludeProjection<T>: { [K in RelationKeysOf<T>]: Object | Object | Object }[RelationKeysOf<T>]
Projection — from must be a real relation on T; where/order constrained to that target.
Modelled as a discriminated union so the literal count: true and limit: 1
variants narrow inference into IncludeExtras (count → number, limit-1 → scalar).
Type parameters
| Name | Type |
|---|---|
T | extends Ad4mModel |
Defined in
core/src/model/types.ts:627 (opens in a new tab)
TypedOrder
Ƭ TypedOrder<T>: HasNoTypedFields<T> extends true ? Order : StrictTypedOrder<T>
Type parameters
| Name | Type |
|---|---|
T | extends Ad4mModel |
Defined in
core/src/model/types.ts:605 (opens in a new tab)
TypedQuery
Ƭ TypedQuery<T>: HasNoTypedFields<T> extends true ? Query : StrictTypedQuery<T>
Type parameters
| Name | Type |
|---|---|
T | extends Ad4mModel |
Defined in
core/src/model/types.ts:690 (opens in a new tab)
TypedQueryWhere
Ƭ TypedQueryWhere<T>: TypedWhere<T> & { producedByFlow?: ProducedByFlowFilter }
Top-level typed where of a query on T: TypedWhere plus
producedByFlow. Kept out of TypedWhere itself because that shape is
reused under OR/AND/NOT and in include sub-queries, where the
executor rejects producedByFlow (see producedByFlow).
Type parameters
| Name | Type |
|---|---|
T | extends Ad4mModel |
Defined in
core/src/model/types.ts:594 (opens in a new tab)
TypedRelationSubQuery
Ƭ TypedRelationSubQuery<U>: Object
Sub-query for an eager-loaded relation — inherits the target model's constraints.
Type parameters
| Name | Type |
|---|---|
U | extends Ad4mModel |
Type declaration
| Name | Type | Description |
|---|---|---|
include? | TypedIncludeMap<U> | - |
includeUnverified? | boolean | See includeUnverified. Inherited from the parent query when unset. |
limit? | number | - |
linkStatus? | LinkStatus | See linkStatus. Inherited from the parent query when unset. |
links? | string[] | - |
offset? | number | - |
order? | TypedOrder<U> | - |
where? | TypedWhere<U> | - |
Defined in
core/src/model/types.ts:611 (opens in a new tab)
TypedWhere
Ƭ TypedWhere<T>: HasNoTypedFields<T> extends true ? Where : StrictTypedWhere<T>
Public typed where for a model class. Falls back to the loose Where
shape when T has no declared fields (e.g. fromSHACL-derived classes).
Type parameters
| Name | Type |
|---|---|
T | extends Ad4mModel |
Defined in
core/src/model/types.ts:587 (opens in a new tab)
TypedWhereCondition
Ƭ TypedWhereCondition<V>: V extends string ? string | string[] | StringWhereOps : V extends number ? number | number[] | NumericWhereOps : V extends boolean ? boolean | { author?: AuthorCondition ; eq?: boolean } : V extends infer U[] ? U extends string ? string | string[] | StringWhereOps : U extends number ? number | number[] | NumericWhereOps : WhereCondition : WhereCondition
Type parameters
| Name |
|---|
V |
Defined in
core/src/model/types.ts:554 (opens in a new tab)
UnlockAgentRequest
Ƭ UnlockAgentRequest: Object
Type declaration
| Name | Type |
|---|---|
holochain? | boolean |
passphrase | string |
Defined in
core/src/generated/api/UnlockAgentRequest.ts:3 (opens in a new tab)
UnytVersionInfo
Ƭ UnytVersionInfo: Object
The Unyt alliance DNA: installed and bundled versions, and why the last
install failed. setUnytMembraneProof installs in the background, so this
is where its outcome shows.
Type declaration
| Name | Type | Description |
|---|---|---|
bundled | string | Version of the DNA bundled with this executor. |
installError | string | null | Error of the last install that failed; null after a success or a new proof. |
installed | string | null | Version of the installed DNA; null until an install succeeds. |
Defined in
core/src/generated/api/UnytVersionInfo.ts:8 (opens in a new tab)
UpdateLinkRequest
Ƭ UpdateLinkRequest: Object
Type declaration
| Name | Type |
|---|---|
batchId? | string |
newLink | LinkInput |
oldLink | LinkExpressionInput |
Defined in
core/src/generated/api/UpdateLinkRequest.ts:5 (opens in a new tab)
UpdatePerspectiveRequest
Ƭ UpdatePerspectiveRequest: Object
Type declaration
| Name | Type |
|---|---|
name | string |
Defined in
core/src/generated/api/UpdatePerspectiveRequest.ts:3 (opens in a new tab)
ValueTuple
Ƭ ValueTuple: [name: string, value: any, resolve?: boolean]
Defined in
core/src/model/types.ts:715 (opens in a new tab)
VerifySignatureRequest
Ƭ VerifySignatureRequest: Object
Type declaration
| Name | Type |
|---|---|
data | string |
did | string |
signedData | string |
Defined in
core/src/generated/api/VerifySignatureRequest.ts:3 (opens in a new tab)
Where
Ƭ Where: Object
Index signature
▪ [propertyName: string]: WhereCondition | undefined
Type declaration
| Name | Type | Description |
|---|---|---|
AND? | Where[] | Logical AND: instance must satisfy all of the given sub-clauses. |
NOT? | Where | Logical NOT: instance must NOT satisfy the given sub-clause. |
OR? | Where[] | Logical OR: instance must satisfy at least one of the given sub-clauses. |
producedByFlow? | ProducedByFlowFilter | Only instances that are valid outputs of a completed run of flow (optionally: of a run settled into terminal state state). Decided executor-side by cryptographic receipt verification, not by a property: an instance passes only when a verified receipt of the flow names it among the outputs its quorum committed to AND its live content still matches that commitment. Fail-closed — a forged, unverifiable or stale receipt excludes the instance — and applied BEFORE limit/ offset, so a page of N is N valid outputs. Only supported as a top-level key on the queried class; anywhere else the query errors. |
Defined in
core/src/model/types.ts:58 (opens in a new tab)
WhereCondition
Ƭ WhereCondition: string | number | boolean | string[] | number[] | { [K in keyof WhereOps]?: WhereOps[K] } | Where[] | Where
Defined in
core/src/model/types.ts:48 (opens in a new tab)
WhereOps
Ƭ WhereOps: Object
Type declaration
| Name | Type | Description |
|---|---|---|
author | AuthorCondition | Per-link author: the link that satisfies this property's condition was written by this author, e.g. { agent: { eq: did, author: admin } }. Alone, { agent: { author: admin } }: admin wrote some agent link. Only on properties and relations stored as links (not getters, timestamp or id). See "Filtering by Author" in the model-classes guide. |
between | [number, number] | - |
contains | string | number | - |
eq | string | number | boolean | string[] | number[] | Equality as an operator: { eq: X } is the bare value X (an array means any of). It lets a value sit beside author, and cannot be combined with the other value operators. |
gt | number | - |
gte | number | - |
lt | number | - |
lte | number | - |
not | string | number | boolean | string[] | number[] | - |
Defined in
core/src/model/types.ts:29 (opens in a new tab)
WriteSettingsRequest
Ƭ WriteSettingsRequest: Object
Type declaration
| Name | Type |
|---|---|
settings | string |
Defined in
core/src/generated/api/WriteSettingsRequest.ts:3 (opens in a new tab)
Variables
ACCEPTED_BY_GETTER
• Const ACCEPTED_BY_GETTER: "SELECT ?target WHERE { ?source <ad4m://acceptedBy> ?target . FILTER EXISTS { ?_vote <http://www.w3.org/1999/02/22-rdf-syntax-ns#reifies> <<( ?source <ad4m://acceptedBy> ?target )>> ; <ad4m://ontology/author> ?_author ; <ad4m://ontology/proofValid> ?_valid . FILTER(STR(?_author) = STR(?target) && STR(?_valid) = \"true\") } }"
The engine's vote rule (signed_by: the link's author is the DID it names,
and its signature verified) as a getter over the link's reifier. Must match
the acceptedBy getter in hardwired_sdna/flow_transition_proposal.json
byte for byte: whichever side registers the class first decides the stored
shape.
Defined in
core/src/perspectives/FlowModels.ts:42 (opens in a new tab)
LONG_METHODS
• Const LONG_METHODS: ReadonlySet<RpcMethod>
Calls that can run for minutes: the client's default timeout is its long one.
Defined in
core/src/generated/api/RpcMethods.ts:406 (opens in a new tab)
LONG_TIMEOUT_MS
• Const LONG_TIMEOUT_MS: number
Default timeout for calls that can run for minutes: LLM work, Holochain, publishing.
Defined in
core/src/apiClient.ts:52 (opens in a new tab)
PROPOSER_GETTER
• Const PROPOSER_GETTER: "SELECT ?target WHERE { ?source <ad4m://flow/proposer> ?target . FILTER EXISTS { ?_claim <http://www.w3.org/1999/02/22-rdf-syntax-ns#reifies> <<( ?source <ad4m://flow/proposer> ?target )>> ; <ad4m://ontology/author> ?_author ; <ad4m://ontology/proofValid> ?_valid . FILTER(STR(?_author) = STR(?target) && STR(?_valid) = \"true\") } }"
The engine's proposer rule (self_authored_proposer: a proposer link
signed by the DID it names) as a getter. Must match the proposer getter in
hardwired_sdna/flow_transition_proposal.json byte for byte, as
ACCEPTED_BY_GETTER must.
Defined in
core/src/perspectives/FlowModels.ts:32 (opens in a new tab)
PerspectiveState
• Const PerspectiveState: Object
Type declaration
| Name | Type |
|---|---|
LinkLanguageFailedToInstall | "LINK_LANGUAGE_FAILED_TO_INSTALL" |
LinkLanguageInstalledButNotSynced | "LINK_LANGUAGE_INSTALLED_BUT_NOT_SYNCED" |
NeighboudhoodCreationInitiated | "NEIGHBOURHOOD_CREATION_INITIATED" |
NeighbourhoodJoinInitiated | "NEIGHBOURHOOD_JOIN_INITIATED" |
Private | "PRIVATE" |
Synced | "SYNCED" |
Defined in
core/src/perspectives/PerspectiveHandle.ts:7 (opens in a new tab)
core/src/perspectives/PerspectiveHandle.ts:15 (opens in a new tab)
READ_METHODS
• Const READ_METHODS: ReadonlySet<RpcMethod>
Idempotent reads: the client resends one once after a reconnect.
Defined in
core/src/generated/api/RpcMethods.ts:336 (opens in a new tab)
SCOPED_EVENTS
• Const SCOPED_EVENTS: ReadonlySet<EventName>
ScopedEventName as a set.
Defined in
core/src/generated/api/Events.ts:53 (opens in a new tab)
SMART_LITERAL_CONTENT_PREDICATE
• Const SMART_LITERAL_CONTENT_PREDICATE: "smart_literal://content"
Defined in
core/src/SmartLiteral.ts:6 (opens in a new tab)
fileToDataUri
• Const fileToDataUri: Readonly<{ cond: NodeExpression ; else: NodeExpression = elseExpr; then: NodeExpression = thenExpr; type: "if" = 'if' }>
Built-in transform: FileData → data: URI
Converts a file stored via FILE_STORAGE_LANGUAGE into a data: URL.
If the object has a data_base64 field, returns:
data:{file_type};base64,{data_base64}
Otherwise passes through the input unchanged.
This is the Rust equivalent of the JS defaultFileDecode function.
Usage:
@Property({
through: 'we://image',
resolveLanguage: 'literal',
transform: fileToDataUri,
})
avatar?: string;Defined in
core/src/shacl/index.ts:52 (opens in a new tab)
typeDefsString
• Const typeDefsString: ""
Defined in
core/src/typeDefs.ts:4 (opens in a new tab)
Decorators Functions
BelongsToMany
▸ BelongsToMany(opts): PropertyDecorator
Decorator for defining the inverse side of a many-to-many relation.
Parameters
| Name | Type |
|---|---|
opts | RelationOptions |
Returns
PropertyDecorator
Description
Declares the non-owning (inverse) side of a many-to-many relationship. The property is a read-only relation since the owning side manages links.
Supports two calling conventions:
@BelongsToMany({ through: "post://tag", target: () => Post })
@BelongsToMany(() => Post, { through: "post://tag" })Example
@Model({ name: "Tag" })
class Tag extends Ad4mModel {
@BelongsToMany(() => Post, { through: "post://tag" })
posts: string[] = [];
}Defined in
core/src/model/decorators.ts:1397 (opens in a new tab)
▸ BelongsToMany(target, opts?): PropertyDecorator
Parameters
| Name | Type |
|---|---|
target | () => Ad4mModelLike |
opts? | Omit<RelationOptions, "target"> |
Returns
PropertyDecorator
Defined in
core/src/model/decorators.ts:1398 (opens in a new tab)
BelongsToOne
▸ BelongsToOne(opts): PropertyDecorator
Decorator for defining the inverse side of a one-to-one relation.
Parameters
| Name | Type |
|---|---|
opts | RelationOptions |
Returns
PropertyDecorator
Description
Declares the non-owning (inverse) side of a one-to-one relationship. The property is read-only since the owning side manages the link.
Supports two calling conventions:
@BelongsToOne({ through: "post://author", target: () => Post })
@BelongsToOne(() => Post, { through: "post://author" })Example
@Model({ name: "Author" })
class Author extends Ad4mModel {
@BelongsToOne(() => Post, { through: "post://author" })
post: string = "";
}Defined in
core/src/model/decorators.ts:1334 (opens in a new tab)
▸ BelongsToOne(target, opts?): PropertyDecorator
Parameters
| Name | Type |
|---|---|
target | () => Ad4mModelLike |
opts? | Omit<RelationOptions, "target"> |
Returns
PropertyDecorator
Defined in
core/src/model/decorators.ts:1335 (opens in a new tab)
Flag
▸ Flag(opts): <T>(target: T, key: keyof T) => void
Decorator for defining flags on model classes.
Parameters
| Name | Type | Description |
|---|---|---|
opts | FlagOptions | Flag configuration |
Returns
fn
▸ <T>(target, key): void
Type parameters
| Name |
|---|
T |
Parameters
| Name | Type |
|---|---|
target | T |
key | keyof T |
Returns
void
Description
A specialized property decorator for defining immutable type flags or markers on model instances. Flags are always required properties with a fixed value that cannot be changed after creation.
Common uses for flags:
- Type discrimination between different kinds of models
- Marking models with specific capabilities or features
- Versioning or compatibility markers
Note: Use of Flag is discouraged unless you specifically need type-based filtering or discrimination between different kinds of models. For most cases, regular properties with
Property
or
Optional
are more appropriate.
Example
class Message extends Ad4mModel {
// Type flag to identify message models
@Flag({
through: "ad4m://type",
value: "ad4m://message"
})
type: string = "";
// Version flag for compatibility
@Flag({
through: "ad4m://version",
value: "1.0.0"
})
version: string = "";
// Feature flag
@Flag({
through: "message://feature",
value: "message://encrypted"
})
feature: string = "";
}
// Later you can query for specific types:
const messages = await Message.query(perspective)
.where({ type: "ad4m://message" })
.run();Defined in
core/src/model/decorators.ts:533 (opens in a new tab)
HasMany
▸ HasMany(opts): PropertyDecorator
Decorator for defining a one-to-many relation.
Parameters
| Name | Type |
|---|---|
opts | RelationOptions |
Returns
PropertyDecorator
Description
Declares that the decorated property is an array of related model instances. Under the hood it registers the relation in the relation registry and also creates the corresponding relation entry so that the SDNA / SHACL generators continue to emit the correct subject-class code.
Supports two calling conventions:
// Options-object style
@HasMany({ through: "post://comment", target: () => Comment })
// Target-first shorthand
@HasMany(() => Comment, { through: "post://comment" })Example
@Model({ name: "Post" })
class Post extends Ad4mModel {
@HasMany(() => Comment, { through: "post://comment" })
comments: string[] = [];
}Defined in
core/src/model/decorators.ts:1165 (opens in a new tab)
▸ HasMany(target, opts?): PropertyDecorator
Parameters
| Name | Type |
|---|---|
target | () => Ad4mModelLike |
opts? | Omit<RelationOptions, "target"> |
Returns
PropertyDecorator
Defined in
core/src/model/decorators.ts:1166 (opens in a new tab)
HasOne
▸ HasOne(opts): PropertyDecorator
Decorator for defining a one-to-one relation (owning side).
Parameters
| Name | Type |
|---|---|
opts | RelationOptions |
Returns
PropertyDecorator
Description
Declares that the decorated property holds a single related model instance. The owning side manages the link.
Supports two calling conventions:
@HasOne({ through: "post://author", target: () => Author })
@HasOne(() => Author, { through: "post://author" })Example
@Model({ name: "Post" })
class Post extends Ad4mModel {
@HasOne(() => Author, { through: "post://author" })
author: string = "";
}Defined in
core/src/model/decorators.ts:1235 (opens in a new tab)
▸ HasOne(target, opts?): PropertyDecorator
Parameters
| Name | Type |
|---|---|
target | () => Ad4mModelLike |
opts? | Omit<RelationOptions, "target"> |
Returns
PropertyDecorator
Defined in
core/src/model/decorators.ts:1236 (opens in a new tab)
Model
▸ Model(opts): (target: any) => void
Decorator for defining model classes in AD4M.
Parameters
| Name | Type | Description |
|---|---|---|
opts | ModelConfig | Model configuration |
Returns
fn
▸ (target): void
Parameters
| Name | Type |
|---|---|
target | any |
Returns
void
Description
The root decorator that must be applied to any class that represents a model in AD4M. It registers the class as a Social DNA (SDNA) subject class and provides the infrastructure for storing and retrieving instances.
This decorator:
- Registers the class with a unique name in the AD4M system
- Generates the necessary SDNA code for the model's properties and relations
- Enables the use of other model decorators (@Property, @HasMany, etc.)
- Provides static query methods through the Ad4mModel base class
Schema generation calls the class constructor once, without a perspective, to read field defaults, so keep constructors free of side effects.
Example
@Model({ name: "Recipe" })
class Recipe extends Ad4mModel {
@Property({
through: "recipe://name"
})
name: string = "";
@HasMany({ through: "recipe://ingredient" })
ingredients: string[] = [];
// Static query methods from Ad4mModel:
static async findByName(perspective: PerspectiveProxy, name: string) {
return Recipe.query(perspective)
.where({ name })
.run();
}
}
// Using the model:
const recipe = new Recipe(perspective);
recipe.name = "Chocolate Cake";
await recipe.save();
// Querying instances:
const recipes = await Recipe.query(perspective)
.where({ name: "Chocolate Cake" })
.run();
// Using with PerspectiveProxy:
await perspective.ensureSDNASubjectClass(Recipe);Defined in
core/src/model/decorators.ts:641 (opens in a new tab)
Optional
▸ Optional(opts): <T>(target: T, key: keyof T) => void
Convenience decorator for defining optional (not required) properties.
Parameters
| Name | Type | Description |
|---|---|---|
opts | PropertyOptions | Property configuration (same options as @Property) |
Returns
fn
▸ <T>(target, key): void
Type parameters
| Name |
|---|
T |
Parameters
| Name | Type |
|---|---|
target | T |
key | keyof T |
Returns
void
Description
Equivalent to @Property but defaults required to false and does not
apply any initial defaults. Use this when a property
may or may not have a value, and you want full control over its configuration.
Example
class Recipe extends Ad4mModel {
@Optional({ through: "recipe://description" })
description?: string;
}Defined in
core/src/model/decorators.ts:460 (opens in a new tab)
Property
▸ Property(opts): <T>(target: T, key: keyof T) => void
The primary property decorator for AD4M model classes.
Parameters
| Name | Type | Description |
|---|---|---|
opts | PropertyOptions | Property configuration |
Returns
fn
▸ <T>(target, key): void
Type parameters
| Name |
|---|
T |
Parameters
| Name | Type |
|---|---|
target | T |
key | keyof T |
Returns
void
Description
The core property decorator with smart defaults. All other property decorators (@Optional, @ReadOnly) are thin wrappers that adjust these defaults.
Smart defaults (all overridable):
required→falsereadOnly→falseresolveLanguage→ unset → deterministic typed literal storage (the perf default). SetresolveLanguage: "literal"for a signed-envelope value, or a custom language address to resolve through that language.initial→undefined(no link created until a value is explicitly set)
Properties are optional by default. When a model instance is created without
providing a value for an optional property, no link is added to the graph.
Set required: true explicitly when a property must always be present (this
also adds a "literal:string:uninitialized" sentinel as the initial value
so that the SDNA constructor creates a placeholder link).
Example
class User extends Ad4mModel {
// Optional property (default) — no link created until a value is set
@Property({
through: "user://name"
})
name: string = "";
// Explicitly required property with sentinel initial value
@Property({
through: "user://status",
required: true
})
status: string = "";
// Required property with custom initial value
@Property({
through: "user://role",
required: true,
initial: "user://member"
})
role: string = "";
// Optional property with signed-envelope literal storage
// (per-value provenance)
@Property({
through: "user://bio",
resolveLanguage: "literal"
})
bio: string = "";
}Defined in
core/src/model/decorators.ts:737 (opens in a new tab)
ReadOnly
▸ ReadOnly(opts): <T>(target: T, key: keyof T) => void
Decorator for defining read-only properties on model classes.
Parameters
| Name | Type | Description |
|---|---|---|
opts | PropertyOptions | Property configuration |
Returns
fn
▸ <T>(target, key): void
Type parameters
| Name |
|---|
T |
Parameters
| Name | Type |
|---|---|
target | T |
key | keyof T |
Returns
void
Description
A convenience decorator that defines a read-only property.
Equivalent to @Property with readOnly: true.
Read-only properties are ideal for:
- Computed or derived values
- Properties that should never change after creation
- Properties that are set by the system
- Properties that represent immutable data
Example
class Post extends Ad4mModel {
// Read-only property with custom getter for computed value
@ReadOnly({
through: "post://likes",
getter: `findall(User, triple(Base, "post://liked_by", User), Users), length(Users, Value)`
})
likeCount: number = 0;
// Read-only property for creation timestamp
@ReadOnly({
through: "post://created_at",
initial: new Date().toISOString()
})
createdAt: string = "";
// Read-only property that resolves to a Literal
@ReadOnly({
through: "post://author",
resolveLanguage: "literal"
})
author: string = "";
// Read-only property for system-managed data
@ReadOnly({
through: "post://version",
initial: "1.0.0"
})
version: string = "";
}Defined in
core/src/model/decorators.ts:807 (opens in a new tab)
Other Functions
ExpressionGeneric
▸ ExpressionGeneric<DataType>(DataTypeClass): (author?: string, timestamp?: string, data?: DataType, proof?: ExpressionProof) => ExpressionShape<DataType>
Type parameters
| Name |
|---|
DataType |
Parameters
| Name | Type |
|---|---|
DataTypeClass | ClassType<DataType> |
Returns
fn
• (author?, timestamp?, data?, proof?)
Parameters
| Name | Type |
|---|---|
author? | string |
timestamp? | string |
data? | DataType |
proof? | ExpressionProof |
Defined in
core/src/expression/Expression.ts:32 (opens in a new tab)
ExpressionGenericInput
▸ ExpressionGenericInput<DataType>(DataTypeClass): () => ExpressionShape<DataType, ExpressionProofInput>
Type parameters
| Name |
|---|
DataType |
Parameters
| Name | Type |
|---|---|
DataTypeClass | ClassType<DataType> |
Returns
fn
• ()
Defined in
core/src/expression/Expression.ts:49 (opens in a new tab)
buildConformanceFilter
▸ buildConformanceFilter(relationPredicate, targetClass): { conformanceConditions: ConformanceCondition[] ; getter: string } | undefined
Build a conformance filter for a relation whose target model is known.
Inspects the target class's property metadata to derive:
conformanceConditions: Structured, DB-agnostic conditions (flag & required checks)getter: Pre-computed graph traversal expression that traverses outgoing links and filters target nodes to only those conforming to the target shape.
Parameters
| Name | Type | Description |
|---|---|---|
relationPredicate | string | The relation's predicate URI (e.g. "flux://entry_type") |
targetClass | Ad4mModelLike | The target model class (resolved from the target() thunk) |
Returns
{ conformanceConditions: ConformanceCondition[] ; getter: string } | undefined
{ getter, conformanceConditions } or undefined if no conditions could be derived
Defined in
core/src/model/decorators.ts:235 (opens in a new tab)
buildModelFromJSONSchema
▸ buildModelFromJSONSchema(BaseClass, schema, options): typeof Ad4mModel
Core implementation of Ad4mModel.fromJSONSchema().
Creates a dynamic Ad4mModel subclass from a JSON Schema definition,
wiring up property / relation metadata, setters, and the @Model decorator.
Parameters
| Name | Type | Description |
|---|---|---|
BaseClass | typeof Ad4mModel | The Ad4mModel class (or subclass) to extend |
schema | JSONSchema | JSON Schema definition |
options | JSONSchemaToModelOptions | Configuration options |
Returns
typeof Ad4mModel
Generated Ad4mModel subclass
Defined in
core/src/model/json-schema.ts:263 (opens in a new tab)
buildSDNA
▸ buildSDNA(subjectName, obj, properties, allRelationsMeta): Object
Build SDNA (Social DNA) Prolog code for a model class.
Parameters
| Name | Type | Description |
|---|---|---|
subjectName | string | The model's registered name (from @Model({ name })) |
obj | any | target.prototype — used to inspect prototype methods (e.g. setter stubs, subjectConstructor, isSubjectInstance) |
properties | Record<string, PropertyMetadataEntry> | Merged property metadata (from getPropertiesMetadata) |
allRelationsMeta | Record<string, RelationMetadataEntry> | Merged relation metadata (from getRelationsMetadata) |
Returns
Object
| Name | Type |
|---|---|
name | string |
sdna | string |
Defined in
core/src/model/sdna.ts:21 (opens in a new tab)
buildSHACL
▸ buildSHACL(subjectName, target, properties, allRelationsMeta, conformanceFilterFn, seedCache?, interpretationHint?): Object
Build a SHACL shape for a model class.
Parameters
| Name | Type | Description |
|---|---|---|
subjectName | string | The model's registered name (from @Model({ name })) |
target | any | The class constructor (used for prototype access, inheritance chain, and relation target resolution) |
properties | Record<string, PropertyMetadataEntry> | Merged property metadata (from getPropertiesMetadata) |
allRelationsMeta | Record<string, RelationMetadataEntry> | Merged relation metadata (from getRelationsMetadata) |
conformanceFilterFn | ConformanceFilterFn | Injected conformance-filter builder (avoids circular dependency back into decorators.ts) |
seedCache? | (partial: { name: string ; shape: SHACLShape }) => void | Optional early-cache seeding callback. When invoked with a partial { shape, name }, any re-entrant generateSHACL() call on the same target — which happens when a relation's target: () => SameClass points at us, directly or transitively — observes the in-progress shape rather than re-entering this function infinitely. Provided by @Model via getMemoizedSHACL; safe to omit when calling buildSHACL directly (e.g. from a one-off SDNA build tool). |
interpretationHint? | string | Natural-language hint declared on the @Model decorator that steers the generic LLM extractor when producing instances of this class. Attached to the SHACL shape node and re-emitted as an ad4m://interpretation_hint link by SHACLShape.toLinks(). |
Returns
Object
| Name | Type |
|---|---|
name | string |
shape | SHACLShape |
Defined in
core/src/model/shacl-gen.ts:31 (opens in a new tab)
buildSPARQLQuery
▸ buildSPARQLQuery(metadata, allRelationsMetadata, query, modelClass): string
Build a SPARQL query that returns all links belonging to instances of
the given model class, optionally filtered by where conditions.
Uses direct triple patterns: ?source ?predicate ?target with named graph storage and metadata keyed by graph IRI.
Parameters
| Name | Type |
|---|---|
metadata | ModelMetadata |
allRelationsMetadata | Record<string, RelationMetadataEntry> |
query | Query |
modelClass | any |
Returns
string
Defined in
core/src/model/query-sparql.ts:324 (opens in a new tab)
buildWhereCondition
▸ buildWhereCondition(predicate, condition, opts?): string
Compile a single Where condition for a property into a SPARQL triple pattern that can be embedded in a getter's WHERE clause.
The generated pattern operates on ?target — e.g.:
?target <pred> <value> .
FILTER EXISTS { ?target <pred> ?_v0 }
Parameters
| Name | Type | Description |
|---|---|---|
predicate | string | The predicate URI for the property |
condition | WhereCondition | The Where condition value |
opts? | Object | Optional settings. isDeterministicLiteral (default true) selects the direct typed-literal WHERE path. Set to false when the property stores a signed envelope (resolveLanguage: "literal") or a custom-language expression — the envelope path unwraps with parse_literal before comparing. |
opts.isDeterministicLiteral? | boolean | - |
opts.varIndex? | number | - |
Returns
string
A single SPARQL condition string
Defined in
core/src/model/query-utils.ts:58 (opens in a new tab)
capSentence
▸ capSentence(cap): string
Parameters
| Name | Type |
|---|---|
cap | any |
Returns
string
Defined in
core/src/utils.ts:15 (opens in a new tab)
clearQueryCache
▸ clearQueryCache(): void
Clear all cache entries (useful for testing).
Returns
void
Defined in
core/src/model/query-cache.ts:70 (opens in a new tab)
coalesce
▸ coalesce(...args): NodeExpression
Coalesce: returns the first non-null evaluated argument.
Parameters
| Name | Type |
|---|---|
...args | NodeExpression[] |
Returns
Defined in
core/src/shacl/builders.ts:76 (opens in a new tab)
compileWhereClause
▸ compileWhereClause(where, metadata): string[]
Compile a full Where clause to an array of SPARQL condition strings.
When metadata is provided, property names are resolved to predicates
using the model's property metadata. When metadata is null, property
names are treated as raw predicate URIs.
Only handles regular properties — special fields (id, author,
timestamp) and relation fields are skipped (they are only relevant at
runtime query time, not for compile-time getter generation).
Parameters
| Name | Type |
|---|---|
where | Where |
metadata | ModelMetadata |
Returns
string[]
Defined in
core/src/model/query-utils.ts:198 (opens in a new tab)
concat
▸ concat(...args): NodeExpression
String concatenation: joins evaluated arguments as strings. Null/undefined arguments are skipped.
Parameters
| Name | Type |
|---|---|
...args | NodeExpression[] |
Returns
Defined in
core/src/shacl/builders.ts:69 (opens in a new tab)
createPersistentCache
▸ createPersistentCache<T>(dbName, storeName): PersistentCache<T>
Create a PersistentCache backed by IndexedDB (browser) or NullCache (Node.js).
Type parameters
| Name | Type |
|---|---|
T | unknown |
Parameters
| Name | Type | Description |
|---|---|---|
dbName | string | IndexedDB database name |
storeName | string | IndexedDB object store name |
Returns
Defined in
core/src/cache/PersistentCache.ts:133 (opens in a new tab)
determineNamespace
▸ determineNamespace(schema, options): string
Determines the namespace for predicates using cascading precedence:
- Explicit namespace in options
- x-ad4m metadata in schema
- Infer from schema title
- Try to extract from $id
- Error if nothing works
Parameters
| Name | Type |
|---|---|
schema | JSONSchema |
options | JSONSchemaToModelOptions |
Returns
string
Defined in
core/src/model/json-schema.ts:108 (opens in a new tab)
determinePredicate
▸ determinePredicate(schema, propertyName, propertySchema, namespace, options): string
Determines the predicate for a specific property using cascading precedence:
- Explicit property mapping
- x-ad4m metadata in property schema
- Predicate template
- Custom predicate generator
- Default: namespace + property name
Parameters
| Name | Type |
|---|---|
schema | JSONSchema |
propertyName | string |
propertySchema | JSONSchemaProperty |
namespace | string |
options | JSONSchemaToModelOptions |
Returns
string
Defined in
core/src/model/json-schema.ts:157 (opens in a new tab)
effectiveLiteralStorage
▸ effectiveLiteralStorage(meta): LiteralStorageMode
Derive the effective storage mode from a property's explicit options.
resolveLanguage is the sole selector and is NOT defaulted at the
decorator level:
- unset → deterministic typed literal (the perf default
for a plain
@Property()) "literal"→ signed envelope on the built-in literal language (per-value provenance, e.g. Flux message bodies)<custom address>→ signed expression on that custom language
Parameters
| Name | Type |
|---|---|
meta | Object |
meta.resolveLanguage? | string |
Returns
Defined in
core/src/model/query-sparql.ts:233 (opens in a new tab)
escapeQueryString
▸ escapeQueryString(value): string
Escapes a string value for safe use in query strings.
Parameters
| Name | Type | Description |
|---|---|---|
value | string | The string value to escape |
Returns
string
The escaped string safe for query interpolation (without surrounding quotes)
Description
Prevents SQL injection by properly escaping special characters in string values that will be interpolated into query strings. This handles the most common special characters that could break SQL queries or enable injection attacks.
Single quotes, backslashes, and other special characters are escaped using backslash notation, which is the standard escaping mechanism for query.
Example
const userInput = "user's input with 'quotes'";
const escaped = escapeQueryString(userInput);
const query = `SELECT * FROM link WHERE uri = '${escaped}'`;
// Results in: SELECT * FROM link WHERE uri = 'user\'s input with \'quotes\''Defined in
core/src/utils.ts:49 (opens in a new tab)
exists
▸ exists(expr): NodeExpression
Existence check: returns true if the inner expression is non-null and non-empty.
Parameters
| Name | Type |
|---|---|
expr | NodeExpression |
Returns
Defined in
core/src/shacl/builders.ts:36 (opens in a new tab)
exprRef2String
▸ exprRef2String(ref): string
Parameters
| Name | Type |
|---|---|
ref | ExpressionRef |
Returns
string
Defined in
core/src/expression/ExpressionRef.ts:16 (opens in a new tab)
fn
▸ fn(iri, args?): NodeExpression
Function call: invoke a named transform function by IRI. Primarily used for built-in functions like "ad4m://fn/defaultFileDecode".
Parameters
| Name | Type | Default value |
|---|---|---|
iri | string | undefined |
args | NodeExpression[] | [] |
Returns
Defined in
core/src/shacl/builders.ts:84 (opens in a new tab)
focus
▸ focus(): NodeExpression
Identity expression: pass the focus node through unchanged.
Returns
Defined in
core/src/shacl/builders.ts:13 (opens in a new tab)
formatList
▸ formatList(list): any
Parameters
| Name | Type |
|---|---|
list | any |
Returns
any
Defined in
core/src/utils.ts:1 (opens in a new tab)
formatQueryValue
▸ formatQueryValue(value): string
Format a JavaScript value for embedding in a query expression.
- Strings are single-quoted with backslash / quote / newline escaping
- Numbers and booleans are passed through as-is
- Arrays are recursed
Parameters
| Name | Type |
|---|---|
value | any |
Returns
string
Defined in
core/src/model/query-utils.ts:20 (opens in a new tab)
formatSPARQLValue
▸ formatSPARQLValue(value): string
Format a value as a SPARQL string literal (double-quoted).
Parameters
| Name | Type |
|---|---|
value | any |
Returns
string
Defined in
core/src/model/query-sparql.ts:270 (opens in a new tab)
getCachedResult
▸ getCachedResult(perspectiveUUID, queryText): any | undefined
Get a cached query result if it exists and hasn't expired.
Parameters
| Name | Type |
|---|---|
perspectiveUUID | string |
queryText | string |
Returns
any | undefined
Defined in
core/src/model/query-cache.ts:27 (opens in a new tab)
getDefaultValueForType
▸ getDefaultValueForType(type?): any
Gets default value for a JSON Schema type.
Parameters
| Name | Type |
|---|---|
type? | string |
Returns
any
Defined in
core/src/model/json-schema.ts:238 (opens in a new tab)
getMemoizedSHACL
▸ getMemoizedSHACL(target, compute): any
Get or compute memoised SHACL for a class. Used by
Parameters
| Name | Type |
|---|---|
target | Function |
compute | (seed: (partial: any) => void) => any |
Returns
any
Model
decorator.
The compute callback receives a seed(partial) function: calling
it stores partial in the cache before compute returns, so any
re-entrant getMemoizedSHACL(target, …) call from inside compute
observes the in-progress shape instead of re-entering compute
infinitely.
This matters for self-referential models — e.g.
@Model({ name: "Channel" })
class Channel extends Ad4mModel {
@HasMany({ predicate: "…/child", target: () => Channel })
childChannels!: Channel[];
}Without the seed, building the SHACL shape for Channel invokes
Channel.generateSHACL() while walking the childChannels
relation's target (shacl-gen.ts ~line 327), which re-enters this
function with an empty cache, blowing the stack.
Defined in
core/src/model/decorators.ts:164 (opens in a new tab)
getPropertiesMetadata
▸ getPropertiesMetadata(ctor): Record<string, PropertyMetadataEntry>
Retrieve property metadata for a given class constructor. Walks the prototype chain so subclass decorators compose with parent decorators. Results are memoised per class constructor.
Parameters
| Name | Type |
|---|---|
ctor | Function |
Returns
Record<string, PropertyMetadataEntry>
Defined in
core/src/model/decorators.ts:99 (opens in a new tab)
getPropertyOption
▸ getPropertyOption(propertyName, propertySchema, options, optionName, defaultValue?): any
Gets property-specific options using cascading precedence:
- Property-specific options
- x-ad4m metadata in property
- Global option
- Default value
Parameters
| Name | Type |
|---|---|
propertyName | string |
propertySchema | JSONSchemaProperty |
options | JSONSchemaToModelOptions |
optionName | keyof PropertyOptions |
defaultValue? | any |
Returns
any
Defined in
core/src/model/json-schema.ts:209 (opens in a new tab)
getRelationsMetadata
▸ getRelationsMetadata(ctor): Record<string, RelationMetadataEntry>
Retrieve relation metadata for a given class constructor. Walks the prototype chain so subclass decorators compose with parent decorators. Results are memoised per class constructor.
Parameters
| Name | Type |
|---|---|
ctor | Function |
Returns
Record<string, RelationMetadataEntry>
Defined in
core/src/model/decorators.ts:123 (opens in a new tab)
hasJsOnlyWhereFilters
▸ hasJsOnlyWhereFilters(metadata, allRelationsMetadata, where?): boolean
Check whether a where clause contains filters that cannot be pushed down
to SPARQL and must be evaluated in JS after hydration.
JS-only filters include:
- Literal-stored properties (equality, comparison, contains, etc.)
- Reverse relations (belongsToOne / belongsToMany)
- author / timestamp filters (skipped by buildSPARQLWhereFilters)
- OR / AND / NOT combinators (skipped by buildSPARQLWhereFilters — see below)
When JS-only filters exist, SPARQL-level LIMIT/OFFSET must NOT be applied because the database would cap the candidate set before JS filters run, potentially discarding matches beyond the LIMIT.
Parameters
| Name | Type |
|---|---|
metadata | ModelMetadata |
allRelationsMetadata | Record<string, RelationMetadataEntry> |
where? | Where |
Returns
boolean
Defined in
core/src/model/query-sparql.ts:34 (opens in a new tab)
hintFor
▸ hintFor(msg): string
Add a short cause hint to known subscription failures. The executor needs its main key to register a live query; on a restarted executor whose wallet was never unlocked this surfaces as a bare 403.
Parameters
| Name | Type |
|---|---|
msg | string |
Returns
string
Defined in
core/src/perspectives/WakerSubscriptionManager.ts:69 (opens in a new tab)
ifExpr
▸ ifExpr(cond): Object
Conditional expression with optional else branch.
Returns a chainable builder that supports .then() and .else().
Parameters
| Name | Type |
|---|---|
cond | NodeExpression |
Returns
Object
| Name | Type |
|---|---|
then | (thenExpr: NodeExpression) => { else: (elseExpr?: NodeExpression) => Readonly<{ cond: NodeExpression ; else: NodeExpression = elseExpr; then: NodeExpression = thenExpr; type: "if" = 'if' }> ; toExpression: () => Readonly<{ cond: NodeExpression ; then: NodeExpression = thenExpr; type: "if" = 'if' }> } |
Defined in
core/src/shacl/builders.ts:44 (opens in a new tab)
invalidatePerspectiveCache
▸ invalidatePerspectiveCache(perspectiveUUID): void
Invalidate all cache entries for a given perspective. Called after write operations to ensure stale data isn't served.
Parameters
| Name | Type |
|---|---|
perspectiveUUID | string |
Returns
void
Defined in
core/src/model/query-cache.ts:58 (opens in a new tab)
isArrayType
▸ isArrayType(schema): boolean
Parameters
| Name | Type |
|---|---|
schema | JSONSchemaProperty |
Returns
boolean
Defined in
core/src/model/json-schema.ts:85 (opens in a new tab)
isExpression
▸ isExpression(e): boolean
Parameters
| Name | Type |
|---|---|
e | any |
Returns
boolean
Defined in
core/src/expression/Expression.ts:66 (opens in a new tab)
isIncludeProjection
▸ isIncludeProjection(val): val is IncludeProjection
Type guard for IncludeProjection objects.
Parameters
| Name | Type |
|---|---|
val | unknown |
Returns
val is IncludeProjection
Defined in
core/src/model/types.ts:322 (opens in a new tab)
isLink
▸ isLink(l): boolean
Parameters
| Name | Type |
|---|---|
l | any |
Returns
boolean
Defined in
core/src/links/Links.ts:105 (opens in a new tab)
isNodeExpression
▸ isNodeExpression(v): v is NodeExpression
Type guard to check if a value is a valid NodeExpression.
Parameters
| Name | Type |
|---|---|
v | unknown |
Returns
v is NodeExpression
Defined in
core/src/shacl/NodeExpression.ts:28 (opens in a new tab)
isNumericType
▸ isNumericType(schema): boolean
Parameters
| Name | Type |
|---|---|
schema | JSONSchemaProperty |
Returns
boolean
Defined in
core/src/model/json-schema.ts:93 (opens in a new tab)
isObjectType
▸ isObjectType(schema): boolean
Parameters
| Name | Type |
|---|---|
schema | JSONSchemaProperty |
Returns
boolean
Defined in
core/src/model/json-schema.ts:89 (opens in a new tab)
isSchemaType
▸ isSchemaType(schema, expectedType): boolean
Parameters
| Name | Type |
|---|---|
schema | JSONSchemaProperty |
expectedType | string |
Returns
boolean
Defined in
core/src/model/json-schema.ts:81 (opens in a new tab)
isTraverseScope
▸ isTraverseScope(scope): scope is TraverseScope
Whether this scope is a traversal rather than a single named parent.
The other two forms carry id; this one carries ids and may name several,
so anything reaching for one parent — every write path — has to ask first.
Parameters
| Name | Type |
|---|---|
scope | Scope |
Returns
scope is TraverseScope
Defined in
core/src/model/types.ts:240 (opens in a new tab)
linkEqual
▸ linkEqual(l1, l2): boolean
Parameters
| Name | Type |
|---|---|
l1 | LinkExpression |
l2 | LinkExpression |
Returns
boolean
Defined in
core/src/links/Links.ts:97 (opens in a new tab)
linkExpressionInputToWire
▸ linkExpressionInputToWire(link): WireLinkExpressionInput
Parameters
| Name | Type |
|---|---|
link | LinkExpressionInput |
Returns
WireLinkExpressionInput
Defined in
core/src/links/Links.ts:80 (opens in a new tab)
linkExpressionToWire
▸ linkExpressionToWire(link): WireLinkExpression
Parameters
| Name | Type |
|---|---|
link | LinkExpression |
Returns
WireLinkExpression
Defined in
core/src/links/Links.ts:70 (opens in a new tab)
linkMutationsToWire
▸ linkMutationsToWire(mutations): WireLinkMutations
Parameters
| Name | Type |
|---|---|
mutations | LinkMutations |
Returns
WireLinkMutations
Defined in
core/src/links/Links.ts:90 (opens in a new tab)
literal
▸ literal(value): NodeExpression
Literal constant expression.
Parameters
| Name | Type |
|---|---|
value | string | number | boolean |
Returns
Defined in
core/src/shacl/builders.ts:20 (opens in a new tab)
looksLikeUri
▸ looksLikeUri(value): boolean
Check whether a string value is a well-formed absolute IRI that can be
stored verbatim as a link target (raw NamedNode) instead of being
wrapped in a literal:string:* URI.
This mirrors the Rust is_safe_iri_target /
looks_like_absolute_iri predicate in
rust-executor/src/perspectives/model_query/utils.rs and is
load-bearing: a value that returns true here MUST also be safely
queryable on the Rust side (validate_iri gate on the SPARQL
UNION { ?s <pred> <val> } IRI arm), otherwise scheme-lookalike prose
such as "Note: buy milk", "Re: standup", "TODO: fix this" slips
through the write regex, is stored as an invalid NamedNode, and
becomes a silent no-match on read.
Fast-path scheme check (^[a-zA-Z][a-zA-Z0-9+\-._]*:) followed by the
same rejection set the Rust validate_iri applies: any Unicode
whitespace, C0/C1 control chars, and the SPARQL-breaking characters
< > { } ".
Parameters
| Name | Type |
|---|---|
value | string |
Returns
boolean
Defined in
core/src/model/query-sparql.ts:165 (opens in a new tab)
neighbourhoodExpressionFromWire
▸ neighbourhoodExpressionFromWire(wire): NeighbourhoodExpression
Build a NeighbourhoodExpression, with a Perspective as its meta, from the wire shape.
Parameters
| Name | Type |
|---|---|
wire | DecoratedNeighbourhoodExpression |
Returns
Defined in
core/src/perspectives/PerspectiveHandle.ts:49 (opens in a new tab)
normalizeNamespaceString
▸ normalizeNamespaceString(namespace): string
Parameters
| Name | Type |
|---|---|
namespace | string |
Returns
string
Defined in
core/src/model/json-schema.ts:60 (opens in a new tab)
normalizeSchemaType
▸ normalizeSchemaType(type?): string | undefined
Parameters
| Name | Type |
|---|---|
type? | string | string[] |
Returns
string | undefined
Defined in
core/src/model/json-schema.ts:71 (opens in a new tab)
normalizeValue
▸ normalizeValue(value): any
Normalize a value for snapshot storage.
Arrays of model instances are reduced to their .id strings so that
dirty-tracking compares stable identifiers instead of object references.
Parameters
| Name | Type |
|---|---|
value | any |
Returns
any
Defined in
core/src/model/hydration.ts:18 (opens in a new tab)
normalizeWhereForSparql
▸ normalizeWhereForSparql(metadata, where?): Where | undefined
Prepare a where for this client-side SPARQL builder: unwrap { eq: X }
to the bare X, and refuse a per-link author.
A per-link author (nested, { agent: { eq: X, author: A } }, or a
top-level author beside link-backed property or relation conditions) is
answered by the executor, which joins each matched link's reifier (#1114). This builder
has no such join, and treating the author as instance-level here would
answer a different, wider question. findAll()/count() answer it.
Parameters
| Name | Type |
|---|---|
metadata | ModelMetadata |
where? | Where |
Returns
Where | undefined
Defined in
core/src/model/query-sparql.ts:94 (opens in a new tab)
parseExprUrl
▸ parseExprUrl(url): ExpressionRef
Parameters
| Name | Type |
|---|---|
url | string |
Returns
Defined in
core/src/expression/ExpressionRef.ts:23 (opens in a new tab)
parseLit
▸ parseLit(val): string
Decode a Literal-encoded SPARQL binding back to a plain string.
Returns '' for undefined/empty input. Falls through to the raw value
if decoding fails — bindings against properties resolved through a custom
language are already raw URIs and should pass through unchanged.
Signed-envelope literals
Properties declared with resolveLanguage: 'literal' are written through
the built-in literal language, which wraps the value in a signed
expression envelope ({ author, timestamp, data, proof }) and encodes
the whole envelope as a literal:json: URL — see
rust-executor/src/languages/mod.rs::expression_create (literal branch).
On read, parseLit unwraps .data from that envelope so callers get the
original scalar value instead of the envelope JSON.
The Channel V refactor moved most scalar properties to deterministic
typed XSD literals which no longer round-trip through this envelope — for
those properties the SPARQL binding is already the lexical form and this
helper decodes to the primitive. Signed-envelope literals still exist
for any property that opts back into resolveLanguage: 'literal' (e.g.
per-message provenance for chat bodies), which is why the .data unwrap
is preserved here.
Non-envelope JSON objects (literal:json: payloads that are not signed
envelopes) are JSON-stringified for display.
Parameters
| Name | Type |
|---|---|
val | string |
Returns
string
Defined in
core/src/perspectives/SparqlBindings.ts:75 (opens in a new tab)
parseLitBoolean
▸ parseLitBoolean(val): boolean
Decode a Literal-encoded binding to a boolean. Returns false on empty input.
Parameters
| Name | Type |
|---|---|
val | string |
Returns
boolean
Defined in
core/src/perspectives/SparqlBindings.ts:127 (opens in a new tab)
parseLitNumber
▸ parseLitNumber(val): number
Decode a Literal-encoded binding to a number. Returns 0 on empty/invalid input.
Parameters
| Name | Type |
|---|---|
val | string |
Returns
number
Defined in
core/src/perspectives/SparqlBindings.ts:119 (opens in a new tab)
parseSparqlCount
▸ parseSparqlCount(result): number
Sum a SPARQL COUNT(?x) result down to a plain number (returns 0 on empty).
Parameters
| Name | Type |
|---|---|
result | CountBinding[] |
Returns
number
Defined in
core/src/perspectives/SparqlBindings.ts:40 (opens in a new tab)
path
▸ path(predicate): NodeExpression
Path expression: navigate to a property on the resolved object. The predicate can be a full IRI (e.g., "file_storage://data_base64") or a simple property name. The Rust evaluator will strip the namespace.
Parameters
| Name | Type |
|---|---|
predicate | string |
Returns
Defined in
core/src/shacl/builders.ts:29 (opens in a new tab)
queryCacheSize
▸ queryCacheSize(): number
Get the current size of the cache (useful for testing).
Returns
number
Defined in
core/src/model/query-cache.ts:77 (opens in a new tab)
requireSingleParent
▸ requireSingleParent(parent): Exclude<Scope, TraverseScope>
Narrow a scope to the one-parent forms, for the paths that write a link.
A traversal describes a read outward from several anchors. Creating a record "under" one would have to pick which, and nothing in the scope says — so this refuses rather than guessing at the first of the list. The executor's write scopes refuse it for the same reason.
Parameters
| Name | Type |
|---|---|
parent | Scope |
Returns
Exclude<Scope, TraverseScope>
Defined in
core/src/model/query-common.ts:26 (opens in a new tab)
resolveParentPredicate
▸ resolveParentPredicate(parent, childCtor): string
Parameters
| Name | Type |
|---|---|
parent | Scope |
childCtor | Function |
Returns
string
Defined in
core/src/model/query-common.ts:36 (opens in a new tab)
setCachedResult
▸ setCachedResult(perspectiveUUID, queryText, result, ttlMs?): void
Store a query result in the cache with TTL.
Parameters
| Name | Type | Default value |
|---|---|---|
perspectiveUUID | string | undefined |
queryText | string | undefined |
result | any | undefined |
ttlMs | number | DEFAULT_TTL_MS |
Returns
void
Defined in
core/src/model/query-cache.ts:41 (opens in a new tab)
setPropertyRegistryEntry
▸ setPropertyRegistryEntry(ctor, propName, meta): void
Programmatically register property metadata for a given constructor.
Used by fromJSONSchema() and other dynamic model builders.
Parameters
| Name | Type |
|---|---|
ctor | Function |
propName | string |
meta | PropertyMetadataEntry & { writable?: boolean } |
Returns
void
Defined in
core/src/model/decorators.ts:191 (opens in a new tab)
setRelationRegistryEntry
▸ setRelationRegistryEntry(ctor, relName, meta): void
Programmatically register relation metadata for a given constructor.
Used by fromJSONSchema() and other dynamic model builders.
Parameters
| Name | Type |
|---|---|
ctor | Function |
relName | string |
meta | RelationMetadataEntry |
Returns
void
Defined in
core/src/model/decorators.ts:204 (opens in a new tab)
valueToLiteralIri
▸ valueToLiteralIri(value): string
Convert a JS value to its literal: IRI form, matching how the Rust executor
stores property values in the default deterministic-literal path
(resolveLanguage unset). Strings that already look like URIs are returned
as-is.
Exported so write-side helpers (e.g. Ad4mModel.setProperty's literal
resolve path) can keep their on-disk form aligned with what
queryToSPARQL() filters against — otherwise the same value can be
stored as <literal:string:https%3A...> from one path while WHERE
builders probe <https://example.com> from the other.
The object/array arm mirrors Rust's Literal::from_json in
perspective_instance.rs::resolve_property_value (which routes
Value::Object | Value::Array through JSON encoding). Without it, JS
would fall through to String(value) and turn {a: 1} into
"[object Object]" and [1, 2, 3] into "1,2,3" before wrapping.
Parameters
| Name | Type |
|---|---|
value | any |
Returns
string