@shaclmate/compiler 4.0.9 → 4.0.10
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/ShapesGraphToAstTransformer.js +1 -1
- package/dist/ast/Ast.d.ts +1 -1
- package/dist/generators/json/AstJsonGenerator.js +1 -1
- package/dist/generators/ts/AbstractCollectionType.d.ts +1 -1
- package/dist/generators/ts/AbstractCollectionType.js +2 -2
- package/dist/generators/ts/AbstractContainerType.d.ts +2 -2
- package/dist/generators/ts/AbstractContainerType.js +1 -1
- package/dist/generators/ts/AbstractLazyObjectType.d.ts +3 -3
- package/dist/generators/ts/AbstractLazyObjectType.js +2 -2
- package/dist/generators/ts/AbstractNamedUnionType.d.ts +2 -2
- package/dist/generators/ts/AbstractNamedUnionType.js +17 -15
- package/dist/generators/ts/AbstractNumericType.d.ts +1 -1
- package/dist/generators/ts/AbstractNumericType.js +1 -1
- package/dist/generators/ts/AbstractType.d.ts +5 -5
- package/dist/generators/ts/AbstractUnionType.d.ts +1 -1
- package/dist/generators/ts/AbstractUnionType.js +6 -6
- package/dist/generators/ts/AnonymousUnionType.d.ts +1 -1
- package/dist/generators/ts/AnonymousUnionType.js +2 -2
- package/dist/generators/ts/BigDecimalType.d.ts +1 -1
- package/dist/generators/ts/BigDecimalType.js +2 -2
- package/dist/generators/ts/BigIntType.d.ts +1 -1
- package/dist/generators/ts/BigIntType.js +1 -1
- package/dist/generators/ts/BlankNodeType.d.ts +1 -1
- package/dist/generators/ts/BlankNodeType.js +1 -1
- package/dist/generators/ts/BooleanType.d.ts +1 -1
- package/dist/generators/ts/BooleanType.js +1 -1
- package/dist/generators/ts/DateTimeType.d.ts +1 -1
- package/dist/generators/ts/DateTimeType.js +1 -1
- package/dist/generators/ts/DateType.d.ts +1 -1
- package/dist/generators/ts/DateType.js +1 -1
- package/dist/generators/ts/DefaultValueType.d.ts +1 -1
- package/dist/generators/ts/DefaultValueType.js +3 -3
- package/dist/generators/ts/IdentifierType.d.ts +1 -1
- package/dist/generators/ts/IdentifierType.js +1 -1
- package/dist/generators/ts/IriType.d.ts +1 -1
- package/dist/generators/ts/IriType.js +1 -1
- package/dist/generators/ts/LazyObjectOptionType.js +1 -1
- package/dist/generators/ts/LazyObjectSetType.js +1 -1
- package/dist/generators/ts/LazyObjectType.js +2 -2
- package/dist/generators/ts/ListType.d.ts +2 -2
- package/dist/generators/ts/ListType.js +1 -1
- package/dist/generators/ts/LiteralType.d.ts +1 -1
- package/dist/generators/ts/LiteralType.js +1 -1
- package/dist/generators/ts/{ObjectType.d.ts → NamedObjectType.d.ts} +28 -28
- package/dist/generators/ts/{ObjectType.js → NamedObjectType.js} +105 -97
- package/dist/generators/ts/NamedObjectUnionType.d.ts +4 -4
- package/dist/generators/ts/NamedObjectUnionType.js +8 -12
- package/dist/generators/ts/OptionType.d.ts +1 -1
- package/dist/generators/ts/OptionType.js +2 -2
- package/dist/generators/ts/StringType.d.ts +1 -1
- package/dist/generators/ts/StringType.js +1 -1
- package/dist/generators/ts/TermType.d.ts +1 -1
- package/dist/generators/ts/TermType.js +1 -1
- package/dist/generators/ts/TsGenerator.js +8 -8
- package/dist/generators/ts/Type.d.ts +2 -2
- package/dist/generators/ts/TypeFactory.d.ts +2 -2
- package/dist/generators/ts/TypeFactory.js +36 -36
- package/dist/generators/ts/ZodGenerator.js +14 -12
- package/dist/generators/ts/{_ObjectType → _NamedObjectType}/AbstractProperty.d.ts +6 -6
- package/dist/generators/ts/{_ObjectType → _NamedObjectType}/AbstractProperty.js +3 -3
- package/dist/generators/ts/{_ObjectType → _NamedObjectType}/DiscriminantProperty.d.ts +1 -1
- package/dist/generators/ts/{_ObjectType → _NamedObjectType}/DiscriminantProperty.js +13 -11
- package/dist/generators/ts/{_ObjectType → _NamedObjectType}/IdentifierPrefixProperty.d.ts +1 -1
- package/dist/generators/ts/{_ObjectType → _NamedObjectType}/IdentifierPrefixProperty.js +4 -4
- package/dist/generators/ts/{_ObjectType → _NamedObjectType}/IdentifierProperty.d.ts +1 -1
- package/dist/generators/ts/{_ObjectType → _NamedObjectType}/IdentifierProperty.js +24 -24
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_classDeclaration.d.ts +4 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_classDeclaration.js → _NamedObjectType/NamedObjectType_classDeclaration.js} +14 -14
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_createFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_createFunctionDeclaration.js → _NamedObjectType/NamedObjectType_createFunctionDeclaration.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_equalsFunctionOrMethodDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_equalsFunctionOrMethodDeclaration.js → _NamedObjectType/NamedObjectType_equalsFunctionOrMethodDeclaration.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterFunctionDeclaration.d.ts +4 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_filterFunctionDeclaration.js → _NamedObjectType/NamedObjectType_filterFunctionDeclaration.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterTypeDeclaration.d.ts +4 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_filterTypeDeclaration.js → _NamedObjectType/NamedObjectType_filterTypeDeclaration.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_focusSparqlConstructTriplesFunctionDeclaration.js → _NamedObjectType/NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_focusSparqlWherePatternsFunctionDeclaration.js → _NamedObjectType/NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromJsonFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_fromJsonFunctionDeclaration.js → _NamedObjectType/NamedObjectType_fromJsonFunctionDeclaration.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_fromRdfResourceFunctionDeclaration.js → _NamedObjectType/NamedObjectType_fromRdfResourceFunctionDeclaration.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceValuesFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_fromRdfResourceValuesFunctionDeclaration.js → _NamedObjectType/NamedObjectType_fromRdfResourceValuesFunctionDeclaration.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfTypeVariableStatement.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_fromRdfTypeVariableStatement.js → _NamedObjectType/NamedObjectType_fromRdfTypeVariableStatement.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_graphqlTypeVariableStatement.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_graphqlTypeVariableStatement.js → _NamedObjectType/NamedObjectType_graphqlTypeVariableStatement.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_hashFunctionOrMethodDeclarations.d.ts +4 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_hashFunctionOrMethodDeclarations.js → _NamedObjectType/NamedObjectType_hashFunctionOrMethodDeclarations.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_interfaceDeclaration.d.ts +4 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_interfaceDeclaration.js → _NamedObjectType/NamedObjectType_interfaceDeclaration.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_isTypeFunctionDeclaration.d.ts +4 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_isTypeFunctionDeclaration.js → _NamedObjectType/NamedObjectType_isTypeFunctionDeclaration.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonParseFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonParseFunctionDeclaration.js +19 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonSchemaFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_jsonZodSchemaFunctionDeclaration.js → _NamedObjectType/NamedObjectType_jsonSchemaFunctionDeclaration.js} +5 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonTypeAliasDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_jsonTypeAliasDeclaration.js → _NamedObjectType/NamedObjectType_jsonTypeAliasDeclaration.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonUiSchemaFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_jsonUiSchemaFunctionDeclaration.js → _NamedObjectType/NamedObjectType_jsonUiSchemaFunctionDeclaration.js} +4 -4
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_objectSetMethodNames.d.ts +9 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_objectSetMethodNames.js → _NamedObjectType/NamedObjectType_objectSetMethodNames.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_propertiesFromJsonFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_propertiesFromJsonFunctionDeclaration.js → _NamedObjectType/NamedObjectType_propertiesFromJsonFunctionDeclaration.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_propertiesFromRdfResourceFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_propertiesFromRdfResourceFunctionDeclaration.js → _NamedObjectType/NamedObjectType_propertiesFromRdfResourceFunctionDeclaration.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_schemaVariableStatement.d.ts +4 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_schemaVariableStatement.js → _NamedObjectType/NamedObjectType_schemaVariableStatement.js} +2 -2
- package/dist/generators/ts/{_ObjectType/ObjectType_sparqlConstructQueryFunctionDeclaration.d.ts → _NamedObjectType/NamedObjectType_sparqlConstructQueryFunctionDeclaration.d.ts} +2 -2
- package/dist/generators/ts/{_ObjectType/ObjectType_sparqlConstructQueryFunctionDeclaration.js → _NamedObjectType/NamedObjectType_sparqlConstructQueryFunctionDeclaration.js} +2 -2
- package/dist/generators/ts/{_ObjectType/ObjectType_sparqlConstructQueryStringFunctionDeclaration.d.ts → _NamedObjectType/NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.d.ts} +2 -2
- package/dist/generators/ts/{_ObjectType/ObjectType_sparqlConstructQueryStringFunctionDeclaration.js → _NamedObjectType/NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toJsonFunctionOrMethodDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_toJsonFunctionOrMethodDeclaration.js → _NamedObjectType/NamedObjectType_toJsonFunctionOrMethodDeclaration.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toRdfResourceFunctionOrMethodDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_toRdfResourceFunctionOrMethodDeclaration.js → _NamedObjectType/NamedObjectType_toRdfResourceFunctionOrMethodDeclaration.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlConstructTriplesFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_valueSparqlConstructTriplesFunctionDeclaration.js → _NamedObjectType/NamedObjectType_valueSparqlConstructTriplesFunctionDeclaration.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlWherePatternsFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_valueSparqlWherePatternsFunctionDeclaration.js → _NamedObjectType/NamedObjectType_valueSparqlWherePatternsFunctionDeclaration.js} +2 -2
- package/dist/generators/ts/{_ObjectType → _NamedObjectType}/ShaclProperty.d.ts +1 -1
- package/dist/generators/ts/{_ObjectType → _NamedObjectType}/ShaclProperty.js +8 -8
- package/dist/generators/ts/_NamedObjectType/identifierTypeDeclarations.d.ts +4 -0
- package/dist/generators/ts/graphqlSchemaVariableStatement.d.ts +2 -2
- package/dist/generators/ts/graphqlSchemaVariableStatement.js +23 -23
- package/dist/generators/ts/objectSetDeclarations.d.ts +2 -2
- package/dist/generators/ts/objectSetDeclarations.js +19 -16
- package/dist/generators/ts/objectSetInterfaceDeclaration.d.ts +3 -3
- package/dist/generators/ts/objectSetInterfaceDeclaration.js +6 -4
- package/dist/generators/ts/objectSetMethodSignatures.d.ts +4 -4
- package/dist/generators/ts/objectSetMethodSignatures.js +9 -9
- package/dist/generators/ts/rdfjsDatasetObjectSetClassDeclaration.d.ts +3 -3
- package/dist/generators/ts/rdfjsDatasetObjectSetClassDeclaration.js +47 -45
- package/dist/generators/ts/singleEntryRecord.d.ts +2 -0
- package/dist/generators/ts/singleEntryRecord.js +6 -0
- package/dist/generators/ts/sparqlObjectSetClassDeclaration.d.ts +3 -3
- package/dist/generators/ts/sparqlObjectSetClassDeclaration.js +17 -17
- package/dist/generators/ts/synthesizeUberObjectUnionType.d.ts +2 -2
- package/dist/generators/ts/synthesizeUberObjectUnionType.js +8 -8
- package/dist/generators/ts/unsupportedObjectSetMethodDeclarations.d.ts +5 -5
- package/dist/generators/ts/unsupportedObjectSetMethodDeclarations.js +2 -2
- package/package.json +4 -4
- package/dist/generators/ts/_ObjectType/ObjectType_classDeclaration.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_createFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_equalsFunctionOrMethodDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_filterFunctionDeclaration.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_filterTypeDeclaration.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_focusSparqlConstructTriplesFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_focusSparqlWherePatternsFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_fromJsonFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceValuesFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_fromRdfTypeVariableStatement.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_graphqlTypeVariableStatement.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_hashFunctionOrMethodDeclarations.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_interfaceDeclaration.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_isTypeFunctionDeclaration.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_jsonSchemaFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_jsonSchemaFunctionDeclaration.js +0 -14
- package/dist/generators/ts/_ObjectType/ObjectType_jsonTypeAliasDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_jsonUiSchemaFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_jsonZodSchemaFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_objectSetMethodNames.d.ts +0 -9
- package/dist/generators/ts/_ObjectType/ObjectType_parseJsonFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_parseJsonFunctionDeclaration.js +0 -19
- package/dist/generators/ts/_ObjectType/ObjectType_propertiesFromJsonFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_propertiesFromRdfResourceFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_schemaVariableStatement.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_toJsonFunctionOrMethodDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_toRdfResourceFunctionOrMethodDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_valueSparqlConstructTriplesFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_valueSparqlWherePatternsFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/identifierTypeDeclarations.d.ts +0 -4
- /package/dist/generators/ts/{_ObjectType → _NamedObjectType}/Property.d.ts +0 -0
- /package/dist/generators/ts/{_ObjectType → _NamedObjectType}/Property.js +0 -0
- /package/dist/generators/ts/{_ObjectType → _NamedObjectType}/identifierTypeDeclarations.js +0 -0
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { Maybe } from "purify-ts";
|
|
2
2
|
import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
|
|
3
3
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
4
|
-
export function
|
|
4
|
+
export function NamedObjectType_jsonUiSchemaFunctionDeclaration() {
|
|
5
5
|
if (!this.features.has("json")) {
|
|
6
6
|
return Maybe.empty();
|
|
7
7
|
}
|
|
8
8
|
const variables = { scopePrefix: code `scopePrefix` };
|
|
9
9
|
const elements = this.parentObjectTypes
|
|
10
|
-
.map((parentObjectType) => code `${parentObjectType.staticModuleName}.${syntheticNamePrefix}
|
|
10
|
+
.map((parentObjectType) => code `${parentObjectType.staticModuleName}.${syntheticNamePrefix}Json.uiSchema({ scopePrefix })`)
|
|
11
11
|
.concat(this.ownProperties.flatMap((property) => property.jsonUiSchemaElement({ variables }).toList()));
|
|
12
12
|
return Maybe.of(code `\
|
|
13
|
-
export function
|
|
13
|
+
export function uiSchema(parameters?: { scopePrefix?: string }): any {
|
|
14
14
|
const scopePrefix = parameters?.scopePrefix ?? "#";
|
|
15
15
|
return { "elements": [ ${joinCode(elements, { on: "," })} ], label: "${this.label.orDefault(this.name)}", type: "Group" };
|
|
16
16
|
}`);
|
|
17
17
|
}
|
|
18
|
-
//# sourceMappingURL=
|
|
18
|
+
//# sourceMappingURL=NamedObjectType_jsonUiSchemaFunctionDeclaration.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare function NamedObjectType_objectSetMethodNames(this: {
|
|
2
|
+
readonly name: string;
|
|
3
|
+
}): {
|
|
4
|
+
object: string;
|
|
5
|
+
objectCount: string;
|
|
6
|
+
objectIdentifiers: string;
|
|
7
|
+
objects: string;
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=NamedObjectType_objectSetMethodNames.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { camelCase, trainCase } from "change-case";
|
|
2
2
|
import plur from "plur";
|
|
3
|
-
export function
|
|
3
|
+
export function NamedObjectType_objectSetMethodNames() {
|
|
4
4
|
const prefixSingular = camelCase(this.name);
|
|
5
5
|
const thisNameParts = trainCase(this.name).split("-");
|
|
6
6
|
let prefixPlural = camelCase(`${thisNameParts.slice(0, thisNameParts.length - 1).join("")}${plur(thisNameParts[thisNameParts.length - 1])}`);
|
|
@@ -15,4 +15,4 @@ export function ObjectType_objectSetMethodNames() {
|
|
|
15
15
|
objects: prefixPlural,
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
|
-
//# sourceMappingURL=
|
|
18
|
+
//# sourceMappingURL=NamedObjectType_objectSetMethodNames.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
|
+
import type { NamedObjectType } from "../NamedObjectType.js";
|
|
3
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
+
export declare function NamedObjectType_propertiesFromJsonFunctionDeclaration(this: NamedObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=NamedObjectType_propertiesFromJsonFunctionDeclaration.d.ts.map
|
|
@@ -4,7 +4,7 @@ import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
|
4
4
|
const variables = {
|
|
5
5
|
jsonObject: code `${syntheticNamePrefix}json`,
|
|
6
6
|
};
|
|
7
|
-
export function
|
|
7
|
+
export function NamedObjectType_propertiesFromJsonFunctionDeclaration() {
|
|
8
8
|
if (!this.features.has("json")) {
|
|
9
9
|
return Maybe.empty();
|
|
10
10
|
}
|
|
@@ -35,4 +35,4 @@ export function ${syntheticNamePrefix}propertiesFromJson(${variables.jsonObject}
|
|
|
35
35
|
${joinCode(statements)}
|
|
36
36
|
}`);
|
|
37
37
|
}
|
|
38
|
-
//# sourceMappingURL=
|
|
38
|
+
//# sourceMappingURL=NamedObjectType_propertiesFromJsonFunctionDeclaration.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
|
+
import type { NamedObjectType } from "../NamedObjectType.js";
|
|
3
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
+
export declare function NamedObjectType_propertiesFromRdfResourceFunctionDeclaration(this: NamedObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=NamedObjectType_propertiesFromRdfResourceFunctionDeclaration.d.ts.map
|
|
@@ -14,7 +14,7 @@ const variables = {
|
|
|
14
14
|
preferredLanguages: code `${optionsVariable}.preferredLanguages`,
|
|
15
15
|
resource: code `${syntheticNamePrefix}resource`,
|
|
16
16
|
};
|
|
17
|
-
export function
|
|
17
|
+
export function NamedObjectType_propertiesFromRdfResourceFunctionDeclaration() {
|
|
18
18
|
if (!this.features.has("rdf")) {
|
|
19
19
|
return Maybe.empty();
|
|
20
20
|
}
|
|
@@ -98,4 +98,4 @@ export const ${syntheticNamePrefix}propertiesFromRdfResource: ${snippets.Propert
|
|
|
98
98
|
${joinCode(statements)}
|
|
99
99
|
};`);
|
|
100
100
|
}
|
|
101
|
-
//# sourceMappingURL=
|
|
101
|
+
//# sourceMappingURL=NamedObjectType_propertiesFromRdfResourceFunctionDeclaration.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { NamedObjectType } from "../NamedObjectType.js";
|
|
2
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
3
|
+
export declare function NamedObjectType_schemaVariableStatement(this: NamedObjectType): Code;
|
|
4
|
+
//# sourceMappingURL=NamedObjectType_schemaVariableStatement.d.ts.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
|
|
2
2
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
3
|
-
export function
|
|
3
|
+
export function NamedObjectType_schemaVariableStatement() {
|
|
4
4
|
return code `\
|
|
5
5
|
export const ${syntheticNamePrefix}schema = { properties: { ${joinCode(this.parentObjectTypes
|
|
6
6
|
.map((parentObjectType) => code `...${parentObjectType.staticModuleName}.${syntheticNamePrefix}schema.properties`)
|
|
7
7
|
.concat(this.ownProperties.map((property) => code `${property.name}: ${property.schema}`)), { on: ", " })} } } as const;`;
|
|
8
8
|
}
|
|
9
|
-
//# sourceMappingURL=
|
|
9
|
+
//# sourceMappingURL=NamedObjectType_schemaVariableStatement.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Maybe } from "purify-ts";
|
|
2
2
|
import type { TsFeature } from "../../../enums/TsFeature.js";
|
|
3
3
|
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
-
export declare function
|
|
4
|
+
export declare function NamedObjectType_sparqlConstructQueryFunctionDeclaration(this: {
|
|
5
5
|
readonly features: ReadonlySet<TsFeature>;
|
|
6
6
|
readonly filterType: Code;
|
|
7
7
|
readonly name: string;
|
|
8
8
|
readonly staticModuleName: string;
|
|
9
9
|
}): Maybe<Code>;
|
|
10
|
-
//# sourceMappingURL=
|
|
10
|
+
//# sourceMappingURL=NamedObjectType_sparqlConstructQueryFunctionDeclaration.d.ts.map
|
|
@@ -4,7 +4,7 @@ import { imports } from "../imports.js";
|
|
|
4
4
|
import { snippets } from "../snippets.js";
|
|
5
5
|
import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
|
|
6
6
|
import { code } from "../ts-poet-wrapper.js";
|
|
7
|
-
export function
|
|
7
|
+
export function NamedObjectType_sparqlConstructQueryFunctionDeclaration() {
|
|
8
8
|
if (!this.features.has("sparql")) {
|
|
9
9
|
return Maybe.empty();
|
|
10
10
|
}
|
|
@@ -39,4 +39,4 @@ export function ${syntheticNamePrefix}sparqlConstructQuery({ filter, ignoreRdfTy
|
|
|
39
39
|
};
|
|
40
40
|
}`);
|
|
41
41
|
}
|
|
42
|
-
//# sourceMappingURL=
|
|
42
|
+
//# sourceMappingURL=NamedObjectType_sparqlConstructQueryFunctionDeclaration.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Maybe } from "purify-ts";
|
|
2
2
|
import type { TsFeature } from "../../../enums/TsFeature.js";
|
|
3
3
|
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
-
export declare function
|
|
4
|
+
export declare function NamedObjectType_sparqlConstructQueryStringFunctionDeclaration(this: {
|
|
5
5
|
readonly features: ReadonlySet<TsFeature>;
|
|
6
6
|
readonly filterType: Code;
|
|
7
7
|
readonly staticModuleName: string;
|
|
8
8
|
}): Maybe<Code>;
|
|
9
|
-
//# sourceMappingURL=
|
|
9
|
+
//# sourceMappingURL=NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.d.ts.map
|
|
@@ -2,7 +2,7 @@ import { Maybe } from "purify-ts";
|
|
|
2
2
|
import { imports } from "../imports.js";
|
|
3
3
|
import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
|
|
4
4
|
import { code } from "../ts-poet-wrapper.js";
|
|
5
|
-
export function
|
|
5
|
+
export function NamedObjectType_sparqlConstructQueryStringFunctionDeclaration() {
|
|
6
6
|
if (!this.features.has("sparql")) {
|
|
7
7
|
return Maybe.empty();
|
|
8
8
|
}
|
|
@@ -11,4 +11,4 @@ export function ${syntheticNamePrefix}sparqlConstructQueryString(parameters: Par
|
|
|
11
11
|
return new ${imports.sparqljs}.Generator(parameters).stringify(${this.staticModuleName}.${syntheticNamePrefix}sparqlConstructQuery(parameters));
|
|
12
12
|
}`);
|
|
13
13
|
}
|
|
14
|
-
//# sourceMappingURL=
|
|
14
|
+
//# sourceMappingURL=NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.js.map
|
package/dist/generators/ts/_NamedObjectType/NamedObjectType_toJsonFunctionOrMethodDeclaration.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
|
+
import type { NamedObjectType } from "../NamedObjectType.js";
|
|
3
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
+
export declare function NamedObjectType_toJsonFunctionOrMethodDeclaration(this: NamedObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=NamedObjectType_toJsonFunctionOrMethodDeclaration.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Maybe } from "purify-ts";
|
|
2
2
|
import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
|
|
3
3
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
4
|
-
export function
|
|
4
|
+
export function NamedObjectType_toJsonFunctionOrMethodDeclaration() {
|
|
5
5
|
if (!this.features.has("json")) {
|
|
6
6
|
return Maybe.empty();
|
|
7
7
|
}
|
|
@@ -56,4 +56,4 @@ ${preamble}${syntheticNamePrefix}toJson(${joinCode(parameters, { on: ", " })}):
|
|
|
56
56
|
return JSON.parse(JSON.stringify({ ${joinCode(jsonObjectMembers, { on: "," })} } satisfies ${this.jsonType().name}));
|
|
57
57
|
}`);
|
|
58
58
|
}
|
|
59
|
-
//# sourceMappingURL=
|
|
59
|
+
//# sourceMappingURL=NamedObjectType_toJsonFunctionOrMethodDeclaration.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
|
+
import type { NamedObjectType } from "../NamedObjectType.js";
|
|
3
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
+
export declare function NamedObjectType_toRdfResourceFunctionOrMethodDeclaration(this: NamedObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=NamedObjectType_toRdfResourceFunctionOrMethodDeclaration.d.ts.map
|
|
@@ -5,7 +5,7 @@ import { rdfjsTermExpression } from "../rdfjsTermExpression.js";
|
|
|
5
5
|
import { snippets } from "../snippets.js";
|
|
6
6
|
import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
|
|
7
7
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
8
|
-
export function
|
|
8
|
+
export function NamedObjectType_toRdfResourceFunctionOrMethodDeclaration() {
|
|
9
9
|
if (!this.features.has("rdf")) {
|
|
10
10
|
return Maybe.empty();
|
|
11
11
|
}
|
|
@@ -64,4 +64,4 @@ const variables = {
|
|
|
64
64
|
resource: code `resource`,
|
|
65
65
|
resourceSet: code `resourceSet`,
|
|
66
66
|
};
|
|
67
|
-
//# sourceMappingURL=
|
|
67
|
+
//# sourceMappingURL=NamedObjectType_toRdfResourceFunctionOrMethodDeclaration.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
|
+
import type { NamedObjectType } from "../NamedObjectType.js";
|
|
3
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
+
export declare function NamedObjectType_valueSparqlConstructTriplesFunctionDeclaration(this: NamedObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=NamedObjectType_valueSparqlConstructTriplesFunctionDeclaration.d.ts.map
|
|
@@ -2,7 +2,7 @@ import { Maybe } from "purify-ts";
|
|
|
2
2
|
import { snippets } from "../snippets.js";
|
|
3
3
|
import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
|
|
4
4
|
import { code } from "../ts-poet-wrapper.js";
|
|
5
|
-
export function
|
|
5
|
+
export function NamedObjectType_valueSparqlConstructTriplesFunctionDeclaration() {
|
|
6
6
|
if (!this.features.has("sparql")) {
|
|
7
7
|
return Maybe.empty();
|
|
8
8
|
}
|
|
@@ -10,4 +10,4 @@ export function ObjectType_valueSparqlConstructTriplesFunctionDeclaration() {
|
|
|
10
10
|
export const ${syntheticNamePrefix}valueSparqlConstructTriples: ${snippets.ValueSparqlConstructTriplesFunction}<${this.filterType}, ${this.schemaType}> = ({ filter, ignoreRdfType, valueVariable, variablePrefix }) =>
|
|
11
11
|
${this.staticModuleName}.${syntheticNamePrefix}focusSparqlConstructTriples({ filter, focusIdentifier: valueVariable, ignoreRdfType, variablePrefix });`);
|
|
12
12
|
}
|
|
13
|
-
//# sourceMappingURL=
|
|
13
|
+
//# sourceMappingURL=NamedObjectType_valueSparqlConstructTriplesFunctionDeclaration.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
|
+
import type { NamedObjectType } from "../NamedObjectType.js";
|
|
3
|
+
import { type Code } from "../ts-poet-wrapper.js";
|
|
4
|
+
export declare function NamedObjectType_valueSparqlWherePatternsFunctionDeclaration(this: NamedObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=NamedObjectType_valueSparqlWherePatternsFunctionDeclaration.d.ts.map
|
|
@@ -2,7 +2,7 @@ import { Maybe } from "purify-ts";
|
|
|
2
2
|
import { snippets } from "../snippets.js";
|
|
3
3
|
import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
|
|
4
4
|
import { code } from "../ts-poet-wrapper.js";
|
|
5
|
-
export function
|
|
5
|
+
export function NamedObjectType_valueSparqlWherePatternsFunctionDeclaration() {
|
|
6
6
|
if (!this.features.has("sparql")) {
|
|
7
7
|
return Maybe.empty();
|
|
8
8
|
}
|
|
@@ -12,4 +12,4 @@ export const ${syntheticNamePrefix}valueSparqlWherePatterns: ${snippets.ValueSpa
|
|
|
12
12
|
${this.staticModuleName}.${syntheticNamePrefix}focusSparqlWherePatterns({ filter, focusIdentifier: valueVariable, ignoreRdfType, preferredLanguages, variablePrefix })
|
|
13
13
|
);`);
|
|
14
14
|
}
|
|
15
|
-
//# sourceMappingURL=
|
|
15
|
+
//# sourceMappingURL=NamedObjectType_valueSparqlWherePatternsFunctionDeclaration.js.map
|
|
@@ -29,7 +29,7 @@ export declare class ShaclProperty<TypeT extends Type> extends AbstractProperty<
|
|
|
29
29
|
get getAccessorDeclaration(): Maybe<Code>;
|
|
30
30
|
get graphqlField(): AbstractProperty<TypeT>["graphqlField"];
|
|
31
31
|
get jsonSignature(): Maybe<Code>;
|
|
32
|
-
get
|
|
32
|
+
get jsonZchema(): AbstractProperty<TypeT>["jsonZchema"];
|
|
33
33
|
protected get schemaObject(): {
|
|
34
34
|
path: Code | undefined;
|
|
35
35
|
kind: Code;
|
|
@@ -59,7 +59,7 @@ export class ShaclProperty extends AbstractProperty {
|
|
|
59
59
|
}
|
|
60
60
|
get declaration() {
|
|
61
61
|
const lhs = [];
|
|
62
|
-
if (this.
|
|
62
|
+
if (this.namedObjectType.declarationType === "class" &&
|
|
63
63
|
this.visibility !== "public") {
|
|
64
64
|
lhs.push(code `${this.visibility}`);
|
|
65
65
|
}
|
|
@@ -103,8 +103,8 @@ export class ShaclProperty extends AbstractProperty {
|
|
|
103
103
|
const typeJsonType = this.type.jsonType();
|
|
104
104
|
return Maybe.of(code `readonly ${this.name}${typeJsonType.optional ? "?" : ""}: ${typeJsonType.requiredName}`);
|
|
105
105
|
}
|
|
106
|
-
get
|
|
107
|
-
let schema = this.type.
|
|
106
|
+
get jsonZchema() {
|
|
107
|
+
let schema = this.type.jsonSchema({
|
|
108
108
|
context: "property",
|
|
109
109
|
});
|
|
110
110
|
this.comment.alt(this.description).ifJust((description) => {
|
|
@@ -120,7 +120,7 @@ export class ShaclProperty extends AbstractProperty {
|
|
|
120
120
|
...super.schemaObject,
|
|
121
121
|
// comment: this.comment.map(JSON.stringify).extract(),
|
|
122
122
|
// description: this.description.map(JSON.stringify).extract(),
|
|
123
|
-
path: this.
|
|
123
|
+
path: this.namedObjectType.features.has("rdf")
|
|
124
124
|
? propertyPathToCode(this.path)
|
|
125
125
|
: undefined,
|
|
126
126
|
// label: this.label.map(JSON.stringify).extract(),
|
|
@@ -135,7 +135,7 @@ export class ShaclProperty extends AbstractProperty {
|
|
|
135
135
|
constructorStatements({ variables, }) {
|
|
136
136
|
const typeConversions = this.type.conversions;
|
|
137
137
|
if (typeConversions.length === 1) {
|
|
138
|
-
switch (this.
|
|
138
|
+
switch (this.namedObjectType.declarationType) {
|
|
139
139
|
case "class":
|
|
140
140
|
return [code `this.${this.name} = ${variables.parameter};`];
|
|
141
141
|
case "interface":
|
|
@@ -144,7 +144,7 @@ export class ShaclProperty extends AbstractProperty {
|
|
|
144
144
|
}
|
|
145
145
|
let lhs;
|
|
146
146
|
const statements = [];
|
|
147
|
-
switch (this.
|
|
147
|
+
switch (this.namedObjectType.declarationType) {
|
|
148
148
|
case "class":
|
|
149
149
|
lhs = `this.${this.name}`;
|
|
150
150
|
break;
|
|
@@ -176,7 +176,7 @@ export class ShaclProperty extends AbstractProperty {
|
|
|
176
176
|
variables: {
|
|
177
177
|
...variables,
|
|
178
178
|
ignoreRdfType: true,
|
|
179
|
-
propertyPath: code `${this.
|
|
179
|
+
propertyPath: code `${this.namedObjectType.staticModuleName}.${syntheticNamePrefix}schema.properties.${this.name}.path`,
|
|
180
180
|
resourceValues: code `resourceValues`,
|
|
181
181
|
},
|
|
182
182
|
})})`,
|
|
@@ -263,5 +263,5 @@ __decorate([
|
|
|
263
263
|
], ShaclProperty.prototype, "jsonSignature", null);
|
|
264
264
|
__decorate([
|
|
265
265
|
Memoize()
|
|
266
|
-
], ShaclProperty.prototype, "
|
|
266
|
+
], ShaclProperty.prototype, "jsonZchema", null);
|
|
267
267
|
//# sourceMappingURL=ShaclProperty.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Maybe } from "purify-ts";
|
|
2
|
+
import type { NamedObjectType } from "./NamedObjectType.js";
|
|
2
3
|
import type { NamedObjectUnionType } from "./NamedObjectUnionType.js";
|
|
3
|
-
import type { ObjectType } from "./ObjectType.js";
|
|
4
4
|
import { type Code } from "./ts-poet-wrapper.js";
|
|
5
5
|
export declare function graphqlSchemaVariableStatement(parameters: {
|
|
6
|
-
|
|
6
|
+
namedObjectTypes: readonly NamedObjectType[];
|
|
7
7
|
namedObjectUnionTypes: NamedObjectUnionType[];
|
|
8
8
|
}): Maybe<Code>;
|
|
9
9
|
//# sourceMappingURL=graphqlSchemaVariableStatement.d.ts.map
|
|
@@ -2,25 +2,25 @@ import { Maybe } from "purify-ts";
|
|
|
2
2
|
import { imports } from "./imports.js";
|
|
3
3
|
import { syntheticNamePrefix } from "./syntheticNamePrefix.js";
|
|
4
4
|
import { code } from "./ts-poet-wrapper.js";
|
|
5
|
-
function graphqlQueryObjectType({
|
|
5
|
+
function graphqlQueryObjectType({ namedObjectTypes, namedObjectUnionTypes, }) {
|
|
6
6
|
return code `new ${imports.GraphQLObjectType}<null, { objectSet: ${syntheticNamePrefix}ObjectSet }>({ name: "Query", fields: ${[
|
|
7
|
-
...
|
|
7
|
+
...namedObjectTypes,
|
|
8
8
|
...namedObjectUnionTypes,
|
|
9
|
-
].reduce((fields,
|
|
10
|
-
fields[
|
|
9
|
+
].reduce((fields, namedObjectType) => {
|
|
10
|
+
fields[namedObjectType.objectSetMethodNames.object] = {
|
|
11
11
|
args: {
|
|
12
12
|
identifier: {
|
|
13
13
|
type: code `new ${imports.GraphQLNonNull}(${imports.GraphQLID})`,
|
|
14
14
|
},
|
|
15
15
|
},
|
|
16
16
|
resolve: code `\
|
|
17
|
-
async (_source, args: { identifier: string }, { objectSet }): Promise<${
|
|
18
|
-
(await ${imports.EitherAsync}<Error, ${
|
|
19
|
-
liftEither(await objectSet.${
|
|
17
|
+
async (_source, args: { identifier: string }, { objectSet }): Promise<${namedObjectType.name}> =>
|
|
18
|
+
(await ${imports.EitherAsync}<Error, ${namedObjectType.name}>(async ({ liftEither }) =>
|
|
19
|
+
liftEither(await objectSet.${namedObjectType.objectSetMethodNames.object}(await liftEither(${namedObjectType.identifierTypeAlias}.fromString(args.identifier))))
|
|
20
20
|
)).unsafeCoerce()`,
|
|
21
|
-
type:
|
|
21
|
+
type: namedObjectType.graphqlType.name,
|
|
22
22
|
};
|
|
23
|
-
fields[
|
|
23
|
+
fields[namedObjectType.objectSetMethodNames.objectIdentifiers] = {
|
|
24
24
|
args: {
|
|
25
25
|
limit: {
|
|
26
26
|
type: code `${imports.GraphQLInt}`,
|
|
@@ -31,10 +31,10 @@ async (_source, args: { identifier: string }, { objectSet }): Promise<${objectTy
|
|
|
31
31
|
},
|
|
32
32
|
resolve: code `\
|
|
33
33
|
async (_source, args: { limit: number | null; offset: number | null; }, { objectSet }): Promise<readonly string[]> =>
|
|
34
|
-
(await objectSet.${
|
|
34
|
+
(await objectSet.${namedObjectType.objectSetMethodNames.objectIdentifiers}({ limit: args.limit !== null ? args.limit : undefined, offset: args.offset !== null ? args.offset : undefined })).unsafeCoerce().map(${namedObjectType.identifierTypeAlias}.toString)`,
|
|
35
35
|
type: code `new ${imports.GraphQLNonNull}(new ${imports.GraphQLList}(${imports.GraphQLString}))`,
|
|
36
36
|
};
|
|
37
|
-
fields[
|
|
37
|
+
fields[namedObjectType.objectSetMethodNames.objects] = {
|
|
38
38
|
args: {
|
|
39
39
|
identifiers: {
|
|
40
40
|
type: code `new ${imports.GraphQLList}(new ${imports.GraphQLNonNull}(${imports.GraphQLID}))`,
|
|
@@ -47,36 +47,36 @@ async (_source, args: { identifier: string }, { objectSet }): Promise<${objectTy
|
|
|
47
47
|
},
|
|
48
48
|
},
|
|
49
49
|
resolve: code `\
|
|
50
|
-
async (_source, args: { identifiers: readonly string[] | null; limit: number | null; offset: number | null; }, { objectSet }): Promise<readonly ${
|
|
51
|
-
(await ${imports.EitherAsync}<Error, readonly ${
|
|
52
|
-
let filter: ${
|
|
50
|
+
async (_source, args: { identifiers: readonly string[] | null; limit: number | null; offset: number | null; }, { objectSet }): Promise<readonly ${namedObjectType.name}[]> =>
|
|
51
|
+
(await ${imports.EitherAsync}<Error, readonly ${namedObjectType.name}[]>(async ({ liftEither }) => {
|
|
52
|
+
let filter: ${namedObjectType.filterType} | undefined;
|
|
53
53
|
if (args.identifiers) {
|
|
54
|
-
const identifiers: ${
|
|
54
|
+
const identifiers: ${namedObjectType.identifierTypeAlias}[] = [];
|
|
55
55
|
for (const identifierArg of args.identifiers) {
|
|
56
|
-
identifiers.push(await liftEither(${
|
|
56
|
+
identifiers.push(await liftEither(${namedObjectType.identifierTypeAlias}.fromString(identifierArg)));
|
|
57
57
|
}
|
|
58
58
|
filter = { ${syntheticNamePrefix}identifier: { in: identifiers } };
|
|
59
59
|
}
|
|
60
|
-
return await liftEither(await objectSet.${
|
|
60
|
+
return await liftEither(await objectSet.${namedObjectType.objectSetMethodNames.objects}({ filter, limit: args.limit !== null ? args.limit : undefined, offset: args.offset !== null ? args.offset : undefined }));
|
|
61
61
|
})).unsafeCoerce()`,
|
|
62
|
-
type: code `new ${imports.GraphQLNonNull}(new ${imports.GraphQLList}(${
|
|
62
|
+
type: code `new ${imports.GraphQLNonNull}(new ${imports.GraphQLList}(${namedObjectType.graphqlType.name}))`,
|
|
63
63
|
};
|
|
64
|
-
fields[
|
|
64
|
+
fields[namedObjectType.objectSetMethodNames.objectCount] = {
|
|
65
65
|
resolve: code `\
|
|
66
|
-
async (_source, _args, { objectSet }): Promise<number> => (await objectSet.${
|
|
66
|
+
async (_source, _args, { objectSet }): Promise<number> => (await objectSet.${namedObjectType.objectSetMethodNames.objectCount}()).unsafeCoerce()`,
|
|
67
67
|
type: code `new ${imports.GraphQLNonNull}(${imports.GraphQLInt})`,
|
|
68
68
|
};
|
|
69
69
|
return fields;
|
|
70
70
|
}, {})} })`;
|
|
71
71
|
}
|
|
72
72
|
export function graphqlSchemaVariableStatement(parameters) {
|
|
73
|
-
const
|
|
73
|
+
const namedObjectTypes = parameters.namedObjectTypes.filter((namedObjectType) => namedObjectType.features.has("graphql") && !namedObjectType.synthetic);
|
|
74
74
|
const namedObjectUnionTypes = parameters.namedObjectUnionTypes.filter((namedObjectUnionType) => namedObjectUnionType.features.has("graphql"));
|
|
75
|
-
if (
|
|
75
|
+
if (namedObjectTypes.length === 0) {
|
|
76
76
|
return Maybe.empty();
|
|
77
77
|
}
|
|
78
78
|
return Maybe.of(code `\
|
|
79
|
-
export const graphqlSchema = new ${imports.GraphQLSchema}({ query: ${graphqlQueryObjectType({
|
|
79
|
+
export const graphqlSchema = new ${imports.GraphQLSchema}({ query: ${graphqlQueryObjectType({ namedObjectTypes: namedObjectTypes, namedObjectUnionTypes })} });
|
|
80
80
|
`);
|
|
81
81
|
}
|
|
82
82
|
//# sourceMappingURL=graphqlSchemaVariableStatement.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import type { NamedObjectType } from "./NamedObjectType.js";
|
|
1
2
|
import type { NamedObjectUnionType } from "./NamedObjectUnionType.js";
|
|
2
|
-
import type { ObjectType } from "./ObjectType.js";
|
|
3
3
|
import type { Code } from "./ts-poet-wrapper.js";
|
|
4
4
|
export declare function objectSetDeclarations({ namedObjectUnionTypes, ...parameters }: {
|
|
5
|
-
|
|
5
|
+
namedObjectTypes: readonly NamedObjectType[];
|
|
6
6
|
namedObjectUnionTypes: readonly NamedObjectUnionType[];
|
|
7
7
|
}): readonly Code[];
|
|
8
8
|
//# sourceMappingURL=objectSetDeclarations.d.ts.map
|
|
@@ -2,18 +2,21 @@ import { objectSetInterfaceDeclaration } from "./objectSetInterfaceDeclaration.j
|
|
|
2
2
|
import { rdfjsDatasetObjectSetClassDeclaration } from "./rdfjsDatasetObjectSetClassDeclaration.js";
|
|
3
3
|
import { sparqlObjectSetClassDeclaration } from "./sparqlObjectSetClassDeclaration.js";
|
|
4
4
|
export function objectSetDeclarations({ namedObjectUnionTypes, ...parameters }) {
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
const namedObjectTypes = parameters.namedObjectTypes.filter((namedObjectType) => !namedObjectType.abstract &&
|
|
6
|
+
!namedObjectType.extern &&
|
|
7
|
+
!namedObjectType.synthetic);
|
|
8
|
+
let namedObjectTypesWithRdfFeatureCount = 0;
|
|
9
|
+
let namedObjectTypesWithSparqlFeatureCount = 0;
|
|
10
|
+
for (const namedObjectType of namedObjectTypes) {
|
|
11
|
+
if (!namedObjectType.features.has("rdf") &&
|
|
12
|
+
!namedObjectType.features.has("sparql")) {
|
|
10
13
|
continue;
|
|
11
14
|
}
|
|
12
|
-
if (
|
|
13
|
-
|
|
15
|
+
if (namedObjectType.features.has("rdf")) {
|
|
16
|
+
namedObjectTypesWithRdfFeatureCount++;
|
|
14
17
|
}
|
|
15
|
-
if (
|
|
16
|
-
|
|
18
|
+
if (namedObjectType.features.has("sparql")) {
|
|
19
|
+
namedObjectTypesWithSparqlFeatureCount++;
|
|
17
20
|
}
|
|
18
21
|
}
|
|
19
22
|
let namedObjectUnionTypesWithRdfFeatureCount = 0;
|
|
@@ -30,27 +33,27 @@ export function objectSetDeclarations({ namedObjectUnionTypes, ...parameters })
|
|
|
30
33
|
namedObjectUnionTypesWithSparqlFeatureCount++;
|
|
31
34
|
}
|
|
32
35
|
}
|
|
33
|
-
if (
|
|
34
|
-
|
|
36
|
+
if (namedObjectTypesWithRdfFeatureCount === 0 &&
|
|
37
|
+
namedObjectTypesWithSparqlFeatureCount === 0 &&
|
|
35
38
|
namedObjectUnionTypesWithRdfFeatureCount === 0 &&
|
|
36
39
|
namedObjectUnionTypesWithSparqlFeatureCount === 0) {
|
|
37
40
|
return [];
|
|
38
41
|
}
|
|
39
42
|
const declarations = [
|
|
40
43
|
objectSetInterfaceDeclaration({
|
|
41
|
-
|
|
44
|
+
namedObjectTypes: namedObjectTypes,
|
|
42
45
|
namedObjectUnionTypes,
|
|
43
46
|
}),
|
|
44
47
|
];
|
|
45
|
-
if (
|
|
48
|
+
if (namedObjectTypesWithRdfFeatureCount > 0) {
|
|
46
49
|
declarations.push(rdfjsDatasetObjectSetClassDeclaration({
|
|
47
|
-
|
|
50
|
+
namedObjectTypes: namedObjectTypes,
|
|
48
51
|
namedObjectUnionTypes,
|
|
49
52
|
}));
|
|
50
53
|
}
|
|
51
|
-
if (
|
|
54
|
+
if (namedObjectTypesWithSparqlFeatureCount > 0) {
|
|
52
55
|
declarations.push(sparqlObjectSetClassDeclaration({
|
|
53
|
-
|
|
56
|
+
namedObjectTypes: namedObjectTypes,
|
|
54
57
|
namedObjectUnionTypes,
|
|
55
58
|
}));
|
|
56
59
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import type { NamedObjectType } from "./NamedObjectType.js";
|
|
1
2
|
import type { NamedObjectUnionType } from "./NamedObjectUnionType.js";
|
|
2
|
-
import type { ObjectType } from "./ObjectType.js";
|
|
3
3
|
import { type Code } from "./ts-poet-wrapper.js";
|
|
4
|
-
export declare function objectSetInterfaceDeclaration({
|
|
5
|
-
|
|
4
|
+
export declare function objectSetInterfaceDeclaration({ namedObjectTypes, namedObjectUnionTypes, }: {
|
|
5
|
+
namedObjectTypes: readonly NamedObjectType[];
|
|
6
6
|
namedObjectUnionTypes: readonly NamedObjectUnionType[];
|
|
7
7
|
}): Code;
|
|
8
8
|
//# sourceMappingURL=objectSetInterfaceDeclaration.d.ts.map
|
|
@@ -2,12 +2,14 @@ import { imports } from "./imports.js";
|
|
|
2
2
|
import { objectSetMethodSignatures } from "./objectSetMethodSignatures.js";
|
|
3
3
|
import { syntheticNamePrefix } from "./syntheticNamePrefix.js";
|
|
4
4
|
import { code, joinCode } from "./ts-poet-wrapper.js";
|
|
5
|
-
export function objectSetInterfaceDeclaration({
|
|
5
|
+
export function objectSetInterfaceDeclaration({ namedObjectTypes, namedObjectUnionTypes, }) {
|
|
6
6
|
return code `\
|
|
7
7
|
export interface ${syntheticNamePrefix}ObjectSet {
|
|
8
|
-
${joinCode(
|
|
9
|
-
.flatMap((
|
|
10
|
-
.concat(namedObjectUnionTypes.flatMap((namedObjectUnionType) => Object.values(objectSetMethodSignatures({
|
|
8
|
+
${joinCode(namedObjectTypes
|
|
9
|
+
.flatMap((namedObjectType) => Object.values(objectSetMethodSignatures({ namedObjectType })))
|
|
10
|
+
.concat(namedObjectUnionTypes.flatMap((namedObjectUnionType) => Object.values(objectSetMethodSignatures({
|
|
11
|
+
namedObjectType: namedObjectUnionType,
|
|
12
|
+
}))))
|
|
11
13
|
.map((methodSignature) => code `${methodSignature.name}(${methodSignature.parameters}): ${methodSignature.returnType};`), { on: "\n\n" })}
|
|
12
14
|
}
|
|
13
15
|
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { NamedObjectType } from "./NamedObjectType.js";
|
|
2
2
|
import { type Code } from "./ts-poet-wrapper.js";
|
|
3
3
|
export declare function objectSetMethodSignatures(parameters: {
|
|
4
|
-
|
|
4
|
+
namedObjectType: {
|
|
5
5
|
readonly filterType: Code;
|
|
6
6
|
readonly identifierTypeAlias: Code;
|
|
7
|
-
readonly objectSetMethodNames:
|
|
7
|
+
readonly objectSetMethodNames: NamedObjectType.ObjectSetMethodNames;
|
|
8
8
|
readonly name: string;
|
|
9
9
|
};
|
|
10
10
|
parameterNamePrefix?: string;
|
|
11
11
|
queryT?: string;
|
|
12
|
-
}): Readonly<Record<keyof
|
|
12
|
+
}): Readonly<Record<keyof NamedObjectType.ObjectSetMethodNames, {
|
|
13
13
|
readonly name: string;
|
|
14
14
|
readonly parameters: Code;
|
|
15
15
|
readonly returnType: Code;
|