@rdfx/resource 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +42 -0
  3. package/dist/DatasetValues.d.ts +24 -0
  4. package/dist/DatasetValues.js +172 -0
  5. package/dist/Identifier.d.ts +10 -0
  6. package/dist/Identifier.js +26 -0
  7. package/dist/ListStructureError.d.ts +4 -0
  8. package/dist/ListStructureError.js +4 -0
  9. package/dist/LiteralDecoder.d.ts +20 -0
  10. package/dist/LiteralDecoder.js +213 -0
  11. package/dist/LiteralFactory.d.ts +19 -0
  12. package/dist/LiteralFactory.js +183 -0
  13. package/dist/MissingValueError.d.ts +10 -0
  14. package/dist/MissingValueError.js +13 -0
  15. package/dist/MistypedPrimitiveValueError.d.ts +13 -0
  16. package/dist/MistypedPrimitiveValueError.js +15 -0
  17. package/dist/MistypedTermValueError.d.ts +13 -0
  18. package/dist/MistypedTermValueError.js +15 -0
  19. package/dist/MistypedValueError.d.ts +15 -0
  20. package/dist/MistypedValueError.js +13 -0
  21. package/dist/Primitive.d.ts +2 -0
  22. package/dist/Primitive.js +2 -0
  23. package/dist/PropertyPath.d.ts +46 -0
  24. package/dist/PropertyPath.js +179 -0
  25. package/dist/Resource.d.ts +112 -0
  26. package/dist/Resource.js +354 -0
  27. package/dist/ResourceSet.d.ts +24 -0
  28. package/dist/ResourceSet.js +76 -0
  29. package/dist/Term.d.ts +6 -0
  30. package/dist/Term.js +31 -0
  31. package/dist/Value.d.ts +103 -0
  32. package/dist/Value.js +173 -0
  33. package/dist/ValueError.d.ts +12 -0
  34. package/dist/ValueError.js +8 -0
  35. package/dist/Values.d.ts +114 -0
  36. package/dist/Values.js +221 -0
  37. package/dist/index.d.ts +4 -0
  38. package/dist/index.js +4 -0
  39. package/dist/literalDatatypeDefinitions.d.ts +24 -0
  40. package/dist/literalDatatypeDefinitions.js +116 -0
  41. package/dist/vocabularies.d.ts +36 -0
  42. package/dist/vocabularies.js +41 -0
  43. package/package.json +42 -0
@@ -0,0 +1,76 @@
1
+ import DefaultDataFactory from "@rdfjs/data-model";
2
+ import TermSet from "@rdfjs/term-set";
3
+ import { Resource } from "./Resource.js";
4
+ import { rdf, rdfs } from "./vocabularies.js";
5
+ /**
6
+ * A ResourceSet wraps an RDF/JS dataset with convenient resource factory methods.
7
+ */
8
+ export class ResourceSet {
9
+ constructor(dataset, options) {
10
+ this.dataset = dataset;
11
+ this.dataFactory = options?.dataFactory ?? DefaultDataFactory;
12
+ this.graph = options?.graph;
13
+ }
14
+ *instancesOf(class_, options) {
15
+ for (const identifier of this.instanceIdentifiers(class_, options)) {
16
+ yield this.resource(identifier);
17
+ }
18
+ }
19
+ *namedInstancesOf(class_, options) {
20
+ for (const identifier of this.instanceIdentifiers(class_, options)) {
21
+ if (identifier.termType === "NamedNode")
22
+ yield this.resource(identifier);
23
+ }
24
+ }
25
+ resource(identifier) {
26
+ return new Resource(this.dataset, identifier, {
27
+ dataFactory: this.dataFactory,
28
+ });
29
+ }
30
+ *instanceIdentifiers(class_, options) {
31
+ yield* instanceIdentifiersRecursive({
32
+ class_,
33
+ dataset: this.dataset,
34
+ graph: options?.graph ?? this.graph,
35
+ visitedClasses: new TermSet(),
36
+ yieldedInstanceIdentifiers: new TermSet(),
37
+ });
38
+ function* instanceIdentifiersRecursive({ class_, dataset, graph, visitedClasses, yieldedInstanceIdentifiers, }) {
39
+ // Get instanceQuads of the class
40
+ for (const quad of dataset.match(null, options?.instanceOfPredicate ?? rdf.type, class_, graph)) {
41
+ switch (quad.subject.termType) {
42
+ case "BlankNode":
43
+ case "NamedNode":
44
+ if (!yieldedInstanceIdentifiers.has(quad.subject)) {
45
+ yield quad.subject;
46
+ yieldedInstanceIdentifiers.add(quad.subject);
47
+ }
48
+ break;
49
+ default:
50
+ break;
51
+ }
52
+ }
53
+ visitedClasses.add(class_);
54
+ if (options?.excludeSubclasses) {
55
+ return;
56
+ }
57
+ // Recurse into class's sub-classes that haven't been visited yet.
58
+ for (const quad of dataset.match(null, options?.subClassOfPredicate ?? rdfs.subClassOf, class_, graph)) {
59
+ if (quad.subject.termType !== "NamedNode") {
60
+ continue;
61
+ }
62
+ if (visitedClasses.has(quad.subject)) {
63
+ continue;
64
+ }
65
+ yield* instanceIdentifiersRecursive({
66
+ class_: quad.subject,
67
+ dataset,
68
+ graph,
69
+ visitedClasses,
70
+ yieldedInstanceIdentifiers,
71
+ });
72
+ }
73
+ }
74
+ }
75
+ }
76
+ //# sourceMappingURL=ResourceSet.js.map
package/dist/Term.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ import type { BlankNode, Literal, NamedNode } from "@rdfjs/types";
2
+ export type Term = BlankNode | Literal | NamedNode;
3
+ export declare namespace Term {
4
+ function toString(term: Term): string;
5
+ }
6
+ //# sourceMappingURL=Term.d.ts.map
package/dist/Term.js ADDED
@@ -0,0 +1,31 @@
1
+ import { Identifier } from "./Identifier.js";
2
+ import { xsd } from "./vocabularies.js";
3
+ export var Term;
4
+ (function (Term) {
5
+ // biome-ignore lint/suspicious/noShadowRestrictedNames: fine here
6
+ function toString(term) {
7
+ switch (term.termType) {
8
+ case "BlankNode":
9
+ case "NamedNode":
10
+ return Identifier.toString(term);
11
+ case "Literal": {
12
+ const literal = term;
13
+ const escaped = literal.value
14
+ .replace(/\\/g, "\\\\")
15
+ .replace(/"/g, '\\"')
16
+ .replace(/\n/g, "\\n")
17
+ .replace(/\r/g, "\\r");
18
+ const quoted = `"${escaped}"`;
19
+ if (literal.language) {
20
+ return `${quoted}@${literal.language}`;
21
+ }
22
+ if (!literal.datatype.equals(xsd.string)) {
23
+ return `${quoted}^^<${literal.datatype.value}>`;
24
+ }
25
+ return quoted;
26
+ }
27
+ }
28
+ }
29
+ Term.toString = toString;
30
+ })(Term || (Term = {}));
31
+ //# sourceMappingURL=Term.js.map
@@ -0,0 +1,103 @@
1
+ import type { BlankNode, DataFactory, Literal, NamedNode, Quad_Graph, Variable } from "@rdfjs/types";
2
+ import { Either } from "purify-ts";
3
+ import type { Identifier } from "./Identifier.js";
4
+ import type { Primitive } from "./Primitive.js";
5
+ import type { PropertyPath } from "./PropertyPath.js";
6
+ import { Resource } from "./Resource.js";
7
+ import { Term } from "./Term.js";
8
+ import { Values } from "./Values.js";
9
+ export declare class Value<TermT extends Term = Term> {
10
+ private readonly dataFactory;
11
+ readonly focusResource: Resource;
12
+ readonly propertyPath: PropertyPath;
13
+ readonly term: TermT;
14
+ constructor({ dataFactory, focusResource, propertyPath, term, }: {
15
+ dataFactory: DataFactory;
16
+ focusResource: Resource;
17
+ propertyPath: PropertyPath;
18
+ term: TermT;
19
+ });
20
+ /**
21
+ * Try to convert this term to a bigint.
22
+ */
23
+ toBigInt(): Either<Error, bigint>;
24
+ toBigInt<T extends bigint>(in_: readonly T[]): Either<Error, T>;
25
+ /**
26
+ * Try to convert this term to a blank node.
27
+ */
28
+ toBlankNode(): Either<Error, BlankNode>;
29
+ /**
30
+ * Try to convert this term to a boolean.
31
+ */
32
+ toBoolean(): Either<Error, boolean>;
33
+ toBoolean<T extends boolean>(in_: readonly T[]): Either<Error, T>;
34
+ /**
35
+ * Try to convert this term to a date.
36
+ */
37
+ toDate(in_?: readonly Date[]): Either<Error, Date>;
38
+ /**
39
+ * Try to convert this term to a date-time.
40
+ */
41
+ toDateTime(in_?: readonly Date[]): Either<Error, Date>;
42
+ /**
43
+ * Try to convert this term to a float.
44
+ */
45
+ toFloat(): Either<Error, number>;
46
+ toFloat<T extends number>(in_: readonly T[]): Either<Error, T>;
47
+ /**
48
+ * Try to convert this term to an identifier (blank node or IRI).
49
+ */
50
+ toIdentifier(): Either<Error, Identifier>;
51
+ toIdentifier<T extends Identifier>(in_: readonly T[]): Either<Error, T>;
52
+ /**
53
+ * Try to convert this term to an int.
54
+ */
55
+ toInt(): Either<Error, number>;
56
+ toInt<T extends number>(in_: readonly T[]): Either<Error, T>;
57
+ /**
58
+ * Try to convert this term to an IRI / NamedNode.
59
+ */
60
+ toIri(): Either<Error, NamedNode>;
61
+ toIri<T extends NamedNode>(in_: readonly T[]): Either<Error, T>;
62
+ /**
63
+ * Try to convert this term to an RDF list.
64
+ */
65
+ toList(options?: {
66
+ graph?: Exclude<Quad_Graph, Variable>;
67
+ }): Either<Error, Values<Value>>;
68
+ /**
69
+ * Try to convert this term to a Literal.
70
+ */
71
+ toLiteral(in_?: readonly Literal[]): Either<Error, Literal>;
72
+ /**
73
+ * Try to convert this term to a number.
74
+ */
75
+ toNumber(): Either<Error, number>;
76
+ toNumber<T extends number>(in_: readonly T[]): Either<Error, T>;
77
+ /**
78
+ * Try to convert this term to a JavaScript primitive (boolean | Date | number | string).
79
+ */
80
+ toPrimitive(): Either<Error, Primitive>;
81
+ toPrimitive<T extends Primitive>(in_: readonly T[]): Either<Error, T>;
82
+ /**
83
+ * Try to convert this term to a resource (identified by a blank node or IRI).
84
+ */
85
+ toResource(): Either<Error, Resource>;
86
+ toResource<T extends Identifier>(in_: readonly T[]): Either<Error, T>;
87
+ /**
88
+ * Try to convert this term to a string.
89
+ */
90
+ toString(): Either<Error, string>;
91
+ toString<T extends string>(in_: readonly T[]): Either<Error, T>;
92
+ toTerm(): Either<Error, TermT>;
93
+ toTerm<T extends TermT>(in_: readonly T[]): Either<Error, T>;
94
+ /**
95
+ * Convert this term into a singleton sequence of values.
96
+ */
97
+ toValues(): Values<Value<TermT>>;
98
+ private constrainDate;
99
+ private constrainPrimitive;
100
+ private constrainTerm;
101
+ private newMistypedTermValueError;
102
+ }
103
+ //# sourceMappingURL=Value.d.ts.map
package/dist/Value.js ADDED
@@ -0,0 +1,173 @@
1
+ import { LiteralDecoder } from "@rdfx/literal";
2
+ import { Either, Left } from "purify-ts";
3
+ import { MistypedPrimitiveValueError } from "./MistypedPrimitiveValueError.js";
4
+ import { MistypedTermValueError } from "./MistypedTermValueError.js";
5
+ import { Resource } from "./Resource.js";
6
+ import { Term } from "./Term.js";
7
+ import { Values } from "./Values.js";
8
+ export class Value {
9
+ constructor({ dataFactory, focusResource, propertyPath, term, }) {
10
+ this.dataFactory = dataFactory;
11
+ this.focusResource = focusResource;
12
+ this.propertyPath = propertyPath;
13
+ this.term = term;
14
+ }
15
+ toBigInt(in_) {
16
+ return this.toLiteral()
17
+ .chain(LiteralDecoder.decodeBigIntLiteral)
18
+ .mapLeft(() => this.newMistypedTermValueError(in_ ? in_.map((_) => _.toString()).join(" | ") : "bigint"))
19
+ .chain((value) => this.constrainPrimitive(value, in_));
20
+ }
21
+ /**
22
+ * Try to convert this term to a blank node.
23
+ */
24
+ toBlankNode() {
25
+ return this.term.termType === "BlankNode"
26
+ ? Either.of(this.term)
27
+ : Left(this.newMistypedTermValueError("BlankNode"));
28
+ }
29
+ toBoolean(in_) {
30
+ return this.toLiteral()
31
+ .chain(LiteralDecoder.decodeBooleanLiteral)
32
+ .mapLeft(() => this.newMistypedTermValueError(in_ ? in_.map((_) => _.toString()).join(" |") : "boolean"))
33
+ .chain((value) => this.constrainPrimitive(value, in_));
34
+ }
35
+ /**
36
+ * Try to convert this term to a date.
37
+ */
38
+ toDate(in_) {
39
+ return this.toLiteral()
40
+ .chain(LiteralDecoder.decodeDateLiteral)
41
+ .mapLeft(() => this.newMistypedTermValueError(in_ ? in_.map((_) => _.toISOString()).join(" |") : "boolean"))
42
+ .chain((value) => this.constrainDate(value, in_));
43
+ }
44
+ /**
45
+ * Try to convert this term to a date-time.
46
+ */
47
+ toDateTime(in_) {
48
+ return this.toLiteral()
49
+ .chain(LiteralDecoder.decodeDateTimeLiteral)
50
+ .mapLeft(() => this.newMistypedTermValueError(in_ ? in_.map((_) => _.toISOString()).join(" |") : "boolean"))
51
+ .chain((value) => this.constrainDate(value, in_));
52
+ }
53
+ toFloat(in_) {
54
+ return this.toLiteral()
55
+ .chain(LiteralDecoder.decodeFloatLiteral)
56
+ .mapLeft(() => this.newMistypedTermValueError(in_ ? in_.map((_) => _.toString()).join(" | ") : "float"))
57
+ .chain((value) => this.constrainPrimitive(value, in_));
58
+ }
59
+ toIdentifier(in_) {
60
+ if (this.term.termType === "Literal") {
61
+ return Left(this.newMistypedTermValueError("Identifier"));
62
+ }
63
+ return this.constrainTerm(this.term, in_);
64
+ }
65
+ toInt(in_) {
66
+ return this.toLiteral()
67
+ .chain(LiteralDecoder.decodeIntLiteral)
68
+ .mapLeft(() => this.newMistypedTermValueError(in_ ? in_.map((_) => _.toString()).join(" | ") : "int"))
69
+ .chain((value) => this.constrainPrimitive(value, in_));
70
+ }
71
+ toIri(in_) {
72
+ if (this.term.termType !== "NamedNode") {
73
+ return Left(this.newMistypedTermValueError("IRI"));
74
+ }
75
+ return this.constrainTerm(this.term, in_);
76
+ }
77
+ /**
78
+ * Try to convert this term to an RDF list.
79
+ */
80
+ toList(options) {
81
+ return this.toResource().chain((resource) => resource.toList({ graph: options?.graph }));
82
+ }
83
+ /**
84
+ * Try to convert this term to a Literal.
85
+ */
86
+ toLiteral(in_) {
87
+ if (this.term.termType !== "Literal") {
88
+ return Left(this.newMistypedTermValueError(in_ ? in_.map((_) => Term.toString(_)).join(" | ") : "Literal"));
89
+ }
90
+ if (in_ && !in_.some((check) => check.equals(this.term))) {
91
+ return Left(this.newMistypedTermValueError(in_ ? in_.map((_) => Term.toString(_)).join(" | ") : "Literal"));
92
+ }
93
+ return Either.of(this.term);
94
+ }
95
+ toNumber(in_) {
96
+ return this.toLiteral()
97
+ .chain(LiteralDecoder.decodeNumberLiteral)
98
+ .mapLeft(() => this.newMistypedTermValueError(in_ ? in_.map((_) => _.toString()).join(" | ") : "float"))
99
+ .chain((value) => this.constrainPrimitive(value, in_));
100
+ }
101
+ toPrimitive(in_) {
102
+ return this.toLiteral()
103
+ .chain(LiteralDecoder.decodePrimitiveLiteral)
104
+ .mapLeft(() => this.newMistypedTermValueError(in_ ? in_.map((_) => _.toString()).join(" | ") : "primitive"))
105
+ .chain((value) => this.constrainPrimitive(value, in_));
106
+ }
107
+ toResource(in_) {
108
+ return (in_ ? this.toIdentifier(in_) : this.toIdentifier()).map((identifier) => new Resource(this.focusResource.dataset, identifier, {
109
+ dataFactory: this.dataFactory,
110
+ }));
111
+ }
112
+ toString(in_) {
113
+ return this.toLiteral()
114
+ .chain(LiteralDecoder.decodeStringLiteral)
115
+ .chain((value) => this.constrainPrimitive(value, in_))
116
+ .mapLeft(() => this.newMistypedTermValueError(in_ ? in_.map((_) => JSON.stringify(_)).join(" | ") : "string"));
117
+ }
118
+ toTerm(in_) {
119
+ return this.constrainTerm(this.term, in_);
120
+ }
121
+ /**
122
+ * Convert this term into a singleton sequence of values.
123
+ */
124
+ toValues() {
125
+ return Values.fromValue({
126
+ focusResource: this.focusResource,
127
+ propertyPath: this.propertyPath,
128
+ value: this,
129
+ });
130
+ }
131
+ constrainDate(value, in_) {
132
+ if (in_ && !in_.some((check) => value.getTime() === check.getTime())) {
133
+ return Left(new MistypedPrimitiveValueError({
134
+ actualValue: value,
135
+ expectedValueType: in_.map((_) => _.toISOString()).join(" | "),
136
+ focusResource: this.focusResource,
137
+ propertyPath: this.propertyPath,
138
+ }));
139
+ }
140
+ return Either.of(value);
141
+ }
142
+ constrainPrimitive(value, in_) {
143
+ if (in_ && !in_.some((check) => value === check)) {
144
+ return Left(new MistypedPrimitiveValueError({
145
+ actualValue: value,
146
+ expectedValueType: in_.map((_) => _.toString()).join(" | "),
147
+ focusResource: this.focusResource,
148
+ propertyPath: this.propertyPath,
149
+ }));
150
+ }
151
+ return Either.of(value);
152
+ }
153
+ constrainTerm(value, in_) {
154
+ if (in_ && !in_.some((check) => value.equals(check))) {
155
+ return Left(new MistypedTermValueError({
156
+ actualValue: value,
157
+ expectedValueType: in_.map(Term.toString).join(" | "),
158
+ focusResource: this.focusResource,
159
+ propertyPath: this.propertyPath,
160
+ }));
161
+ }
162
+ return Either.of(value);
163
+ }
164
+ newMistypedTermValueError(expectedValueType) {
165
+ return new MistypedTermValueError({
166
+ actualValue: this.term,
167
+ expectedValueType,
168
+ focusResource: this.focusResource,
169
+ propertyPath: this.propertyPath,
170
+ });
171
+ }
172
+ }
173
+ //# sourceMappingURL=Value.js.map
@@ -0,0 +1,12 @@
1
+ import type { PropertyPath } from "./PropertyPath.js";
2
+ import type { Resource } from "./Resource.js";
3
+ export declare abstract class ValueError extends Error {
4
+ readonly focusResource: Resource;
5
+ readonly propertyPath: PropertyPath;
6
+ constructor({ focusResource, message, propertyPath, }: {
7
+ focusResource: Resource;
8
+ message: string;
9
+ propertyPath: PropertyPath;
10
+ });
11
+ }
12
+ //# sourceMappingURL=ValueError.d.ts.map
@@ -0,0 +1,8 @@
1
+ export class ValueError extends Error {
2
+ constructor({ focusResource, message, propertyPath, }) {
3
+ super(message);
4
+ this.focusResource = focusResource;
5
+ this.propertyPath = propertyPath;
6
+ }
7
+ }
8
+ //# sourceMappingURL=ValueError.js.map
@@ -0,0 +1,114 @@
1
+ import { Either } from "purify-ts";
2
+ import { MissingValueError } from "./MissingValueError.js";
3
+ import type { PropertyPath } from "./PropertyPath.js";
4
+ import type { Resource } from "./Resource.js";
5
+ import type { Value } from "./Value.js";
6
+ import type { ValueError } from "./ValueError.js";
7
+ /**
8
+ * Iterable sequence of values of a given type.
9
+ *
10
+ * Resource.values returns instances of this class instead of a simple array of values in order to
11
+ * (1) preserve the focus resource that .values was invoked on, in case of errors
12
+ * (2) preserve the propertyPath that .values was invoked with, in case of errors
13
+ * (3) return purify types from methods like .find instead of null or undefined
14
+ * (4) add some methods that aren't on arrays, like .chainMap and .head
15
+ *
16
+ * The class doesn't try to implement the entire Array interface. Methods are added as needed by downstream code.
17
+ */
18
+ export declare abstract class Values<T = Value> implements Iterable<T> {
19
+ readonly focusResource: Resource;
20
+ readonly propertyPath: PropertyPath;
21
+ abstract readonly length: number;
22
+ protected constructor({ focusResource, propertyPath, }: {
23
+ focusResource: Resource;
24
+ propertyPath: PropertyPath;
25
+ });
26
+ /**
27
+ * Create a Values instance that is empty.
28
+ */
29
+ static empty<T>(parameters: {
30
+ focusResource: Resource;
31
+ propertyPath: PropertyPath;
32
+ }): Values<T>;
33
+ /**
34
+ * Create a Values instance from an array of values.
35
+ */
36
+ static fromArray<T>(parameters: {
37
+ focusResource: Resource;
38
+ propertyPath: PropertyPath;
39
+ values: readonly T[];
40
+ }): Values<T>;
41
+ /**
42
+ * Create a Values instance from a single value.
43
+ */
44
+ static fromValue<T>(parameters: {
45
+ focusResource: Resource;
46
+ propertyPath: PropertyPath;
47
+ value: T;
48
+ }): SingletonValues<T>;
49
+ abstract [Symbol.iterator](): Iterator<T>;
50
+ /**
51
+ * For each value in the sequence, try to convert it to a new type / transform it using the provided callback.
52
+ *
53
+ * If any conversion fails, return the failure (the Left).
54
+ *
55
+ * If all of the conversions succeed, return a new Values with the converted values.
56
+ *
57
+ * This is a combination of Either.chain and Either.map.
58
+ */
59
+ chainMap<NewT>(callback: (value: T, index: number) => Either<Error, NewT>): Either<Error, Values<NewT>>;
60
+ /**
61
+ * Concatenate another values of the same type to this Values, returning a new Values instance.
62
+ */
63
+ concat(...values: readonly T[]): Values<T>;
64
+ /**
65
+ * Filter the values, returning a new Values instance.
66
+ */
67
+ filter(propertyPath: (value: T, index: number) => boolean): Values<T>;
68
+ /**
69
+ * Find a value that satisfies the given propertyPath.
70
+ *
71
+ * Return Right if a value satisfies the propertyPath, otherwise Left.
72
+ */
73
+ find(propertyPath: (value: T, index: number) => boolean): Either<MissingValueError, T>;
74
+ /**
75
+ * Flatten a Values of iterables into a new Values.
76
+ *
77
+ * Equivalent of Array.flat.
78
+ */
79
+ flat<NewT>(): Values<NewT>;
80
+ /**
81
+ * Map each value to an array of values of a new type. Flatten those arrays and return the result as a new Values.
82
+ */
83
+ flatMap<NewT>(callback: (value: T, index: number) => ReadonlyArray<NewT>): Values<NewT>;
84
+ /**
85
+ * Get the head of this sequence of values if the sequence is non-empty. Otherwise return Left.
86
+ */
87
+ head(): Either<ValueError, T>;
88
+ /**
89
+ * Map each value to a value of a new type and return a new Values with the mapped results.
90
+ */
91
+ map<NewT>(callback: (value: T, index: number) => NewT): Values<NewT>;
92
+ /**
93
+ * Convert this values to an array of the values.
94
+ */
95
+ abstract toArray(): readonly T[];
96
+ }
97
+ /**
98
+ * Private implementation of Values that iterates over a single value.
99
+ *
100
+ * Must be in the same file to avoid circular dependencies.
101
+ */
102
+ declare class SingletonValues<T> extends Values<T> {
103
+ private readonly value;
104
+ readonly length = 1;
105
+ constructor({ value, ...superParameters }: {
106
+ focusResource: Resource;
107
+ propertyPath: PropertyPath;
108
+ value: T;
109
+ });
110
+ [Symbol.iterator](): Iterator<T>;
111
+ toArray(): readonly T[];
112
+ }
113
+ export {};
114
+ //# sourceMappingURL=Values.d.ts.map