@shaclmate/compiler 2.0.12

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 (109) hide show
  1. package/ShapesGraphToAstTransformer.d.ts +32 -0
  2. package/ShapesGraphToAstTransformer.js +461 -0
  3. package/ast/Ast.d.ts +5 -0
  4. package/ast/Ast.js +2 -0
  5. package/ast/IdentifierType.d.ts +13 -0
  6. package/ast/IdentifierType.js +2 -0
  7. package/ast/IntersectionType.d.ts +9 -0
  8. package/ast/IntersectionType.js +2 -0
  9. package/ast/LiteralType.d.ts +13 -0
  10. package/ast/LiteralType.js +2 -0
  11. package/ast/MintingStrategy.d.ts +8 -0
  12. package/ast/MintingStrategy.js +9 -0
  13. package/ast/Name.d.ts +13 -0
  14. package/ast/Name.js +2 -0
  15. package/ast/ObjectType.d.ts +88 -0
  16. package/ast/ObjectType.js +2 -0
  17. package/ast/OptionType.d.ts +11 -0
  18. package/ast/OptionType.js +2 -0
  19. package/ast/SetType.d.ts +12 -0
  20. package/ast/SetType.js +2 -0
  21. package/ast/Type.d.ts +9 -0
  22. package/ast/Type.js +2 -0
  23. package/ast/UnionType.d.ts +9 -0
  24. package/ast/UnionType.js +2 -0
  25. package/ast/index.d.ts +10 -0
  26. package/ast/index.js +10 -0
  27. package/generators/index.d.ts +3 -0
  28. package/generators/index.js +3 -0
  29. package/generators/json/AstJsonGenerator.d.ts +7 -0
  30. package/generators/json/AstJsonGenerator.js +103 -0
  31. package/generators/json/index.d.ts +2 -0
  32. package/generators/json/index.js +2 -0
  33. package/generators/ts/BooleanType.d.ts +7 -0
  34. package/generators/ts/BooleanType.js +13 -0
  35. package/generators/ts/Configuration.d.ts +29 -0
  36. package/generators/ts/Configuration.js +40 -0
  37. package/generators/ts/IdentifierType.d.ts +23 -0
  38. package/generators/ts/IdentifierType.js +83 -0
  39. package/generators/ts/IntersectionType.d.ts +14 -0
  40. package/generators/ts/IntersectionType.js +26 -0
  41. package/generators/ts/ListType.d.ts +26 -0
  42. package/generators/ts/ListType.js +119 -0
  43. package/generators/ts/LiteralType.d.ts +14 -0
  44. package/generators/ts/LiteralType.js +61 -0
  45. package/generators/ts/NumberType.d.ts +7 -0
  46. package/generators/ts/NumberType.js +13 -0
  47. package/generators/ts/ObjectType.d.ts +71 -0
  48. package/generators/ts/ObjectType.js +160 -0
  49. package/generators/ts/OptionType.d.ts +17 -0
  50. package/generators/ts/OptionType.js +83 -0
  51. package/generators/ts/PrimitiveType.d.ts +11 -0
  52. package/generators/ts/PrimitiveType.js +41 -0
  53. package/generators/ts/RdfjsTermType.d.ts +25 -0
  54. package/generators/ts/RdfjsTermType.js +46 -0
  55. package/generators/ts/SetType.d.ts +19 -0
  56. package/generators/ts/SetType.js +76 -0
  57. package/generators/ts/StringType.d.ts +7 -0
  58. package/generators/ts/StringType.js +13 -0
  59. package/generators/ts/TsGenerator.d.ts +15 -0
  60. package/generators/ts/TsGenerator.js +119 -0
  61. package/generators/ts/Type.d.ts +108 -0
  62. package/generators/ts/Type.js +83 -0
  63. package/generators/ts/TypeFactory.d.ts +15 -0
  64. package/generators/ts/TypeFactory.js +198 -0
  65. package/generators/ts/UnionType.d.ts +18 -0
  66. package/generators/ts/UnionType.js +165 -0
  67. package/generators/ts/_ObjectType/IdentifierProperty.d.ts +23 -0
  68. package/generators/ts/_ObjectType/IdentifierProperty.js +82 -0
  69. package/generators/ts/_ObjectType/Property.d.ts +38 -0
  70. package/generators/ts/_ObjectType/Property.js +11 -0
  71. package/generators/ts/_ObjectType/ShaclProperty.d.ts +25 -0
  72. package/generators/ts/_ObjectType/ShaclProperty.js +106 -0
  73. package/generators/ts/_ObjectType/TypeDiscriminatorProperty.d.ts +29 -0
  74. package/generators/ts/_ObjectType/TypeDiscriminatorProperty.js +53 -0
  75. package/generators/ts/_ObjectType/classDeclaration.d.ts +4 -0
  76. package/generators/ts/_ObjectType/classDeclaration.js +154 -0
  77. package/generators/ts/_ObjectType/equalsFunctionDeclaration.d.ts +4 -0
  78. package/generators/ts/_ObjectType/equalsFunctionDeclaration.js +27 -0
  79. package/generators/ts/_ObjectType/fromRdfFunctionDeclaration.d.ts +4 -0
  80. package/generators/ts/_ObjectType/fromRdfFunctionDeclaration.js +72 -0
  81. package/generators/ts/_ObjectType/hashFunctionDeclaration.d.ts +5 -0
  82. package/generators/ts/_ObjectType/hashFunctionDeclaration.js +64 -0
  83. package/generators/ts/_ObjectType/index.d.ts +12 -0
  84. package/generators/ts/_ObjectType/index.js +12 -0
  85. package/generators/ts/_ObjectType/interfaceDeclaration.d.ts +4 -0
  86. package/generators/ts/_ObjectType/interfaceDeclaration.js +12 -0
  87. package/generators/ts/_ObjectType/sparqlGraphPatternsClassDeclaration.d.ts +4 -0
  88. package/generators/ts/_ObjectType/sparqlGraphPatternsClassDeclaration.js +46 -0
  89. package/generators/ts/_ObjectType/toRdfFunctionDeclaration.d.ts +4 -0
  90. package/generators/ts/_ObjectType/toRdfFunctionDeclaration.js +53 -0
  91. package/generators/ts/index.d.ts +2 -0
  92. package/generators/ts/index.js +2 -0
  93. package/generators/ts/rdfjsTermExpression.d.ts +5 -0
  94. package/generators/ts/rdfjsTermExpression.js +15 -0
  95. package/generators/ts/stringToValidTsIdentifier.d.ts +2 -0
  96. package/generators/ts/stringToValidTsIdentifier.js +14 -0
  97. package/generators/ts/tsName.d.ts +3 -0
  98. package/generators/ts/tsName.js +22 -0
  99. package/index.d.ts +2 -0
  100. package/index.js +2 -0
  101. package/logger.d.ts +2 -0
  102. package/logger.js +8 -0
  103. package/package.json +71 -0
  104. package/vocabularies/dashDataset.d.ts +3 -0
  105. package/vocabularies/dashDataset.js +2370 -0
  106. package/vocabularies/index.d.ts +2 -0
  107. package/vocabularies/index.js +2 -0
  108. package/vocabularies/shaclmate.d.ts +15 -0
  109. package/vocabularies/shaclmate.js +6 -0
@@ -0,0 +1,22 @@
1
+ import { Resource } from "rdfjs-resource";
2
+ import { stringToValidTsIdentifier } from "./stringToValidTsIdentifier.js";
3
+ export function tsName(astName) {
4
+ for (const tsNameAlternative of [
5
+ astName.shaclmateName.extract(),
6
+ astName.shName.extract()?.replace(" ", "_"),
7
+ astName.curie.map((curie) => curie.replace(":", "_")).extract(),
8
+ astName.propertyPath
9
+ .chain((propertyPath) => propertyPath.curie.map((curie) => curie.replace(":", "_")))
10
+ .extract(),
11
+ astName.propertyPath
12
+ .map((propertyPath) => Resource.Identifier.toString(propertyPath.identifier))
13
+ .extract(),
14
+ Resource.Identifier.toString(astName.identifier),
15
+ ]) {
16
+ if (tsNameAlternative) {
17
+ return stringToValidTsIdentifier(tsNameAlternative);
18
+ }
19
+ }
20
+ throw new Error("should never reach this point");
21
+ }
22
+ //# sourceMappingURL=tsName.js.map
package/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from "./ShapesGraphToAstTransformer.js";
2
+ //# sourceMappingURL=index.d.ts.map
package/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export * from "./ShapesGraphToAstTransformer.js";
2
+ //# sourceMappingURL=index.js.map
package/logger.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export declare const logger: import("pino").Logger<never>;
2
+ //# sourceMappingURL=logger.d.ts.map
package/logger.js ADDED
@@ -0,0 +1,8 @@
1
+ import { pino } from "pino";
2
+ export const logger = pino({
3
+ level: process.env["NODE_ENV"] === "development" ||
4
+ process.env["NODE_ENV"] === "test"
5
+ ? "debug"
6
+ : "info",
7
+ }, pino["destination"] ? pino.destination(2) : undefined);
8
+ //# sourceMappingURL=logger.js.map
package/package.json ADDED
@@ -0,0 +1,71 @@
1
+ {
2
+ "dependencies": {
3
+ "@rdfjs/prefix-map": "^0.1.2",
4
+ "@rdfjs/term-map": "^2.0.2",
5
+ "@rdfjs/term-set": "^2.0.3",
6
+ "@rdfjs/types": "^1.1.0",
7
+ "@sindresorhus/base62": "^0.1.0",
8
+ "@tpluscode/rdf-ns-builders": "^4.3.0",
9
+ "@types/n3": "^1.21.1",
10
+ "@types/rdfjs__prefix-map": "^0.1.5",
11
+ "@types/rdfjs__term-map": "^2.0.10",
12
+ "@types/rdfjs__term-set": "^2.0.9",
13
+ "change-case": "^5.4.4",
14
+ "n3": "^1.21.3",
15
+ "pino": "^9.1.0",
16
+ "reserved-identifiers": "^1.0.0",
17
+ "shacl-ast": "2.0.12",
18
+ "ts-invariant": "^0.10.3",
19
+ "ts-morph": "^24.0.0",
20
+ "typescript-memoize": "^1.1.1"
21
+ },
22
+ "devDependencies": {
23
+ "@shaclmate/runtime": "2.0.12"
24
+ },
25
+ "files": [
26
+ "*.d.ts",
27
+ "*.js",
28
+ "ast/*.d.ts",
29
+ "ast/*.js",
30
+ "generators/*.d.ts",
31
+ "generators/*.js",
32
+ "generators/json/*.d.ts",
33
+ "generators/json/*.js",
34
+ "generators/ts/*.d.ts",
35
+ "generators/ts/*.js",
36
+ "generators/ts/_ObjectType/*.d.ts",
37
+ "generators/ts/_ObjectType/*.js",
38
+ "vocabularies/*.d.ts",
39
+ "vocabularies/*.js"
40
+ ],
41
+ "main": "index.js",
42
+ "license": "Apache-2.0",
43
+ "name": "@shaclmate/compiler",
44
+ "scripts": {
45
+ "build": "tsc -b",
46
+ "check": "biome check",
47
+ "check:write": "biome check --write",
48
+ "check:write:unsafe": "biome check --write --unsafe",
49
+ "clean": "rimraf -g **/*.d.ts* **/*.js **/*.js.map tsconfig.tsbuildinfo",
50
+ "format": "biome format",
51
+ "format:write": "biome format --write",
52
+ "format:write:unsafe": "biome format --write --unsafe",
53
+ "rebuild": "run-s clean build",
54
+ "link-dependencies": "npm link purify-ts-helpers rdfjs-resource",
55
+ "lint": "biome lint",
56
+ "lint:write": "biome lint --write",
57
+ "lint:write:unsafe": "biome lint --write --unsafe",
58
+ "test": "biome check && vitest run",
59
+ "test:coverage": "biome check && vitest run --coverage",
60
+ "test:watch": "vitest watch",
61
+ "unlink": "npm unlink -g @shaclmate/compiler",
62
+ "watch": "tsc -w --preserveWatchOutput"
63
+ },
64
+ "repository": {
65
+ "type": "git",
66
+ "url": "git+https://github.com/minorg/shaclmate"
67
+ },
68
+ "type": "module",
69
+ "types": "index.d.ts",
70
+ "version": "2.0.12"
71
+ }
@@ -0,0 +1,3 @@
1
+ import type { DatasetCore } from "@rdfjs/types";
2
+ export declare const dashDataset: DatasetCore;
3
+ //# sourceMappingURL=dashDataset.d.ts.map