@rdfx/builder 0.0.54 → 0.0.56

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/builder.d.ts CHANGED
@@ -112,6 +112,8 @@ export declare function builder<DefaultNamespaceT extends NamespaceBuilder = Nam
112
112
  }, "$identifier" | "path" | "in_" | "nodeKind" | "maxCount" | "minCount"> & {
113
113
  readonly cardinality?: "optional" | "required" | "set";
114
114
  readonly in_?: import("./shapes.js").skos_ConceptScheme | readonly (string | number | bigint | boolean | import("@rdfjs/types").Literal | Date | NamedNode<string>)[];
115
+ readonly maxCount?: bigint | number;
116
+ readonly minCount?: bigint | number;
115
117
  readonly nodeKind?: ((NamedNode<string> & NamedNode<"http://www.w3.org/ns/shacl#BlankNode">) | (NamedNode<string> & NamedNode<"http://www.w3.org/ns/shacl#Literal">) | (NamedNode<string> & NamedNode<"http://www.w3.org/ns/shacl#BlankNodeOrIRI">) | (NamedNode<string> & NamedNode<"http://www.w3.org/ns/shacl#BlankNodeOrLiteral">) | (NamedNode<string> & NamedNode<"http://www.w3.org/ns/shacl#IRI">) | (NamedNode<string> & NamedNode<"http://www.w3.org/ns/shacl#IRIOrLiteral">)) | ("BlankNode" | "Literal" | "BlankNodeOrIRI" | "BlankNodeOrLiteral" | "IRI" | "IRIOrLiteral");
116
118
  readonly path?: import("@rdfx/resource").PropertyPath | (keyof DefaultNamespaceT & string) | undefined;
117
119
  }, "$identifier" | "path"> & {
@@ -177,6 +179,8 @@ export declare function builder<DefaultNamespaceT extends NamespaceBuilder = Nam
177
179
  }, "$identifier" | "path" | "in_" | "nodeKind" | "maxCount" | "minCount"> & {
178
180
  readonly cardinality?: "optional" | "required" | "set";
179
181
  readonly in_?: import("./shapes.js").skos_ConceptScheme | readonly (string | number | bigint | boolean | import("@rdfjs/types").Literal | Date | NamedNode<string>)[];
182
+ readonly maxCount?: bigint | number;
183
+ readonly minCount?: bigint | number;
180
184
  readonly nodeKind?: ((NamedNode<string> & NamedNode<"http://www.w3.org/ns/shacl#BlankNode">) | (NamedNode<string> & NamedNode<"http://www.w3.org/ns/shacl#Literal">) | (NamedNode<string> & NamedNode<"http://www.w3.org/ns/shacl#BlankNodeOrIRI">) | (NamedNode<string> & NamedNode<"http://www.w3.org/ns/shacl#BlankNodeOrLiteral">) | (NamedNode<string> & NamedNode<"http://www.w3.org/ns/shacl#IRI">) | (NamedNode<string> & NamedNode<"http://www.w3.org/ns/shacl#IRIOrLiteral">)) | ("BlankNode" | "Literal" | "BlankNodeOrIRI" | "BlankNodeOrLiteral" | "IRI" | "IRIOrLiteral");
181
185
  readonly path?: import("@rdfx/resource").PropertyPath | (keyof DefaultNamespaceT & string) | undefined;
182
186
  }) | undefined) => ReturnType<typeof import("./shapes.js").sh_PropertyShape.createUnsafe>;
package/dist/sh.d.ts CHANGED
@@ -70,12 +70,16 @@ export declare function sh<DefaultNamespaceT extends NamespaceBuilder>({ default
70
70
  }, "$identifier" | "path" | "in_" | "nodeKind" | "maxCount" | "minCount"> & {
71
71
  readonly cardinality?: "optional" | "required" | "set";
72
72
  readonly in_?: skos_ConceptScheme | ConvertibleInArray;
73
+ readonly maxCount?: bigint | number;
74
+ readonly minCount?: bigint | number;
73
75
  readonly nodeKind?: NodeKindIri | NodeKindString;
74
76
  readonly path?: (keyof DefaultNamespaceT & string) | PropertyPath;
75
77
  }, "$identifier" | "path"> & {
76
78
  readonly $identifier?: Parameters<($identifier: BlankNode | (keyof DefaultNamespaceT & string) | NamedNode | undefined, parameters?: Omit<NonNullable<Parameters<typeof sh_PropertyShape.createUnsafe<DefaultNamespaceT>>[0]>, "$identifier" | "in_" | "maxCount" | "minCount" | "nodeKind" | "path"> & {
77
79
  readonly cardinality?: "optional" | "required" | "set";
78
80
  readonly in_?: skos_ConceptScheme | ConvertibleInArray;
81
+ readonly maxCount?: bigint | number;
82
+ readonly minCount?: bigint | number;
79
83
  readonly nodeKind?: NodeKindIri | NodeKindString;
80
84
  readonly path?: (keyof DefaultNamespaceT & string) | PropertyPath;
81
85
  }) => ReturnType<typeof sh_PropertyShape.createUnsafe<DefaultNamespaceT>>>[0];
@@ -86,6 +90,8 @@ export declare function sh<DefaultNamespaceT extends NamespaceBuilder>({ default
86
90
  PropertyShape: ($identifier: BlankNode | (keyof DefaultNamespaceT & string) | NamedNode | undefined, parameters?: Omit<NonNullable<Parameters<typeof sh_PropertyShape.createUnsafe<DefaultNamespaceT>>[0]>, "$identifier" | "in_" | "maxCount" | "minCount" | "nodeKind" | "path"> & {
87
91
  readonly cardinality?: "optional" | "required" | "set";
88
92
  readonly in_?: skos_ConceptScheme | ConvertibleInArray;
93
+ readonly maxCount?: bigint | number;
94
+ readonly minCount?: bigint | number;
89
95
  readonly nodeKind?: NodeKindIri | NodeKindString;
90
96
  readonly path?: (keyof DefaultNamespaceT & string) | PropertyPath;
91
97
  }) => ReturnType<typeof sh_PropertyShape.createUnsafe<DefaultNamespaceT>>;
package/dist/sh.js CHANGED
@@ -34,7 +34,7 @@ function convertNodeKind(nodeKind) {
34
34
  export function sh({ defaultNamespace, toIdentifier, toIri, toIriArray, }) {
35
35
  function PropertyShape($identifier, parameters) {
36
36
  // Order of default population matters here.
37
- const { cardinality: cardinalityParameter, in_: inParameter, path: pathParameter, nodeKind: nodeKindParameter, ...otherParameters } = parameters ?? {};
37
+ const { cardinality: cardinalityParameter, in_: inParameter, maxCount: maxCountParameter, minCount: minCountParameter, path: pathParameter, nodeKind: nodeKindParameter, ...otherParameters } = parameters ?? {};
38
38
  const $identifierTerm = toIdentifier($identifier);
39
39
  let path;
40
40
  switch (typeof pathParameter) {
@@ -55,18 +55,22 @@ export function sh({ defaultNamespace, toIdentifier, toIri, toIriArray, }) {
55
55
  }
56
56
  let maxCount;
57
57
  let minCount;
58
- if (cardinalityParameter) {
59
- switch (cardinalityParameter) {
60
- case "optional":
61
- maxCount = 1n;
62
- break;
63
- case "required":
64
- maxCount = 1n;
65
- minCount = 1n;
66
- break;
67
- case "set":
68
- break;
69
- }
58
+ switch (cardinalityParameter ?? "set") {
59
+ case "optional":
60
+ maxCount = 1n;
61
+ break;
62
+ case "required":
63
+ maxCount = 1n;
64
+ minCount = 1n;
65
+ break;
66
+ case "set":
67
+ if (maxCountParameter !== undefined) {
68
+ maxCount = BigInt(maxCountParameter);
69
+ }
70
+ if (minCountParameter !== undefined) {
71
+ minCount = BigInt(minCountParameter);
72
+ }
73
+ break;
70
74
  }
71
75
  return sh_PropertyShape.createUnsafe({
72
76
  ...otherParameters,
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "dependencies": {
3
- "@rdfx/data-factory": "0.0.54",
4
- "@rdfx/literal": "0.0.54",
5
- "@rdfx/logger": "0.0.54",
6
- "@rdfx/resource": "0.0.54",
7
- "@rdfx/string": "0.0.54",
3
+ "@rdfx/data-factory": "0.0.56",
4
+ "@rdfx/literal": "0.0.56",
5
+ "@rdfx/logger": "0.0.56",
6
+ "@rdfx/resource": "0.0.56",
7
+ "@rdfx/string": "0.0.56",
8
8
  "@rdfjs/namespace": "~2.0.1",
9
9
  "@rdfjs/types": "~2.0.1",
10
10
  "@types/rdfjs__namespace": "~2.0.10",
@@ -12,12 +12,12 @@
12
12
  "purify-ts": "~2.1.4"
13
13
  },
14
14
  "devDependencies": {
15
- "@rdfx/collection": "0.0.54",
16
- "@rdfx/fs": "0.0.54",
17
- "@rdfx/logger": "0.0.54",
18
- "@rdfx/testing": "0.0.54",
19
- "@shaclmate/compiler": "4.0.80",
20
- "@shaclmate/validator": "4.0.80",
15
+ "@rdfx/collection": "0.0.56",
16
+ "@rdfx/fs": "0.0.56",
17
+ "@rdfx/logger": "0.0.56",
18
+ "@rdfx/testing": "0.0.56",
19
+ "@shaclmate/compiler": "4.0.88",
20
+ "@shaclmate/validator": "4.0.88",
21
21
  "@tpluscode/rdf-ns-builders": "~4.3.0"
22
22
  },
23
23
  "files": [
@@ -43,5 +43,5 @@
43
43
  },
44
44
  "type": "module",
45
45
  "types": "./dist/index.d.ts",
46
- "version": "0.0.54"
46
+ "version": "0.0.56"
47
47
  }