@shaclmate/compiler 4.0.63 → 4.0.65

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 (25) hide show
  1. package/dist/generators/ts/LazyOptionType.js +16 -1
  2. package/dist/generators/ts/LazySetType.js +20 -1
  3. package/dist/generators/ts/LazyType.js +12 -1
  4. package/dist/generators/ts/ObjectDiscriminatedUnionType.d.ts +2 -0
  5. package/dist/generators/ts/ObjectDiscriminatedUnionType.js +12 -2
  6. package/dist/generators/ts/ObjectType.d.ts +1 -0
  7. package/dist/generators/ts/ObjectType.js +11 -3
  8. package/dist/generators/ts/TsGenerator.js +1 -1
  9. package/dist/generators/ts/_ObjectDiscriminatedUnionType/ObjectDiscriminatedUnionType_focusSparqlConstructTriplesFunctionDeclaration.js +1 -1
  10. package/dist/generators/ts/_ObjectDiscriminatedUnionType/ObjectDiscriminatedUnionType_focusSparqlWherePatternsFunctionDeclaration.js +1 -1
  11. package/dist/generators/ts/_ObjectDiscriminatedUnionType/ObjectDiscriminatedUnionType_typeGuardFunctionDeclaration.d.ts +4 -0
  12. package/dist/generators/ts/_ObjectDiscriminatedUnionType/{ObjectDiscriminatedUnionType_isTypeFunctionDeclaration.js → ObjectDiscriminatedUnionType_typeGuardFunctionDeclaration.js} +6 -3
  13. package/dist/generators/ts/_ObjectType/ObjectType_DiscriminantProperty.d.ts +2 -2
  14. package/dist/generators/ts/_ObjectType/ObjectType_DiscriminantProperty.js +6 -2
  15. package/dist/generators/ts/_ObjectType/ObjectType_typeGuardFunctionExpression.d.ts +5 -0
  16. package/dist/generators/ts/_ObjectType/ObjectType_typeGuardFunctionExpression.js +14 -0
  17. package/dist/generators/ts/_snippets/snippets_convertToLazy.js +22 -6
  18. package/dist/generators/ts/_snippets/snippets_convertToLazyOption.js +38 -24
  19. package/dist/generators/ts/_snippets/snippets_convertToLazySet.js +32 -19
  20. package/dist/input/input.shaclmate.d.ts +8 -8
  21. package/dist/input/input.shaclmate.js +11 -28
  22. package/package.json +6 -6
  23. package/dist/generators/ts/_ObjectDiscriminatedUnionType/ObjectDiscriminatedUnionType_isTypeFunctionDeclaration.d.ts +0 -4
  24. package/dist/generators/ts/_ObjectType/ObjectType_isTypeFunctionDeclaration.d.ts +0 -5
  25. package/dist/generators/ts/_ObjectType/ObjectType_isTypeFunctionDeclaration.js +0 -20
@@ -18,16 +18,31 @@ export class LazyOptionType extends Super {
18
18
  invariant(this.resolveType.jsTypes.length === 1);
19
19
  invariant(this.resolveType.itemType.jsTypes.length === 1);
20
20
  return Maybe.of({
21
- code: code `${this.reusables.snippets.convertToLazyOption}<${this.partialType.itemType.expression}, ${this.resolveType.itemType.expression}>(${this.resolveToPartialFunction({ partialType: this.partialType.itemType, resolveType: this.resolveType.itemType })})`,
21
+ code: code `\
22
+ ${this.reusables.snippets.convertToLazyOption}<
23
+ ${this.partialType.itemType.expression},
24
+ ${this.resolveType.itemType.expression},
25
+ >(
26
+ ${this.partialType.itemType.typeGuardFunction.unsafeCoerce()},
27
+ ${this.resolveToPartialFunction({ partialType: this.partialType.itemType, resolveType: this.resolveType.itemType })}
28
+ )`,
22
29
  sourceTypes: [
23
30
  {
24
31
  expression: this.expression,
25
32
  jsType: this.jsTypes[0],
26
33
  },
34
+ {
35
+ expression: this.partialType.expression,
36
+ jsType: this.partialType.jsTypes[0],
37
+ },
27
38
  {
28
39
  expression: this.resolveType.expression,
29
40
  jsType: this.resolveType.jsTypes[0],
30
41
  },
42
+ {
43
+ expression: this.partialType.itemType.expression,
44
+ jsType: this.resolveType.itemType.jsTypes[0],
45
+ },
31
46
  {
32
47
  expression: this.resolveType.itemType.expression,
33
48
  jsType: this.resolveType.itemType.jsTypes[0],
@@ -23,16 +23,35 @@ export class LazySetType extends AbstractLazyType {
23
23
  invariant(this.jsTypes.length === 1);
24
24
  invariant(this.resolveType.jsTypes.length === 1);
25
25
  return Maybe.of({
26
- code: code `${this.reusables.snippets.convertToLazySet}<${this.partialType.itemType.expression}, ${this.resolveType.itemType.expression}>(${this.resolveToPartialFunction({ partialType: this.partialType.itemType, resolveType: this.resolveType.itemType })})`,
26
+ code: code `\
27
+ ${this.reusables.snippets.convertToLazySet}<
28
+ ${this.partialType.itemType.expression},
29
+ ${this.resolveType.itemType.expression}
30
+ >(
31
+ ${this.partialType.itemType.typeGuardFunction.unsafeCoerce()},
32
+ ${this.resolveToPartialFunction({ partialType: this.partialType.itemType, resolveType: this.resolveType.itemType })}
33
+ )`,
27
34
  sourceTypes: [
28
35
  {
29
36
  expression: this.expression,
30
37
  jsType: this.jsTypes[0],
31
38
  },
39
+ {
40
+ expression: this.partialType.expression,
41
+ jsType: this.partialType.jsTypes[0],
42
+ },
32
43
  {
33
44
  expression: this.resolveType.expression,
34
45
  jsType: this.resolveType.jsTypes[0],
35
46
  },
47
+ {
48
+ expression: this.partialType.itemType.expression,
49
+ jsType: this.partialType.itemType.jsTypes[0],
50
+ },
51
+ {
52
+ expression: this.resolveType.itemType.expression,
53
+ jsType: this.resolveType.itemType.jsTypes[0],
54
+ },
36
55
  {
37
56
  expression: code `undefined`,
38
57
  jsType: { typeof: "undefined" },
@@ -16,12 +16,23 @@ export class LazyType extends AbstractLazyType {
16
16
  invariant(this.jsTypes.length === 1);
17
17
  invariant(this.resolveType.jsTypes.length === 1);
18
18
  return Maybe.of({
19
- code: code `${this.reusables.snippets.convertToLazy}<${this.partialType.expression}, ${this.resolveType.expression}>(${this.resolveToPartialFunction({ partialType: this.partialType, resolveType: this.resolveType })})`,
19
+ code: code `\
20
+ ${this.reusables.snippets.convertToLazy}<
21
+ ${this.partialType.expression},
22
+ ${this.resolveType.expression}
23
+ >(
24
+ ${this.partialType.typeGuardFunction.unsafeCoerce()},
25
+ ${this.resolveToPartialFunction({ partialType: this.partialType, resolveType: this.resolveType })}
26
+ )`,
20
27
  sourceTypes: [
21
28
  {
22
29
  expression: this.expression,
23
30
  jsType: this.jsTypes[0],
24
31
  },
32
+ {
33
+ expression: this.partialType.expression,
34
+ jsType: this.partialType.jsTypes[0],
35
+ },
25
36
  {
26
37
  expression: this.resolveType.expression,
27
38
  jsType: this.resolveType.jsTypes[0],
@@ -1,3 +1,4 @@
1
+ import { Maybe } from "purify-ts";
1
2
  import { DiscriminatedUnionType } from "./DiscriminatedUnionType.js";
2
3
  import type { ObjectType } from "./ObjectType.js";
3
4
  import { type Code } from "./ts-poet-wrapper.js";
@@ -7,6 +8,7 @@ export declare class ObjectDiscriminatedUnionType extends DiscriminatedUnionType
7
8
  get objectSetMethodNames(): ObjectType.ObjectSetMethodNames;
8
9
  get schema(): Code;
9
10
  get schemaType(): Code;
11
+ get typeGuardFunction(): Maybe<Code>;
10
12
  protected get staticModuleDeclarations(): Record<string, Code>;
11
13
  }
12
14
  //# sourceMappingURL=ObjectDiscriminatedUnionType.d.ts.map
@@ -4,15 +4,16 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
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
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
+ import { Maybe } from "purify-ts";
7
8
  import { Memoize } from "typescript-memoize";
8
9
  import { ObjectDiscriminatedUnionType_focusSparqlConstructTriplesFunctionDeclaration } from "./_ObjectDiscriminatedUnionType/ObjectDiscriminatedUnionType_focusSparqlConstructTriplesFunctionDeclaration.js";
9
10
  import { ObjectDiscriminatedUnionType_focusSparqlWherePatternsFunctionDeclaration } from "./_ObjectDiscriminatedUnionType/ObjectDiscriminatedUnionType_focusSparqlWherePatternsFunctionDeclaration.js";
10
11
  import { ObjectDiscriminatedUnionType_fromRdfResourceFunctionDeclaration } from "./_ObjectDiscriminatedUnionType/ObjectDiscriminatedUnionType_fromRdfResourceFunctionDeclaration.js";
11
12
  import { ObjectDiscriminatedUnionType_graphqlTypeVariableStatement } from "./_ObjectDiscriminatedUnionType/ObjectDiscriminatedUnionType_graphqlTypeVariableStatement.js";
12
13
  import { ObjectDiscriminatedUnionType_identifierTypeDeclarations } from "./_ObjectDiscriminatedUnionType/ObjectDiscriminatedUnionType_identifierTypeDeclarations.js";
13
- import { ObjectDiscriminatedUnionType_isTypeFunctionDeclaration } from "./_ObjectDiscriminatedUnionType/ObjectDiscriminatedUnionType_isTypeFunctionDeclaration.js";
14
14
  import { ObjectDiscriminatedUnionType_schemaVariableStatement } from "./_ObjectDiscriminatedUnionType/ObjectDiscriminatedUnionType_schemaVariableStatement.js";
15
15
  import { ObjectDiscriminatedUnionType_toRdfResourceFunctionDeclaration } from "./_ObjectDiscriminatedUnionType/ObjectDiscriminatedUnionType_toRdfResourceFunctionDeclaration.js";
16
+ import { ObjectDiscriminatedUnionType_typeGuardFunctionDeclaration } from "./_ObjectDiscriminatedUnionType/ObjectDiscriminatedUnionType_typeGuardFunctionDeclaration.js";
16
17
  import { ObjectType_objectSetMethodNames } from "./_ObjectType/ObjectType_objectSetMethodNames.js";
17
18
  import { ObjectType_sparqlConstructQueryFunctionDeclaration } from "./_ObjectType/ObjectType_sparqlConstructQueryFunctionDeclaration.js";
18
19
  import { ObjectType_sparqlConstructQueryStringFunctionDeclaration } from "./_ObjectType/ObjectType_sparqlConstructQueryStringFunctionDeclaration.js";
@@ -42,6 +43,12 @@ export class ObjectDiscriminatedUnionType extends DiscriminatedUnionType {
42
43
  .map(() => code `typeof ${this.schema}`)
43
44
  .orDefault(super.schemaType);
44
45
  }
46
+ get typeGuardFunction() {
47
+ if (Object.keys(ObjectDiscriminatedUnionType_typeGuardFunctionDeclaration.call(this)).length === 0) {
48
+ return Maybe.empty();
49
+ }
50
+ return this.name.map((name) => code `${name}.is${name}`);
51
+ }
45
52
  get staticModuleDeclarations() {
46
53
  const name = this.name.unsafeCoerce();
47
54
  return {
@@ -51,7 +58,7 @@ export class ObjectDiscriminatedUnionType extends DiscriminatedUnionType {
51
58
  ...ObjectDiscriminatedUnionType_focusSparqlWherePatternsFunctionDeclaration.call(this),
52
59
  ...ObjectDiscriminatedUnionType_fromRdfResourceFunctionDeclaration.call(this),
53
60
  ...ObjectDiscriminatedUnionType_graphqlTypeVariableStatement.call(this),
54
- ...ObjectDiscriminatedUnionType_isTypeFunctionDeclaration.call(this),
61
+ ...ObjectDiscriminatedUnionType_typeGuardFunctionDeclaration.call(this),
55
62
  ...ObjectDiscriminatedUnionType_schemaVariableStatement.call(this),
56
63
  ...(this.configuration.features.has("Object.SPARQL")
57
64
  ? {
@@ -85,4 +92,7 @@ __decorate([
85
92
  __decorate([
86
93
  Memoize()
87
94
  ], ObjectDiscriminatedUnionType.prototype, "schemaType", null);
95
+ __decorate([
96
+ Memoize()
97
+ ], ObjectDiscriminatedUnionType.prototype, "typeGuardFunction", null);
88
98
  //# sourceMappingURL=ObjectDiscriminatedUnionType.js.map
@@ -56,6 +56,7 @@ export declare class ObjectType extends AbstractType {
56
56
  get schemaType(): Code;
57
57
  get toRdfResourceValueTypes(): AbstractType["toRdfResourceValueTypes"];
58
58
  get toRdfjsResourceType(): Code;
59
+ get typeGuardFunction(): Maybe<Code>;
59
60
  get valueSparqlConstructTriplesFunction(): Code;
60
61
  get valueSparqlWherePatternsFunction(): Code;
61
62
  protected get constructorParameters(): {
@@ -22,7 +22,6 @@ import { ObjectType_graphqlTypeExpression } from "./_ObjectType/ObjectType_graph
22
22
  import { ObjectType_hashFunctionExpression } from "./_ObjectType/ObjectType_hashFunctionExpression.js";
23
23
  import { ObjectType_IdentifierProperty } from "./_ObjectType/ObjectType_IdentifierProperty.js";
24
24
  import { ObjectType_identifierTypeDeclarations } from "./_ObjectType/ObjectType_identifierTypeDeclarations.js";
25
- import { ObjectType_isTypeFunctionDeclaration } from "./_ObjectType/ObjectType_isTypeFunctionDeclaration.js";
26
25
  import { ObjectType_jsonParseFunctionDeclaration } from "./_ObjectType/ObjectType_jsonParseFunctionDeclaration.js";
27
26
  import { ObjectType_jsonSchemaExpression } from "./_ObjectType/ObjectType_jsonSchemaExpression.js";
28
27
  import { ObjectType_jsonTypeExpression } from "./_ObjectType/ObjectType_jsonTypeExpression.js";
@@ -37,6 +36,7 @@ import { ObjectType_toJsonFunctionExpression } from "./_ObjectType/ObjectType_to
37
36
  import { ObjectType_toRdfResourceFunctionExpression } from "./_ObjectType/ObjectType_toRdfResourceFunctionExpression.js";
38
37
  import { ObjectType_toStringFunctionExpression } from "./_ObjectType/ObjectType_toStringFunctionExpression.js";
39
38
  import { ObjectType_toStringRecordFunctionExpression } from "./_ObjectType/ObjectType_toStringRecordFunctionExpression.js";
39
+ import { ObjectType_typeGuardFunctionExpression } from "./_ObjectType/ObjectType_typeGuardFunctionExpression.js";
40
40
  import { ObjectType_valueSparqlConstructTriplesFunctionExpression } from "./_ObjectType/ObjectType_valueSparqlConstructTriplesFunctionExpression.js";
41
41
  import { ObjectType_valueSparqlWherePatternsFunctionExpression } from "./_ObjectType/ObjectType_valueSparqlWherePatternsFunctionExpression.js";
42
42
  import { AbstractType } from "./AbstractType.js";
@@ -140,8 +140,10 @@ export class ObjectType extends AbstractType {
140
140
  if (this.configuration.features.has("Object.type")) {
141
141
  staticModuleDeclarations = staticModuleDeclarations.concat(ObjectType_identifierTypeDeclarations.call(this));
142
142
  }
143
- // isType
144
- staticModuleDeclarations = staticModuleDeclarations.concat(ObjectType_isTypeFunctionDeclaration.call(this).toList());
143
+ // Type guard
144
+ ObjectType_typeGuardFunctionExpression.call(this).ifJust((typeGuardFunctionExpression) => {
145
+ staticModuleDeclarations.push(code `export const is${name} = ${typeGuardFunctionExpression};`);
146
+ });
145
147
  // type Json
146
148
  if (this.configuration.features.has("Object.JSON.type")) {
147
149
  staticModuleDeclarations.push(code `export type Json = ${ObjectType_jsonTypeExpression.call(this)}`);
@@ -293,6 +295,9 @@ ${joinCode(staticModuleDeclarations, { on: "\n\n" })}
293
295
  get toRdfjsResourceType() {
294
296
  return code `${this.reusables.imports.Resource}${this.identifierType.kind === "Iri" ? code `<${this.reusables.imports.NamedNode}>` : ""}`;
295
297
  }
298
+ get typeGuardFunction() {
299
+ return ObjectType_typeGuardFunctionExpression.call(this).map((expression) => this.name.map((name) => code `${name}.is${name}`).orDefault(expression));
300
+ }
296
301
  get valueSparqlConstructTriplesFunction() {
297
302
  return this.name
298
303
  .map((name) => code `${name}.valueSparqlConstructTriples`)
@@ -468,6 +473,9 @@ __decorate([
468
473
  __decorate([
469
474
  Memoize()
470
475
  ], ObjectType.prototype, "toRdfjsResourceType", null);
476
+ __decorate([
477
+ Memoize()
478
+ ], ObjectType.prototype, "typeGuardFunction", null);
471
479
  __decorate([
472
480
  Memoize()
473
481
  ], ObjectType.prototype, "valueSparqlConstructTriplesFunction", null);
@@ -142,7 +142,7 @@ export class TsGenerator {
142
142
  * Synthesize the $Object union.
143
143
  */
144
144
  synthesizeUberObjectDiscriminatedUnionType({ configuration, namedObjectTypes, reusables, }) {
145
- const filteredNamedObjectTypes = namedObjectTypes.filter((namedObjectType) => !namedObjectType.extern && !namedObjectType.synthetic);
145
+ const filteredNamedObjectTypes = namedObjectTypes.filter((namedObjectType) => !namedObjectType.extern);
146
146
  invariant(filteredNamedObjectTypes.length > 0);
147
147
  const nodeKinds = filteredNamedObjectTypes.reduce((nodeKinds, namedObjectType) => {
148
148
  for (const nodeKind of namedObjectType.identifierType.nodeKinds) {
@@ -7,7 +7,7 @@ export function ObjectDiscriminatedUnionType_focusSparqlConstructTriplesFunction
7
7
  }
8
8
  return singleEntryRecord(`focusSparqlConstructTriples`, code `\
9
9
  export function focusSparqlConstructTriples({ filter, focusIdentifier, variablePrefix }: { filter: ${this.filterType} | undefined; focusIdentifier: ${this.reusables.imports.NamedNode} | ${this.reusables.imports.Variable}; ignoreRdfType: boolean; variablePrefix: string }): readonly ${this.reusables.imports.sparqljs}.Triple[] {
10
- return [${joinCode(this.members.map((member) => code `...${member.type.name.unsafeCoerce()}.focusSparqlConstructTriples({ filter: filter?.on?.${member.type.name.unsafeCoerce()}, focusIdentifier, ignoreRdfType: false, variablePrefix: \`\${variablePrefix}${pascalCase(member.type.name.unsafeCoerce())}\` }).concat()`), { on: ", " })}];
10
+ return [${joinCode(this.members.map((member) => code `...${member.type.name.unsafeCoerce()}.focusSparqlConstructTriples({ filter: filter?.on?.${member.primaryDiscriminantValue}, focusIdentifier, ignoreRdfType: false, variablePrefix: \`\${variablePrefix}${pascalCase(member.type.name.unsafeCoerce())}\` }).concat()`), { on: ", " })}];
11
11
  }`);
12
12
  }
13
13
  //# sourceMappingURL=ObjectDiscriminatedUnionType_focusSparqlConstructTriplesFunctionDeclaration.js.map
@@ -22,7 +22,7 @@ if (focusIdentifier.termType === "Variable") {
22
22
  }));
23
23
  }`,
24
24
  code `patterns.push({ patterns: [${joinCode(this.members.map((member) => code `${{
25
- patterns: code `${member.type.name.unsafeCoerce()}.focusSparqlWherePatterns({ filter: filter?.on?.${member.type.name.unsafeCoerce()}, focusIdentifier, ignoreRdfType: false, preferredLanguages, variablePrefix: \`\${variablePrefix}${pascalCase(member.type.name.unsafeCoerce())}\` }).concat()`,
25
+ patterns: code `${member.type.name.unsafeCoerce()}.focusSparqlWherePatterns({ filter: filter?.on?.${member.primaryDiscriminantValue}, focusIdentifier, ignoreRdfType: false, preferredLanguages, variablePrefix: \`\${variablePrefix}${pascalCase(member.type.name.unsafeCoerce())}\` }).concat()`,
26
26
  type: literalOf("group"),
27
27
  }}`), { on: ", " })}], type: "union" });`,
28
28
  code `return patterns;`,
@@ -0,0 +1,4 @@
1
+ import type { ObjectDiscriminatedUnionType } from "../ObjectDiscriminatedUnionType.js";
2
+ import { type Code } from "../ts-poet-wrapper.js";
3
+ export declare function ObjectDiscriminatedUnionType_typeGuardFunctionDeclaration(this: ObjectDiscriminatedUnionType): Record<string, Code>;
4
+ //# sourceMappingURL=ObjectDiscriminatedUnionType_typeGuardFunctionDeclaration.d.ts.map
@@ -1,10 +1,13 @@
1
1
  import { singleEntryRecord } from "../singleEntryRecord.js";
2
2
  import { code, joinCode } from "../ts-poet-wrapper.js";
3
- export function ObjectDiscriminatedUnionType_isTypeFunctionDeclaration() {
3
+ export function ObjectDiscriminatedUnionType_typeGuardFunctionDeclaration() {
4
4
  if (!this.configuration.features.has("Object.type")) {
5
5
  return {};
6
6
  }
7
- const name = this.name.unsafeCoerce();
7
+ const name = this.name.extract();
8
+ if (!name) {
9
+ return {};
10
+ }
8
11
  if (name === `${this.configuration.syntheticNamePrefix}Object`) {
9
12
  return {};
10
13
  }
@@ -13,4 +16,4 @@ export function ObjectDiscriminatedUnionType_isTypeFunctionDeclaration() {
13
16
  return ${joinCode(this.members.map((member) => code `${member.type.name.unsafeCoerce()}.is${member.type.name.unsafeCoerce()}(object)`), { on: " || " })};
14
17
  }`);
15
18
  }
16
- //# sourceMappingURL=ObjectDiscriminatedUnionType_isTypeFunctionDeclaration.js.map
19
+ //# sourceMappingURL=ObjectDiscriminatedUnionType_typeGuardFunctionDeclaration.js.map
@@ -10,8 +10,6 @@ export declare class ObjectType_DiscriminantProperty extends ObjectType_Abstract
10
10
  readonly kind = "Discriminant";
11
11
  readonly mutable = false;
12
12
  readonly recursive = false;
13
- readonly schema: Maybe<Code>;
14
- readonly schemaType: Maybe<Code>;
15
13
  readonly value: string;
16
14
  constructor({ configuration, value, ...superParameters }: {
17
15
  value: string;
@@ -19,6 +17,8 @@ export declare class ObjectType_DiscriminantProperty extends ObjectType_Abstract
19
17
  get jsonName(): string;
20
18
  get jsonSchema(): ObjectType_AbstractProperty<ObjectType_DiscriminantProperty.Type>["jsonSchema"];
21
19
  get jsonSignature(): Maybe<Code>;
20
+ get schema(): Maybe<Code>;
21
+ get schemaType(): Maybe<Code>;
22
22
  get values(): readonly string[];
23
23
  private get constValue();
24
24
  constructorInitializer(): Maybe<Code>;
@@ -17,8 +17,6 @@ export class ObjectType_DiscriminantProperty extends ObjectType_AbstractProperty
17
17
  kind = "Discriminant";
18
18
  mutable = false;
19
19
  recursive = false;
20
- schema = Maybe.empty();
21
- schemaType = Maybe.empty();
22
20
  value;
23
21
  constructor({ configuration, value, ...superParameters }) {
24
22
  super({
@@ -41,6 +39,12 @@ export class ObjectType_DiscriminantProperty extends ObjectType_AbstractProperty
41
39
  get jsonSignature() {
42
40
  return Maybe.of(code `readonly "${this.jsonName}": ${this.type.expression}`);
43
41
  }
42
+ get schema() {
43
+ return Maybe.of(code `${{ kind: this.kind, value: this.value }}`);
44
+ }
45
+ get schemaType() {
46
+ return Maybe.of(code `${{ kind: this.kind, value: this.value }}`);
47
+ }
44
48
  get values() {
45
49
  return [this.value];
46
50
  }
@@ -0,0 +1,5 @@
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_typeGuardFunctionExpression(this: ObjectType): Maybe<Code>;
5
+ //# sourceMappingURL=ObjectType_typeGuardFunctionExpression.d.ts.map
@@ -0,0 +1,14 @@
1
+ import { Maybe } from "purify-ts";
2
+ import { code, literalOf } from "../ts-poet-wrapper.js";
3
+ export function ObjectType_typeGuardFunctionExpression() {
4
+ if (!this.configuration.features.has("Object.type")) {
5
+ return Maybe.empty();
6
+ }
7
+ const discriminantProperty = this.discriminantProperty.extract();
8
+ if (!discriminantProperty) {
9
+ return Maybe.empty();
10
+ }
11
+ return Maybe.of(code `\
12
+ (object: ${this.configuration.syntheticNamePrefix}Object): object is ${this.expression} => object.${discriminantProperty.name} === ${literalOf(discriminantProperty.value)}`);
13
+ }
14
+ //# sourceMappingURL=ObjectType_typeGuardFunctionExpression.js.map
@@ -1,15 +1,31 @@
1
1
  import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
2
  export const snippets_convertToLazy = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}convertToLazy`, code `\
3
- function ${syntheticNamePrefix}convertToLazy<PartialT, ResolvedT>(resolvedToPartial: (resolved: ResolvedT) => PartialT) {
4
- return (value: ${snippets.Lazy}<PartialT, ResolvedT> | ResolvedT): ${imports.Either}<Error, ${snippets.Lazy}<PartialT, ResolvedT>> => {
3
+ function ${syntheticNamePrefix}convertToLazy<PartialT, ResolvedT>(
4
+ isPartial: (object: PartialT | ResolvedT) => object is PartialT,
5
+ resolvedToPartial: (resolved: ResolvedT) => PartialT
6
+ ) {
7
+ return (value: ${snippets.Lazy}<PartialT, ResolvedT> | PartialT | ResolvedT): ${imports.Either}<Error, ${snippets.Lazy}<PartialT, ResolvedT>> => {
5
8
  if (value instanceof ${snippets.Lazy}) {
6
9
  return ${imports.Either}.of(value);
7
10
  }
8
11
 
9
- return ${imports.Either}.of(new ${snippets.Lazy}({
10
- partial: resolvedToPartial(value),
11
- resolver: async () => ${imports.Right}(value)
12
- }));
12
+ if (isPartial(value)) {
13
+ const partial: PartialT = value;
14
+ return ${imports.Either}.of(
15
+ new ${snippets.Lazy}({
16
+ partial,
17
+ resolver: async () => ${imports.Left}(new Error("unable to resolve"))
18
+ })
19
+ );
20
+ }
21
+
22
+ const resolved: ResolvedT = value;
23
+ return ${imports.Either}.of(
24
+ new ${snippets.Lazy}({
25
+ partial: resolvedToPartial(resolved),
26
+ resolver: async () => ${imports.Right}(resolved)
27
+ })
28
+ );
13
29
  };
14
30
  }`);
15
31
  //# sourceMappingURL=snippets_convertToLazy.js.map
@@ -1,33 +1,47 @@
1
1
  import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
2
  export const snippets_convertToLazyOption = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}convertToLazyOption`, code `\
3
- function ${syntheticNamePrefix}convertToLazyOption<PartialT, ResolvedT>(resolvedToPartial: (resolved: ResolvedT) => PartialT) {
4
- return (value: ${snippets.LazyOption}<PartialT, ResolvedT> | ${imports.Maybe}<ResolvedT> | ResolvedT | undefined): ${imports.Either}<Error, ${snippets.LazyOption}<PartialT, ResolvedT>> => {
5
- switch (typeof value) {
6
- case "object": {
7
- if (value instanceof ${snippets.LazyOption}) {
8
- return ${imports.Either}.of(value);
9
- }
3
+ function ${syntheticNamePrefix}convertToLazyOption<PartialT, ResolvedT>(
4
+ isPartial: (object: PartialT | ResolvedT) => object is PartialT,
5
+ resolvedToPartial: (resolved: ResolvedT) => PartialT
6
+ ) {
7
+ return (value: ${snippets.LazyOption}<PartialT, ResolvedT> | ${imports.Maybe}<PartialT> | ${imports.Maybe}<ResolvedT> | PartialT | ResolvedT | undefined): ${imports.Either}<Error, ${snippets.LazyOption}<PartialT, ResolvedT>> => {
8
+ if (value instanceof ${snippets.LazyOption}) {
9
+ return ${imports.Either}.of(value);
10
+ }
11
+
12
+ let extractedValue: PartialT | ResolvedT | undefined;
13
+ if (typeof value === "undefined") {
14
+ extractedValue = value;
15
+ } else if (${imports.Maybe}.isMaybe(value)) {
16
+ extractedValue = value.extract();
17
+ } else {
18
+ extractedValue = value;
19
+ }
10
20
 
11
- if (${imports.Maybe}.isMaybe(value)) {
12
- return ${imports.Either}.of(new ${snippets.LazyOption}<PartialT, ResolvedT>({
13
- partial: value.map(resolvedToPartial),
14
- resolver: async () => ${imports.Right}(value.unsafeCoerce())
15
- }));
16
- }
21
+ if (typeof extractedValue === "undefined") {
22
+ return ${imports.Either}.of(new ${snippets.LazyOption}<PartialT, ResolvedT>({
23
+ partial: ${imports.Maybe}.empty(),
24
+ resolver: async () => { throw new Error("should never be called"); }
25
+ }));
26
+ }
17
27
 
18
- break;
19
- }
20
- case "undefined":
21
- return ${imports.Either}.of(new ${snippets.LazyOption}<PartialT, ResolvedT>({
22
- partial: ${imports.Maybe}.empty(),
23
- resolver: async () => { throw new Error("should never be called"); }
24
- }));
28
+ if (isPartial(extractedValue)) {
29
+ const partial: PartialT = extractedValue;
30
+ return ${imports.Either}.of(
31
+ new ${snippets.LazyOption}({
32
+ partial: ${imports.Maybe}.of(partial),
33
+ resolver: async () => ${imports.Left}(new Error("unable to resolve"))
34
+ })
35
+ );
25
36
  }
26
37
 
27
- return ${imports.Either}.of(new ${snippets.LazyOption}<PartialT, ResolvedT>({
28
- partial: ${imports.Maybe}.of(resolvedToPartial(value)),
29
- resolver: async () => ${imports.Right}(value)
30
- }));
38
+ const resolved: ResolvedT = extractedValue;
39
+ return ${imports.Either}.of(
40
+ new ${snippets.LazyOption}({
41
+ partial: ${imports.Maybe}.of(resolvedToPartial(resolved)),
42
+ resolver: async () => ${imports.Right}(resolved)
43
+ })
44
+ );
31
45
  };
32
46
  }`);
33
47
  //# sourceMappingURL=snippets_convertToLazyOption.js.map
@@ -1,27 +1,40 @@
1
1
  import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
2
  export const snippets_convertToLazySet = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}convertToLazySet`, code `\
3
- function ${syntheticNamePrefix}convertToLazySet<PartialT, ResolvedT>(resolvedToPartial: (resolved: ResolvedT) => PartialT) {
4
- return (value: ${snippets.LazySet}<PartialT, ResolvedT> | readonly ResolvedT[] | undefined): ${imports.Either}<Error, ${snippets.LazySet}<PartialT, ResolvedT>> => {
5
- switch (typeof value) {
6
- case "object": {
7
- if (value instanceof ${snippets.LazySet}) {
8
- return ${imports.Either}.of(value);
9
- }
3
+ function ${syntheticNamePrefix}convertToLazySet<PartialT, ResolvedT>(
4
+ isPartial: (object: PartialT | ResolvedT) => object is PartialT,
5
+ resolvedToPartial: (resolved: ResolvedT) => PartialT
6
+ ) {
7
+ return (value: ${snippets.LazySet}<PartialT, ResolvedT> | readonly PartialT[] | readonly ResolvedT[] | PartialT | ResolvedT | undefined): ${imports.Either}<Error, ${snippets.LazySet}<PartialT, ResolvedT>> => {
8
+ if (typeof value === "undefined") {
9
+ return ${imports.Either}.of(new ${snippets.LazySet}<PartialT, ResolvedT>({
10
+ partials: [],
11
+ resolver: async () => ${imports.Right}([])
12
+ }));
13
+ }
14
+
15
+ if (value instanceof ${snippets.LazySet}) {
16
+ return ${imports.Either}.of(value);
17
+ }
18
+
19
+ const arrayValue = (Array.isArray(value) ? value : [value]) as readonly PartialT[] | readonly ResolvedT[];
10
20
 
11
- break;
12
- }
13
- case "undefined":
14
- return ${imports.Either}.of(new ${snippets.LazySet}<PartialT, ResolvedT>({
15
- partials: [],
16
- resolver: async () => ${imports.Right}([])
17
- }));
21
+ if (arrayValue.every(isPartial)) {
22
+ const partials: readonly PartialT[] = arrayValue;
23
+ return ${imports.Either}.of(
24
+ new ${snippets.LazySet}<PartialT, ResolvedT>({
25
+ partials,
26
+ resolver: async () => ${imports.Left}(new Error("unable to resolve"))
27
+ })
28
+ );
18
29
  }
19
30
 
20
- const captureValue = value;
21
- return ${imports.Either}.of(new ${snippets.LazySet}<PartialT, ResolvedT>({
22
- partials: value.map(resolvedToPartial),
23
- resolver: async () => ${imports.Right}(captureValue)
24
- }));
31
+ const resolved: readonly ResolvedT[] = arrayValue;
32
+ return ${imports.Either}.of(
33
+ new ${snippets.LazySet}<PartialT, ResolvedT>({
34
+ partials: resolved.map(resolvedToPartial),
35
+ resolver: async () => ${imports.Right}(resolved)
36
+ })
37
+ );
25
38
  };
26
39
  }`);
27
40
  //# sourceMappingURL=snippets_convertToLazySet.js.map
@@ -246,7 +246,7 @@ export declare namespace NodeShape {
246
246
  const parse: (value: string) => Either<Error, import("@rdfx/string/dist/Identifier.js").Identifier>;
247
247
  const stringify: typeof NTriplesTerm.stringify;
248
248
  }
249
- function isNodeShape(object: $Object): object is NodeShape;
249
+ const isNodeShape: (object: $Object) => object is NodeShape;
250
250
  const schema: {
251
251
  readonly fromRdfType: import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#NodeShape">;
252
252
  readonly properties: {
@@ -744,7 +744,7 @@ export declare namespace Ontology {
744
744
  const parse: (value: string) => Either<Error, import("@rdfx/string/dist/Identifier.js").Identifier>;
745
745
  const stringify: typeof NTriplesTerm.stringify;
746
746
  }
747
- function isOntology(object: $Object): object is Ontology;
747
+ const isOntology: (object: $Object) => object is Ontology;
748
748
  const schema: {
749
749
  readonly fromRdfType: import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/2002/07/owl#Ontology">;
750
750
  readonly properties: {
@@ -808,7 +808,7 @@ export declare namespace PropertyGroup {
808
808
  const parse: (value: string) => Either<Error, import("@rdfx/string/dist/Identifier.js").Identifier>;
809
809
  const stringify: typeof NTriplesTerm.stringify;
810
810
  }
811
- function isPropertyGroup(object: $Object): object is PropertyGroup;
811
+ const isPropertyGroup: (object: $Object) => object is PropertyGroup;
812
812
  const schema: {
813
813
  readonly fromRdfType: import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#PropertyGroup">;
814
814
  readonly properties: {
@@ -1025,7 +1025,7 @@ export declare namespace PropertyShape {
1025
1025
  const parse: (value: string) => Either<Error, import("@rdfx/string/dist/Identifier.js").Identifier>;
1026
1026
  const stringify: typeof NTriplesTerm.stringify;
1027
1027
  }
1028
- function isPropertyShape(object: $Object): object is PropertyShape;
1028
+ const isPropertyShape: (object: $Object) => object is PropertyShape;
1029
1029
  const schema: {
1030
1030
  readonly fromRdfType: import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#PropertyShape">;
1031
1031
  readonly properties: {
@@ -1601,7 +1601,7 @@ export declare namespace ValidationReport {
1601
1601
  const parse: (value: string) => Either<Error, import("@rdfx/string/dist/Identifier.js").Identifier>;
1602
1602
  const stringify: typeof NTriplesTerm.stringify;
1603
1603
  }
1604
- function isValidationReport(object: $Object): object is ValidationReport;
1604
+ const isValidationReport: (object: $Object) => object is ValidationReport;
1605
1605
  const schema: {
1606
1606
  readonly fromRdfType: import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#ValidationReport">;
1607
1607
  readonly properties: {
@@ -1772,7 +1772,7 @@ export declare namespace ValidationResult {
1772
1772
  const parse: (value: string) => Either<Error, import("@rdfx/string/dist/Identifier.js").Identifier>;
1773
1773
  const stringify: typeof NTriplesTerm.stringify;
1774
1774
  }
1775
- function isValidationResult(object: $Object): object is ValidationResult;
1775
+ const isValidationResult: (object: $Object) => object is ValidationResult;
1776
1776
  const schema: {
1777
1777
  readonly fromRdfType: import("@rdfx/data-factory/dist/NamedNode.js").NamedNode<"http://www.w3.org/ns/shacl#ValidationResult">;
1778
1778
  readonly properties: {
@@ -1876,7 +1876,7 @@ export declare namespace Shape {
1876
1876
  }
1877
1877
  function isShape(object: $Object): object is Shape;
1878
1878
  const schema: {
1879
- readonly kind: "ObjectUnion";
1879
+ readonly kind: "ObjectDiscriminatedUnion";
1880
1880
  readonly members: {
1881
1881
  readonly NodeShape: {
1882
1882
  readonly discriminantValues: readonly ["NodeShape"];
@@ -3255,7 +3255,7 @@ export declare namespace $Object {
3255
3255
  const stringify: typeof NTriplesTerm.stringify;
3256
3256
  }
3257
3257
  const schema: {
3258
- readonly kind: "ObjectUnion";
3258
+ readonly kind: "ObjectDiscriminatedUnion";
3259
3259
  readonly members: {
3260
3260
  readonly NodeShape: {
3261
3261
  readonly discriminantValues: readonly ["NodeShape"];
@@ -178,7 +178,7 @@ function $listFromRdfResourceValues(itemFromRdfResourceValues) {
178
178
  }
179
179
  const $literalFactory = new LiteralFactory({ dataFactory: dataFactory });
180
180
  function $literalFromRdfResourceValues(values, options) {
181
- return $termLikeFromRdfResourceValues(values, options).chain((values) => values.chainMap((value) => value.toLiteral()));
181
+ return $termLikeFromRdfResourceValues(values, options).chain((values) => values.chainMap((value) => value.toLiteral(options.schema.in)));
182
182
  }
183
183
  function $maybeFromRdfResourceValues(itemFromRdfResourceValues) {
184
184
  return (values, options) => itemFromRdfResourceValues(values, {
@@ -234,6 +234,7 @@ var $RdfVocabularies;
234
234
  (function ($RdfVocabularies) {
235
235
  $RdfVocabularies.rdf = {
236
236
  first: dataFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#first"),
237
+ langString: dataFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),
237
238
  nil: dataFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"),
238
239
  rest: dataFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#rest"),
239
240
  subject: dataFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#subject"),
@@ -324,7 +325,7 @@ function $termFromRdfResourceValues(values, options) {
324
325
  if (!schema.types.some((type) => term.termType === type)) {
325
326
  return Left(new Resource.MistypedValueError({
326
327
  actualValue: term,
327
- expectedValueType: "Term types",
328
+ expectedValueType: "BlankNode | Literal | NamedNode",
328
329
  focusResource,
329
330
  propertyPath,
330
331
  }));
@@ -801,10 +802,7 @@ export var NodeShape;
801
802
  Identifier.parse = $parseIdentifier;
802
803
  Identifier.stringify = NTriplesTerm.stringify;
803
804
  })(Identifier = NodeShape.Identifier || (NodeShape.Identifier = {}));
804
- function isNodeShape(object) {
805
- return object.$type === "NodeShape";
806
- }
807
- NodeShape.isNodeShape = isNodeShape;
805
+ NodeShape.isNodeShape = (object) => object.$type === "NodeShape";
808
806
  NodeShape.schema = {
809
807
  fromRdfType: dataFactory.namedNode("http://www.w3.org/ns/shacl#NodeShape"),
810
808
  properties: {
@@ -1446,10 +1444,7 @@ export var Ontology;
1446
1444
  Identifier.parse = $parseIdentifier;
1447
1445
  Identifier.stringify = NTriplesTerm.stringify;
1448
1446
  })(Identifier = Ontology.Identifier || (Ontology.Identifier = {}));
1449
- function isOntology(object) {
1450
- return object.$type === "Ontology";
1451
- }
1452
- Ontology.isOntology = isOntology;
1447
+ Ontology.isOntology = (object) => object.$type === "Ontology";
1453
1448
  Ontology.schema = {
1454
1449
  fromRdfType: dataFactory.namedNode("http://www.w3.org/2002/07/owl#Ontology"),
1455
1450
  properties: {
@@ -1545,10 +1540,7 @@ export var PropertyGroup;
1545
1540
  Identifier.parse = $parseIdentifier;
1546
1541
  Identifier.stringify = NTriplesTerm.stringify;
1547
1542
  })(Identifier = PropertyGroup.Identifier || (PropertyGroup.Identifier = {}));
1548
- function isPropertyGroup(object) {
1549
- return object.$type === "PropertyGroup";
1550
- }
1551
- PropertyGroup.isPropertyGroup = isPropertyGroup;
1543
+ PropertyGroup.isPropertyGroup = (object) => object.$type === "PropertyGroup";
1552
1544
  PropertyGroup.schema = {
1553
1545
  fromRdfType: dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyGroup"),
1554
1546
  properties: {
@@ -2036,10 +2028,7 @@ export var PropertyShape;
2036
2028
  Identifier.parse = $parseIdentifier;
2037
2029
  Identifier.stringify = NTriplesTerm.stringify;
2038
2030
  })(Identifier = PropertyShape.Identifier || (PropertyShape.Identifier = {}));
2039
- function isPropertyShape(object) {
2040
- return object.$type === "PropertyShape";
2041
- }
2042
- PropertyShape.isPropertyShape = isPropertyShape;
2031
+ PropertyShape.isPropertyShape = (object) => object.$type === "PropertyShape";
2043
2032
  PropertyShape.schema = {
2044
2033
  fromRdfType: dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyShape"),
2045
2034
  properties: {
@@ -2774,10 +2763,7 @@ export var ValidationReport;
2774
2763
  Identifier.parse = $parseIdentifier;
2775
2764
  Identifier.stringify = NTriplesTerm.stringify;
2776
2765
  })(Identifier = ValidationReport.Identifier || (ValidationReport.Identifier = {}));
2777
- function isValidationReport(object) {
2778
- return object.$type === "ValidationReport";
2779
- }
2780
- ValidationReport.isValidationReport = isValidationReport;
2766
+ ValidationReport.isValidationReport = (object) => object.$type === "ValidationReport";
2781
2767
  ValidationReport.schema = {
2782
2768
  fromRdfType: dataFactory.namedNode("http://www.w3.org/ns/shacl#ValidationReport"),
2783
2769
  properties: {
@@ -2936,10 +2922,7 @@ export var ValidationResult;
2936
2922
  Identifier.parse = $parseIdentifier;
2937
2923
  Identifier.stringify = NTriplesTerm.stringify;
2938
2924
  })(Identifier = ValidationResult.Identifier || (ValidationResult.Identifier = {}));
2939
- function isValidationResult(object) {
2940
- return object.$type === "ValidationResult";
2941
- }
2942
- ValidationResult.isValidationResult = isValidationResult;
2925
+ ValidationResult.isValidationResult = (object) => object.$type === "ValidationResult";
2943
2926
  ValidationResult.schema = {
2944
2927
  fromRdfType: dataFactory.namedNode("http://www.w3.org/ns/shacl#ValidationResult"),
2945
2928
  properties: {
@@ -3094,7 +3077,7 @@ export var Shape;
3094
3077
  }
3095
3078
  Shape.isShape = isShape;
3096
3079
  Shape.schema = {
3097
- kind: "ObjectUnion",
3080
+ kind: "ObjectDiscriminatedUnion",
3098
3081
  members: {
3099
3082
  NodeShape: { discriminantValues: ["NodeShape"], type: NodeShape.schema },
3100
3083
  PropertyShape: {
@@ -3496,7 +3479,7 @@ export var $Object;
3496
3479
  Identifier.stringify = NTriplesTerm.stringify;
3497
3480
  })(Identifier = $Object.Identifier || ($Object.Identifier = {}));
3498
3481
  $Object.schema = {
3499
- kind: "ObjectUnion",
3482
+ kind: "ObjectDiscriminatedUnion",
3500
3483
  members: {
3501
3484
  NodeShape: { discriminantValues: ["NodeShape"], type: NodeShape.schema },
3502
3485
  Ontology: { discriminantValues: ["Ontology"], type: Ontology.schema },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "dependencies": {
3
- "@shaclmate/shacl-ast": "4.0.63",
3
+ "@shaclmate/shacl-ast": "4.0.65",
4
4
  "@rdfjs/dataset": "~2.0.2",
5
5
  "@rdfjs/prefix-map": "~0.1.2",
6
6
  "@rdfjs/term-map": "~2.0.2",
@@ -283,12 +283,12 @@
283
283
  "dist/generators/ts/_ObjectDiscriminatedUnionType/ObjectDiscriminatedUnionType_graphqlTypeVariableStatement.js",
284
284
  "dist/generators/ts/_ObjectDiscriminatedUnionType/ObjectDiscriminatedUnionType_identifierTypeDeclarations.d.ts",
285
285
  "dist/generators/ts/_ObjectDiscriminatedUnionType/ObjectDiscriminatedUnionType_identifierTypeDeclarations.js",
286
- "dist/generators/ts/_ObjectDiscriminatedUnionType/ObjectDiscriminatedUnionType_isTypeFunctionDeclaration.d.ts",
287
- "dist/generators/ts/_ObjectDiscriminatedUnionType/ObjectDiscriminatedUnionType_isTypeFunctionDeclaration.js",
288
286
  "dist/generators/ts/_ObjectDiscriminatedUnionType/ObjectDiscriminatedUnionType_schemaVariableStatement.d.ts",
289
287
  "dist/generators/ts/_ObjectDiscriminatedUnionType/ObjectDiscriminatedUnionType_schemaVariableStatement.js",
290
288
  "dist/generators/ts/_ObjectDiscriminatedUnionType/ObjectDiscriminatedUnionType_toRdfResourceFunctionDeclaration.d.ts",
291
289
  "dist/generators/ts/_ObjectDiscriminatedUnionType/ObjectDiscriminatedUnionType_toRdfResourceFunctionDeclaration.js",
290
+ "dist/generators/ts/_ObjectDiscriminatedUnionType/ObjectDiscriminatedUnionType_typeGuardFunctionDeclaration.d.ts",
291
+ "dist/generators/ts/_ObjectDiscriminatedUnionType/ObjectDiscriminatedUnionType_typeGuardFunctionDeclaration.js",
292
292
  "dist/generators/ts/_ObjectType/ObjectType_AbstractProperty.d.ts",
293
293
  "dist/generators/ts/_ObjectType/ObjectType_AbstractProperty.js",
294
294
  "dist/generators/ts/_ObjectType/ObjectType_DiscriminantProperty.d.ts",
@@ -321,8 +321,6 @@
321
321
  "dist/generators/ts/_ObjectType/ObjectType_hashFunctionExpression.js",
322
322
  "dist/generators/ts/_ObjectType/ObjectType_identifierTypeDeclarations.d.ts",
323
323
  "dist/generators/ts/_ObjectType/ObjectType_identifierTypeDeclarations.js",
324
- "dist/generators/ts/_ObjectType/ObjectType_isTypeFunctionDeclaration.d.ts",
325
- "dist/generators/ts/_ObjectType/ObjectType_isTypeFunctionDeclaration.js",
326
324
  "dist/generators/ts/_ObjectType/ObjectType_jsonParseFunctionDeclaration.d.ts",
327
325
  "dist/generators/ts/_ObjectType/ObjectType_jsonParseFunctionDeclaration.js",
328
326
  "dist/generators/ts/_ObjectType/ObjectType_jsonSchemaExpression.d.ts",
@@ -349,6 +347,8 @@
349
347
  "dist/generators/ts/_ObjectType/ObjectType_toStringFunctionExpression.js",
350
348
  "dist/generators/ts/_ObjectType/ObjectType_toStringRecordFunctionExpression.d.ts",
351
349
  "dist/generators/ts/_ObjectType/ObjectType_toStringRecordFunctionExpression.js",
350
+ "dist/generators/ts/_ObjectType/ObjectType_typeGuardFunctionExpression.d.ts",
351
+ "dist/generators/ts/_ObjectType/ObjectType_typeGuardFunctionExpression.js",
352
352
  "dist/generators/ts/_ObjectType/ObjectType_valueSparqlConstructTriplesFunctionExpression.d.ts",
353
353
  "dist/generators/ts/_ObjectType/ObjectType_valueSparqlConstructTriplesFunctionExpression.js",
354
354
  "dist/generators/ts/_ObjectType/ObjectType_valueSparqlWherePatternsFunctionExpression.d.ts",
@@ -721,5 +721,5 @@
721
721
  },
722
722
  "type": "module",
723
723
  "types": "./dist/index.d.ts",
724
- "version": "4.0.63"
724
+ "version": "4.0.65"
725
725
  }
@@ -1,4 +0,0 @@
1
- import type { ObjectDiscriminatedUnionType } from "../ObjectDiscriminatedUnionType.js";
2
- import { type Code } from "../ts-poet-wrapper.js";
3
- export declare function ObjectDiscriminatedUnionType_isTypeFunctionDeclaration(this: ObjectDiscriminatedUnionType): Record<string, Code>;
4
- //# sourceMappingURL=ObjectDiscriminatedUnionType_isTypeFunctionDeclaration.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_isTypeFunctionDeclaration(this: ObjectType): Maybe<Code>;
5
- //# sourceMappingURL=ObjectType_isTypeFunctionDeclaration.d.ts.map
@@ -1,20 +0,0 @@
1
- import { Maybe } from "purify-ts";
2
- import { code, literalOf } from "../ts-poet-wrapper.js";
3
- export function ObjectType_isTypeFunctionDeclaration() {
4
- if (!this.configuration.features.has("Object.type")) {
5
- return Maybe.empty();
6
- }
7
- if (this.synthetic) {
8
- return Maybe.empty();
9
- }
10
- const name = this.name.extract();
11
- const discriminantProperty = this.discriminantProperty.extract();
12
- if (!name || !discriminantProperty) {
13
- return Maybe.empty();
14
- }
15
- return Maybe.of(code `\
16
- export function is${name}(object: ${this.configuration.syntheticNamePrefix}Object): object is ${name} {
17
- return object.${discriminantProperty.name} === ${literalOf(discriminantProperty.value)};
18
- }`);
19
- }
20
- //# sourceMappingURL=ObjectType_isTypeFunctionDeclaration.js.map