@shaclmate/compiler 4.0.78 → 4.0.80
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/ast/AbstractCompoundType.d.ts +1 -1
- package/dist/ast/AbstractCompoundType.js +1 -1
- package/dist/ast/AbstractContainerType.d.ts +1 -1
- package/dist/ast/AbstractContainerType.js +1 -1
- package/dist/ast/ListType.d.ts +1 -1
- package/dist/ast/ListType.js +1 -1
- package/dist/ast/Type.d.ts +1 -1
- package/dist/ast/Type.js +2 -2
- package/dist/generators/ts/AbstractContainerType.d.ts +1 -1
- package/dist/generators/ts/AbstractContainerType.js +2 -2
- package/dist/generators/ts/AbstractDiscriminatedUnionType.d.ts +74 -0
- package/dist/generators/ts/AbstractDiscriminatedUnionType.js +430 -0
- package/dist/generators/ts/AbstractType.d.ts +5 -1
- package/dist/generators/ts/AbstractType.js +5 -0
- package/dist/generators/ts/DiscriminatedUnionType.d.ts +3 -70
- package/dist/generators/ts/DiscriminatedUnionType.js +2 -424
- package/dist/generators/ts/LazyOptionType.d.ts +1 -0
- package/dist/generators/ts/ListType.d.ts +1 -1
- package/dist/generators/ts/ListType.js +1 -1
- package/dist/generators/ts/ObjectDiscriminatedUnionType.d.ts +2 -3
- package/dist/generators/ts/ObjectDiscriminatedUnionType.js +2 -10
- package/dist/generators/ts/ObjectType.js +10 -2
- package/dist/generators/ts/Type.d.ts +1 -1
- package/dist/generators/ts/TypeFactory.d.ts +1 -1
- package/dist/generators/ts/{_DiscriminatedUnionType/DiscriminatedUnionType_Discriminant.d.ts → _AbstractDiscriminatedUnionType/AbstractDiscriminatedUnionType_Discriminant.d.ts} +2 -2
- package/dist/generators/ts/_AbstractDiscriminatedUnionType/AbstractDiscriminatedUnionType_Discriminant.js +2 -0
- package/dist/generators/ts/_AbstractDiscriminatedUnionType/AbstractDiscriminatedUnionType_conversionFunctionExpression.d.ts +6 -0
- package/dist/generators/ts/_AbstractDiscriminatedUnionType/AbstractDiscriminatedUnionType_conversionFunctionExpression.js +86 -0
- package/dist/generators/ts/_AbstractDiscriminatedUnionType/AbstractDiscriminatedUnionType_equalsFunctionExpression.d.ts +5 -0
- package/dist/generators/ts/{_DiscriminatedUnionType/DiscriminatedUnionType_equalsFunctionExpression.js → _AbstractDiscriminatedUnionType/AbstractDiscriminatedUnionType_equalsFunctionExpression.js} +2 -2
- package/dist/generators/ts/_AbstractDiscriminatedUnionType/AbstractDiscriminatedUnionType_filterFunctionExpression.d.ts +5 -0
- package/dist/generators/ts/{_DiscriminatedUnionType/DiscriminatedUnionType_filterFunctionExpression.js → _AbstractDiscriminatedUnionType/AbstractDiscriminatedUnionType_filterFunctionExpression.js} +2 -2
- package/dist/generators/ts/_AbstractDiscriminatedUnionType/AbstractDiscriminatedUnionType_filterTypeExpression.d.ts +5 -0
- package/dist/generators/ts/{_DiscriminatedUnionType/DiscriminatedUnionType_filterTypeExpression.js → _AbstractDiscriminatedUnionType/AbstractDiscriminatedUnionType_filterTypeExpression.js} +2 -2
- package/dist/generators/ts/_AbstractDiscriminatedUnionType/AbstractDiscriminatedUnionType_fromJsonFunctionExpression.d.ts +5 -0
- package/dist/generators/ts/{_DiscriminatedUnionType/DiscriminatedUnionType_fromJsonFunctionExpression.js → _AbstractDiscriminatedUnionType/AbstractDiscriminatedUnionType_fromJsonFunctionExpression.js} +2 -2
- package/dist/generators/ts/_AbstractDiscriminatedUnionType/AbstractDiscriminatedUnionType_fromRdfResourceValuesFunctionExpression.d.ts +5 -0
- package/dist/generators/ts/{_DiscriminatedUnionType/DiscriminatedUnionType_fromRdfResourceValuesFunctionExpression.js → _AbstractDiscriminatedUnionType/AbstractDiscriminatedUnionType_fromRdfResourceValuesFunctionExpression.js} +2 -2
- package/dist/generators/ts/_AbstractDiscriminatedUnionType/AbstractDiscriminatedUnionType_hashFunctionExpression.d.ts +5 -0
- package/dist/generators/ts/{_DiscriminatedUnionType/DiscriminatedUnionType_hashFunctionExpression.js → _AbstractDiscriminatedUnionType/AbstractDiscriminatedUnionType_hashFunctionExpression.js} +2 -2
- package/dist/generators/ts/_AbstractDiscriminatedUnionType/AbstractDiscriminatedUnionType_inferDiscriminant.d.ts +8 -0
- package/dist/generators/ts/{_DiscriminatedUnionType/DiscriminatedUnionType_inferDiscriminant.js → _AbstractDiscriminatedUnionType/AbstractDiscriminatedUnionType_inferDiscriminant.js} +2 -2
- package/dist/generators/ts/_AbstractDiscriminatedUnionType/AbstractDiscriminatedUnionType_inlineExpression.d.ts +5 -0
- package/dist/generators/ts/{_DiscriminatedUnionType/DiscriminatedUnionType_inlineExpression.js → _AbstractDiscriminatedUnionType/AbstractDiscriminatedUnionType_inlineExpression.js} +2 -2
- package/dist/generators/ts/_AbstractDiscriminatedUnionType/AbstractDiscriminatedUnionType_jsonSchemaExpression.d.ts +5 -0
- package/dist/generators/ts/{_DiscriminatedUnionType/DiscriminatedUnionType_jsonSchemaExpression.js → _AbstractDiscriminatedUnionType/AbstractDiscriminatedUnionType_jsonSchemaExpression.js} +2 -2
- package/dist/generators/ts/_AbstractDiscriminatedUnionType/AbstractDiscriminatedUnionType_jsonTypeLiteral.d.ts +5 -0
- package/dist/generators/ts/{_DiscriminatedUnionType/DiscriminatedUnionType_jsonTypeLiteral.js → _AbstractDiscriminatedUnionType/AbstractDiscriminatedUnionType_jsonTypeLiteral.js} +2 -2
- package/dist/generators/ts/_AbstractDiscriminatedUnionType/AbstractDiscriminatedUnionType_schemaTypeExpression.d.ts +5 -0
- package/dist/generators/ts/{_DiscriminatedUnionType/DiscriminatedUnionType_schemaTypeExpression.js → _AbstractDiscriminatedUnionType/AbstractDiscriminatedUnionType_schemaTypeExpression.js} +2 -2
- package/dist/generators/ts/_AbstractDiscriminatedUnionType/AbstractDiscriminatedUnionType_toJsonFunctionExpression.d.ts +5 -0
- package/dist/generators/ts/{_DiscriminatedUnionType/DiscriminatedUnionType_toJsonFunctionExpression.js → _AbstractDiscriminatedUnionType/AbstractDiscriminatedUnionType_toJsonFunctionExpression.js} +2 -2
- package/dist/generators/ts/_AbstractDiscriminatedUnionType/AbstractDiscriminatedUnionType_toRdfResourceValuesFunctionExpression.d.ts +5 -0
- package/dist/generators/ts/{_DiscriminatedUnionType/DiscriminatedUnionType_toRdfResourceValuesFunctionExpression.js → _AbstractDiscriminatedUnionType/AbstractDiscriminatedUnionType_toRdfResourceValuesFunctionExpression.js} +2 -2
- package/dist/generators/ts/_AbstractDiscriminatedUnionType/AbstractDiscriminatedUnionType_toStringFunctionExpression.d.ts +5 -0
- package/dist/generators/ts/{_DiscriminatedUnionType/DiscriminatedUnionType_toStringFunctionExpression.js → _AbstractDiscriminatedUnionType/AbstractDiscriminatedUnionType_toStringFunctionExpression.js} +2 -2
- package/dist/generators/ts/_AbstractDiscriminatedUnionType/AbstractDiscriminatedUnionType_valueSparqlConstructTriplesFunctionExpression.d.ts +5 -0
- package/dist/generators/ts/{_DiscriminatedUnionType/DiscriminatedUnionType_valueSparqlConstructTriplesFunctionExpression.js → _AbstractDiscriminatedUnionType/AbstractDiscriminatedUnionType_valueSparqlConstructTriplesFunctionExpression.js} +2 -2
- package/dist/generators/ts/_AbstractDiscriminatedUnionType/AbstractDiscriminatedUnionType_valueSparqlWherePatternsFunctionExpression.d.ts +5 -0
- package/dist/generators/ts/{_DiscriminatedUnionType/DiscriminatedUnionType_valueSparqlWherePatternsFunctionExpression.js → _AbstractDiscriminatedUnionType/AbstractDiscriminatedUnionType_valueSparqlWherePatternsFunctionExpression.js} +2 -2
- package/dist/generators/ts/_AbstractType/AbstractType_ConversionFunction.d.ts +9 -3
- package/dist/generators/ts/_AbstractType/AbstractType_ConversionFunction.js +18 -1
- package/dist/input/input.shaclmate.d.ts +116 -100
- package/dist/input/input.shaclmate.js +144 -130
- package/package.json +40 -36
- package/dist/generators/ts/_DiscriminatedUnionType/DiscriminatedUnionType_Discriminant.js +0 -2
- package/dist/generators/ts/_DiscriminatedUnionType/DiscriminatedUnionType_equalsFunctionExpression.d.ts +0 -5
- package/dist/generators/ts/_DiscriminatedUnionType/DiscriminatedUnionType_filterFunctionExpression.d.ts +0 -5
- package/dist/generators/ts/_DiscriminatedUnionType/DiscriminatedUnionType_filterTypeExpression.d.ts +0 -5
- package/dist/generators/ts/_DiscriminatedUnionType/DiscriminatedUnionType_fromJsonFunctionExpression.d.ts +0 -5
- package/dist/generators/ts/_DiscriminatedUnionType/DiscriminatedUnionType_fromRdfResourceValuesFunctionExpression.d.ts +0 -5
- package/dist/generators/ts/_DiscriminatedUnionType/DiscriminatedUnionType_hashFunctionExpression.d.ts +0 -5
- package/dist/generators/ts/_DiscriminatedUnionType/DiscriminatedUnionType_inferDiscriminant.d.ts +0 -8
- package/dist/generators/ts/_DiscriminatedUnionType/DiscriminatedUnionType_inlineExpression.d.ts +0 -5
- package/dist/generators/ts/_DiscriminatedUnionType/DiscriminatedUnionType_jsonSchemaExpression.d.ts +0 -5
- package/dist/generators/ts/_DiscriminatedUnionType/DiscriminatedUnionType_jsonTypeLiteral.d.ts +0 -5
- package/dist/generators/ts/_DiscriminatedUnionType/DiscriminatedUnionType_schemaTypeExpression.d.ts +0 -5
- package/dist/generators/ts/_DiscriminatedUnionType/DiscriminatedUnionType_toJsonFunctionExpression.d.ts +0 -5
- package/dist/generators/ts/_DiscriminatedUnionType/DiscriminatedUnionType_toRdfResourceValuesFunctionExpression.d.ts +0 -5
- package/dist/generators/ts/_DiscriminatedUnionType/DiscriminatedUnionType_toStringFunctionExpression.d.ts +0 -5
- package/dist/generators/ts/_DiscriminatedUnionType/DiscriminatedUnionType_valueSparqlConstructTriplesFunctionExpression.d.ts +0 -5
- package/dist/generators/ts/_DiscriminatedUnionType/DiscriminatedUnionType_valueSparqlWherePatternsFunctionExpression.d.ts +0 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AbstractType } from "../AbstractType.js";
|
|
2
2
|
import type { Typeof } from "../Typeof.js";
|
|
3
|
-
export type
|
|
3
|
+
export type AbstractDiscriminatedUnionType_Discriminant = ExtrinsicDiscriminant | HybridDiscriminant | IntrinsicDiscriminant | TypeofDiscriminant;
|
|
4
4
|
type ExtrinsicDiscriminant = {
|
|
5
5
|
readonly jsonName: string;
|
|
6
6
|
readonly kind: "Extrinsic";
|
|
@@ -27,4 +27,4 @@ type TypeofDiscriminant = {
|
|
|
27
27
|
readonly memberValues: readonly Typeof[];
|
|
28
28
|
};
|
|
29
29
|
export {};
|
|
30
|
-
//# sourceMappingURL=
|
|
30
|
+
//# sourceMappingURL=AbstractDiscriminatedUnionType_Discriminant.d.ts.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
|
+
import type { AbstractDiscriminatedUnionType } from "../AbstractDiscriminatedUnionType.js";
|
|
3
|
+
import { AbstractType } from "../AbstractType.js";
|
|
4
|
+
import type { Type } from "../Type.js";
|
|
5
|
+
export declare function AbstractDiscriminatedUnionType_conversionFunctionExpression<MemberTypeT extends Type>(this: AbstractDiscriminatedUnionType<MemberTypeT>): Maybe<AbstractType.ConversionFunction>;
|
|
6
|
+
//# sourceMappingURL=AbstractDiscriminatedUnionType_conversionFunctionExpression.d.ts.map
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
|
+
import { invariant } from "ts-invariant";
|
|
3
|
+
import { AbstractType } from "../AbstractType.js";
|
|
4
|
+
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
5
|
+
export function AbstractDiscriminatedUnionType_conversionFunctionExpression() {
|
|
6
|
+
if (this.discriminant.kind === "Typeof") {
|
|
7
|
+
// If the members are discriminated by typeof, they can all be used as source types.
|
|
8
|
+
return Maybe.of({
|
|
9
|
+
code: code `${this.reusables.snippets.identityConversionFunction}`,
|
|
10
|
+
sourceTypes: this.members.flatMap(({ type }) => type.jsTypes.map((jsType) => ({
|
|
11
|
+
expression: type.expression,
|
|
12
|
+
jsType,
|
|
13
|
+
}))),
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
if (this.discriminant.kind === "Intrinsic") {
|
|
17
|
+
// Allow discriminated unions with intrinsic discriminants (e.g., a "termType" property) to accept additional
|
|
18
|
+
// source types with typeofs besides "object".
|
|
19
|
+
// @rdfx/builder relies on discriminated unions of IRI | SomeObjectType and forces SomeObjectType to use the discriminant property
|
|
20
|
+
// "termType" so the two members share it. These properties should accept (keyof DefaultNamespaceT & string) | NamedNode | SomeObjectType source types --
|
|
21
|
+
// the "string" typeof for IRI and then "object" identity typeofs for the IRI and SomeObjectType, respectively.
|
|
22
|
+
const memberIdentitySourceTypes = [];
|
|
23
|
+
const otherMemberConversionsByTypeof = new Map();
|
|
24
|
+
for (const member of this.members) {
|
|
25
|
+
const memberConversionFunction = member.type.conversionFunction.extract();
|
|
26
|
+
const memberIdentitySourceType = {
|
|
27
|
+
expression: member.type.expression,
|
|
28
|
+
jsType: {
|
|
29
|
+
instanceof: "Object",
|
|
30
|
+
typeof: "object",
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
memberIdentitySourceTypes.push(memberIdentitySourceType);
|
|
34
|
+
if (!memberConversionFunction) {
|
|
35
|
+
// Identity conversion
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
const memberSourceTypes = memberConversionFunction.sourceTypes;
|
|
39
|
+
invariant(memberSourceTypes.length > 1, "member type should return Maybe.empty() instead of returning an identity conversion alone");
|
|
40
|
+
let haveMemberIdentitySourceType = false;
|
|
41
|
+
for (const memberSourceType of memberSourceTypes) {
|
|
42
|
+
if (AbstractType.ConversionFunction.SourceType.equals(memberSourceType, memberIdentitySourceType)) {
|
|
43
|
+
haveMemberIdentitySourceType = true;
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
if (memberSourceType.jsType.typeof === "object") {
|
|
47
|
+
this.logger.debug("%s: member type %s conversion function has more than one source type with typeof === 'object'", this, member.type);
|
|
48
|
+
return Maybe.empty();
|
|
49
|
+
}
|
|
50
|
+
if (otherMemberConversionsByTypeof.has(memberSourceType.jsType.typeof)) {
|
|
51
|
+
this.logger.debug("%s: member type %s conversion function has a source type with the same non-object typeof as another member type", this, member.type);
|
|
52
|
+
return Maybe.empty();
|
|
53
|
+
}
|
|
54
|
+
otherMemberConversionsByTypeof.set(memberSourceType.jsType.typeof, [
|
|
55
|
+
memberSourceType,
|
|
56
|
+
memberConversionFunction,
|
|
57
|
+
]);
|
|
58
|
+
}
|
|
59
|
+
invariant(haveMemberIdentitySourceType, "member conversion source types should include the member type itself");
|
|
60
|
+
}
|
|
61
|
+
invariant(memberIdentitySourceTypes.length === this.members.length);
|
|
62
|
+
if (otherMemberConversionsByTypeof.size === 0) {
|
|
63
|
+
return Maybe.empty();
|
|
64
|
+
}
|
|
65
|
+
const otherMemberConversions = [...otherMemberConversionsByTypeof.values()];
|
|
66
|
+
const sourceTypes = memberIdentitySourceTypes.concat([
|
|
67
|
+
...otherMemberConversions.map((_) => _[0]),
|
|
68
|
+
]);
|
|
69
|
+
const syntheticNamePrefix = this.configuration.syntheticNamePrefix;
|
|
70
|
+
return Maybe.of({
|
|
71
|
+
code: code `\
|
|
72
|
+
(<${syntheticNamePrefix}DefaultNamespaceT extends ${this.reusables.snippets.NamespaceBuilder} = ${this.reusables.snippets.NamespaceBuilder}>(value: ${joinCode(sourceTypes.map((sourceType) => sourceType.expression), { on: " | " })}, defaultNamespace?: ${syntheticNamePrefix}DefaultNamespaceT): ${this.reusables.imports.Either}<Error, ${this.expression}> => {
|
|
73
|
+
switch (typeof value) {
|
|
74
|
+
case "object": return ${this.reusables.imports.Either}.of(value);
|
|
75
|
+
${joinCode(otherMemberConversions.map(([otherMemberSourceType, otherMemberConversionFunction]) => code `case "${otherMemberSourceType.jsType.typeof}": return ${otherMemberConversionFunction.code}(value, defaultNamespace);`), { on: "\n" })}
|
|
76
|
+
default:
|
|
77
|
+
value satisfies never;
|
|
78
|
+
throw new Error("should never reach this point");
|
|
79
|
+
}
|
|
80
|
+
})`,
|
|
81
|
+
sourceTypes,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
return Maybe.empty();
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=AbstractDiscriminatedUnionType_conversionFunctionExpression.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AbstractDiscriminatedUnionType } from "../AbstractDiscriminatedUnionType.js";
|
|
2
|
+
import type { Type } from "../Type.js";
|
|
3
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
+
export declare function AbstractDiscriminatedUnionType_equalsFunctionExpression<MemberTypeT extends Type>(this: AbstractDiscriminatedUnionType<MemberTypeT>): Code;
|
|
5
|
+
//# sourceMappingURL=AbstractDiscriminatedUnionType_equalsFunctionExpression.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
2
|
-
export function
|
|
2
|
+
export function AbstractDiscriminatedUnionType_equalsFunctionExpression() {
|
|
3
3
|
return code `\
|
|
4
4
|
((left: ${this.expression}, right: ${this.expression}) => {
|
|
5
5
|
${joinCode(this.members.map(({ type, typeCheck, unwrap }) => code `if (${typeCheck(code `left`)} && ${typeCheck(code `right`)}) {
|
|
@@ -9,4 +9,4 @@ ${joinCode(this.members.map(({ type, typeCheck, unwrap }) => code `if (${typeChe
|
|
|
9
9
|
return ${this.reusables.imports.Left}({ left, right, propertyName: "type", propertyValuesUnequal: { left: typeof left, right: typeof right, type: "boolean" as const }, type: "property" as const });
|
|
10
10
|
})`;
|
|
11
11
|
}
|
|
12
|
-
//# sourceMappingURL=
|
|
12
|
+
//# sourceMappingURL=AbstractDiscriminatedUnionType_equalsFunctionExpression.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AbstractDiscriminatedUnionType } from "../AbstractDiscriminatedUnionType.js";
|
|
2
|
+
import type { Type } from "../Type.js";
|
|
3
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
+
export declare function AbstractDiscriminatedUnionType_filterFunctionExpression<MemberTypeT extends Type>(this: AbstractDiscriminatedUnionType<MemberTypeT>): Code;
|
|
5
|
+
//# sourceMappingURL=AbstractDiscriminatedUnionType_filterFunctionExpression.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { code, joinCode, literalOf } from "../ts-poet-wrapper.js";
|
|
2
|
-
export function
|
|
2
|
+
export function AbstractDiscriminatedUnionType_filterFunctionExpression() {
|
|
3
3
|
const syntheticNamePrefix = this.configuration.syntheticNamePrefix;
|
|
4
4
|
return code `\
|
|
5
5
|
((filter: ${this.filterType}, value: ${this.expression}) => {
|
|
@@ -21,4 +21,4 @@ if (filter.on?.[${literalOf(primaryDiscriminantValue)}] !== undefined && ${typeC
|
|
|
21
21
|
return true;
|
|
22
22
|
})`;
|
|
23
23
|
}
|
|
24
|
-
//# sourceMappingURL=
|
|
24
|
+
//# sourceMappingURL=AbstractDiscriminatedUnionType_filterFunctionExpression.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AbstractDiscriminatedUnionType } from "../AbstractDiscriminatedUnionType.js";
|
|
2
|
+
import type { Type } from "../Type.js";
|
|
3
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
+
export declare function AbstractDiscriminatedUnionType_filterTypeExpression<MemberTypeT extends Type>(this: AbstractDiscriminatedUnionType<MemberTypeT>): Code;
|
|
5
|
+
//# sourceMappingURL=AbstractDiscriminatedUnionType_filterTypeExpression.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { code, joinCode, literalOf } from "../ts-poet-wrapper.js";
|
|
2
|
-
export function
|
|
2
|
+
export function AbstractDiscriminatedUnionType_filterTypeExpression() {
|
|
3
3
|
const syntheticNamePrefix = this.configuration.syntheticNamePrefix;
|
|
4
4
|
return code `\
|
|
5
5
|
{
|
|
@@ -7,4 +7,4 @@ export function DiscriminatedUnionType_filterTypeExpression() {
|
|
|
7
7
|
readonly on?: { ${joinCode(this.members.map(({ type, primaryDiscriminantValue }) => code `readonly ${literalOf(primaryDiscriminantValue)}?: ${type.filterType}`), { on: ";" })} }
|
|
8
8
|
}`;
|
|
9
9
|
}
|
|
10
|
-
//# sourceMappingURL=
|
|
10
|
+
//# sourceMappingURL=AbstractDiscriminatedUnionType_filterTypeExpression.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AbstractDiscriminatedUnionType } from "../AbstractDiscriminatedUnionType.js";
|
|
2
|
+
import type { Type } from "../Type.js";
|
|
3
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
+
export declare function AbstractDiscriminatedUnionType_fromJsonFunctionExpression<MemberTypeT extends Type>(this: AbstractDiscriminatedUnionType<MemberTypeT>): Code;
|
|
5
|
+
//# sourceMappingURL=AbstractDiscriminatedUnionType_fromJsonFunctionExpression.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
2
|
-
export function
|
|
2
|
+
export function AbstractDiscriminatedUnionType_fromJsonFunctionExpression() {
|
|
3
3
|
return code `\
|
|
4
4
|
((value: ${this.jsonType().expression}): ${this.reusables.imports.Either}<Error, ${this.expression}> => {
|
|
5
5
|
${joinCode(this.members.map(({ jsonType, jsonTypeCheck, type, unwrap, wrap }) => code `if (${jsonTypeCheck(code `value`)}) { return ${type.fromJsonExpression({
|
|
@@ -11,4 +11,4 @@ ${joinCode(this.members.map(({ jsonType, jsonTypeCheck, type, unwrap, wrap }) =>
|
|
|
11
11
|
throw new Error("unable to deserialize JSON");
|
|
12
12
|
})`;
|
|
13
13
|
}
|
|
14
|
-
//# sourceMappingURL=
|
|
14
|
+
//# sourceMappingURL=AbstractDiscriminatedUnionType_fromJsonFunctionExpression.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AbstractDiscriminatedUnionType } from "../AbstractDiscriminatedUnionType.js";
|
|
2
|
+
import type { Type } from "../Type.js";
|
|
3
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
+
export declare function AbstractDiscriminatedUnionType_fromRdfResourceValuesFunctionExpression<MemberTypeT extends Type>(this: AbstractDiscriminatedUnionType<MemberTypeT>): Code;
|
|
5
|
+
//# sourceMappingURL=AbstractDiscriminatedUnionType_fromRdfResourceValuesFunctionExpression.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { code, literalOf } from "../ts-poet-wrapper.js";
|
|
2
|
-
export function
|
|
2
|
+
export function AbstractDiscriminatedUnionType_fromRdfResourceValuesFunctionExpression() {
|
|
3
3
|
return code `\
|
|
4
4
|
(((values, options) =>
|
|
5
5
|
values.chainMap(value => {
|
|
@@ -19,4 +19,4 @@ export function DiscriminatedUnionType_fromRdfResourceValuesFunctionExpression()
|
|
|
19
19
|
})
|
|
20
20
|
) satisfies ${this.reusables.snippets.FromRdfResourceValuesFunction}<${this.expression}, ${this.schemaType}>)`;
|
|
21
21
|
}
|
|
22
|
-
//# sourceMappingURL=
|
|
22
|
+
//# sourceMappingURL=AbstractDiscriminatedUnionType_fromRdfResourceValuesFunctionExpression.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AbstractDiscriminatedUnionType } from "../AbstractDiscriminatedUnionType.js";
|
|
2
|
+
import type { Type } from "../Type.js";
|
|
3
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
+
export declare function AbstractDiscriminatedUnionType_hashFunctionExpression<MemberTypeT extends Type>(this: AbstractDiscriminatedUnionType<MemberTypeT>): Code;
|
|
5
|
+
//# sourceMappingURL=AbstractDiscriminatedUnionType_hashFunctionExpression.d.ts.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
2
|
-
export function
|
|
2
|
+
export function AbstractDiscriminatedUnionType_hashFunctionExpression() {
|
|
3
3
|
return code `\
|
|
4
4
|
(<HasherT extends ${this.reusables.snippets.Hasher}>(hasher: HasherT, value: ${this.expression}): HasherT => {
|
|
5
5
|
${joinCode(this.members.map(({ type, typeCheck, unwrap }) => code `if (${typeCheck(code `value`)}) { return ${type.hashFunction}(hasher, ${unwrap(code `value`)}); }`))}
|
|
6
6
|
return hasher;
|
|
7
7
|
})`;
|
|
8
8
|
}
|
|
9
|
-
//# sourceMappingURL=
|
|
9
|
+
//# sourceMappingURL=AbstractDiscriminatedUnionType_hashFunctionExpression.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Maybe } from "purify-ts";
|
|
2
|
+
import type { AbstractDiscriminatedUnionType } from "../AbstractDiscriminatedUnionType.js";
|
|
3
|
+
import type { Type } from "../Type.js";
|
|
4
|
+
export declare function AbstractDiscriminatedUnionType_inferDiscriminant<MemberTypeT extends Type>(this: AbstractDiscriminatedUnionType<MemberTypeT>, members: readonly {
|
|
5
|
+
readonly discriminantValue: Maybe<number | string>;
|
|
6
|
+
readonly type: Type;
|
|
7
|
+
}[]): AbstractDiscriminatedUnionType.Discriminant;
|
|
8
|
+
//# sourceMappingURL=AbstractDiscriminatedUnionType_inferDiscriminant.d.ts.map
|
|
@@ -11,7 +11,7 @@ function termTypes(type) {
|
|
|
11
11
|
return emptyTermTypesSet;
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
export function
|
|
14
|
+
export function AbstractDiscriminatedUnionType_inferDiscriminant(members) {
|
|
15
15
|
// extrinsic with user-specified values
|
|
16
16
|
if (members.some((member) => member.discriminantValue.isJust())) {
|
|
17
17
|
return {
|
|
@@ -130,4 +130,4 @@ export function DiscriminatedUnionType_inferDiscriminant(members) {
|
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
const emptyTermTypesSet = new Set();
|
|
133
|
-
//# sourceMappingURL=
|
|
133
|
+
//# sourceMappingURL=AbstractDiscriminatedUnionType_inferDiscriminant.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AbstractDiscriminatedUnionType } from "../AbstractDiscriminatedUnionType.js";
|
|
2
|
+
import type { Type } from "../Type.js";
|
|
3
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
+
export declare function AbstractDiscriminatedUnionType_inlineExpression<MemberTypeT extends Type>(this: AbstractDiscriminatedUnionType<MemberTypeT>): Code;
|
|
5
|
+
//# sourceMappingURL=AbstractDiscriminatedUnionType_inlineExpression.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { code, joinCode, literalOf } from "../ts-poet-wrapper.js";
|
|
2
|
-
export function
|
|
2
|
+
export function AbstractDiscriminatedUnionType_inlineExpression() {
|
|
3
3
|
const discriminant = this.discriminant; // To get type narrowing to work
|
|
4
4
|
switch (discriminant.kind) {
|
|
5
5
|
case "Extrinsic":
|
|
@@ -28,4 +28,4 @@ export function DiscriminatedUnionType_inlineExpression() {
|
|
|
28
28
|
throw new Error("should never reach this point");
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
-
//# sourceMappingURL=
|
|
31
|
+
//# sourceMappingURL=AbstractDiscriminatedUnionType_inlineExpression.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AbstractDiscriminatedUnionType } from "../AbstractDiscriminatedUnionType.js";
|
|
2
|
+
import type { Type } from "../Type.js";
|
|
3
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
+
export declare function AbstractDiscriminatedUnionType_jsonSchemaExpression<MemberTypeT extends Type>(this: AbstractDiscriminatedUnionType<MemberTypeT>): Code;
|
|
5
|
+
//# sourceMappingURL=AbstractDiscriminatedUnionType_jsonSchemaExpression.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { code, joinCode, literalOf } from "../ts-poet-wrapper.js";
|
|
2
|
-
export function
|
|
2
|
+
export function AbstractDiscriminatedUnionType_jsonSchemaExpression() {
|
|
3
3
|
const discriminant = this.discriminant; // To get type narrowing to work
|
|
4
4
|
switch (discriminant.kind) {
|
|
5
5
|
case "Extrinsic":
|
|
@@ -29,4 +29,4 @@ export function DiscriminatedUnionType_jsonSchemaExpression() {
|
|
|
29
29
|
throw discriminant;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
//# sourceMappingURL=
|
|
32
|
+
//# sourceMappingURL=AbstractDiscriminatedUnionType_jsonSchemaExpression.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AbstractDiscriminatedUnionType } from "../AbstractDiscriminatedUnionType.js";
|
|
2
|
+
import { AbstractType } from "../AbstractType.js";
|
|
3
|
+
import type { Type } from "../Type.js";
|
|
4
|
+
export declare function AbstractDiscriminatedUnionType_jsonTypeLiteral<MemberTypeT extends Type>(this: AbstractDiscriminatedUnionType<MemberTypeT>): AbstractType.JsonType;
|
|
5
|
+
//# sourceMappingURL=AbstractDiscriminatedUnionType_jsonTypeLiteral.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AbstractType } from "../AbstractType.js";
|
|
2
2
|
import { code, joinCode, literalOf } from "../ts-poet-wrapper.js";
|
|
3
|
-
export function
|
|
3
|
+
export function AbstractDiscriminatedUnionType_jsonTypeLiteral() {
|
|
4
4
|
const discriminant = this.discriminant; // To get type narrowing to work
|
|
5
5
|
switch (discriminant.kind) {
|
|
6
6
|
case "Extrinsic":
|
|
@@ -23,4 +23,4 @@ export function DiscriminatedUnionType_jsonTypeLiteral() {
|
|
|
23
23
|
throw discriminant;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
//# sourceMappingURL=
|
|
26
|
+
//# sourceMappingURL=AbstractDiscriminatedUnionType_jsonTypeLiteral.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AbstractDiscriminatedUnionType } from "../AbstractDiscriminatedUnionType.js";
|
|
2
|
+
import type { Type } from "../Type.js";
|
|
3
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
+
export declare function AbstractDiscriminatedUnionType_schemaTypeExpression<MemberTypeT extends Type>(this: AbstractDiscriminatedUnionType<MemberTypeT>): Code;
|
|
5
|
+
//# sourceMappingURL=AbstractDiscriminatedUnionType_schemaTypeExpression.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { code, joinCode, literalOf } from "../ts-poet-wrapper.js";
|
|
2
|
-
export function
|
|
2
|
+
export function AbstractDiscriminatedUnionType_schemaTypeExpression() {
|
|
3
3
|
return code `${{
|
|
4
4
|
kind: this.kind,
|
|
5
5
|
members: code `{ ${joinCode(this.members.map(({ type, primaryDiscriminantValue }) => code `readonly ${literalOf(primaryDiscriminantValue)}: ${{
|
|
@@ -8,4 +8,4 @@ export function DiscriminatedUnionType_schemaTypeExpression() {
|
|
|
8
8
|
}}`), { on: ";" })} }`,
|
|
9
9
|
}}`;
|
|
10
10
|
}
|
|
11
|
-
//# sourceMappingURL=
|
|
11
|
+
//# sourceMappingURL=AbstractDiscriminatedUnionType_schemaTypeExpression.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AbstractDiscriminatedUnionType } from "../AbstractDiscriminatedUnionType.js";
|
|
2
|
+
import type { Type } from "../Type.js";
|
|
3
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
+
export declare function AbstractDiscriminatedUnionType_toJsonFunctionExpression<MemberTypeT extends Type>(this: AbstractDiscriminatedUnionType<MemberTypeT>): Code;
|
|
5
|
+
//# sourceMappingURL=AbstractDiscriminatedUnionType_toJsonFunctionExpression.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
2
|
-
export function
|
|
2
|
+
export function AbstractDiscriminatedUnionType_toJsonFunctionExpression() {
|
|
3
3
|
return code `\
|
|
4
4
|
((value: ${this.expression}): ${this.jsonType().expression} => {
|
|
5
5
|
${joinCode(this.members.map(({ typeCheck, typeToJsonExpression, unwrap, wrap }) => code `if (${typeCheck(code `value`)}) { return ${wrap(typeToJsonExpression(unwrap(code `value`)))}; }`))}
|
|
@@ -7,4 +7,4 @@ ${joinCode(this.members.map(({ typeCheck, typeToJsonExpression, unwrap, wrap })
|
|
|
7
7
|
throw new Error("unable to serialize to JSON");
|
|
8
8
|
})`;
|
|
9
9
|
}
|
|
10
|
-
//# sourceMappingURL=
|
|
10
|
+
//# sourceMappingURL=AbstractDiscriminatedUnionType_toJsonFunctionExpression.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AbstractDiscriminatedUnionType } from "../AbstractDiscriminatedUnionType.js";
|
|
2
|
+
import type { Type } from "../Type.js";
|
|
3
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
+
export declare function AbstractDiscriminatedUnionType_toRdfResourceValuesFunctionExpression<MemberTypeT extends Type>(this: AbstractDiscriminatedUnionType<MemberTypeT>): Code;
|
|
5
|
+
//# sourceMappingURL=AbstractDiscriminatedUnionType_toRdfResourceValuesFunctionExpression.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
2
|
-
export function
|
|
2
|
+
export function AbstractDiscriminatedUnionType_toRdfResourceValuesFunctionExpression() {
|
|
3
3
|
return code `\
|
|
4
4
|
(((value, _options): (${joinCode([...this.toRdfResourceValueTypes].map((toRdfResourceValueType) => {
|
|
5
5
|
switch (toRdfResourceValueType) {
|
|
@@ -27,4 +27,4 @@ export function DiscriminatedUnionType_toRdfResourceValuesFunctionExpression() {
|
|
|
27
27
|
throw new Error("unable to serialize to RDF");
|
|
28
28
|
}) satisfies ${this.reusables.snippets.ToRdfResourceValuesFunction}<${this.expression}>)`;
|
|
29
29
|
}
|
|
30
|
-
//# sourceMappingURL=
|
|
30
|
+
//# sourceMappingURL=AbstractDiscriminatedUnionType_toRdfResourceValuesFunctionExpression.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AbstractDiscriminatedUnionType } from "../AbstractDiscriminatedUnionType.js";
|
|
2
|
+
import type { Type } from "../Type.js";
|
|
3
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
+
export declare function AbstractDiscriminatedUnionType_toStringFunctionExpression<MemberTypeT extends Type>(this: AbstractDiscriminatedUnionType<MemberTypeT>): Code;
|
|
5
|
+
//# sourceMappingURL=AbstractDiscriminatedUnionType_toStringFunctionExpression.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
2
|
-
export function
|
|
2
|
+
export function AbstractDiscriminatedUnionType_toStringFunctionExpression() {
|
|
3
3
|
return code `\
|
|
4
4
|
((value: ${this.expression}): string => {
|
|
5
5
|
${joinCode(this.members.map(({ type, typeCheck, unwrap }) => code `if (${typeCheck(code `value`)}) { return ${type.toStringExpression({
|
|
@@ -9,4 +9,4 @@ ${joinCode(this.members.map(({ type, typeCheck, unwrap }) => code `if (${typeChe
|
|
|
9
9
|
throw new Error("unable to serialize to string");
|
|
10
10
|
})`;
|
|
11
11
|
}
|
|
12
|
-
//# sourceMappingURL=
|
|
12
|
+
//# sourceMappingURL=AbstractDiscriminatedUnionType_toStringFunctionExpression.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AbstractDiscriminatedUnionType } from "../AbstractDiscriminatedUnionType.js";
|
|
2
|
+
import type { Type } from "../Type.js";
|
|
3
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
+
export declare function AbstractDiscriminatedUnionType_valueSparqlConstructTriplesFunctionExpression<MemberTypeT extends Type>(this: AbstractDiscriminatedUnionType<MemberTypeT>): Code;
|
|
5
|
+
//# sourceMappingURL=AbstractDiscriminatedUnionType_valueSparqlConstructTriplesFunctionExpression.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { code, joinCode, literalOf } from "../ts-poet-wrapper.js";
|
|
2
|
-
export function
|
|
2
|
+
export function AbstractDiscriminatedUnionType_valueSparqlConstructTriplesFunctionExpression() {
|
|
3
3
|
return code `\
|
|
4
4
|
((({ ignoreRdfType, filter, schema, ...otherParameters }) => {
|
|
5
5
|
let triples: ${this.reusables.imports.sparqljs}.Triple[] = [];
|
|
@@ -10,4 +10,4 @@ triples = triples.concat(${type.valueSparqlConstructTriplesFunction}({ ...otherP
|
|
|
10
10
|
return triples;
|
|
11
11
|
}) satisfies ${this.reusables.snippets.ValueSparqlConstructTriplesFunction}<${this.filterType}, ${this.schemaType}>)`;
|
|
12
12
|
}
|
|
13
|
-
//# sourceMappingURL=
|
|
13
|
+
//# sourceMappingURL=AbstractDiscriminatedUnionType_valueSparqlConstructTriplesFunctionExpression.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AbstractDiscriminatedUnionType } from "../AbstractDiscriminatedUnionType.js";
|
|
2
|
+
import type { Type } from "../Type.js";
|
|
3
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
+
export declare function AbstractDiscriminatedUnionType_valueSparqlWherePatternsFunctionExpression<MemberTypeT extends Type>(this: AbstractDiscriminatedUnionType<MemberTypeT>): Code;
|
|
5
|
+
//# sourceMappingURL=AbstractDiscriminatedUnionType_valueSparqlWherePatternsFunctionExpression.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { code, joinCode, literalOf } from "../ts-poet-wrapper.js";
|
|
2
|
-
export function
|
|
2
|
+
export function AbstractDiscriminatedUnionType_valueSparqlWherePatternsFunctionExpression() {
|
|
3
3
|
return code `\
|
|
4
4
|
((({ filter, schema, ...otherParameters }) => {
|
|
5
5
|
const unionPatterns: ${this.reusables.imports.sparqljs}.GroupPattern[] = [];
|
|
@@ -10,4 +10,4 @@ unionPatterns.push({ patterns: ${type.valueSparqlWherePatternsFunction}({ ...oth
|
|
|
10
10
|
return [{ patterns: unionPatterns, type: "union" }];
|
|
11
11
|
}) satisfies ${this.reusables.snippets.ValueSparqlWherePatternsFunction}<${this.filterType}, ${this.schemaType}>)`;
|
|
12
12
|
}
|
|
13
|
-
//# sourceMappingURL=
|
|
13
|
+
//# sourceMappingURL=AbstractDiscriminatedUnionType_valueSparqlWherePatternsFunctionExpression.js.map
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import type { Code } from "../ts-poet-wrapper.js";
|
|
2
|
-
import
|
|
2
|
+
import { AbstractType_JsType } from "./AbstractType_JsType.js";
|
|
3
3
|
export interface AbstractType_ConversionFunction {
|
|
4
4
|
readonly code: Code;
|
|
5
|
-
readonly sourceTypes:
|
|
5
|
+
readonly sourceTypes: AbstractType_ConversionFunction.SourceType[];
|
|
6
|
+
}
|
|
7
|
+
export declare namespace AbstractType_ConversionFunction {
|
|
8
|
+
interface SourceType {
|
|
6
9
|
readonly expression: Code;
|
|
7
10
|
readonly jsType: AbstractType_JsType;
|
|
8
|
-
}
|
|
11
|
+
}
|
|
12
|
+
namespace SourceType {
|
|
13
|
+
function equals(left: SourceType, right: SourceType): boolean;
|
|
14
|
+
}
|
|
9
15
|
}
|
|
10
16
|
//# sourceMappingURL=AbstractType_ConversionFunction.d.ts.map
|
|
@@ -1,2 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
import { codeEquals } from "../codeEquals.js";
|
|
2
|
+
import { AbstractType_JsType } from "./AbstractType_JsType.js";
|
|
3
|
+
export var AbstractType_ConversionFunction;
|
|
4
|
+
(function (AbstractType_ConversionFunction) {
|
|
5
|
+
let SourceType;
|
|
6
|
+
(function (SourceType) {
|
|
7
|
+
function equals(left, right) {
|
|
8
|
+
if (!codeEquals(left.expression, right.expression)) {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
if (!AbstractType_JsType.equals(left.jsType, right.jsType)) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
SourceType.equals = equals;
|
|
17
|
+
})(SourceType = AbstractType_ConversionFunction.SourceType || (AbstractType_ConversionFunction.SourceType = {}));
|
|
18
|
+
})(AbstractType_ConversionFunction || (AbstractType_ConversionFunction = {}));
|
|
2
19
|
//# sourceMappingURL=AbstractType_ConversionFunction.js.map
|