@shaclmate/compiler 4.0.33 → 4.0.34
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/Compiler.d.ts +0 -3
- package/dist/Compiler.js +0 -2
- package/dist/ShapesGraphToAstTransformer.d.ts +1 -4
- package/dist/ShapesGraphToAstTransformer.js +1 -5
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstObjectTypeProperty.js +1 -3
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstCompoundType.js +4 -7
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstListType.js +0 -1
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstObjectType.js +1 -3
- package/dist/ast/AbstractCompoundType.d.ts +6 -4
- package/dist/ast/AbstractCompoundType.js +4 -37
- package/dist/ast/ObjectType.d.ts +1 -7
- package/dist/ast/ObjectType.js +1 -6
- package/dist/generators/ts/AbstractCollectionType.d.ts +8 -8
- package/dist/generators/ts/AbstractCollectionType.js +28 -111
- package/dist/generators/ts/AbstractContainerType.d.ts +1 -1
- package/dist/generators/ts/AbstractDateType.d.ts +4 -9
- package/dist/generators/ts/AbstractDateType.js +2 -29
- package/dist/generators/ts/AbstractIdentifierType.d.ts +4 -1
- package/dist/generators/ts/AbstractIdentifierType.js +0 -17
- package/dist/generators/ts/AbstractLazyObjectType.d.ts +8 -5
- package/dist/generators/ts/AbstractLazyObjectType.js +21 -21
- package/dist/generators/ts/AbstractLiteralType.d.ts +11 -3
- package/dist/generators/ts/AbstractLiteralType.js +1 -1
- package/dist/generators/ts/AbstractNamedUnionType.d.ts +2 -5
- package/dist/generators/ts/AbstractNamedUnionType.js +27 -58
- package/dist/generators/ts/AbstractNumericType.d.ts +9 -8
- package/dist/generators/ts/AbstractNumericType.js +18 -11
- package/dist/generators/ts/AbstractPrimitiveType.d.ts +8 -4
- package/dist/generators/ts/AbstractPrimitiveType.js +9 -17
- package/dist/generators/ts/AbstractTermType.d.ts +8 -4
- package/dist/generators/ts/AbstractTermType.js +11 -51
- package/dist/generators/ts/AbstractType.d.ts +26 -22
- package/dist/generators/ts/AbstractType.js +4 -2
- package/dist/generators/ts/AbstractUnionType.d.ts +2 -2
- package/dist/generators/ts/AbstractUnionType.js +25 -36
- package/dist/generators/ts/AnonymousUnionType.d.ts +1 -1
- package/dist/generators/ts/AnonymousUnionType.js +3 -3
- package/dist/generators/ts/BigDecimalType.d.ts +5 -3
- package/dist/generators/ts/BigDecimalType.js +15 -42
- package/dist/generators/ts/BigIntType.d.ts +3 -4
- package/dist/generators/ts/BigIntType.js +5 -16
- package/dist/generators/ts/BlankNodeType.d.ts +7 -7
- package/dist/generators/ts/BlankNodeType.js +14 -2
- package/dist/generators/ts/BooleanType.d.ts +6 -8
- package/dist/generators/ts/BooleanType.js +18 -11
- package/dist/generators/ts/DateTimeType.d.ts +5 -1
- package/dist/generators/ts/DateTimeType.js +15 -13
- package/dist/generators/ts/DateType.d.ts +5 -1
- package/dist/generators/ts/DateType.js +16 -14
- package/dist/generators/ts/DefaultValueType.d.ts +5 -6
- package/dist/generators/ts/DefaultValueType.js +30 -64
- package/dist/generators/ts/FloatType.d.ts +3 -3
- package/dist/generators/ts/FloatType.js +5 -5
- package/dist/generators/ts/IdentifierType.d.ts +6 -6
- package/dist/generators/ts/IdentifierType.js +22 -2
- package/dist/generators/ts/IntType.d.ts +3 -3
- package/dist/generators/ts/IntType.js +5 -5
- package/dist/generators/ts/IriType.d.ts +17 -12
- package/dist/generators/ts/IriType.js +39 -29
- package/dist/generators/ts/LazyObjectOptionType.d.ts +2 -1
- package/dist/generators/ts/LazyObjectOptionType.js +23 -44
- package/dist/generators/ts/LazyObjectSetType.d.ts +1 -1
- package/dist/generators/ts/LazyObjectSetType.js +19 -29
- package/dist/generators/ts/LazyObjectType.d.ts +1 -1
- package/dist/generators/ts/LazyObjectType.js +17 -25
- package/dist/generators/ts/LiteralType.d.ts +5 -3
- package/dist/generators/ts/LiteralType.js +25 -12
- package/dist/generators/ts/NamedObjectType.d.ts +6 -9
- package/dist/generators/ts/NamedObjectType.js +33 -29
- package/dist/generators/ts/NamedObjectUnionType.d.ts +3 -1
- package/dist/generators/ts/NamedObjectUnionType.js +21 -14
- package/dist/generators/ts/OptionType.d.ts +4 -4
- package/dist/generators/ts/OptionType.js +22 -45
- package/dist/generators/ts/Reusables.d.ts +3 -1
- package/dist/generators/ts/Reusables.js +2 -1
- package/dist/generators/ts/SetType.d.ts +0 -1
- package/dist/generators/ts/SetType.js +4 -22
- package/dist/generators/ts/SnippetFactory.d.ts +2 -0
- package/dist/generators/ts/Snippets.d.ts +40 -8
- package/dist/generators/ts/Snippets.js +235 -30
- package/dist/generators/ts/StringType.d.ts +6 -9
- package/dist/generators/ts/StringType.js +17 -16
- package/dist/generators/ts/TermType.d.ts +1 -4
- package/dist/generators/ts/TermType.js +14 -8
- package/dist/generators/ts/TsGenerator.d.ts +14 -1
- package/dist/generators/ts/TsGenerator.js +41 -12
- package/dist/generators/ts/TypeFactory.d.ts +8 -4
- package/dist/generators/ts/TypeFactory.js +73 -49
- package/dist/generators/ts/ZodGenerator.js +6 -3
- package/dist/generators/ts/_NamedObjectType/AbstractProperty.d.ts +27 -20
- package/dist/generators/ts/_NamedObjectType/AbstractProperty.js +4 -2
- package/dist/generators/ts/_NamedObjectType/DiscriminantProperty.d.ts +7 -7
- package/dist/generators/ts/_NamedObjectType/DiscriminantProperty.js +9 -9
- package/dist/generators/ts/_NamedObjectType/IdentifierProperty.d.ts +6 -6
- package/dist/generators/ts/_NamedObjectType/IdentifierProperty.js +35 -39
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_createFunctionDeclaration.js +34 -31
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_equalsFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromJsonFunctionDeclaration.js +7 -16
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceFunctionDeclaration.js +26 -32
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceValuesFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfTypeVariableStatement.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_graphqlTypeVariableStatement.js +2 -3
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_hashFunctionDeclarations.js +6 -8
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_isTypeFunctionDeclaration.js +1 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonParseFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonSchemaFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonTypeAliasDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonUiSchemaFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_objectSetMethodNames.d.ts +2 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_objectSetMethodNames.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_sparqlConstructQueryFunctionDeclaration.d.ts +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_sparqlConstructQueryFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.d.ts +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toJsonFunctionDeclaration.js +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toRdfResourceFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toStringFunctionDeclarations.js +14 -18
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlConstructTriplesFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlWherePatternsFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/ShaclProperty.d.ts +7 -7
- package/dist/generators/ts/_NamedObjectType/ShaclProperty.js +22 -30
- package/dist/generators/ts/_snippets/snippets_DefaultValueSchema.js +3 -3
- package/dist/generators/ts/_snippets/snippets_HashFunction.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_HashFunction.js +4 -0
- package/dist/generators/ts/_snippets/snippets_PropertyPath.js +34 -24
- package/dist/generators/ts/_snippets/snippets_convertToBigDecimal.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_convertToBigDecimal.js +6 -0
- package/dist/generators/ts/_snippets/snippets_convertToBlankNode.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_convertToBlankNode.js +11 -0
- package/dist/generators/ts/_snippets/snippets_convertToBlankNodeIdentifierProperty.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_convertToBlankNodeIdentifierProperty.js +17 -0
- package/dist/generators/ts/_snippets/snippets_convertToBoolean.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_convertToBoolean.js +6 -0
- package/dist/generators/ts/_snippets/snippets_convertToDate.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_convertToDate.js +6 -0
- package/dist/generators/ts/_snippets/snippets_convertToDateTime.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_convertToDateTime.js +6 -0
- package/dist/generators/ts/_snippets/snippets_convertToIdentifier.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_convertToIdentifier.js +13 -0
- package/dist/generators/ts/_snippets/snippets_convertToIdentifierProperty.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_convertToIdentifierProperty.js +21 -0
- package/dist/generators/ts/_snippets/snippets_convertToIri.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_convertToIri.js +11 -0
- package/dist/generators/ts/_snippets/snippets_convertToIriIdentifierProperty.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_convertToIriIdentifierProperty.js +17 -0
- package/dist/generators/ts/_snippets/snippets_convertToLazyObject.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_convertToLazyObject.js +15 -0
- package/dist/generators/ts/_snippets/snippets_convertToLazyObjectOption.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_convertToLazyObjectOption.js +31 -0
- package/dist/generators/ts/_snippets/snippets_convertToLazyObjectSet.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_convertToLazyObjectSet.js +25 -0
- package/dist/generators/ts/_snippets/snippets_convertToLiteral.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_convertToLiteral.js +13 -0
- package/dist/generators/ts/_snippets/snippets_convertToMaybe.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_convertToMaybe.js +19 -0
- package/dist/generators/ts/_snippets/snippets_convertToMutableArray.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_convertToMutableArray.js +14 -0
- package/dist/generators/ts/_snippets/snippets_convertToNumeric.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_convertToNumeric.js +6 -0
- package/dist/generators/ts/_snippets/snippets_convertToObject.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_convertToObject.js +6 -0
- package/dist/generators/ts/_snippets/snippets_convertToReadonlyArray.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_convertToReadonlyArray.js +14 -0
- package/dist/generators/ts/_snippets/snippets_convertToString.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_convertToString.js +6 -0
- package/dist/generators/ts/_snippets/snippets_convertToTerm.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_convertToTerm.js +6 -0
- package/dist/generators/ts/_snippets/snippets_convertToUnion.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_convertToUnion.js +6 -0
- package/dist/generators/ts/_snippets/snippets_convertWithDefaultValue.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_convertWithDefaultValue.js +11 -0
- package/dist/generators/ts/_snippets/snippets_defaultValueSparqlWherePatterns.js +1 -1
- package/dist/generators/ts/_snippets/snippets_hashArray.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_hashArray.js +11 -0
- package/dist/generators/ts/_snippets/snippets_hashBigDecimal.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_hashBigDecimal.js +7 -0
- package/dist/generators/ts/_snippets/snippets_hashBoolean.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_hashBoolean.js +7 -0
- package/dist/generators/ts/_snippets/snippets_hashDate.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_hashDate.js +7 -0
- package/dist/generators/ts/_snippets/snippets_hashDateTime.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_hashDateTime.js +7 -0
- package/dist/generators/ts/_snippets/snippets_hashMaybe.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_hashMaybe.js +11 -0
- package/dist/generators/ts/_snippets/snippets_hashNumeric.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_hashNumeric.js +7 -0
- package/dist/generators/ts/_snippets/snippets_hashString.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_hashString.js +7 -0
- package/dist/generators/ts/_snippets/snippets_hashTerm.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_hashTerm.js +12 -0
- package/dist/generators/ts/_snippets/snippets_toIsoDateString.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_toIsoDateString.js +6 -0
- package/dist/generators/ts/graphqlSchemaVariableStatement.d.ts +1 -1
- package/dist/generators/ts/graphqlSchemaVariableStatement.js +7 -4
- package/dist/generators/ts/objectSetDeclarations.js +4 -34
- package/dist/generators/ts/objectSetInterfaceDeclaration.js +1 -1
- package/dist/generators/ts/objectSetMethodSignatures.js +2 -2
- package/dist/generators/ts/rdfjsDatasetObjectSetClassDeclaration.js +2 -2
- package/dist/generators/ts/sparqlObjectSetClassDeclaration.js +2 -2
- package/dist/input/ShapesGraph.d.ts +5 -8
- package/dist/input/ShapesGraph.js +5 -6
- package/dist/input/generated.d.ts +171 -226
- package/dist/input/generated.js +563 -2082
- package/package.json +2 -2
- package/dist/_ShapesGraphToAstTransformer/nodeShapeTsFeatures.d.ts +0 -6
- package/dist/_ShapesGraphToAstTransformer/nodeShapeTsFeatures.js +0 -67
- package/dist/generators/ts/_snippets/snippets_isReadonlyBigIntArray.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_isReadonlyBigIntArray.js +0 -6
- package/dist/generators/ts/_snippets/snippets_isReadonlyBooleanArray.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_isReadonlyBooleanArray.js +0 -6
- package/dist/generators/ts/_snippets/snippets_isReadonlyNumberArray.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_isReadonlyNumberArray.js +0 -6
- package/dist/generators/ts/_snippets/snippets_isReadonlyObjectArray.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_isReadonlyObjectArray.js +0 -6
- package/dist/generators/ts/_snippets/snippets_isReadonlyStringArray.d.ts +0 -3
- package/dist/generators/ts/_snippets/snippets_isReadonlyStringArray.js +0 -6
- package/dist/generators/ts/syntheticNamePrefix.d.ts +0 -2
- package/dist/generators/ts/syntheticNamePrefix.js +0 -2
|
@@ -4,27 +4,16 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import {
|
|
7
|
+
import { LiteralDecoder } from "@rdfx/literal";
|
|
8
8
|
import { Memoize } from "typescript-memoize";
|
|
9
9
|
import { AbstractNumericType } from "./AbstractNumericType.js";
|
|
10
10
|
import { code, joinCode, literalOf } from "./ts-poet-wrapper.js";
|
|
11
11
|
export class BigIntType extends AbstractNumericType {
|
|
12
12
|
kind = "BigIntType";
|
|
13
|
-
typeofs =
|
|
13
|
+
typeofs = ["bigint"];
|
|
14
14
|
get graphqlType() {
|
|
15
15
|
return new AbstractNumericType.GraphqlType(code `${this.reusables.imports.GraphQLBigInt}`, this.reusables);
|
|
16
16
|
}
|
|
17
|
-
get conversions() {
|
|
18
|
-
if (this.in_.length > 0) {
|
|
19
|
-
return super.conversions;
|
|
20
|
-
}
|
|
21
|
-
return super.conversions.concat({
|
|
22
|
-
conversionExpression: (value) => code `BigInt(${value})`,
|
|
23
|
-
sourceTypeCheckExpression: (value) => code `typeof ${value} === "number"`,
|
|
24
|
-
sourceTypeName: "number",
|
|
25
|
-
sourceTypeof: "number",
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
17
|
fromJsonExpression({ variables, }) {
|
|
29
18
|
let expression = code `BigInt(${variables.value})`;
|
|
30
19
|
if (this.primitiveIn.length > 0) {
|
|
@@ -45,15 +34,15 @@ export class BigIntType extends AbstractNumericType {
|
|
|
45
34
|
jsonType() {
|
|
46
35
|
return new AbstractNumericType.JsonType(code `string`);
|
|
47
36
|
}
|
|
37
|
+
literalExpression(literal) {
|
|
38
|
+
return code `${typeof literal === "bigint" ? literal : LiteralDecoder.decodeBigIntLiteral(literal).unsafeCoerce()}n`;
|
|
39
|
+
}
|
|
48
40
|
toJsonExpression({ variables, }) {
|
|
49
41
|
return code `${variables.value}.toString()`;
|
|
50
42
|
}
|
|
51
43
|
fromRdfResourceValueExpression({ variables, }) {
|
|
52
44
|
return code `${variables.value}.toBigInt(${this.primitiveIn.length > 0 ? `[${this.primitiveIn.map((_) => `${_}n`).join(", ")}] as const` : ""})`;
|
|
53
45
|
}
|
|
54
|
-
literalOf(value) {
|
|
55
|
-
return `${value.toString()}n`;
|
|
56
|
-
}
|
|
57
46
|
}
|
|
58
47
|
__decorate([
|
|
59
48
|
Memoize()
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { BlankNode
|
|
1
|
+
import type { BlankNode } from "@rdfjs/types";
|
|
2
2
|
import { AbstractIdentifierType } from "./AbstractIdentifierType.js";
|
|
3
|
-
import { AbstractTermType } from "./AbstractTermType.js";
|
|
4
3
|
import { type Code } from "./ts-poet-wrapper.js";
|
|
5
4
|
export declare class BlankNodeType extends AbstractIdentifierType<BlankNode> {
|
|
5
|
+
readonly conversionFunction: AbstractIdentifierType.ConversionFunction;
|
|
6
6
|
readonly filterFunction: Code;
|
|
7
7
|
readonly filterType: Code;
|
|
8
8
|
readonly parseFunction: Code;
|
|
@@ -12,11 +12,11 @@ export declare class BlankNodeType extends AbstractIdentifierType<BlankNode> {
|
|
|
12
12
|
readonly schemaType: Code;
|
|
13
13
|
readonly valueSparqlWherePatternsFunction: Code;
|
|
14
14
|
constructor(superParameters: Omit<ConstructorParameters<typeof AbstractIdentifierType<BlankNode>>[0], "hasValues" | "in_">);
|
|
15
|
-
fromJsonExpression({ variables, }: Parameters<
|
|
16
|
-
jsonType(parameters?: Parameters<
|
|
17
|
-
jsonSchema({ includeDiscriminantProperty, }: Parameters<
|
|
18
|
-
toJsonExpression({ includeDiscriminantProperty, variables, }: Parameters<
|
|
19
|
-
protected fromRdfExpressionChain({ variables, }: Parameters<
|
|
15
|
+
fromJsonExpression({ variables, }: Parameters<AbstractIdentifierType<BlankNode>["fromJsonExpression"]>[0]): Code;
|
|
16
|
+
jsonType(parameters?: Parameters<AbstractIdentifierType<BlankNode>["jsonType"]>[0]): AbstractIdentifierType.JsonType;
|
|
17
|
+
jsonSchema({ includeDiscriminantProperty, }: Parameters<AbstractIdentifierType<BlankNode>["jsonSchema"]>[0]): Code;
|
|
18
|
+
toJsonExpression({ includeDiscriminantProperty, variables, }: Parameters<AbstractIdentifierType<BlankNode>["toJsonExpression"]>[0]): Code;
|
|
19
|
+
protected fromRdfExpressionChain({ variables, }: Parameters<AbstractIdentifierType<BlankNode>["fromRdfExpressionChain"]>[0]): {
|
|
20
20
|
valueTo: Code;
|
|
21
21
|
hasValues?: Code;
|
|
22
22
|
languageIn?: Code;
|
|
@@ -6,9 +6,21 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { Memoize } from "typescript-memoize";
|
|
8
8
|
import { AbstractIdentifierType } from "./AbstractIdentifierType.js";
|
|
9
|
-
import { AbstractTermType } from "./AbstractTermType.js";
|
|
10
9
|
import { code } from "./ts-poet-wrapper.js";
|
|
11
10
|
export class BlankNodeType extends AbstractIdentifierType {
|
|
11
|
+
conversionFunction = {
|
|
12
|
+
code: code `${this.reusables.snippets.convertToBlankNode}`,
|
|
13
|
+
sourceTypes: [
|
|
14
|
+
{
|
|
15
|
+
name: code `${this.reusables.imports.BlankNode}`,
|
|
16
|
+
typeof: "object",
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
name: "undefined",
|
|
20
|
+
typeof: "undefined",
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
};
|
|
12
24
|
filterFunction = code `${this.reusables.snippets.filterBlankNode}`;
|
|
13
25
|
filterType = code `${this.reusables.snippets.BlankNodeFilter}`;
|
|
14
26
|
parseFunction = code `${this.reusables.snippets.parseBlankNode};`;
|
|
@@ -31,7 +43,7 @@ export class BlankNodeType extends AbstractIdentifierType {
|
|
|
31
43
|
const discriminantProperty = parameters?.includeDiscriminantProperty
|
|
32
44
|
? `, readonly termType: "BlankNode"`
|
|
33
45
|
: "";
|
|
34
|
-
return new
|
|
46
|
+
return new AbstractIdentifierType.JsonType(code `{ readonly "@id": string${discriminantProperty} }`);
|
|
35
47
|
}
|
|
36
48
|
jsonSchema({ includeDiscriminantProperty, }) {
|
|
37
49
|
const discriminantProperty = includeDiscriminantProperty
|
|
@@ -1,21 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Literal } from "@rdfjs/types";
|
|
2
2
|
import { AbstractPrimitiveType } from "./AbstractPrimitiveType.js";
|
|
3
3
|
import { type Code } from "./ts-poet-wrapper.js";
|
|
4
4
|
export declare class BooleanType extends AbstractPrimitiveType<boolean> {
|
|
5
5
|
readonly filterFunction: Code;
|
|
6
6
|
readonly filterType: Code;
|
|
7
|
+
readonly graphqlType: import("./AbstractType.js").AbstractType.GraphqlType;
|
|
8
|
+
readonly hashFunction: Code;
|
|
7
9
|
readonly kind = "BooleanType";
|
|
8
10
|
readonly schemaType: Code;
|
|
11
|
+
readonly typeofs: "boolean"[];
|
|
9
12
|
readonly valueSparqlWherePatternsFunction: Code;
|
|
10
|
-
|
|
11
|
-
get graphqlType(): import("./AbstractType.js").AbstractType.GraphqlType;
|
|
13
|
+
get conversionFunction(): AbstractPrimitiveType.ConversionFunction;
|
|
12
14
|
get name(): string;
|
|
13
|
-
protected get schemaObject(): {
|
|
14
|
-
in: boolean[] | undefined;
|
|
15
|
-
languageIn: import("ts-poet/build/Node.js").Node[] | undefined;
|
|
16
|
-
kind: Code;
|
|
17
|
-
};
|
|
18
15
|
jsonSchema(_parameters: Parameters<AbstractPrimitiveType<number>["jsonSchema"]>[0]): Code;
|
|
16
|
+
literalExpression(literal: boolean | Literal): Code;
|
|
19
17
|
toRdfResourceValuesExpression({ variables, }: Parameters<AbstractPrimitiveType<boolean>["toRdfResourceValuesExpression"]>[0]): Code;
|
|
20
18
|
protected fromRdfExpressionChain({ variables, }: Parameters<AbstractPrimitiveType<boolean>["fromRdfExpressionChain"]>[0]): ReturnType<AbstractPrimitiveType<boolean>["fromRdfExpressionChain"]>;
|
|
21
19
|
}
|
|
@@ -4,19 +4,29 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import {
|
|
7
|
+
import { LiteralDecoder } from "@rdfx/literal";
|
|
8
8
|
import { Memoize } from "typescript-memoize";
|
|
9
9
|
import { AbstractPrimitiveType } from "./AbstractPrimitiveType.js";
|
|
10
10
|
import { code } from "./ts-poet-wrapper.js";
|
|
11
11
|
export class BooleanType extends AbstractPrimitiveType {
|
|
12
12
|
filterFunction = code `${this.reusables.snippets.filterBoolean}`;
|
|
13
13
|
filterType = code `${this.reusables.snippets.BooleanFilter}`;
|
|
14
|
+
graphqlType = new AbstractPrimitiveType.GraphqlType(code `${this.reusables.imports.GraphQLBoolean}`, this.reusables);
|
|
15
|
+
hashFunction = code `${this.reusables.snippets.hashBoolean}`;
|
|
14
16
|
kind = "BooleanType";
|
|
15
17
|
schemaType = code `${this.reusables.snippets.BooleanSchema}`;
|
|
18
|
+
typeofs = ["boolean"];
|
|
16
19
|
valueSparqlWherePatternsFunction = code `${this.reusables.snippets.booleanSparqlWherePatterns}`;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
get conversionFunction() {
|
|
21
|
+
return {
|
|
22
|
+
code: code `${this.reusables.snippets.convertToBoolean}<${this.name}>`,
|
|
23
|
+
sourceTypes: [
|
|
24
|
+
{
|
|
25
|
+
name: this.name,
|
|
26
|
+
typeof: "boolean",
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
};
|
|
20
30
|
}
|
|
21
31
|
get name() {
|
|
22
32
|
if (this.primitiveIn.length > 0) {
|
|
@@ -24,18 +34,15 @@ export class BooleanType extends AbstractPrimitiveType {
|
|
|
24
34
|
}
|
|
25
35
|
return `boolean`;
|
|
26
36
|
}
|
|
27
|
-
get schemaObject() {
|
|
28
|
-
return {
|
|
29
|
-
...super.schemaObject,
|
|
30
|
-
in: this.primitiveIn.length > 0 ? this.primitiveIn.concat() : undefined,
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
37
|
jsonSchema(_parameters) {
|
|
34
38
|
if (this.primitiveIn.length === 1) {
|
|
35
39
|
return code `${this.reusables.imports.z}.literal(${this.primitiveIn[0]})`;
|
|
36
40
|
}
|
|
37
41
|
return code `${this.reusables.imports.z}.boolean()`;
|
|
38
42
|
}
|
|
43
|
+
literalExpression(literal) {
|
|
44
|
+
return code `${typeof literal === "boolean" ? literal : LiteralDecoder.decodeBooleanLiteral(literal).unsafeCoerce()}`;
|
|
45
|
+
}
|
|
39
46
|
toRdfResourceValuesExpression({ variables, }) {
|
|
40
47
|
return code `[${this.reusables.snippets.literalFactory}.boolean(${variables.value}, ${this.rdfjsTermExpression(this.datatype)})]`;
|
|
41
48
|
}
|
|
@@ -50,7 +57,7 @@ export class BooleanType extends AbstractPrimitiveType {
|
|
|
50
57
|
}
|
|
51
58
|
__decorate([
|
|
52
59
|
Memoize()
|
|
53
|
-
], BooleanType.prototype, "
|
|
60
|
+
], BooleanType.prototype, "conversionFunction", null);
|
|
54
61
|
__decorate([
|
|
55
62
|
Memoize()
|
|
56
63
|
], BooleanType.prototype, "name", null);
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
import type { Literal } from "@rdfjs/types";
|
|
1
2
|
import { AbstractDateType } from "./AbstractDateType.js";
|
|
2
3
|
import { type Code } from "./ts-poet-wrapper.js";
|
|
3
4
|
export declare class DateTimeType extends AbstractDateType {
|
|
5
|
+
readonly conversionFunction: AbstractDateType.ConversionFunction;
|
|
6
|
+
readonly graphqlType: import("./AbstractType.js").AbstractType.GraphqlType;
|
|
7
|
+
readonly hashFunction: Code;
|
|
4
8
|
readonly kind = "DateTimeType";
|
|
5
|
-
get graphqlType(): import("./AbstractType.js").AbstractType.GraphqlType;
|
|
6
9
|
jsonSchema(_parameters: Parameters<AbstractDateType["jsonSchema"]>[0]): Code;
|
|
10
|
+
literalExpression(literal: Date | Literal): Code;
|
|
7
11
|
toJsonExpression({ variables, }: Parameters<AbstractDateType["toJsonExpression"]>[0]): Code;
|
|
8
12
|
protected fromRdfResourceValueExpression({ variables, }: Parameters<AbstractDateType["fromRdfResourceValueExpression"]>[0]): Code;
|
|
9
13
|
}
|
|
@@ -1,20 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { Memoize } from "typescript-memoize";
|
|
1
|
+
import { LiteralDecoder } from "@rdfx/literal";
|
|
8
2
|
import { AbstractDateType } from "./AbstractDateType.js";
|
|
9
3
|
import { code } from "./ts-poet-wrapper.js";
|
|
10
4
|
export class DateTimeType extends AbstractDateType {
|
|
5
|
+
conversionFunction = {
|
|
6
|
+
code: code `${this.reusables.snippets.convertToDateTime}`,
|
|
7
|
+
sourceTypes: [
|
|
8
|
+
{
|
|
9
|
+
name: "Date",
|
|
10
|
+
typeof: "object",
|
|
11
|
+
},
|
|
12
|
+
],
|
|
13
|
+
};
|
|
14
|
+
graphqlType = new DateTimeType.GraphqlType(code `${this.reusables.imports.GraphQLDateTime}`, this.reusables);
|
|
15
|
+
hashFunction = code `${this.reusables.snippets.hashDateTime}`;
|
|
11
16
|
kind = "DateTimeType";
|
|
12
|
-
get graphqlType() {
|
|
13
|
-
return new DateTimeType.GraphqlType(code `${this.reusables.imports.GraphQLDateTime}`, this.reusables);
|
|
14
|
-
}
|
|
15
17
|
jsonSchema(_parameters) {
|
|
16
18
|
return code `${this.reusables.imports.z}.iso.datetime()`;
|
|
17
19
|
}
|
|
20
|
+
literalExpression(literal) {
|
|
21
|
+
return code `new Date("${(literal instanceof Date ? literal : LiteralDecoder.decodeDateTimeLiteral(literal).unsafeCoerce()).toISOString()}")`;
|
|
22
|
+
}
|
|
18
23
|
toJsonExpression({ variables, }) {
|
|
19
24
|
return code `${variables.value}.toISOString()`;
|
|
20
25
|
}
|
|
@@ -22,7 +27,4 @@ export class DateTimeType extends AbstractDateType {
|
|
|
22
27
|
return code `${variables.value}.toDateTime(${this.primitiveIn.length > 0 ? `[${this.primitiveIn.map((_) => `new Date(${_.getTime()})`).join(", ")}]` : ""})`;
|
|
23
28
|
}
|
|
24
29
|
}
|
|
25
|
-
__decorate([
|
|
26
|
-
Memoize()
|
|
27
|
-
], DateTimeType.prototype, "graphqlType", null);
|
|
28
30
|
//# sourceMappingURL=DateTimeType.js.map
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
+
import type { Literal } from "@rdfjs/types";
|
|
1
2
|
import { AbstractDateType } from "./AbstractDateType.js";
|
|
2
3
|
import { DateTimeType } from "./DateTimeType.js";
|
|
3
4
|
import { type Code } from "./ts-poet-wrapper.js";
|
|
4
5
|
export declare class DateType extends AbstractDateType {
|
|
6
|
+
readonly conversionFunction: AbstractDateType.ConversionFunction;
|
|
7
|
+
readonly graphqlType: import("./AbstractType.js").AbstractType.GraphqlType;
|
|
8
|
+
readonly hashFunction: Code;
|
|
5
9
|
readonly kind = "DateType";
|
|
6
|
-
get graphqlType(): import("./AbstractType.js").AbstractType.GraphqlType;
|
|
7
10
|
jsonSchema(_parameters: Parameters<DateTimeType["jsonSchema"]>[0]): Code;
|
|
11
|
+
literalExpression(literal: Date | Literal): Code;
|
|
8
12
|
toJsonExpression({ variables, }: Parameters<AbstractDateType["toJsonExpression"]>[0]): Code;
|
|
9
13
|
protected fromRdfResourceValueExpression({ variables, }: Parameters<AbstractDateType["fromRdfResourceValueExpression"]>[0]): Code;
|
|
10
14
|
}
|
|
@@ -1,29 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { Memoize } from "typescript-memoize";
|
|
1
|
+
import { LiteralDecoder } from "@rdfx/literal";
|
|
8
2
|
import { AbstractDateType } from "./AbstractDateType.js";
|
|
9
3
|
import { DateTimeType } from "./DateTimeType.js";
|
|
10
4
|
import { code } from "./ts-poet-wrapper.js";
|
|
11
5
|
export class DateType extends AbstractDateType {
|
|
6
|
+
conversionFunction = {
|
|
7
|
+
code: code `${this.reusables.snippets.convertToDate}`,
|
|
8
|
+
sourceTypes: [
|
|
9
|
+
{
|
|
10
|
+
name: "Date",
|
|
11
|
+
typeof: "object",
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
};
|
|
15
|
+
graphqlType = new DateTimeType.GraphqlType(code `${this.reusables.imports.GraphQLDate}`, this.reusables);
|
|
16
|
+
hashFunction = code `${this.reusables.snippets.hashDate}`;
|
|
12
17
|
kind = "DateType";
|
|
13
|
-
get graphqlType() {
|
|
14
|
-
return new DateTimeType.GraphqlType(code `${this.reusables.imports.GraphQLDate}`, this.reusables);
|
|
15
|
-
}
|
|
16
18
|
jsonSchema(_parameters) {
|
|
17
19
|
return code `${this.reusables.imports.z}.iso.date()`;
|
|
18
20
|
}
|
|
21
|
+
literalExpression(literal) {
|
|
22
|
+
return code `new Date("${(literal instanceof Date ? literal : LiteralDecoder.decodeDateLiteral(literal).unsafeCoerce()).toISOString()}")`;
|
|
23
|
+
}
|
|
19
24
|
toJsonExpression({ variables, }) {
|
|
20
|
-
return code `${variables.value}
|
|
25
|
+
return code `${this.reusables.snippets.toIsoDateString}(${variables.value})`;
|
|
21
26
|
}
|
|
22
27
|
fromRdfResourceValueExpression({ variables, }) {
|
|
23
28
|
return code `${variables.value}.toDate(${this.primitiveIn.length > 0 ? `[${this.primitiveIn.map((_) => `new Date(${_.getTime()})`).join(", ")}]` : ""})`;
|
|
24
29
|
}
|
|
25
30
|
}
|
|
26
|
-
__decorate([
|
|
27
|
-
Memoize()
|
|
28
|
-
], DateType.prototype, "graphqlType", null);
|
|
29
31
|
//# sourceMappingURL=DateType.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Literal, NamedNode } from "@rdfjs/types";
|
|
2
|
-
import { Maybe
|
|
2
|
+
import { Maybe } from "purify-ts";
|
|
3
3
|
import { AbstractContainerType } from "./AbstractContainerType.js";
|
|
4
4
|
import type { AbstractType } from "./AbstractType.js";
|
|
5
5
|
import type { BlankNodeType } from "./BlankNodeType.js";
|
|
@@ -10,15 +10,16 @@ export declare class DefaultValueType<ItemTypeT extends DefaultValueType.ItemTyp
|
|
|
10
10
|
readonly discriminantProperty: Maybe<AbstractType.DiscriminantProperty>;
|
|
11
11
|
readonly graphqlArgs: AbstractType["graphqlArgs"];
|
|
12
12
|
readonly kind = "DefaultValueType";
|
|
13
|
-
readonly typeofs:
|
|
13
|
+
readonly typeofs: "object"[];
|
|
14
14
|
constructor({ defaultValue, ...superParameters }: {
|
|
15
15
|
defaultValue: Literal | NamedNode;
|
|
16
16
|
} & ConstructorParameters<typeof AbstractContainerType<ItemTypeT>>[0]);
|
|
17
|
-
get
|
|
17
|
+
get conversionFunction(): AbstractContainerType.ConversionFunction;
|
|
18
18
|
get equalsFunction(): Code;
|
|
19
19
|
get filterFunction(): Code;
|
|
20
20
|
get filterType(): Code;
|
|
21
21
|
get graphqlType(): AbstractContainerType.GraphqlType;
|
|
22
|
+
get hashFunction(): Code;
|
|
22
23
|
get mutable(): boolean;
|
|
23
24
|
get name(): Code | string;
|
|
24
25
|
get schemaType(): Code;
|
|
@@ -29,12 +30,10 @@ export declare class DefaultValueType<ItemTypeT extends DefaultValueType.ItemTyp
|
|
|
29
30
|
item: Code;
|
|
30
31
|
kind: Code;
|
|
31
32
|
};
|
|
32
|
-
private get
|
|
33
|
-
private get defaultValueTermExpression();
|
|
33
|
+
private get defaultValueExpression();
|
|
34
34
|
fromJsonExpression(parameters: Parameters<AbstractType["fromJsonExpression"]>[0]): Code;
|
|
35
35
|
fromRdfResourceValuesExpression({ variables, }: Parameters<AbstractContainerType<ItemTypeT>["fromRdfResourceValuesExpression"]>[0]): Code;
|
|
36
36
|
graphqlResolveExpression(parameters: Parameters<AbstractContainerType<ItemTypeT>["graphqlResolveExpression"]>[0]): Code;
|
|
37
|
-
hashStatements(parameters: Parameters<AbstractContainerType<ItemTypeT>["hashStatements"]>[0]): readonly Code[];
|
|
38
37
|
jsonSchema(parameters: Parameters<AbstractContainerType<ItemTypeT>["jsonSchema"]>[0]): Code;
|
|
39
38
|
jsonType(parameters?: Parameters<AbstractContainerType<ItemTypeT>["jsonType"]>[0]): AbstractType.JsonType;
|
|
40
39
|
jsonUiSchemaElement(parameters: Parameters<AbstractContainerType<ItemTypeT>["jsonUiSchemaElement"]>[0]): Maybe<Code>;
|
|
@@ -4,33 +4,32 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import {
|
|
8
|
-
import { Maybe, NonEmptyList } from "purify-ts";
|
|
7
|
+
import { Maybe } from "purify-ts";
|
|
9
8
|
import { invariant } from "ts-invariant";
|
|
10
9
|
import { Memoize } from "typescript-memoize";
|
|
11
10
|
import { AbstractContainerType } from "./AbstractContainerType.js";
|
|
12
|
-
import { code
|
|
11
|
+
import { code } from "./ts-poet-wrapper.js";
|
|
13
12
|
export class DefaultValueType extends AbstractContainerType {
|
|
14
13
|
defaultValue;
|
|
15
14
|
discriminantProperty = Maybe.empty();
|
|
16
15
|
graphqlArgs = Maybe.empty();
|
|
17
16
|
kind = "DefaultValueType";
|
|
18
|
-
typeofs =
|
|
17
|
+
typeofs = ["object"];
|
|
19
18
|
constructor({ defaultValue, ...superParameters }) {
|
|
20
19
|
super(superParameters);
|
|
21
20
|
this.defaultValue = defaultValue;
|
|
22
21
|
}
|
|
23
|
-
get
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
22
|
+
get conversionFunction() {
|
|
23
|
+
const itemConversionFunction = this.itemType.conversionFunction;
|
|
24
|
+
return {
|
|
25
|
+
code: code `${this.reusables.snippets.convertWithDefaultValue}(${itemConversionFunction.code})`,
|
|
26
|
+
sourceTypes: itemConversionFunction.sourceTypes
|
|
27
|
+
.filter((sourceType) => sourceType.typeof !== "undefined")
|
|
28
|
+
.concat({
|
|
29
|
+
name: "undefined",
|
|
30
|
+
typeof: "undefined",
|
|
31
|
+
}),
|
|
32
|
+
};
|
|
34
33
|
}
|
|
35
34
|
get equalsFunction() {
|
|
36
35
|
return this.itemType.equalsFunction;
|
|
@@ -44,6 +43,9 @@ export class DefaultValueType extends AbstractContainerType {
|
|
|
44
43
|
get graphqlType() {
|
|
45
44
|
return this.itemType.graphqlType;
|
|
46
45
|
}
|
|
46
|
+
get hashFunction() {
|
|
47
|
+
return this.itemType.hashFunction;
|
|
48
|
+
}
|
|
47
49
|
get mutable() {
|
|
48
50
|
return this.itemType.mutable;
|
|
49
51
|
}
|
|
@@ -51,7 +53,7 @@ export class DefaultValueType extends AbstractContainerType {
|
|
|
51
53
|
return this.itemType.name;
|
|
52
54
|
}
|
|
53
55
|
get schemaType() {
|
|
54
|
-
return code `${this.reusables.snippets.DefaultValueSchema}
|
|
56
|
+
return code `${this.reusables.snippets.DefaultValueSchema}<${this.itemType.name}, ${this.itemType.schemaType}>`;
|
|
55
57
|
}
|
|
56
58
|
get valueSparqlConstructTriplesFunction() {
|
|
57
59
|
return this.itemType.valueSparqlConstructTriplesFunction;
|
|
@@ -62,56 +64,25 @@ export class DefaultValueType extends AbstractContainerType {
|
|
|
62
64
|
get schemaObject() {
|
|
63
65
|
return {
|
|
64
66
|
...super.schemaObject,
|
|
65
|
-
defaultValue: this.
|
|
67
|
+
defaultValue: this.defaultValueExpression,
|
|
66
68
|
};
|
|
67
69
|
}
|
|
68
|
-
get
|
|
70
|
+
get defaultValueExpression() {
|
|
69
71
|
switch (this.itemType.kind) {
|
|
70
|
-
case "BigDecimalType":
|
|
71
|
-
invariant(this.defaultValue.termType === "Literal");
|
|
72
|
-
return Maybe.of(code `new ${this.reusables.imports.BigDecimal}(${literalOf(this.defaultValue.value)})`);
|
|
73
|
-
case "BigIntType":
|
|
74
|
-
invariant(this.defaultValue.termType === "Literal");
|
|
75
|
-
return Maybe.of(code `${LiteralDecoder.decodeBigIntLiteral(this.defaultValue).unsafeCoerce()}n`);
|
|
76
|
-
case "BooleanType":
|
|
77
|
-
invariant(this.defaultValue.termType === "Literal");
|
|
78
|
-
return Maybe.of(code `${LiteralDecoder.decodeBooleanLiteral(this.defaultValue).unsafeCoerce()}`);
|
|
79
|
-
case "DateType":
|
|
80
|
-
invariant(this.defaultValue.termType === "Literal");
|
|
81
|
-
return Maybe.of(code `new Date("${LiteralDecoder.decodeDateLiteral(this.defaultValue).unsafeCoerce().toISOString()}")`);
|
|
82
|
-
case "DateTimeType":
|
|
83
|
-
invariant(this.defaultValue.termType === "Literal");
|
|
84
|
-
return Maybe.of(code `new Date("${LiteralDecoder.decodeDateTimeLiteral(this.defaultValue).unsafeCoerce().toISOString()}")`);
|
|
85
|
-
case "FloatType":
|
|
86
|
-
invariant(this.defaultValue.termType === "Literal");
|
|
87
|
-
return Maybe.of(code `${LiteralDecoder.decodeFloatLiteral(this.defaultValue).unsafeCoerce()}`);
|
|
88
|
-
case "IntType":
|
|
89
|
-
invariant(this.defaultValue.termType === "Literal");
|
|
90
|
-
return Maybe.of(code `${LiteralDecoder.decodeIntLiteral(this.defaultValue).unsafeCoerce()}`);
|
|
91
|
-
case "StringType":
|
|
92
|
-
invariant(this.defaultValue.termType === "Literal");
|
|
93
|
-
return Maybe.of(code `${literalOf(this.defaultValue.value)}`);
|
|
94
72
|
case "IdentifierType":
|
|
95
73
|
case "IriType":
|
|
96
|
-
invariant(this.defaultValue.termType === "NamedNode");
|
|
97
|
-
return Maybe.of(this.defaultValueTermExpression);
|
|
98
74
|
case "LiteralType":
|
|
99
75
|
case "TermType":
|
|
100
|
-
|
|
101
|
-
return Maybe.of(this.defaultValueTermExpression);
|
|
76
|
+
return this.rdfjsTermExpression(this.defaultValue);
|
|
102
77
|
case "AnonymousUnionType":
|
|
103
78
|
case "ListType":
|
|
104
79
|
case "NamedObjectType":
|
|
105
80
|
case "NamedObjectUnionType":
|
|
106
81
|
case "NamedUnionType":
|
|
107
|
-
|
|
108
|
-
default:
|
|
109
|
-
this.itemType;
|
|
110
|
-
throw new Error("should never reach this point");
|
|
82
|
+
throw new RangeError(`not implemented ${this.itemType.kind}`);
|
|
111
83
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
return this.rdfjsTermExpression(this.defaultValue);
|
|
84
|
+
invariant(this.defaultValue.termType === "Literal");
|
|
85
|
+
return this.itemType.literalExpression(this.defaultValue);
|
|
115
86
|
}
|
|
116
87
|
fromJsonExpression(parameters) {
|
|
117
88
|
return this.itemType.fromJsonExpression(parameters);
|
|
@@ -120,16 +91,13 @@ export class DefaultValueType extends AbstractContainerType {
|
|
|
120
91
|
return this.itemType.fromRdfResourceValuesExpression({
|
|
121
92
|
variables: {
|
|
122
93
|
...variables,
|
|
123
|
-
resourceValues: code `${variables.resourceValues}.map(values => values.length > 0 ? values : new ${this.reusables.imports.Resource}.Value(${{ dataFactory: this.reusables.imports.dataFactory, focusResource: variables.resource, propertyPath: variables.propertyPath, term: this.
|
|
94
|
+
resourceValues: code `${variables.resourceValues}.map(values => values.length > 0 ? values : new ${this.reusables.imports.Resource}.Value(${{ dataFactory: this.reusables.imports.dataFactory, focusResource: variables.resource, propertyPath: variables.propertyPath, term: this.rdfjsTermExpression(this.defaultValue) }}).toValues())`,
|
|
124
95
|
},
|
|
125
96
|
});
|
|
126
97
|
}
|
|
127
98
|
graphqlResolveExpression(parameters) {
|
|
128
99
|
return this.itemType.graphqlResolveExpression(parameters);
|
|
129
100
|
}
|
|
130
|
-
hashStatements(parameters) {
|
|
131
|
-
return this.itemType.hashStatements(parameters);
|
|
132
|
-
}
|
|
133
101
|
jsonSchema(parameters) {
|
|
134
102
|
return this.itemType.jsonSchema(parameters);
|
|
135
103
|
}
|
|
@@ -144,14 +112,15 @@ export class DefaultValueType extends AbstractContainerType {
|
|
|
144
112
|
}
|
|
145
113
|
toRdfResourceValuesExpression(parameters) {
|
|
146
114
|
const { variables } = parameters;
|
|
147
|
-
return this.
|
|
148
|
-
.map((defaultValuePrimitiveExpression) => code `${this.itemType.equalsFunction}(${variables.value}, ${defaultValuePrimitiveExpression}).isLeft() ? ${this.itemType.toRdfResourceValuesExpression(parameters)} : []`)
|
|
149
|
-
.orDefault(code `${this.itemType.toRdfResourceValuesExpression(parameters)}.filter(value => !value.equals(${this.defaultValueTermExpression}))`);
|
|
115
|
+
return code `${this.itemType.equalsFunction}(${variables.value}, ${this.defaultValueExpression}).isLeft() ? ${this.itemType.toRdfResourceValuesExpression(parameters)} : []`;
|
|
150
116
|
}
|
|
151
117
|
toStringExpression(parameters) {
|
|
152
118
|
return this.itemType.toStringExpression(parameters);
|
|
153
119
|
}
|
|
154
120
|
}
|
|
121
|
+
__decorate([
|
|
122
|
+
Memoize()
|
|
123
|
+
], DefaultValueType.prototype, "conversionFunction", null);
|
|
155
124
|
__decorate([
|
|
156
125
|
Memoize()
|
|
157
126
|
], DefaultValueType.prototype, "schemaType", null);
|
|
@@ -163,10 +132,7 @@ __decorate([
|
|
|
163
132
|
], DefaultValueType.prototype, "valueSparqlWherePatternsFunction", null);
|
|
164
133
|
__decorate([
|
|
165
134
|
Memoize()
|
|
166
|
-
], DefaultValueType.prototype, "
|
|
167
|
-
__decorate([
|
|
168
|
-
Memoize()
|
|
169
|
-
], DefaultValueType.prototype, "defaultValueTermExpression", null);
|
|
135
|
+
], DefaultValueType.prototype, "defaultValueExpression", null);
|
|
170
136
|
(function (DefaultValueType) {
|
|
171
137
|
function isItemType(type) {
|
|
172
138
|
if (type.kind === "BlankNodeType") {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Literal } from "@rdfjs/types";
|
|
2
2
|
import { AbstractNumericType } from "./AbstractNumericType.js";
|
|
3
3
|
import { type Code } from "./ts-poet-wrapper.js";
|
|
4
4
|
export declare class FloatType extends AbstractNumericType<number> {
|
|
5
5
|
readonly kind = "FloatType";
|
|
6
|
-
readonly typeofs:
|
|
6
|
+
readonly typeofs: "number"[];
|
|
7
7
|
get graphqlType(): import("./AbstractType.js").AbstractType.GraphqlType;
|
|
8
|
+
literalExpression(literal: Literal | number): Code;
|
|
8
9
|
protected fromRdfResourceValueExpression({ variables, }: Parameters<AbstractNumericType<number>["fromRdfResourceValueExpression"]>[0]): Code;
|
|
9
|
-
protected literalOf(value: number): string;
|
|
10
10
|
}
|
|
11
11
|
//# sourceMappingURL=FloatType.d.ts.map
|
|
@@ -4,22 +4,22 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import {
|
|
7
|
+
import { LiteralDecoder } from "@rdfx/literal";
|
|
8
8
|
import { Memoize } from "typescript-memoize";
|
|
9
9
|
import { AbstractNumericType } from "./AbstractNumericType.js";
|
|
10
10
|
import { code } from "./ts-poet-wrapper.js";
|
|
11
11
|
export class FloatType extends AbstractNumericType {
|
|
12
12
|
kind = "FloatType";
|
|
13
|
-
typeofs =
|
|
13
|
+
typeofs = ["number"];
|
|
14
14
|
get graphqlType() {
|
|
15
15
|
return new AbstractNumericType.GraphqlType(code `${this.reusables.imports.GraphQLFloat}`, this.reusables);
|
|
16
16
|
}
|
|
17
|
+
literalExpression(literal) {
|
|
18
|
+
return code `${typeof literal === "number" ? literal : LiteralDecoder.decodeFloatLiteral(literal).unsafeCoerce()}`;
|
|
19
|
+
}
|
|
17
20
|
fromRdfResourceValueExpression({ variables, }) {
|
|
18
21
|
return code `${variables.value}.toFloat(${this.primitiveIn.length > 0 ? `${JSON.stringify(this.primitiveIn)} as const` : ""})`;
|
|
19
22
|
}
|
|
20
|
-
literalOf(value) {
|
|
21
|
-
return value.toString();
|
|
22
|
-
}
|
|
23
23
|
}
|
|
24
24
|
__decorate([
|
|
25
25
|
Memoize()
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { BlankNode, NamedNode } from "@rdfjs/types";
|
|
2
2
|
import { type IdentifierNodeKind } from "@shaclmate/shacl-ast";
|
|
3
3
|
import { AbstractIdentifierType } from "./AbstractIdentifierType.js";
|
|
4
|
-
import { AbstractTermType } from "./AbstractTermType.js";
|
|
5
4
|
import { type Code } from "./ts-poet-wrapper.js";
|
|
6
5
|
export declare class IdentifierType extends AbstractIdentifierType<BlankNode | NamedNode> {
|
|
6
|
+
readonly conversionFunction: AbstractIdentifierType.ConversionFunction;
|
|
7
7
|
readonly filterFunction: Code;
|
|
8
8
|
readonly filterType: Code;
|
|
9
9
|
readonly parseFunction: Code;
|
|
@@ -13,10 +13,10 @@ export declare class IdentifierType extends AbstractIdentifierType<BlankNode | N
|
|
|
13
13
|
readonly schemaType: Code;
|
|
14
14
|
readonly valueSparqlWherePatternsFunction: Code;
|
|
15
15
|
constructor(parameters: Omit<ConstructorParameters<typeof AbstractIdentifierType<BlankNode | NamedNode>>[0], "hasValues" | "in_">);
|
|
16
|
-
fromJsonExpression({ variables, }: Parameters<
|
|
17
|
-
jsonType(parameters?: Parameters<
|
|
18
|
-
jsonSchema({ includeDiscriminantProperty, }: Parameters<
|
|
19
|
-
toJsonExpression({ includeDiscriminantProperty, variables, }: Parameters<
|
|
20
|
-
protected fromRdfExpressionChain({ variables, }: Parameters<
|
|
16
|
+
fromJsonExpression({ variables, }: Parameters<AbstractIdentifierType<BlankNode | NamedNode>["fromJsonExpression"]>[0]): Code;
|
|
17
|
+
jsonType(parameters?: Parameters<AbstractIdentifierType<BlankNode | NamedNode>["jsonType"]>[0]): AbstractIdentifierType.JsonType;
|
|
18
|
+
jsonSchema({ includeDiscriminantProperty, }: Parameters<AbstractIdentifierType<BlankNode | NamedNode>["jsonSchema"]>[0]): Code;
|
|
19
|
+
toJsonExpression({ includeDiscriminantProperty, variables, }: Parameters<AbstractIdentifierType<BlankNode | NamedNode>["toJsonExpression"]>[0]): Code;
|
|
20
|
+
protected fromRdfExpressionChain({ variables, }: Parameters<AbstractIdentifierType<BlankNode | NamedNode>["fromRdfExpressionChain"]>[0]): ReturnType<AbstractIdentifierType<BlankNode | NamedNode>["fromRdfExpressionChain"]>;
|
|
21
21
|
}
|
|
22
22
|
//# sourceMappingURL=IdentifierType.d.ts.map
|