rdfjs-resource 3.0.0 → 3.0.2

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.
package/dist/Value.d.ts CHANGED
@@ -8,8 +8,8 @@ import { Term } from "./Term.js";
8
8
  import { Values } from "./Values.js";
9
9
  export declare class Value<TermT extends Term = Term> {
10
10
  private readonly dataFactory;
11
- private readonly focusResource;
12
- private readonly propertyPath;
11
+ readonly focusResource: Resource;
12
+ readonly propertyPath: PropertyPath;
13
13
  readonly term: TermT;
14
14
  constructor({ dataFactory, focusResource, propertyPath, term, }: {
15
15
  dataFactory: DataFactory;
@@ -31,14 +31,14 @@ export declare class Value<TermT extends Term = Term> {
31
31
  */
32
32
  toBoolean(): Either<Error, boolean>;
33
33
  toBoolean<T extends boolean>(in_: readonly T[]): Either<Error, T>;
34
- /**
35
- * Try to convert this term to a date-time.
36
- */
37
- toDateTime(in_?: readonly Date[]): Either<Error, Date>;
38
34
  /**
39
35
  * Try to convert this term to a date.
40
36
  */
41
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
42
  /**
43
43
  * Try to convert this term to a float.
44
44
  */
@@ -95,9 +95,9 @@ export declare class Value<TermT extends Term = Term> {
95
95
  * Convert this term into a singleton sequence of values.
96
96
  */
97
97
  toValues(): Values<Value<TermT>>;
98
- private newMistypedTermValueError;
99
98
  private constrainDate;
100
99
  private constrainPrimitive;
101
100
  private constrainTerm;
101
+ private newMistypedTermValueError;
102
102
  }
103
103
  //# sourceMappingURL=Value.d.ts.map
package/dist/Value.js CHANGED
@@ -33,20 +33,20 @@ export class Value {
33
33
  .chain((value) => this.constrainPrimitive(value, in_));
34
34
  }
35
35
  /**
36
- * Try to convert this term to a date-time.
36
+ * Try to convert this term to a date.
37
37
  */
38
- toDateTime(in_) {
38
+ toDate(in_) {
39
39
  return this.toLiteral()
40
- .chain(LiteralDecoder.decodeDateTimeLiteral)
40
+ .chain(LiteralDecoder.decodeDateLiteral)
41
41
  .mapLeft(() => this.newMistypedTermValueError(in_ ? in_.map((_) => _.toISOString()).join(" |") : "boolean"))
42
42
  .chain((value) => this.constrainDate(value, in_));
43
43
  }
44
44
  /**
45
- * Try to convert this term to a date.
45
+ * Try to convert this term to a date-time.
46
46
  */
47
- toDate(in_) {
47
+ toDateTime(in_) {
48
48
  return this.toLiteral()
49
- .chain(LiteralDecoder.decodeDateLiteral)
49
+ .chain(LiteralDecoder.decodeDateTimeLiteral)
50
50
  .mapLeft(() => this.newMistypedTermValueError(in_ ? in_.map((_) => _.toISOString()).join(" |") : "boolean"))
51
51
  .chain((value) => this.constrainDate(value, in_));
52
52
  }
@@ -128,14 +128,6 @@ export class Value {
128
128
  value: this,
129
129
  });
130
130
  }
131
- newMistypedTermValueError(expectedValueType) {
132
- return new MistypedTermValueError({
133
- actualValue: this.term,
134
- expectedValueType,
135
- focusResource: this.focusResource,
136
- propertyPath: this.propertyPath,
137
- });
138
- }
139
131
  constrainDate(value, in_) {
140
132
  if (in_ && !in_.some((check) => value.getTime() === check.getTime())) {
141
133
  return Left(new MistypedPrimitiveValueError({
@@ -169,5 +161,13 @@ export class Value {
169
161
  }
170
162
  return Either.of(value);
171
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
172
  }
173
173
  //# sourceMappingURL=Value.js.map
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from "./LiteralDecoder.js";
2
2
  export * from "./LiteralFactory.js";
3
3
  export * from "./literalDatatypeDefinitions.js";
4
+ export * from "./PropertyPath.js";
4
5
  export * from "./Resource.js";
5
6
  export * from "./ResourceSet.js";
6
7
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from "./LiteralDecoder.js";
2
2
  export * from "./LiteralFactory.js";
3
3
  export * from "./literalDatatypeDefinitions.js";
4
+ export * from "./PropertyPath.js";
4
5
  export * from "./Resource.js";
5
6
  export * from "./ResourceSet.js";
6
7
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -47,5 +47,5 @@
47
47
  },
48
48
  "type": "module",
49
49
  "types": "dist/index.d.ts",
50
- "version": "3.0.0"
50
+ "version": "3.0.2"
51
51
  }