@shaclmate/compiler 4.0.91 → 4.0.93
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/generators/ts/AbstractNumericType.d.ts +1 -0
- package/dist/generators/ts/AbstractPrimitiveType.d.ts +0 -7
- package/dist/generators/ts/AbstractPrimitiveType.js +0 -7
- package/dist/generators/ts/BigDecimalType.d.ts +6 -8
- package/dist/generators/ts/BigDecimalType.js +27 -10
- package/dist/generators/ts/BigIntType.d.ts +2 -0
- package/dist/generators/ts/BigIntType.js +26 -0
- package/dist/generators/ts/BooleanType.d.ts +2 -0
- package/dist/generators/ts/BooleanType.js +2 -0
- package/dist/generators/ts/DefaultValueType.d.ts +2 -1
- package/dist/generators/ts/FloatType.d.ts +2 -0
- package/dist/generators/ts/FloatType.js +2 -0
- package/dist/generators/ts/IntType.d.ts +2 -0
- package/dist/generators/ts/IntType.js +2 -0
- package/dist/generators/ts/Snippets.d.ts +2 -0
- package/dist/generators/ts/Snippets.js +14 -0
- package/dist/generators/ts/StringType.d.ts +3 -1
- package/dist/generators/ts/StringType.js +5 -3
- package/dist/generators/ts/_AbstractDiscriminatedUnionType/AbstractDiscriminatedUnionType_conversionFunctionExpression.js +2 -0
- package/dist/generators/ts/_snippets/snippets_NamespaceBuilder.js +1 -1
- package/dist/generators/ts/_snippets/snippets_convertToBigDecimal.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_convertToBigDecimal.js +5 -0
- package/dist/generators/ts/_snippets/snippets_convertToBigInt.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_convertToBigInt.js +5 -0
- package/package.json +6 -2
|
@@ -13,6 +13,7 @@ export declare abstract class AbstractNumericType<ValueT extends bigint | number
|
|
|
13
13
|
toRdfResourceValuesExpression({ variables, }: Parameters<AbstractPrimitiveType<string>["toRdfResourceValuesExpression"]>[0]): Code;
|
|
14
14
|
}
|
|
15
15
|
export declare namespace AbstractNumericType {
|
|
16
|
+
type ConversionFunction = AbstractPrimitiveType.ConversionFunction;
|
|
16
17
|
const JsonType: typeof import("./_AbstractType/AbstractType_JsonType.js").AbstractType_JsonType;
|
|
17
18
|
type JsonType = AbstractPrimitiveType.JsonType;
|
|
18
19
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { Primitive } from "@rdfx/literal";
|
|
2
|
-
import { Maybe } from "purify-ts";
|
|
3
2
|
import { AbstractLiteralType } from "./AbstractLiteralType.js";
|
|
4
3
|
import { AbstractTypedLiteralType } from "./AbstractTypedLiteralType.js";
|
|
5
4
|
import { type Code } from "./ts-poet-wrapper.js";
|
|
@@ -7,12 +6,6 @@ import { type Code } from "./ts-poet-wrapper.js";
|
|
|
7
6
|
* Abstract base class of typed literals whose datatype corresponds to a JavaScript primitive type.
|
|
8
7
|
*/
|
|
9
8
|
export declare abstract class AbstractPrimitiveType<ValueT extends Primitive> extends AbstractTypedLiteralType<ValueT> {
|
|
10
|
-
/**
|
|
11
|
-
* Primitive types have no conversion functions to avoid source type overlap with other primitive types.
|
|
12
|
-
*
|
|
13
|
-
* A property that can take on multiple primitive types should be a union.
|
|
14
|
-
*/
|
|
15
|
-
readonly conversionFunction: Maybe<AbstractLiteralType.ConversionFunction>;
|
|
16
9
|
readonly equalsFunction: Code;
|
|
17
10
|
protected get inlineExpression(): Code;
|
|
18
11
|
fromJsonExpression({ variables, }: Parameters<AbstractLiteralType["fromJsonExpression"]>[0]): Code;
|
|
@@ -4,7 +4,6 @@ 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 { Maybe } from "purify-ts";
|
|
8
7
|
import { Memoize } from "typescript-memoize";
|
|
9
8
|
import { AbstractLiteralType } from "./AbstractLiteralType.js";
|
|
10
9
|
import { AbstractTypedLiteralType } from "./AbstractTypedLiteralType.js";
|
|
@@ -13,12 +12,6 @@ import { arrayOf, code, joinCode } from "./ts-poet-wrapper.js";
|
|
|
13
12
|
* Abstract base class of typed literals whose datatype corresponds to a JavaScript primitive type.
|
|
14
13
|
*/
|
|
15
14
|
export class AbstractPrimitiveType extends AbstractTypedLiteralType {
|
|
16
|
-
/**
|
|
17
|
-
* Primitive types have no conversion functions to avoid source type overlap with other primitive types.
|
|
18
|
-
*
|
|
19
|
-
* A property that can take on multiple primitive types should be a union.
|
|
20
|
-
*/
|
|
21
|
-
conversionFunction = Maybe.empty();
|
|
22
15
|
equalsFunction = code `${this.reusables.snippets.strictEquals}`;
|
|
23
16
|
get inlineExpression() {
|
|
24
17
|
if (this.in_.length > 0) {
|
|
@@ -6,18 +6,16 @@ import { AbstractTypedLiteralType } from "./AbstractTypedLiteralType.js";
|
|
|
6
6
|
import { type Code } from "./ts-poet-wrapper.js";
|
|
7
7
|
export declare class BigDecimalType extends AbstractTypedLiteralType<Decimal> {
|
|
8
8
|
protected readonly inlineExpression: Code;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
readonly jsTypes: readonly [{
|
|
10
|
+
readonly className: Code;
|
|
11
|
+
readonly instanceof: "class";
|
|
12
|
+
readonly typeof: "object";
|
|
13
|
+
}];
|
|
12
14
|
readonly conversionFunction: Maybe<AbstractLiteralType.ConversionFunction>;
|
|
13
15
|
readonly filterFunction: Code;
|
|
14
16
|
readonly filterType: Code;
|
|
15
17
|
readonly fromRdfResourceValuesFunction: Code;
|
|
16
18
|
readonly hashFunction: Code;
|
|
17
|
-
readonly jsTypes: readonly [{
|
|
18
|
-
readonly instanceof: "Object";
|
|
19
|
-
readonly typeof: "object";
|
|
20
|
-
}];
|
|
21
19
|
readonly kind = "BigDecimal";
|
|
22
20
|
readonly schemaType: Code;
|
|
23
21
|
readonly valueSparqlWherePatternsFunction: Code;
|
|
@@ -26,8 +24,8 @@ export declare class BigDecimalType extends AbstractTypedLiteralType<Decimal> {
|
|
|
26
24
|
graphqlResolveExpression({ variables, }: Parameters<AbstractLiteralType["graphqlResolveExpression"]>[0]): Code;
|
|
27
25
|
jsonSchema(): Code;
|
|
28
26
|
jsonType(): AbstractLiteralType.JsonType;
|
|
29
|
-
valueExpression(literal: Literal): Code;
|
|
30
27
|
toJsonExpression({ variables, }: Parameters<AbstractTypedLiteralType<Decimal>["toJsonExpression"]>[0]): Code;
|
|
31
28
|
toRdfResourceValuesExpression({ variables, }: Parameters<AbstractLiteralType["toRdfResourceValuesExpression"]>[0]): Code;
|
|
29
|
+
valueExpression(literal: Literal): Code;
|
|
32
30
|
}
|
|
33
31
|
//# sourceMappingURL=BigDecimalType.d.ts.map
|
|
@@ -11,17 +11,34 @@ import { AbstractTypedLiteralType } from "./AbstractTypedLiteralType.js";
|
|
|
11
11
|
import { code, literalOf } from "./ts-poet-wrapper.js";
|
|
12
12
|
export class BigDecimalType extends AbstractTypedLiteralType {
|
|
13
13
|
inlineExpression = code `${this.reusables.imports.BigDecimal}`;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
jsTypes = [
|
|
15
|
+
{
|
|
16
|
+
className: code `${this.reusables.imports.BigDecimal}`,
|
|
17
|
+
instanceof: "class",
|
|
18
|
+
typeof: "object",
|
|
19
|
+
},
|
|
20
|
+
];
|
|
21
|
+
conversionFunction = Maybe.of({
|
|
22
|
+
code: code `${this.reusables.snippets.convertToBigDecimal}`,
|
|
23
|
+
sourceTypes: [
|
|
24
|
+
{
|
|
25
|
+
expression: code `${this.reusables.imports.BigDecimal}`,
|
|
26
|
+
jsType: this.jsTypes[0],
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
expression: code `number`,
|
|
30
|
+
jsType: { typeof: "number" },
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
expression: code `string`,
|
|
34
|
+
jsType: { typeof: "string" },
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
});
|
|
18
38
|
filterFunction = code `${this.reusables.snippets.filterBigDecimal}`;
|
|
19
39
|
filterType = code `${this.reusables.snippets.NumericFilter}<${this.reusables.imports.BigDecimal}>`;
|
|
20
40
|
fromRdfResourceValuesFunction = code `${this.reusables.snippets.bigDecimalFromRdfResourceValues}`;
|
|
21
41
|
hashFunction = code `${this.reusables.snippets.hashBigDecimal}`;
|
|
22
|
-
jsTypes = [
|
|
23
|
-
{ instanceof: "Object", typeof: "object" },
|
|
24
|
-
];
|
|
25
42
|
kind = "BigDecimal";
|
|
26
43
|
schemaType = code `${this.reusables.snippets.NumericSchema}<${this.reusables.imports.BigDecimal}>`;
|
|
27
44
|
valueSparqlWherePatternsFunction = code `${this.reusables.snippets.bigDecimalSparqlWherePatterns}`;
|
|
@@ -40,15 +57,15 @@ export class BigDecimalType extends AbstractTypedLiteralType {
|
|
|
40
57
|
jsonType() {
|
|
41
58
|
return new AbstractLiteralType.JsonType(code `{ readonly "@type": ${literalOf(this.datatype.value)}, readonly "@value": string }`);
|
|
42
59
|
}
|
|
43
|
-
valueExpression(literal) {
|
|
44
|
-
return code `new ${this.reusables.imports.BigDecimal}(${literalOf(literal.value)})`;
|
|
45
|
-
}
|
|
46
60
|
toJsonExpression({ variables, }) {
|
|
47
61
|
return code `{ "@type": ${literalOf(this.datatype.value)} as const, "@value": ${variables.value}.toFixed() }`;
|
|
48
62
|
}
|
|
49
63
|
toRdfResourceValuesExpression({ variables, }) {
|
|
50
64
|
return code `[${this.reusables.snippets.bigDecimalLiteral}(${variables.value})]`;
|
|
51
65
|
}
|
|
66
|
+
valueExpression(literal) {
|
|
67
|
+
return code `new ${this.reusables.imports.BigDecimal}(${literalOf(literal.value)})`;
|
|
68
|
+
}
|
|
52
69
|
}
|
|
53
70
|
__decorate([
|
|
54
71
|
Memoize()
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Literal } from "@rdfjs/types";
|
|
2
|
+
import { Maybe } from "purify-ts";
|
|
2
3
|
import { AbstractNumericType } from "./AbstractNumericType.js";
|
|
3
4
|
import { type Code } from "./ts-poet-wrapper.js";
|
|
4
5
|
export declare class BigIntType extends AbstractNumericType<bigint> {
|
|
@@ -6,6 +7,7 @@ export declare class BigIntType extends AbstractNumericType<bigint> {
|
|
|
6
7
|
readonly typeof: "bigint";
|
|
7
8
|
}[];
|
|
8
9
|
readonly kind = "BigInt";
|
|
10
|
+
get conversionFunction(): Maybe<AbstractNumericType.ConversionFunction>;
|
|
9
11
|
get fromRdfResourceValuesFunction(): Code;
|
|
10
12
|
get graphqlType(): import("./_AbstractType/AbstractType_GraphqlType.js").AbstractType_GraphqlType;
|
|
11
13
|
private get decodedIn();
|
|
@@ -5,12 +5,35 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { LiteralDecoder } from "@rdfx/literal";
|
|
8
|
+
import { Maybe } from "purify-ts";
|
|
8
9
|
import { Memoize } from "typescript-memoize";
|
|
9
10
|
import { AbstractNumericType } from "./AbstractNumericType.js";
|
|
10
11
|
import { arrayOf, code, joinCode, literalOf, } from "./ts-poet-wrapper.js";
|
|
11
12
|
export class BigIntType extends AbstractNumericType {
|
|
12
13
|
jsTypes = [{ typeof: "bigint" }];
|
|
13
14
|
kind = "BigInt";
|
|
15
|
+
get conversionFunction() {
|
|
16
|
+
if (this.in_.length > 0) {
|
|
17
|
+
return Maybe.empty();
|
|
18
|
+
}
|
|
19
|
+
return Maybe.of({
|
|
20
|
+
code: code `${this.reusables.snippets.convertToBigInt}`,
|
|
21
|
+
sourceTypes: [
|
|
22
|
+
{
|
|
23
|
+
expression: code `bigint`,
|
|
24
|
+
jsType: this.jsTypes[0],
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
expression: code `number`,
|
|
28
|
+
jsType: { typeof: "number" },
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
expression: code `string`,
|
|
32
|
+
jsType: { typeof: "string" },
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
});
|
|
36
|
+
}
|
|
14
37
|
get fromRdfResourceValuesFunction() {
|
|
15
38
|
return code `${this.reusables.snippets.bigIntFromRdfResourceValues}<${this.expression}>`;
|
|
16
39
|
}
|
|
@@ -58,6 +81,9 @@ export class BigIntType extends AbstractNumericType {
|
|
|
58
81
|
return code `${typeof literal === "bigint" ? literal : LiteralDecoder.decodeBigIntLiteral(literal).unsafeCoerce()}n`;
|
|
59
82
|
}
|
|
60
83
|
}
|
|
84
|
+
__decorate([
|
|
85
|
+
Memoize()
|
|
86
|
+
], BigIntType.prototype, "conversionFunction", null);
|
|
61
87
|
__decorate([
|
|
62
88
|
Memoize()
|
|
63
89
|
], BigIntType.prototype, "fromRdfResourceValuesFunction", null);
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { Literal } from "@rdfjs/types";
|
|
2
|
+
import { Maybe } from "purify-ts";
|
|
2
3
|
import { AbstractPrimitiveType } from "./AbstractPrimitiveType.js";
|
|
3
4
|
import { type Code } from "./ts-poet-wrapper.js";
|
|
4
5
|
export declare class BooleanType extends AbstractPrimitiveType<boolean> {
|
|
6
|
+
readonly conversionFunction: Maybe<AbstractPrimitiveType.ConversionFunction>;
|
|
5
7
|
readonly filterFunction: Code;
|
|
6
8
|
readonly filterType: Code;
|
|
7
9
|
readonly graphqlType: import("./_AbstractType/AbstractType_GraphqlType.js").AbstractType_GraphqlType;
|
|
@@ -5,10 +5,12 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { LiteralDecoder } from "@rdfx/literal";
|
|
8
|
+
import { Maybe } from "purify-ts";
|
|
8
9
|
import { Memoize } from "typescript-memoize";
|
|
9
10
|
import { AbstractPrimitiveType } from "./AbstractPrimitiveType.js";
|
|
10
11
|
import { code } from "./ts-poet-wrapper.js";
|
|
11
12
|
export class BooleanType extends AbstractPrimitiveType {
|
|
13
|
+
conversionFunction = Maybe.empty();
|
|
12
14
|
filterFunction = code `${this.reusables.snippets.filterBoolean}`;
|
|
13
15
|
filterType = code `${this.reusables.snippets.BooleanFilter}`;
|
|
14
16
|
graphqlType = new AbstractPrimitiveType.GraphqlType(code `${this.reusables.imports.GraphQLBoolean}`, this.reusables);
|
|
@@ -19,7 +19,8 @@ export declare class DefaultValueType<ItemTypeT extends DefaultValueType.ItemTyp
|
|
|
19
19
|
readonly instanceof: "Object";
|
|
20
20
|
readonly typeof: "object";
|
|
21
21
|
}] | readonly [{
|
|
22
|
-
readonly
|
|
22
|
+
readonly className: Code;
|
|
23
|
+
readonly instanceof: "class";
|
|
23
24
|
readonly typeof: "object";
|
|
24
25
|
}] | {
|
|
25
26
|
readonly typeof: "bigint";
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { Literal } from "@rdfjs/types";
|
|
2
|
+
import { Maybe } from "purify-ts";
|
|
2
3
|
import { AbstractNumericType } from "./AbstractNumericType.js";
|
|
3
4
|
import { type Code } from "./ts-poet-wrapper.js";
|
|
4
5
|
export declare class FloatType extends AbstractNumericType<number> {
|
|
6
|
+
readonly conversionFunction: Maybe<AbstractNumericType.ConversionFunction>;
|
|
5
7
|
readonly jsTypes: readonly [{
|
|
6
8
|
readonly typeof: "number";
|
|
7
9
|
}];
|
|
@@ -5,10 +5,12 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { LiteralDecoder } from "@rdfx/literal";
|
|
8
|
+
import { Maybe } from "purify-ts";
|
|
8
9
|
import { Memoize } from "typescript-memoize";
|
|
9
10
|
import { AbstractNumericType } from "./AbstractNumericType.js";
|
|
10
11
|
import { code } from "./ts-poet-wrapper.js";
|
|
11
12
|
export class FloatType extends AbstractNumericType {
|
|
13
|
+
conversionFunction = Maybe.empty();
|
|
12
14
|
jsTypes = [{ typeof: "number" }];
|
|
13
15
|
kind = "Float";
|
|
14
16
|
get fromRdfResourceValuesFunction() {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { Literal } from "@rdfjs/types";
|
|
2
|
+
import { Maybe } from "purify-ts";
|
|
2
3
|
import { AbstractNumericType } from "./AbstractNumericType.js";
|
|
3
4
|
import { type Code } from "./ts-poet-wrapper.js";
|
|
4
5
|
export declare class IntType extends AbstractNumericType<number> {
|
|
6
|
+
readonly conversionFunction: Maybe<AbstractNumericType.ConversionFunction>;
|
|
5
7
|
readonly jsTypes: readonly [{
|
|
6
8
|
readonly typeof: "number";
|
|
7
9
|
}];
|
|
@@ -5,10 +5,12 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { LiteralDecoder } from "@rdfx/literal";
|
|
8
|
+
import { Maybe } from "purify-ts";
|
|
8
9
|
import { Memoize } from "typescript-memoize";
|
|
9
10
|
import { AbstractNumericType } from "./AbstractNumericType.js";
|
|
10
11
|
import { code } from "./ts-poet-wrapper.js";
|
|
11
12
|
export class IntType extends AbstractNumericType {
|
|
13
|
+
conversionFunction = Maybe.empty();
|
|
12
14
|
jsTypes = [{ typeof: "number" }];
|
|
13
15
|
kind = "Int";
|
|
14
16
|
get fromRdfResourceValuesFunction() {
|
|
@@ -77,6 +77,8 @@ export declare class Snippets {
|
|
|
77
77
|
get booleanSparqlWherePatterns(): Snippet;
|
|
78
78
|
get compactRecord(): Snippet;
|
|
79
79
|
get convertToArraySet(): Snippet;
|
|
80
|
+
get convertToBigDecimal(): Snippet;
|
|
81
|
+
get convertToBigInt(): Snippet;
|
|
80
82
|
get convertToBlankNode(): Snippet;
|
|
81
83
|
get convertToBlankNodeIdentifierProperty(): Snippet;
|
|
82
84
|
get convertToIdentifier(): Snippet;
|
|
@@ -28,6 +28,8 @@ import { snippets_CollectionSchema } from "./_snippets/snippets_CollectionSchema
|
|
|
28
28
|
import { snippets_ConversionFunction } from "./_snippets/snippets_ConversionFunction.js";
|
|
29
29
|
import { snippets_compactRecord } from "./_snippets/snippets_compactRecord.js";
|
|
30
30
|
import { snippets_convertToArraySet } from "./_snippets/snippets_convertToArraySet.js";
|
|
31
|
+
import { snippets_convertToBigDecimal } from "./_snippets/snippets_convertToBigDecimal.js";
|
|
32
|
+
import { snippets_convertToBigInt } from "./_snippets/snippets_convertToBigInt.js";
|
|
31
33
|
import { snippets_convertToBlankNode } from "./_snippets/snippets_convertToBlankNode.js";
|
|
32
34
|
import { snippets_convertToBlankNodeIdentifierProperty } from "./_snippets/snippets_convertToBlankNodeIdentifierProperty.js";
|
|
33
35
|
import { snippets_convertToIdentifier } from "./_snippets/snippets_convertToIdentifier.js";
|
|
@@ -383,6 +385,12 @@ export class Snippets {
|
|
|
383
385
|
get convertToArraySet() {
|
|
384
386
|
return this.snippet(snippets_convertToArraySet);
|
|
385
387
|
}
|
|
388
|
+
get convertToBigDecimal() {
|
|
389
|
+
return this.snippet(snippets_convertToBigDecimal);
|
|
390
|
+
}
|
|
391
|
+
get convertToBigInt() {
|
|
392
|
+
return this.snippet(snippets_convertToBigInt);
|
|
393
|
+
}
|
|
386
394
|
get convertToBlankNode() {
|
|
387
395
|
return this.snippet(snippets_convertToBlankNode);
|
|
388
396
|
}
|
|
@@ -933,6 +941,12 @@ __decorate([
|
|
|
933
941
|
__decorate([
|
|
934
942
|
Memoize()
|
|
935
943
|
], Snippets.prototype, "convertToArraySet", null);
|
|
944
|
+
__decorate([
|
|
945
|
+
Memoize()
|
|
946
|
+
], Snippets.prototype, "convertToBigDecimal", null);
|
|
947
|
+
__decorate([
|
|
948
|
+
Memoize()
|
|
949
|
+
], Snippets.prototype, "convertToBigInt", null);
|
|
936
950
|
__decorate([
|
|
937
951
|
Memoize()
|
|
938
952
|
], Snippets.prototype, "convertToBlankNode", null);
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { Literal } from "@rdfjs/types";
|
|
2
|
+
import { Maybe } from "purify-ts";
|
|
2
3
|
import { AbstractPrimitiveType } from "./AbstractPrimitiveType.js";
|
|
3
4
|
import { type Code } from "./ts-poet-wrapper.js";
|
|
4
5
|
export declare class StringType extends AbstractPrimitiveType<string> {
|
|
5
6
|
private readonly languageIn;
|
|
7
|
+
readonly conversionFunction: Maybe<AbstractPrimitiveType.ConversionFunction>;
|
|
6
8
|
readonly filterFunction: Code;
|
|
7
9
|
readonly filterType: Code;
|
|
8
10
|
readonly graphqlType: import("./_AbstractType/AbstractType_GraphqlType.js").AbstractType_GraphqlType;
|
|
@@ -19,7 +21,7 @@ export declare class StringType extends AbstractPrimitiveType<string> {
|
|
|
19
21
|
get schemaType(): Code;
|
|
20
22
|
protected get schemaInitializers(): readonly Code[];
|
|
21
23
|
jsonSchema(parameters: Parameters<AbstractPrimitiveType<string>["jsonSchema"]>[0]): Code;
|
|
22
|
-
valueExpression(literal: Literal | string): Code;
|
|
23
24
|
toRdfResourceValuesExpression({ variables, }: Parameters<AbstractPrimitiveType<string>["toRdfResourceValuesExpression"]>[0]): Code;
|
|
25
|
+
valueExpression(literal: Literal | string): Code;
|
|
24
26
|
}
|
|
25
27
|
//# sourceMappingURL=StringType.d.ts.map
|
|
@@ -5,11 +5,13 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { xsd } from "@tpluscode/rdf-ns-builders";
|
|
8
|
+
import { Maybe } from "purify-ts";
|
|
8
9
|
import { Memoize } from "typescript-memoize";
|
|
9
10
|
import { AbstractPrimitiveType } from "./AbstractPrimitiveType.js";
|
|
10
11
|
import { arrayOf, code, literalOf } from "./ts-poet-wrapper.js";
|
|
11
12
|
export class StringType extends AbstractPrimitiveType {
|
|
12
13
|
languageIn;
|
|
14
|
+
conversionFunction = Maybe.empty();
|
|
13
15
|
filterFunction = code `${this.reusables.snippets.filterString}`;
|
|
14
16
|
filterType = code `${this.reusables.snippets.StringFilter}`;
|
|
15
17
|
graphqlType = new AbstractPrimitiveType.GraphqlType(code `${this.reusables.imports.GraphQLString}`, this.reusables);
|
|
@@ -51,12 +53,12 @@ export class StringType extends AbstractPrimitiveType {
|
|
|
51
53
|
}
|
|
52
54
|
return super.jsonSchema(parameters);
|
|
53
55
|
}
|
|
54
|
-
valueExpression(literal) {
|
|
55
|
-
return code `${literalOf(typeof literal === "string" ? literal : literal.value)}`;
|
|
56
|
-
}
|
|
57
56
|
toRdfResourceValuesExpression({ variables, }) {
|
|
58
57
|
return code `[${this.reusables.snippets.literalFactory}.string(${variables.value}${!this.datatype.equals(xsd.string) ? `, ${this.rdfjsTermExpression(this.datatype)}` : ""})]`;
|
|
59
58
|
}
|
|
59
|
+
valueExpression(literal) {
|
|
60
|
+
return code `${literalOf(typeof literal === "string" ? literal : literal.value)}`;
|
|
61
|
+
}
|
|
60
62
|
}
|
|
61
63
|
__decorate([
|
|
62
64
|
Memoize()
|
|
@@ -5,6 +5,8 @@ import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
|
5
5
|
export function AbstractDiscriminatedUnionType_conversionFunctionExpression() {
|
|
6
6
|
if (this.discriminant.kind === "Typeof") {
|
|
7
7
|
// If the members are discriminated by typeof, they can all be used as source types.
|
|
8
|
+
// Don't consider the member types' conversion functions, since the source types might overlap.
|
|
9
|
+
// Only consider the member types' declared type(s) (e.g., type.jsTypes).
|
|
8
10
|
return Maybe.of({
|
|
9
11
|
code: code `${this.reusables.snippets.identityConversionFunction}`,
|
|
10
12
|
sourceTypes: this.members.flatMap(({ type }) => type.jsTypes.map((jsType) => ({
|
|
@@ -3,7 +3,7 @@ export const snippets_NamespaceBuilder = ({ imports, syntheticNamePrefix, }) =>
|
|
|
3
3
|
/**
|
|
4
4
|
* NamespaceBuilder type excerpted from @rdfjs/namespace (MIT license) in lieu of a type import.
|
|
5
5
|
*/
|
|
6
|
-
type ${syntheticNamePrefix}NamespaceBuilder<TermNames extends string = any> = Record<TermNames, NamedNode> & {
|
|
6
|
+
export type ${syntheticNamePrefix}NamespaceBuilder<TermNames extends string = any> = Record<TermNames, NamedNode> & {
|
|
7
7
|
(property?: TemplateStringsArray | TermNames): ${imports.NamedNode};
|
|
8
8
|
};`);
|
|
9
9
|
//# sourceMappingURL=snippets_NamespaceBuilder.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
|
+
export const snippets_convertToBigDecimal = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}convertToBigDecimal`, code `\
|
|
3
|
+
const ${syntheticNamePrefix}convertToBigDecimal: ${snippets.ConversionFunction}<number | string | ${imports.BigDecimal}, ${imports.BigDecimal}> = (value) =>
|
|
4
|
+
${imports.Either}.encase(() => new ${imports.BigDecimal}(value));`);
|
|
5
|
+
//# sourceMappingURL=snippets_convertToBigDecimal.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
|
+
export const snippets_convertToBigInt = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}convertToBigInt`, code `\
|
|
3
|
+
const ${syntheticNamePrefix}convertToBigInt: ${snippets.ConversionFunction}<bigint | number | string, bigint> = (value) =>
|
|
4
|
+
${imports.Either}.encase(() => BigInt(value));`);
|
|
5
|
+
//# sourceMappingURL=snippets_convertToBigInt.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"dependencies": {
|
|
3
|
-
"@shaclmate/shacl-ast": "4.0.
|
|
3
|
+
"@shaclmate/shacl-ast": "4.0.93",
|
|
4
4
|
"@rdfjs/types": "~2.0.1",
|
|
5
5
|
"@rdfx/collection": "0.0.57",
|
|
6
6
|
"@rdfx/data-factory": "0.0.57",
|
|
@@ -483,6 +483,10 @@
|
|
|
483
483
|
"dist/generators/ts/_snippets/snippets_compactRecord.js",
|
|
484
484
|
"dist/generators/ts/_snippets/snippets_convertToArraySet.d.ts",
|
|
485
485
|
"dist/generators/ts/_snippets/snippets_convertToArraySet.js",
|
|
486
|
+
"dist/generators/ts/_snippets/snippets_convertToBigDecimal.d.ts",
|
|
487
|
+
"dist/generators/ts/_snippets/snippets_convertToBigDecimal.js",
|
|
488
|
+
"dist/generators/ts/_snippets/snippets_convertToBigInt.d.ts",
|
|
489
|
+
"dist/generators/ts/_snippets/snippets_convertToBigInt.js",
|
|
486
490
|
"dist/generators/ts/_snippets/snippets_convertToBlankNode.d.ts",
|
|
487
491
|
"dist/generators/ts/_snippets/snippets_convertToBlankNode.js",
|
|
488
492
|
"dist/generators/ts/_snippets/snippets_convertToBlankNodeIdentifierProperty.d.ts",
|
|
@@ -735,5 +739,5 @@
|
|
|
735
739
|
},
|
|
736
740
|
"type": "module",
|
|
737
741
|
"types": "./dist/index.d.ts",
|
|
738
|
-
"version": "4.0.
|
|
742
|
+
"version": "4.0.93"
|
|
739
743
|
}
|