@shaclmate/compiler 4.0.35 → 4.0.36

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 (47) hide show
  1. package/dist/generators/ts/AbstractNamedUnionType.js +33 -20
  2. package/dist/generators/ts/NamedObjectType.js +7 -2
  3. package/dist/generators/ts/NamedObjectUnionType.js +14 -5
  4. package/dist/generators/ts/TsFeature.d.ts +1 -1
  5. package/dist/generators/ts/TsFeature.js +25 -7
  6. package/dist/generators/ts/TsGenerator.d.ts +1 -1
  7. package/dist/generators/ts/TsGenerator.js +66 -8
  8. package/dist/generators/ts/_NamedObjectType/NamedObjectType_createFunctionDeclaration.js +1 -1
  9. package/dist/generators/ts/_NamedObjectType/NamedObjectType_equalsFunctionDeclaration.js +1 -1
  10. package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterFunctionDeclaration.d.ts +2 -1
  11. package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterFunctionDeclaration.js +6 -2
  12. package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterTypeDeclaration.d.ts +2 -1
  13. package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterTypeDeclaration.js +6 -2
  14. package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.js +1 -1
  15. package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.js +1 -1
  16. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromJsonFunctionDeclaration.js +1 -1
  17. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceFunctionDeclaration.js +1 -1
  18. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceValuesFunctionDeclaration.js +1 -1
  19. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfTypeVariableStatement.js +1 -1
  20. package/dist/generators/ts/_NamedObjectType/NamedObjectType_graphqlTypeVariableStatement.js +1 -1
  21. package/dist/generators/ts/_NamedObjectType/NamedObjectType_hashFunctionDeclarations.js +1 -1
  22. package/dist/generators/ts/_NamedObjectType/NamedObjectType_isTypeFunctionDeclaration.d.ts +2 -1
  23. package/dist/generators/ts/_NamedObjectType/NamedObjectType_isTypeFunctionDeclaration.js +6 -2
  24. package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonParseFunctionDeclaration.js +1 -1
  25. package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonSchemaFunctionDeclaration.js +1 -1
  26. package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonTypeAliasDeclaration.js +1 -1
  27. package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonUiSchemaFunctionDeclaration.js +1 -1
  28. package/dist/generators/ts/_NamedObjectType/NamedObjectType_schemaVariableStatement.d.ts +2 -1
  29. package/dist/generators/ts/_NamedObjectType/NamedObjectType_schemaVariableStatement.js +6 -2
  30. package/dist/generators/ts/_NamedObjectType/NamedObjectType_sparqlConstructQueryFunctionDeclaration.js +1 -1
  31. package/dist/generators/ts/_NamedObjectType/NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.js +1 -1
  32. package/dist/generators/ts/_NamedObjectType/NamedObjectType_toJsonFunctionDeclaration.js +1 -1
  33. package/dist/generators/ts/_NamedObjectType/NamedObjectType_toRdfResourceFunctionDeclaration.js +1 -1
  34. package/dist/generators/ts/_NamedObjectType/NamedObjectType_toStringFunctionDeclarations.js +3 -0
  35. package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlConstructTriplesFunctionDeclaration.js +1 -1
  36. package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlWherePatternsFunctionDeclaration.js +1 -1
  37. package/dist/generators/ts/_NamedObjectType/ShaclProperty.js +4 -2
  38. package/dist/generators/ts/_NamedObjectType/identifierTypeDeclarations.js +3 -0
  39. package/dist/generators/ts/_snippets/snippets_PropertyPath.js +12 -6
  40. package/dist/generators/ts/graphqlSchemaVariableStatement.js +1 -1
  41. package/dist/generators/ts/objectSetDeclarations.js +7 -10
  42. package/dist/generators/ts/rdfjsDatasetObjectSetClassDeclaration.js +0 -6
  43. package/dist/generators/ts/sparqlObjectSetClassDeclaration.js +0 -6
  44. package/dist/input/generated.js +78 -78
  45. package/package.json +2 -2
  46. package/dist/generators/ts/unsupportedObjectSetMethodDeclarations.d.ts +0 -12
  47. package/dist/generators/ts/unsupportedObjectSetMethodDeclarations.js +0 -21
@@ -16,9 +16,10 @@ export class AbstractNamedUnionType extends AbstractUnionType {
16
16
  this._name = name;
17
17
  }
18
18
  get declaration() {
19
- const declarations = [
20
- code `export type ${def(this._name)} = ${this.inlineName};`,
21
- ];
19
+ const declarations = [];
20
+ if (this.configuration.features.has("Object.type")) {
21
+ declarations.push(code `export type ${def(this._name)} = ${this.inlineName};`);
22
+ }
22
23
  const staticModuleDeclarations = Object.entries(this.staticModuleDeclarations);
23
24
  if (staticModuleDeclarations.length > 0) {
24
25
  declarations.push(code `\
@@ -68,22 +69,26 @@ ${joinCode(staticModuleDeclarations
68
69
  }
69
70
  get staticModuleDeclarations() {
70
71
  const staticModuleDeclarations = {};
71
- if (this.configuration.features.has("equals")) {
72
+ if (this.configuration.features.has("Object.equals")) {
72
73
  staticModuleDeclarations[`equals`] =
73
74
  code `export const equals = ${this.inlineEqualsFunction};`;
74
75
  }
75
- staticModuleDeclarations[`Filter`] =
76
- code `export type Filter = ${this.inlineFilterType};`;
77
- staticModuleDeclarations[`filter`] =
78
- code `export const filter = ${this.inlineFilterFunction};`;
79
- if (this.configuration.features.has("hash")) {
76
+ if (this.configuration.features.has("Object.filter")) {
77
+ staticModuleDeclarations[`Filter`] =
78
+ code `export type Filter = ${this.inlineFilterType};`;
79
+ staticModuleDeclarations[`filter`] =
80
+ code `export const filter = ${this.inlineFilterFunction};`;
81
+ }
82
+ if (this.configuration.features.has("Object.hash")) {
80
83
  staticModuleDeclarations[`hash`] =
81
84
  code `export const hash = ${this.inlineHashFunction};`;
82
85
  }
83
- if (this.configuration.features.has("json")) {
84
- staticModuleDeclarations[`Json`] = code `\
85
- ${this.jsonTypeAliasDeclaration}
86
-
86
+ if (this.configuration.features.has("Object.JSON.type")) {
87
+ staticModuleDeclarations[`Json.type`] =
88
+ code `${this.jsonTypeAliasDeclaration}`;
89
+ }
90
+ if (this.configuration.features.has("Object.JSON.schema")) {
91
+ staticModuleDeclarations[`Json.namespace`] = code `\
87
92
  export namespace Json {
88
93
  ${this.jsonSchemaFunctionDeclaration}
89
94
 
@@ -93,26 +98,34 @@ export namespace Json {
93
98
  return ${this.reusables.imports.Right}(jsonSafeParseResult.data);
94
99
  }
95
100
  }`;
101
+ }
102
+ if (this.configuration.features.has("Object.fromJson")) {
96
103
  staticModuleDeclarations[`fromJson`] =
97
104
  code `export const fromJson = ${this.inlineFromJsonFunction};`;
98
- staticModuleDeclarations[`toJson`] =
99
- code `export const toJson = ${this.inlineToJsonFunction};`;
100
105
  }
101
- if (this.configuration.features.has("rdf")) {
106
+ if (this.configuration.features.has("Object.fromRdf")) {
102
107
  staticModuleDeclarations[`fromRdfResourceValues`] =
103
108
  code `export const fromRdfResourceValues: ${this.reusables.snippets.FromRdfResourceValuesFunction}<${this.name}> = ${this.inlineFromRdfResourceValuesFunction};`;
109
+ }
110
+ if (this.configuration.features.has("Object.toJson")) {
111
+ staticModuleDeclarations[`toJson`] =
112
+ code `export const toJson = ${this.inlineToJsonFunction};`;
113
+ }
114
+ if (this.configuration.features.has("Object.toRdf")) {
104
115
  staticModuleDeclarations[`toRdfResourceValues`] =
105
116
  code `export const toRdfResourceValues = ${this.inlineToRdfResourceValuesFunction};`;
106
117
  }
107
- if (this.configuration.features.has("sparql")) {
118
+ if (this.configuration.features.has("Object.SPARQL")) {
108
119
  staticModuleDeclarations[`valueSparqlConstructTriples`] =
109
120
  code `export const valueSparqlConstructTriples: ${this.reusables.snippets.ValueSparqlConstructTriplesFunction}<${this.filterType}, ${this.schemaType}> = ${this.inlineValueSparqlConstructTriplesFunction};`;
110
121
  staticModuleDeclarations[`valueSparqlWherePatterns`] =
111
122
  code `export const valueSparqlWherePatterns: ${this.reusables.snippets.ValueSparqlWherePatternsFunction}<${this.filterType}, ${this.schemaType}> = ${this.inlineValueSparqlWherePatternsFunction};`;
112
123
  }
113
- const syntheticNamePrefix = this.configuration.syntheticNamePrefix;
114
- staticModuleDeclarations[`${syntheticNamePrefix}toString`] =
115
- code `export const ${syntheticNamePrefix}toString = ${this.inlineToStringFunction};`;
124
+ if (this.configuration.features.has("Object.toString")) {
125
+ const syntheticNamePrefix = this.configuration.syntheticNamePrefix;
126
+ staticModuleDeclarations[`${syntheticNamePrefix}toString`] =
127
+ code `export const ${syntheticNamePrefix}toString = ${this.inlineToStringFunction};`;
128
+ }
116
129
  return staticModuleDeclarations;
117
130
  }
118
131
  fromJsonExpression({ variables, }) {
@@ -84,7 +84,9 @@ export class NamedObjectType extends AbstractType {
84
84
  const declarations = [];
85
85
  if (!this.extern) {
86
86
  const staticModuleDeclarations = [];
87
- declarations.push(NamedObjectType_interfaceDeclaration.call(this));
87
+ if (this.configuration.features.has("Object.type")) {
88
+ declarations.push(NamedObjectType_interfaceDeclaration.call(this));
89
+ }
88
90
  staticModuleDeclarations.push(...NamedObjectType_createFunctionDeclaration.call(this).toList(), ...NamedObjectType_equalsFunctionDeclaration.call(this).toList(), ...NamedObjectType_hashFunctionDeclarations.call(this));
89
91
  const jsonModuleDeclarations = [
90
92
  ...NamedObjectType_jsonParseFunctionDeclaration.call(this).toList(),
@@ -95,7 +97,7 @@ export class NamedObjectType extends AbstractType {
95
97
  ? [
96
98
  code `export namespace Json { ${joinCode(jsonModuleDeclarations, { on: "\n\n" })} }`,
97
99
  ]
98
- : []), NamedObjectType_filterFunctionDeclaration.call(this), NamedObjectType_filterTypeDeclaration.call(this), ...NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.call(this).toList(), ...NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.call(this).toList(), ...NamedObjectType_fromJsonFunctionDeclaration.call(this).toList(), ...NamedObjectType_fromRdfResourceFunctionDeclaration.call(this).toList(), ...NamedObjectType_fromRdfResourceValuesFunctionDeclaration.call(this).toList(), ...NamedObjectType_fromRdfTypeVariableStatement.call(this).toList(), NamedObjectType_isTypeFunctionDeclaration.call(this), NamedObjectType_schemaVariableStatement.call(this), ...NamedObjectType_sparqlConstructQueryFunctionDeclaration.call({
100
+ : []), ...NamedObjectType_filterFunctionDeclaration.call(this).toList(), ...NamedObjectType_filterTypeDeclaration.call(this).toList(), ...NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.call(this).toList(), ...NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.call(this).toList(), ...NamedObjectType_fromJsonFunctionDeclaration.call(this).toList(), ...NamedObjectType_fromRdfResourceFunctionDeclaration.call(this).toList(), ...NamedObjectType_fromRdfResourceValuesFunctionDeclaration.call(this).toList(), ...NamedObjectType_fromRdfTypeVariableStatement.call(this).toList(), ...NamedObjectType_isTypeFunctionDeclaration.call(this).toList(), ...NamedObjectType_schemaVariableStatement.call(this).toList(), ...NamedObjectType_sparqlConstructQueryFunctionDeclaration.call({
99
101
  configuration: this.configuration,
100
102
  filterType: this.filterType,
101
103
  name: this.name,
@@ -113,6 +115,9 @@ ${joinCode(staticModuleDeclarations, { on: "\n\n" })}
113
115
  }`);
114
116
  }
115
117
  }
118
+ if (declarations.length === 0) {
119
+ return Maybe.empty();
120
+ }
116
121
  return Maybe.of(joinCode(declarations, { on: "\n\n" }));
117
122
  }
118
123
  get descendantFromRdfTypeVariables() {
@@ -73,7 +73,7 @@ export class NamedObjectUnionType extends AbstractNamedUnionType {
73
73
  };
74
74
  }
75
75
  get focusSparqlConstructTriplesFunctionDeclaration() {
76
- if (!this.configuration.features.has("sparql")) {
76
+ if (!this.configuration.features.has("Object.SPARQL")) {
77
77
  return {};
78
78
  }
79
79
  return singleEntryRecord(`focusSparqlConstructTriples`, code `\
@@ -82,7 +82,7 @@ export function focusSparqlConstructTriples({ filter, focusIdentifier, variableP
82
82
  }`);
83
83
  }
84
84
  get focusSparqlWherePatternsFunctionDeclaration() {
85
- if (!this.configuration.features.has("sparql")) {
85
+ if (!this.configuration.features.has("Object.SPARQL")) {
86
86
  return {};
87
87
  }
88
88
  return singleEntryRecord(`focusSparqlWherePatterns`, code `\
@@ -110,7 +110,7 @@ if (focusIdentifier.termType === "Variable") {
110
110
  }`);
111
111
  }
112
112
  get fromRdfResourceFunctionDeclaration() {
113
- if (!this.configuration.features.has("rdf")) {
113
+ if (!this.configuration.features.has("Object.fromRdf")) {
114
114
  return {};
115
115
  }
116
116
  return singleEntryRecord(`fromRdfResource`, code `\
@@ -123,7 +123,7 @@ export const fromRdfResource: ${this.reusables.snippets.FromRdfResourceFunction}
123
123
  }, null)};`);
124
124
  }
125
125
  get graphqlTypeVariableStatement() {
126
- if (!this.configuration.features.has("graphql")) {
126
+ if (!this.configuration.features.has("GraphQL")) {
127
127
  return {};
128
128
  }
129
129
  if (this.synthetic) {
@@ -138,6 +138,9 @@ export const GraphQL = new ${this.reusables.imports.GraphQLUnionType}(${{
138
138
  }});`);
139
139
  }
140
140
  get identifierTypeDeclarations() {
141
+ if (!this.configuration.features.has("Object.type")) {
142
+ return {};
143
+ }
141
144
  return singleEntryRecord(`Identifier`, code `\
142
145
  export type Identifier = ${this.#identifierType.name};
143
146
  export namespace Identifier {
@@ -146,6 +149,9 @@ export namespace Identifier {
146
149
  }`);
147
150
  }
148
151
  get isTypeFunctionDeclaration() {
152
+ if (!this.configuration.features.has("Object.type")) {
153
+ return {};
154
+ }
149
155
  if (this._name === `${this.configuration.syntheticNamePrefix}Object`) {
150
156
  return {};
151
157
  }
@@ -155,6 +161,9 @@ export namespace Identifier {
155
161
  }`);
156
162
  }
157
163
  get schemaVariableStatement() {
164
+ if (!this.configuration.features.has("Object.schema")) {
165
+ return {};
166
+ }
158
167
  const commonPropertiesByName = {};
159
168
  this.members.forEach((member, memberI) => {
160
169
  for (const memberTypeProperty of member.type.properties.concat(member.type.ancestorObjectTypes.flatMap((ancestorObjectType) => ancestorObjectType.properties))) {
@@ -192,7 +201,7 @@ ${{
192
201
  }} as const;`);
193
202
  }
194
203
  get toRdfResourceFunctionDeclaration() {
195
- if (!this.configuration.features.has("rdf")) {
204
+ if (!this.configuration.features.has("Object.toRdf")) {
196
205
  return {};
197
206
  }
198
207
  return singleEntryRecord(`toRdfResource`, code `\
@@ -1,3 +1,3 @@
1
1
  export type TsFeature = (typeof TS_FEATURES)[number];
2
- export declare const TS_FEATURES: readonly ["create", "equals", "graphql", "hash", "json", "rdf", "sparql"];
2
+ export declare const TS_FEATURES: readonly ["GraphQL", "JSON", "Object.create", "Object.equals", "Object.filter", "Object.fromJson", "Object.fromRdf", "Object.hash", "Object.JSON", "Object.JSON.type", "Object.JSON.parse", "Object.JSON.schema", "Object.JSON.uiSchema", "Object.RDF", "Object.schema", "Object.SPARQL", "Object.toJson", "Object.toRdf", "Object.toString", "Object.type", "ObjectSet", "RDF", "RdfjsDatasetObjectSet", "SPARQL", "SparqlObjectSet"];
3
3
  //# sourceMappingURL=TsFeature.d.ts.map
@@ -1,10 +1,28 @@
1
1
  export const TS_FEATURES = [
2
- "create",
3
- "equals",
4
- "graphql",
5
- "hash",
6
- "json",
7
- "rdf",
8
- "sparql",
2
+ "GraphQL",
3
+ "JSON",
4
+ "Object.create",
5
+ "Object.equals",
6
+ "Object.filter",
7
+ "Object.fromJson",
8
+ "Object.fromRdf",
9
+ "Object.hash",
10
+ "Object.JSON",
11
+ "Object.JSON.type",
12
+ "Object.JSON.parse",
13
+ "Object.JSON.schema",
14
+ "Object.JSON.uiSchema",
15
+ "Object.RDF",
16
+ "Object.schema",
17
+ "Object.SPARQL",
18
+ "Object.toJson",
19
+ "Object.toRdf",
20
+ "Object.toString",
21
+ "Object.type",
22
+ "ObjectSet",
23
+ "RDF",
24
+ "RdfjsDatasetObjectSet",
25
+ "SPARQL",
26
+ "SparqlObjectSet",
9
27
  ];
10
28
  //# sourceMappingURL=TsFeature.js.map
@@ -24,8 +24,8 @@ export declare namespace TsGenerator {
24
24
  readonly syntheticNamePrefix: string;
25
25
  }
26
26
  namespace Configuration {
27
+ function inferFeatures(features: ReadonlySet<TsFeature>): Set<"JSON" | "GraphQL" | "Object.create" | "Object.equals" | "Object.filter" | "Object.fromJson" | "Object.fromRdf" | "Object.hash" | "Object.JSON" | "Object.JSON.type" | "Object.JSON.parse" | "Object.JSON.schema" | "Object.JSON.uiSchema" | "Object.RDF" | "Object.schema" | "Object.SPARQL" | "Object.toJson" | "Object.toRdf" | "Object.toString" | "Object.type" | "ObjectSet" | "RDF" | "RdfjsDatasetObjectSet" | "SPARQL" | "SparqlObjectSet">;
27
28
  const default_: Configuration;
28
- function inferFeatures(features: ReadonlySet<TsFeature>): Set<"equals" | "create" | "graphql" | "hash" | "json" | "rdf" | "sparql">;
29
29
  }
30
30
  }
31
31
  //# sourceMappingURL=TsGenerator.d.ts.map
@@ -150,21 +150,79 @@ export class TsGenerator {
150
150
  (function (TsGenerator) {
151
151
  let Configuration;
152
152
  (function (Configuration) {
153
- Configuration.default_ = {
154
- features: new Set(["create", "equals", "hash", "json", "rdf"]),
155
- syntheticNamePrefix: "$",
153
+ const featureDependencies = {
154
+ GraphQL: ["ObjectSet"],
155
+ // Alias for other features, not dependencies per se
156
+ JSON: ["Object.JSON"],
157
+ "Object.create": ["Object.schema", "Object.toString", "Object.type"],
158
+ "Object.equals": ["Object.type"],
159
+ "Object.filter": ["Object.type"],
160
+ "Object.fromJson": [
161
+ "Object.create",
162
+ "Object.JSON.type",
163
+ "Object.type",
164
+ "ObjectSet",
165
+ ],
166
+ "Object.fromRdf": [
167
+ "Object.create",
168
+ "Object.schema",
169
+ "ObjectSet",
170
+ "RdfjsDatasetObjectSet",
171
+ ],
172
+ "Object.hash": [],
173
+ // Alias for other features, not dependencies per se
174
+ "Object.JSON": [
175
+ "Object.fromJson",
176
+ "Object.JSON.parse",
177
+ "Object.JSON.schema",
178
+ "Object.JSON.type",
179
+ "Object.JSON.uiSchema",
180
+ "Object.toJson",
181
+ ],
182
+ "Object.JSON.parse": ["Object.JSON.schema", "Object.JSON.type"],
183
+ "Object.JSON.type": [],
184
+ "Object.JSON.schema": ["Object.JSON.type"],
185
+ "Object.JSON.uiSchema": [],
186
+ // Alias for other features, not dependencies per se
187
+ "Object.RDF": ["Object.fromRdf", "Object.toRdf"],
188
+ "Object.schema": [],
189
+ "Object.toJson": ["Object.JSON.type", "Object.type"],
190
+ "Object.toRdf": ["Object.schema", "Object.type"],
191
+ "Object.toString": ["Object.type"],
192
+ "Object.SPARQL": ["Object.schema"],
193
+ "Object.type": [], // Implies Object.Identifier
194
+ ObjectSet: ["Object.filter"],
195
+ // Alias for other features, not dependencies per se
196
+ RDF: ["Object.RDF", "RdfjsDatasetObjectSet"],
197
+ RdfjsDatasetObjectSet: ["Object.fromRdf", "ObjectSet"],
198
+ SPARQL: ["Object.SPARQL", "SparqlObjectSet"],
199
+ SparqlObjectSet: ["Object.SPARQL", "ObjectSet"],
156
200
  };
157
201
  function inferFeatures(features) {
158
202
  const inferredFeatures = new Set(features);
159
- if (inferredFeatures.has("graphql") || inferredFeatures.has("sparql")) {
160
- inferredFeatures.add("rdf");
161
- }
162
- if (inferredFeatures.has("json") || inferredFeatures.has("rdf")) {
163
- inferredFeatures.add("create");
203
+ const queue = [...features];
204
+ while (queue.length > 0) {
205
+ const feature = queue.shift();
206
+ for (const featureDependency of featureDependencies[feature]) {
207
+ if (!inferredFeatures.has(featureDependency)) {
208
+ inferredFeatures.add(featureDependency);
209
+ queue.push(featureDependency);
210
+ }
211
+ }
164
212
  }
165
213
  return inferredFeatures;
166
214
  }
167
215
  Configuration.inferFeatures = inferFeatures;
216
+ Configuration.default_ = {
217
+ features: inferFeatures(new Set([
218
+ "Object.create",
219
+ "Object.equals",
220
+ "Object.hash",
221
+ "JSON",
222
+ "RDF",
223
+ ])),
224
+ syntheticNamePrefix: "$",
225
+ };
168
226
  })(Configuration = TsGenerator.Configuration || (TsGenerator.Configuration = {}));
169
227
  })(TsGenerator || (TsGenerator = {}));
170
228
  //# sourceMappingURL=TsGenerator.js.map
@@ -2,7 +2,7 @@ import { Maybe } from "purify-ts";
2
2
  import { invariant } from "ts-invariant";
3
3
  import { code, joinCode, literalOf } from "../ts-poet-wrapper.js";
4
4
  export function NamedObjectType_createFunctionDeclaration() {
5
- if (!this.configuration.features.has("create")) {
5
+ if (!this.configuration.features.has("Object.create")) {
6
6
  return Maybe.empty();
7
7
  }
8
8
  const parametersPropertySignatures = this.properties.flatMap((property) => property.constructorParameter.toList());
@@ -1,7 +1,7 @@
1
1
  import { Maybe } from "purify-ts";
2
2
  import { code, joinCode } from "../ts-poet-wrapper.js";
3
3
  export function NamedObjectType_equalsFunctionDeclaration() {
4
- if (!this.configuration.features.has("equals")) {
4
+ if (!this.configuration.features.has("Object.equals")) {
5
5
  return Maybe.empty();
6
6
  }
7
7
  const chain = [];
@@ -1,4 +1,5 @@
1
+ import { Maybe } from "purify-ts";
1
2
  import type { NamedObjectType } from "../NamedObjectType.js";
2
3
  import { type Code } from "../ts-poet-wrapper.js";
3
- export declare function NamedObjectType_filterFunctionDeclaration(this: NamedObjectType): Code;
4
+ export declare function NamedObjectType_filterFunctionDeclaration(this: NamedObjectType): Maybe<Code>;
4
5
  //# sourceMappingURL=NamedObjectType_filterFunctionDeclaration.d.ts.map
@@ -1,5 +1,9 @@
1
+ import { Maybe } from "purify-ts";
1
2
  import { code, joinCode } from "../ts-poet-wrapper.js";
2
3
  export function NamedObjectType_filterFunctionDeclaration() {
4
+ if (!this.configuration.features.has("Object.filter")) {
5
+ return Maybe.empty();
6
+ }
3
7
  const statements = [];
4
8
  for (const parentObjectType of this.parentObjectTypes) {
5
9
  statements.push(code `if (!${parentObjectType.filterFunction}(filter, value)) { return false; }`);
@@ -12,9 +16,9 @@ export function NamedObjectType_filterFunctionDeclaration() {
12
16
  }
13
17
  }
14
18
  statements.push(code `return true;`);
15
- return code `\
19
+ return Maybe.of(code `\
16
20
  export function filter(filter: ${this.filterType}, value: ${this.name}): boolean {
17
21
  ${joinCode(statements)}
18
- }`;
22
+ }`);
19
23
  }
20
24
  //# sourceMappingURL=NamedObjectType_filterFunctionDeclaration.js.map
@@ -1,4 +1,5 @@
1
+ import { Maybe } from "purify-ts";
1
2
  import type { NamedObjectType } from "../NamedObjectType.js";
2
3
  import { type Code } from "../ts-poet-wrapper.js";
3
- export declare function NamedObjectType_filterTypeDeclaration(this: NamedObjectType): Code;
4
+ export declare function NamedObjectType_filterTypeDeclaration(this: NamedObjectType): Maybe<Code>;
4
5
  //# sourceMappingURL=NamedObjectType_filterTypeDeclaration.d.ts.map
@@ -1,5 +1,9 @@
1
+ import { Maybe } from "purify-ts";
1
2
  import { code, joinCode } from "../ts-poet-wrapper.js";
2
3
  export function NamedObjectType_filterTypeDeclaration() {
4
+ if (!this.configuration.features.has("Object.filter")) {
5
+ return Maybe.empty();
6
+ }
3
7
  const members = [];
4
8
  if (this.properties.length > 0) {
5
9
  const filterProperties = {};
@@ -15,7 +19,7 @@ export function NamedObjectType_filterTypeDeclaration() {
15
19
  for (const parentObjectType of this.parentObjectTypes) {
16
20
  members.push(code `${parentObjectType.name}.Filter`);
17
21
  }
18
- return code `\
19
- export type Filter = ${members.length > 0 ? joinCode(members, { on: " & " }) : "object"};`;
22
+ return Maybe.of(code `\
23
+ export type Filter = ${members.length > 0 ? joinCode(members, { on: " & " }) : "object"};`);
20
24
  }
21
25
  //# sourceMappingURL=NamedObjectType_filterTypeDeclaration.js.map
@@ -7,7 +7,7 @@ const variables = {
7
7
  variablePrefix: code `parameters.variablePrefix`,
8
8
  };
9
9
  export function NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration() {
10
- if (!this.configuration.features.has("sparql")) {
10
+ if (!this.configuration.features.has("Object.SPARQL")) {
11
11
  return Maybe.empty();
12
12
  }
13
13
  const rdfClassVariable = code `${this.reusables.imports.dataFactory}.variable!(\`\${${variables.variablePrefix}}RdfClass\`)`;
@@ -8,7 +8,7 @@ const variables = {
8
8
  variablePrefix: code `parameters.variablePrefix`,
9
9
  };
10
10
  export function NamedObjectType_focusSparqlWherePatternsFunctionDeclaration() {
11
- if (!this.configuration.features.has("sparql")) {
11
+ if (!this.configuration.features.has("Object.SPARQL")) {
12
12
  return Maybe.empty();
13
13
  }
14
14
  const rdfClassVariable = code `${this.reusables.imports.dataFactory}.variable!(\`\${${variables.variablePrefix}}RdfClass\`)`;
@@ -1,7 +1,7 @@
1
1
  import { Maybe } from "purify-ts";
2
2
  import { code, joinCode } from "../ts-poet-wrapper.js";
3
3
  export function NamedObjectType_fromJsonFunctionDeclaration() {
4
- if (!this.configuration.features.has("json")) {
4
+ if (!this.configuration.features.has("Object.fromJson")) {
5
5
  return Maybe.empty();
6
6
  }
7
7
  const variables = {
@@ -2,7 +2,7 @@ import { rdf } from "@tpluscode/rdf-ns-builders";
2
2
  import { Maybe } from "purify-ts";
3
3
  import { code, joinCode } from "../ts-poet-wrapper.js";
4
4
  export function NamedObjectType_fromRdfResourceFunctionDeclaration() {
5
- if (!this.configuration.features.has("rdf")) {
5
+ if (!this.configuration.features.has("Object.fromRdf")) {
6
6
  return Maybe.empty();
7
7
  }
8
8
  const syntheticNamePrefix = this.configuration.syntheticNamePrefix;
@@ -1,7 +1,7 @@
1
1
  import { Maybe } from "purify-ts";
2
2
  import { code } from "../ts-poet-wrapper.js";
3
3
  export function NamedObjectType_fromRdfResourceValuesFunctionDeclaration() {
4
- if (!this.configuration.features.has("rdf")) {
4
+ if (!this.configuration.features.has("Object.fromRdf")) {
5
5
  return Maybe.empty();
6
6
  }
7
7
  return Maybe.of(code `\
@@ -1,7 +1,7 @@
1
1
  import { Maybe } from "purify-ts";
2
2
  import { code } from "../ts-poet-wrapper.js";
3
3
  export function NamedObjectType_fromRdfTypeVariableStatement() {
4
- if (!this.configuration.features.has("rdf")) {
4
+ if (!this.configuration.features.has("Object.fromRdf")) {
5
5
  return Maybe.empty();
6
6
  }
7
7
  return this.fromRdfType.map((fromRdfType) => code `\
@@ -1,7 +1,7 @@
1
1
  import { Maybe } from "purify-ts";
2
2
  import { code } from "../ts-poet-wrapper.js";
3
3
  export function NamedObjectType_graphqlTypeVariableStatement() {
4
- if (!this.configuration.features.has("graphql")) {
4
+ if (!this.configuration.features.has("GraphQL")) {
5
5
  return Maybe.empty();
6
6
  }
7
7
  if (this.synthetic) {
@@ -1,7 +1,7 @@
1
1
  import { code, joinCode } from "../ts-poet-wrapper.js";
2
2
  const hasherVariable = code `hasher`;
3
3
  export function NamedObjectType_hashFunctionDeclarations() {
4
- if (!this.configuration.features.has("hash")) {
4
+ if (!this.configuration.features.has("Object.hash")) {
5
5
  return [];
6
6
  }
7
7
  const hashOwnShaclPropertiesStatements = this.properties.flatMap((property) => property.kind === "ShaclProperty"
@@ -1,4 +1,5 @@
1
+ import { Maybe } from "purify-ts";
1
2
  import type { NamedObjectType } from "../NamedObjectType.js";
2
3
  import { type Code } from "../ts-poet-wrapper.js";
3
- export declare function NamedObjectType_isTypeFunctionDeclaration(this: NamedObjectType): Code;
4
+ export declare function NamedObjectType_isTypeFunctionDeclaration(this: NamedObjectType): Maybe<Code>;
4
5
  //# sourceMappingURL=NamedObjectType_isTypeFunctionDeclaration.d.ts.map
@@ -1,6 +1,10 @@
1
+ import { Maybe } from "purify-ts";
1
2
  import { code } from "../ts-poet-wrapper.js";
2
3
  export function NamedObjectType_isTypeFunctionDeclaration() {
3
- return code `\
4
+ if (!this.configuration.features.has("Object.type")) {
5
+ return Maybe.empty();
6
+ }
7
+ return Maybe.of(code `\
4
8
  export function is${this.name}(object: ${this.configuration.syntheticNamePrefix}Object): object is ${this.name} {
5
9
  switch (object.${this._discriminantProperty.name}) {
6
10
  ${this._discriminantProperty.type.descendantValues
@@ -8,6 +12,6 @@ export function is${this.name}(object: ${this.configuration.syntheticNamePrefix}
8
12
  .map((value) => `case "${value}":`)
9
13
  .join("\n")} return true; default: return false;
10
14
  }
11
- }`;
15
+ }`);
12
16
  }
13
17
  //# sourceMappingURL=NamedObjectType_isTypeFunctionDeclaration.js.map
@@ -1,7 +1,7 @@
1
1
  import { Maybe } from "purify-ts";
2
2
  import { code } from "../ts-poet-wrapper.js";
3
3
  export function NamedObjectType_jsonParseFunctionDeclaration() {
4
- if (!this.configuration.features.has("json")) {
4
+ if (!this.configuration.features.has("Object.JSON.parse")) {
5
5
  return Maybe.empty();
6
6
  }
7
7
  return Maybe.of(code `\
@@ -1,7 +1,7 @@
1
1
  import { Maybe } from "purify-ts";
2
2
  import { code, joinCode } from "../ts-poet-wrapper.js";
3
3
  export function NamedObjectType_jsonSchemaFunctionDeclaration() {
4
- if (!this.configuration.features.has("json")) {
4
+ if (!this.configuration.features.has("Object.JSON.schema")) {
5
5
  return Maybe.empty();
6
6
  }
7
7
  let properties = [];
@@ -1,7 +1,7 @@
1
1
  import { Maybe } from "purify-ts";
2
2
  import { code, joinCode } from "../ts-poet-wrapper.js";
3
3
  export function NamedObjectType_jsonTypeAliasDeclaration() {
4
- if (!this.configuration.features.has("json")) {
4
+ if (!this.configuration.features.has("Object.JSON.type")) {
5
5
  return Maybe.empty();
6
6
  }
7
7
  const members = [];
@@ -1,7 +1,7 @@
1
1
  import { Maybe } from "purify-ts";
2
2
  import { code, joinCode } from "../ts-poet-wrapper.js";
3
3
  export function NamedObjectType_jsonUiSchemaFunctionDeclaration() {
4
- if (!this.configuration.features.has("json")) {
4
+ if (!this.configuration.features.has("Object.JSON.uiSchema")) {
5
5
  return Maybe.empty();
6
6
  }
7
7
  const variables = { scopePrefix: code `scopePrefix` };
@@ -1,4 +1,5 @@
1
+ import { Maybe } from "purify-ts";
1
2
  import type { NamedObjectType } from "../NamedObjectType.js";
2
3
  import { type Code } from "../ts-poet-wrapper.js";
3
- export declare function NamedObjectType_schemaVariableStatement(this: NamedObjectType): Code;
4
+ export declare function NamedObjectType_schemaVariableStatement(this: NamedObjectType): Maybe<Code>;
4
5
  //# sourceMappingURL=NamedObjectType_schemaVariableStatement.d.ts.map
@@ -1,8 +1,12 @@
1
+ import { Maybe } from "purify-ts";
1
2
  import { code, joinCode } from "../ts-poet-wrapper.js";
2
3
  export function NamedObjectType_schemaVariableStatement() {
3
- return code `\
4
+ if (!this.configuration.features.has("Object.schema")) {
5
+ return Maybe.empty();
6
+ }
7
+ return Maybe.of(code `\
4
8
  export const schema = { properties: { ${joinCode(this.parentObjectTypes
5
9
  .map((parentObjectType) => code `...${parentObjectType.name}.schema.properties`)
6
- .concat(this.properties.map((property) => code `${property.name}: ${property.schema}`)), { on: ", " })} } } as const;`;
10
+ .concat(this.properties.map((property) => code `${property.name}: ${property.schema}`)), { on: ", " })} } } as const;`);
7
11
  }
8
12
  //# sourceMappingURL=NamedObjectType_schemaVariableStatement.js.map
@@ -2,7 +2,7 @@ import { camelCase } from "change-case";
2
2
  import { Maybe } from "purify-ts";
3
3
  import { code } from "../ts-poet-wrapper.js";
4
4
  export function NamedObjectType_sparqlConstructQueryFunctionDeclaration() {
5
- if (!this.configuration.features.has("sparql")) {
5
+ if (!this.configuration.features.has("Object.SPARQL")) {
6
6
  return Maybe.empty();
7
7
  }
8
8
  return Maybe.of(code `\
@@ -1,7 +1,7 @@
1
1
  import { Maybe } from "purify-ts";
2
2
  import { code } from "../ts-poet-wrapper.js";
3
3
  export function NamedObjectType_sparqlConstructQueryStringFunctionDeclaration() {
4
- if (!this.configuration.features.has("sparql")) {
4
+ if (!this.configuration.features.has("Object.SPARQL")) {
5
5
  return Maybe.empty();
6
6
  }
7
7
  return Maybe.of(code `\
@@ -1,7 +1,7 @@
1
1
  import { Maybe } from "purify-ts";
2
2
  import { code, joinCode } from "../ts-poet-wrapper.js";
3
3
  export function NamedObjectType_toJsonFunctionDeclaration() {
4
- if (!this.configuration.features.has("json")) {
4
+ if (!this.configuration.features.has("Object.toJson")) {
5
5
  return Maybe.empty();
6
6
  }
7
7
  const jsonObjectMembers = [];