@shaclmate/compiler 4.0.9 → 4.0.11

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.
Files changed (184) hide show
  1. package/dist/ShapesGraphToAstTransformer.js +1 -1
  2. package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstObjectTypeProperty.js +4 -1
  3. package/dist/ast/AbstractCompoundType.js +0 -2
  4. package/dist/ast/Ast.d.ts +1 -1
  5. package/dist/ast/IntersectionType.js +4 -3
  6. package/dist/ast/UnionType.js +3 -2
  7. package/dist/generators/json/AstJsonGenerator.js +1 -1
  8. package/dist/generators/ts/AbstractCollectionType.d.ts +1 -1
  9. package/dist/generators/ts/AbstractCollectionType.js +2 -2
  10. package/dist/generators/ts/AbstractContainerType.d.ts +2 -2
  11. package/dist/generators/ts/AbstractContainerType.js +1 -1
  12. package/dist/generators/ts/AbstractLazyObjectType.d.ts +3 -3
  13. package/dist/generators/ts/AbstractLazyObjectType.js +2 -2
  14. package/dist/generators/ts/AbstractNamedUnionType.d.ts +2 -2
  15. package/dist/generators/ts/AbstractNamedUnionType.js +17 -15
  16. package/dist/generators/ts/AbstractNumericType.d.ts +1 -1
  17. package/dist/generators/ts/AbstractNumericType.js +1 -1
  18. package/dist/generators/ts/AbstractType.d.ts +5 -5
  19. package/dist/generators/ts/AbstractUnionType.d.ts +1 -1
  20. package/dist/generators/ts/AbstractUnionType.js +6 -6
  21. package/dist/generators/ts/AnonymousUnionType.d.ts +1 -1
  22. package/dist/generators/ts/AnonymousUnionType.js +2 -2
  23. package/dist/generators/ts/BigDecimalType.d.ts +1 -1
  24. package/dist/generators/ts/BigDecimalType.js +2 -2
  25. package/dist/generators/ts/BigIntType.d.ts +1 -1
  26. package/dist/generators/ts/BigIntType.js +1 -1
  27. package/dist/generators/ts/BlankNodeType.d.ts +1 -1
  28. package/dist/generators/ts/BlankNodeType.js +1 -1
  29. package/dist/generators/ts/BooleanType.d.ts +1 -1
  30. package/dist/generators/ts/BooleanType.js +1 -1
  31. package/dist/generators/ts/DateTimeType.d.ts +1 -1
  32. package/dist/generators/ts/DateTimeType.js +1 -1
  33. package/dist/generators/ts/DateType.d.ts +1 -1
  34. package/dist/generators/ts/DateType.js +1 -1
  35. package/dist/generators/ts/DefaultValueType.d.ts +1 -1
  36. package/dist/generators/ts/DefaultValueType.js +3 -3
  37. package/dist/generators/ts/IdentifierType.d.ts +1 -1
  38. package/dist/generators/ts/IdentifierType.js +1 -1
  39. package/dist/generators/ts/IriType.d.ts +1 -1
  40. package/dist/generators/ts/IriType.js +1 -1
  41. package/dist/generators/ts/LazyObjectOptionType.js +1 -1
  42. package/dist/generators/ts/LazyObjectSetType.js +1 -1
  43. package/dist/generators/ts/LazyObjectType.js +2 -2
  44. package/dist/generators/ts/ListType.d.ts +2 -2
  45. package/dist/generators/ts/ListType.js +1 -1
  46. package/dist/generators/ts/LiteralType.d.ts +1 -1
  47. package/dist/generators/ts/LiteralType.js +1 -1
  48. package/dist/generators/ts/{ObjectType.d.ts → NamedObjectType.d.ts} +28 -28
  49. package/dist/generators/ts/{ObjectType.js → NamedObjectType.js} +105 -97
  50. package/dist/generators/ts/NamedObjectUnionType.d.ts +4 -4
  51. package/dist/generators/ts/NamedObjectUnionType.js +8 -12
  52. package/dist/generators/ts/OptionType.d.ts +1 -1
  53. package/dist/generators/ts/OptionType.js +2 -2
  54. package/dist/generators/ts/StringType.d.ts +1 -1
  55. package/dist/generators/ts/StringType.js +1 -1
  56. package/dist/generators/ts/TermType.d.ts +1 -1
  57. package/dist/generators/ts/TermType.js +1 -1
  58. package/dist/generators/ts/TsGenerator.js +8 -8
  59. package/dist/generators/ts/Type.d.ts +2 -2
  60. package/dist/generators/ts/TypeFactory.d.ts +2 -2
  61. package/dist/generators/ts/TypeFactory.js +36 -36
  62. package/dist/generators/ts/ZodGenerator.js +14 -12
  63. package/dist/generators/ts/{_ObjectType → _NamedObjectType}/AbstractProperty.d.ts +6 -6
  64. package/dist/generators/ts/{_ObjectType → _NamedObjectType}/AbstractProperty.js +3 -3
  65. package/dist/generators/ts/{_ObjectType → _NamedObjectType}/DiscriminantProperty.d.ts +1 -1
  66. package/dist/generators/ts/{_ObjectType → _NamedObjectType}/DiscriminantProperty.js +13 -11
  67. package/dist/generators/ts/{_ObjectType → _NamedObjectType}/IdentifierPrefixProperty.d.ts +1 -1
  68. package/dist/generators/ts/{_ObjectType → _NamedObjectType}/IdentifierPrefixProperty.js +4 -4
  69. package/dist/generators/ts/{_ObjectType → _NamedObjectType}/IdentifierProperty.d.ts +1 -1
  70. package/dist/generators/ts/{_ObjectType → _NamedObjectType}/IdentifierProperty.js +24 -24
  71. package/dist/generators/ts/_NamedObjectType/NamedObjectType_classDeclaration.d.ts +4 -0
  72. package/dist/generators/ts/{_ObjectType/ObjectType_classDeclaration.js → _NamedObjectType/NamedObjectType_classDeclaration.js} +14 -14
  73. package/dist/generators/ts/_NamedObjectType/NamedObjectType_createFunctionDeclaration.d.ts +5 -0
  74. package/dist/generators/ts/{_ObjectType/ObjectType_createFunctionDeclaration.js → _NamedObjectType/NamedObjectType_createFunctionDeclaration.js} +2 -2
  75. package/dist/generators/ts/_NamedObjectType/NamedObjectType_equalsFunctionOrMethodDeclaration.d.ts +5 -0
  76. package/dist/generators/ts/{_ObjectType/ObjectType_equalsFunctionOrMethodDeclaration.js → _NamedObjectType/NamedObjectType_equalsFunctionOrMethodDeclaration.js} +2 -2
  77. package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterFunctionDeclaration.d.ts +4 -0
  78. package/dist/generators/ts/{_ObjectType/ObjectType_filterFunctionDeclaration.js → _NamedObjectType/NamedObjectType_filterFunctionDeclaration.js} +2 -2
  79. package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterTypeDeclaration.d.ts +4 -0
  80. package/dist/generators/ts/{_ObjectType/ObjectType_filterTypeDeclaration.js → _NamedObjectType/NamedObjectType_filterTypeDeclaration.js} +2 -2
  81. package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.d.ts +5 -0
  82. package/dist/generators/ts/{_ObjectType/ObjectType_focusSparqlConstructTriplesFunctionDeclaration.js → _NamedObjectType/NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.js} +2 -2
  83. package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.d.ts +5 -0
  84. package/dist/generators/ts/{_ObjectType/ObjectType_focusSparqlWherePatternsFunctionDeclaration.js → _NamedObjectType/NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.js} +2 -2
  85. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromJsonFunctionDeclaration.d.ts +5 -0
  86. package/dist/generators/ts/{_ObjectType/ObjectType_fromJsonFunctionDeclaration.js → _NamedObjectType/NamedObjectType_fromJsonFunctionDeclaration.js} +2 -2
  87. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceFunctionDeclaration.d.ts +5 -0
  88. package/dist/generators/ts/{_ObjectType/ObjectType_fromRdfResourceFunctionDeclaration.js → _NamedObjectType/NamedObjectType_fromRdfResourceFunctionDeclaration.js} +2 -2
  89. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceValuesFunctionDeclaration.d.ts +5 -0
  90. package/dist/generators/ts/{_ObjectType/ObjectType_fromRdfResourceValuesFunctionDeclaration.js → _NamedObjectType/NamedObjectType_fromRdfResourceValuesFunctionDeclaration.js} +2 -2
  91. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfTypeVariableStatement.d.ts +5 -0
  92. package/dist/generators/ts/{_ObjectType/ObjectType_fromRdfTypeVariableStatement.js → _NamedObjectType/NamedObjectType_fromRdfTypeVariableStatement.js} +2 -2
  93. package/dist/generators/ts/_NamedObjectType/NamedObjectType_graphqlTypeVariableStatement.d.ts +5 -0
  94. package/dist/generators/ts/{_ObjectType/ObjectType_graphqlTypeVariableStatement.js → _NamedObjectType/NamedObjectType_graphqlTypeVariableStatement.js} +2 -2
  95. package/dist/generators/ts/_NamedObjectType/NamedObjectType_hashFunctionOrMethodDeclarations.d.ts +4 -0
  96. package/dist/generators/ts/{_ObjectType/ObjectType_hashFunctionOrMethodDeclarations.js → _NamedObjectType/NamedObjectType_hashFunctionOrMethodDeclarations.js} +2 -2
  97. package/dist/generators/ts/_NamedObjectType/NamedObjectType_interfaceDeclaration.d.ts +4 -0
  98. package/dist/generators/ts/{_ObjectType/ObjectType_interfaceDeclaration.js → _NamedObjectType/NamedObjectType_interfaceDeclaration.js} +2 -2
  99. package/dist/generators/ts/_NamedObjectType/NamedObjectType_isTypeFunctionDeclaration.d.ts +4 -0
  100. package/dist/generators/ts/{_ObjectType/ObjectType_isTypeFunctionDeclaration.js → _NamedObjectType/NamedObjectType_isTypeFunctionDeclaration.js} +2 -2
  101. package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonParseFunctionDeclaration.d.ts +5 -0
  102. package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonParseFunctionDeclaration.js +19 -0
  103. package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonSchemaFunctionDeclaration.d.ts +5 -0
  104. package/dist/generators/ts/{_ObjectType/ObjectType_jsonZodSchemaFunctionDeclaration.js → _NamedObjectType/NamedObjectType_jsonSchemaFunctionDeclaration.js} +5 -5
  105. package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonTypeAliasDeclaration.d.ts +5 -0
  106. package/dist/generators/ts/{_ObjectType/ObjectType_jsonTypeAliasDeclaration.js → _NamedObjectType/NamedObjectType_jsonTypeAliasDeclaration.js} +2 -2
  107. package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonUiSchemaFunctionDeclaration.d.ts +5 -0
  108. package/dist/generators/ts/{_ObjectType/ObjectType_jsonUiSchemaFunctionDeclaration.js → _NamedObjectType/NamedObjectType_jsonUiSchemaFunctionDeclaration.js} +4 -4
  109. package/dist/generators/ts/_NamedObjectType/NamedObjectType_objectSetMethodNames.d.ts +9 -0
  110. package/dist/generators/ts/{_ObjectType/ObjectType_objectSetMethodNames.js → _NamedObjectType/NamedObjectType_objectSetMethodNames.js} +2 -2
  111. package/dist/generators/ts/_NamedObjectType/NamedObjectType_propertiesFromJsonFunctionDeclaration.d.ts +5 -0
  112. package/dist/generators/ts/{_ObjectType/ObjectType_propertiesFromJsonFunctionDeclaration.js → _NamedObjectType/NamedObjectType_propertiesFromJsonFunctionDeclaration.js} +2 -2
  113. package/dist/generators/ts/_NamedObjectType/NamedObjectType_propertiesFromRdfResourceFunctionDeclaration.d.ts +5 -0
  114. package/dist/generators/ts/{_ObjectType/ObjectType_propertiesFromRdfResourceFunctionDeclaration.js → _NamedObjectType/NamedObjectType_propertiesFromRdfResourceFunctionDeclaration.js} +2 -2
  115. package/dist/generators/ts/_NamedObjectType/NamedObjectType_schemaVariableStatement.d.ts +4 -0
  116. package/dist/generators/ts/{_ObjectType/ObjectType_schemaVariableStatement.js → _NamedObjectType/NamedObjectType_schemaVariableStatement.js} +2 -2
  117. package/dist/generators/ts/{_ObjectType/ObjectType_sparqlConstructQueryFunctionDeclaration.d.ts → _NamedObjectType/NamedObjectType_sparqlConstructQueryFunctionDeclaration.d.ts} +2 -2
  118. package/dist/generators/ts/{_ObjectType/ObjectType_sparqlConstructQueryFunctionDeclaration.js → _NamedObjectType/NamedObjectType_sparqlConstructQueryFunctionDeclaration.js} +2 -2
  119. package/dist/generators/ts/{_ObjectType/ObjectType_sparqlConstructQueryStringFunctionDeclaration.d.ts → _NamedObjectType/NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.d.ts} +2 -2
  120. package/dist/generators/ts/{_ObjectType/ObjectType_sparqlConstructQueryStringFunctionDeclaration.js → _NamedObjectType/NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.js} +2 -2
  121. package/dist/generators/ts/_NamedObjectType/NamedObjectType_toJsonFunctionOrMethodDeclaration.d.ts +5 -0
  122. package/dist/generators/ts/{_ObjectType/ObjectType_toJsonFunctionOrMethodDeclaration.js → _NamedObjectType/NamedObjectType_toJsonFunctionOrMethodDeclaration.js} +2 -2
  123. package/dist/generators/ts/_NamedObjectType/NamedObjectType_toRdfResourceFunctionOrMethodDeclaration.d.ts +5 -0
  124. package/dist/generators/ts/{_ObjectType/ObjectType_toRdfResourceFunctionOrMethodDeclaration.js → _NamedObjectType/NamedObjectType_toRdfResourceFunctionOrMethodDeclaration.js} +2 -2
  125. package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlConstructTriplesFunctionDeclaration.d.ts +5 -0
  126. package/dist/generators/ts/{_ObjectType/ObjectType_valueSparqlConstructTriplesFunctionDeclaration.js → _NamedObjectType/NamedObjectType_valueSparqlConstructTriplesFunctionDeclaration.js} +2 -2
  127. package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlWherePatternsFunctionDeclaration.d.ts +5 -0
  128. package/dist/generators/ts/{_ObjectType/ObjectType_valueSparqlWherePatternsFunctionDeclaration.js → _NamedObjectType/NamedObjectType_valueSparqlWherePatternsFunctionDeclaration.js} +2 -2
  129. package/dist/generators/ts/{_ObjectType → _NamedObjectType}/ShaclProperty.d.ts +1 -1
  130. package/dist/generators/ts/{_ObjectType → _NamedObjectType}/ShaclProperty.js +8 -8
  131. package/dist/generators/ts/_NamedObjectType/identifierTypeDeclarations.d.ts +4 -0
  132. package/dist/generators/ts/graphqlSchemaVariableStatement.d.ts +2 -2
  133. package/dist/generators/ts/graphqlSchemaVariableStatement.js +23 -23
  134. package/dist/generators/ts/objectSetDeclarations.d.ts +2 -2
  135. package/dist/generators/ts/objectSetDeclarations.js +19 -16
  136. package/dist/generators/ts/objectSetInterfaceDeclaration.d.ts +3 -3
  137. package/dist/generators/ts/objectSetInterfaceDeclaration.js +6 -4
  138. package/dist/generators/ts/objectSetMethodSignatures.d.ts +4 -4
  139. package/dist/generators/ts/objectSetMethodSignatures.js +9 -9
  140. package/dist/generators/ts/rdfjsDatasetObjectSetClassDeclaration.d.ts +3 -3
  141. package/dist/generators/ts/rdfjsDatasetObjectSetClassDeclaration.js +47 -45
  142. package/dist/generators/ts/singleEntryRecord.d.ts +2 -0
  143. package/dist/generators/ts/singleEntryRecord.js +6 -0
  144. package/dist/generators/ts/sparqlObjectSetClassDeclaration.d.ts +3 -3
  145. package/dist/generators/ts/sparqlObjectSetClassDeclaration.js +17 -17
  146. package/dist/generators/ts/synthesizeUberObjectUnionType.d.ts +2 -2
  147. package/dist/generators/ts/synthesizeUberObjectUnionType.js +8 -8
  148. package/dist/generators/ts/unsupportedObjectSetMethodDeclarations.d.ts +5 -5
  149. package/dist/generators/ts/unsupportedObjectSetMethodDeclarations.js +2 -2
  150. package/package.json +4 -4
  151. package/dist/generators/ts/_ObjectType/ObjectType_classDeclaration.d.ts +0 -4
  152. package/dist/generators/ts/_ObjectType/ObjectType_createFunctionDeclaration.d.ts +0 -5
  153. package/dist/generators/ts/_ObjectType/ObjectType_equalsFunctionOrMethodDeclaration.d.ts +0 -5
  154. package/dist/generators/ts/_ObjectType/ObjectType_filterFunctionDeclaration.d.ts +0 -4
  155. package/dist/generators/ts/_ObjectType/ObjectType_filterTypeDeclaration.d.ts +0 -4
  156. package/dist/generators/ts/_ObjectType/ObjectType_focusSparqlConstructTriplesFunctionDeclaration.d.ts +0 -5
  157. package/dist/generators/ts/_ObjectType/ObjectType_focusSparqlWherePatternsFunctionDeclaration.d.ts +0 -5
  158. package/dist/generators/ts/_ObjectType/ObjectType_fromJsonFunctionDeclaration.d.ts +0 -5
  159. package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceFunctionDeclaration.d.ts +0 -5
  160. package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceValuesFunctionDeclaration.d.ts +0 -5
  161. package/dist/generators/ts/_ObjectType/ObjectType_fromRdfTypeVariableStatement.d.ts +0 -5
  162. package/dist/generators/ts/_ObjectType/ObjectType_graphqlTypeVariableStatement.d.ts +0 -5
  163. package/dist/generators/ts/_ObjectType/ObjectType_hashFunctionOrMethodDeclarations.d.ts +0 -4
  164. package/dist/generators/ts/_ObjectType/ObjectType_interfaceDeclaration.d.ts +0 -4
  165. package/dist/generators/ts/_ObjectType/ObjectType_isTypeFunctionDeclaration.d.ts +0 -4
  166. package/dist/generators/ts/_ObjectType/ObjectType_jsonSchemaFunctionDeclaration.d.ts +0 -5
  167. package/dist/generators/ts/_ObjectType/ObjectType_jsonSchemaFunctionDeclaration.js +0 -14
  168. package/dist/generators/ts/_ObjectType/ObjectType_jsonTypeAliasDeclaration.d.ts +0 -5
  169. package/dist/generators/ts/_ObjectType/ObjectType_jsonUiSchemaFunctionDeclaration.d.ts +0 -5
  170. package/dist/generators/ts/_ObjectType/ObjectType_jsonZodSchemaFunctionDeclaration.d.ts +0 -5
  171. package/dist/generators/ts/_ObjectType/ObjectType_objectSetMethodNames.d.ts +0 -9
  172. package/dist/generators/ts/_ObjectType/ObjectType_parseJsonFunctionDeclaration.d.ts +0 -5
  173. package/dist/generators/ts/_ObjectType/ObjectType_parseJsonFunctionDeclaration.js +0 -19
  174. package/dist/generators/ts/_ObjectType/ObjectType_propertiesFromJsonFunctionDeclaration.d.ts +0 -5
  175. package/dist/generators/ts/_ObjectType/ObjectType_propertiesFromRdfResourceFunctionDeclaration.d.ts +0 -5
  176. package/dist/generators/ts/_ObjectType/ObjectType_schemaVariableStatement.d.ts +0 -4
  177. package/dist/generators/ts/_ObjectType/ObjectType_toJsonFunctionOrMethodDeclaration.d.ts +0 -5
  178. package/dist/generators/ts/_ObjectType/ObjectType_toRdfResourceFunctionOrMethodDeclaration.d.ts +0 -5
  179. package/dist/generators/ts/_ObjectType/ObjectType_valueSparqlConstructTriplesFunctionDeclaration.d.ts +0 -5
  180. package/dist/generators/ts/_ObjectType/ObjectType_valueSparqlWherePatternsFunctionDeclaration.d.ts +0 -5
  181. package/dist/generators/ts/_ObjectType/identifierTypeDeclarations.d.ts +0 -4
  182. /package/dist/generators/ts/{_ObjectType → _NamedObjectType}/Property.d.ts +0 -0
  183. /package/dist/generators/ts/{_ObjectType → _NamedObjectType}/Property.js +0 -0
  184. /package/dist/generators/ts/{_ObjectType → _NamedObjectType}/identifierTypeDeclarations.js +0 -0
@@ -2,30 +2,30 @@ import { imports } from "./imports.js";
2
2
  import { syntheticNamePrefix } from "./syntheticNamePrefix.js";
3
3
  import { code } from "./ts-poet-wrapper.js";
4
4
  export function objectSetMethodSignatures(parameters) {
5
- const { objectType } = parameters;
5
+ const { namedObjectType } = parameters;
6
6
  const parameterNamePrefix = parameters?.parameterNamePrefix ?? "";
7
7
  const queryT = parameters.queryT ?? `${syntheticNamePrefix}ObjectSet.Query`;
8
- const methodNames = objectType.objectSetMethodNames;
8
+ const methodNames = namedObjectType.objectSetMethodNames;
9
9
  return {
10
10
  object: {
11
11
  name: methodNames.object,
12
- parameters: code `${parameterNamePrefix}identifier: ${objectType.identifierTypeAlias}, options?: { preferredLanguages?: readonly string[]; }`,
13
- returnType: code `Promise<${imports.Either}<Error, ${objectType.name}>>`,
12
+ parameters: code `${parameterNamePrefix}identifier: ${namedObjectType.identifierTypeAlias}, options?: { preferredLanguages?: readonly string[]; }`,
13
+ returnType: code `Promise<${imports.Either}<Error, ${namedObjectType.name}>>`,
14
14
  },
15
15
  objectCount: {
16
16
  name: methodNames.objectCount,
17
- parameters: code `${parameterNamePrefix}query?: Pick<${queryT}<${objectType.filterType}, ${objectType.identifierTypeAlias}>, "filter">`,
17
+ parameters: code `${parameterNamePrefix}query?: Pick<${queryT}<${namedObjectType.filterType}, ${namedObjectType.identifierTypeAlias}>, "filter">`,
18
18
  returnType: code `Promise<${imports.Either}<Error, number>>`,
19
19
  },
20
20
  objectIdentifiers: {
21
21
  name: methodNames.objectIdentifiers,
22
- parameters: code `${parameterNamePrefix}query?: ${queryT}<${objectType.filterType}, ${objectType.identifierTypeAlias}>`,
23
- returnType: code `Promise<${imports.Either}<Error, readonly ${objectType.identifierTypeAlias}[]>>`,
22
+ parameters: code `${parameterNamePrefix}query?: ${queryT}<${namedObjectType.filterType}, ${namedObjectType.identifierTypeAlias}>`,
23
+ returnType: code `Promise<${imports.Either}<Error, readonly ${namedObjectType.identifierTypeAlias}[]>>`,
24
24
  },
25
25
  objects: {
26
26
  name: methodNames.objects,
27
- parameters: code `${parameterNamePrefix}query?: ${queryT}<${objectType.filterType}, ${objectType.identifierTypeAlias}>`,
28
- returnType: code `Promise<${imports.Either}<Error, readonly ${objectType.name}[]>>`,
27
+ parameters: code `${parameterNamePrefix}query?: ${queryT}<${namedObjectType.filterType}, ${namedObjectType.identifierTypeAlias}>`,
28
+ returnType: code `Promise<${imports.Either}<Error, readonly ${namedObjectType.name}[]>>`,
29
29
  },
30
30
  };
31
31
  }
@@ -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 rdfjsDatasetObjectSetClassDeclaration({ objectTypes, namedObjectUnionTypes, }: {
5
- objectTypes: readonly ObjectType[];
4
+ export declare function rdfjsDatasetObjectSetClassDeclaration({ namedObjectTypes, namedObjectUnionTypes, }: {
5
+ namedObjectTypes: readonly NamedObjectType[];
6
6
  namedObjectUnionTypes: readonly NamedObjectUnionType[];
7
7
  }): Code;
8
8
  //# sourceMappingURL=rdfjsDatasetObjectSetClassDeclaration.d.ts.map
@@ -4,8 +4,8 @@ import { snippets } from "./snippets.js";
4
4
  import { syntheticNamePrefix } from "./syntheticNamePrefix.js";
5
5
  import { code, joinCode } from "./ts-poet-wrapper.js";
6
6
  import { unsupportedObjectSetMethodDeclarations } from "./unsupportedObjectSetMethodDeclarations.js";
7
- export function rdfjsDatasetObjectSetClassDeclaration({ objectTypes, namedObjectUnionTypes, }) {
8
- const objectTypeType = code `\
7
+ export function rdfjsDatasetObjectSetClassDeclaration({ namedObjectTypes, namedObjectUnionTypes, }) {
8
+ const namedObjectTypeType = code `\
9
9
  {
10
10
  ${syntheticNamePrefix}filter: (filter: ObjectFilterT, value: ObjectT) => boolean;
11
11
  ${syntheticNamePrefix}fromRdfResource: ${snippets.FromRdfResourceFunction}<ObjectT>;
@@ -41,13 +41,15 @@ export class ${syntheticNamePrefix}RdfjsDatasetObjectSet implements ${syntheticN
41
41
  }
42
42
 
43
43
  ${joinCode([
44
- ...[...objectTypes, ...namedObjectUnionTypes].flatMap((objectType) => {
45
- if (!objectType.features.has("rdf")) {
44
+ ...[...namedObjectTypes, ...namedObjectUnionTypes].flatMap((namedObjectType) => {
45
+ if (!namedObjectType.features.has("rdf")) {
46
46
  return Object.values(unsupportedObjectSetMethodDeclarations({
47
- objectType,
47
+ namedObjectType,
48
48
  }));
49
49
  }
50
- const methodSignatures = objectSetMethodSignatures({ objectType });
50
+ const methodSignatures = objectSetMethodSignatures({
51
+ namedObjectType,
52
+ });
51
53
  const delegatingMethods = [
52
54
  // object
53
55
  code `\
@@ -56,7 +58,7 @@ async ${methodSignatures.object.name}(${methodSignatures.object.parameters}): ${
56
58
  }`,
57
59
  // objectSync
58
60
  code `\
59
- ${methodSignatures.object.name}Sync(${methodSignatures.object.parameters}): ${imports.Either}<Error, ${objectType.name}> {
61
+ ${methodSignatures.object.name}Sync(${methodSignatures.object.parameters}): ${imports.Either}<Error, ${namedObjectType.name}> {
60
62
  return this.${methodSignatures.objects.name}Sync({ identifiers: [identifier], preferredLanguages: options?.preferredLanguages }).map(objects => objects[0]);
61
63
  }`,
62
64
  // objectCount
@@ -76,7 +78,7 @@ async ${methodSignatures.objectIdentifiers.name}(${methodSignatures.objectIdenti
76
78
  }`,
77
79
  // objectIdentifiersSync
78
80
  code `\
79
- ${methodSignatures.objectIdentifiers.name}Sync(${methodSignatures.objectIdentifiers.parameters}): ${imports.Either}<Error, readonly ${objectType.identifierTypeAlias}[]> {
81
+ ${methodSignatures.objectIdentifiers.name}Sync(${methodSignatures.objectIdentifiers.parameters}): ${imports.Either}<Error, readonly ${namedObjectType.identifierTypeAlias}[]> {
80
82
  return this.${methodSignatures.objects.name}Sync(query).map(objects => objects.map(object => object.${syntheticNamePrefix}identifier));
81
83
  }`,
82
84
  // objects
@@ -86,37 +88,37 @@ async ${methodSignatures.objects.name}(${methodSignatures.objects.parameters}):
86
88
  }`,
87
89
  // objectsSync has per-object type logic, not just forwarding
88
90
  ];
89
- const runtimeObjectType = (filterFunction, objectType) => {
90
- const fromRdfTypes = objectType.fromRdfTypeVariable
91
+ const runtimeObjectType = (filterFunction, namedObjectType) => {
92
+ const fromRdfTypes = namedObjectType.fromRdfTypeVariable
91
93
  .toList()
92
- .concat(objectType.descendantFromRdfTypeVariables);
93
- return code `{ ${syntheticNamePrefix}filter: ${filterFunction}, ${syntheticNamePrefix}fromRdfResource: ${objectType.staticModuleName}.${syntheticNamePrefix}fromRdfResource, ${syntheticNamePrefix}fromRdfTypes: ${fromRdfTypes.length > 0 ? code `[${joinCode(fromRdfTypes, { on: ", " })}]` : "[]"} }`;
94
+ .concat(namedObjectType.descendantFromRdfTypeVariables);
95
+ return code `{ ${syntheticNamePrefix}filter: ${filterFunction}, ${syntheticNamePrefix}fromRdfResource: ${namedObjectType.staticModuleName}.${syntheticNamePrefix}fromRdfResource, ${syntheticNamePrefix}fromRdfTypes: ${fromRdfTypes.length > 0 ? code `[${joinCode(fromRdfTypes, { on: ", " })}]` : "[]"} }`;
94
96
  };
95
- switch (objectType.kind) {
96
- case "ObjectType": {
97
+ switch (namedObjectType.kind) {
98
+ case "NamedObjectType": {
97
99
  return delegatingMethods.concat(code `\
98
- ${methodSignatures.objects.name}Sync(${methodSignatures.objects.parameters}): ${imports.Either}<Error, readonly ${objectType.name}[]> {
99
- return this.${syntheticNamePrefix}objectsSync<${objectType.name}, ${objectType.filterType}, ${objectType.identifierTypeAlias}>(${runtimeObjectType(objectType.filterFunction, objectType)}, query);
100
+ ${methodSignatures.objects.name}Sync(${methodSignatures.objects.parameters}): ${imports.Either}<Error, readonly ${namedObjectType.name}[]> {
101
+ return this.${syntheticNamePrefix}objectsSync<${namedObjectType.name}, ${namedObjectType.filterType}, ${namedObjectType.identifierTypeAlias}>(${runtimeObjectType(namedObjectType.filterFunction, namedObjectType)}, query);
100
102
  }`);
101
103
  }
102
104
  case "NamedObjectUnionType":
103
105
  return delegatingMethods.concat(code `\
104
- ${methodSignatures.objects.name}Sync(${methodSignatures.objects.parameters}): ${imports.Either}<Error, readonly ${objectType.name}[]> {
105
- return this.${syntheticNamePrefix}objectUnionsSync<${objectType.name}, ${objectType.filterType}, ${objectType.identifierTypeAlias}>([
106
- ${joinCode(objectType.members
106
+ ${methodSignatures.objects.name}Sync(${methodSignatures.objects.parameters}): ${imports.Either}<Error, readonly ${namedObjectType.name}[]> {
107
+ return this.${syntheticNamePrefix}objectUnionsSync<${namedObjectType.name}, ${namedObjectType.filterType}, ${namedObjectType.identifierTypeAlias}>([
108
+ ${joinCode(namedObjectType.members
107
109
  .filter((member) => !member.type.abstract)
108
- .map((member) => runtimeObjectType(objectType.filterFunction, member.type)), { on: ", " })}
110
+ .map((member) => runtimeObjectType(namedObjectType.filterFunction, member.type)), { on: ", " })}
109
111
  ], query);
110
112
  }`);
111
113
  default:
112
- objectType;
114
+ namedObjectType;
113
115
  return [];
114
116
  }
115
117
  }),
116
- ...(objectTypes.length > 0
118
+ ...(namedObjectTypes.length > 0
117
119
  ? [
118
120
  code `\
119
- protected ${syntheticNamePrefix}objectsSync<${typeParameters.ObjectT}, ${typeParameters.ObjectFilterT}, ${typeParameters.ObjectIdentifierT}>(objectType: ${objectTypeType}, ${parameters.query}): ${imports.Either}<Error, readonly ObjectT[]> {
121
+ protected ${syntheticNamePrefix}objectsSync<${typeParameters.ObjectT}, ${typeParameters.ObjectFilterT}, ${typeParameters.ObjectIdentifierT}>(namedObjectType: ${namedObjectTypeType}, ${parameters.query}): ${imports.Either}<Error, readonly ObjectT[]> {
120
122
  const graph = query?.graph ?? this.${syntheticNamePrefix}graph;
121
123
 
122
124
  const limit = query?.limit ?? Number.MAX_SAFE_INTEGER;
@@ -133,11 +135,11 @@ protected ${syntheticNamePrefix}objectsSync<${typeParameters.ObjectT}, ${typePar
133
135
  if (query?.identifiers) {
134
136
  resources = query.identifiers.map(identifier => ({ resource: resourceSet.resource(identifier) }));
135
137
  sortResources = false;
136
- } else if (objectType.${syntheticNamePrefix}fromRdfTypes.length > 0) {
138
+ } else if (namedObjectType.${syntheticNamePrefix}fromRdfTypes.length > 0) {
137
139
  const identifierSet = new ${snippets.IdentifierSet}();
138
140
  resources = [];
139
141
  sortResources = true;
140
- for (const fromRdfType of objectType.${syntheticNamePrefix}fromRdfTypes) {
142
+ for (const fromRdfType of namedObjectType.${syntheticNamePrefix}fromRdfTypes) {
141
143
  for (const resource of resourceSet.instancesOf(fromRdfType, { graph })) {
142
144
  if (!identifierSet.has(resource.identifier)) {
143
145
  identifierSet.add(resource.identifier);
@@ -168,7 +170,7 @@ protected ${syntheticNamePrefix}objectsSync<${typeParameters.ObjectT}, ${typePar
168
170
  identifierSet.add(quad.subject);
169
171
  const resource = resourceSet.resource(quad.subject);
170
172
  // Eagerly eliminate the majority of resources that won't match the object type
171
- objectType.${syntheticNamePrefix}fromRdfResource(resource, fromRdfResourceOptions).ifRight(object => {
173
+ namedObjectType.${syntheticNamePrefix}fromRdfResource(resource, fromRdfResourceOptions).ifRight(object => {
172
174
  resources.push({ object, resource });
173
175
  });
174
176
  }
@@ -183,14 +185,14 @@ protected ${syntheticNamePrefix}objectsSync<${typeParameters.ObjectT}, ${typePar
183
185
  const objects: ObjectT[] = [];
184
186
  for (let { object, resource } of resources) {
185
187
  if (!object) {
186
- const objectEither = objectType.${syntheticNamePrefix}fromRdfResource(resource, fromRdfResourceOptions);
188
+ const objectEither = namedObjectType.${syntheticNamePrefix}fromRdfResource(resource, fromRdfResourceOptions);
187
189
  if (objectEither.isLeft()) {
188
190
  return objectEither;
189
191
  }
190
192
  object = objectEither.unsafeCoerce();
191
193
  }
192
194
 
193
- if (query?.filter && !objectType.${syntheticNamePrefix}filter(query.filter, object)) {
195
+ if (query?.filter && !namedObjectType.${syntheticNamePrefix}filter(query.filter, object)) {
194
196
  continue;
195
197
  }
196
198
 
@@ -208,7 +210,7 @@ protected ${syntheticNamePrefix}objectsSync<${typeParameters.ObjectT}, ${typePar
208
210
  ...(namedObjectUnionTypes.length > 0
209
211
  ? [
210
212
  code `\
211
- protected ${syntheticNamePrefix}objectUnionsSync<${typeParameters.ObjectT}, ${typeParameters.ObjectFilterT}, ${typeParameters.ObjectIdentifierT}>(objectTypes: readonly ${objectTypeType}[], ${parameters.query}): ${imports.Either}<Error, readonly ObjectT[]> {
213
+ protected ${syntheticNamePrefix}objectUnionsSync<${typeParameters.ObjectT}, ${typeParameters.ObjectFilterT}, ${typeParameters.ObjectIdentifierT}>(namedObjectTypes: readonly ${namedObjectTypeType}[], ${parameters.query}): ${imports.Either}<Error, readonly ObjectT[]> {
212
214
  const graph = query?.graph ?? this.${syntheticNamePrefix}graph;
213
215
 
214
216
  const limit = query?.limit ?? Number.MAX_SAFE_INTEGER;
@@ -219,22 +221,22 @@ protected ${syntheticNamePrefix}objectUnionsSync<${typeParameters.ObjectT}, ${ty
219
221
 
220
222
  const fromRdfResourceOptions: Parameters<${snippets.FromRdfResourceFunction}<ObjectT>>[1] = { graph, objectSet: this, preferredLanguages: query?.preferredLanguages };
221
223
 
222
- let resources: { object?: ObjectT, objectType?: ${objectTypeType}, resource: ${imports.Resource} }[];
224
+ let resources: { object?: ObjectT, namedObjectType?: ${namedObjectTypeType}, resource: ${imports.Resource} }[];
223
225
  const resourceSet = this.${syntheticNamePrefix}resourceSet(); // Access once, in case it's instantiated lazily
224
226
  let sortResources: boolean;
225
227
  if (query?.identifiers) {
226
228
  resources = query.identifiers.map(identifier => ({ resource: resourceSet.resource(identifier) }));
227
229
  sortResources = false;
228
- } else if (objectTypes.every(objectType => objectType.${syntheticNamePrefix}fromRdfTypes.length > 0)) {
230
+ } else if (namedObjectTypes.every(namedObjectType => namedObjectType.${syntheticNamePrefix}fromRdfTypes.length > 0)) {
229
231
  const identifierSet = new ${snippets.IdentifierSet}();
230
232
  resources = [];
231
233
  sortResources = true;
232
- for (const objectType of objectTypes) {
233
- for (const fromRdfType of objectType.${syntheticNamePrefix}fromRdfTypes) {
234
+ for (const namedObjectType of namedObjectTypes) {
235
+ for (const fromRdfType of namedObjectType.${syntheticNamePrefix}fromRdfTypes) {
234
236
  for (const resource of resourceSet.instancesOf(fromRdfType, { graph })) {
235
237
  if (!identifierSet.has(resource.identifier)) {
236
238
  identifierSet.add(resource.identifier);
237
- resources.push({ objectType, resource });
239
+ resources.push({ namedObjectType, resource });
238
240
  }
239
241
  }
240
242
  }
@@ -262,9 +264,9 @@ protected ${syntheticNamePrefix}objectUnionsSync<${typeParameters.ObjectT}, ${ty
262
264
  identifierSet.add(quad.subject);
263
265
  // Eagerly eliminate the majority of resources that won't match the object types
264
266
  const resource = resourceSet.resource(quad.subject);
265
- for (const objectType of objectTypes) {
266
- if (objectType.${syntheticNamePrefix}fromRdfResource(resource, fromRdfResourceOptions).ifRight(object => {
267
- resources.push({ object, objectType, resource });
267
+ for (const namedObjectType of namedObjectTypes) {
268
+ if (namedObjectType.${syntheticNamePrefix}fromRdfResource(resource, fromRdfResourceOptions).ifRight(object => {
269
+ resources.push({ object, namedObjectType, resource });
268
270
  }).isRight()) {
269
271
  break;
270
272
  }
@@ -279,17 +281,17 @@ protected ${syntheticNamePrefix}objectUnionsSync<${typeParameters.ObjectT}, ${ty
279
281
 
280
282
  let objectI = 0;
281
283
  const objects: ObjectT[] = [];
282
- for (let { object, objectType, resource } of resources) {
284
+ for (let { object, namedObjectType, resource } of resources) {
283
285
  if (!object) {
284
286
  let objectEither: ${imports.Either}<Error, ObjectT>;
285
- if (objectType) {
286
- objectEither = objectType.${syntheticNamePrefix}fromRdfResource(resource, fromRdfResourceOptions);
287
+ if (namedObjectType) {
288
+ objectEither = namedObjectType.${syntheticNamePrefix}fromRdfResource(resource, fromRdfResourceOptions);
287
289
  } else {
288
290
  objectEither = ${imports.Left}(new Error("no object types"));
289
- for (const tryObjectType of objectTypes) {
291
+ for (const tryObjectType of namedObjectTypes) {
290
292
  objectEither = tryObjectType.${syntheticNamePrefix}fromRdfResource(resource, fromRdfResourceOptions);
291
293
  if (objectEither.isRight()) {
292
- objectType = tryObjectType;
294
+ namedObjectType = tryObjectType;
293
295
  break;
294
296
  }
295
297
  }
@@ -299,11 +301,11 @@ protected ${syntheticNamePrefix}objectUnionsSync<${typeParameters.ObjectT}, ${ty
299
301
  }
300
302
  object = objectEither.unsafeCoerce();
301
303
  }
302
- if (!objectType) {
303
- throw new Error("objectType should be set here");
304
+ if (!namedObjectType) {
305
+ throw new Error("namedObjectType should be set here");
304
306
  }
305
307
 
306
- if (query?.filter && !objectType.${syntheticNamePrefix}filter(query.filter, object)) {
308
+ if (query?.filter && !namedObjectType.${syntheticNamePrefix}filter(query.filter, object)) {
307
309
  continue;
308
310
  }
309
311
 
@@ -0,0 +1,2 @@
1
+ export declare function singleEntryRecord<T>(key: string, value: T): Record<string, T>;
2
+ //# sourceMappingURL=singleEntryRecord.d.ts.map
@@ -0,0 +1,6 @@
1
+ export function singleEntryRecord(key, value) {
2
+ const record = {};
3
+ record[key] = value;
4
+ return record;
5
+ }
6
+ //# sourceMappingURL=singleEntryRecord.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
- export declare function sparqlObjectSetClassDeclaration({ objectTypes, namedObjectUnionTypes, }: {
5
- objectTypes: readonly ObjectType[];
4
+ export declare function sparqlObjectSetClassDeclaration({ namedObjectTypes, namedObjectUnionTypes, }: {
5
+ namedObjectTypes: readonly NamedObjectType[];
6
6
  namedObjectUnionTypes: readonly NamedObjectUnionType[];
7
7
  }): Code;
8
8
  //# sourceMappingURL=sparqlObjectSetClassDeclaration.d.ts.map
@@ -4,15 +4,15 @@ import { snippets } from "./snippets.js";
4
4
  import { syntheticNamePrefix } from "./syntheticNamePrefix.js";
5
5
  import { code, joinCode } from "./ts-poet-wrapper.js";
6
6
  import { unsupportedObjectSetMethodDeclarations } from "./unsupportedObjectSetMethodDeclarations.js";
7
- export function sparqlObjectSetClassDeclaration({ objectTypes, namedObjectUnionTypes, }) {
7
+ export function sparqlObjectSetClassDeclaration({ namedObjectTypes, namedObjectUnionTypes, }) {
8
8
  const parameters = {
9
- constructObjectType: code `objectType: {\
9
+ constructObjectType: code `namedObjectType: {\
10
10
  ${syntheticNamePrefix}focusSparqlWherePatterns: ${snippets.FocusSparqlWherePatternsFunction}<ObjectFilterT>;
11
11
  ${syntheticNamePrefix}fromRdfResource: ${snippets.FromRdfResourceFunction}<ObjectT>;
12
12
  ${syntheticNamePrefix}sparqlConstructQueryString: (parameters: { filter?: ObjectFilterT; subject: ${imports.NamedNode} | ${imports.Variable}; } & Omit<${imports.sparqljs}.ConstructQuery, "prefixes" | "queryType" | "type"> & ${imports.sparqljs}.GeneratorOptions) => string;
13
13
  }`,
14
14
  query: code `query?: ${syntheticNamePrefix}SparqlObjectSet.Query<ObjectFilterT, ObjectIdentifierT>`,
15
- selectObjectTypeType: code `objectType: { ${syntheticNamePrefix}focusSparqlWherePatterns: ${snippets.FocusSparqlWherePatternsFunction}<ObjectFilterT> }`,
15
+ selectObjectTypeType: code `namedObjectType: { ${syntheticNamePrefix}focusSparqlWherePatterns: ${snippets.FocusSparqlWherePatternsFunction}<ObjectFilterT> }`,
16
16
  };
17
17
  const typeParameters = {
18
18
  ObjectT: code `ObjectT extends { readonly $identifier: ObjectIdentifierT }`,
@@ -30,17 +30,17 @@ export class ${syntheticNamePrefix}SparqlObjectSet implements ${syntheticNamePre
30
30
  this.graph = options?.graph;
31
31
  }
32
32
 
33
- ${joinCode([...objectTypes, ...namedObjectUnionTypes].flatMap((objectType) => {
34
- if (!objectType.features.has("sparql")) {
33
+ ${joinCode([...namedObjectTypes, ...namedObjectUnionTypes].flatMap((namedObjectType) => {
34
+ if (!namedObjectType.features.has("sparql")) {
35
35
  return Object.values(unsupportedObjectSetMethodDeclarations({
36
- objectType,
36
+ namedObjectType,
37
37
  }));
38
38
  }
39
39
  const methodSignatures = objectSetMethodSignatures({
40
- objectType,
40
+ namedObjectType,
41
41
  queryT: `${syntheticNamePrefix}SparqlObjectSet.Query`,
42
42
  });
43
- const runtimeObjectType = objectType.staticModuleName;
43
+ const runtimeObjectType = namedObjectType.staticModuleName;
44
44
  return [
45
45
  code `\
46
46
  async ${methodSignatures.object.name}(${methodSignatures.object.parameters}): ${methodSignatures.object.returnType} {
@@ -48,15 +48,15 @@ async ${methodSignatures.object.name}(${methodSignatures.object.parameters}): ${
48
48
  }`,
49
49
  code `\
50
50
  async ${methodSignatures.objectCount.name}(${methodSignatures.objectCount.parameters}): ${methodSignatures.objectCount.returnType} {
51
- return this.${syntheticNamePrefix}objectCount<${objectType.filterType}, ${objectType.identifierTypeAlias}>(${runtimeObjectType}, query);
51
+ return this.${syntheticNamePrefix}objectCount<${namedObjectType.filterType}, ${namedObjectType.identifierTypeAlias}>(${runtimeObjectType}, query);
52
52
  }`,
53
53
  code `\
54
54
  async ${methodSignatures.objectIdentifiers.name}(${methodSignatures.objectIdentifiers.parameters}): ${methodSignatures.objectIdentifiers.returnType} {
55
- return this.${syntheticNamePrefix}objectIdentifiers<${objectType.filterType}, ${objectType.identifierTypeAlias}>(${runtimeObjectType}, query);
55
+ return this.${syntheticNamePrefix}objectIdentifiers<${namedObjectType.filterType}, ${namedObjectType.identifierTypeAlias}>(${runtimeObjectType}, query);
56
56
  }`,
57
57
  code `\
58
58
  async ${methodSignatures.objects.name}(${methodSignatures.objects.parameters}): ${methodSignatures.objects.returnType} {
59
- return this.${syntheticNamePrefix}objects<${objectType.name}, ${objectType.filterType}, ${objectType.identifierTypeAlias}>(${runtimeObjectType}, query);
59
+ return this.${syntheticNamePrefix}objects<${namedObjectType.name}, ${namedObjectType.filterType}, ${namedObjectType.identifierTypeAlias}>(${runtimeObjectType}, query);
60
60
  }`,
61
61
  ];
62
62
  }), { on: "\n\n" })}
@@ -111,7 +111,7 @@ async ${methodSignatures.objects.name}(${methodSignatures.objects.parameters}):
111
111
  offset = 0;
112
112
  }
113
113
 
114
- const wherePatterns = this.${syntheticNamePrefix}wherePatterns(objectType, query);
114
+ const wherePatterns = this.${syntheticNamePrefix}wherePatterns(namedObjectType, query);
115
115
  if (wherePatterns.length === 0) {
116
116
  return ${imports.Left}(new Error("no SPARQL WHERE patterns for identifiers"));
117
117
  }
@@ -139,12 +139,12 @@ async ${methodSignatures.objects.name}(${methodSignatures.objects.parameters}):
139
139
 
140
140
  protected async ${syntheticNamePrefix}objects<${typeParameters.ObjectT}, ${typeParameters.ObjectFilterT}, ${typeParameters.ObjectIdentifierT}>(${parameters.constructObjectType}, ${parameters.query}): Promise<${imports.Either}<Error, readonly ObjectT[]>> {
141
141
  return ${imports.EitherAsync}(async ({ liftEither }) => {
142
- const identifiers = await liftEither(await this.${syntheticNamePrefix}objectIdentifiers<ObjectFilterT, ObjectIdentifierT>(objectType, query));
142
+ const identifiers = await liftEither(await this.${syntheticNamePrefix}objectIdentifiers<ObjectFilterT, ObjectIdentifierT>(namedObjectType, query));
143
143
  if (identifiers.length === 0) {
144
144
  return [];
145
145
  }
146
146
 
147
- const constructQueryString = objectType.${syntheticNamePrefix}sparqlConstructQueryString({
147
+ const constructQueryString = namedObjectType.${syntheticNamePrefix}sparqlConstructQueryString({
148
148
  subject: this.${syntheticNamePrefix}objectVariable,
149
149
  where: [{
150
150
  type: "values" as const,
@@ -161,14 +161,14 @@ async ${methodSignatures.objects.name}(${methodSignatures.objects.parameters}):
161
161
  const dataset = ${imports.datasetFactory}.dataset(quads.concat());
162
162
  const objects: ObjectT[] = [];
163
163
  for (const identifier of identifiers) {
164
- objects.push(await liftEither(objectType.${syntheticNamePrefix}fromRdfResource(new ${imports.Resource}(dataset, identifier as ${imports.NamedNode}), { objectSet: this, preferredLanguages: query?.preferredLanguages })));
164
+ objects.push(await liftEither(namedObjectType.${syntheticNamePrefix}fromRdfResource(new ${imports.Resource}(dataset, identifier as ${imports.NamedNode}), { objectSet: this, preferredLanguages: query?.preferredLanguages })));
165
165
  }
166
166
  return objects;
167
167
  });
168
168
  }
169
169
 
170
170
  protected async ${syntheticNamePrefix}objectCount<${typeParameters.ObjectFilterT}, ${typeParameters.ObjectIdentifierT}>(${parameters.selectObjectTypeType}, ${parameters.query}): Promise<${imports.Either}<Error, number>> {
171
- const wherePatterns = this.${syntheticNamePrefix}wherePatterns(objectType, query);
171
+ const wherePatterns = this.${syntheticNamePrefix}wherePatterns(namedObjectType, query);
172
172
  if (wherePatterns.length === 0) {
173
173
  return ${imports.Left}(new Error("no SPARQL WHERE patterns for count"));
174
174
  }
@@ -210,7 +210,7 @@ async ${methodSignatures.objects.name}(${methodSignatures.objects.parameters}):
210
210
  patterns = patterns.concat(query.where(this.${syntheticNamePrefix}objectVariable));
211
211
  }
212
212
 
213
- patterns = patterns.concat(objectType.${syntheticNamePrefix}focusSparqlWherePatterns({ filter: query?.filter, focusIdentifier: this.${syntheticNamePrefix}objectVariable, ignoreRdfType: false, preferredLanguages: query?.preferredLanguages, variablePrefix: this.${syntheticNamePrefix}objectVariable.value }));
213
+ patterns = patterns.concat(namedObjectType.${syntheticNamePrefix}focusSparqlWherePatterns({ filter: query?.filter, focusIdentifier: this.${syntheticNamePrefix}objectVariable, ignoreRdfType: false, preferredLanguages: query?.preferredLanguages, variablePrefix: this.${syntheticNamePrefix}objectVariable.value }));
214
214
 
215
215
  patterns = ${snippets.normalizeSparqlWherePatterns}(patterns).concat();
216
216
 
@@ -1,9 +1,9 @@
1
+ import type { NamedObjectType } from "./NamedObjectType.js";
1
2
  import { NamedObjectUnionType } from "./NamedObjectUnionType.js";
2
- import type { ObjectType } from "./ObjectType.js";
3
3
  /**
4
4
  * Synthesize the $Object union.
5
5
  */
6
6
  export declare function synthesizeUberObjectUnionType(parameters: {
7
- objectTypes: readonly ObjectType[];
7
+ namedObjectTypes: readonly NamedObjectType[];
8
8
  }): NamedObjectUnionType;
9
9
  //# sourceMappingURL=synthesizeUberObjectUnionType.d.ts.map
@@ -9,10 +9,10 @@ import { syntheticNamePrefix } from "./syntheticNamePrefix.js";
9
9
  * Synthesize the $Object union.
10
10
  */
11
11
  export function synthesizeUberObjectUnionType(parameters) {
12
- const objectTypes = parameters.objectTypes.filter((objectType) => !objectType.extern);
13
- invariant(objectTypes.length > 0);
14
- const nodeKinds = objectTypes.reduce((nodeKinds, objectType) => {
15
- for (const nodeKind of objectType.identifierType.nodeKinds) {
12
+ const namedObjectTypes = parameters.namedObjectTypes.filter((namedObjectType) => !namedObjectType.extern);
13
+ invariant(namedObjectTypes.length > 0);
14
+ const nodeKinds = namedObjectTypes.reduce((nodeKinds, namedObjectType) => {
15
+ for (const nodeKind of namedObjectType.identifierType.nodeKinds) {
16
16
  nodeKinds.add(nodeKind);
17
17
  }
18
18
  return nodeKinds;
@@ -44,8 +44,8 @@ export function synthesizeUberObjectUnionType(parameters) {
44
44
  }
45
45
  return new NamedObjectUnionType({
46
46
  comment: Maybe.empty(),
47
- features: objectTypes.reduce((features, objectType) => {
48
- for (const feature of objectType.features) {
47
+ features: namedObjectTypes.reduce((features, namedObjectType) => {
48
+ for (const feature of namedObjectType.features) {
49
49
  features.add(feature);
50
50
  }
51
51
  features.delete("graphql");
@@ -53,9 +53,9 @@ export function synthesizeUberObjectUnionType(parameters) {
53
53
  }, new Set()),
54
54
  identifierType,
55
55
  label: Maybe.empty(),
56
- members: objectTypes.map((objectType) => ({
56
+ members: namedObjectTypes.map((namedObjectType) => ({
57
57
  discriminantValue: Maybe.empty(),
58
- type: objectType,
58
+ type: namedObjectType,
59
59
  })),
60
60
  name: `${syntheticNamePrefix}Object`,
61
61
  recursive: false,
@@ -1,11 +1,11 @@
1
- import type { ObjectType } from "./ObjectType.js";
1
+ import type { NamedObjectType } from "./NamedObjectType.js";
2
2
  import { type Code } from "./ts-poet-wrapper.js";
3
- export declare function unsupportedObjectSetMethodDeclarations({ objectType, }: {
4
- objectType: {
3
+ export declare function unsupportedObjectSetMethodDeclarations({ namedObjectType, }: {
4
+ namedObjectType: {
5
5
  readonly filterType: Code;
6
6
  readonly identifierTypeAlias: Code;
7
- readonly objectSetMethodNames: ObjectType.ObjectSetMethodNames;
7
+ readonly objectSetMethodNames: NamedObjectType.ObjectSetMethodNames;
8
8
  readonly name: string;
9
9
  };
10
- }): Readonly<Record<keyof ObjectType.ObjectSetMethodNames, Code>>;
10
+ }): Readonly<Record<keyof NamedObjectType.ObjectSetMethodNames, Code>>;
11
11
  //# sourceMappingURL=unsupportedObjectSetMethodDeclarations.d.ts.map
@@ -7,9 +7,9 @@ async ${name}(${parameters}): ${returnType} {
7
7
  return ${imports.Left}(new Error("${name}: not supported")) satisfies Awaited<${returnType}>;
8
8
  }`;
9
9
  }
10
- export function unsupportedObjectSetMethodDeclarations({ objectType, }) {
10
+ export function unsupportedObjectSetMethodDeclarations({ namedObjectType, }) {
11
11
  const methodSignatures = objectSetMethodSignatures({
12
- objectType,
12
+ namedObjectType,
13
13
  parameterNamePrefix: "_",
14
14
  });
15
15
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "dependencies": {
3
- "@shaclmate/shacl-ast": "4.0.9",
3
+ "@shaclmate/shacl-ast": "4.0.11",
4
4
  "@rdfjs/data-model": "~2.1.1",
5
5
  "@rdfjs/dataset": "~2.0.2",
6
6
  "@rdfjs/prefix-map": "~0.1.2",
@@ -51,8 +51,8 @@
51
51
  "dist/generators/json/*.js",
52
52
  "dist/generators/ts/*.d.ts",
53
53
  "dist/generators/ts/*.js",
54
- "dist/generators/ts/_ObjectType/*.d.ts",
55
- "dist/generators/ts/_ObjectType/*.js",
54
+ "dist/generators/ts/_NamedObjectType/*.d.ts",
55
+ "dist/generators/ts/_NamedObjectType/*.js",
56
56
  "dist/generators/ts/_snippets/*.d.ts",
57
57
  "dist/generators/ts/_snippets/*.js",
58
58
  "dist/input/*.d.ts",
@@ -78,5 +78,5 @@
78
78
  },
79
79
  "type": "module",
80
80
  "types": "./dist/index.d.ts",
81
- "version": "4.0.9"
81
+ "version": "4.0.11"
82
82
  }
@@ -1,4 +0,0 @@
1
- import type { ObjectType } from "../ObjectType.js";
2
- import { type Code } from "../ts-poet-wrapper.js";
3
- export declare function ObjectType_classDeclaration(this: ObjectType): Code;
4
- //# sourceMappingURL=ObjectType_classDeclaration.d.ts.map
@@ -1,5 +0,0 @@
1
- import { Maybe } from "purify-ts";
2
- import type { ObjectType } from "../ObjectType.js";
3
- import { type Code } from "../ts-poet-wrapper.js";
4
- export declare function ObjectType_createFunctionDeclaration(this: ObjectType): Maybe<Code>;
5
- //# sourceMappingURL=ObjectType_createFunctionDeclaration.d.ts.map
@@ -1,5 +0,0 @@
1
- import { Maybe } from "purify-ts";
2
- import type { ObjectType } from "../ObjectType.js";
3
- import { type Code } from "../ts-poet-wrapper.js";
4
- export declare function ObjectType_equalsFunctionOrMethodDeclaration(this: ObjectType): Maybe<Code>;
5
- //# sourceMappingURL=ObjectType_equalsFunctionOrMethodDeclaration.d.ts.map
@@ -1,4 +0,0 @@
1
- import type { ObjectType } from "../ObjectType.js";
2
- import { type Code } from "../ts-poet-wrapper.js";
3
- export declare function ObjectType_filterFunctionDeclaration(this: ObjectType): Code;
4
- //# sourceMappingURL=ObjectType_filterFunctionDeclaration.d.ts.map
@@ -1,4 +0,0 @@
1
- import type { ObjectType } from "../ObjectType.js";
2
- import { type Code } from "../ts-poet-wrapper.js";
3
- export declare function ObjectType_filterTypeDeclaration(this: ObjectType): Code;
4
- //# sourceMappingURL=ObjectType_filterTypeDeclaration.d.ts.map
@@ -1,5 +0,0 @@
1
- import { Maybe } from "purify-ts";
2
- import type { ObjectType } from "../ObjectType.js";
3
- import { type Code } from "../ts-poet-wrapper.js";
4
- export declare function ObjectType_focusSparqlConstructTriplesFunctionDeclaration(this: ObjectType): Maybe<Code>;
5
- //# sourceMappingURL=ObjectType_focusSparqlConstructTriplesFunctionDeclaration.d.ts.map
@@ -1,5 +0,0 @@
1
- import { Maybe } from "purify-ts";
2
- import type { ObjectType } from "../ObjectType.js";
3
- import { type Code } from "../ts-poet-wrapper.js";
4
- export declare function ObjectType_focusSparqlWherePatternsFunctionDeclaration(this: ObjectType): Maybe<Code>;
5
- //# sourceMappingURL=ObjectType_focusSparqlWherePatternsFunctionDeclaration.d.ts.map
@@ -1,5 +0,0 @@
1
- import { Maybe } from "purify-ts";
2
- import type { ObjectType } from "../ObjectType.js";
3
- import { type Code } from "../ts-poet-wrapper.js";
4
- export declare function ObjectType_fromJsonFunctionDeclaration(this: ObjectType): Maybe<Code>;
5
- //# sourceMappingURL=ObjectType_fromJsonFunctionDeclaration.d.ts.map
@@ -1,5 +0,0 @@
1
- import { Maybe } from "purify-ts";
2
- import type { ObjectType } from "../ObjectType.js";
3
- import { type Code } from "../ts-poet-wrapper.js";
4
- export declare function ObjectType_fromRdfResourceFunctionDeclaration(this: ObjectType): Maybe<Code>;
5
- //# sourceMappingURL=ObjectType_fromRdfResourceFunctionDeclaration.d.ts.map
@@ -1,5 +0,0 @@
1
- import { Maybe } from "purify-ts";
2
- import type { ObjectType } from "../ObjectType.js";
3
- import { type Code } from "../ts-poet-wrapper.js";
4
- export declare function ObjectType_fromRdfResourceValuesFunctionDeclaration(this: ObjectType): Maybe<Code>;
5
- //# sourceMappingURL=ObjectType_fromRdfResourceValuesFunctionDeclaration.d.ts.map
@@ -1,5 +0,0 @@
1
- import { Maybe } from "purify-ts";
2
- import type { ObjectType } from "../ObjectType.js";
3
- import { type Code } from "../ts-poet-wrapper.js";
4
- export declare function ObjectType_fromRdfTypeVariableStatement(this: ObjectType): Maybe<Code>;
5
- //# sourceMappingURL=ObjectType_fromRdfTypeVariableStatement.d.ts.map
@@ -1,5 +0,0 @@
1
- import { Maybe } from "purify-ts";
2
- import type { ObjectType } from "../ObjectType.js";
3
- import { type Code } from "../ts-poet-wrapper.js";
4
- export declare function ObjectType_graphqlTypeVariableStatement(this: ObjectType): Maybe<Code>;
5
- //# sourceMappingURL=ObjectType_graphqlTypeVariableStatement.d.ts.map
@@ -1,4 +0,0 @@
1
- import type { ObjectType } from "../ObjectType.js";
2
- import { type Code } from "../ts-poet-wrapper.js";
3
- export declare function ObjectType_hashFunctionOrMethodDeclarations(this: ObjectType): readonly Code[];
4
- //# sourceMappingURL=ObjectType_hashFunctionOrMethodDeclarations.d.ts.map
@@ -1,4 +0,0 @@
1
- import type { ObjectType } from "../ObjectType.js";
2
- import { type Code } from "../ts-poet-wrapper.js";
3
- export declare function ObjectType_interfaceDeclaration(this: ObjectType): Code;
4
- //# sourceMappingURL=ObjectType_interfaceDeclaration.d.ts.map