@coasys/ad4m / Exports
@coasys/ad4m
Table of contents
Enumerations
Classes
- Ad4mClient
- Agent
- AgentClient
- AgentExpression
- AgentSignature
- AgentStatus
- Apps
- AuthInfo
- AuthInfoInput
- Capability
- CapabilityInput
- Dna
- EntanglementProof
- EntanglementProofInput
- Expression
- ExpressionProof
- ExpressionProofInput
- ExpressionRef
- ExpressionRendered
- Icon
- InteractionCall
- InteractionMeta
- InteractionParameter
- LanguageExpression
- LanguageHandle
- LanguageLanguageInput
- LanguageMeta
- LanguageMetaInput
- LanguageMetaInternal
- LanguageRef
- Link
- LinkExpression
- LinkExpressionInput
- LinkExpressionMutations
- LinkExpressionUpdated
- LinkInput
- LinkMutations
- LinkQuery
- Literal
- Neighbourhood
- NeighbourhoodExpression
- NeighbourhoodProxy
- OnlineAgent
- Perspective
- PerspectiveAction
- PerspectiveDiff
- PerspectiveDiffExpression
- PerspectiveExpression
- PerspectiveHandle
- PerspectiveInput
- PerspectiveProxy
- PerspectiveUnsignedInput
- Resource
- ResourceInput
- SmartLiteral
- Subject
- SubjectEntity
Interfaces
- AgentService
- CollectionOptions
- DirectMessageAdapter
- ExpressionAdapter
- ExpressionUI
- FlagOptions
- GetAllAdapter
- GetByAuthorAdapter
- HolochainLanguageDelegate
- InitializeArgs
- InstanceQueryParams
- Interaction
- Language
- LanguageAdapter
- LanguageContext
- LinkSyncAdapter
- PropertyOptions
- PublicSharing
- ReadOnlyLanguage
- SDNAClassOptions
- SettingsUI
- SignaturesService
- TelepresenceAdapter
Type Aliases
- Ad4mSignalCB
- Address
- AgentAppsUpdatedCallback
- AgentStatusChangedCallback
- AgentUpdatedCallback
- DID
- LinkStatus
- MessageCallback
- PerspectiveDiffObserver
- QueryPartialEntity
- StatusCallback
- SubjectArray
- SubjectEntityQueryParam
- SyncStateChangeObserver
- TelepresenceSignalCallback
Variables
Decorators Functions
Other Functions
- ExpressionGeneric
- ExpressionGenericInput
- addLink
- capSentence
- exprRef2String
- formatList
- hasLink
- isExpression
- isLink
- linkEqual
- makeRandomPrologAtom
- parseExprUrl
Type Aliases
Ad4mSignalCB
Ƭ Ad4mSignalCB: (signal
: any
) => void
Type declaration
▸ (signal
): void
Parameters
Name | Type |
---|---|
signal | any |
Returns
void
Defined in
language/LanguageContext.ts:37 (opens in a new tab)
Address
Ƭ Address: string
Defined in
Address.ts:1 (opens in a new tab)
AgentAppsUpdatedCallback
Ƭ AgentAppsUpdatedCallback: () => null
Type declaration
▸ (): null
Returns
null
Defined in
agent/AgentClient.ts:81 (opens in a new tab)
AgentStatusChangedCallback
Ƭ AgentStatusChangedCallback: (agent
: Agent
) => null
Type declaration
▸ (agent
): null
Parameters
Name | Type |
---|---|
agent | Agent |
Returns
null
Defined in
agent/AgentClient.ts:80 (opens in a new tab)
AgentUpdatedCallback
Ƭ AgentUpdatedCallback: (agent
: Agent
) => null
Type declaration
▸ (agent
): null
Parameters
Name | Type |
---|---|
agent | Agent |
Returns
null
Defined in
agent/AgentClient.ts:79 (opens in a new tab)
DID
Ƭ DID: string
Defined in
LinkStatus
Ƭ LinkStatus: "shared"
| "local"
Defined in
perspectives/PerspectiveProxy.ts:15 (opens in a new tab)
MessageCallback
Ƭ MessageCallback: (message
: PerspectiveExpression
) => void
Type declaration
▸ (message
): void
Parameters
Name | Type |
---|---|
message | PerspectiveExpression |
Returns
void
Defined in
language/Language.ts:192 (opens in a new tab)
PerspectiveDiffObserver
Ƭ PerspectiveDiffObserver: (diff
: PerspectiveDiff
) => void
Type declaration
▸ (diff
): void
Parameters
Name | Type |
---|---|
diff | PerspectiveDiff |
Returns
void
Defined in
language/Language.ts:151 (opens in a new tab)
QueryPartialEntity
Ƭ QueryPartialEntity<T
>: { [P in keyof T]?: T[P] | Function }
Type parameters
Name |
---|
T |
Defined in
subject/SubjectEntity.ts:7 (opens in a new tab)
StatusCallback
Ƭ StatusCallback: (caller
: DID
) => Perspective
Type declaration
▸ (caller
): Perspective
Parameters
Name | Type |
---|---|
caller | DID |
Returns
Defined in
language/Language.ts:193 (opens in a new tab)
SubjectArray
Ƭ SubjectArray<T
>: T
[] | { action
: "setter"
| "adder"
| "remover"
; value
: T
[] }
Type parameters
Name |
---|
T |
Defined in
subject/SubjectEntity.ts:355 (opens in a new tab)
SubjectEntityQueryParam
Ƭ SubjectEntityQueryParam: Object
Type declaration
Name | Type |
---|---|
page? | number |
size? | number |
source? | string |
Defined in
subject/SubjectEntity.ts:360 (opens in a new tab)
SyncStateChangeObserver
Ƭ SyncStateChangeObserver: (state
: PerspectiveState
) => void
Type declaration
▸ (state
): void
Parameters
Name | Type |
---|---|
state | PerspectiveState |
Returns
void
Defined in
language/Language.ts:152 (opens in a new tab)
TelepresenceSignalCallback
Ƭ TelepresenceSignalCallback: (payload
: PerspectiveExpression
) => void
Type declaration
▸ (payload
): void
Parameters
Name | Type |
---|---|
payload | PerspectiveExpression |
Returns
void
Defined in
language/Language.ts:258 (opens in a new tab)
Variables
SMART_LITERAL_CONTENT_PREDICATE
• Const
SMART_LITERAL_CONTENT_PREDICATE: "smart_literal://content"
Defined in
SmartLiteral.ts:6 (opens in a new tab)
typeDefsString
• Const
typeDefsString: ""
Defined in
typeDefs.ts:6 (opens in a new tab)
Decorators Functions
InstanceQuery
▸ InstanceQuery(options?
): <T>(target
: T
, key
: keyof T
, descriptor
: PropertyDescriptor
) => void
Decorator for querying instances of a subject class.
Parameters
Name | Type | Description |
---|---|---|
options? | InstanceQueryParams | Query options. |
Returns
fn
▸ <T
>(target
, key
, descriptor
): void
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
target | T |
key | keyof T |
descriptor | PropertyDescriptor |
Returns
void
Description
NOTE: Only works on methods that return a promise and will throw an error if not used on a method that returns a promise. This will allow you to query for instances of a subject class with custom clauses within the instance clauses.
Example
// Usage with where clause
InstanceQuery({ where: { name: "John" }}) // this will return all the properties of the subject class with the name "John"
Example
// Usage with condition clause
InstanceQuery({ condition: "triple(Instance, 'age', Age), Age > 18" }) // this will return all the properties of the subject class with the age greater than 18
Defined in
subject/SDNADecorators.ts:56 (opens in a new tab)
SDNAClass
▸ SDNAClass(opts
): (target
: any
) => void
Decorator for defining an SDNA class.
Parameters
Name | Type | Description |
---|---|---|
opts | SDNAClassOptions | SDNA class options. |
Returns
fn
▸ (target
): void
Parameters
Name | Type |
---|---|
target | any |
Returns
void
Description
This will create a new SDNA class with the given name and add custom methods to generate the SDNA for the class, for this to work the class need to have the properties defined using the decorators like SubjectProperty
.
Note: This decorator is required for the class to be picked up during the initialization phase.
Example
// Usage
SDNAClass({ name: "Person" }) // this will create a new SDNA class with the name "Person"
Defined in
subject/SDNADecorators.ts:336 (opens in a new tab)
SubjectCollection
▸ SubjectCollection(opts
): <T>(target
: T
, key
: keyof T
) => void
Decorator for defining collections of a subject class.
Parameters
Name | Type | Description |
---|---|---|
opts | CollectionOptions | Collection options. |
Returns
fn
▸ <T
>(target
, key
): void
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
target | T |
key | keyof T |
Returns
void
Description
This will allow you to define collections with different conditions and how they would be defined in proflog engine.
NOTE: The property needs to be an array for it to picked up during the initialization phase.
- All collections must have a
through
option which is the predicate of the collection. - If the collection has a
where
option, it can be used to define a custom condition for the collection. - If the collection has a
local
option, the collection will be stored locally in the perspective and not in the network. This is useful for collections that are not meant to be shared with the network.
Example
// Usage
SubjectCollection({ through: "ad4m://friends" }) // this will define a collection with the name "ad4m://friends"
Defined in
subject/SDNADecorators.ts:289 (opens in a new tab)
SubjectFlag
▸ SubjectFlag(opts?
): <T>(target
: T
, key
: keyof T
) => void
Decorator for defining flags of a subject class
Parameters
Name | Type | Description |
---|---|---|
opts? | FlagOptions | Flag options. |
Returns
fn
▸ <T
>(target
, key
): void
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
target | T |
key | keyof T |
Returns
void
Description
The idea behind flag decorator is to define a property that is required and has an initial value.
This will allow you to define a strict instance query. This behaviour can also be achieved with the SubjectProperty
decorator but the SubjectFlag
decorator is a shorthand for that.
NOTE: Use of Flag is discouraged and should be used only when necessary.
- All properties must have a
through
&initial
option which is the predicate of the property.
Example
// Usage
SubjectFlag({ through: "ad4m://name", value: "John" }) // this will define a flag with the name "ad4m://name" and the initial value "John"
Defined in
subject/SDNADecorators.ts:216 (opens in a new tab)
SubjectProperty
▸ SubjectProperty(opts?
): <T>(target
: T
, key
: keyof T
) => void
Decorator for defining properties of a subject class.
Parameters
Name | Type | Description |
---|---|---|
opts? | PropertyOptions | Property options. |
Returns
fn
▸ <T
>(target
, key
): void
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
target | T |
key | keyof T |
Returns
void
Description
This will allow you to define properties with different conditions and how they would be defined in proflog engine.
- All properties must have a
through
option which is the predicate of the property. -e If the property is required, it must have aninitial
option which is the initial value of the property. - If the property is writable, it will have a setter in prolog engine. A custom setter can be defined with the
setter
option. - If resolveLanguage is defined, you can use the default
Literal
Language or use your custom language address that can be used to store the property. - If a custom getter is defined, it will be used to get the value of the property in prolog engine. If not, the default getter will be used.
- If local is defined, the property will be stored locally in the perspective and not in the network. This is useful for properties that are not meant to be shared with the network
Example
// Usage
SubjectProperty({ through: "ad4m://name", initial: "John", required: true }) // this will define a property with the name "ad4m://name" and the initial value "John"
Defined in
subject/SDNADecorators.ts:162 (opens in a new tab)
Other Functions
ExpressionGeneric
▸ ExpressionGeneric<DataType
>(DataTypeClass
): any
Type parameters
Name |
---|
DataType |
Parameters
Name | Type |
---|---|
DataTypeClass | ClassType <DataType > |
Returns
any
Defined in
expression/Expression.ts:42 (opens in a new tab)
ExpressionGenericInput
▸ ExpressionGenericInput<DataType
>(DataTypeClass
): any
Type parameters
Name |
---|
DataType |
Parameters
Name | Type |
---|---|
DataTypeClass | ClassType <DataType > |
Returns
any
Defined in
expression/Expression.ts:67 (opens in a new tab)
addLink
▸ addLink(source
, predicate
, target
): PerspectiveAction
Parameters
Name | Type |
---|---|
source | string |
predicate | string |
target | string |
Returns
Defined in
subject/SDNADecorators.ts:12 (opens in a new tab)
capSentence
▸ capSentence(cap
): string
Parameters
Name | Type |
---|---|
cap | any |
Returns
string
Defined in
utils.ts:15 (opens in a new tab)
exprRef2String
▸ exprRef2String(ref
): string
Parameters
Name | Type |
---|---|
ref | ExpressionRef |
Returns
string
Defined in
expression/ExpressionRef.ts:22 (opens in a new tab)
formatList
▸ formatList(list
): any
Parameters
Name | Type |
---|---|
list | any |
Returns
any
Defined in
utils.ts:1 (opens in a new tab)
hasLink
▸ hasLink(predicate
): string
Parameters
Name | Type |
---|---|
predicate | string |
Returns
string
Defined in
subject/SDNADecorators.ts:21 (opens in a new tab)
isExpression
▸ isExpression(e
): boolean
Parameters
Name | Type |
---|---|
e | any |
Returns
boolean
Defined in
expression/Expression.ts:97 (opens in a new tab)
isLink
▸ isLink(l
): boolean
Parameters
Name | Type |
---|---|
l | any |
Returns
boolean
Defined in
links/Links.ts:91 (opens in a new tab)
linkEqual
▸ linkEqual(l1
, l2
): boolean
Parameters
Name | Type |
---|---|
l1 | LinkExpression |
l2 | LinkExpression |
Returns
boolean
Defined in
links/Links.ts:83 (opens in a new tab)
makeRandomPrologAtom
▸ makeRandomPrologAtom(length
): string
Parameters
Name | Type |
---|---|
length | number |
Returns
string
Defined in
subject/SDNADecorators.ts:303 (opens in a new tab)
parseExprUrl
▸ parseExprUrl(url
): ExpressionRef
Parameters
Name | Type |
---|---|
url | string |