The factory of the module, i.e. its including namespace
Module's [[Cache | cache]], usually initialized at module construction (except if one is provided at construction).
The module's static configuration.
See [[ModuleConfiguration]] for a discussion about static vs dynamic configuration.
Output pipe of the module: convey a YouWol's drive
Environment, used to:
A dictionary of helping objects (often functions) that can be used when writing an [[Adaptor | adaptor]] for the module.
the list of inputSlots, those have to be registered at module's construction.
🤓 The number of inputs, and what they do, can depend on the module's configuration
The list of available [[Journal | journals]].
This includes:
❕ Only the latest Journal for a particular [[Journal.title]] attribute is kept in memory.
The channels of logs broadcasting, by default:
Observable that emits the [[Log | logs]] of the module.
module id, if not provided explicitly at construction it is a [[uuidv4]]
the list of inputSlots, those have to be registered at module's construction.
🤓 The number of outputs, and what they do, can depend on the module's configuration
Add an input to the module.
The [[contract]]: defines pre-conditions and data normalization in order to reach the triggered process
description of the process triggered by the input when incoming data comes in. If not provided, 'no description available' is used.
id - usually a meaningful name that is not shared with other inputs/outputs. If not provided, 'input' is used.
❕ if multiple inputs are added you need to provide an id to them
The callback triggered when a message reach the input
Add/update a journal record (only one journal for a specific title is stored).
the [[Context | context]] entry point of the journal
title of the journal
The method addOutput declares a new output for the module and return a handle ([[Pipe]]) to emit value at any time.
An output is usually used in such way:
export class Module extends ModuleFlux {
result$ : Pipe<number>
constructor( params ){
super(params)
this.addInput({
id:'input',
description: 'trigger an operation between 2 numbers',
contract: expectCount<number>( {count:2, when:permissiveNumber}),
onTriggered: ({data, configuration, context}) =>
this.do(data, configuration, context)
})
this.result$ = this.addOutput({id:'result'})
}
do( data: [number, number], configuration: PersistentData, context: Context ) {
let result = operationsFactory[configuration.operationType](data)
context.info('Computation done', {result})
this.result$.next({data:result,context})
}
}
Couple of comments:
id - usually a meaningful name that is not share with other inputs/outputs. If not provided 'output' is used.
A pipe that allows to emit data
the slot id
Matching input slot; undefined if not found
the slot id
Matching output slot; undefined if not found
This function return the default PersistentData of the module. The default data can be updated at run time: the updated version is then provided to the 'onTriggered' callback defined in addInput method.
Default persistent data
the slot id
Matching input or output slot; undefined if not found
Log a message with data in the 'console' ('console' is exposed in the [[IEnvironment | environment]]).
Generated using TypeDoc
Abstract
The YouWol's drive module is used to access your resources loaded in YouWol, it points to an exposed folder (see PersistentData)
Typical use-cases include the ability of your application to read/write data to your YouWol workspace. Typical downstream modules can be the modules included in the flux-files module-box.
A couple examples of flux applications can be found here.
Inputs/Outputs
The module features one output: it is emitting the drive entity. The drive allow to access the data in your workpsace under group/drive_name where group and drive_name are the property defined in PersistentData.
Helpers
Some [[ModuleYouwolDrive.helpers]] functions are provided to use within an adaptor.