@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
|
@@ -39,8 +39,8 @@ export class IdentifierProperty extends AbstractProperty {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
const hasQuestionToken = this.identifierMintingStrategy.isJust() ||
|
|
42
|
-
this.
|
|
43
|
-
this.
|
|
42
|
+
this.namedObjectType.ancestorObjectTypes.some((ancestorObjectType) => ancestorObjectType.identifierProperty.identifierMintingStrategy.isJust()) ||
|
|
43
|
+
this.namedObjectType.descendantObjectTypes.some((descendantObjectType) => descendantObjectType.identifierProperty.identifierMintingStrategy.isJust());
|
|
44
44
|
const typeNames = [];
|
|
45
45
|
for (const conversion of this.type.conversions) {
|
|
46
46
|
if (conversion.sourceTypeof !== "undefined" &&
|
|
@@ -91,7 +91,7 @@ export class IdentifierProperty extends AbstractProperty {
|
|
|
91
91
|
break;
|
|
92
92
|
case "sha256":
|
|
93
93
|
// If the object is mutable don't memoize the minted identifier, since the hash will change if the object mutates.
|
|
94
|
-
memoizeMintedIdentifier = !this.
|
|
94
|
+
memoizeMintedIdentifier = !this.namedObjectType.mutable;
|
|
95
95
|
mintIdentifier = code `${imports.dataFactory}.namedNode(\`\${this.${this.identifierPrefixPropertyName}}\${this.${syntheticNamePrefix}hashShaclProperties(${imports.sha256}.create())}\`)`;
|
|
96
96
|
break;
|
|
97
97
|
case "uuidv4":
|
|
@@ -107,11 +107,11 @@ export class IdentifierProperty extends AbstractProperty {
|
|
|
107
107
|
])} }`);
|
|
108
108
|
}
|
|
109
109
|
// If this object type has an ancestor or a descendant with an identifier minting strategy, declare a get accessor.
|
|
110
|
-
if (this.
|
|
111
|
-
this.
|
|
112
|
-
if (this.
|
|
110
|
+
if (this.namedObjectType.ancestorObjectTypes.some((ancestorObjectType) => ancestorObjectType.identifierProperty.identifierMintingStrategy.isJust()) ||
|
|
111
|
+
this.namedObjectType.descendantObjectTypes.some((descendantObjectType) => descendantObjectType.identifierProperty.identifierMintingStrategy.isJust())) {
|
|
112
|
+
if (this.namedObjectType.parentObjectTypes.length > 0) {
|
|
113
113
|
// If this object type isn't the root, delegate up.
|
|
114
|
-
const checkSuperIdentifierTermTypeStatements = checkIdentifierTermTypeStatements("identifier", this.
|
|
114
|
+
const checkSuperIdentifierTermTypeStatements = checkIdentifierTermTypeStatements("identifier", this.namedObjectType.parentObjectTypes[0].identifierType.nodeKinds);
|
|
115
115
|
if (checkSuperIdentifierTermTypeStatements.length === 0) {
|
|
116
116
|
return Maybe.empty(); // Don't need a get accessor just to return super.identifier.
|
|
117
117
|
}
|
|
@@ -148,7 +148,7 @@ export class IdentifierProperty extends AbstractProperty {
|
|
|
148
148
|
}
|
|
149
149
|
return Maybe.of(code `readonly "@id": string`);
|
|
150
150
|
}
|
|
151
|
-
get
|
|
151
|
+
get jsonZchema() {
|
|
152
152
|
let schema;
|
|
153
153
|
if (this.type.in_.length > 0 && this.type.kind === "IriType") {
|
|
154
154
|
// Treat sh:in as a union of the IRIs
|
|
@@ -172,22 +172,22 @@ export class IdentifierProperty extends AbstractProperty {
|
|
|
172
172
|
// };
|
|
173
173
|
// }
|
|
174
174
|
get abstract() {
|
|
175
|
-
return this.
|
|
175
|
+
return this.namedObjectType.abstract;
|
|
176
176
|
}
|
|
177
177
|
get declarationModifiers() {
|
|
178
|
-
if (this.
|
|
178
|
+
if (this.namedObjectType.declarationType === "interface") {
|
|
179
179
|
return Maybe.of({ readonly: true });
|
|
180
180
|
}
|
|
181
|
-
if (this.
|
|
181
|
+
if (this.namedObjectType.parentObjectTypes.length > 0) {
|
|
182
182
|
// An ancestor will declare the identifier property.
|
|
183
183
|
return Maybe.empty();
|
|
184
184
|
}
|
|
185
185
|
if (this.identifierMintingStrategy.isJust() ||
|
|
186
|
-
this.
|
|
187
|
-
this.
|
|
186
|
+
this.namedObjectType.ancestorObjectTypes.some((ancestorObjectType) => ancestorObjectType.identifierProperty.identifierMintingStrategy.isJust()) ||
|
|
187
|
+
this.namedObjectType.descendantObjectTypes.some((descendantObjectType) => descendantObjectType.identifierProperty.identifierMintingStrategy.isJust())) {
|
|
188
188
|
return Maybe.of({
|
|
189
189
|
hasQuestionToken: true,
|
|
190
|
-
visibility: this.
|
|
190
|
+
visibility: this.namedObjectType.descendantObjectTypes.some((descendantObjectType) => descendantObjectType.identifierProperty.identifierMintingStrategy.isJust())
|
|
191
191
|
? "protected"
|
|
192
192
|
: "private",
|
|
193
193
|
});
|
|
@@ -207,10 +207,10 @@ export class IdentifierProperty extends AbstractProperty {
|
|
|
207
207
|
});
|
|
208
208
|
}
|
|
209
209
|
get declarationName() {
|
|
210
|
-
if (this.
|
|
210
|
+
if (this.namedObjectType.declarationType === "class" &&
|
|
211
211
|
(this.identifierMintingStrategy.isJust() ||
|
|
212
|
-
this.
|
|
213
|
-
this.
|
|
212
|
+
this.namedObjectType.ancestorObjectTypes.some((ancestorObjectType) => ancestorObjectType.identifierProperty.identifierMintingStrategy.isJust()) ||
|
|
213
|
+
this.namedObjectType.descendantObjectTypes.some((descendantObjectType) => descendantObjectType.identifierProperty.identifierMintingStrategy.isJust()))) {
|
|
214
214
|
// If this, an ancestor, or a descendant has an identifier minting strategy, declare the identifier property
|
|
215
215
|
// private or protected and prefix its name with _ in order to avoid a conflict with the get accessor name.
|
|
216
216
|
return `_${this.name}`;
|
|
@@ -218,7 +218,7 @@ export class IdentifierProperty extends AbstractProperty {
|
|
|
218
218
|
return this.name;
|
|
219
219
|
}
|
|
220
220
|
get override() {
|
|
221
|
-
return this.
|
|
221
|
+
return this.namedObjectType.parentObjectTypes.length > 0;
|
|
222
222
|
}
|
|
223
223
|
constructorStatements({ variables, }) {
|
|
224
224
|
const constructorParametersSignature = this.constructorParametersSignature.extractNullable();
|
|
@@ -228,7 +228,7 @@ export class IdentifierProperty extends AbstractProperty {
|
|
|
228
228
|
let lhs;
|
|
229
229
|
const statements = [];
|
|
230
230
|
const typeConversions = this.type.conversions;
|
|
231
|
-
switch (this.
|
|
231
|
+
switch (this.namedObjectType.declarationType) {
|
|
232
232
|
case "class": {
|
|
233
233
|
if (this.declaration.isNothing()) {
|
|
234
234
|
return [];
|
|
@@ -247,7 +247,7 @@ export class IdentifierProperty extends AbstractProperty {
|
|
|
247
247
|
conversionBranches.push(code `if (${conversion.sourceTypeCheckExpression(variables.parameter)}) { ${lhs} = ${conversion.conversionExpression(variables.parameter)}; }`);
|
|
248
248
|
}
|
|
249
249
|
this.identifierMintingStrategy.ifJust((identifierMintingStrategy) => {
|
|
250
|
-
switch (this.
|
|
250
|
+
switch (this.namedObjectType.declarationType) {
|
|
251
251
|
case "class":
|
|
252
252
|
// The identifier will be minted lazily in the get accessor
|
|
253
253
|
invariant(this.getAccessorDeclaration.isJust());
|
|
@@ -260,10 +260,10 @@ export class IdentifierProperty extends AbstractProperty {
|
|
|
260
260
|
mintIdentifier = code `${imports.dataFactory}.blankNode()`;
|
|
261
261
|
break;
|
|
262
262
|
case "sha256":
|
|
263
|
-
logger.warn("minting %s identifiers with %s is unsupported", this.
|
|
263
|
+
logger.warn("minting %s identifiers with %s is unsupported", this.namedObjectType.declarationType, identifierMintingStrategy);
|
|
264
264
|
return;
|
|
265
265
|
case "uuidv4":
|
|
266
|
-
mintIdentifier = code `${imports.dataFactory}.namedNode(\`\${${variables.parameters}.${this.identifierPrefixPropertyName} ?? "urn:shaclmate:${this.
|
|
266
|
+
mintIdentifier = code `${imports.dataFactory}.namedNode(\`\${${variables.parameters}.${this.identifierPrefixPropertyName} ?? "urn:shaclmate:${this.namedObjectType.discriminantValue}:"}\${${imports.uuid}.v4()}\`)`;
|
|
267
267
|
break;
|
|
268
268
|
}
|
|
269
269
|
conversionBranches.push(code `if (${variables.parameter} === undefined) { ${lhs} = ${mintIdentifier}; }`);
|
|
@@ -306,7 +306,7 @@ export class IdentifierProperty extends AbstractProperty {
|
|
|
306
306
|
ignoreRdfType: true, // Unused
|
|
307
307
|
preferredLanguages: variables.preferredLanguages,
|
|
308
308
|
propertyPatterns: code `[]`,
|
|
309
|
-
schema: code `${this.
|
|
309
|
+
schema: code `${this.namedObjectType.staticModuleName}.${syntheticNamePrefix}schema.properties.${this.namedObjectType.identifierProperty.name}.type()`,
|
|
310
310
|
valueVariable: variables.focusIdentifier,
|
|
311
311
|
variablePrefix: variables.variablePrefix, // Unused
|
|
312
312
|
}})`,
|
|
@@ -357,7 +357,7 @@ __decorate([
|
|
|
357
357
|
], IdentifierProperty.prototype, "jsonSignature", null);
|
|
358
358
|
__decorate([
|
|
359
359
|
Memoize()
|
|
360
|
-
], IdentifierProperty.prototype, "
|
|
360
|
+
], IdentifierProperty.prototype, "jsonZchema", null);
|
|
361
361
|
__decorate([
|
|
362
362
|
Memoize()
|
|
363
363
|
], IdentifierProperty.prototype, "declarationModifiers", null);
|
|
@@ -2,11 +2,11 @@ import { Maybe } from "purify-ts";
|
|
|
2
2
|
import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
|
|
3
3
|
import { code, def, joinCode } from "../ts-poet-wrapper.js";
|
|
4
4
|
import { tsComment } from "../tsComment.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
function
|
|
5
|
+
import { NamedObjectType_equalsFunctionOrMethodDeclaration } from "./NamedObjectType_equalsFunctionOrMethodDeclaration.js";
|
|
6
|
+
import { NamedObjectType_hashFunctionOrMethodDeclarations } from "./NamedObjectType_hashFunctionOrMethodDeclarations.js";
|
|
7
|
+
import { NamedObjectType_toJsonFunctionOrMethodDeclaration } from "./NamedObjectType_toJsonFunctionOrMethodDeclaration.js";
|
|
8
|
+
import { NamedObjectType_toRdfResourceFunctionOrMethodDeclaration } from "./NamedObjectType_toRdfResourceFunctionOrMethodDeclaration.js";
|
|
9
|
+
function NamedObjectType_constructorDeclaration() {
|
|
10
10
|
const parametersPropertySignatures = this.properties.flatMap((property) => property.constructorParametersSignature.toList());
|
|
11
11
|
const parametersType = [];
|
|
12
12
|
if (parametersPropertySignatures.length > 0) {
|
|
@@ -41,7 +41,7 @@ constructor(${statements.length > 0 ? "parameters" : "_parameters"}${parametersH
|
|
|
41
41
|
${joinCode(statements)}
|
|
42
42
|
}`;
|
|
43
43
|
}
|
|
44
|
-
export function
|
|
44
|
+
export function NamedObjectType_classDeclaration() {
|
|
45
45
|
this.ensureAtMostOneSuperObjectType();
|
|
46
46
|
return code `\
|
|
47
47
|
${this.comment
|
|
@@ -50,20 +50,20 @@ ${this.comment
|
|
|
50
50
|
.orDefault("")}export ${this.abstract ? "abstract " : ""}class ${def(this.name)}${this.parentObjectTypes.length > 0 ? ` extends ${this.parentObjectTypes[0].name}` : ""} {
|
|
51
51
|
${joinCode([
|
|
52
52
|
...this.properties.flatMap((property) => property.declaration.toList()),
|
|
53
|
-
|
|
53
|
+
NamedObjectType_constructorDeclaration.call(this),
|
|
54
54
|
...this.properties.flatMap((property) => property.getAccessorDeclaration.toList()),
|
|
55
|
-
...
|
|
56
|
-
...
|
|
57
|
-
...
|
|
58
|
-
...
|
|
59
|
-
...
|
|
55
|
+
...NamedObjectType_equalsFunctionOrMethodDeclaration.call(this).toList(),
|
|
56
|
+
...NamedObjectType_hashFunctionOrMethodDeclarations.call(this),
|
|
57
|
+
...NamedObjectType_toJsonFunctionOrMethodDeclaration.call(this).toList(),
|
|
58
|
+
...NamedObjectType_toRdfResourceFunctionOrMethodDeclaration.call(this).toList(),
|
|
59
|
+
...NamedObjectType_toStringMethodDeclaration.call(this).toList(),
|
|
60
60
|
], { on: "\n\n" })}
|
|
61
61
|
}`;
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function NamedObjectType_toStringMethodDeclaration() {
|
|
64
64
|
if (!this.features.has("json")) {
|
|
65
65
|
return Maybe.empty();
|
|
66
66
|
}
|
|
67
67
|
return Maybe.of(code `${this.parentObjectTypes.length > 0 ? "override " : ""}toString(): string { return JSON.stringify(this.${syntheticNamePrefix}toJson()); }`);
|
|
68
68
|
}
|
|
69
|
-
//# sourceMappingURL=
|
|
69
|
+
//# sourceMappingURL=NamedObjectType_classDeclaration.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_createFunctionDeclaration(this: NamedObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=NamedObjectType_createFunctionDeclaration.d.ts.map
|
|
@@ -2,7 +2,7 @@ import { Maybe } from "purify-ts";
|
|
|
2
2
|
import { invariant } from "ts-invariant";
|
|
3
3
|
import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
|
|
4
4
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
5
|
-
export function
|
|
5
|
+
export function NamedObjectType_createFunctionDeclaration() {
|
|
6
6
|
if (!this.features.has("create")) {
|
|
7
7
|
return Maybe.empty();
|
|
8
8
|
}
|
|
@@ -49,4 +49,4 @@ export function ${syntheticNamePrefix}create(parameters${parametersHasQuestionTo
|
|
|
49
49
|
return { ${propertyInitializers.join(", ")} };
|
|
50
50
|
}`);
|
|
51
51
|
}
|
|
52
|
-
//# sourceMappingURL=
|
|
52
|
+
//# sourceMappingURL=NamedObjectType_createFunctionDeclaration.js.map
|
package/dist/generators/ts/_NamedObjectType/NamedObjectType_equalsFunctionOrMethodDeclaration.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_equalsFunctionOrMethodDeclaration(this: NamedObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=NamedObjectType_equalsFunctionOrMethodDeclaration.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, joinCode } from "../ts-poet-wrapper.js";
|
|
5
|
-
export function
|
|
5
|
+
export function NamedObjectType_equalsFunctionOrMethodDeclaration() {
|
|
6
6
|
if (!this.features.has("equals")) {
|
|
7
7
|
return Maybe.empty();
|
|
8
8
|
}
|
|
@@ -48,4 +48,4 @@ ${preamble}${syntheticNamePrefix}equals(${parameters}): ${snippets.EqualsResult}
|
|
|
48
48
|
return ${joinCode(chain.map((chainPart, chainPartI) => chainPartI === 0 ? chainPart : code `chain(() => ${chainPart})`), { on: "." })}
|
|
49
49
|
}`);
|
|
50
50
|
}
|
|
51
|
-
//# sourceMappingURL=
|
|
51
|
+
//# sourceMappingURL=NamedObjectType_equalsFunctionOrMethodDeclaration.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_filterFunctionDeclaration(this: NamedObjectType): Code;
|
|
4
|
+
//# sourceMappingURL=NamedObjectType_filterFunctionDeclaration.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
|
|
2
2
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
3
|
-
export function
|
|
3
|
+
export function NamedObjectType_filterFunctionDeclaration() {
|
|
4
4
|
const statements = [];
|
|
5
5
|
for (const parentObjectType of this.parentObjectTypes) {
|
|
6
6
|
statements.push(code `if (!${parentObjectType.filterFunction}(filter, value)) { return false; }`);
|
|
@@ -18,4 +18,4 @@ export function ${syntheticNamePrefix}filter(filter: ${this.filterType}, value:
|
|
|
18
18
|
${joinCode(statements)}
|
|
19
19
|
}`;
|
|
20
20
|
}
|
|
21
|
-
//# sourceMappingURL=
|
|
21
|
+
//# sourceMappingURL=NamedObjectType_filterFunctionDeclaration.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_filterTypeDeclaration(this: NamedObjectType): Code;
|
|
4
|
+
//# sourceMappingURL=NamedObjectType_filterTypeDeclaration.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
|
|
2
2
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
3
|
-
export function
|
|
3
|
+
export function NamedObjectType_filterTypeDeclaration() {
|
|
4
4
|
const members = [];
|
|
5
5
|
if (this.properties.length > 0) {
|
|
6
6
|
const filterProperties = {};
|
|
@@ -19,4 +19,4 @@ export function ObjectType_filterTypeDeclaration() {
|
|
|
19
19
|
return code `\
|
|
20
20
|
export type ${syntheticNamePrefix}Filter = ${members.length > 0 ? joinCode(members, { on: " & " }) : "object"};`;
|
|
21
21
|
}
|
|
22
|
-
//# sourceMappingURL=
|
|
22
|
+
//# sourceMappingURL=NamedObjectType_filterTypeDeclaration.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_focusSparqlConstructTriplesFunctionDeclaration(this: NamedObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.d.ts.map
|
|
@@ -10,7 +10,7 @@ const variables = {
|
|
|
10
10
|
focusIdentifier: code `parameters.focusIdentifier`,
|
|
11
11
|
variablePrefix: code `parameters.variablePrefix`,
|
|
12
12
|
};
|
|
13
|
-
export function
|
|
13
|
+
export function NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration() {
|
|
14
14
|
if (!this.features.has("sparql")) {
|
|
15
15
|
return Maybe.empty();
|
|
16
16
|
}
|
|
@@ -55,4 +55,4 @@ ${statements.length > 0
|
|
|
55
55
|
: "return [];"}
|
|
56
56
|
};`);
|
|
57
57
|
}
|
|
58
|
-
//# sourceMappingURL=
|
|
58
|
+
//# sourceMappingURL=NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.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_focusSparqlWherePatternsFunctionDeclaration(this: NamedObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.d.ts.map
|
|
@@ -11,7 +11,7 @@ const variables = {
|
|
|
11
11
|
focusIdentifier: code `parameters.focusIdentifier`,
|
|
12
12
|
variablePrefix: code `parameters.variablePrefix`,
|
|
13
13
|
};
|
|
14
|
-
export function
|
|
14
|
+
export function NamedObjectType_focusSparqlWherePatternsFunctionDeclaration() {
|
|
15
15
|
if (!this.features.has("sparql")) {
|
|
16
16
|
return Maybe.empty();
|
|
17
17
|
}
|
|
@@ -103,4 +103,4 @@ ${statements.length > 0
|
|
|
103
103
|
: "return [];"}
|
|
104
104
|
};`);
|
|
105
105
|
}
|
|
106
|
-
//# sourceMappingURL=
|
|
106
|
+
//# sourceMappingURL=NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.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_fromJsonFunctionDeclaration(this: NamedObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=NamedObjectType_fromJsonFunctionDeclaration.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 } from "../ts-poet-wrapper.js";
|
|
4
|
-
export function
|
|
4
|
+
export function NamedObjectType_fromJsonFunctionDeclaration() {
|
|
5
5
|
if (!this.features.has("json")) {
|
|
6
6
|
return Maybe.empty();
|
|
7
7
|
}
|
|
@@ -17,4 +17,4 @@ export function ${syntheticNamePrefix}fromJson(json: ${this.jsonType().name}): $
|
|
|
17
17
|
return ${returnExpression};
|
|
18
18
|
}`);
|
|
19
19
|
}
|
|
20
|
-
//# sourceMappingURL=
|
|
20
|
+
//# sourceMappingURL=NamedObjectType_fromJsonFunctionDeclaration.js.map
|
package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceFunctionDeclaration.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_fromRdfResourceFunctionDeclaration(this: NamedObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=NamedObjectType_fromRdfResourceFunctionDeclaration.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, joinCode } from "../ts-poet-wrapper.js";
|
|
5
|
-
export function
|
|
5
|
+
export function NamedObjectType_fromRdfResourceFunctionDeclaration() {
|
|
6
6
|
if (!this.features.has("rdf")) {
|
|
7
7
|
return Maybe.empty();
|
|
8
8
|
}
|
|
@@ -23,4 +23,4 @@ export const ${syntheticNamePrefix}fromRdfResource: ${snippets.FromRdfResourceFu
|
|
|
23
23
|
${joinCode(statements)}
|
|
24
24
|
};`);
|
|
25
25
|
}
|
|
26
|
-
//# sourceMappingURL=
|
|
26
|
+
//# sourceMappingURL=NamedObjectType_fromRdfResourceFunctionDeclaration.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_fromRdfResourceValuesFunctionDeclaration(this: NamedObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=NamedObjectType_fromRdfResourceValuesFunctionDeclaration.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_fromRdfResourceValuesFunctionDeclaration() {
|
|
6
6
|
if (!this.features.has("rdf")) {
|
|
7
7
|
return Maybe.empty();
|
|
8
8
|
}
|
|
@@ -17,4 +17,4 @@ export const ${syntheticNamePrefix}fromRdfResourceValues: ${snippets.FromRdfReso
|
|
|
17
17
|
)
|
|
18
18
|
);`);
|
|
19
19
|
}
|
|
20
|
-
//# sourceMappingURL=
|
|
20
|
+
//# sourceMappingURL=NamedObjectType_fromRdfResourceValuesFunctionDeclaration.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_fromRdfTypeVariableStatement(this: NamedObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=NamedObjectType_fromRdfTypeVariableStatement.d.ts.map
|
|
@@ -3,11 +3,11 @@ import { imports } from "../imports.js";
|
|
|
3
3
|
import { rdfjsTermExpression } from "../rdfjsTermExpression.js";
|
|
4
4
|
import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
|
|
5
5
|
import { code } from "../ts-poet-wrapper.js";
|
|
6
|
-
export function
|
|
6
|
+
export function NamedObjectType_fromRdfTypeVariableStatement() {
|
|
7
7
|
if (!this.features.has("rdf")) {
|
|
8
8
|
return Maybe.empty();
|
|
9
9
|
}
|
|
10
10
|
return this.fromRdfType.map((fromRdfType) => code `\
|
|
11
11
|
export const ${syntheticNamePrefix}fromRdfType: ${imports.NamedNode}<string> = ${rdfjsTermExpression(fromRdfType)};`);
|
|
12
12
|
}
|
|
13
|
-
//# sourceMappingURL=
|
|
13
|
+
//# sourceMappingURL=NamedObjectType_fromRdfTypeVariableStatement.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_graphqlTypeVariableStatement(this: NamedObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=NamedObjectType_graphqlTypeVariableStatement.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_graphqlTypeVariableStatement() {
|
|
6
6
|
if (!this.features.has("graphql")) {
|
|
7
7
|
return Maybe.empty();
|
|
8
8
|
}
|
|
@@ -32,4 +32,4 @@ export const ${syntheticNamePrefix}GraphQL = new ${imports.GraphQLObjectType}<${
|
|
|
32
32
|
name: this.name,
|
|
33
33
|
}});`);
|
|
34
34
|
}
|
|
35
|
-
//# sourceMappingURL=
|
|
35
|
+
//# sourceMappingURL=NamedObjectType_graphqlTypeVariableStatement.js.map
|
package/dist/generators/ts/_NamedObjectType/NamedObjectType_hashFunctionOrMethodDeclarations.d.ts
ADDED
|
@@ -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_hashFunctionOrMethodDeclarations(this: NamedObjectType): readonly Code[];
|
|
4
|
+
//# sourceMappingURL=NamedObjectType_hashFunctionOrMethodDeclarations.d.ts.map
|
|
@@ -2,7 +2,7 @@ import { snippets } from "../snippets.js";
|
|
|
2
2
|
import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
|
|
3
3
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
4
4
|
const hasherVariable = code `_hasher`;
|
|
5
|
-
export function
|
|
5
|
+
export function NamedObjectType_hashFunctionOrMethodDeclarations() {
|
|
6
6
|
if (!this.features.has("hash")) {
|
|
7
7
|
return [];
|
|
8
8
|
}
|
|
@@ -70,4 +70,4 @@ ${hashShaclPropertiesPreamble}${syntheticNamePrefix}hashShaclProperties<HasherT
|
|
|
70
70
|
}`,
|
|
71
71
|
];
|
|
72
72
|
}
|
|
73
|
-
//# sourceMappingURL=
|
|
73
|
+
//# sourceMappingURL=NamedObjectType_hashFunctionOrMethodDeclarations.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_interfaceDeclaration(this: NamedObjectType): Code;
|
|
4
|
+
//# sourceMappingURL=NamedObjectType_interfaceDeclaration.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
2
2
|
import { tsComment } from "../tsComment.js";
|
|
3
|
-
export function
|
|
3
|
+
export function NamedObjectType_interfaceDeclaration() {
|
|
4
4
|
return code `\
|
|
5
5
|
${this.comment
|
|
6
6
|
.alt(this.label)
|
|
@@ -13,4 +13,4 @@ ${this.comment
|
|
|
13
13
|
${joinCode(this.properties.flatMap((property) => property.declaration.toList()))}
|
|
14
14
|
}`;
|
|
15
15
|
}
|
|
16
|
-
//# sourceMappingURL=
|
|
16
|
+
//# sourceMappingURL=NamedObjectType_interfaceDeclaration.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_isTypeFunctionDeclaration(this: NamedObjectType): Code;
|
|
4
|
+
//# sourceMappingURL=NamedObjectType_isTypeFunctionDeclaration.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
|
|
2
2
|
import { code } from "../ts-poet-wrapper.js";
|
|
3
|
-
export function
|
|
3
|
+
export function NamedObjectType_isTypeFunctionDeclaration() {
|
|
4
4
|
return code `\
|
|
5
5
|
export function is${this.name}(object: ${syntheticNamePrefix}Object): object is ${this.name} {
|
|
6
6
|
switch (object.${this._discriminantProperty.name}) {
|
|
@@ -11,4 +11,4 @@ export function is${this.name}(object: ${syntheticNamePrefix}Object): object is
|
|
|
11
11
|
}
|
|
12
12
|
}`;
|
|
13
13
|
}
|
|
14
|
-
//# sourceMappingURL=
|
|
14
|
+
//# sourceMappingURL=NamedObjectType_isTypeFunctionDeclaration.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_jsonParseFunctionDeclaration(this: NamedObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=NamedObjectType_jsonParseFunctionDeclaration.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Maybe } from "purify-ts";
|
|
2
|
+
import { imports } from "../imports.js";
|
|
3
|
+
import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
|
|
4
|
+
import { code } from "../ts-poet-wrapper.js";
|
|
5
|
+
export function NamedObjectType_jsonParseFunctionDeclaration() {
|
|
6
|
+
if (!this.features.has("json")) {
|
|
7
|
+
return Maybe.empty();
|
|
8
|
+
}
|
|
9
|
+
if (this.abstract) {
|
|
10
|
+
return Maybe.empty();
|
|
11
|
+
}
|
|
12
|
+
return Maybe.of(code `\
|
|
13
|
+
export function parse(json: unknown): ${imports.Either}<Error, ${syntheticNamePrefix}Json> {
|
|
14
|
+
const jsonSafeParseResult = schema().safeParse(json);
|
|
15
|
+
if (!jsonSafeParseResult.success) { return ${imports.Left}(jsonSafeParseResult.error); }
|
|
16
|
+
return ${imports.Right}(jsonSafeParseResult.data);
|
|
17
|
+
}`);
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=NamedObjectType_jsonParseFunctionDeclaration.js.map
|
package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonSchemaFunctionDeclaration.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_jsonSchemaFunctionDeclaration(this: NamedObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=NamedObjectType_jsonSchemaFunctionDeclaration.d.ts.map
|
|
@@ -2,21 +2,21 @@ import { Maybe } from "purify-ts";
|
|
|
2
2
|
import { imports } from "../imports.js";
|
|
3
3
|
import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
|
|
4
4
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
5
|
-
export function
|
|
5
|
+
export function NamedObjectType_jsonSchemaFunctionDeclaration() {
|
|
6
6
|
if (!this.features.has("json")) {
|
|
7
7
|
return Maybe.empty();
|
|
8
8
|
}
|
|
9
9
|
const mergeZodObjectSchemas = [];
|
|
10
10
|
for (const parentObjectType of this.parentObjectTypes) {
|
|
11
|
-
mergeZodObjectSchemas.push(parentObjectType.
|
|
11
|
+
mergeZodObjectSchemas.push(parentObjectType.jsonSchema({ context: "type" }));
|
|
12
12
|
}
|
|
13
13
|
if (this.properties.length > 0) {
|
|
14
14
|
mergeZodObjectSchemas.push(code `${imports.z}.object({ ${joinCode(this.properties
|
|
15
|
-
.flatMap((property) => property.
|
|
15
|
+
.flatMap((property) => property.jsonZchema.toList())
|
|
16
16
|
.map(({ key, schema }) => code `"${key}": ${schema}`), { on: "," })} })`);
|
|
17
17
|
}
|
|
18
18
|
return Maybe.of(code `\
|
|
19
|
-
export function
|
|
19
|
+
export function schema() {
|
|
20
20
|
return ${mergeZodObjectSchemas.length > 0
|
|
21
21
|
? mergeZodObjectSchemas.reduce((merged, zodObjectSchema) => {
|
|
22
22
|
if (merged === null) {
|
|
@@ -27,4 +27,4 @@ export function ${syntheticNamePrefix}jsonZodSchema() {
|
|
|
27
27
|
: `${imports.z}.object()`} satisfies ${imports.z}.ZodType<${syntheticNamePrefix}Json>;
|
|
28
28
|
}`);
|
|
29
29
|
}
|
|
30
|
-
//# sourceMappingURL=
|
|
30
|
+
//# sourceMappingURL=NamedObjectType_jsonSchemaFunctionDeclaration.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_jsonTypeAliasDeclaration(this: NamedObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=NamedObjectType_jsonTypeAliasDeclaration.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_jsonTypeAliasDeclaration() {
|
|
5
5
|
if (!this.features.has("json")) {
|
|
6
6
|
return Maybe.empty();
|
|
7
7
|
}
|
|
@@ -14,4 +14,4 @@ export function ObjectType_jsonTypeAliasDeclaration() {
|
|
|
14
14
|
}
|
|
15
15
|
return Maybe.of(code `export type ${syntheticNamePrefix}Json = ${members.length > 0 ? joinCode(members, { on: " & " }) : "object"};`);
|
|
16
16
|
}
|
|
17
|
-
//# sourceMappingURL=
|
|
17
|
+
//# sourceMappingURL=NamedObjectType_jsonTypeAliasDeclaration.js.map
|
package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonUiSchemaFunctionDeclaration.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_jsonUiSchemaFunctionDeclaration(this: NamedObjectType): Maybe<Code>;
|
|
5
|
+
//# sourceMappingURL=NamedObjectType_jsonUiSchemaFunctionDeclaration.d.ts.map
|