Members
(constant) DualEditor
The editor which is used to create the annotation. Supports formatting.
(constant) FileSyncHelper
Hacky workaround to avoid to many uppy instances to be spawned and to avoid having dynamic uploadHandler functions by using a static processRequest function.
- Source:
(constant) capitalizeFirstLetter
(constant) careType :Uint8Array
initialStructureStore = Automerge.change(initialStructureStore, { message: "Add care type table", }, doc => { const convertToInput = (value) => ({ input: { signature: MD5(value), value } }); doc.formState.care_type = { [uuidv1()]: { category: convertToInput("Huishoudelijke hulp"), care_zin: convertToInput(false), care_pgb: convertToInput(false) }, [uuidv1({ nsecs: 100})]: { category: convertToInput("Begeleiding individueel - licht"), care_zin: convertToInput(false), care_pgb: convertToInput(false) }, [uuidv1({ nsecs: 200})]: { category: convertToInput("Begeleiding individueel - middel"), care_zin: convertToInput(false), care_pgb: convertToInput(false) }, [uuidv1({ nsecs: 300})]: { category: convertToInput("Begeleiding individueel - zwaar"), care_zin: convertToInput(false), care_pgb: convertToInput(false) }, [uuidv1({ nsecs: 400})]: { category: convertToInput("Begeleiding individueel - zwaar casusregie"), care_zin: convertToInput(false), care_pgb: convertToInput(false) }, [uuidv1({ nsecs: 500})]: { category: convertToInput("Begeleiding groep"), care_zin: convertToInput(false), care_pgb: convertToInput(false) }, [uuidv1({ nsecs: 600})]: { category: convertToInput("Dagbesteding en dagopvang - licht"), care_zin: convertToInput(false), care_pgb: convertToInput(false) }, [uuidv1({ nsecs: 700})]: { category: convertToInput("Dagbesteding en dagopvang - middel"), care_zin: convertToInput(false), care_pgb: convertToInput(false) }, [uuidv1({ nsecs: 800})]: { category: convertToInput("Dagbesteding en dagopvang - zwaar"), care_zin: convertToInput(false), care_pgb: convertToInput(false) }, [uuidv1({ nsecs: 900})]: { category: convertToInput("Beschermd wonen"), care_zin: convertToInput(false), care_pgb: convertToInput(false) }, [uuidv1({ nsecs: 950})]: { category: convertToInput("Vervoer"), care_zin: convertToInput(false), care_pgb: convertToInput(false) }, [uuidv1({ nsecs: 960})]: { category: convertToInput("Hulpmiddelen"), care_zin: convertToInput(false), care_pgb: convertToInput(false) }, [uuidv1({ nsecs: 970})]: { category: convertToInput("Persoonlijke verzorging"), care_zin: convertToInput(false), care_pgb: convertToInput(false) }, [uuidv1({ nsecs: 980})]: { category: convertToInput("Overig maatwerk"), care_zin: convertToInput(false), care_pgb: convertToInput(false) }, [uuidv1({ nsecs: 990})]: { category: convertToInput("Overige ondersteuning individueel"), care_zin: convertToInput(false), care_pgb: convertToInput(false) }, [uuidv1({ nsecs: 1000})]: { category: convertToInput("Andere categorie"), care_zin: convertToInput(false), care_pgb: convertToInput(false)} }; });
Type:
- Uint8Array
- Source:
(constant) careTypeJeugdwet
Date added: 31 Aug 2023 - +-2PM
- Source:
(constant) changeCareTypeCategoryMiddelToMidden
Date added: 8 Feb 2023 - +-10AM let initialStructureStore = Automerge.applyChanges(Automerge.init(), [initialStructure, careType, staffMembersTable2022])[0]; initialStructureStore = Automerge.change(initialStructureStore, { message: "Change within the care type table with categories ending with 'middel' to 'midden'", }, doc => { // Assuming care_type is already set by the initialStructureStore patch const convertToInput = (value) => ({ input: { signature: MD5(value), value } }); // Avoiding working with proxies. const currentDoc = Automerge.toJS(doc); Object.entries(currentDoc.formState.care_type).filter(([, { category } = {}]) => category.input.value.endsWith("middel")).forEach(([k, { category }]) => { const newValue = convertToInput(category.input.value.replace("middel", "midden")); doc.formState.care_type[k].category.input.value = newValue.input.value; doc.formState.care_type[k].category.input.signature = newValue.input.signature; }); });
- Source:
(constant) createOnlineStatusMachine
- Source:
(constant) initialStructure :Uint8Array
Add the following patch: doc.declaration = {}; doc.formState = {}; doc.version = '2023-01-05#1';
Type:
- Uint8Array
- Source:
(constant) nissewaardWmoCareTypes
Date added: 6 Sept 2023 - +- 11AM
- Source:
(constant) nothing :symbol
Symbol to hash undefined values, equivalent to 'nothing' of the immer package.
Type:
- symbol
- Source:
(constant) staffMembersTable2022 :Uint8Array
initialStructureStore = Automerge.change(initialStructureStore, { message: "Add staff members table for the year 2022", }, doc => { const convertToInput = (value) => ({ input: { value } }); doc.formState.staff_members = Object.fromEntries(Array.from({ length: 12 }, (_, i) => [[format(new Date(2022, i, 1), "yyyy-MM")], [{ num_employees: convertToInput(0), num_fte: convertToInput(0), num_pnil: 0}]])); });
Type:
- Uint8Array
- Source:
(constant) v1UuidSort
Sort two uuidv1 uuid's.
- Source:
- See:
Methods
Store()
Store returning a CRDT document by using automerge. Singleton pattern is used, as automerge does not support multiple pointers to an object.
- Source:
addIdGetter(obj) → {*}
Add getter functionality for id, to enable both a function call as a getter.
Parameters:
| Name | Type | Description |
|---|---|---|
obj |
Returns:
- Type
- *
dangerousDismountStore()
Remove internal subscriptions of store to free-up as much memory as possible for garbage collection.
- Source:
elementMachine(formStateStore$, updateStore, formStateReferenceId, eventCreatorsopt, saveModeopt, machineIdopt) → {object}
Element machine
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
formStateStore$ |
Observer | Observer to the store containing the form state. |
||
updateStore |
function | Function to update the store |
||
formStateReferenceId |
string | Reference id, referring to a specific item within the form state store. |
||
eventCreators |
Object |
<optional> |
Object containing the event creators to submit an event. |
|
saveMode |
"onDebouncedInput" | "none" | "onBlur" | "onBlurAndInactivity" |
<optional> |
onDebouncedInput | |
machineId |
string |
<optional> |
Alternative name for the machine itself, not being used for any other id reference. |
- Source:
Returns:
Element machine in xstate object.
- Type
- object
exportStore() → {Uint8Array}
Export store to be synced remotely.
- Source:
Returns:
Store in serializable format.
- Type
- Uint8Array
forceStoreUpdateSignal()
Force all store value and header observers to signal the store its value. Do not use this by default, as it might trigger a lot of subscribers. Useful for edge cases, e.g. a modal containing a store but only want to sync it after specific conditions have met (and therefore having 'late' sync subscribers).
- Source:
getChanges(changeEncodingopt) → {Array.<Array.<number>>|Array.<Change>}
Get all changes since {heads}
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
|
||||
changeEncoding |
"Uint8Array" | "array" |
<optional> |
"Uint8Array" | By default Automerge spits out Uint8Array formatted changes, but those are converted to objects by JSON.stringify. When "array" is used, the type is removed. |
- Source:
Returns:
- Type
- Array.<Array.<number>> | Array.<Change>
getHeads()
Get current heads of the store, including an observable.
- Source:
Returns:
getStore()
Get the store observers and update function.
- Source:
Returns:
getStoreSyncHelper(type, id, optsopt)
Parameters:
| Name | Type | Attributes | Default | Description | |||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
type |
|||||||||||||||||||||||||||||
id |
|||||||||||||||||||||||||||||
opts |
Object |
<optional> |
{} |
Properties
|
- Source:
Returns:
Object
getUploadDate(filePathopt, fileIdopt) → {string|null}
Provide either the fileId or filePath and the upload date is provided.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
filePath |
string |
<optional> |
|
fileId |
string |
<optional> |
- Source:
Returns:
Null if no upload date could be found, otherwise formatted date.
- Type
- string | null
initiate(activateObserveropt, submitInitialStoreToPipeopt)
Initiate the document store (automerge) for a form. If already initiated, only the return value is sent back.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
|
||||
activateObserver |
boolean |
<optional> |
true | If set to true, the returned store pipe will be active (and therefore when submitInitialStoreToPipe = true a value). |
submitInitialStoreToPipe |
boolean |
<optional> |
false | If set to true, the returned store pipe will have the initial store. Not advised to set to true if document is expected to have edits! |
- Source:
Returns:
mergeStore(doc, storeHeadsCallbackopt)
Merge external changes (possibly from others) with the current store.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
doc |
object | Automerge document |
|
storeHeadsCallback |
function |
<optional> |
Provide a callback function to retrieve the heads of the merged store (getHeads()) before signaling the observer. |
- Source:
Returns:
rawUpdateStoreValue(callback, message) → {Promise.<void>}
Update the store value without any checks. Only call this function if you really know what you're doing
Parameters:
| Name | Type | Description |
|---|---|---|
callback |
function | Function that executes the inner change Automerge function. |
message |
string | Message or JSON object |
- Source:
Returns:
- Type
- Promise.<void>
smartValueCompare(elementMaintainsOwnActiveState) → {boolean}
Compare the smart value and check if the value changed.
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
elementMaintainsOwnActiveState |
boolean | false | If true entered value changes by the user do not result into a re-render (making the element during the user input passive) |
|
|||
|
- Source:
Returns:
True if not changed.
- Type
- boolean
smartValueSelector(state)
Retrieving the entered value when the user is focused/changing the element field, otherwise showing the value instead.
Parameters:
| Name | Type | Description |
|---|---|---|
state |
object | Element machine state. |
- Source:
Returns:
updateInfo(rawDynamoDBObject, awaitResultopt) → {Promise.<Object>|void}
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
rawDynamoDBObject |
||||
awaitResult |
boolean |
<optional> |
false | If true, wait for the result to return |
- Source:
Returns:
- Type
- Promise.<Object> | void
updateMetaData(metaData, metaDataOptionsopt) → {Promise.<void>}
Update metadata
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
metaData |
object | New meta data |
|
metaDataOptions |
object |
<optional> |
Options |
- Source:
Returns:
- Type
- Promise.<void>
updateStoreValue(ref, value, weightopt, optionsopt)
Update a path within the store.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
ref |
string | Path notated like 'someObj.foo[bar]' |
||
value |
* | Any value that must be inserted within the path. |
||
weight |
number |
<optional> |
0 | Optional patch weight |
options |
object |
<optional> |
- Source:
useApplicationFont() → {unknown}
Modals are mounted outside the next.js app div. Use this context to retrieve the font. Use the 'variable' key for TailwindCSS usage.
- Source:
Returns:
- Type
- unknown
useStoreValues() → {unknown}
Modals are mounted outside the next.js app div. Use this context to retrieve the font. Use the 'variable' key for TailwindCSS usage.
- Source:
Returns:
- Type
- unknown
withCentralSyncStore(Component)
Add a modal showing "no internet connection" when the component is mounted and the user is not online
Parameters:
| Name | Type | Description |
|---|---|---|
Component |
Returns:
withCloneStore(Component)
Parameters:
| Name | Type | Description |
|---|---|---|
Component |
- Source:
Returns:
withDateConverter(Component)
Converts a date into YYYY-MM-DD
Parameters:
| Name | Type | Description |
|---|---|---|
Component |
- Source:
Returns:
withElementMachine(Component, optionsopt)
Wrap an element service (through an element machine) around any element.
Parameters:
| Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Component |
JSXElement | React component. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
options |
object |
<optional> |
Options to tweak the element machine. Properties
|
- Source:
Returns:
withOnlineNotifier(Component)
Add a modal showing "no internet connection" when the component is mounted and the user is not online
Parameters:
| Name | Type | Description |
|---|---|---|
Component |
- Source:
Returns:
withReadOnlyWhenNeeded(Component, enforceReadOnlyTillStoreIsInitializedopt)
Enforce machined elements to be read-only if a declaration was submitted, the store was not loaded yet or the viewer has no edit rights
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
Component |
||||
enforceReadOnlyTillStoreIsInitialized |
boolean |
<optional> |
true | True: make all items read-only until the store is initialized, ensuring no quick clicks can alter a view that deviates from 'reality' |
Returns:
withStore(Component)
Parameters:
| Name | Type | Description |
|---|---|---|
Component |
- Source:
Returns:
withVersionNotifier(Component)
Add a modal showing "no internet connection" when the component is mounted and the user is not online
Parameters:
| Name | Type | Description |
|---|---|---|
Component |
- Source: