@comunica/types
Advanced tools
Comparing version 2.5.1-alpha.34.0 to 2.5.1-alpha.35.0
@@ -7,2 +7,5 @@ import type * as RDF from '@rdfjs/types'; | ||
export interface IMetadata<OrderItemsType extends RDF.Variable | RDF.QuadTermName> extends Record<string, any> { | ||
/** | ||
* The validity state of this metadata object. | ||
*/ | ||
state: IMetadataValidationState; | ||
@@ -66,6 +69,27 @@ /** | ||
}; | ||
/** | ||
* Represents the validity of a metadata object. | ||
*/ | ||
export interface IMetadataValidationState { | ||
/** | ||
* If the metadata object is valid. | ||
* | ||
* If it is invalid, the metadata values should be considered outdated, and a new version should be requested. | ||
*/ | ||
valid: boolean; | ||
/** | ||
* Mark the metadta object as invalid. | ||
* | ||
* This will set the `valid` field to false, and invoke the invalidation listeners. | ||
*/ | ||
invalidate: () => void; | ||
/** | ||
* Add an listener that will be invoked when the metadata object becomes invalid. | ||
* | ||
* No expensive operations should be done in these listeners, only other invalidations. | ||
* If other operations should be done, those should be scheduled in next ticks. | ||
* | ||
* @param listener An invalidation listener. | ||
*/ | ||
addInvalidateListener: (listener: () => void) => void; | ||
} |
@@ -23,7 +23,14 @@ import type * as RDF from '@rdfjs/types'; | ||
* Callback that returns a promise that resolves to the metadata about the stream. | ||
* | ||
* This can contain things like the estimated number of total stream elements, | ||
* or the order in which the bindings appear. | ||
* | ||
* This callback can be invoked multiple times. | ||
* The actors that return this metadata will make sure that multiple calls properly cache this promise. | ||
* Each invocation can return a different metadata object, | ||
* if the previous one would have become invalidated (see `metadata.state`). | ||
* The actors that return this metadata will make sure that multiple calls properly cache this promise, | ||
* and that the cached object is properly invalidated if needed. | ||
* Metadata will not be collected until this callback is invoked. | ||
* | ||
* This callback should resolve quickly, so it is safe to call and immediately `await` it. | ||
*/ | ||
@@ -30,0 +37,0 @@ metadata: () => Promise<M>; |
{ | ||
"name": "@comunica/types", | ||
"version": "2.5.1-alpha.34.0", | ||
"version": "2.5.1-alpha.35.0", | ||
"description": "Typings module for Comunica", | ||
@@ -46,3 +46,3 @@ "lsd:module": true, | ||
}, | ||
"gitHead": "aca2c85618e066a032d7e97202c86fb033b15b3d" | ||
"gitHead": "52b989a4d9701913cf529831876074a873afe501" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
97432
640