@shaclmate/compiler 4.0.35 → 4.0.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ShapesGraphToAstTransformer.js +10 -0
- package/dist/ast/Ast.d.ts +1 -0
- package/dist/generators/ts/AbstractNamedUnionType.js +39 -22
- package/dist/generators/ts/AbstractObjectSetType.d.ts +35 -0
- package/dist/generators/ts/AbstractObjectSetType.js +44 -0
- package/dist/generators/ts/GraphqlSchema.d.ts +22 -0
- package/dist/generators/ts/GraphqlSchema.js +87 -0
- package/dist/generators/ts/NamedObjectType.js +13 -4
- package/dist/generators/ts/NamedObjectUnionType.js +14 -5
- package/dist/generators/ts/ObjectSetType.d.ts +6 -0
- package/dist/generators/ts/ObjectSetType.js +36 -0
- package/dist/generators/ts/RdfjsDatasetObjectSetType.d.ts +6 -0
- package/dist/generators/ts/{rdfjsDatasetObjectSetClassDeclaration.js → RdfjsDatasetObjectSetType.js} +73 -69
- package/dist/generators/ts/Snippets.d.ts +1 -0
- package/dist/generators/ts/Snippets.js +7 -0
- package/dist/generators/ts/SparqlObjectSetType.d.ts +6 -0
- package/dist/generators/ts/{sparqlObjectSetClassDeclaration.js → SparqlObjectSetType.js} +40 -35
- package/dist/generators/ts/TsFeature.d.ts +1 -1
- package/dist/generators/ts/TsFeature.js +25 -7
- package/dist/generators/ts/TsGenerator.d.ts +7 -8
- package/dist/generators/ts/TsGenerator.js +141 -52
- package/dist/generators/ts/ZodGenerator.d.ts +1 -2
- package/dist/generators/ts/ZodGenerator.js +12 -12
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_createFunctionDeclaration.js +18 -12
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_equalsFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterFunctionDeclaration.d.ts +2 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterFunctionDeclaration.js +6 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterTypeDeclaration.d.ts +2 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterTypeDeclaration.js +6 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromJsonFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceValuesFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfTypeVariableStatement.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_graphqlTypeVariableStatement.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_hashFunctionDeclarations.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_isTypeFunctionDeclaration.d.ts +2 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_isTypeFunctionDeclaration.js +6 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonParseFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonSchemaFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonTypeAliasDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonUiSchemaFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_schemaVariableStatement.d.ts +2 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_schemaVariableStatement.js +6 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_sparqlConstructQueryFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toJsonFunctionDeclaration.js +3 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toRdfResourceFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toStringFunctionDeclarations.js +5 -4
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlConstructTriplesFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlWherePatternsFunctionDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/ShaclProperty.js +4 -2
- package/dist/generators/ts/_NamedObjectType/identifierTypeDeclarations.js +3 -0
- package/dist/generators/ts/_snippets/snippets_FromRdfResourceFunction.js +2 -2
- package/dist/generators/ts/_snippets/snippets_FromRdfResourceValuesFunction.js +2 -2
- package/dist/generators/ts/_snippets/snippets_PropertyPath.js +12 -6
- package/dist/generators/ts/_snippets/snippets__FromRdfResourceFunction.js +2 -2
- package/dist/generators/ts/_snippets/snippets_monkeyPatchObject.d.ts +3 -0
- package/dist/generators/ts/_snippets/snippets_monkeyPatchObject.js +16 -0
- package/dist/generators/ts/_snippets/snippets_wrap_FromRdfResourceFunction.js +3 -4
- package/dist/input/generated.d.ts +1 -286
- package/dist/input/generated.js +104 -1093
- package/package.json +2 -2
- package/dist/generators/ts/graphqlSchemaVariableStatement.d.ts +0 -10
- package/dist/generators/ts/graphqlSchemaVariableStatement.js +0 -84
- package/dist/generators/ts/objectSetDeclarations.d.ts +0 -9
- package/dist/generators/ts/objectSetDeclarations.js +0 -30
- package/dist/generators/ts/objectSetInterfaceDeclaration.d.ts +0 -9
- package/dist/generators/ts/objectSetInterfaceDeclaration.js +0 -26
- package/dist/generators/ts/objectSetMethodSignatures.d.ts +0 -18
- package/dist/generators/ts/objectSetMethodSignatures.js +0 -31
- package/dist/generators/ts/rdfjsDatasetObjectSetClassDeclaration.d.ts +0 -9
- package/dist/generators/ts/sparqlObjectSetClassDeclaration.d.ts +0 -9
- package/dist/generators/ts/unsupportedObjectSetMethodDeclarations.d.ts +0 -12
- package/dist/generators/ts/unsupportedObjectSetMethodDeclarations.js +0 -21
|
@@ -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("
|
|
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("
|
|
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("
|
|
4
|
+
if (!this.configuration.features.has("Object.toJson")) {
|
|
5
5
|
return Maybe.empty();
|
|
6
6
|
}
|
|
7
7
|
const jsonObjectMembers = [];
|
|
@@ -19,6 +19,7 @@ export function NamedObjectType_toJsonFunctionDeclaration() {
|
|
|
19
19
|
})
|
|
20
20
|
.toList()));
|
|
21
21
|
}
|
|
22
|
+
const returnType = this.jsonType().name;
|
|
22
23
|
// 20241220: don't add @type until we're doing JSON-LD
|
|
23
24
|
// switch (this.toRdfTypes.length) {
|
|
24
25
|
// case 0:
|
|
@@ -33,7 +34,7 @@ export function NamedObjectType_toJsonFunctionDeclaration() {
|
|
|
33
34
|
// break;
|
|
34
35
|
// }
|
|
35
36
|
return Maybe.of(code `\
|
|
36
|
-
export function toJson(${this.thisVariable}: ${this.name}): ${
|
|
37
|
+
export function toJson(${this.thisVariable}: ${this.name}): ${returnType} {
|
|
37
38
|
return JSON.parse(JSON.stringify({ ${joinCode(jsonObjectMembers, { on: "," })} } satisfies ${this.jsonType().name}));
|
|
38
39
|
}`);
|
|
39
40
|
}
|
package/dist/generators/ts/_NamedObjectType/NamedObjectType_toRdfResourceFunctionDeclaration.js
CHANGED
|
@@ -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_toRdfResourceFunctionDeclaration() {
|
|
5
|
-
if (!this.configuration.features.has("
|
|
5
|
+
if (!this.configuration.features.has("Object.toRdf")) {
|
|
6
6
|
return Maybe.empty();
|
|
7
7
|
}
|
|
8
8
|
const statements = this.parentObjectTypes.map((parentObjectType) => code `${parentObjectType.name}._toRdfResource({ ...parameters, ignoreRdfType: true });`);
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { code, joinCode } from "../ts-poet-wrapper.js";
|
|
2
2
|
export function NamedObjectType_toStringFunctionDeclarations() {
|
|
3
|
+
if (!this.configuration.features.has("Object.toString")) {
|
|
4
|
+
return [];
|
|
5
|
+
}
|
|
3
6
|
let propertiesToStringInitializers = [];
|
|
4
7
|
if (this.parentObjectTypes.length > 0) {
|
|
5
8
|
for (const parentObjectType of this.parentObjectTypes) {
|
|
@@ -25,10 +28,8 @@ export function _propertiesToStrings(${this.thisVariable}: ${this.name}): Record
|
|
|
25
28
|
return ${propertiesToStringsReturnExpression};
|
|
26
29
|
}`,
|
|
27
30
|
code `\
|
|
28
|
-
export function ${syntheticNamePrefix}toString(this: ${this.name}): string
|
|
29
|
-
|
|
30
|
-
export function ${syntheticNamePrefix}toString(this: ${this.name} | undefined, ${this.thisVariable}?: ${this.name}): string {
|
|
31
|
-
return ${toStringReturnExpression(code `_propertiesToStrings((${this.thisVariable} ?? this)!)`)};
|
|
31
|
+
export function ${syntheticNamePrefix}toString(${this.thisVariable}: ${this.name}): string {
|
|
32
|
+
return ${toStringReturnExpression(code `_propertiesToStrings(${this.thisVariable})`)};
|
|
32
33
|
}`,
|
|
33
34
|
];
|
|
34
35
|
}
|
|
@@ -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_valueSparqlConstructTriplesFunctionDeclaration() {
|
|
4
|
-
if (!this.configuration.features.has("
|
|
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 } from "../ts-poet-wrapper.js";
|
|
3
3
|
export function NamedObjectType_valueSparqlWherePatternsFunctionDeclaration() {
|
|
4
|
-
if (!this.configuration.features.has("
|
|
4
|
+
if (!this.configuration.features.has("Object.SPARQL")) {
|
|
5
5
|
return Maybe.empty();
|
|
6
6
|
}
|
|
7
7
|
return Maybe.of(code `\
|
|
@@ -102,7 +102,9 @@ export class ShaclProperty extends AbstractProperty {
|
|
|
102
102
|
...super.schemaObject,
|
|
103
103
|
// comment: this.comment.map(JSON.stringify).extract(),
|
|
104
104
|
// description: this.description.map(JSON.stringify).extract(),
|
|
105
|
-
path: this.configuration.features.has("
|
|
105
|
+
path: this.configuration.features.has("Object.fromRdf") ||
|
|
106
|
+
this.configuration.features.has("Object.toRdf") ||
|
|
107
|
+
this.configuration.features.has("Object.SPARQL")
|
|
106
108
|
? this.propertyPathToCode(this.path)
|
|
107
109
|
: undefined,
|
|
108
110
|
// label: this.label.map(JSON.stringify).extract(),
|
|
@@ -211,7 +213,7 @@ export class ShaclProperty extends AbstractProperty {
|
|
|
211
213
|
default:
|
|
212
214
|
return [];
|
|
213
215
|
}
|
|
214
|
-
const propertyPath = this.
|
|
216
|
+
const propertyPath = code `${this.namedObjectType.name}.schema.properties.${this.name}.path`;
|
|
215
217
|
return [
|
|
216
218
|
code `${variables.resource}.add(${propertyPath}, ${this.type.toRdfResourceValuesExpression({
|
|
217
219
|
variables: { ...variables, propertyPath },
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { code } from "../ts-poet-wrapper.js";
|
|
2
2
|
export function identifierTypeDeclarations() {
|
|
3
|
+
if (!this.configuration.features.has("Object.type")) {
|
|
4
|
+
return [];
|
|
5
|
+
}
|
|
3
6
|
const ancestorObjectTypeWithSameIdentifierType = this.ancestorObjectTypes.find((ancestorObjectType) => ancestorObjectType.identifierType.name === this.identifierType.name);
|
|
4
7
|
if (ancestorObjectTypeWithSameIdentifierType) {
|
|
5
8
|
// This object type's identifier type has the same identifier type as an ancestor object type,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
|
-
export const snippets_FromRdfResourceFunction = ({ imports, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}FromRdfResourceFunction`, code `\
|
|
2
|
+
export const snippets_FromRdfResourceFunction = ({ configuration, imports, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}FromRdfResourceFunction`, code `\
|
|
3
3
|
export type ${syntheticNamePrefix}FromRdfResourceFunction<T> = (
|
|
4
4
|
resource: ${imports.Resource},
|
|
5
5
|
options?: {
|
|
6
6
|
context?: unknown;
|
|
7
7
|
graph?: Exclude<${imports.Quad_Graph}, ${imports.Variable}>;
|
|
8
8
|
ignoreRdfType?: boolean;
|
|
9
|
-
objectSet?: ${syntheticNamePrefix}ObjectSet
|
|
9
|
+
${configuration.features.has("ObjectSet") ? code `objectSet?: ${syntheticNamePrefix}ObjectSet;` : ""}
|
|
10
10
|
preferredLanguages?: readonly string[];
|
|
11
11
|
}
|
|
12
12
|
) => ${imports.Either}<Error, T>`);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
|
-
export const snippets_FromRdfResourceValuesFunction = ({ imports, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}FromRdfResourceValuesFunction`, code `\
|
|
2
|
+
export const snippets_FromRdfResourceValuesFunction = ({ configuration, imports, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}FromRdfResourceValuesFunction`, code `\
|
|
3
3
|
export type ${syntheticNamePrefix}FromRdfResourceValuesFunction<T> = (
|
|
4
4
|
resourceValues: ${imports.Either}<Error, ${imports.Resource}.Values>,
|
|
5
5
|
options: {
|
|
6
6
|
context?: unknown;
|
|
7
7
|
graph?: Exclude<${imports.Quad_Graph}, ${imports.Variable}>;
|
|
8
8
|
ignoreRdfType?: boolean;
|
|
9
|
-
objectSet?: ${syntheticNamePrefix}ObjectSet
|
|
9
|
+
${configuration.features.has("ObjectSet") ? code `objectSet?: ${syntheticNamePrefix}ObjectSet;` : ""}
|
|
10
10
|
preferredLanguages?: readonly string[];
|
|
11
11
|
propertyPath: ${syntheticNamePrefix}PropertyPath;
|
|
12
12
|
resource: ${imports.Resource};
|
|
@@ -4,17 +4,19 @@ import { code, conditionalOutput, joinCode, } from "../ts-poet-wrapper.js";
|
|
|
4
4
|
*/
|
|
5
5
|
export const snippets_PropertyPath = ({ configuration, imports, snippets, syntheticNamePrefix, }) => {
|
|
6
6
|
const companionDeclarations = [];
|
|
7
|
-
if (configuration.features.has("equals")) {
|
|
7
|
+
if (configuration.features.has("Object.equals")) {
|
|
8
8
|
companionDeclarations.push(code `\
|
|
9
9
|
export function equals(left: ${syntheticNamePrefix}PropertyPath, right: ${syntheticNamePrefix}PropertyPath): ${snippets.EqualsResult} {
|
|
10
10
|
return ${snippets.EqualsResult}.fromBooleanEqualsResult(left, right, ${imports.RdfxResourcePropertyPath}.equals(left, right));
|
|
11
11
|
}`);
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
if (configuration.features.has("Object.filter")) {
|
|
14
|
+
companionDeclarations.push(code `export type Filter = object`, code `\
|
|
14
15
|
export function filter(_filter: Filter, _value: ${syntheticNamePrefix}PropertyPath): boolean {
|
|
15
16
|
return true;
|
|
16
17
|
}`);
|
|
17
|
-
|
|
18
|
+
}
|
|
19
|
+
if (configuration.features.has("Object.fromRdf")) {
|
|
18
20
|
companionDeclarations.push(code `\
|
|
19
21
|
export const fromRdfResource: ${snippets.FromRdfResourceFunction}<${syntheticNamePrefix}PropertyPath> = ${imports.RdfxResourcePropertyPath}.fromResource;`, code `\
|
|
20
22
|
export const fromRdfResourceValues: ${snippets.FromRdfResourceValuesFunction}<${syntheticNamePrefix}PropertyPath> = (values, options) =>
|
|
@@ -26,12 +28,16 @@ export const fromRdfResourceValues: ${snippets.FromRdfResourceValuesFunction}<${
|
|
|
26
28
|
),
|
|
27
29
|
);`);
|
|
28
30
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
if (configuration.features.has("Object.schema")) {
|
|
32
|
+
companionDeclarations.push(code `export const schema: Readonly<object> = {}`);
|
|
33
|
+
}
|
|
34
|
+
if (configuration.features.has("Object.toRdf")) {
|
|
31
35
|
companionDeclarations.push(code `\
|
|
32
36
|
export const toRdfResource: ${snippets.ToRdfResourceFunction}<${syntheticNamePrefix}PropertyPath> = ${imports.RdfxResourcePropertyPath}.toResource;`);
|
|
33
37
|
}
|
|
34
|
-
|
|
38
|
+
if (configuration.features.has("Object.toString")) {
|
|
39
|
+
companionDeclarations.push(code `export const ${syntheticNamePrefix}toString = ${imports.RdfxResourcePropertyPath}.toString;`);
|
|
40
|
+
}
|
|
35
41
|
return conditionalOutput(`${syntheticNamePrefix}PropertyPath`, code `\
|
|
36
42
|
export type ${syntheticNamePrefix}PropertyPath = ${imports.RdfxResourcePropertyPath};
|
|
37
43
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
|
-
export const snippets__FromRdfResourceFunction = ({ imports, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}_FromRdfResourceFunction`, code `\
|
|
2
|
+
export const snippets__FromRdfResourceFunction = ({ configuration, imports, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}_FromRdfResourceFunction`, code `\
|
|
3
3
|
type ${syntheticNamePrefix}_FromRdfResourceFunction<T> = (
|
|
4
4
|
resource: ${imports.Resource},
|
|
5
5
|
options: {
|
|
6
6
|
context: undefined | unknown;
|
|
7
7
|
graph: Exclude<${imports.Quad_Graph}, ${imports.Variable}> | undefined;
|
|
8
8
|
ignoreRdfType: boolean;
|
|
9
|
-
objectSet: ${syntheticNamePrefix}ObjectSet
|
|
9
|
+
${configuration.features.has("ObjectSet") ? code `objectSet: ${syntheticNamePrefix}ObjectSet;` : ""}
|
|
10
10
|
preferredLanguages: readonly string[] | undefined;
|
|
11
11
|
}
|
|
12
12
|
) => ${imports.Either}<Error, T>;`);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
|
+
export const snippets_monkeyPatchObject = ({ syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}monkeyPatchObject`, code `\
|
|
3
|
+
function ${syntheticNamePrefix}monkeyPatchObject<T extends object>(obj: T, methods: { toJson?: (obj: T) => object, ${syntheticNamePrefix}toString?: (obj: T) => string }): T {
|
|
4
|
+
if (methods.toJson && !globalThis.Object.prototype.hasOwnProperty.call(obj, "toJSON")) {
|
|
5
|
+
const toJsonMethod = methods.toJson;
|
|
6
|
+
(obj as any).toJSON = function(this: T, _key: string) { return toJsonMethod(this); }
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
if (methods.${syntheticNamePrefix}toString && !globalThis.Object.prototype.hasOwnProperty.call(obj, "toString")) {
|
|
10
|
+
const toStringMethod = methods.${syntheticNamePrefix}toString;
|
|
11
|
+
(obj as any).toString = function(this: T) { return toStringMethod(this); }
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return obj;
|
|
15
|
+
}`);
|
|
16
|
+
//# sourceMappingURL=snippets_monkeyPatchObject.js.map
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
2
|
-
export const snippets_wrap_FromRdfResourceFunction = ({ snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}wrap_FromRdfResourceFunction`, code `\
|
|
2
|
+
export const snippets_wrap_FromRdfResourceFunction = ({ configuration, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}wrap_FromRdfResourceFunction`, code `\
|
|
3
3
|
function ${syntheticNamePrefix}wrap_FromRdfResourceFunction<T>(_fromRdfResourceFunction: ${snippets._FromRdfResourceFunction}<T>): ${snippets.FromRdfResourceFunction}<T> {
|
|
4
4
|
return (resource, options) => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return _fromRdfResourceFunction(resource, { context, graph, ignoreRdfType, objectSet, preferredLanguages });
|
|
5
|
+
const { context, graph, ignoreRdfType = false, ${configuration.features.has("ObjectSet") ? "objectSet, " : ""}preferredLanguages } = (options ?? {});
|
|
6
|
+
return _fromRdfResourceFunction(resource, { context, graph, ignoreRdfType, ${configuration.features.has("ObjectSet") ? code `objectSet: objectSet ?? new ${syntheticNamePrefix}RdfjsDatasetObjectSet(resource.dataset), ` : ""}preferredLanguages });
|
|
8
7
|
};
|
|
9
8
|
}`);
|
|
10
9
|
//# sourceMappingURL=snippets_wrap_FromRdfResourceFunction.js.map
|