Options
All
  • Public
  • Public/Protected
  • All
Menu

@dhealthdapps/backend

Index

Enumerations

Classes

Interfaces

Type Aliases

Variables

Functions

Type Aliases

AccountDocument: Account & Documentable
description

This type is used to interface entities of the accounts collection with mongoose and permits to instanciate objects representing these entities.

e.g. alongside AccountSchema, we also define AccountDocument which is a mixin that comprises of Account and this Documentable class.

In class Queryable, the first generic accepted permits to use documents that are typed with this, to filter results in a documents query.

since

v0.3.0

AccountIntegrationDocument: AccountIntegration & Documentable
description

This type is used to interface entities of the account_integrations collection with mongoose and permits to instanciate objects representing these entities.

e.g. alongside AccountIntegrationSchema, we also define AccountIntegrationDocument which is a mixin that comprises of AccountIntegration and this Documentable class.

In class Queryable, the first generic accepted permits to use documents that are typed with this, to filter results in a documents query.

since

v0.3.0

AccountSessionDocument: AccountSession & Documentable
description

This type is used to interface entities of the account-sessions collection with mongoose and permits to instanciate objects representing these entities.

e.g. alongside AccountSessionSchema, we also define AccountDocument which is a mixin that comprises of AccountSession and this Documentable class.

In class Queryable, the first generic accepted permits to use documents that are typed with this, to filter results in a documents query.

since

v0.3.2

ActivityDataDocument: ActivityData & Documentable
description

This type is used to interface entities of the activitydata collection with mongoose and permits to instanciate objects representing these entities.

e.g. alongside ActivityDataSchema, we also define ActivityDataDocument which is a mixin that comprises of ActivityData and this Documentable class.

In class Queryable, the first generic accepted permits to use documents that are typed with this, to filter results in a documents query.

since

v0.3.0

ActivityDocument: Activity & Documentable
description

This type is used to interface entities of the activities collection with mongoose and permits to an instance and objects representing these entities.

e.g. alongside ActivitySchema, we also define ActivityDocument which is a mixin that comprises of Activity and this Documentable class.

In class Queryable, the first generic accepted permits to use documents that are typed with this, to filter results in a documents query.

since

v0.3.0

AppConnectionPayload: { host: string; https: boolean; port: string | number; url: string }
label

COMMON

description

This type consists of an URL, a host, a port and a flag to enable/disable HTTPS. This type is used to establish a connection to the frontend or the backend apps from the outside of the hosting network ("public internet").

example

Using the AppConnectionPayload type to configure apps

const myFrontend = {
url: "http://elevate.dhealth.cloud:8080",
host: "elevate.dhealth.cloud",
port: 8080,
https: false
} as AppConnectionPayload;
link

DappConfig

since

v0.3.0

Type declaration

  • host: string
  • https: boolean
  • port: string | number
  • url: string
AssetDocument: Asset & Documentable
description

This type is used to interface entities of the operations collection with mongoose and permits to instanciate objects representing these entities.

e.g. alongside AssetSchema, we also define AssetDocument which is a mixin that comprises of Asset and this Documentable class.

In class Queryable, the first generic accepted permits to use documents that are typed with this, to filter results in a documents query.

since

v0.3.0

AssetType: string | "base" | "earn"
label

COMMON

description

This interface consists of a set of configuration fields that must be provided to configure a custom asset.

Note that newly implemented assets must be added to this type such that they are correctly understood and configured for the backend runtime endpoints.

link

AssetsConfig

since

v0.3.0

AuthChallengeDocument: AuthChallenge & Documentable
description

This type is used to interface entities of the authChallenges collection with mongoose and permits to create objects representing these entities.

e.g. alongside AuthChallengeSchema, we also define AuthChallengeDocument which is a mixin that comprises of AuthChallenge and this Documentable class.

In class Queryable, the first generic accepted permits to use documents that are typed with this, to filter results in a documents query.

since

v0.3.0

AuthParameters: { challengeSize: number; registries: string[]; secret: string }
label

COMMON

description

This type consists of a list of dHealth Account Addresses or Public Keys that are used for authentication purposes (registry), as well as an authentication secret which is used for signing access tokens.

example

Using the AuthParameters type to configure authentication

{
registries: ["NBLT42KCICXZE2Q7Q4SWW3GWWE3XWPH3KUBBOEY"],
secret: "ThisIsASecretThatYouShouldNotUseAndThatShouldNotLeak",
challengeSize: 8,
}
link

SecurityConfig

since

v0.3.0

Type declaration

  • challengeSize: number
  • registries: string[]
  • secret: string
BlockDocument: Block & Documentable
description

This type is used to interface entities of the operations collection with mongoose and permits to instanciate objects representing these entities.

e.g. alongside BlockSchema, we also define BlockDocument which is a mixin that comprises of Block and this Documentable class.

In class Queryable, the first generic accepted permits to use documents that are typed with this, to filter results in a documents query.

since

v0.3.2

BoosterAssetsMap: {}
label

COMMON

description

A discoverable asset configuration object. This configuration field consists of a key as listed in BoosterGroup and a configuration object as defined by DiscoverableAssetsMap.

link

AssetsConfig

since

v0.3.0

Type declaration

BoosterGroup: string | "referral" | "progress"
label

COMMON

description

This interface consists of a set of configuration fields that must be provided to configure a booster asset.

Note that newly implemented boosters must be added to this type such that they are correctly understood and configured for the backend runtime endpoints.

link

AssetsConfig

since

v0.3.0

BroadcastActivityPayoutsCommandOptions: BroadcastPayoutsCommandOptions
interface

BroadcastActivityPayoutsCommandOptions

description

This interface defines arguments that can be passed to this processor command that is implemented in the backend runtime.

Note that it is important that child classes extend this interface with their own specification of arguments.

Additional note relating to this implementation is that the payout preparation command does not need any other command options.

see

PayoutCommandOptions

since

v0.4.0

BroadcastBoosterPayoutsCommandOptions: BroadcastPayoutsCommandOptions
interface

BroadcastBoosterPayoutsCommandOptions

description

This interface defines arguments that can be passed to this processor command that is implemented in the backend runtime.

Note that it is important that child classes extend this interface with their own specification of arguments.

Additional note relating to this implementation is that the payout preparation command does not need any other command options.

see

PayoutCommandOptions

since

v0.4.0

CrossOriginParameters: { origin: string[] | string | boolean }
label

COMMON

description

This type consists of the security configuration related to the backend runtime API. It sets the valid origins to enable/disable CORS and permits to stop accepting requests from unknown locations ("origins").

example

Using the CrossOriginParameters type with a wildcard origin

{ origin: "*" }



example

Using the CrossOriginParameters type with a list of origins

// this allows both localhost and example.com
{ origin: ["http://localhost", "http://example.com"] }



example

Using the CrossOriginParameters type to disable CORS

// Setting `origin: false` disables CORS
{ origin: false }

// Setting `origin: true` is the equivalent of a wilcard
{ origin: true }
link

SecurityConfig

since

v0.3.0

Type declaration

  • origin: string[] | string | boolean
DefaultNodePayload: { publicKey: string; url: string }
label

COMMON

description

This type consists of an URL anda publicKey that are used to establish the connection and query info of the default node.

example

Using the DefaultNodePayload type to configure nodes

 // by default the URL can contain the schema and port
const defaultNode = {
url: "http://dual-02.dhealth.cloud:3000",
publicKey: "613010BCE1FBF3CE1503DEF3003C76E451EA4DD9205FAD3530BFF7B1D78BC989"
} as DefaultNodePayload;
link

NetworkConfig

since

v0.3.0

Type declaration

  • publicKey: string
  • url: string
DiscoverableAssetsMap: {}
label

COMMON

description

A discoverable asset configuration object. This configuration field consists of a key as listed in AssetType and a parameters object as defined by AssetParameters.

link

AssetsConfig

since

v0.3.0

Type declaration

HttpMethod: "GET" | "POST" | "PUT" | "PATCH"
description

The HTTP method name, e.g. "GET". This type is used to execute to HTTP requests using the axios dependency.

since

v0.3.0

LeaderboardConfig: { daily_score: ScoreSchedulerConfig; monthly_score: ScoreSchedulerConfig; weekly_score: ScoreSchedulerConfig }
label

COMMON

description

This type consists of 3 ScoreSchedulerConfig objects:

  • daily_score: the score config values for daily statistics aggregation.
  • weekly_score: the score config values for weekly statistics aggregation.
  • monthly_score: the score config values for monthly statistics aggregation.
link

StatisticsConfig

since

v0.3.2

Type declaration

LogDocument: Log & Documentable
description

This type is used to interface entities of the system-logs collection with mongoose and permits to instanciate objects representing these entities.

e.g. alongside LogSchema, we also define LogDocument which is a mixin that comprises of Log and this Documentable class.

In class Queryable, the first generic accepted permits to use documents that are typed with this, to filter results in a documents query.

since

v0.3.2

MessageDetails: object | ISendMailOptions
MongoOperationDec: { $inc: Record<string, number> }
description

A type that represents a mongo query operations using the $dec-operator that updates document field values by decrementing it as defined in the specification object. This type is used whenever a $dec operation shall be executed to decrement field values.

since

v0.3.2

Type declaration

  • $inc: Record<string, number>
MongoOperationEqual: { $eq: MongoQueryOperationValue }
description

A type that represents a mongo query operations using the $eq-operator that matches documents based of a field value.This type is used whenever a $eq operation shall be executed for filters additionally to query conditions.

since

v0.3.2

Type declaration

MongoOperationExists: { $exists: boolean }
description

A type that represents a mongo query operations using the $eq-operator that matches documents based of a field value.This type is used whenever a $eq operation shall be executed for filters additionally to query conditions.

since

v0.3.2

Type declaration

  • $exists: boolean
MongoOperationGreaterThan: { $gt: MongoQueryOperationValue }
description

A type that represents a mongo query operations using the $gt-operator that matches documents based of a field value.This type is used whenever a $gt operation shall be executed for filters additionally to query conditions.

since

v0.4.0

Type declaration

MongoOperationGreaterThanEqual: { $gte: MongoQueryOperationValue }
description

A type that represents a mongo query operations using the $gte-operator that matches documents based of a field value.This type is used whenever a $gte operation shall be executed for filters additionally to query conditions.

since

v0.4.0

Type declaration

MongoOperationInc: { $inc: Record<string, number> }
description

A type that represents a mongo query operations using the $inc-operator that updates document field values by incrementing it as defined in the specification object. This type is used whenever a $inc operation shall be executed to increment field values.

since

v0.3.2

Type declaration

  • $inc: Record<string, number>
MongoOperationLessThan: { $lt: MongoQueryOperationValue }
description

A type that represents a mongo query operations using the $lt-operator that matches documents based of a field value.This type is used whenever a $lt operation shall be executed for filters additionally to query conditions.

since

v0.4.0

Type declaration

MongoOperationLessThanEqual: { $lte: MongoQueryOperationValue }
description

A type that represents a mongo query operations using the $lte-operator that matches documents based of a field value.This type is used whenever a $lte operation shall be executed for filters additionally to query conditions.

since

v0.4.0

Type declaration

MongoOperationNotEqual: { $ne: MongoQueryOperationValue }
description

A type that represents a mongo query operations using the $ne-operator that matches documents based of a field value.This type is used whenever a $eq operation shall be executed for filters additionally to query conditions.

since

v0.3.2

Type declaration

MongoOperationSet: { $set: Record<string, MongoQueryOperationValue> }
description

A type that represents a mongo query operations using the $set-operator that updates document field values. This type is used whenever a $set operation shall be executed to create or update individual field values.

since

v0.3.2

Type declaration

MongoPipelineFacet: { $facet: { data: ({ $skip: number } | { $limit: number } | { $sort: Record<string, { $meta: "textScore" } | 1 | -1> })[]; metadata?: MongoRoutineCount[] } }
description

A type that represents a mongo routine used for preparing the result set that will be aggregated. This type notably configures the pagination of an individual mongo query and possible enables the $count routine with the corresponding field name in the result set.

since

v0.3.2

Type declaration

  • $facet: { data: ({ $skip: number } | { $limit: number } | { $sort: Record<string, { $meta: "textScore" } | 1 | -1> })[]; metadata?: MongoRoutineCount[] }
    • data: ({ $skip: number } | { $limit: number } | { $sort: Record<string, { $meta: "textScore" } | 1 | -1> })[]
    • Optional metadata?: MongoRoutineCount[]
MongoPipelineMatch: { $match: MongoQueryConditions }
description

A type that represents a mongo pipeline stage that uses the $match operator. This type is used whenever a search query shall be executed for any type of query conditions.

since

v0.3.2

Type declaration

MongoPipelineSet: { $set: MongoQueryResultSet }
description

A type that represents a mongo routine used for preparing an update (or creation) of new field values.

since

v0.3.2

Type declaration

MongoQueryConditionValue: boolean | number | string | Date | any[] | MongoRoutineIn | MongoRoutineRegex
description

A type that represents mongo query conditions individually and is used to perform safe database queries with typed conditions.

since

v0.3.2

MongoQueryConditions: {}
description

A type that consists of a container for multiple mongo query conditions that are typed using MongoQueryConditionValue and used to perform safe queries using typed conditions.

since

v0.3.2

Type declaration

MongoQueryCursor: { limit: number; page: number; skip: number }
description

A type that represents data about pagination, offset and limit for mongo database queries.

since

v0.3.2

Type declaration

  • limit: number
  • page: number
  • skip: number
description

A type that represents mongo query operations individually and is used to perform safe database queries with typed operations.

Mongo operations that are currently supported include:

  • $eq: This operation consists of matching documents by equality of a field value.
  • $ne: This operation consists of matching documents for which a field is not null.
  • $exists: This operation consists of matching documents for which a field exists and is not null.
  • $set: This operation consists of setting field values on matching documents.
  • $inc: This operation consists of incrementing a field value on matching documents.
  • $dec: This operation consists of decrementing a field value on matching documents.
  • $gt: This operation consists of matching documents for which a field value is greater than the provided filter.
  • $gte: This operation consists of matching documents for which a field value is greater than or equal the provided filter.
  • $lt: This operation consists of matching documents for which a field value is less than the provided filter.
  • $lte: This operation consists of matching documents for which a field value is less than or equal the provided filter.

example

Using the MongoOperationEqual operator

// performs a "non-null" query on field `fieldName`
{ "fieldName": { $ne: null } }
since

v0.3.2

description

A type that represents mongo query operations raw specification and is used to perform safe database query with added typed operations.

since

v0.3.2

MongoQueryOperationValue: boolean | boolean[] | number | number[] | string | string[] | Date | null | any[]
description

A type that represents mongo query conditions individually and is used to perform safe database queries with typed conditions.

since

v0.3.2

MongoQueryOperations: {}
description

A type that consists of a container for multiple mongo query operations, e.g. $ne or $eq that are typed using MongoQueryOperation and used to perform safe queries using typed operations.

since

v0.3.2

Type declaration

MongoQueryPipeline: (MongoQueryPipelineStage | MongoQueryUnion)[]
description

A type that represents mongo query pipelines. A pipeline typically consists of one or more mongo routines that impact the result set that the query execution will return.

since

v0.3.2

description

A type that represents mongo query pipeline stages. A pipeline stage consists of one mongo routines that impacts the result set that a query execution will return.

since

v0.3.2

MongoQueryResultSet: {}
description

A type that consists of a container for multiple mongo result values that are typed using MongoQueryResultValue and used to type the result set of a mongo query.

since

v0.3.2

Type declaration

MongoQueryResultValue: boolean | number | string | Date | any[]
description

A type that represents mongo result values individually and is used to type the result set when a mongo query is executed with the $set operator.

since

v0.3.2

MongoQueryUnion: { $unionWith: { coll: string; pipeline: (MongoQueryPipelineStage | { $group: any & { _id: string } })[] } }
description

A type that represents a union pipeline used for preparing the result set that will be aggregated. This type notably configures the collection name of an individual union group.

Note that the _id field is obligatory in the union group, as well as the coll - collection name - and the query pipeline stages

since

v0.3.2

Type declaration

MongoRoutineCount: { $count: string }
description

A type that represents a mongo routine using the $count operator. This type is used whenever a $count routine shall be executed i.e. when the result set contains an aggregated total number of entries.

since

v0.3.2

Type declaration

  • $count: string
MongoRoutineIn: { $in: number[] | string[] }
description

A type that represents a mongo routine using the $in operator. This type is used whenever a $in routine shall be executed for number- or string-typed query conditions.

since

v0.3.2

Type declaration

  • $in: number[] | string[]
MongoRoutineRegex: { $regex: string | RegExp }
description

A type that represents a mongo routine using the $regex operator. This type is used whenever a $regex condition shall be executed.

since

v0.3.2

Type declaration

  • $regex: string | RegExp
NetworkConnectionPayload: { epochAdjustment: number; generationHash: string; networkCurrencies: NetworkCurrencies; networkIdentifier: number; nodePublicKey?: string }
description

This type encapsulates parameters that can be used when connecting to a dHealth Network node. Configuring the connection object (repository factory) permits to avoid extra node requests to be issued before connection can be established.

example

Example network connection payload object for dHealth Network

 import { Currency } from "@dhealth/sdk";

const networkConnectionPayload = {
nodePublicKey: "5172C98BD61DF32F447C501DE8090A9D7096F9E71975D788D67F7A82B8C04EFA",
generationHash: "ED5761EA890A096C50D3F50B7C2F0CCB4B84AFC9EA870F381E84DDE36D04EF16",
epochAdjustment: "1616978397",
networkIdentifier: 104,
networkCurrencies: {
new Currency({
mosaicId: new MosaicId("39E0C49FA322A459"),
divisibility: 6,
transferable: true,
supplyMutable: false,
restrictable: false,
}),
new Currency({
mosaicId: new MosaicId("39E0C49FA322A459"),
divisibility: 6,
transferable: true,
supplyMutable: false,
restrictable: false,
});
}
} as NetworkConnectionPayload;
since

v0.1.0

Type declaration

  • epochAdjustment: number
  • generationHash: string
  • networkCurrencies: NetworkCurrencies
  • networkIdentifier: number
  • Optional nodePublicKey?: string
NetworkParameters: { divisibility: number; epochAdjustment: number; generationHash: string; mosaicId: string; namespaceId: string; namespaceName: string; networkIdentifier: number }
label

COMMON

description

This type consists of network parameters that are necessary when trying to establish connection to an operating node of dHealth Network.

Important network connection parameters include the network type, which can be MAIN_NET (104) or TEST_NET (152), a network identifier that is used as a security against transaction replays, and some other network related fields like it's starting epoch (UTC timestamp).

example

Example network configuration object for dHealth Network

{
namespaceName: "dhealth.dhp",
mosaicId: "39E0C49FA322A459",
namespaceId: "9D8930CDBB417337",
divisibility: 6,
networkIdentifier: 104,
epochAdjustment: 1616978397,
generationHash: "ED5761EA890A096C50D3F50B7C2F0CCB4B84AFC9EA870F381E84DDE36D04EF16"
}
link

NetworkConfig

since

v0.3.0

Type declaration

  • divisibility: number
  • epochAdjustment: number
  • generationHash: string
  • mosaicId: string
  • namespaceId: string
  • namespaceName: string
  • networkIdentifier: number
NodeConnectionPayload: { port?: number | string; url: string }
label

COMMON

description

This type consists of an URL and an optional port that are used to establish the connection with an operating dHealth Network Node. Typically, this node connection payload refers to a node by its URL with scheme, domain name and port.

example

Using the NodeConnectionPayload type to configure nodes

// by default the URL can contain the schema and port
const myNode1 = { url: "http://dual-02.dhealth.cloud:3000" } as NodeConnectionPayload;

// or also, the port can be split in a separate field
const myNode2 = { url: "http://dual-02.dhealth.cloud", port: 3000 } as NodeConnectionPayload;
link

NetworkConfig

since

v0.3.0

Type declaration

  • Optional port?: number | string
  • url: string
NotifierResult: object | SentMessageInfo
OAuthProviderType: string | "strava"
label

OAUTH

description

This interface consists of a set of configuration fields that must be provided to configure a custom OAuth provider.

Note that newly implemented OAuth provider must be added to this type such that they are correctly understood and configured for the backend runtime endpoints (/oauth).

link

OAuthConfig

since

v0.3.0

OAuthProvidersMap: {}
label

OAUTH

description

An OAuth Providers configuration object. This configuration field consists of a key as listed in {@link ProviderType} and a parameters object as defined by {@link ProviderParameters}.

link

OAuthConfig

since

v0.3.0

OperationDocument: Operation & Documentable
description

This type is used to interface entities of the operations collection with mongoose and permits to instanciate objects representing these entities.

e.g. alongside OperationSchema, we also define OperationDocument which is a mixin that comprises of Operation and this Documentable class.

In class Queryable, the first generic accepted permits to use documents that are typed with this, to filter results in a documents query.

since

v0.3.0

OperationParameters: { contract: string; label: string; query: TransactionDocument | any }
label

COMMON

description

This type consists of operation parameters that are necessary when processing high-level information from data that is communicated using dHealth Network Transactions. The query field is passed as a mongo filter query for relevant subjects.

example

Example operation configuration object

{
contract: "elevate:auth"
label: "Session|Sessions",
query: {
sourceAddress: "NDAPPH6ZGD4D6LBWFLGFZUT2KQ5OLBLU32K3HNY"
}
}
link

ProcessorConfig

since

v0.3.0

Type declaration

PayoutDocument: Payout & Documentable
description

This type is used to interface entities of the payouts collection with mongoose and permits to create an instance and objects representing these entities.

e.g. alongside PayoutSchema, we also define PayoutDocument which is a mixin that comprises of Payout and this Documentable class.

In class Queryable, the first generic accepted permits to use documents that are typed with this, to filter results in a documents query.

since

v0.4.0

PrepareActivityPayoutsCommandOptions: PreparePayoutsCommandOptions
interface

PrepareActivityPayoutsCommandOptions

description

This interface defines arguments that can be passed to this processor command that is implemented in the backend runtime.

Note that it is important that child classes extend this interface with their own specification of arguments.

Additional note relating to this implementation is that the payout preparation command does not need any other command options.

see

PayoutCommandOptions

since

v0.4.0

PrepareBoost10PayoutsCommandOptions: PrepareBoosterPayoutsCommandOptions
interface

PrepareBoost10PayoutsCommandOptions

description

This interface defines arguments that can be passed to this processor command that is implemented in the backend runtime.

Note that it is important that child classes extend this interface with their own specification of arguments.

Additional note relating to this implementation is that the payout preparation command does not need any other command options.

see

PayoutCommandOptions

since

v0.4.0

PrepareBoost15PayoutsCommandOptions: PrepareBoosterPayoutsCommandOptions
interface

PrepareBoost15PayoutsCommandOptions

description

This interface defines arguments that can be passed to this processor command that is implemented in the backend runtime.

Note that it is important that child classes extend this interface with their own specification of arguments.

Additional note relating to this implementation is that the payout preparation command does not need any other command options.

see

PayoutCommandOptions

since

v0.4.0

PrepareBoost5PayoutsCommandOptions: PrepareBoosterPayoutsCommandOptions
interface

PrepareBoost5PayoutsCommandOptions

description

This interface defines arguments that can be passed to this processor command that is implemented in the backend runtime.

Note that it is important that child classes extend this interface with their own specification of arguments.

Additional note relating to this implementation is that the payout preparation command does not need any other command options.

see

PayoutCommandOptions

since

v0.4.0

PrepareBoosterPayoutsCommandOptions: PreparePayoutsCommandOptions
interface

PrepareBoosterPayoutsCommandOptions

description

This interface defines arguments that can be passed to this processor command that is implemented in the backend runtime.

Note that it is important that child classes extend this interface with their own specification of arguments.

Additional note relating to this implementation is that the payout preparation command does not need any other command options.

see

PayoutCommandOptions

since

v0.4.0

PreparePayoutsCommandOptions: PayoutCommandOptions
interface

PreparePayoutsCommandOptions

description

This interface defines arguments that can be passed to this processor command that is implemented in the backend runtime.

Note that it is important that child classes extend this interface with their own specification of arguments.

Additional note relating to this implementation is that the payout preparation command does not need any other command options.

see

PayoutCommandOptions

since

v0.4.0

ReferralBoosterParameters: {}

A configuration object that defines the total number of referrals necessary to unlock the corresponding booster asset.

Note that the keys of this configuration object should contain the booster asset's identifier as defined inside config/assets.ts.

link

ReferralBoosterParameters

since

v0.6.0

Type declaration

  • [key: string]: { minReferred: number }
    • minReferred: number
Scope: string | "database" | "discovery" | "notifier" | "payout" | "processor" | "statistics" | "oauth" | "users"
label

COMMON

description

This enumeration contains the configurable scopes for the runtime. Any newly added scope must be added here as well to make sure, and in case it's necessary, that the scope can be enabled through the configuration of the backend runtime.

since

v0.1.0

ScoreSchedulerConfig: { collection: string; fields: string[]; type: string }
label

COMMON

description

This type consists of:

  • A period format type e.g. "D", "W", "M" for daily, weekly & monthly.
  • A collection name - of which schedulers will use to aggregate statistics from.
  • A fields array - which the schedulers will use to sum up for score.
link

StatisticsConfig

since

v0.3.2

Type declaration

  • collection: string
  • fields: string[]
  • type: string
SearchQuery: { queryCursor: MongoQueryCursor; querySorter: Record<string, 1 | -1 | { $meta: "textScore" }>; searchQuery: MongoQueryConditions }
description

Query configuration object that is intended to separate Mongo query configuration from sorting and pagination (cursor) logic using native types.

This class may be used to create custom search queries that can be executed againt a running Mongo service.

since

v0.1.0

Type declaration

SocialPlatformsMap: {}
label

COMMON

description

App share configuration object.

link

SocialPlatformsMap

since

v0.3.0

Type declaration

StateData: Record<string, any> | any
description

A type that represents data about the state of a module or scheduler.

since

v0.1.0

StateDocument: State & Documentable
description

This type is used to interface entities of the states collection with mongoose and permits to instanciate objects representing these entities.

e.g. alongside StateSchema, we also define StateDocument which is a mixin that comprises of State and this Documentable class.

In class Queryable, the first generic accepted permits to use documents that are typed with this, to filter results in a documents query.

since

v0.3.0

StatisticsDataType: ObjectLiteral | UserStatisticsFields
description

This type defines a type that is used for the column with name data in Statistics.

since

v0.5.0

StatisticsDocument: Statistics & Documentable
description

This type is used to interface entities of the statistics collection with mongoose and permits to instanciate objects representing these entities.

e.g. alongside StatisticsSchema, we also define StatisticsDocument which is a mixin that comprises of Statistics and this Documentable class.

In class Queryable, the first generic accepted permits to use documents that are typed with this, to filter results in a documents query.

since

v0.3.2

TransactionDocument: Transaction & Documentable
description

This type is used to interface entities of the transactions collection with mongoose and permits to instanciate objects representing these entities.

e.g. alongside TransactionSchema, we also define TransactionDocument which is a mixin that comprises of Transaction and this Documentable class.

In class Queryable, the first generic accepted permits to use documents that are typed with this, to filter results in a documents query.

since

v0.3.0

UnknownFieldValue: boolean | number | string | any[] | null | any
description

A type that represents data that is largely typed and thereby unsafe. This type is used internally before type-casting the mongo query conditions using MongoQueryConditions.

since

v0.3.2

UnsafeQueryConditions: {}
description

A type that represents data that is largely typed and thereby unsafe, formatted into a query condition format. This type is used internally before type-casting the mongo query conditions using MongoQueryConditions.

since

v0.3.2

Type declaration

WebsocketConsumerMap: {}
description

Contains a labelled map of connected websocket clients. The value always contains a connected Socket instance that is used to interact with UDP datagram sockets.

since

v0.6.0

Type declaration

  • [id: string]: any

Variables

AccountIntegrationSchema: Schema<AccountIntegration, Model<AccountIntegration, any, any, any, any>, {}, {}, {}, {}, "type", AccountIntegration> = ...
export

AccountIntegrationSchema

description

This export creates a mongoose schema using the custom AccountIntegration class and should be used mainly when inferring the type of fields in a document for the corresponding collection.

since

v0.3.0

AccountSchema: Schema<Account, Model<Account, any, any, any, any>, {}, {}, {}, {}, "type", Account> = ...
export

AccountSchema

description

This export creates a mongoose schema using the custom Account class and should be used mainly when inferring the type of fields in a document for the corresponding collection.

since

v0.3.0

AccountSessionSchema: Schema<AccountSession, Model<AccountSession, any, any, any, any>, {}, {}, {}, {}, "type", AccountSession> = ...
export

AccountSessionSchema

description

This export creates a mongoose schema using the custom AccountSession class and should be used mainly when inferring the type of fields in a document for the corresponding collection.

since

v0.3.2

ActivityDataSchema: Schema<ActivityData, Model<ActivityData, any, any, any, any>, {}, {}, {}, {}, "type", ActivityData> = ...
export

ActivityDataSchema

description

This export creates a mongoose schema using the custom ActivityData class and should be used mainly when inferring the type of fields in a document for the corresponding collection.

since

v0.3.0

ActivitySchema: Schema<Activity, Model<Activity, any, any, any, any>, {}, {}, {}, {}, "type", Activity> = ...
export

ActivitySchema

description

This export creates a mongoose schema using the custom Activity class and should be used mainly when inferring the type of fields in a document for the corresponding collection.

since

v0.3.0

AssetSchema: Schema<Asset, Model<Asset, any, any, any, any>, {}, {}, {}, {}, "type", Asset> = ...
export

AssetSchema

description

This export creates a mongoose schema using the custom Asset class and should be used mainly when inferring the type of fields in a document for the corresponding collection.

since

v0.3.0

AuthChallengeSchema: Schema<AuthChallenge, Model<AuthChallenge, any, any, any, any>, {}, {}, {}, {}, "type", AuthChallenge> = ...
export

AuthChallengeSchema

description

This export creates a mongoose schema using the custom AuthChallenge class and should be used mainly when inferring the type of fields in a document for the corresponding collection.

since

v0.3.0

BlockSchema: Schema<Block, Model<Block, any, any, any, any>, {}, {}, {}, {}, "type", Block> = ...
export

BlockSchema

description

This export creates a mongoose schema using the custom Block class and should be used mainly when inferring the type of fields in a document for the corresponding collection.

since

v0.3.0

LogSchema: Schema<Log, Model<Log, any, any, any, any>, {}, {}, {}, {}, "type", Log> = ...
export

LogSchema

description

This export creates a mongoose schema using the custom Log class and should be used mainly when inferring the type of fields in a document for the corresponding collection.

since

v0.3.2

OperationSchema: Schema<Operation, Model<Operation, any, any, any, any>, {}, {}, {}, {}, "type", Operation> = ...
export

OperationSchema

description

This export creates a mongoose schema using the custom Operation class and should be used mainly when inferring the type of fields in a document for the corresponding collection.

since

v0.3.0

PayoutSchema: Schema<Payout, Model<Payout, any, any, any, any>, {}, {}, {}, {}, "type", Payout> = ...
export

PayoutSchema

description

This export creates a mongoose schema using the custom Activity class and should be used mainly when inferring the type of fields in a document for the corresponding collection.

since

v0.4.0

Schedulers: {} = ...
label

COMMON

description

This exported constant enumerates all available scheduler modules. Schedulers are opt-in through the scopes field value of a dApp's configuration files (config/dapp.json). Schedulers always belong to and are registered through a scoped module, i.e. "discovery" defines some schedulers and "payout" may define more schedulers.

Note that the database password is intentionally read only from environment variables and is not added to the configuration to reduce potential leaks.

Schedulers that are currently available are represented in the following information table:

Scope Scheduler Description
discovery DiscoverTransactions A discovery command that retrieves transactions information from the network.
discovery DiscoverAccounts A discovery command that retrieves accounts information from the database using discovered transactions.
discovery DiscoverAssets A discovery command that retrieves assets information from the database using discovered transactions.
discovery DiscoverBlocks A discovery command that retrieves blocks information from the network using discovered transactions.
processor ProcessOperations A processor command that interprets discovered transactions and maps them to dApp operations.
payout PrepareActivityPayouts A payout command that prepares activity reward transactions and signs them such that they can be broadcast to dHealth Network.
payout PrepareBoost5Payouts A payout command that prepares booster reward (BOOST 5%) transactions and signs them such that they can be broadcast to dHealth Network.
payout PrepareBoost10Payouts A payout command that prepares booster reward (BOOST 10%) transactions and signs them such that they can be broadcast to dHealth Network.
payout PrepareBoost15Payouts A payout command that prepares booster reward (BOOST 15%) transactions and signs them such that they can be broadcast to dHealth Network.
payout BroadcastActivityPayouts A payout command that broadcasts activity reward transactions to dHealth Network.
payout BroadcastBoosterPayouts A payout command that broadcasts booster rewards (BOOST 5%, 10%, 15%) transactions to dHealth Network.
statistics LeaderboardAggregation A statistics command that aggregates and sorts user rewards for activities and creates leaderboards.
statistics UserAggregation A statistics command that aggregates and sorts user rewards for activities and creates user statistics.
statistics {@link UserTopActivities} A statistics command that aggregates and sorts user's top activities and updates user statistics entries.
notifier ReportNotifierCommand A notifier command that aggregates and sorts persisted warn/error logs and periodically creates and send reports.


var

{[key: string]: any[]}

since

v0.1.0

Type declaration

  • [key: string]: any[]
Scopes: {} = ...
label

COMMON

description

This exported constant enumerates all available scoped modules. Scopes are opt-in and only enabled if they are present in a dApp's configuration files (config/dapp.json).

Note that the database password is intentionally read only from environment variables and is not added to the configuration to reduce potential leaks.

Scopes that are currently available are represented in the following information table:

Scope Reference Description
database {@link MongooseModule} A database scope that consists in a connection adapter for the mongo database background process.
discovery DiscoveryModule A state discovery scope that consists in caching data and reading operations using network nodes.
payout PayoutModule A payout scope that encapsulates payout mechanisms that are executed in background processes.
processor ProcessorModule A processing scope that consists in detecting invoice updates and processing payments.
statistics StatisticsModule A statistics scope that consists in aggregate data into meaningful statistics and measurements.
notifier NotifierModule A notifier scope that consists in aggregate monitoring logs into meaningful alerts and reports.
oauth OAuthModule A oauth scope that consists in enabling OAuth data providers (e.g. Strava) and web hooks capabilities.
users UsersModule A user scope that consists in defining specific user profile information such as Activities data for Strava.


A scheduler scope is also included with WorkerModule but
this one executes in a parallel process and thereby should not be
imported here.
<br /
var

{[key: string]: AbstractAppModule}

since

v0.1.0

Type declaration

StateSchema: Schema<State, Model<State, any, any, any, any>, {}, {}, {}, {}, "type", State> = ...
export

StateSchema

description

This export creates a mongoose schema using the custom State class and should be used mainly when inferring the type of fields in a document for the corresponding collection.

since

v0.2.0

StatisticsSchema: Schema<Statistics, Model<Statistics, any, any, any, any>, {}, {}, {}, {}, "type", Statistics> = ...
export

StatisticsSchema

description

This export creates a mongoose schema using the custom Statistics class and should be used mainly when inferring the type of fields in a document for the corresponding collection.

since

v0.3.2

TransactionSchema: Schema<Transaction, Model<Transaction, any, any, any, any>, {}, {}, {}, {}, "type", Transaction> = ...
export

TransactionSchema

description

This export creates a mongoose schema using the custom Transaction class and should be used mainly when inferring the type of fields in a document for the corresponding collection.

since

v0.2.0

Functions

  • getOperation(plainMessage: string | PlainMessage): Contract
  • function

    getOperation

    description

    This helper function parses a transfer transaction message into an operation, a.k.a "a contract".

    For purposes of backwards compatibility, this function permits to parse Health2Earn v0 messages as well and maps them to the elevate:earn operation.

    Note that this method will return null given a plain message that cannot be parsed into a contracts object.

    Parameters

    • plainMessage: string | PlainMessage

      The contract's JSON payload.

    Returns Contract

  • getOperationType(plainMessage: string | PlainMessage): string
  • function

    getOperationType

    description

    This helper function parses a transfer transaction message into an operation type, a.k.a "a contract identifier".

    For purposes of backwards compatibility, this function permits to parse Health2Earn v0 messages as well and maps them to the elevate:earn operation type.

    Note that this method will return "elevate:base" given a plain message that cannot be parsed into a contracts object.

    since

    v0.3.0

    Parameters

    • plainMessage: string | PlainMessage

      The contract's JSON payload.

    Returns string

Generated using TypeDoc