@shaclmate/compiler 4.0.39 → 4.0.40

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 (163) hide show
  1. package/dist/generators/ts/AbstractCollectionType.d.ts +1 -1
  2. package/dist/generators/ts/AbstractCollectionType.js +10 -10
  3. package/dist/generators/ts/AbstractContainerType.d.ts +4 -5
  4. package/dist/generators/ts/AbstractContainerType.js +4 -5
  5. package/dist/generators/ts/AbstractDateType.d.ts +3 -3
  6. package/dist/generators/ts/AbstractDateType.js +2 -2
  7. package/dist/generators/ts/AbstractLazyObjectType.d.ts +8 -8
  8. package/dist/generators/ts/AbstractLazyObjectType.js +19 -19
  9. package/dist/generators/ts/AbstractNumericType.d.ts +1 -1
  10. package/dist/generators/ts/AbstractNumericType.js +3 -3
  11. package/dist/generators/ts/AbstractObjectSetType.d.ts +10 -9
  12. package/dist/generators/ts/AbstractObjectSetType.js +2 -2
  13. package/dist/generators/ts/AbstractPrimitiveType.js +2 -2
  14. package/dist/generators/ts/AbstractTermType.js +2 -2
  15. package/dist/generators/ts/AbstractType.d.ts +15 -10
  16. package/dist/generators/ts/AbstractType.js +6 -1
  17. package/dist/generators/ts/BigDecimalType.d.ts +1 -1
  18. package/dist/generators/ts/BigDecimalType.js +2 -2
  19. package/dist/generators/ts/BigIntType.js +2 -2
  20. package/dist/generators/ts/BlankNodeType.d.ts +3 -3
  21. package/dist/generators/ts/BlankNodeType.js +11 -11
  22. package/dist/generators/ts/BooleanType.d.ts +2 -2
  23. package/dist/generators/ts/BooleanType.js +10 -5
  24. package/dist/generators/ts/DefaultValueType.d.ts +1 -1
  25. package/dist/generators/ts/DefaultValueType.js +8 -9
  26. package/dist/generators/ts/GraphqlSchema.d.ts +4 -4
  27. package/dist/generators/ts/GraphqlSchema.js +4 -4
  28. package/dist/generators/ts/IdentifierType.d.ts +3 -3
  29. package/dist/generators/ts/IdentifierType.js +13 -13
  30. package/dist/generators/ts/IriType.d.ts +2 -2
  31. package/dist/generators/ts/IriType.js +17 -17
  32. package/dist/generators/ts/LazyObjectOptionType.d.ts +1 -0
  33. package/dist/generators/ts/LazyObjectOptionType.js +6 -6
  34. package/dist/generators/ts/LazyObjectSetType.js +5 -5
  35. package/dist/generators/ts/LazyObjectType.js +4 -4
  36. package/dist/generators/ts/ListType.d.ts +4 -5
  37. package/dist/generators/ts/ListType.js +3 -4
  38. package/dist/generators/ts/LiteralType.d.ts +1 -1
  39. package/dist/generators/ts/LiteralType.js +5 -5
  40. package/dist/generators/ts/{NamedObjectType.d.ts → ObjectType.d.ts} +23 -24
  41. package/dist/generators/ts/ObjectType.js +350 -0
  42. package/dist/generators/ts/ObjectUnionType.d.ts +20 -0
  43. package/dist/generators/ts/{NamedObjectUnionType.js → ObjectUnionType.js} +50 -58
  44. package/dist/generators/ts/OptionType.d.ts +1 -1
  45. package/dist/generators/ts/OptionType.js +10 -10
  46. package/dist/generators/ts/RdfjsDatasetObjectSetType.js +8 -8
  47. package/dist/generators/ts/SparqlObjectSetType.js +2 -2
  48. package/dist/generators/ts/StringType.d.ts +2 -2
  49. package/dist/generators/ts/StringType.js +10 -5
  50. package/dist/generators/ts/TermType.d.ts +2 -2
  51. package/dist/generators/ts/TermType.js +12 -12
  52. package/dist/generators/ts/TsGenerator.js +12 -9
  53. package/dist/generators/ts/Type.d.ts +4 -5
  54. package/dist/generators/ts/TypeFactory.d.ts +7 -8
  55. package/dist/generators/ts/TypeFactory.js +61 -62
  56. package/dist/generators/ts/{AbstractUnionType.d.ts → UnionType.d.ts} +33 -5
  57. package/dist/generators/ts/{AbstractUnionType.js → UnionType.js} +262 -58
  58. package/dist/generators/ts/ZodGenerator.js +7 -9
  59. package/dist/generators/ts/{_NamedObjectType → _ObjectType}/AbstractProperty.d.ts +6 -6
  60. package/dist/generators/ts/{_NamedObjectType → _ObjectType}/AbstractProperty.js +3 -3
  61. package/dist/generators/ts/{_NamedObjectType → _ObjectType}/DiscriminantProperty.d.ts +1 -1
  62. package/dist/generators/ts/{_NamedObjectType → _ObjectType}/DiscriminantProperty.js +8 -8
  63. package/dist/generators/ts/{_NamedObjectType → _ObjectType}/IdentifierProperty.d.ts +1 -5
  64. package/dist/generators/ts/{_NamedObjectType → _ObjectType}/IdentifierProperty.js +15 -10
  65. package/dist/generators/ts/_ObjectType/ObjectType_createFunctionDeclaration.d.ts +5 -0
  66. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_createFunctionDeclaration.js → _ObjectType/ObjectType_createFunctionDeclaration.js} +6 -6
  67. package/dist/generators/ts/_ObjectType/ObjectType_equalsFunctionDeclaration.d.ts +5 -0
  68. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_equalsFunctionDeclaration.js → _ObjectType/ObjectType_equalsFunctionDeclaration.js} +4 -4
  69. package/dist/generators/ts/_ObjectType/ObjectType_filterFunctionDeclaration.d.ts +5 -0
  70. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_filterFunctionDeclaration.js → _ObjectType/ObjectType_filterFunctionDeclaration.js} +3 -3
  71. package/dist/generators/ts/_ObjectType/ObjectType_filterTypeDeclaration.d.ts +5 -0
  72. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_filterTypeDeclaration.js → _ObjectType/ObjectType_filterTypeDeclaration.js} +3 -3
  73. package/dist/generators/ts/_ObjectType/ObjectType_focusSparqlConstructTriplesFunctionDeclaration.d.ts +5 -0
  74. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.js → _ObjectType/ObjectType_focusSparqlConstructTriplesFunctionDeclaration.js} +3 -3
  75. package/dist/generators/ts/_ObjectType/ObjectType_focusSparqlWherePatternsFunctionDeclaration.d.ts +5 -0
  76. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.js → _ObjectType/ObjectType_focusSparqlWherePatternsFunctionDeclaration.js} +3 -3
  77. package/dist/generators/ts/_ObjectType/ObjectType_fromJsonFunctionDeclaration.d.ts +5 -0
  78. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_fromJsonFunctionDeclaration.js → _ObjectType/ObjectType_fromJsonFunctionDeclaration.js} +4 -4
  79. package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceFunctionDeclaration.d.ts +5 -0
  80. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_fromRdfResourceFunctionDeclaration.js → _ObjectType/ObjectType_fromRdfResourceFunctionDeclaration.js} +4 -4
  81. package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceValuesFunctionDeclaration.d.ts +5 -0
  82. package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceValuesFunctionDeclaration.js +15 -0
  83. package/dist/generators/ts/_ObjectType/ObjectType_fromRdfTypeVariableStatement.d.ts +5 -0
  84. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_fromRdfTypeVariableStatement.js → _ObjectType/ObjectType_fromRdfTypeVariableStatement.js} +2 -2
  85. package/dist/generators/ts/_ObjectType/ObjectType_graphqlTypeVariableStatement.d.ts +5 -0
  86. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_graphqlTypeVariableStatement.js → _ObjectType/ObjectType_graphqlTypeVariableStatement.js} +4 -4
  87. package/dist/generators/ts/_ObjectType/ObjectType_hashFunctionDeclarations.d.ts +4 -0
  88. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_hashFunctionDeclarations.js → _ObjectType/ObjectType_hashFunctionDeclarations.js} +6 -6
  89. package/dist/generators/ts/_ObjectType/ObjectType_interfaceDeclaration.d.ts +4 -0
  90. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_interfaceDeclaration.js → _ObjectType/ObjectType_interfaceDeclaration.js} +4 -4
  91. package/dist/generators/ts/_ObjectType/ObjectType_isTypeFunctionDeclaration.d.ts +5 -0
  92. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_isTypeFunctionDeclaration.js → _ObjectType/ObjectType_isTypeFunctionDeclaration.js} +3 -3
  93. package/dist/generators/ts/_ObjectType/ObjectType_jsonParseFunctionDeclaration.d.ts +5 -0
  94. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_jsonParseFunctionDeclaration.js → _ObjectType/ObjectType_jsonParseFunctionDeclaration.js} +2 -2
  95. package/dist/generators/ts/_ObjectType/ObjectType_jsonSchemaFunctionDeclaration.d.ts +5 -0
  96. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_jsonSchemaFunctionDeclaration.js → _ObjectType/ObjectType_jsonSchemaFunctionDeclaration.js} +2 -2
  97. package/dist/generators/ts/_ObjectType/ObjectType_jsonTypeAliasDeclaration.d.ts +5 -0
  98. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_jsonTypeAliasDeclaration.js → _ObjectType/ObjectType_jsonTypeAliasDeclaration.js} +2 -2
  99. package/dist/generators/ts/_ObjectType/ObjectType_jsonUiSchemaFunctionDeclaration.d.ts +5 -0
  100. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_jsonUiSchemaFunctionDeclaration.js → _ObjectType/ObjectType_jsonUiSchemaFunctionDeclaration.js} +4 -4
  101. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_objectSetMethodNames.d.ts → _ObjectType/ObjectType_objectSetMethodNames.d.ts} +3 -3
  102. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_objectSetMethodNames.js → _ObjectType/ObjectType_objectSetMethodNames.js} +4 -4
  103. package/dist/generators/ts/_ObjectType/ObjectType_schemaVariableStatement.d.ts +5 -0
  104. package/dist/generators/ts/_ObjectType/ObjectType_schemaVariableStatement.js +14 -0
  105. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_sparqlConstructQueryFunctionDeclaration.d.ts → _ObjectType/ObjectType_sparqlConstructQueryFunctionDeclaration.d.ts} +3 -3
  106. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_sparqlConstructQueryFunctionDeclaration.js → _ObjectType/ObjectType_sparqlConstructQueryFunctionDeclaration.js} +5 -5
  107. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.d.ts → _ObjectType/ObjectType_sparqlConstructQueryStringFunctionDeclaration.d.ts} +3 -3
  108. package/dist/generators/ts/_ObjectType/ObjectType_sparqlConstructQueryStringFunctionDeclaration.js +12 -0
  109. package/dist/generators/ts/_ObjectType/ObjectType_toJsonFunctionDeclaration.d.ts +5 -0
  110. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_toJsonFunctionDeclaration.js → _ObjectType/ObjectType_toJsonFunctionDeclaration.js} +4 -4
  111. package/dist/generators/ts/_ObjectType/ObjectType_toRdfResourceFunctionDeclaration.d.ts +5 -0
  112. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_toRdfResourceFunctionDeclaration.js → _ObjectType/ObjectType_toRdfResourceFunctionDeclaration.js} +4 -4
  113. package/dist/generators/ts/_ObjectType/ObjectType_toStringFunctionDeclarations.d.ts +4 -0
  114. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_toStringFunctionDeclarations.js → _ObjectType/ObjectType_toStringFunctionDeclarations.js} +6 -6
  115. package/dist/generators/ts/_ObjectType/ObjectType_valueSparqlConstructTriplesFunctionDeclaration.d.ts +5 -0
  116. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_valueSparqlConstructTriplesFunctionDeclaration.js → _ObjectType/ObjectType_valueSparqlConstructTriplesFunctionDeclaration.js} +3 -3
  117. package/dist/generators/ts/_ObjectType/ObjectType_valueSparqlWherePatternsFunctionDeclaration.d.ts +5 -0
  118. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_valueSparqlWherePatternsFunctionDeclaration.js → _ObjectType/ObjectType_valueSparqlWherePatternsFunctionDeclaration.js} +3 -3
  119. package/dist/generators/ts/{_NamedObjectType → _ObjectType}/ShaclProperty.js +7 -7
  120. package/dist/generators/ts/_ObjectType/identifierTypeDeclarations.d.ts +4 -0
  121. package/dist/generators/ts/{_NamedObjectType → _ObjectType}/identifierTypeDeclarations.js +4 -2
  122. package/dist/input/generated.d.ts +2 -2
  123. package/dist/input/generated.js +2 -2
  124. package/package.json +4 -4
  125. package/dist/generators/ts/AbstractNamedUnionType.d.ts +0 -30
  126. package/dist/generators/ts/AbstractNamedUnionType.js +0 -190
  127. package/dist/generators/ts/AnonymousUnionType.d.ts +0 -27
  128. package/dist/generators/ts/AnonymousUnionType.js +0 -59
  129. package/dist/generators/ts/NamedObjectType.js +0 -342
  130. package/dist/generators/ts/NamedObjectUnionType.d.ts +0 -37
  131. package/dist/generators/ts/NamedUnionType.d.ts +0 -11
  132. package/dist/generators/ts/NamedUnionType.js +0 -13
  133. package/dist/generators/ts/_NamedObjectType/NamedObjectType_createFunctionDeclaration.d.ts +0 -5
  134. package/dist/generators/ts/_NamedObjectType/NamedObjectType_equalsFunctionDeclaration.d.ts +0 -5
  135. package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterFunctionDeclaration.d.ts +0 -5
  136. package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterTypeDeclaration.d.ts +0 -5
  137. package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.d.ts +0 -5
  138. package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.d.ts +0 -5
  139. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromJsonFunctionDeclaration.d.ts +0 -5
  140. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceFunctionDeclaration.d.ts +0 -5
  141. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceValuesFunctionDeclaration.d.ts +0 -5
  142. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceValuesFunctionDeclaration.js +0 -15
  143. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfTypeVariableStatement.d.ts +0 -5
  144. package/dist/generators/ts/_NamedObjectType/NamedObjectType_graphqlTypeVariableStatement.d.ts +0 -5
  145. package/dist/generators/ts/_NamedObjectType/NamedObjectType_hashFunctionDeclarations.d.ts +0 -4
  146. package/dist/generators/ts/_NamedObjectType/NamedObjectType_interfaceDeclaration.d.ts +0 -4
  147. package/dist/generators/ts/_NamedObjectType/NamedObjectType_isTypeFunctionDeclaration.d.ts +0 -5
  148. package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonParseFunctionDeclaration.d.ts +0 -5
  149. package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonSchemaFunctionDeclaration.d.ts +0 -5
  150. package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonTypeAliasDeclaration.d.ts +0 -5
  151. package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonUiSchemaFunctionDeclaration.d.ts +0 -5
  152. package/dist/generators/ts/_NamedObjectType/NamedObjectType_schemaVariableStatement.d.ts +0 -5
  153. package/dist/generators/ts/_NamedObjectType/NamedObjectType_schemaVariableStatement.js +0 -12
  154. package/dist/generators/ts/_NamedObjectType/NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.js +0 -12
  155. package/dist/generators/ts/_NamedObjectType/NamedObjectType_toJsonFunctionDeclaration.d.ts +0 -5
  156. package/dist/generators/ts/_NamedObjectType/NamedObjectType_toRdfResourceFunctionDeclaration.d.ts +0 -5
  157. package/dist/generators/ts/_NamedObjectType/NamedObjectType_toStringFunctionDeclarations.d.ts +0 -4
  158. package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlConstructTriplesFunctionDeclaration.d.ts +0 -5
  159. package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlWherePatternsFunctionDeclaration.d.ts +0 -5
  160. package/dist/generators/ts/_NamedObjectType/identifierTypeDeclarations.d.ts +0 -4
  161. /package/dist/generators/ts/{_NamedObjectType → _ObjectType}/Property.d.ts +0 -0
  162. /package/dist/generators/ts/{_NamedObjectType → _ObjectType}/Property.js +0 -0
  163. /package/dist/generators/ts/{_NamedObjectType → _ObjectType}/ShaclProperty.d.ts +0 -0
@@ -1,56 +1,55 @@
1
1
  import type { NamedNode } from "@rdfjs/types";
2
2
  import { Maybe } from "purify-ts";
3
- import { DiscriminantProperty as _DiscriminantProperty } from "./_NamedObjectType/DiscriminantProperty.js";
4
- import { IdentifierProperty as _IdentifierProperty } from "./_NamedObjectType/IdentifierProperty.js";
5
- import type { Property as _Property } from "./_NamedObjectType/Property.js";
6
- import { ShaclProperty as _ShaclProperty } from "./_NamedObjectType/ShaclProperty.js";
3
+ import { DiscriminantProperty as _DiscriminantProperty } from "./_ObjectType/DiscriminantProperty.js";
4
+ import { IdentifierProperty as _IdentifierProperty } from "./_ObjectType/IdentifierProperty.js";
5
+ import type { Property as _Property } from "./_ObjectType/Property.js";
6
+ import { ShaclProperty as _ShaclProperty } from "./_ObjectType/ShaclProperty.js";
7
7
  import { AbstractType } from "./AbstractType.js";
8
8
  import type { BlankNodeType } from "./BlankNodeType.js";
9
9
  import type { IdentifierType } from "./IdentifierType.js";
10
10
  import type { IriType } from "./IriType.js";
11
11
  import type { Type } from "./Type.js";
12
12
  import { type Code } from "./ts-poet-wrapper.js";
13
- export declare class NamedObjectType extends AbstractType {
13
+ export declare class ObjectType extends AbstractType {
14
14
  protected readonly toRdfTypes: readonly NamedNode[];
15
15
  readonly conversionFunction: Maybe<AbstractType.ConversionFunction>;
16
16
  readonly extern: boolean;
17
17
  readonly fromRdfType: Maybe<NamedNode>;
18
18
  readonly graphqlArgs: AbstractType["graphqlArgs"];
19
19
  readonly identifierType: BlankNodeType | IdentifierType | IriType;
20
- readonly kind = "NamedObjectType";
21
- readonly name: string;
20
+ readonly kind = "Object";
22
21
  readonly recursive: boolean;
23
22
  readonly referencesObjectType = true;
24
23
  readonly synthetic: boolean;
25
24
  readonly typeofs: "object"[];
26
25
  readonly validationFunction: Maybe<Code>;
27
- constructor({ extern, fromRdfType, identifierType, lazyAncestorObjectTypes, lazyChildObjectTypes, lazyDescendantObjectTypes, lazyDiscriminantProperty, lazyParentObjectTypes, lazyProperties, name, recursive, synthetic, toRdfTypes, ...superParameters }: {
26
+ constructor({ extern, fromRdfType, identifierType, lazyAncestorObjectTypes, lazyChildObjectTypes, lazyDescendantObjectTypes, lazyDiscriminantProperty, lazyParentObjectTypes, lazyProperties, recursive, synthetic, toRdfTypes, ...superParameters }: {
28
27
  comment: Maybe<string>;
29
28
  extern: boolean;
30
29
  fromRdfType: Maybe<NamedNode>;
31
30
  identifierType: BlankNodeType | IdentifierType | IriType;
32
31
  label: Maybe<string>;
33
- lazyAncestorObjectTypes: () => readonly NamedObjectType[];
34
- lazyChildObjectTypes: () => readonly NamedObjectType[];
35
- lazyDiscriminantProperty: (namedObjectType: NamedObjectType) => NamedObjectType.DiscriminantProperty;
36
- lazyDescendantObjectTypes: () => readonly NamedObjectType[];
37
- lazyParentObjectTypes: () => readonly NamedObjectType[];
38
- lazyProperties: (namedObjectType: NamedObjectType) => readonly NamedObjectType.Property[];
39
- name: string;
32
+ lazyAncestorObjectTypes: () => readonly ObjectType[];
33
+ lazyChildObjectTypes: () => readonly ObjectType[];
34
+ lazyDiscriminantProperty: (namedObjectType: ObjectType) => ObjectType.DiscriminantProperty;
35
+ lazyDescendantObjectTypes: () => readonly ObjectType[];
36
+ lazyParentObjectTypes: () => readonly ObjectType[];
37
+ lazyProperties: (namedObjectType: ObjectType) => readonly ObjectType.Property[];
40
38
  recursive: boolean;
41
39
  synthetic: boolean;
42
40
  toRdfTypes: readonly NamedNode[];
43
41
  } & ConstructorParameters<typeof AbstractType>[0]);
44
- get _discriminantProperty(): NamedObjectType.DiscriminantProperty;
45
- get ancestorObjectTypes(): readonly NamedObjectType[];
46
- get childObjectTypes(): readonly NamedObjectType[];
42
+ get _discriminantProperty(): ObjectType.DiscriminantProperty;
43
+ get ancestorObjectTypes(): readonly ObjectType[];
44
+ get childObjectTypes(): readonly ObjectType[];
47
45
  get declaration(): Maybe<Code>;
48
46
  get descendantFromRdfTypeVariables(): readonly Code[];
49
47
  get descendantFromRdfTypes(): readonly NamedNode[];
50
- get descendantObjectTypes(): readonly NamedObjectType[];
48
+ get descendantObjectTypes(): readonly ObjectType[];
51
49
  get discriminantProperty(): Maybe<AbstractType.DiscriminantProperty>;
52
50
  get discriminantValue(): string;
53
51
  get equalsFunction(): Code;
52
+ get expression(): Code;
54
53
  get filterFunction(): Code;
55
54
  get filterType(): Code;
56
55
  get fromRdfTypeVariable(): Maybe<Code>;
@@ -58,9 +57,9 @@ export declare class NamedObjectType extends AbstractType {
58
57
  get hashFunction(): Code;
59
58
  get identifierTypeAlias(): Code;
60
59
  get mutable(): boolean;
61
- get objectSetMethodNames(): NamedObjectType.ObjectSetMethodNames;
62
- get parentObjectTypes(): readonly NamedObjectType[];
63
- get properties(): readonly NamedObjectType.Property[];
60
+ get objectSetMethodNames(): ObjectType.ObjectSetMethodNames;
61
+ get parentObjectTypes(): readonly ObjectType[];
62
+ get properties(): readonly ObjectType.Property[];
64
63
  get schema(): Code;
65
64
  get schemaType(): Code;
66
65
  get toRdfResourceValueTypes(): AbstractType["toRdfResourceValueTypes"];
@@ -88,7 +87,7 @@ export declare class NamedObjectType extends AbstractType {
88
87
  private readonly lazyParentObjectTypes;
89
88
  private readonly lazyProperties;
90
89
  }
91
- export declare namespace NamedObjectType {
90
+ export declare namespace ObjectType {
92
91
  const IdentifierProperty: typeof _IdentifierProperty;
93
92
  type IdentifierProperty = _IdentifierProperty;
94
93
  type ObjectSetMethodNames = {
@@ -103,4 +102,4 @@ export declare namespace NamedObjectType {
103
102
  const DiscriminantProperty: typeof _DiscriminantProperty;
104
103
  type DiscriminantProperty = _DiscriminantProperty;
105
104
  }
106
- //# sourceMappingURL=NamedObjectType.d.ts.map
105
+ //# sourceMappingURL=ObjectType.d.ts.map
@@ -0,0 +1,350 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { NodeKind } from "@shaclmate/shacl-ast";
8
+ import { camelCase } from "change-case";
9
+ import { Maybe } from "purify-ts";
10
+ import { Memoize } from "typescript-memoize";
11
+ import { DiscriminantProperty as _DiscriminantProperty } from "./_ObjectType/DiscriminantProperty.js";
12
+ import { IdentifierProperty as _IdentifierProperty } from "./_ObjectType/IdentifierProperty.js";
13
+ import { identifierTypeDeclarations } from "./_ObjectType/identifierTypeDeclarations.js";
14
+ import { ObjectType_createFunctionDeclaration } from "./_ObjectType/ObjectType_createFunctionDeclaration.js";
15
+ import { ObjectType_equalsFunctionDeclaration } from "./_ObjectType/ObjectType_equalsFunctionDeclaration.js";
16
+ import { ObjectType_filterFunctionDeclaration } from "./_ObjectType/ObjectType_filterFunctionDeclaration.js";
17
+ import { ObjectType_filterTypeDeclaration } from "./_ObjectType/ObjectType_filterTypeDeclaration.js";
18
+ import { ObjectType_focusSparqlConstructTriplesFunctionDeclaration } from "./_ObjectType/ObjectType_focusSparqlConstructTriplesFunctionDeclaration.js";
19
+ import { ObjectType_focusSparqlWherePatternsFunctionDeclaration } from "./_ObjectType/ObjectType_focusSparqlWherePatternsFunctionDeclaration.js";
20
+ import { ObjectType_fromJsonFunctionDeclaration } from "./_ObjectType/ObjectType_fromJsonFunctionDeclaration.js";
21
+ import { ObjectType_fromRdfResourceFunctionDeclaration } from "./_ObjectType/ObjectType_fromRdfResourceFunctionDeclaration.js";
22
+ import { ObjectType_fromRdfResourceValuesFunctionDeclaration } from "./_ObjectType/ObjectType_fromRdfResourceValuesFunctionDeclaration.js";
23
+ import { ObjectType_fromRdfTypeVariableStatement } from "./_ObjectType/ObjectType_fromRdfTypeVariableStatement.js";
24
+ import { ObjectType_graphqlTypeVariableStatement } from "./_ObjectType/ObjectType_graphqlTypeVariableStatement.js";
25
+ import { ObjectType_hashFunctionDeclarations } from "./_ObjectType/ObjectType_hashFunctionDeclarations.js";
26
+ import { ObjectType_interfaceDeclaration } from "./_ObjectType/ObjectType_interfaceDeclaration.js";
27
+ import { ObjectType_isTypeFunctionDeclaration } from "./_ObjectType/ObjectType_isTypeFunctionDeclaration.js";
28
+ import { ObjectType_jsonParseFunctionDeclaration } from "./_ObjectType/ObjectType_jsonParseFunctionDeclaration.js";
29
+ import { ObjectType_jsonSchemaFunctionDeclaration } from "./_ObjectType/ObjectType_jsonSchemaFunctionDeclaration.js";
30
+ import { ObjectType_jsonTypeAliasDeclaration } from "./_ObjectType/ObjectType_jsonTypeAliasDeclaration.js";
31
+ import { ObjectType_jsonUiSchemaFunctionDeclaration } from "./_ObjectType/ObjectType_jsonUiSchemaFunctionDeclaration.js";
32
+ import { ObjectType_objectSetMethodNames } from "./_ObjectType/ObjectType_objectSetMethodNames.js";
33
+ import { ObjectType_schemaVariableStatement } from "./_ObjectType/ObjectType_schemaVariableStatement.js";
34
+ import { ObjectType_sparqlConstructQueryFunctionDeclaration } from "./_ObjectType/ObjectType_sparqlConstructQueryFunctionDeclaration.js";
35
+ import { ObjectType_sparqlConstructQueryStringFunctionDeclaration } from "./_ObjectType/ObjectType_sparqlConstructQueryStringFunctionDeclaration.js";
36
+ import { ObjectType_toJsonFunctionDeclaration } from "./_ObjectType/ObjectType_toJsonFunctionDeclaration.js";
37
+ import { ObjectType_toRdfResourceFunctionDeclaration } from "./_ObjectType/ObjectType_toRdfResourceFunctionDeclaration.js";
38
+ import { ObjectType_toStringFunctionDeclarations } from "./_ObjectType/ObjectType_toStringFunctionDeclarations.js";
39
+ import { ObjectType_valueSparqlConstructTriplesFunctionDeclaration } from "./_ObjectType/ObjectType_valueSparqlConstructTriplesFunctionDeclaration.js";
40
+ import { ObjectType_valueSparqlWherePatternsFunctionDeclaration } from "./_ObjectType/ObjectType_valueSparqlWherePatternsFunctionDeclaration.js";
41
+ import { ShaclProperty as _ShaclProperty } from "./_ObjectType/ShaclProperty.js";
42
+ import { AbstractType } from "./AbstractType.js";
43
+ import { code, def, joinCode } from "./ts-poet-wrapper.js";
44
+ export class ObjectType extends AbstractType {
45
+ toRdfTypes;
46
+ conversionFunction = Maybe.empty();
47
+ extern;
48
+ fromRdfType;
49
+ graphqlArgs = Maybe.empty();
50
+ identifierType;
51
+ kind = "Object";
52
+ recursive;
53
+ referencesObjectType = true;
54
+ synthetic;
55
+ typeofs = ["object"];
56
+ validationFunction = Maybe.empty();
57
+ constructor({ extern, fromRdfType, identifierType, lazyAncestorObjectTypes, lazyChildObjectTypes, lazyDescendantObjectTypes, lazyDiscriminantProperty, lazyParentObjectTypes, lazyProperties, recursive, synthetic, toRdfTypes, ...superParameters }) {
58
+ super(superParameters);
59
+ this.extern = extern;
60
+ this.fromRdfType = fromRdfType;
61
+ this.identifierType = identifierType;
62
+ // Lazily initialize some members in getters to avoid recursive construction
63
+ this.lazyAncestorObjectTypes = lazyAncestorObjectTypes;
64
+ this.lazyChildObjectTypes = lazyChildObjectTypes;
65
+ this.lazyDescendantObjectTypes = lazyDescendantObjectTypes;
66
+ this.lazyDiscriminantProperty = lazyDiscriminantProperty;
67
+ this.lazyParentObjectTypes = lazyParentObjectTypes;
68
+ this.lazyProperties = lazyProperties;
69
+ this.recursive = recursive;
70
+ this.synthetic = synthetic;
71
+ this.toRdfTypes = toRdfTypes;
72
+ }
73
+ get _discriminantProperty() {
74
+ return this.lazyDiscriminantProperty(this);
75
+ }
76
+ get ancestorObjectTypes() {
77
+ return this.lazyAncestorObjectTypes();
78
+ }
79
+ get childObjectTypes() {
80
+ return this.lazyChildObjectTypes();
81
+ }
82
+ get declaration() {
83
+ const alias = this.alias.extract();
84
+ if (!alias) {
85
+ return Maybe.empty();
86
+ }
87
+ const declarations = [];
88
+ if (!this.extern) {
89
+ const staticModuleDeclarations = [];
90
+ if (this.configuration.features.has("Object.type")) {
91
+ declarations.push(ObjectType_interfaceDeclaration.call(this));
92
+ }
93
+ staticModuleDeclarations.push(...ObjectType_createFunctionDeclaration.call(this).toList(), ...ObjectType_equalsFunctionDeclaration.call(this).toList(), ...ObjectType_hashFunctionDeclarations.call(this));
94
+ const jsonModuleDeclarations = [
95
+ ...ObjectType_jsonParseFunctionDeclaration.call(this).toList(),
96
+ ...ObjectType_jsonSchemaFunctionDeclaration.call(this).toList(),
97
+ ...ObjectType_jsonUiSchemaFunctionDeclaration.call(this).toList(),
98
+ ];
99
+ staticModuleDeclarations.push(...ObjectType_graphqlTypeVariableStatement.call(this).toList(), ...identifierTypeDeclarations.call(this), ...ObjectType_jsonTypeAliasDeclaration.call(this).toList(), ...(jsonModuleDeclarations.length > 0
100
+ ? [
101
+ code `export namespace Json { ${joinCode(jsonModuleDeclarations, { on: "\n\n" })} }`,
102
+ ]
103
+ : []), ...ObjectType_filterFunctionDeclaration.call(this).toList(), ...ObjectType_filterTypeDeclaration.call(this).toList(), ...ObjectType_focusSparqlConstructTriplesFunctionDeclaration.call(this).toList(), ...ObjectType_focusSparqlWherePatternsFunctionDeclaration.call(this).toList(), ...ObjectType_fromJsonFunctionDeclaration.call(this).toList(), ...ObjectType_fromRdfResourceFunctionDeclaration.call(this).toList(), ...ObjectType_fromRdfResourceValuesFunctionDeclaration.call(this).toList(), ...ObjectType_fromRdfTypeVariableStatement.call(this).toList(), ...ObjectType_isTypeFunctionDeclaration.call(this).toList(), ...ObjectType_schemaVariableStatement.call(this).toList(), ...ObjectType_sparqlConstructQueryFunctionDeclaration.call({
104
+ alias,
105
+ configuration: this.configuration,
106
+ filterType: this.filterType,
107
+ reusables: this.reusables,
108
+ }).toList(), ...ObjectType_sparqlConstructQueryStringFunctionDeclaration.call({
109
+ alias,
110
+ configuration: this.configuration,
111
+ filterType: this.filterType,
112
+ reusables: this.reusables,
113
+ }).toList(), ...ObjectType_toJsonFunctionDeclaration.call(this).toList(), ...ObjectType_toRdfResourceFunctionDeclaration.call(this).toList(), ...ObjectType_toStringFunctionDeclarations.call(this), ...ObjectType_valueSparqlConstructTriplesFunctionDeclaration.call(this).toList(), ...ObjectType_valueSparqlWherePatternsFunctionDeclaration.call(this).toList());
114
+ if (staticModuleDeclarations.length > 0) {
115
+ declarations.push(code `\
116
+ export namespace ${def(alias)} {
117
+ ${joinCode(staticModuleDeclarations, { on: "\n\n" })}
118
+ }`);
119
+ }
120
+ }
121
+ if (declarations.length === 0) {
122
+ return Maybe.empty();
123
+ }
124
+ return Maybe.of(joinCode(declarations, { on: "\n\n" }));
125
+ }
126
+ get descendantFromRdfTypeVariables() {
127
+ return this.descendantObjectTypes.flatMap((descendantObjectType) => descendantObjectType.fromRdfTypeVariable.toList());
128
+ }
129
+ get descendantFromRdfTypes() {
130
+ return this.descendantObjectTypes.flatMap((descendantObjectType) => descendantObjectType.fromRdfType.toList());
131
+ }
132
+ get descendantObjectTypes() {
133
+ return this.lazyDescendantObjectTypes();
134
+ }
135
+ get discriminantProperty() {
136
+ return Maybe.of({
137
+ jsonName: this._discriminantProperty.jsonName,
138
+ name: this._discriminantProperty.name,
139
+ ownValues: this._discriminantProperty.type.ownValues,
140
+ descendantValues: this._discriminantProperty.type.descendantValues,
141
+ });
142
+ }
143
+ get discriminantValue() {
144
+ return this.alias.unsafeCoerce();
145
+ }
146
+ get equalsFunction() {
147
+ return code `${this.alias.unsafeCoerce()}.equals`;
148
+ }
149
+ get expression() {
150
+ return code `${this.alias.unsafeCoerce()}`;
151
+ }
152
+ get filterFunction() {
153
+ return code `${this.alias.unsafeCoerce()}.filter`;
154
+ }
155
+ get filterType() {
156
+ return code `${this.alias.unsafeCoerce()}.Filter`;
157
+ }
158
+ get fromRdfTypeVariable() {
159
+ return this.fromRdfType.map(() => code `${this.alias.unsafeCoerce()}.fromRdfType`);
160
+ }
161
+ get graphqlType() {
162
+ return new AbstractType.GraphqlType(code `${this.alias.unsafeCoerce()}.GraphQL`, this.reusables);
163
+ }
164
+ get hashFunction() {
165
+ return code `${this.alias.unsafeCoerce()}.hash`;
166
+ }
167
+ get identifierTypeAlias() {
168
+ return code `${this.alias.unsafeCoerce()}.Identifier`;
169
+ }
170
+ get mutable() {
171
+ return this.properties.some((property) => property.mutable);
172
+ }
173
+ get objectSetMethodNames() {
174
+ return ObjectType_objectSetMethodNames.call({
175
+ alias: this.alias.unsafeCoerce(),
176
+ configuration: this.configuration,
177
+ });
178
+ }
179
+ get parentObjectTypes() {
180
+ return this.lazyParentObjectTypes();
181
+ }
182
+ get properties() {
183
+ const properties = this.lazyProperties(this);
184
+ const propertyNames = new Set();
185
+ for (const property of properties) {
186
+ if (propertyNames.has(property.name)) {
187
+ throw new Error(`duplicate property '${property.name}'`);
188
+ }
189
+ }
190
+ return properties;
191
+ }
192
+ get schema() {
193
+ return code `${this.alias.unsafeCoerce()}.schema`;
194
+ }
195
+ get schemaType() {
196
+ return code `typeof ${this.schema}`;
197
+ }
198
+ get toRdfResourceValueTypes() {
199
+ return new Set([...this.identifierType.nodeKinds].map(NodeKind.toTermType));
200
+ }
201
+ get toRdfjsResourceType() {
202
+ if (this.parentObjectTypes.length > 0) {
203
+ return this.parentObjectTypes[0].toRdfjsResourceType;
204
+ }
205
+ return code `${this.reusables.imports.Resource}${this.identifierType.kind === "Iri" ? code `<${this.reusables.imports.NamedNode}>` : ""}`;
206
+ }
207
+ get valueSparqlConstructTriplesFunction() {
208
+ return code `${this.alias.unsafeCoerce()}.valueSparqlConstructTriples`;
209
+ }
210
+ get valueSparqlWherePatternsFunction() {
211
+ return code `${this.alias.unsafeCoerce()}.valueSparqlWherePatterns`;
212
+ }
213
+ get thisVariable() {
214
+ return code `_${camelCase(this.alias.unsafeCoerce())}`;
215
+ }
216
+ fromJsonExpression({ variables, }) {
217
+ // Assumes the JSON object has been recursively validated already.
218
+ return code `${this.alias.unsafeCoerce()}.fromJson(${variables.value})`;
219
+ }
220
+ fromRdfResourceValuesExpression({ variables, }) {
221
+ const { resourceValues: resourceValuesVariable, ...fromRdfResourceValuesOptionsTemp } = variables;
222
+ const fromRdfResourceValuesOptions = fromRdfResourceValuesOptionsTemp;
223
+ if (!this.configuration.features.has("ObjectSet")) {
224
+ delete fromRdfResourceValuesOptions["objectSet"];
225
+ }
226
+ return code `${this.alias.unsafeCoerce()}.fromRdfResourceValues(${resourceValuesVariable}, ${fromRdfResourceValuesOptions})`;
227
+ }
228
+ graphqlResolveExpression({ variables, }) {
229
+ return variables.value;
230
+ }
231
+ jsonSchema({ context, }) {
232
+ let expression = code `${this.alias.unsafeCoerce()}.Json.schema()`;
233
+ if (context === "property" &&
234
+ this.properties.some((property) => property.recursive)) {
235
+ expression = code `${this.reusables.imports.z}.lazy((): ${this.reusables.imports.z}.ZodType<${this.alias.unsafeCoerce()}.Json> => ${expression})`;
236
+ }
237
+ return expression;
238
+ }
239
+ jsonType() {
240
+ return new AbstractType.JsonType(code `${this.alias.unsafeCoerce()}.Json`);
241
+ }
242
+ jsonUiSchemaElement({ variables, }) {
243
+ return Maybe.of(code `${this.alias.unsafeCoerce()}.Json.uiSchema({ scopePrefix: ${variables.scopePrefix} })`);
244
+ }
245
+ toJsonExpression({ variables, }) {
246
+ return code `${this.alias.unsafeCoerce()}.toJson(${variables.value})`;
247
+ }
248
+ toRdfResourceValuesExpression({ variables, }) {
249
+ return code `[${this.alias.unsafeCoerce()}.toRdfResource(${variables.value}, { graph: ${variables.graph}, resourceSet: ${variables.resourceSet} }).identifier]`;
250
+ }
251
+ toStringExpression({ variables, }) {
252
+ return code `${this.alias.unsafeCoerce()}.${this.configuration.syntheticNamePrefix}toString(${variables.value})`;
253
+ }
254
+ lazyAncestorObjectTypes;
255
+ lazyChildObjectTypes;
256
+ lazyDescendantObjectTypes;
257
+ lazyDiscriminantProperty;
258
+ lazyParentObjectTypes;
259
+ lazyProperties;
260
+ }
261
+ __decorate([
262
+ Memoize()
263
+ ], ObjectType.prototype, "_discriminantProperty", null);
264
+ __decorate([
265
+ Memoize()
266
+ ], ObjectType.prototype, "ancestorObjectTypes", null);
267
+ __decorate([
268
+ Memoize()
269
+ ], ObjectType.prototype, "childObjectTypes", null);
270
+ __decorate([
271
+ Memoize()
272
+ ], ObjectType.prototype, "descendantFromRdfTypeVariables", null);
273
+ __decorate([
274
+ Memoize()
275
+ ], ObjectType.prototype, "descendantFromRdfTypes", null);
276
+ __decorate([
277
+ Memoize()
278
+ ], ObjectType.prototype, "descendantObjectTypes", null);
279
+ __decorate([
280
+ Memoize()
281
+ ], ObjectType.prototype, "discriminantProperty", null);
282
+ __decorate([
283
+ Memoize()
284
+ ], ObjectType.prototype, "discriminantValue", null);
285
+ __decorate([
286
+ Memoize()
287
+ ], ObjectType.prototype, "equalsFunction", null);
288
+ __decorate([
289
+ Memoize()
290
+ ], ObjectType.prototype, "expression", null);
291
+ __decorate([
292
+ Memoize()
293
+ ], ObjectType.prototype, "filterFunction", null);
294
+ __decorate([
295
+ Memoize()
296
+ ], ObjectType.prototype, "filterType", null);
297
+ __decorate([
298
+ Memoize()
299
+ ], ObjectType.prototype, "fromRdfTypeVariable", null);
300
+ __decorate([
301
+ Memoize()
302
+ ], ObjectType.prototype, "graphqlType", null);
303
+ __decorate([
304
+ Memoize()
305
+ ], ObjectType.prototype, "hashFunction", null);
306
+ __decorate([
307
+ Memoize()
308
+ ], ObjectType.prototype, "identifierTypeAlias", null);
309
+ __decorate([
310
+ Memoize()
311
+ ], ObjectType.prototype, "mutable", null);
312
+ __decorate([
313
+ Memoize()
314
+ ], ObjectType.prototype, "objectSetMethodNames", null);
315
+ __decorate([
316
+ Memoize()
317
+ ], ObjectType.prototype, "parentObjectTypes", null);
318
+ __decorate([
319
+ Memoize()
320
+ ], ObjectType.prototype, "properties", null);
321
+ __decorate([
322
+ Memoize()
323
+ ], ObjectType.prototype, "schema", null);
324
+ __decorate([
325
+ Memoize()
326
+ ], ObjectType.prototype, "schemaType", null);
327
+ __decorate([
328
+ Memoize()
329
+ ], ObjectType.prototype, "toRdfResourceValueTypes", null);
330
+ __decorate([
331
+ Memoize()
332
+ ], ObjectType.prototype, "toRdfjsResourceType", null);
333
+ __decorate([
334
+ Memoize()
335
+ ], ObjectType.prototype, "valueSparqlConstructTriplesFunction", null);
336
+ __decorate([
337
+ Memoize()
338
+ ], ObjectType.prototype, "valueSparqlWherePatternsFunction", null);
339
+ __decorate([
340
+ Memoize()
341
+ ], ObjectType.prototype, "thisVariable", null);
342
+ __decorate([
343
+ Memoize()
344
+ ], ObjectType.prototype, "jsonType", null);
345
+ (function (ObjectType) {
346
+ ObjectType.IdentifierProperty = _IdentifierProperty;
347
+ ObjectType.ShaclProperty = _ShaclProperty;
348
+ ObjectType.DiscriminantProperty = _DiscriminantProperty;
349
+ })(ObjectType || (ObjectType = {}));
350
+ //# sourceMappingURL=ObjectType.js.map
@@ -0,0 +1,20 @@
1
+ import type { ObjectType } from "./ObjectType.js";
2
+ import { type Code } from "./ts-poet-wrapper.js";
3
+ import { UnionType } from "./UnionType.js";
4
+ export declare class ObjectUnionType extends UnionType<ObjectType> {
5
+ readonly kind = "ObjectUnion";
6
+ get identifierTypeAlias(): Code;
7
+ get objectSetMethodNames(): ObjectType.ObjectSetMethodNames;
8
+ get schema(): Code;
9
+ get schemaType(): Code;
10
+ protected get staticModuleDeclarations(): Record<string, Code>;
11
+ private get focusSparqlConstructTriplesFunctionDeclaration();
12
+ private get focusSparqlWherePatternsFunctionDeclaration();
13
+ private get fromRdfResourceFunctionDeclaration();
14
+ private get graphqlTypeVariableStatement();
15
+ private get identifierTypeDeclarations();
16
+ private get isTypeFunctionDeclaration();
17
+ private get schemaVariableStatement();
18
+ private get toRdfResourceFunctionDeclaration();
19
+ }
20
+ //# sourceMappingURL=ObjectUnionType.d.ts.map