@magnetarjs/core
Advanced tools
Comparing version 0.0.13 to 0.0.14
{ | ||
"name": "@magnetarjs/core", | ||
"version": "0.0.13", | ||
"version": "0.0.14", | ||
"sideEffects": false, | ||
@@ -69,3 +69,3 @@ "description": "Magnetar core library.", | ||
}, | ||
"gitHead": "b1ed1387f9aa3c2fc3867d2df619d029503a193b" | ||
"gitHead": "070cf44ea57eb0581d5a90431cd354ec310ba4fa" | ||
} |
@@ -6,3 +6,3 @@ import { DocMetadata } from './atoms' | ||
*/ | ||
export type OnAddedFn = (docData: Record<string, any>, docMetadata: DocMetadata) => Record<string, any> | void //prettier-ignore | ||
export type OnAddedFn = (docData: Record<string, any> | undefined, docMetadata: DocMetadata) => Record<string, any> | void //prettier-ignore | ||
@@ -12,3 +12,3 @@ /** | ||
*/ | ||
export type OnModifiedFn = (docData: Record<string, any>, docMetadata: DocMetadata) => Record<string, any> | void //prettier-ignore | ||
export type OnModifiedFn = (docData: Record<string, any> | undefined, docMetadata: DocMetadata) => Record<string, any> | void //prettier-ignore | ||
@@ -18,3 +18,3 @@ /** | ||
*/ | ||
export type OnRemovedFn = (docData: Record<string, any> | string, docMetadata: DocMetadata) => Record<string, any> | string | void //prettier-ignore | ||
export type OnRemovedFn = (docData: Record<string, any> | string | undefined, docMetadata: DocMetadata) => Record<string, any> | string | void //prettier-ignore | ||
@@ -21,0 +21,0 @@ /** |
@@ -217,11 +217,20 @@ import { O } from 'ts-toolbelt' | ||
/** | ||
* 'added' is/should be triggered per document on 3 occasions: on 'fetch' when a document is read; on 'stream' when initial documents are read; on 'stream' when there are consequent insertions of documents on the end-point. | ||
* 'added' will/should be triggered per document on 3 occasions: on 'fetch' when a document is read; on 'stream' when initial documents are read; on 'stream' when there are consequent insertions of documents on the end-point. | ||
* | ||
* As local store plugin this should be a function that covers the logic to save the payload to the local state. | ||
* As remote store plugin this is what must be executed during the events. | ||
*/ | ||
added?: OnAddedFn | ||
/** | ||
* 'modified' is/should be triggered per document on 1 occasion: on 'stream' when a document that was already read through that stream once before is modified on the end-point. | ||
* 'modified' will/should be triggered per document on 1 occasion: on 'stream' when a document that was already read through that stream once before is modified on the end-point. | ||
* | ||
* As local store plugin this should be a function that covers the logic to update the payload in the local state. | ||
* As remote store plugin this is what must be executed during the events. | ||
*/ | ||
modified?: OnModifiedFn | ||
/** | ||
* 'removed' is/should be triggered per document on 2 occasions: on 'stream' when a document is "deleted" on the end-point; when a document doesn't adhere to the "stream clauses" any more. | ||
* 'removed' will/should be triggered per document on 2 occasions: on 'stream' when a document is "deleted" on the end-point; when a document doesn't adhere to the "stream clauses" any more. | ||
* | ||
* As local store plugin this should be a function that covers the logic to remove the payload from the local state. | ||
* As remote store plugin this is what must be executed during the events. | ||
*/ | ||
@@ -228,0 +237,0 @@ removed?: OnRemovedFn |
@@ -5,11 +5,11 @@ import { DocMetadata } from './atoms'; | ||
*/ | ||
export declare type OnAddedFn = (docData: Record<string, any>, docMetadata: DocMetadata) => Record<string, any> | void; | ||
export declare type OnAddedFn = (docData: Record<string, any> | undefined, docMetadata: DocMetadata) => Record<string, any> | void; | ||
/** | ||
* Is triggered only while a 'stream' is open, and can modify docs that were modified on another client, before they are updated to the store data. When returning `undefined` they will be discarded & the modifications won't be applied to the store data. | ||
*/ | ||
export declare type OnModifiedFn = (docData: Record<string, any>, docMetadata: DocMetadata) => Record<string, any> | void; | ||
export declare type OnModifiedFn = (docData: Record<string, any> | undefined, docMetadata: DocMetadata) => Record<string, any> | void; | ||
/** | ||
* Is triggered only while a 'stream' is open, every time a document is either 'deleted' on another client OR if a document doesn't adhere to the clauses of that 'stream' anymore. When returning `undefined` they will not be removed from the store data. | ||
*/ | ||
export declare type OnRemovedFn = (docData: Record<string, any> | string, docMetadata: DocMetadata) => Record<string, any> | string | void; | ||
export declare type OnRemovedFn = (docData: Record<string, any> | string | undefined, docMetadata: DocMetadata) => Record<string, any> | string | void; | ||
/** | ||
@@ -16,0 +16,0 @@ * These functions will be executed everytime BEFORE documents are added/modified/deleted in your local data store. The function defined will receive the payload with changes from the server. You can then modify and return this payload. |
@@ -157,11 +157,20 @@ import { O } from 'ts-toolbelt'; | ||
/** | ||
* 'added' is/should be triggered per document on 3 occasions: on 'fetch' when a document is read; on 'stream' when initial documents are read; on 'stream' when there are consequent insertions of documents on the end-point. | ||
* 'added' will/should be triggered per document on 3 occasions: on 'fetch' when a document is read; on 'stream' when initial documents are read; on 'stream' when there are consequent insertions of documents on the end-point. | ||
* | ||
* As local store plugin this should be a function that covers the logic to save the payload to the local state. | ||
* As remote store plugin this is what must be executed during the events. | ||
*/ | ||
added?: OnAddedFn; | ||
/** | ||
* 'modified' is/should be triggered per document on 1 occasion: on 'stream' when a document that was already read through that stream once before is modified on the end-point. | ||
* 'modified' will/should be triggered per document on 1 occasion: on 'stream' when a document that was already read through that stream once before is modified on the end-point. | ||
* | ||
* As local store plugin this should be a function that covers the logic to update the payload in the local state. | ||
* As remote store plugin this is what must be executed during the events. | ||
*/ | ||
modified?: OnModifiedFn; | ||
/** | ||
* 'removed' is/should be triggered per document on 2 occasions: on 'stream' when a document is "deleted" on the end-point; when a document doesn't adhere to the "stream clauses" any more. | ||
* 'removed' will/should be triggered per document on 2 occasions: on 'stream' when a document is "deleted" on the end-point; when a document doesn't adhere to the "stream clauses" any more. | ||
* | ||
* As local store plugin this should be a function that covers the logic to remove the payload from the local state. | ||
* As remote store plugin this is what must be executed during the events. | ||
*/ | ||
@@ -168,0 +177,0 @@ removed?: OnRemovedFn; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
242454
5472