🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@comunica/types

Package Overview
Dependencies
Maintainers
5
Versions
88
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@comunica/types - npm Package Compare versions

Comparing version
5.1.3
to
5.2.0
+1
-1
lib/ExpressionEvaluator.js.map

@@ -1,1 +0,1 @@

{"version":3,"file":"ExpressionEvaluator.js","sourceRoot":"","sources":["ExpressionEvaluator.ts"],"names":[],"mappings":";;;AAkFA,IAAY,cAMX;AAND,WAAY,cAAc;IACxB,yCAAuB,CAAA;IACvB,yCAAuB,CAAA;IACvB,uCAAqB,CAAA;IACrB,+BAAa,CAAA;IACb,uCAAqB,CAAA;AACvB,CAAC,EANW,cAAc,8BAAd,cAAc,QAMzB","sourcesContent":["import type { Algebra } from '@comunica/utils-algebra';\nimport type * as RDF from '@rdfjs/types';\nimport type { LRUCache } from 'lru-cache';\nimport type { ComunicaDataFactory } from './ComunicaDataFactory';\nimport type { IActionContext } from './IActionContext';\n\nexport interface ITimeZoneRepresentation {\n // https://www.w3.org/TR/xpath-functions/#func-implicit-timezone\n // Type is a dayTimeDuration.\n // We use a separate dataType since it makes TS type modifications and JS object copying easier.\n zoneHours: number;\n zoneMinutes: number;\n}\n\nexport interface IDateRepresentation extends Partial<ITimeZoneRepresentation> {\n year: number;\n month: number;\n day: number;\n}\n\nexport interface ITimeRepresentation extends Partial<ITimeZoneRepresentation> {\n hours: number;\n minutes: number;\n seconds: number;\n}\n\nexport interface IDayTimeDurationRepresentation {\n hours: number;\n minutes: number;\n seconds: number;\n day: number;\n}\n\nexport interface IYearMonthDurationRepresentation {\n year: number;\n month: number;\n}\n\nexport type IDurationRepresentation = IYearMonthDurationRepresentation & IDayTimeDurationRepresentation;\nexport type IDateTimeRepresentation = IDateRepresentation & ITimeRepresentation;\nexport type AsyncExtensionFunction = (args: RDF.Term[]) => Promise<RDF.Term>;\nexport type AsyncExtensionFunctionCreator = (functionNamedNode: RDF.NamedNode) =>\nPromise<AsyncExtensionFunction | undefined>;\n\n/**\n * The key 'term' is not included in these keys. Something that is just a term will map to number 0.\n */\nexport type GeneralSuperTypeDict = Record<string, number> & { __depth: number };\nexport type TypeCache = LRUCache<string, GeneralSuperTypeDict>;\nexport type SuperTypeCallback = (unknownType: string) => string;\n\nexport interface ISuperTypeProvider {\n cache: TypeCache;\n discoverer: SuperTypeCallback;\n}\n\n/**\n * An evaluator for RDF expressions.\n */\nexport interface IExpressionEvaluator extends IInternalEvaluator {\n /**\n * Evaluates the provided bindings in terms of the context the evaluator was created.\n * @param mapping the RDF bindings to evaluate against.\n */\n evaluate: (mapping: RDF.Bindings) => Promise<RDF.Term>;\n\n /**\n * Evaluates the provided bindings in terms of the context the evaluator was created,\n * returning the effective boolean value.\n * @param mapping the RDF bindings to evaluate against.\n */\n evaluateAsEBV: (mapping: RDF.Bindings) => Promise<boolean>;\n\n evaluateAsEvaluatorExpression: (mapping: RDF.Bindings) => Promise<TermExpression>;\n}\n\nexport interface IInternalEvaluator {\n evaluatorExpressionEvaluation: (expr: Expression, mapping: RDF.Bindings) => Promise<TermExpression>;\n\n context: IActionContext;\n}\n\nexport enum ExpressionType {\n Aggregate = 'aggregate',\n Existence = 'existence',\n Operator = 'operator',\n Term = 'term',\n Variable = 'variable',\n}\nexport type TermType = 'namedNode' | 'literal' | 'blankNode' | 'quad' | 'defaultGraph';\n\nexport type TermExpression = IExpressionProps & {\n expressionType: ExpressionType.Term;\n termType: TermType;\n str: () => string;\n coerceEBV: () => boolean;\n toRDF: (dataFactory: ComunicaDataFactory) => RDF.Term;\n};\n\nexport type Expression =\n AggregateExpression |\n ExistenceExpression |\n OperatorExpression |\n TermExpression |\n VariableExpression;\n\nexport interface IExpressionProps {\n expressionType: ExpressionType;\n}\n\nexport type AggregateExpression = IExpressionProps & {\n expressionType: ExpressionType.Aggregate;\n name: string;\n expression: Algebra.AggregateExpression;\n};\n\nexport type ExistenceExpression = IExpressionProps & {\n expressionType: ExpressionType.Existence;\n expression: Algebra.ExistenceExpression;\n};\n\nexport type OperatorExpression = IExpressionProps & {\n expressionType: ExpressionType.Operator;\n name: string;\n args: Expression[];\n apply: FunctionApplication;\n};\n\nexport type VariableExpression = IExpressionProps & {\n expressionType: ExpressionType.Variable;\n name: string;\n};\n\nexport type SimpleApplication = (args: TermExpression[]) => TermExpression;\nexport type SimpleApplicationTuple<T> = (args: T) => TermExpression;\n\nexport type FunctionApplication = (evalContext: IEvalContext) => Promise<TermExpression>;\n\nexport type ImplementationFunction = (expressionEvaluator: IInternalEvaluator) => SimpleApplication;\nexport type ImplementationFunctionTuple<T> = (expressionEvaluator: IInternalEvaluator) => SimpleApplicationTuple<T>;\n\nexport interface IFunctionArgumentsCacheObj {\n func?: ImplementationFunction;\n cache?: FunctionArgumentsCache;\n}\nexport type FunctionArgumentsCache = Record<string, IFunctionArgumentsCacheObj>;\n\nexport interface IEvalContext {\n args: Expression[];\n mapping: RDF.Bindings;\n exprEval: IInternalEvaluator;\n}\n"]}
{"version":3,"file":"ExpressionEvaluator.js","sourceRoot":"","sources":["ExpressionEvaluator.ts"],"names":[],"mappings":";;;AAkFA,IAAY,cAMX;AAND,WAAY,cAAc;IACxB,yCAAuB,CAAA;IACvB,yCAAuB,CAAA;IACvB,uCAAqB,CAAA;IACrB,+BAAa,CAAA;IACb,uCAAqB,CAAA;AACvB,CAAC,EANW,cAAc,8BAAd,cAAc,QAMzB","sourcesContent":["import type { Algebra } from '@comunica/utils-algebra';\nimport type * as RDF from '@rdfjs/types';\nimport type { LRUCache } from 'lru-cache';\nimport type { ComunicaDataFactory } from './ComunicaDataFactory';\nimport type { IActionContext } from './IActionContext';\n\nexport interface ITimeZoneRepresentation {\n // https://www.w3.org/TR/xpath-functions/#func-implicit-timezone\n // Type is a dayTimeDuration.\n // We use a separate dataType since it makes TS type modifications and JS object copying easier.\n zoneHours: number;\n zoneMinutes: number;\n}\n\nexport interface IDateRepresentation extends Partial<ITimeZoneRepresentation> {\n year: number;\n month: number;\n day: number;\n}\n\nexport interface ITimeRepresentation extends Partial<ITimeZoneRepresentation> {\n hours: number;\n minutes: number;\n seconds: number;\n}\n\nexport interface IDayTimeDurationRepresentation {\n hours: number;\n minutes: number;\n seconds: number;\n day: number;\n}\n\nexport interface IYearMonthDurationRepresentation {\n year: number;\n month: number;\n}\n\nexport type IDurationRepresentation = IYearMonthDurationRepresentation & IDayTimeDurationRepresentation;\nexport type IDateTimeRepresentation = IDateRepresentation & ITimeRepresentation;\nexport type AsyncExtensionFunction = (args: RDF.Term[]) => Promise<RDF.Term>;\nexport type AsyncExtensionFunctionCreator = (functionNamedNode: RDF.NamedNode) =>\nPromise<AsyncExtensionFunction | undefined>;\n\n/**\n * The key 'term' is not included in these keys. Something that is just a term will map to number 0.\n */\nexport type GeneralSuperTypeDict = Record<string, number> & { __depth: number };\nexport type TypeCache = LRUCache<string, GeneralSuperTypeDict>;\nexport type SuperTypeCallback = (unknownType: string) => string;\n\nexport interface ISuperTypeProvider {\n cache: TypeCache;\n discoverer: SuperTypeCallback;\n}\n\n/**\n * An evaluator for RDF expressions.\n */\nexport interface IExpressionEvaluator extends IInternalEvaluator {\n /**\n * Evaluates the provided bindings in terms of the context the evaluator was created.\n * @param mapping the RDF bindings to evaluate against.\n */\n evaluate: (mapping: RDF.Bindings) => Promise<RDF.Term>;\n\n /**\n * Evaluates the provided bindings in terms of the context the evaluator was created,\n * returning the effective boolean value.\n * @param mapping the RDF bindings to evaluate against.\n */\n evaluateAsEBV: (mapping: RDF.Bindings) => Promise<boolean>;\n\n evaluateAsEvaluatorExpression: (mapping: RDF.Bindings) => Promise<TermExpression>;\n}\n\nexport interface IInternalEvaluator {\n evaluatorExpressionEvaluation: (expr: Expression, mapping: RDF.Bindings) => Promise<TermExpression>;\n\n context: IActionContext;\n}\n\nexport enum ExpressionType {\n Aggregate = 'aggregate',\n Existence = 'existence',\n Operator = 'operator',\n Term = 'term',\n Variable = 'variable',\n}\n\n// TODO: next/major - edit these to reflect the RDFJS capitalization (and general typings?)\nexport type TermType = 'namedNode' | 'literal' | 'blankNode' | 'quad' | 'defaultGraph';\n\nexport type TermExpression = IExpressionProps & {\n expressionType: ExpressionType.Term;\n termType: TermType;\n str: () => string;\n coerceEBV: () => boolean;\n toRDF: (dataFactory: ComunicaDataFactory) => RDF.Term;\n};\n\nexport type Expression =\n AggregateExpression |\n ExistenceExpression |\n OperatorExpression |\n TermExpression |\n VariableExpression;\n\nexport interface IExpressionProps {\n expressionType: ExpressionType;\n}\n\nexport type AggregateExpression = IExpressionProps & {\n expressionType: ExpressionType.Aggregate;\n name: string;\n expression: Algebra.AggregateExpression;\n};\n\nexport type ExistenceExpression = IExpressionProps & {\n expressionType: ExpressionType.Existence;\n expression: Algebra.ExistenceExpression;\n};\n\nexport type OperatorExpression = IExpressionProps & {\n expressionType: ExpressionType.Operator;\n name: string;\n args: Expression[];\n apply: FunctionApplication;\n};\n\nexport type VariableExpression = IExpressionProps & {\n expressionType: ExpressionType.Variable;\n name: string;\n};\n\nexport type SimpleApplication = (args: TermExpression[]) => TermExpression;\nexport type SimpleApplicationTuple<T> = (args: T) => TermExpression;\n\nexport type FunctionApplication = (evalContext: IEvalContext) => Promise<TermExpression>;\n\nexport type ImplementationFunction = (expressionEvaluator: IInternalEvaluator) => SimpleApplication;\nexport type ImplementationFunctionTuple<T> = (expressionEvaluator: IInternalEvaluator) => SimpleApplicationTuple<T>;\n\nexport interface IFunctionArgumentsCacheObj {\n func?: ImplementationFunction;\n cache?: FunctionArgumentsCache;\n}\nexport type FunctionArgumentsCache = Record<string, IFunctionArgumentsCacheObj>;\n\nexport interface IEvalContext {\n args: Expression[];\n mapping: RDF.Bindings;\n exprEval: IInternalEvaluator;\n}\n"]}

@@ -38,2 +38,6 @@ import type * as RDF from '@rdfjs/types';

httpRetryStatusCodes?: number[];
httpRetryBodyCount?: number;
httpRetryBodyDelayFallback?: number;
httpRetryBodyAllowUnsafe?: boolean;
httpRetryBodyMaxBytes?: number;
httpAbortSignal?: AbortSignal;

@@ -40,0 +44,0 @@ httpCache?: boolean;

@@ -1,1 +0,1 @@

{"version":3,"file":"IQueryContext.js","sourceRoot":"","sources":["IQueryContext.ts"],"names":[],"mappings":"","sourcesContent":["import type * as RDF from '@rdfjs/types';\nimport type { ComunicaDataFactory } from './ComunicaDataFactory';\nimport type { FunctionArgumentsCache } from './ExpressionEvaluator';\nimport type { IDataDestination } from './IDataDestination';\nimport type { IProxyHandler } from './IProxyHandler';\nimport type { SourceType } from './IQueryEngine';\nimport type { QueryExplainMode } from './IQueryOperationResult';\nimport type { Logger } from './Logger';\n\n// We omit `& RDF.QuerySourceContext<SourceType>` in the following two types\n// as the QuerySourceContext proved to be too developer-unfriendly.\n\n/**\n * Query context when a string-based query was passed.\n */\nexport type QueryStringContext = RDF.QueryStringContext & IQueryContextCommon;\n/**\n * Query context when an algebra-based query was passed.\n */\nexport type QueryAlgebraContext = RDF.QueryAlgebraContext & IQueryContextCommon;\n\n/**\n * Common query context interface\n */\nexport interface IQueryContextCommon {\n // Types of these entries should be aligned with contextKeyShortcuts in ActorContextPreprocessConvertShortcuts,\n // Keys in @comunica/context-entries, and possibly the CliArgsHandlers in @comunica/actor-init-query.\n\n // Inherited from RDF.QueryStringContext: sources\n destination?: IDataDestination;\n initialBindings?: RDF.Bindings;\n // Inherited from RDF.QueryStringContext: queryFormat?: string;\n // Inherited from RDF.QueryStringContext: baseIRI?: string;\n fileBaseIRI?: string;\n log?: Logger;\n datetime?: Date;\n // Inherited from RDF.QueryStringContext: queryTimestamp?: Date;\n queryTimestampHighResolution?: DOMHighResTimeStamp;\n httpProxyHandler?: IProxyHandler;\n lenient?: boolean;\n parseUnsupportedVersions?: boolean;\n httpIncludeCredentials?: boolean;\n httpAuth?: string;\n httpTimeout?: number;\n httpBodyTimeout?: boolean;\n httpRetryCount?: number;\n httpRetryDelayFallback?: number;\n httpRetryDelayLimit?: number;\n httpRetryStatusCodes?: number[];\n httpAbortSignal?: AbortSignal;\n httpCache?: boolean;\n fetch?: typeof fetch;\n recoverBrokenLinks?: boolean;\n readOnly?: boolean;\n extensionFunctions?: Record<string, (args: RDF.Term[]) => Promise<RDF.Term>>;\n extensionFunctionsAlwaysPushdown?: boolean;\n extensionFunctionCreator?: (functionNamedNode: RDF.NamedNode)\n => ((args: RDF.Term[]) => Promise<RDF.Term>) | undefined;\n functionArgumentsCache?: FunctionArgumentsCache;\n explain?: QueryExplainMode;\n unionDefaultGraph?: boolean;\n traverse?: boolean;\n invalidateCache?: boolean;\n dataFactory?: ComunicaDataFactory;\n distinctConstruct?: boolean;\n rdfSerializationPrefixes?: Record<string, string>;\n\n sources: SourceType[];\n}\n"]}
{"version":3,"file":"IQueryContext.js","sourceRoot":"","sources":["IQueryContext.ts"],"names":[],"mappings":"","sourcesContent":["import type * as RDF from '@rdfjs/types';\nimport type { ComunicaDataFactory } from './ComunicaDataFactory';\nimport type { FunctionArgumentsCache } from './ExpressionEvaluator';\nimport type { IDataDestination } from './IDataDestination';\nimport type { IProxyHandler } from './IProxyHandler';\nimport type { SourceType } from './IQueryEngine';\nimport type { QueryExplainMode } from './IQueryOperationResult';\nimport type { Logger } from './Logger';\n\n// We omit `& RDF.QuerySourceContext<SourceType>` in the following two types\n// as the QuerySourceContext proved to be too developer-unfriendly.\n\n/**\n * Query context when a string-based query was passed.\n */\nexport type QueryStringContext = RDF.QueryStringContext & IQueryContextCommon;\n/**\n * Query context when an algebra-based query was passed.\n */\nexport type QueryAlgebraContext = RDF.QueryAlgebraContext & IQueryContextCommon;\n\n/**\n * Common query context interface\n */\nexport interface IQueryContextCommon {\n // Types of these entries should be aligned with contextKeyShortcuts in ActorContextPreprocessConvertShortcuts,\n // Keys in @comunica/context-entries, and possibly the CliArgsHandlers in @comunica/actor-init-query.\n\n // Inherited from RDF.QueryStringContext: sources\n destination?: IDataDestination;\n initialBindings?: RDF.Bindings;\n // Inherited from RDF.QueryStringContext: queryFormat?: string;\n // Inherited from RDF.QueryStringContext: baseIRI?: string;\n fileBaseIRI?: string;\n log?: Logger;\n datetime?: Date;\n // Inherited from RDF.QueryStringContext: queryTimestamp?: Date;\n queryTimestampHighResolution?: DOMHighResTimeStamp;\n httpProxyHandler?: IProxyHandler;\n lenient?: boolean;\n parseUnsupportedVersions?: boolean;\n httpIncludeCredentials?: boolean;\n httpAuth?: string;\n httpTimeout?: number;\n httpBodyTimeout?: boolean;\n httpRetryCount?: number;\n httpRetryDelayFallback?: number;\n httpRetryDelayLimit?: number;\n httpRetryStatusCodes?: number[];\n httpRetryBodyCount?: number;\n httpRetryBodyDelayFallback?: number;\n httpRetryBodyAllowUnsafe?: boolean;\n httpRetryBodyMaxBytes?: number;\n httpAbortSignal?: AbortSignal;\n httpCache?: boolean;\n fetch?: typeof fetch;\n recoverBrokenLinks?: boolean;\n readOnly?: boolean;\n extensionFunctions?: Record<string, (args: RDF.Term[]) => Promise<RDF.Term>>;\n extensionFunctionsAlwaysPushdown?: boolean;\n extensionFunctionCreator?: (functionNamedNode: RDF.NamedNode)\n => ((args: RDF.Term[]) => Promise<RDF.Term>) | undefined;\n functionArgumentsCache?: FunctionArgumentsCache;\n explain?: QueryExplainMode;\n unionDefaultGraph?: boolean;\n traverse?: boolean;\n invalidateCache?: boolean;\n dataFactory?: ComunicaDataFactory;\n distinctConstruct?: boolean;\n rdfSerializationPrefixes?: Record<string, string>;\n\n sources: SourceType[];\n}\n"]}

@@ -1,2 +0,2 @@

import type { Algebra } from '@comunica/utils-algebra';
import type { Algebra, TypesComunica } from '@comunica/utils-algebra';
import type * as RDF from '@rdfjs/types';

@@ -30,3 +30,12 @@ import type { AsyncIterator } from 'asynciterator';

}
export type QuerySourceUnidentifiedExpanded = IQuerySourceUnidentifiedExpanded | IQuerySourceSerialized;
/**
* A composite file source that combines multiple file URLs or sources into a single queryable source.
* All files are loaded and merged into one in-memory RDF store before querying.
*/
export interface IQuerySourceCompositeFile {
type: 'compositefile';
value: (string | IQuerySourceWrapper)[];
context?: IActionContext;
}
export type QuerySourceUnidentifiedExpanded = IQuerySourceUnidentifiedExpanded | IQuerySourceSerialized | IQuerySourceCompositeFile;
export type QuerySourceUnidentified = string | RDF.Source | RDF.Store | RDF.DatasetCore | QuerySourceUnidentifiedExpanded | IQuerySourceUnidentifiedExpandedRawContext | IQuerySourceTraverse;

@@ -157,3 +166,3 @@ /**

operationType: 'type';
type: Algebra.Types;
type: Algebra.Types | TypesComunica;
} | {

@@ -160,0 +169,0 @@ operationType: 'pattern';

@@ -1,1 +0,1 @@

{"version":3,"file":"IQuerySource.js","sourceRoot":"","sources":["IQuerySource.ts"],"names":[],"mappings":";;AAgPA,iDAAiD;AACjD,4BAA4B;AAC5B,gCAAgC;AAChC,4CAA4C;AAC5C,uBAAuB;AACvB,oGAAoG;AACpG,yBAAyB;AACzB,wBAAwB;AACxB,wBAAwB;AACxB,wBAAwB;AACxB,OAAO;AACP,KAAK;AACL,EAAE;AACF,4CAA4C;AAC5C,uBAAuB;AACvB,sHAAsH;AACtH,yBAAyB;AACzB,wBAAwB;AACxB,wBAAwB;AACxB,wBAAwB;AACxB,wBAAwB;AACxB,OAAO;AACP,KAAK;AACL,EAAE;AACF,8CAA8C;AAC9C,uBAAuB;AACvB,oGAAoG;AACpG,yBAAyB;AACzB,wBAAwB;AACxB,wBAAwB;AACxB,wBAAwB;AACxB,OAAO;AACP,uBAAuB;AACvB,KAAK;AACL,EAAE;AACF,iEAAiE;AACjE,yBAAyB;AACzB,gBAAgB;AAChB,QAAQ;AACR,2BAA2B;AAC3B,oDAAoD;AACpD,SAAS;AACT,QAAQ;AACR,2BAA2B;AAC3B,sDAAsD;AACtD,SAAS;AACT,QAAQ;AACR,2BAA2B;AAC3B,qDAAqD;AACrD,SAAS;AACT,QAAQ;AACR,2BAA2B;AAC3B,gDAAgD;AAChD,SAAS;AACT,QAAQ;AACR,2BAA2B;AAC3B,6DAA6D;AAC7D,SAAS;AACT,OAAO;AACP,KAAK;AACL,EAAE;AACF,yBAAyB;AACzB,6FAA6F;AAC7F,4CAA4C;AAC5C,uBAAuB;AACvB,4CAA4C;AAC5C,uBAAuB;AACvB,wBAAwB;AACxB,OAAO;AACP,gBAAgB;AAChB,QAAQ;AACR,uBAAuB;AACvB,gBAAgB;AAChB,uCAAuC;AACvC,iBAAiB;AACjB,6BAA6B;AAC7B,0GAA0G;AAC1G,+BAA+B;AAC/B,8BAA8B;AAC9B,8BAA8B;AAC9B,aAAa;AACb,WAAW;AACX,SAAS;AACT,OAAO;AACP,uBAAuB;AACvB,KAAK;AACL,EAAE;AACF,0BAA0B;AAC1B,eAAe;AACf,wDAAwD;AACxD,gDAAgD;AAChD,yBAAyB;AACzB,gBAAgB;AAChB,QAAQ;AACR,2BAA2B;AAC3B,wGAAwG;AACxG,6BAA6B;AAC7B,4BAA4B;AAC5B,4BAA4B;AAC5B,4BAA4B;AAC5B,WAAW;AACX,2BAA2B;AAC3B,SAAS;AACT,QAAQ;AACR,2BAA2B;AAC3B,gDAAgD;AAChD,oBAAoB;AACpB,YAAY;AACZ,2BAA2B;AAC3B,oBAAoB;AACpB,2CAA2C;AAC3C,qBAAqB;AACrB,iCAAiC;AACjC,8GAA8G;AAC9G,mCAAmC;AACnC,kCAAkC;AAClC,iBAAiB;AACjB,eAAe;AACf,aAAa;AACb,WAAW;AACX,SAAS;AACT,OAAO;AACP,KAAK","sourcesContent":["import type { Algebra } from '@comunica/utils-algebra';\nimport type * as RDF from '@rdfjs/types';\nimport type { AsyncIterator } from 'asynciterator';\nimport type { BindingsStream } from './Bindings';\nimport type { IActionContext } from './IActionContext';\nimport type { ILink } from './ILink';\nimport type { MetadataBindings } from './IMetadata';\n\nexport interface IQuerySourceSerialized extends IQuerySourceUnidentifiedExpanded {\n type?: 'serialized';\n value: string;\n mediaType: string;\n baseIRI?: string;\n version?: string;\n}\n\nexport interface IQuerySourceUnidentifiedExpanded {\n type?: string;\n value: string | RDF.Source | RDF.Store | RDF.DatasetCore;\n context?: IActionContext;\n}\n\nexport interface IQuerySourceUnidentifiedExpandedRawContext {\n type?: string;\n value: string | RDF.Source | RDF.Store | RDF.DatasetCore;\n context?: Record<string, any>;\n}\n\nexport interface IQuerySourceTraverse {\n type: 'traverse';\n value: ILink[];\n context?: IActionContext | Record<string, any>;\n}\n\nexport type QuerySourceUnidentifiedExpanded = IQuerySourceUnidentifiedExpanded | IQuerySourceSerialized;\nexport type QuerySourceUnidentified = string | RDF.Source | RDF.Store | RDF.DatasetCore |\nQuerySourceUnidentifiedExpanded | IQuerySourceUnidentifiedExpandedRawContext | IQuerySourceTraverse;\n\n/**\n * Attaches a context to a query target.\n */\nexport interface IQuerySourceWrapper<Q extends IQuerySource = IQuerySource> {\n source: Q;\n context?: IActionContext;\n}\n\nexport type QuerySourceReference = string | RDF.Source | RDF.DatasetCore;\n\n/**\n * A lazy query source.\n */\nexport interface IQuerySource {\n /**\n * The URL of RDF source of this source.\n */\n referenceValue: QuerySourceReference;\n\n /**\n * @return A value from 0 to 1 indicating to what respect a source type is\n * able to pre-filter the source based on the pattern.\n * 1 indicates that the source can apply the whole pattern,\n * and 0 indicates that the source can not apply the pattern at all (and local filtering must happen).\n * Plain RDF documents for example have a filter factor of 0,\n * while SPARQL endpoints have a filter factor of 1.\n */\n getFilterFactor: (context: IActionContext) => Promise<number>;\n\n /**\n * Get the selector type that is supported by this source.\n * @param context The action context.\n */\n getSelectorShape: (context: IActionContext) => Promise<FragmentSelectorShape>;\n\n /**\n * Returns a (possibly lazy) stream that returns all bindings matching the operation.\n *\n * Passed operations MUST conform to the query shape exposed by the selector type returned from `getSelectorShape`.\n * The given operation represents a Linked Data Fragments selector.\n *\n * The returned stream MUST expose the property 'metadata' of type `MetadataBindings`.\n * The implementor is reponsible for handling cases where 'metadata'\n * is being called without the stream being in flow-mode.\n * This metadata object can become invalidated (see `metadata.state`),\n * in which case the 'metadata' property must and will be updated.\n *\n * @param {Algebra.Operation} operation The query operation to execute.\n * @param {IActionContext} context The query context.\n * @param {BindingsStream} options Options for querying bindings\n * @return {AsyncIterator<RDF.Quad>} The resulting bindings stream.\n *\n * @see https://linkeddatafragments.org/specification/linked-data-fragments/#selectors\n */\n queryBindings: (\n operation: Algebra.Operation,\n context: IActionContext,\n options?: IQueryBindingsOptions,\n ) => BindingsStream;\n\n /**\n * Returns a (possibly lazy) stream that returns all quads matching the operation.\n *\n * This method should only be supported if the selector type returned from `getSelectorShape`\n * supports construct queries.\n *\n * @param {Algebra.Operation} operation The query operation to execute.\n * @param {IActionContext} context The query context.\n * @return {AsyncIterator<RDF.Quad>} The resulting quads stream.\n */\n queryQuads: (\n operation: Algebra.Operation,\n context: IActionContext,\n ) => AsyncIterator<RDF.Quad>;\n\n /**\n * Returns a promise resolving to the ask response of the given operation.\n *\n * This method should only be supported if the selector type returned from `getSelectorShape`\n * supports ask queries.\n *\n * @param {Algebra.Operation} operation The query operation to execute.\n * @param {IActionContext} context The query context.\n * @return {Promise<boolean>} The resulting ask reply.\n */\n queryBoolean: (\n operation: Algebra.Ask,\n context: IActionContext,\n ) => Promise<boolean>;\n\n /**\n * Returns a promise resolving when the given update operation succeeds.\n *\n * This method should only be supported if the selector type returned from `getSelectorShape`\n * supports update queries.\n *\n * @param {Algebra.Operation} operation The query operation to execute.\n * @param {IActionContext} context The query context.\n * @return {Promise<boolean>} The void response.\n */\n queryVoid: (\n operation: Algebra.Operation,\n context: IActionContext,\n ) => Promise<void>;\n\n /**\n * Returns a string representation of this source.\n */\n toString: () => string;\n}\n\nexport interface IQueryBindingsOptions {\n /**\n * Bindings that must be joined by the source together with the operation.\n * This can only be done if the source accepts joinBindings in the selector shape.\n *\n * The passed bindings may optionally apply to different variables than the query.\n * If this is not the case, then `filterBindings` should be used instead.\n */\n joinBindings?: { bindings: BindingsStream; metadata: MetadataBindings };\n /**\n * Bindings to filter the query operation's result by.\n * This can only be done if the source accepts filterBindings in the selector shape.\n *\n * The caller of this function should ensure that only bindings are being passed that are applicable to the query,\n * which means that a projection and filtering step might be needed beforehand.\n */\n filterBindings?: { bindings: BindingsStream; metadata: MetadataBindings };\n}\n\n/**\n * A fragment selector shape determines the shape of selectors that can be executed by a query source.\n * Selectors conforming to this shape represent boolean functions to decide if triples belong to a query response.\n * @see https://linkeddatafragments.org/specification/linked-data-fragments/#selectors\n */\nexport type FragmentSelectorShape = {\n type: 'operation';\n /**\n * The supported operation.\n */\n operation: {\n operationType: 'type';\n type: Algebra.Types;\n } | {\n operationType: 'pattern';\n pattern: Algebra.Operation;\n } | {\n operationType: 'type';\n type: Algebra.Types.EXPRESSION;\n /**\n * The extension functions this source supports.\n */\n extensionFunctions?: string[];\n } | {\n /**\n * All possible operations are accepted by this shape.\n * As exception, extension functions are not accepted through wildcards, and must be\n * explicitly listed via `extensionFunctions`.\n */\n operationType: 'wildcard';\n };\n /**\n * Variables that are in-scope in this operation and its children.\n */\n scopedVariables?: RDF.Variable[];\n /**\n * Variables that must be passed to the selector when instantiated.\n */\n variablesRequired?: RDF.Variable[];\n /**\n * Variables that may be passed to the selector when instantiated.\n */\n variablesOptional?: RDF.Variable[];\n /**\n * Children of this operation.\n * If this field is not set, then all operations defined at the top level of the shape are allowed as children.\n */\n children?: FragmentSelectorShape[];\n /**\n * If bindings can be passed into the source as a join.\n */\n joinBindings?: true;\n /**\n * If bindings can be passed into the source as a filter.\n */\n filterBindings?: true;\n} | {\n type: 'conjunction';\n children: FragmentSelectorShape[];\n} | {\n type: 'disjunction';\n children: FragmentSelectorShape[];\n} | {\n type: 'negation';\n child: FragmentSelectorShape;\n} | {\n type: 'arity';\n min?: number;\n max?: number;\n child: FragmentSelectorShape;\n};\n\n// ----- Examples of FragmentSelectorShapes -----\n// const AF = new Factory();\n// const DF = new DataFactory();\n// const shapeTpf: FragmentSelectorShape = {\n// type: 'operation',\n// operation: { pattern: AF.createPattern(DF.variable('s'), DF.variable('p'), DF.variable('o')) },\n// variablesOptional: [\n// DF.variable('s'),\n// DF.variable('p'),\n// DF.variable('o'),\n// ],\n// };\n//\n// const shapeQpf: FragmentSelectorShape = {\n// type: 'operation',\n// operation: { pattern: AF.createPattern(DF.variable('s'), DF.variable('p'), DF.variable('o'), DF.variable('g')) },\n// variablesOptional: [\n// DF.variable('s'),\n// DF.variable('p'),\n// DF.variable('o'),\n// DF.variable('g'),\n// ],\n// };\n//\n// const shapeBrTpf: FragmentSelectorShape = {\n// type: 'operation',\n// operation: { pattern: AF.createPattern(DF.variable('s'), DF.variable('p'), DF.variable('o')) },\n// variablesOptional: [\n// DF.variable('s'),\n// DF.variable('p'),\n// DF.variable('o'),\n// ],\n// addBindings: true,\n// };\n//\n// const shapeSparqlEp: FragmentSelectorShape = { // Same as SaGe\n// type: 'disjunction',\n// children: [\n// {\n// type: 'operation',\n// operation: { type: Algebra.Types.PROJECT },\n// },\n// {\n// type: 'operation',\n// operation: { type: Algebra.Types.CONSTRUCT },\n// },\n// {\n// type: 'operation',\n// operation: { type: Algebra.Types.DESCRIBE },\n// },\n// {\n// type: 'operation',\n// operation: { type: Algebra.Types.ASK },\n// },\n// {\n// type: 'operation',\n// operation: { type: Algebra.Types.COMPOSITE_UPDATE },\n// },\n// ],\n// };\n//\n// // Example of request:\n// // Find ?s matching \"?s dbo:country dbr:norway. ?s dbo:award ?o2. ?s dbo:birthDate ?o3.\"\n// const shapeSpf: FragmentSelectorShape = {\n// type: 'operation',\n// operation: { type: Algebra.Types.BGP },\n// scopedVariables: [\n// DF.variable('s'),\n// ],\n// children: [\n// {\n// type: 'arity',\n// min: 1,\n// max: Number.POSITIVE_INFINITY,\n// child: {\n// type: 'operation',\n// operation: { pattern: AF.createPattern(DF.variable('s'), DF.variable('p'), DF.variable('o')) },\n// variablesOptional: [\n// DF.variable('p'),\n// DF.variable('o'),\n// ],\n// },\n// },\n// ],\n// addBindings: true,\n// };\n//\n// // Example of requests:\n// // - brTPF\n// // - Find all ?s and ?o matching \"?s db:country ?o\"\n// const shapeSmartKg: FragmentSelectorShape = {\n// type: 'disjunction',\n// children: [\n// {\n// type: 'operation',\n// operation: { pattern: AF.createPattern(DF.variable('s'), DF.variable('p'), DF.variable('o')) },\n// variablesOptional: [\n// DF.variable('s'),\n// DF.variable('p'),\n// DF.variable('o'),\n// ],\n// addBindings: true,\n// },\n// {\n// type: 'operation',\n// operation: { type: Algebra.Types.BGP },\n// children: [\n// {\n// type: 'arity',\n// min: 1,\n// max: Number.POSITIVE_INFINITY,\n// child: {\n// type: 'operation',\n// operation: { pattern: AF.createPattern(DF.variable('s'), DF.variable('p'), DF.variable('o')) },\n// variablesRequired: [\n// DF.variable('p'),\n// ],\n// },\n// },\n// ],\n// },\n// ],\n// };\n"]}
{"version":3,"file":"IQuerySource.js","sourceRoot":"","sources":["IQuerySource.ts"],"names":[],"mappings":";;AA2PA,iDAAiD;AACjD,4BAA4B;AAC5B,gCAAgC;AAChC,4CAA4C;AAC5C,uBAAuB;AACvB,oGAAoG;AACpG,yBAAyB;AACzB,wBAAwB;AACxB,wBAAwB;AACxB,wBAAwB;AACxB,OAAO;AACP,KAAK;AACL,EAAE;AACF,4CAA4C;AAC5C,uBAAuB;AACvB,sHAAsH;AACtH,yBAAyB;AACzB,wBAAwB;AACxB,wBAAwB;AACxB,wBAAwB;AACxB,wBAAwB;AACxB,OAAO;AACP,KAAK;AACL,EAAE;AACF,8CAA8C;AAC9C,uBAAuB;AACvB,oGAAoG;AACpG,yBAAyB;AACzB,wBAAwB;AACxB,wBAAwB;AACxB,wBAAwB;AACxB,OAAO;AACP,uBAAuB;AACvB,KAAK;AACL,EAAE;AACF,iEAAiE;AACjE,yBAAyB;AACzB,gBAAgB;AAChB,QAAQ;AACR,2BAA2B;AAC3B,oDAAoD;AACpD,SAAS;AACT,QAAQ;AACR,2BAA2B;AAC3B,sDAAsD;AACtD,SAAS;AACT,QAAQ;AACR,2BAA2B;AAC3B,qDAAqD;AACrD,SAAS;AACT,QAAQ;AACR,2BAA2B;AAC3B,gDAAgD;AAChD,SAAS;AACT,QAAQ;AACR,2BAA2B;AAC3B,6DAA6D;AAC7D,SAAS;AACT,OAAO;AACP,KAAK;AACL,EAAE;AACF,yBAAyB;AACzB,6FAA6F;AAC7F,4CAA4C;AAC5C,uBAAuB;AACvB,4CAA4C;AAC5C,uBAAuB;AACvB,wBAAwB;AACxB,OAAO;AACP,gBAAgB;AAChB,QAAQ;AACR,uBAAuB;AACvB,gBAAgB;AAChB,uCAAuC;AACvC,iBAAiB;AACjB,6BAA6B;AAC7B,0GAA0G;AAC1G,+BAA+B;AAC/B,8BAA8B;AAC9B,8BAA8B;AAC9B,aAAa;AACb,WAAW;AACX,SAAS;AACT,OAAO;AACP,uBAAuB;AACvB,KAAK;AACL,EAAE;AACF,0BAA0B;AAC1B,eAAe;AACf,wDAAwD;AACxD,gDAAgD;AAChD,yBAAyB;AACzB,gBAAgB;AAChB,QAAQ;AACR,2BAA2B;AAC3B,wGAAwG;AACxG,6BAA6B;AAC7B,4BAA4B;AAC5B,4BAA4B;AAC5B,4BAA4B;AAC5B,WAAW;AACX,2BAA2B;AAC3B,SAAS;AACT,QAAQ;AACR,2BAA2B;AAC3B,gDAAgD;AAChD,oBAAoB;AACpB,YAAY;AACZ,2BAA2B;AAC3B,oBAAoB;AACpB,2CAA2C;AAC3C,qBAAqB;AACrB,iCAAiC;AACjC,8GAA8G;AAC9G,mCAAmC;AACnC,kCAAkC;AAClC,iBAAiB;AACjB,eAAe;AACf,aAAa;AACb,WAAW;AACX,SAAS;AACT,OAAO;AACP,KAAK","sourcesContent":["import type { Algebra, TypesComunica } from '@comunica/utils-algebra';\nimport type * as RDF from '@rdfjs/types';\nimport type { AsyncIterator } from 'asynciterator';\nimport type { BindingsStream } from './Bindings';\nimport type { IActionContext } from './IActionContext';\nimport type { ILink } from './ILink';\nimport type { MetadataBindings } from './IMetadata';\n\nexport interface IQuerySourceSerialized extends IQuerySourceUnidentifiedExpanded {\n type?: 'serialized';\n value: string;\n mediaType: string;\n baseIRI?: string;\n version?: string;\n}\n\nexport interface IQuerySourceUnidentifiedExpanded {\n type?: string;\n value: string | RDF.Source | RDF.Store | RDF.DatasetCore;\n context?: IActionContext;\n}\n\nexport interface IQuerySourceUnidentifiedExpandedRawContext {\n type?: string;\n value: string | RDF.Source | RDF.Store | RDF.DatasetCore;\n context?: Record<string, any>;\n}\n\nexport interface IQuerySourceTraverse {\n type: 'traverse';\n value: ILink[];\n context?: IActionContext | Record<string, any>;\n}\n\n/**\n * A composite file source that combines multiple file URLs or sources into a single queryable source.\n * All files are loaded and merged into one in-memory RDF store before querying.\n */\nexport interface IQuerySourceCompositeFile {\n type: 'compositefile';\n value: (string | IQuerySourceWrapper)[];\n context?: IActionContext;\n}\n\nexport type QuerySourceUnidentifiedExpanded =\n IQuerySourceUnidentifiedExpanded | IQuerySourceSerialized | IQuerySourceCompositeFile;\nexport type QuerySourceUnidentified = string | RDF.Source | RDF.Store | RDF.DatasetCore |\nQuerySourceUnidentifiedExpanded | IQuerySourceUnidentifiedExpandedRawContext | IQuerySourceTraverse;\n\n/**\n * Attaches a context to a query target.\n */\nexport interface IQuerySourceWrapper<Q extends IQuerySource = IQuerySource> {\n source: Q;\n context?: IActionContext;\n}\n\nexport type QuerySourceReference = string | RDF.Source | RDF.DatasetCore;\n\n/**\n * A lazy query source.\n */\nexport interface IQuerySource {\n /**\n * The URL of RDF source of this source.\n */\n referenceValue: QuerySourceReference;\n\n /**\n * @return A value from 0 to 1 indicating to what respect a source type is\n * able to pre-filter the source based on the pattern.\n * 1 indicates that the source can apply the whole pattern,\n * and 0 indicates that the source can not apply the pattern at all (and local filtering must happen).\n * Plain RDF documents for example have a filter factor of 0,\n * while SPARQL endpoints have a filter factor of 1.\n */\n getFilterFactor: (context: IActionContext) => Promise<number>;\n\n /**\n * Get the selector type that is supported by this source.\n * @param context The action context.\n */\n getSelectorShape: (context: IActionContext) => Promise<FragmentSelectorShape>;\n\n /**\n * Returns a (possibly lazy) stream that returns all bindings matching the operation.\n *\n * Passed operations MUST conform to the query shape exposed by the selector type returned from `getSelectorShape`.\n * The given operation represents a Linked Data Fragments selector.\n *\n * The returned stream MUST expose the property 'metadata' of type `MetadataBindings`.\n * The implementor is reponsible for handling cases where 'metadata'\n * is being called without the stream being in flow-mode.\n * This metadata object can become invalidated (see `metadata.state`),\n * in which case the 'metadata' property must and will be updated.\n *\n * @param {Algebra.Operation} operation The query operation to execute.\n * @param {IActionContext} context The query context.\n * @param {BindingsStream} options Options for querying bindings\n * @return {AsyncIterator<RDF.Quad>} The resulting bindings stream.\n *\n * @see https://linkeddatafragments.org/specification/linked-data-fragments/#selectors\n */\n queryBindings: (\n operation: Algebra.Operation,\n context: IActionContext,\n options?: IQueryBindingsOptions,\n ) => BindingsStream;\n\n /**\n * Returns a (possibly lazy) stream that returns all quads matching the operation.\n *\n * This method should only be supported if the selector type returned from `getSelectorShape`\n * supports construct queries.\n *\n * @param {Algebra.Operation} operation The query operation to execute.\n * @param {IActionContext} context The query context.\n * @return {AsyncIterator<RDF.Quad>} The resulting quads stream.\n */\n queryQuads: (\n operation: Algebra.Operation,\n context: IActionContext,\n ) => AsyncIterator<RDF.Quad>;\n\n /**\n * Returns a promise resolving to the ask response of the given operation.\n *\n * This method should only be supported if the selector type returned from `getSelectorShape`\n * supports ask queries.\n *\n * @param {Algebra.Operation} operation The query operation to execute.\n * @param {IActionContext} context The query context.\n * @return {Promise<boolean>} The resulting ask reply.\n */\n queryBoolean: (\n operation: Algebra.Ask,\n context: IActionContext,\n ) => Promise<boolean>;\n\n /**\n * Returns a promise resolving when the given update operation succeeds.\n *\n * This method should only be supported if the selector type returned from `getSelectorShape`\n * supports update queries.\n *\n * @param {Algebra.Operation} operation The query operation to execute.\n * @param {IActionContext} context The query context.\n * @return {Promise<boolean>} The void response.\n */\n queryVoid: (\n operation: Algebra.Operation,\n context: IActionContext,\n ) => Promise<void>;\n\n /**\n * Returns a string representation of this source.\n */\n toString: () => string;\n}\n\nexport interface IQueryBindingsOptions {\n /**\n * Bindings that must be joined by the source together with the operation.\n * This can only be done if the source accepts joinBindings in the selector shape.\n *\n * The passed bindings may optionally apply to different variables than the query.\n * If this is not the case, then `filterBindings` should be used instead.\n */\n joinBindings?: { bindings: BindingsStream; metadata: MetadataBindings };\n /**\n * Bindings to filter the query operation's result by.\n * This can only be done if the source accepts filterBindings in the selector shape.\n *\n * The caller of this function should ensure that only bindings are being passed that are applicable to the query,\n * which means that a projection and filtering step might be needed beforehand.\n */\n filterBindings?: { bindings: BindingsStream; metadata: MetadataBindings };\n}\n\n/**\n * A fragment selector shape determines the shape of selectors that can be executed by a query source.\n * Selectors conforming to this shape represent boolean functions to decide if triples belong to a query response.\n * @see https://linkeddatafragments.org/specification/linked-data-fragments/#selectors\n */\nexport type FragmentSelectorShape = {\n type: 'operation';\n /**\n * The supported operation.\n */\n operation: {\n operationType: 'type';\n type: Algebra.Types | TypesComunica;\n } | {\n operationType: 'pattern';\n pattern: Algebra.Operation;\n } | {\n operationType: 'type';\n type: Algebra.Types.EXPRESSION;\n /**\n * The extension functions this source supports.\n */\n extensionFunctions?: string[];\n } | {\n /**\n * All possible operations are accepted by this shape.\n * As exception, extension functions are not accepted through wildcards, and must be\n * explicitly listed via `extensionFunctions`.\n */\n operationType: 'wildcard';\n };\n /**\n * Variables that are in-scope in this operation and its children.\n */\n scopedVariables?: RDF.Variable[];\n /**\n * Variables that must be passed to the selector when instantiated.\n */\n variablesRequired?: RDF.Variable[];\n /**\n * Variables that may be passed to the selector when instantiated.\n */\n variablesOptional?: RDF.Variable[];\n /**\n * Children of this operation.\n * If this field is not set, then all operations defined at the top level of the shape are allowed as children.\n */\n children?: FragmentSelectorShape[];\n /**\n * If bindings can be passed into the source as a join.\n */\n joinBindings?: true;\n /**\n * If bindings can be passed into the source as a filter.\n */\n filterBindings?: true;\n} | {\n type: 'conjunction';\n children: FragmentSelectorShape[];\n} | {\n type: 'disjunction';\n children: FragmentSelectorShape[];\n} | {\n type: 'negation';\n child: FragmentSelectorShape;\n} | {\n type: 'arity';\n min?: number;\n max?: number;\n child: FragmentSelectorShape;\n};\n\n// ----- Examples of FragmentSelectorShapes -----\n// const AF = new Factory();\n// const DF = new DataFactory();\n// const shapeTpf: FragmentSelectorShape = {\n// type: 'operation',\n// operation: { pattern: AF.createPattern(DF.variable('s'), DF.variable('p'), DF.variable('o')) },\n// variablesOptional: [\n// DF.variable('s'),\n// DF.variable('p'),\n// DF.variable('o'),\n// ],\n// };\n//\n// const shapeQpf: FragmentSelectorShape = {\n// type: 'operation',\n// operation: { pattern: AF.createPattern(DF.variable('s'), DF.variable('p'), DF.variable('o'), DF.variable('g')) },\n// variablesOptional: [\n// DF.variable('s'),\n// DF.variable('p'),\n// DF.variable('o'),\n// DF.variable('g'),\n// ],\n// };\n//\n// const shapeBrTpf: FragmentSelectorShape = {\n// type: 'operation',\n// operation: { pattern: AF.createPattern(DF.variable('s'), DF.variable('p'), DF.variable('o')) },\n// variablesOptional: [\n// DF.variable('s'),\n// DF.variable('p'),\n// DF.variable('o'),\n// ],\n// addBindings: true,\n// };\n//\n// const shapeSparqlEp: FragmentSelectorShape = { // Same as SaGe\n// type: 'disjunction',\n// children: [\n// {\n// type: 'operation',\n// operation: { type: Algebra.Types.PROJECT },\n// },\n// {\n// type: 'operation',\n// operation: { type: Algebra.Types.CONSTRUCT },\n// },\n// {\n// type: 'operation',\n// operation: { type: Algebra.Types.DESCRIBE },\n// },\n// {\n// type: 'operation',\n// operation: { type: Algebra.Types.ASK },\n// },\n// {\n// type: 'operation',\n// operation: { type: Algebra.Types.COMPOSITE_UPDATE },\n// },\n// ],\n// };\n//\n// // Example of request:\n// // Find ?s matching \"?s dbo:country dbr:norway. ?s dbo:award ?o2. ?s dbo:birthDate ?o3.\"\n// const shapeSpf: FragmentSelectorShape = {\n// type: 'operation',\n// operation: { type: Algebra.Types.BGP },\n// scopedVariables: [\n// DF.variable('s'),\n// ],\n// children: [\n// {\n// type: 'arity',\n// min: 1,\n// max: Number.POSITIVE_INFINITY,\n// child: {\n// type: 'operation',\n// operation: { pattern: AF.createPattern(DF.variable('s'), DF.variable('p'), DF.variable('o')) },\n// variablesOptional: [\n// DF.variable('p'),\n// DF.variable('o'),\n// ],\n// },\n// },\n// ],\n// addBindings: true,\n// };\n//\n// // Example of requests:\n// // - brTPF\n// // - Find all ?s and ?o matching \"?s db:country ?o\"\n// const shapeSmartKg: FragmentSelectorShape = {\n// type: 'disjunction',\n// children: [\n// {\n// type: 'operation',\n// operation: { pattern: AF.createPattern(DF.variable('s'), DF.variable('p'), DF.variable('o')) },\n// variablesOptional: [\n// DF.variable('s'),\n// DF.variable('p'),\n// DF.variable('o'),\n// ],\n// addBindings: true,\n// },\n// {\n// type: 'operation',\n// operation: { type: Algebra.Types.BGP },\n// children: [\n// {\n// type: 'arity',\n// min: 1,\n// max: Number.POSITIVE_INFINITY,\n// child: {\n// type: 'operation',\n// operation: { pattern: AF.createPattern(DF.variable('s'), DF.variable('p'), DF.variable('o')) },\n// variablesRequired: [\n// DF.variable('p'),\n// ],\n// },\n// },\n// ],\n// },\n// ],\n// };\n"]}

@@ -17,2 +17,9 @@ /**

static getLevelOrdinal(level: string): number;
protected readonly activeLogGroups: Record<string, {
count: number;
lastSeenIndex: number;
callback: (count: number) => void;
}>;
protected repetitionCounter: number;
protected readonly groupedLogLimit = 5;
abstract trace(message: string, data?: any): void;

@@ -24,2 +31,17 @@ abstract debug(message: string, data?: any): void;

abstract fatal(message: string, data?: any): void;
/**
* Log a message that might be repeated, preventing console spam.
* If the same key is passed multiple times,
* only the first time the emit callback will be invoked immediately.
* All subsequent calls will be buffered,
* until at least {@link Logger#groupedLogLimit} other logGrouped calls are made,
* or {@link Logger#flush} is called.
* @param key A unique key for this message (e.g. the message template).
* @param emit A callback to emit the message.
*/
logGrouped(key: string, emit: (count: number) => void): void;
/**
* Flush all active log groups.
*/
flush(): void;
}

@@ -29,4 +29,45 @@ "use strict";

}
activeLogGroups = {};
repetitionCounter = 0;
groupedLogLimit = 5;
/**
* Log a message that might be repeated, preventing console spam.
* If the same key is passed multiple times,
* only the first time the emit callback will be invoked immediately.
* All subsequent calls will be buffered,
* until at least {@link Logger#groupedLogLimit} other logGrouped calls are made,
* or {@link Logger#flush} is called.
* @param key A unique key for this message (e.g. the message template).
* @param emit A callback to emit the message.
*/
logGrouped(key, emit) {
const pending = this.activeLogGroups[key];
if (pending) {
if (this.repetitionCounter - pending.lastSeenIndex - 1 < this.groupedLogLimit) {
pending.count++;
pending.lastSeenIndex = this.repetitionCounter++;
return;
}
delete this.activeLogGroups[key];
if (pending.count > 0) {
pending.callback(pending.count);
}
}
this.activeLogGroups[key] = { count: 0, lastSeenIndex: this.repetitionCounter++, callback: emit };
emit(1);
}
/**
* Flush all active log groups.
*/
flush() {
for (const key in this.activeLogGroups) {
const { count, callback } = this.activeLogGroups[key];
delete this.activeLogGroups[key];
if (count > 0) {
callback(count);
}
}
}
}
exports.Logger = Logger;
//# sourceMappingURL=Logger.js.map

@@ -1,1 +0,1 @@

{"version":3,"file":"Logger.js","sourceRoot":"","sources":["Logger.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,MAAsB,MAAM;IAC1B;;;OAGG;IAEI,MAAM,CAAU,MAAM,GAA2B;QACtD,KAAK,EAAE,CAAC;QACR,KAAK,EAAE,CAAC;QACR,IAAI,EAAE,CAAC;QACP,IAAI,EAAE,CAAC;QACP,KAAK,EAAE,CAAC;QACR,KAAK,EAAE,CAAC;KACT,CAAC;IAEF;;;;OAIG;IACI,MAAM,CAAC,eAAe,CAAC,KAAa;QACzC,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;;AAtBH,wBA8BC","sourcesContent":["/**\n * A logger accepts messages from different levels\n * and emits them in a certain way.\n */\nexport abstract class Logger {\n /**\n * All available logging levels.\n * @type {{trace: number; debug: number; info: number; warn: number; error: number; fatal: number}}\n */\n\n public static readonly LEVELS: Record<string, number> = {\n trace: 0,\n debug: 1,\n info: 2,\n warn: 3,\n error: 4,\n fatal: 5,\n };\n\n /**\n * Convert a string-based logging level to a numerical logging level.\n * @param level A string-based logging level\n * @return The numerical logging level, or undefined.\n */\n public static getLevelOrdinal(level: string): number {\n return Logger.LEVELS[level];\n }\n\n public abstract trace(message: string, data?: any): void;\n public abstract debug(message: string, data?: any): void;\n public abstract info(message: string, data?: any): void;\n public abstract warn(message: string, data?: any): void;\n public abstract error(message: string, data?: any): void;\n public abstract fatal(message: string, data?: any): void;\n}\n"]}
{"version":3,"file":"Logger.js","sourceRoot":"","sources":["Logger.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,MAAsB,MAAM;IAC1B;;;OAGG;IAEI,MAAM,CAAU,MAAM,GAA2B;QACtD,KAAK,EAAE,CAAC;QACR,KAAK,EAAE,CAAC;QACR,IAAI,EAAE,CAAC;QACP,IAAI,EAAE,CAAC;QACP,KAAK,EAAE,CAAC;QACR,KAAK,EAAE,CAAC;KACT,CAAC;IAEF;;;;OAIG;IACI,MAAM,CAAC,eAAe,CAAC,KAAa;QACzC,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;IAEkB,eAAe,GAI7B,EAAE,CAAC;IAEE,iBAAiB,GAAG,CAAC,CAAC;IAEb,eAAe,GAAG,CAAC,CAAC;IASvC;;;;;;;;;OASG;IACI,UAAU,CAAC,GAAW,EAAE,IAA6B;QAC1D,MAAM,OAAO,GAAG,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;QAC1C,IAAI,OAAO,EAAE,CAAC;YACZ,IAAI,IAAI,CAAC,iBAAiB,GAAG,OAAO,CAAC,aAAa,GAAG,CAAC,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;gBAC9E,OAAO,CAAC,KAAK,EAAE,CAAC;gBAChB,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAC;gBACjD,OAAO;YACT,CAAC;YACD,OAAO,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;YACjC,IAAI,OAAO,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC;gBACtB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YAClC,CAAC;QACH,CAAC;QAED,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,aAAa,EAAE,IAAI,CAAC,iBAAiB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;QAClG,IAAI,CAAC,CAAC,CAAC,CAAC;IACV,CAAC;IAED;;OAEG;IACI,KAAK;QACV,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;YACvC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;YACtD,OAAO,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;YACjC,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;gBACd,QAAQ,CAAC,KAAK,CAAC,CAAC;YAClB,CAAC;QACH,CAAC;IACH,CAAC;;AAhFH,wBAiFC","sourcesContent":["/**\n * A logger accepts messages from different levels\n * and emits them in a certain way.\n */\nexport abstract class Logger {\n /**\n * All available logging levels.\n * @type {{trace: number; debug: number; info: number; warn: number; error: number; fatal: number}}\n */\n\n public static readonly LEVELS: Record<string, number> = {\n trace: 0,\n debug: 1,\n info: 2,\n warn: 3,\n error: 4,\n fatal: 5,\n };\n\n /**\n * Convert a string-based logging level to a numerical logging level.\n * @param level A string-based logging level\n * @return The numerical logging level, or undefined.\n */\n public static getLevelOrdinal(level: string): number {\n return Logger.LEVELS[level];\n }\n\n protected readonly activeLogGroups: Record<string, {\n count: number;\n lastSeenIndex: number;\n callback: (count: number) => void;\n }> = {};\n\n protected repetitionCounter = 0;\n\n protected readonly groupedLogLimit = 5;\n\n public abstract trace(message: string, data?: any): void;\n public abstract debug(message: string, data?: any): void;\n public abstract info(message: string, data?: any): void;\n public abstract warn(message: string, data?: any): void;\n public abstract error(message: string, data?: any): void;\n public abstract fatal(message: string, data?: any): void;\n\n /**\n * Log a message that might be repeated, preventing console spam.\n * If the same key is passed multiple times,\n * only the first time the emit callback will be invoked immediately.\n * All subsequent calls will be buffered,\n * until at least {@link Logger#groupedLogLimit} other logGrouped calls are made,\n * or {@link Logger#flush} is called.\n * @param key A unique key for this message (e.g. the message template).\n * @param emit A callback to emit the message.\n */\n public logGrouped(key: string, emit: (count: number) => void): void {\n const pending = this.activeLogGroups[key];\n if (pending) {\n if (this.repetitionCounter - pending.lastSeenIndex - 1 < this.groupedLogLimit) {\n pending.count++;\n pending.lastSeenIndex = this.repetitionCounter++;\n return;\n }\n delete this.activeLogGroups[key];\n if (pending.count > 0) {\n pending.callback(pending.count);\n }\n }\n\n this.activeLogGroups[key] = { count: 0, lastSeenIndex: this.repetitionCounter++, callback: emit };\n emit(1);\n }\n\n /**\n * Flush all active log groups.\n */\n public flush(): void {\n for (const key in this.activeLogGroups) {\n const { count, callback } = this.activeLogGroups[key];\n delete this.activeLogGroups[key];\n if (count > 0) {\n callback(count);\n }\n }\n }\n}\n"]}
{
"name": "@comunica/types",
"version": "5.1.3",
"version": "5.2.0",
"description": "Typings module for Comunica",

@@ -45,3 +45,3 @@ "lsd:module": true,

"dependencies": {
"@comunica/utils-algebra": "^5.1.3",
"@comunica/utils-algebra": "^5.2.0",
"@rdfjs/types": "*",

@@ -52,3 +52,3 @@ "@types/yargs": "^17.0.24",

},
"gitHead": "8740a36019a375fd2ba27e799c52d63eb5cacc24"
"gitHead": "ebb0e79bddcd850fcb8d0fb5b422af88e67fa283"
}

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

Sorry, the diff of this file is not supported yet