adjust js-land to use compact shape types for hooks

main
Laurin Weger 3 weeks ago
parent 62cc9352cb
commit 4410980fbc
No known key found for this signature in database
GPG Key ID: 9B372BB0B792770F
  1. 372
      package-lock.json
  2. 2
      package.json
  3. 8
      src/frontends/react/HelloWorld.tsx
  4. 3
      src/frontends/svelte/HelloWorld.svelte
  5. 3
      src/frontends/vue/HelloWorld.vue
  6. 29
      src/ng-mock/js-land/connector/createSignalObjectForShape.ts
  7. 1
      src/ng-mock/js-land/frontendAdapters/react/index.ts
  8. 13
      src/ng-mock/js-land/frontendAdapters/react/useShape.ts
  9. 8
      src/ng-mock/js-land/frontendAdapters/svelte/useShape.svelte.ts
  10. 3
      src/ng-mock/js-land/frontendAdapters/vue/index.ts
  11. 9
      src/ng-mock/js-land/frontendAdapters/vue/useShape.ts
  12. 2
      src/ng-mock/tests/updatesWithWasm.test.ts
  13. 75
      src/ng-mock/wasm-land/requestShape.ts
  14. 5
      src/ng-mock/wasm-land/types.ts
  15. 96
      src/shapes/ldo/catShape.schema.ts
  16. 9
      src/shapes/ldo/catShape.shapeTypes.ts
  17. 47
      src/shapes/ldo/catShape.typings.ts
  18. 88
      src/shapes/ldo/personShape.schema.ts
  19. 9
      src/shapes/ldo/personShape.shapeTypes.ts
  20. 43
      src/shapes/ldo/personShape.typings.ts
  21. 138
      src/shapes/ldo/testShape.schema.ts
  22. 9
      src/shapes/ldo/testShape.shapeTypes.ts
  23. 68
      src/shapes/ldo/testShape.typings.ts
  24. 15
      src/shapes/shex/catShape.shex
  25. 14
      src/shapes/shex/personShape.shex
  26. 19
      src/shapes/shex/testShape.shex
  27. 4
      tsconfig.json

372
package-lock.json generated

@ -15,8 +15,10 @@
"@gn8/alien-signals-solid": "^0.1.1", "@gn8/alien-signals-solid": "^0.1.1",
"@gn8/alien-signals-svelte": "^0.1.1", "@gn8/alien-signals-svelte": "^0.1.1",
"@gn8/alien-signals-vue": "^0.1.1", "@gn8/alien-signals-vue": "^0.1.1",
"@ldo/ldo": "^1.0.0-alpha.32",
"@types/react": "19.1.10", "@types/react": "19.1.10",
"@types/react-dom": "19.1.7", "@types/react-dom": "19.1.7",
"@types/shexj": "^2.1.7",
"alien-deepsignals": "^0.1.0", "alien-deepsignals": "^0.1.0",
"alien-signals": "^2.0.7", "alien-signals": "^2.0.7",
"astro": "5.13.2", "astro": "5.13.2",
@ -1402,6 +1404,64 @@
"@jridgewell/sourcemap-codec": "^1.4.14" "@jridgewell/sourcemap-codec": "^1.4.14"
} }
}, },
"node_modules/@ldo/dataset": {
"version": "1.0.0-alpha.30",
"resolved": "https://registry.npmjs.org/@ldo/dataset/-/dataset-1.0.0-alpha.30.tgz",
"integrity": "sha512-XKGtsOULCZ32AtNlGqNYGjaZADwJtIWuILmL12TWeWpjzSfEodpzudjx4Ux+SES56MflGVl5CNuazsyj9+/5Gg==",
"license": "MIT",
"dependencies": {
"@ldo/rdf-utils": "^1.0.0-alpha.30",
"@rdfjs/dataset": "^1.1.0",
"buffer": "^6.0.3",
"readable-stream": "^4.2.0"
}
},
"node_modules/@ldo/jsonld-dataset-proxy": {
"version": "1.0.0-alpha.32",
"resolved": "https://registry.npmjs.org/@ldo/jsonld-dataset-proxy/-/jsonld-dataset-proxy-1.0.0-alpha.32.tgz",
"integrity": "sha512-ll8jOP6L6sCEce73PNkBZWhs+GmDE1vNsg/7fRv6eqROZJOhOqHTs74/qkvyOTzRVVOthIB0MMoRva4kE96r2Q==",
"license": "MIT",
"dependencies": {
"@ldo/rdf-utils": "^1.0.0-alpha.30",
"@ldo/subscribable-dataset": "^1.0.0-alpha.32",
"jsonld2graphobject": "^0.0.4"
}
},
"node_modules/@ldo/ldo": {
"version": "1.0.0-alpha.32",
"resolved": "https://registry.npmjs.org/@ldo/ldo/-/ldo-1.0.0-alpha.32.tgz",
"integrity": "sha512-B5yEKAjpQA4VbXOv3faxYYxjgDZUSxTy4vCSATpVvGt96RxolJzewJ7ELl0C2KG0EANcWoHyUB0ac7oOJrmUCQ==",
"license": "MIT",
"dependencies": {
"@ldo/dataset": "^1.0.0-alpha.30",
"@ldo/jsonld-dataset-proxy": "^1.0.0-alpha.32",
"@ldo/subscribable-dataset": "^1.0.0-alpha.32",
"buffer": "^6.0.3",
"readable-stream": "^4.3.0"
}
},
"node_modules/@ldo/rdf-utils": {
"version": "1.0.0-alpha.30",
"resolved": "https://registry.npmjs.org/@ldo/rdf-utils/-/rdf-utils-1.0.0-alpha.30.tgz",
"integrity": "sha512-nYCaf//tysYOhQfj1SmYTvuRzAK1VCENMOFYJlF0oNKIK/pEqXOkxFKt8yhkNEZ5e9BZ5ofLmGFeyj3OLiYivw==",
"license": "MIT",
"dependencies": {
"@rdfjs/data-model": "^1.2.0",
"n3": "^1.17.1",
"rdf-string": "^1.6.3"
}
},
"node_modules/@ldo/subscribable-dataset": {
"version": "1.0.0-alpha.32",
"resolved": "https://registry.npmjs.org/@ldo/subscribable-dataset/-/subscribable-dataset-1.0.0-alpha.32.tgz",
"integrity": "sha512-E42L2tDRxqOx5vxLGG0HiuZ6SMdW9iothJcFREV4f92kE9KE+l+Ope9hpfAmRfyNMdAEbl1wvW2iCfyj/J5naw==",
"license": "MIT",
"dependencies": {
"@ldo/dataset": "^1.0.0-alpha.30",
"@ldo/rdf-utils": "^1.0.0-alpha.30",
"uuid": "^11.1.0"
}
},
"node_modules/@oslojs/encoding": { "node_modules/@oslojs/encoding": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/@oslojs/encoding/-/encoding-1.1.0.tgz", "resolved": "https://registry.npmjs.org/@oslojs/encoding/-/encoding-1.1.0.tgz",
@ -1430,6 +1490,39 @@
"integrity": "sha512-wwQAWhWSuHaag8c4q/KN/vCoeOJYshAIvMQwD4GpSb3OiZklFfvAgmj0VCBBImRpuF/aFgIRzllXlVX93Jevww==", "integrity": "sha512-wwQAWhWSuHaag8c4q/KN/vCoeOJYshAIvMQwD4GpSb3OiZklFfvAgmj0VCBBImRpuF/aFgIRzllXlVX93Jevww==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/@rdfjs/data-model": {
"version": "1.3.4",
"resolved": "https://registry.npmjs.org/@rdfjs/data-model/-/data-model-1.3.4.tgz",
"integrity": "sha512-iKzNcKvJotgbFDdti7GTQDCYmL7GsGldkYStiP0K8EYtN7deJu5t7U11rKTz+nR7RtesUggT+lriZ7BakFv8QQ==",
"license": "MIT",
"dependencies": {
"@rdfjs/types": ">=1.0.1"
},
"bin": {
"rdfjs-data-model-test": "bin/test.js"
}
},
"node_modules/@rdfjs/dataset": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@rdfjs/dataset/-/dataset-1.1.1.tgz",
"integrity": "sha512-BNwCSvG0cz0srsG5esq6CQKJc1m8g/M0DZpLuiEp0MMpfwguXX7VeS8TCg4UUG3DV/DqEvhy83ZKSEjdsYseeA==",
"license": "MIT",
"dependencies": {
"@rdfjs/data-model": "^1.2.0"
},
"bin": {
"rdfjs-dataset-test": "bin/test.js"
}
},
"node_modules/@rdfjs/types": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/@rdfjs/types/-/types-2.0.1.tgz",
"integrity": "sha512-uyAzpugX7KekAXAHq26m3JlUIZJOC0uSBhpnefGV5i15bevDyyejoB7I+9MKeUrzXD8OOUI3+4FeV1wwQr5ihA==",
"license": "MIT",
"dependencies": {
"@types/node": "*"
}
},
"node_modules/@rolldown/pluginutils": { "node_modules/@rolldown/pluginutils": {
"version": "1.0.0-beta.27", "version": "1.0.0-beta.27",
"resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-beta.27.tgz", "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-beta.27.tgz",
@ -1670,6 +1763,21 @@
"@types/unist": "*" "@types/unist": "*"
} }
}, },
"node_modules/@types/http-link-header": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/@types/http-link-header/-/http-link-header-1.0.7.tgz",
"integrity": "sha512-snm5oLckop0K3cTDAiBnZDy6ncx9DJ3mCRDvs42C884MbVYPP74Tiq2hFsSDRTyjK6RyDYDIulPiW23ge+g5Lw==",
"license": "MIT",
"dependencies": {
"@types/node": "*"
}
},
"node_modules/@types/jsonld": {
"version": "1.5.15",
"resolved": "https://registry.npmjs.org/@types/jsonld/-/jsonld-1.5.15.tgz",
"integrity": "sha512-PlAFPZjL+AuGYmwlqwKEL0IMP8M8RexH0NIPGfCVWSQ041H2rR/8OlyZSD7KsCVoN8vCfWdtWDBxX8yBVP+xow==",
"license": "MIT"
},
"node_modules/@types/mdast": { "node_modules/@types/mdast": {
"version": "4.0.4", "version": "4.0.4",
"resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-4.0.4.tgz", "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-4.0.4.tgz",
@ -1715,6 +1823,12 @@
"@types/react": "^19.0.0" "@types/react": "^19.0.0"
} }
}, },
"node_modules/@types/shexj": {
"version": "2.1.7",
"resolved": "https://registry.npmjs.org/@types/shexj/-/shexj-2.1.7.tgz",
"integrity": "sha512-pu/0vIZxFTMPVjTlo5MJKFkBL/EbAuFhtCXpmBB7ZdUiyNpc6pt8GxfyRPqdf6q2SsWu71a/vbhvGK2IZN2Eug==",
"license": "MIT"
},
"node_modules/@types/unist": { "node_modules/@types/unist": {
"version": "3.0.3", "version": "3.0.3",
"resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz", "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz",
@ -2063,6 +2177,18 @@
"version": "3.5.19", "version": "3.5.19",
"license": "MIT" "license": "MIT"
}, },
"node_modules/abort-controller": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz",
"integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==",
"license": "MIT",
"dependencies": {
"event-target-shim": "^5.0.0"
},
"engines": {
"node": ">=6.5"
}
},
"node_modules/acorn": { "node_modules/acorn": {
"version": "8.15.0", "version": "8.15.0",
"license": "MIT", "license": "MIT",
@ -2541,6 +2667,30 @@
"node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"
} }
}, },
"node_modules/buffer": {
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz",
"integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
],
"license": "MIT",
"dependencies": {
"base64-js": "^1.3.1",
"ieee754": "^1.2.1"
}
},
"node_modules/bundle-name": { "node_modules/bundle-name": {
"version": "4.1.0", "version": "4.1.0",
"resolved": "https://registry.npmjs.org/bundle-name/-/bundle-name-4.1.0.tgz", "resolved": "https://registry.npmjs.org/bundle-name/-/bundle-name-4.1.0.tgz",
@ -3192,12 +3342,30 @@
"version": "2.0.2", "version": "2.0.2",
"license": "MIT" "license": "MIT"
}, },
"node_modules/event-target-shim": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz",
"integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==",
"license": "MIT",
"engines": {
"node": ">=6"
}
},
"node_modules/eventemitter3": { "node_modules/eventemitter3": {
"version": "5.0.1", "version": "5.0.1",
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz",
"integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==", "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/events": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz",
"integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==",
"license": "MIT",
"engines": {
"node": ">=0.8.x"
}
},
"node_modules/execa": { "node_modules/execa": {
"version": "9.6.0", "version": "9.6.0",
"resolved": "https://registry.npmjs.org/execa/-/execa-9.6.0.tgz", "resolved": "https://registry.npmjs.org/execa/-/execa-9.6.0.tgz",
@ -3621,6 +3789,15 @@
"integrity": "sha512-dTxcvPXqPvXBQpq5dUr6mEMJX4oIEFv6bwom3FDwKRDsuIjjJGANqhBuoAn9c1RQJIdAKav33ED65E2ys+87QQ==", "integrity": "sha512-dTxcvPXqPvXBQpq5dUr6mEMJX4oIEFv6bwom3FDwKRDsuIjjJGANqhBuoAn9c1RQJIdAKav33ED65E2ys+87QQ==",
"license": "BSD-2-Clause" "license": "BSD-2-Clause"
}, },
"node_modules/http-link-header": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/http-link-header/-/http-link-header-1.1.3.tgz",
"integrity": "sha512-3cZ0SRL8fb9MUlU3mKM61FcQvPfXx2dBrZW3Vbg5CXa8jFlK8OaEpePenLe1oEXQduhz8b0QjsqfS59QP4AJDQ==",
"license": "MIT",
"engines": {
"node": ">=6.0.0"
}
},
"node_modules/human-signals": { "node_modules/human-signals": {
"version": "8.0.1", "version": "8.0.1",
"resolved": "https://registry.npmjs.org/human-signals/-/human-signals-8.0.1.tgz", "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-8.0.1.tgz",
@ -3630,6 +3807,26 @@
"node": ">=18.18.0" "node": ">=18.18.0"
} }
}, },
"node_modules/ieee754": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
"integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
],
"license": "BSD-3-Clause"
},
"node_modules/import-meta-resolve": { "node_modules/import-meta-resolve": {
"version": "4.1.0", "version": "4.1.0",
"resolved": "https://registry.npmjs.org/import-meta-resolve/-/import-meta-resolve-4.1.0.tgz", "resolved": "https://registry.npmjs.org/import-meta-resolve/-/import-meta-resolve-4.1.0.tgz",
@ -3837,6 +4034,67 @@
"graceful-fs": "^4.1.6" "graceful-fs": "^4.1.6"
} }
}, },
"node_modules/jsonld-context-parser": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/jsonld-context-parser/-/jsonld-context-parser-2.4.0.tgz",
"integrity": "sha512-ZYOfvh525SdPd9ReYY58dxB3E2RUEU4DJ6ZibO8AitcowPeBH4L5rCAitE2om5G1P+HMEgYEYEr4EZKbVN4tpA==",
"license": "MIT",
"dependencies": {
"@types/http-link-header": "^1.0.1",
"@types/node": "^18.0.0",
"cross-fetch": "^3.0.6",
"http-link-header": "^1.0.2",
"relative-to-absolute-iri": "^1.0.5"
},
"bin": {
"jsonld-context-parse": "bin/jsonld-context-parse.js"
}
},
"node_modules/jsonld-context-parser/node_modules/@types/node": {
"version": "18.19.124",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.124.tgz",
"integrity": "sha512-hY4YWZFLs3ku6D2Gqo3RchTd9VRCcrjqp/I0mmohYeUVA5Y8eCXKJEasHxLAJVZRJuQogfd1GiJ9lgogBgKeuQ==",
"license": "MIT",
"dependencies": {
"undici-types": "~5.26.4"
}
},
"node_modules/jsonld-context-parser/node_modules/undici-types": {
"version": "5.26.5",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz",
"integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==",
"license": "MIT"
},
"node_modules/jsonld2graphobject": {
"version": "0.0.4",
"resolved": "https://registry.npmjs.org/jsonld2graphobject/-/jsonld2graphobject-0.0.4.tgz",
"integrity": "sha512-7siWYw9/EaD9lWyMbHr2uLMy8kbNVyOtDlsAWJUlUjVfXpcJcwLN6f0qeNt0ySV4fDoAJOjJXNvo7V/McrubAg==",
"license": "MIT",
"dependencies": {
"@rdfjs/types": "^1.0.1",
"@types/jsonld": "^1.5.6",
"jsonld-context-parser": "^2.1.5",
"uuid": "^8.3.2"
}
},
"node_modules/jsonld2graphobject/node_modules/@rdfjs/types": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/@rdfjs/types/-/types-1.1.2.tgz",
"integrity": "sha512-wqpOJK1QCbmsGNtyzYnojPU8gRDPid2JO0Q0kMtb4j65xhCK880cnKAfEOwC+dX85VJcCByQx5zOwyyfCjDJsg==",
"license": "MIT",
"dependencies": {
"@types/node": "*"
}
},
"node_modules/jsonld2graphobject/node_modules/uuid": {
"version": "8.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
"license": "MIT",
"bin": {
"uuid": "dist/bin/uuid"
}
},
"node_modules/kleur": { "node_modules/kleur": {
"version": "4.1.5", "version": "4.1.5",
"resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.5.tgz", "resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.5.tgz",
@ -4734,6 +4992,19 @@
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/n3": {
"version": "1.26.0",
"resolved": "https://registry.npmjs.org/n3/-/n3-1.26.0.tgz",
"integrity": "sha512-SQknS0ua90rN+3RHuk8BeIqeYyqIH/+ecViZxX08jR4j6MugqWRjtONl3uANG/crWXnOM2WIqBJtjIhVYFha+w==",
"license": "MIT",
"dependencies": {
"buffer": "^6.0.3",
"readable-stream": "^4.0.0"
},
"engines": {
"node": ">=12.0"
}
},
"node_modules/nanoid": { "node_modules/nanoid": {
"version": "3.3.11", "version": "3.3.11",
"funding": [ "funding": [
@ -7634,6 +7905,15 @@
"node": ">=6" "node": ">=6"
} }
}, },
"node_modules/process": {
"version": "0.11.10",
"resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
"integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==",
"license": "MIT",
"engines": {
"node": ">= 0.6.0"
}
},
"node_modules/prompts": { "node_modules/prompts": {
"version": "2.4.2", "version": "2.4.2",
"resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz",
@ -7672,6 +7952,34 @@
"integrity": "sha512-b484I/7b8rDEdSDKckSSBA8knMpcdsXudlE/LNL639wFoHKwLbEkQFZHWEYwDC0wa0FKUcCY+GAF73Z7wxNVFA==", "integrity": "sha512-b484I/7b8rDEdSDKckSSBA8knMpcdsXudlE/LNL639wFoHKwLbEkQFZHWEYwDC0wa0FKUcCY+GAF73Z7wxNVFA==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/rdf-data-factory": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/rdf-data-factory/-/rdf-data-factory-1.1.3.tgz",
"integrity": "sha512-ny6CI7m2bq4lfQQmDYvcb2l1F9KtGwz9chipX4oWu2aAtVoXjb7k3d8J1EsgAsEbMXnBipB/iuRen5H2fwRWWQ==",
"license": "MIT",
"dependencies": {
"@rdfjs/types": "^1.0.0"
}
},
"node_modules/rdf-data-factory/node_modules/@rdfjs/types": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/@rdfjs/types/-/types-1.1.2.tgz",
"integrity": "sha512-wqpOJK1QCbmsGNtyzYnojPU8gRDPid2JO0Q0kMtb4j65xhCK880cnKAfEOwC+dX85VJcCByQx5zOwyyfCjDJsg==",
"license": "MIT",
"dependencies": {
"@types/node": "*"
}
},
"node_modules/rdf-string": {
"version": "1.6.3",
"resolved": "https://registry.npmjs.org/rdf-string/-/rdf-string-1.6.3.tgz",
"integrity": "sha512-HIVwQ2gOqf+ObsCLSUAGFZMIl3rh9uGcRf1KbM85UDhKqP+hy6qj7Vz8FKt3GA54RiThqK3mNcr66dm1LP0+6g==",
"license": "MIT",
"dependencies": {
"@rdfjs/types": "*",
"rdf-data-factory": "^1.1.0"
}
},
"node_modules/react": { "node_modules/react": {
"version": "19.1.1", "version": "19.1.1",
"license": "MIT", "license": "MIT",
@ -7698,6 +8006,22 @@
"node": ">=0.10.0" "node": ">=0.10.0"
} }
}, },
"node_modules/readable-stream": {
"version": "4.7.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.7.0.tgz",
"integrity": "sha512-oIGGmcpTLwPga8Bn6/Z75SVaH1z5dUut2ibSyAMVhmUggWpmDn2dapB0n7f8nwaSiRtepAsfJyfXIO5DCVAODg==",
"license": "MIT",
"dependencies": {
"abort-controller": "^3.0.0",
"buffer": "^6.0.3",
"events": "^3.3.0",
"process": "^0.11.10",
"string_decoder": "^1.3.0"
},
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
}
},
"node_modules/readdirp": { "node_modules/readdirp": {
"version": "4.1.2", "version": "4.1.2",
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz",
@ -7796,6 +8120,12 @@
"url": "https://opencollective.com/unified" "url": "https://opencollective.com/unified"
} }
}, },
"node_modules/relative-to-absolute-iri": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/relative-to-absolute-iri/-/relative-to-absolute-iri-1.0.7.tgz",
"integrity": "sha512-Xjyl4HmIzg2jzK/Un2gELqbcE8Fxy85A/aLSHE6PE/3+OGsFwmKVA1vRyGaz6vLWSqLDMHA+5rjD/xbibSQN1Q==",
"license": "MIT"
},
"node_modules/remark-gfm": { "node_modules/remark-gfm": {
"version": "4.0.1", "version": "4.0.1",
"resolved": "https://registry.npmjs.org/remark-gfm/-/remark-gfm-4.0.1.tgz", "resolved": "https://registry.npmjs.org/remark-gfm/-/remark-gfm-4.0.1.tgz",
@ -7999,6 +8329,26 @@
"url": "https://github.com/sponsors/sindresorhus" "url": "https://github.com/sponsors/sindresorhus"
} }
}, },
"node_modules/safe-buffer": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
],
"license": "MIT"
},
"node_modules/scheduler": { "node_modules/scheduler": {
"version": "0.26.0", "version": "0.26.0",
"license": "MIT" "license": "MIT"
@ -8238,6 +8588,15 @@
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/string_decoder": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
"integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
"license": "MIT",
"dependencies": {
"safe-buffer": "~5.2.0"
}
},
"node_modules/string-width": { "node_modules/string-width": {
"version": "7.2.0", "version": "7.2.0",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz", "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz",
@ -8859,6 +9218,19 @@
"browserslist": ">= 4.21.0" "browserslist": ">= 4.21.0"
} }
}, },
"node_modules/uuid": {
"version": "11.1.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-11.1.0.tgz",
"integrity": "sha512-0/A9rDy9P7cJ+8w1c9WD9V//9Wj15Ce2MPz8Ri6032usz+NfePxx5AcN3bN+r6ZL6jEo066/yNYB3tn4pQEx+A==",
"funding": [
"https://github.com/sponsors/broofa",
"https://github.com/sponsors/ctavan"
],
"license": "MIT",
"bin": {
"uuid": "dist/esm/bin/uuid"
}
},
"node_modules/vfile": { "node_modules/vfile": {
"version": "6.0.3", "version": "6.0.3",
"resolved": "https://registry.npmjs.org/vfile/-/vfile-6.0.3.tgz", "resolved": "https://registry.npmjs.org/vfile/-/vfile-6.0.3.tgz",

@ -20,8 +20,10 @@
"@gn8/alien-signals-solid": "^0.1.1", "@gn8/alien-signals-solid": "^0.1.1",
"@gn8/alien-signals-svelte": "^0.1.1", "@gn8/alien-signals-svelte": "^0.1.1",
"@gn8/alien-signals-vue": "^0.1.1", "@gn8/alien-signals-vue": "^0.1.1",
"@ldo/ldo": "^1.0.0-alpha.32",
"@types/react": "19.1.10", "@types/react": "19.1.10",
"@types/react-dom": "19.1.7", "@types/react-dom": "19.1.7",
"@types/shexj": "^2.1.7",
"alien-deepsignals": "^0.1.0", "alien-deepsignals": "^0.1.0",
"alien-signals": "^2.0.7", "alien-signals": "^2.0.7",
"astro": "5.13.2", "astro": "5.13.2",

@ -1,14 +1,16 @@
import React from "react"; import React from "react";
import useShape from "../../ng-mock/js-land/frontendAdapters/react/useShape"; import useShape from "../../ng-mock/js-land/frontendAdapters/react/useShape";
import flattenObject from "../utils/flattenObject"; import flattenObject from "../utils/flattenObject";
import { TestObjectShapeType } from "src/shapes/ldo/testShape.shapeTypes";
import type { TestObject } from "src/shapes/ldo/testShape.typings";
export function HelloWorldReact() { export function HelloWorldReact() {
const state = useShape("TestShape", ""); const state = useShape(TestObjectShapeType);
// @ts-expect-error // @ts-expect-error
window.reactState = state; window.reactState = state;
if (!state) return <>Loading state</>; if (!("id" in state)) return <>Loading state</>;
// Create a table from the state object: One column for keys, one for values, one with an input to change the value. // Create a table from the state object: One column for keys, one for values, one with an input to change the value.
@ -16,6 +18,8 @@ export function HelloWorldReact() {
<div> <div>
<p>Rendered in React</p> <p>Rendered in React</p>
<button onClick={() => state}>click me to change multiple props</button>
<table border={1} cellPadding={5}> <table border={1} cellPadding={5}>
<thead> <thead>
<tr> <tr>

@ -1,8 +1,9 @@
<script lang="ts"> <script lang="ts">
import { TestObjectShapeType } from "src/shapes/ldo/testShape.shapeTypes";
import useShape from "../../ng-mock/js-land/frontendAdapters/svelte/useShape.svelte"; import useShape from "../../ng-mock/js-land/frontendAdapters/svelte/useShape.svelte";
import flattenObject from "../utils/flattenObject"; import flattenObject from "../utils/flattenObject";
const shapeObject = useShape("TestShape"); const shapeObject = useShape(TestObjectShapeType);
function getNestedValue(obj: any, path: string) { function getNestedValue(obj: any, path: string) {
return path return path

@ -2,9 +2,10 @@
import { computed } from 'vue'; import { computed } from 'vue';
import useShape from '../../ng-mock/js-land/frontendAdapters/vue/useShape'; import useShape from '../../ng-mock/js-land/frontendAdapters/vue/useShape';
import flattenObject from '../utils/flattenObject'; import flattenObject from '../utils/flattenObject';
import { TestObjectShapeType } from 'src/shapes/ldo/testShape.shapeTypes';
// Acquire deep signal object (proxy) for a shape; scope second arg left empty string for parity // Acquire deep signal object (proxy) for a shape; scope second arg left empty string for parity
const shapeObj = useShape('TestShape', ''); const shapeObj = useShape(TestObjectShapeType);
// Expose for devtools exploration // Expose for devtools exploration
// @ts-ignore // @ts-ignore

@ -3,16 +3,15 @@ import type { Connection, Diff, Scope, Shape } from "../types";
import requestShape from "src/ng-mock/wasm-land/requestShape"; import requestShape from "src/ng-mock/wasm-land/requestShape";
import { applyDiff } from "./applyDiff"; import { applyDiff } from "./applyDiff";
import { deepSignal, watch, batch } from "alien-deepsignals"; import { deepSignal, watch, batch } from "alien-deepsignals";
import type { DeepPatch } from "alien-deepsignals"; import type { DeepPatch, DeepSignalObject } from "alien-deepsignals";
import type { CompactShapeType } from "node_modules/@ldo/ldo/dist/types/ShapeType";
import type { LdoCompactBase } from "@ldo/ldo";
type ShapeObject = Record<string, any>; interface PoolEntry<T extends LdoCompactBase> {
type ShapeObjectSignal = ReturnType<typeof deepSignal<ShapeObject>>;
interface PoolEntry {
key: string; key: string;
shape: Shape; shape: CompactShapeType<T>;
scopeKey: string; scopeKey: string;
signalObject: ShapeObjectSignal; signalObject: DeepSignalObject<T | {}>;
refCount: number; refCount: number;
stopListening: (() => void) | null; stopListening: (() => void) | null;
registerCleanup?: (fn: () => void) => void; registerCleanup?: (fn: () => void) => void;
@ -22,7 +21,7 @@ interface PoolEntry {
suspendDeepWatcher: boolean; suspendDeepWatcher: boolean;
} }
const pool = new Map<string, PoolEntry>(); const pool = new Map<string, PoolEntry<any>>();
function canonicalScope(scope: Scope | undefined): string { function canonicalScope(scope: Scope | undefined): string {
if (scope == null) return ""; if (scope == null) return "";
@ -36,8 +35,8 @@ export function deepPatchesToDiff(patches: DeepPatch[]): Diff {
}) as Diff; }) as Diff;
} }
export function createSignalObjectForShape( export function createSignalObjectForShape<T extends LdoCompactBase>(
shape: Shape, shape: CompactShapeType<T>,
scope?: Scope, scope?: Scope,
poolSignal = true poolSignal = true
) { ) {
@ -52,10 +51,10 @@ export function createSignalObjectForShape(
} }
} }
const signalObject = deepSignal<ShapeObject>({}); const signalObject = deepSignal<T | {}>({});
let resolveReady!: (id: string) => void; let resolveReady!: (id: string) => void;
const ready = new Promise<string>((res) => (resolveReady = res)); const ready = new Promise<string>((res) => (resolveReady = res));
const entry: PoolEntry = { const entry: PoolEntry<T> = {
key, key,
shape, shape,
scopeKey, scopeKey,
@ -102,9 +101,7 @@ export function createSignalObjectForShape(
} }
); );
return buildReturn(entry); function buildReturn(entry: PoolEntry<T>) {
function buildReturn(entry: PoolEntry) {
const release = () => { const release = () => {
if (entry.refCount > 0) entry.refCount--; if (entry.refCount > 0) entry.refCount--;
if (entry.refCount === 0) { if (entry.refCount === 0) {
@ -122,4 +119,6 @@ export function createSignalObjectForShape(
registerCleanup: entry.registerCleanup, registerCleanup: entry.registerCleanup,
}; };
} }
return buildReturn(entry);
} }

@ -1 +0,0 @@
export * from "./useDeepSignal";

@ -1,12 +1,17 @@
import type { LdoCompactBase } from "@ldo/ldo";
import { watch } from "alien-deepsignals"; import { watch } from "alien-deepsignals";
import type { CompactShapeType } from "@ldo/ldo";
import { useEffect, useRef, useState } from "react"; import { useEffect, useRef, useState } from "react";
import { createSignalObjectForShape } from "src/ng-mock/js-land/connector/createSignalObjectForShape"; import { createSignalObjectForShape } from "src/ng-mock/js-land/connector/createSignalObjectForShape";
import type { Scope, Shape } from "src/ng-mock/js-land/types"; import type { Scope, Shape } from "src/ng-mock/js-land/types";
const useShape = (shape: Shape, scope: Scope) => { const useShape = <T extends LdoCompactBase>(
const shapeSignalRef = useRef<ReturnType<typeof createSignalObjectForShape>>( shape: CompactShapeType<T>,
createSignalObjectForShape(shape, scope) scope: Scope = ""
); ) => {
const shapeSignalRef = useRef<
ReturnType<typeof createSignalObjectForShape<T>>
>(createSignalObjectForShape(shape, scope));
const [, setTick] = useState(0); const [, setTick] = useState(0);
useEffect(() => { useEffect(() => {

@ -7,6 +7,8 @@ import {
getDeepSignalRootId, getDeepSignalRootId,
type DeepPatch, type DeepPatch,
} from "alien-deepsignals"; } from "alien-deepsignals";
import type { CompactShapeType } from "@ldo/ldo";
import type { LdoCompactBase } from "@ldo/ldo";
/** Base result contract for a deepSignal-backed Svelte integration. */ /** Base result contract for a deepSignal-backed Svelte integration. */
export interface UseDeepSignalResult<T = any> extends Readable<T> { export interface UseDeepSignalResult<T = any> extends Readable<T> {
@ -87,10 +89,10 @@ export interface UseShapeRuneResult<T = any> extends UseDeepSignalResult<T> {
/** /**
* Shape-specific rune: constructs the signal object for a shape then delegates to {@link useDeepSignal}. * Shape-specific rune: constructs the signal object for a shape then delegates to {@link useDeepSignal}.
*/ */
export function useShapeRune<T = any>( export function useShapeRune<T extends LdoCompactBase>(
shape: Shape, shape: CompactShapeType<T>,
scope?: Scope scope?: Scope
): UseShapeRuneResult<T> { ): UseShapeRuneResult<T | {}> {
const { signalObject: rootSignal, stop } = createSignalObjectForShape( const { signalObject: rootSignal, stop } = createSignalObjectForShape(
shape, shape,
scope scope

@ -1,3 +0,0 @@
export * from "./useDeepSignal";
export { default as useDeepSignal } from "./useDeepSignal";
export { default as useShape } from "./useShape";

@ -2,10 +2,13 @@ import { createSignalObjectForShape } from "src/ng-mock/js-land/connector/create
import type { Scope, Shape } from "src/ng-mock/js-land/types"; import type { Scope, Shape } from "src/ng-mock/js-land/types";
import useDeepSignal from "./useDeepSignal"; import useDeepSignal from "./useDeepSignal";
import { onBeforeUnmount } from "vue"; import { onBeforeUnmount } from "vue";
import type { CompactShapeType } from "node_modules/@ldo/ldo/dist/types/ShapeType";
import type { LdoCompactBase } from "@ldo/ldo";
/** export function useShape<T extends LdoCompactBase>(
*/ shape: CompactShapeType<T>,
export function useShape(shape: Shape, scope?: Scope) { scope?: Scope
) {
const handle = createSignalObjectForShape(shape, scope); const handle = createSignalObjectForShape(shape, scope);
// Cleanup // Cleanup

@ -1,5 +1,5 @@
import { describe, expect, test } from "vitest"; import { describe, expect, test } from "vitest";
import { createSignalObjectForShape } from "../js-land/connector/createSignalObjectForShape"; import { createSignalObjectForShape } from "../js-land/connector/createSignalObjectForShape.ts";
const wait = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); const wait = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));

@ -1,22 +1,34 @@
import * as shapeManager from "./shapeManager"; import * as shapeManager from "./shapeManager";
import type { WasmConnection, Diff, Scope } from "./types"; import type { WasmConnection, Diff, Scope } from "./types";
import type { Shape } from "../js-land/types"; import type { CompactShapeType } from "@ldo/ldo";
import type { LdoCompactBase } from "@ldo/ldo";
import type { Person } from "src/shapes/ldo/personShape.typings";
import type { Cat } from "src/shapes/ldo/catShape.typings";
import type { TestObject } from "src/shapes/ldo/testShape.typings";
export const mockTestObject = { export const mockTestObject = {
type: "TestObject", type: "TestObject",
stringValue: "string", stringValue: "string",
numValue: 42, numValue: 42,
boolValue: true, boolValue: true,
nullValue: null, arrayValue: new Set([1, 2, 3]),
arrayValue: [1, 2, 3],
objectValue: { objectValue: {
nestedString: "nested", nestedString: "nested",
nestedNum: 7, nestedNum: 7,
nestedArray: [10, 12], nestedArray: new Set([10, 12]),
}, },
// TODO: We can't test this right now because we serialize via JSON. anotherObject: {
setValue: new Set(["v1", "v2", "v3"]), "id:1": {
}; prop1: "prop1 value",
prop2: 100,
},
"id:2": {
prop1: "prop2 value",
prop2: 200,
},
},
} satisfies TestObject;
const mockShapeObject1 = { const mockShapeObject1 = {
type: "Person", type: "Person",
name: "Bob", name: "Bob",
@ -26,7 +38,7 @@ const mockShapeObject1 = {
}, },
hasChildren: true, hasChildren: true,
numberOfHouses: 0, numberOfHouses: 0,
}; } satisfies Person;
const mockShapeObject2 = { const mockShapeObject2 = {
type: "Cat", type: "Cat",
name: "Niko's cat", name: "Niko's cat",
@ -37,35 +49,46 @@ const mockShapeObject2 = {
houseNumber: "15", houseNumber: "15",
floor: 0, floor: 0,
}, },
}; } satisfies Cat;
const shapeNameToMockObject: Record<Shape, object> = {
Shape1: mockShapeObject1,
Shape2: mockShapeObject2,
TestShape: mockTestObject,
};
let connectionIdCounter = 1; let connectionIdCounter = 1;
export default async function requestShape( export default async function requestShape<T extends LdoCompactBase>(
shape: Shape, shape: CompactShapeType<T>,
scope: Scope | undefined, scope: Scope | undefined,
callback: (diff: Diff, connectionId: WasmConnection["id"]) => void callback: (diff: Diff, connectionId: WasmConnection["id"]) => void
): Promise<{ ): Promise<{
connectionId: string; connectionId: string;
shapeObject: object; shapeObject: T;
}> { }> {
const connection: WasmConnection = { const connectionId = `connection-${connectionIdCounter++}-${
id: String(connectionIdCounter++), shape.schema.shapes?.[0].id
}`;
let shapeObject: T;
if (shape.schema.shapes?.[0].id.includes("TestObject")) {
shapeObject = JSON.parse(JSON.stringify(mockTestObject)) as T;
} else if (shape.schema.shapes?.[0].id.includes("Person")) {
shapeObject = JSON.parse(JSON.stringify(mockShapeObject1)) as T;
} else if (shape.schema.shapes?.[0].id.includes("Cat")) {
shapeObject = JSON.parse(JSON.stringify(mockShapeObject2)) as T;
} else {
console.warn(
"BACKEND: requestShape for unknown shape, returning empty object.",
shape.schema.shapes?.[0].id
);
shapeObject = {};
}
shapeManager.connections.set(connectionId, {
id: connectionId,
shape, shape,
// Create a deep copy to prevent accidental by-reference changes. state: shapeObject,
state: JSON.parse(JSON.stringify(shapeNameToMockObject[shape])),
callback, callback,
}; });
shapeManager.connections.set(connection.id, connection);
return { return {
connectionId: connection.id, connectionId,
shapeObject: connection.state, shapeObject,
}; };
} }

@ -1,3 +1,4 @@
import type { CompactShapeType, LdoCompactBase } from "@ldo/ldo";
import type { Patch } from "../js-land/connector/applyDiff"; import type { Patch } from "../js-land/connector/applyDiff";
import type { Shape } from "../js-land/types"; import type { Shape } from "../js-land/types";
@ -10,9 +11,9 @@ export type Diff = Patch[];
export type ObjectState = object; export type ObjectState = object;
/** A connection established between wasm-land and js-land for subscription of a shape. */ /** A connection established between wasm-land and js-land for subscription of a shape. */
export type WasmConnection = { export type WasmConnection<T extends LdoCompactBase = LdoCompactBase> = {
id: string; id: string;
shape: Shape; shape: CompactShapeType<T>;
state: ObjectState; state: ObjectState;
callback: (diff: Diff, connectionId: WasmConnection["id"]) => void; callback: (diff: Diff, connectionId: WasmConnection["id"]) => void;
}; };

@ -0,0 +1,96 @@
import type { Schema } from "shexj";
/**
* =============================================================================
* catShapeSchema: ShexJ Schema for catShape
* =============================================================================
*/
export const catShapeSchema: Schema = {
type: "Schema",
shapes: [
{
id: "https://ldo.js.org/Cat",
type: "ShapeDecl",
shapeExpr: {
type: "Shape",
expression: {
type: "EachOf",
expressions: [
{
type: "TripleConstraint",
predicate: "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
valueExpr: {
type: "NodeConstraint",
values: [
{
value: "Cat",
},
],
},
},
{
type: "TripleConstraint",
predicate: "http://example.org/name",
valueExpr: {
type: "NodeConstraint",
datatype: "http://www.w3.org/2001/XMLSchema#string",
},
},
{
type: "TripleConstraint",
predicate: "http://example.org/age",
valueExpr: {
type: "NodeConstraint",
datatype: "http://www.w3.org/2001/XMLSchema#integer",
},
},
{
type: "TripleConstraint",
predicate: "http://example.org/numberOfHomes",
valueExpr: {
type: "NodeConstraint",
datatype: "http://www.w3.org/2001/XMLSchema#integer",
},
},
{
type: "TripleConstraint",
predicate: "http://example.org/address",
valueExpr: {
type: "Shape",
expression: {
type: "EachOf",
expressions: [
{
type: "TripleConstraint",
predicate: "http://example.org/street",
valueExpr: {
type: "NodeConstraint",
datatype: "http://www.w3.org/2001/XMLSchema#string",
},
},
{
type: "TripleConstraint",
predicate: "http://example.org/houseNumber",
valueExpr: {
type: "NodeConstraint",
datatype: "http://www.w3.org/2001/XMLSchema#string",
},
},
{
type: "TripleConstraint",
predicate: "http://example.org/floor",
valueExpr: {
type: "NodeConstraint",
datatype: "http://www.w3.org/2001/XMLSchema#integer",
},
},
],
},
},
},
],
},
},
},
],
};

@ -0,0 +1,9 @@
import type { CompactShapeType } from "@ldo/ldo";
import { catShapeSchema } from "./catShape.schema";
import type { Cat } from "./catShape.typings";
// Compact ShapeTypes for catShape
export const CatShapeType: CompactShapeType<Cat> = {
schema: catShapeSchema,
shape: "https://ldo.js.org/Cat",
};

@ -0,0 +1,47 @@
export type IRI = string;
/**
* =============================================================================
* Typescript Typings for catShape
* =============================================================================
*/
/**
* Cat Type
*/
export interface Cat {
id: IRI;
/**
* Original IRI: http://www.w3.org/1999/02/22-rdf-syntax-ns#type
*/
type: string;
/**
* Original IRI: http://example.org/name
*/
name: string;
/**
* Original IRI: http://example.org/age
*/
age: number;
/**
* Original IRI: http://example.org/numberOfHomes
*/
numberOfHomes: number;
/**
* Original IRI: http://example.org/address
*/
address: {
/**
* Original IRI: http://example.org/street
*/
street: string;
/**
* Original IRI: http://example.org/houseNumber
*/
houseNumber: string;
/**
* Original IRI: http://example.org/floor
*/
floor: number;
};
}

@ -0,0 +1,88 @@
import type { Schema } from "shexj";
/**
* =============================================================================
* personShapeSchema: ShexJ Schema for personShape
* =============================================================================
*/
export const personShapeSchema: Schema = {
type: "Schema",
shapes: [
{
id: "https://ldo.js.org/Person",
type: "ShapeDecl",
shapeExpr: {
type: "Shape",
expression: {
type: "EachOf",
expressions: [
{
type: "TripleConstraint",
predicate: "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
valueExpr: {
type: "NodeConstraint",
values: [
{
value: "Person",
},
],
},
},
{
type: "TripleConstraint",
predicate: "http://example.org/name",
valueExpr: {
type: "NodeConstraint",
datatype: "http://www.w3.org/2001/XMLSchema#string",
},
},
{
type: "TripleConstraint",
predicate: "http://example.org/address",
valueExpr: {
type: "Shape",
expression: {
type: "EachOf",
expressions: [
{
type: "TripleConstraint",
predicate: "http://example.org/street",
valueExpr: {
type: "NodeConstraint",
datatype: "http://www.w3.org/2001/XMLSchema#string",
},
},
{
type: "TripleConstraint",
predicate: "http://example.org/houseNumber",
valueExpr: {
type: "NodeConstraint",
datatype: "http://www.w3.org/2001/XMLSchema#string",
},
},
],
},
},
},
{
type: "TripleConstraint",
predicate: "http://example.org/hasChildren",
valueExpr: {
type: "NodeConstraint",
datatype: "http://www.w3.org/2001/XMLSchema#boolean",
},
},
{
type: "TripleConstraint",
predicate: "http://example.org/numberOfHouses",
valueExpr: {
type: "NodeConstraint",
datatype: "http://www.w3.org/2001/XMLSchema#integer",
},
},
],
},
},
},
],
};

@ -0,0 +1,9 @@
import type { CompactShapeType } from "@ldo/ldo";
import { personShapeSchema } from "./personShape.schema";
import type { Person } from "./personShape.typings";
// Compact ShapeTypes for personShape
export const PersonShapeType: CompactShapeType<Person> = {
schema: personShapeSchema,
shape: "https://ldo.js.org/Person",
};

@ -0,0 +1,43 @@
export type IRI = string;
/**
* =============================================================================
* Typescript Typings for personShape
* =============================================================================
*/
/**
* Person Type
*/
export interface Person {
id: IRI;
/**
* Original IRI: http://www.w3.org/1999/02/22-rdf-syntax-ns#type
*/
type: string;
/**
* Original IRI: http://example.org/name
*/
name: string;
/**
* Original IRI: http://example.org/address
*/
address: {
/**
* Original IRI: http://example.org/street
*/
street: string;
/**
* Original IRI: http://example.org/houseNumber
*/
houseNumber: string;
};
/**
* Original IRI: http://example.org/hasChildren
*/
hasChildren: boolean;
/**
* Original IRI: http://example.org/numberOfHouses
*/
numberOfHouses: number;
}

@ -0,0 +1,138 @@
import type { Schema } from "shexj";
/**
* =============================================================================
* testShapeSchema: ShexJ Schema for testShape
* =============================================================================
*/
export const testShapeSchema: Schema = {
type: "Schema",
shapes: [
{
id: "https://ldo.js.org/TestObject",
type: "ShapeDecl",
shapeExpr: {
type: "Shape",
expression: {
type: "EachOf",
expressions: [
{
type: "TripleConstraint",
predicate: "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
valueExpr: {
type: "NodeConstraint",
values: [
{
value: "TestObject",
},
],
},
},
{
type: "TripleConstraint",
predicate: "http://example.org/stringValue",
valueExpr: {
type: "NodeConstraint",
datatype: "http://www.w3.org/2001/XMLSchema#string",
},
},
{
type: "TripleConstraint",
predicate: "http://example.org/numValue",
valueExpr: {
type: "NodeConstraint",
datatype: "http://www.w3.org/2001/XMLSchema#integer",
},
},
{
type: "TripleConstraint",
predicate: "http://example.org/boolValue",
valueExpr: {
type: "NodeConstraint",
datatype: "http://www.w3.org/2001/XMLSchema#boolean",
},
},
{
type: "TripleConstraint",
predicate: "http://example.org/arrayValue",
valueExpr: {
type: "NodeConstraint",
datatype: "http://www.w3.org/2001/XMLSchema#integer",
},
min: 0,
max: -1,
},
{
type: "TripleConstraint",
predicate: "http://example.org/objectValue",
valueExpr: {
type: "Shape",
expression: {
type: "EachOf",
expressions: [
{
type: "TripleConstraint",
predicate: "http://example.org/nestedString",
valueExpr: {
type: "NodeConstraint",
datatype: "http://www.w3.org/2001/XMLSchema#string",
},
},
{
type: "TripleConstraint",
predicate: "http://example.org/nestedNum",
valueExpr: {
type: "NodeConstraint",
datatype: "http://www.w3.org/2001/XMLSchema#integer",
},
},
{
type: "TripleConstraint",
predicate: "http://example.org/nestedArray",
valueExpr: {
type: "NodeConstraint",
datatype: "http://www.w3.org/2001/XMLSchema#integer",
},
min: 0,
max: -1,
},
],
},
},
},
{
type: "TripleConstraint",
predicate: "http://example.org/anotherObject",
valueExpr: {
type: "Shape",
expression: {
type: "EachOf",
expressions: [
{
type: "TripleConstraint",
predicate: "http://example.org/prop1",
valueExpr: {
type: "NodeConstraint",
datatype: "http://www.w3.org/2001/XMLSchema#string",
},
},
{
type: "TripleConstraint",
predicate: "http://example.org/prop2",
valueExpr: {
type: "NodeConstraint",
datatype: "http://www.w3.org/2001/XMLSchema#integer",
},
},
],
},
},
min: 0,
max: -1,
},
],
},
},
},
],
};

@ -0,0 +1,9 @@
import type { CompactShapeType } from "@ldo/ldo";
import { testShapeSchema } from "./testShape.schema";
import type { TestObject } from "./testShape.typings";
// Compact ShapeTypes for testShape
export const TestObjectShapeType: CompactShapeType<TestObject> = {
schema: testShapeSchema,
shape: "https://ldo.js.org/TestObject",
};

@ -0,0 +1,68 @@
export type IRI = string;
/**
* =============================================================================
* Typescript Typings for testShape
* =============================================================================
*/
/**
* TestObject Type
*/
export interface TestObject {
id: IRI;
/**
* Original IRI: http://www.w3.org/1999/02/22-rdf-syntax-ns#type
*/
type: string;
/**
* Original IRI: http://example.org/stringValue
*/
stringValue: string;
/**
* Original IRI: http://example.org/numValue
*/
numValue: number;
/**
* Original IRI: http://example.org/boolValue
*/
boolValue: boolean;
/**
* Original IRI: http://example.org/arrayValue
*/
arrayValue?: Set<number>;
/**
* Original IRI: http://example.org/objectValue
*/
objectValue: {
/**
* Original IRI: http://example.org/nestedString
*/
nestedString: string;
/**
* Original IRI: http://example.org/nestedNum
*/
nestedNum: number;
/**
* Original IRI: http://example.org/nestedArray
*/
nestedArray?: Set<number>;
};
/**
* Original IRI: http://example.org/anotherObject
*/
anotherObject?: Record<
IRI,
{
id: IRI;
/**
* Original IRI: http://example.org/prop1
*/
prop1: string;
/**
* Original IRI: http://example.org/prop2
*/
prop2: number;
}
>;
}

@ -0,0 +1,15 @@
PREFIX ex: <http://example.org/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
<Cat> {
a ["Cat"] ;
ex:name xsd:string ;
ex:age xsd:integer ;
ex:numberOfHomes xsd:integer ;
ex:address {
ex:street xsd:string ;
ex:houseNumber xsd:string ;
ex:floor xsd:integer
}
}

@ -0,0 +1,14 @@
PREFIX ex: <http://example.org/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
<Person> {
a ["Person"] ;
ex:name xsd:string ;
ex:address {
ex:street xsd:string ;
ex:houseNumber xsd:string
} ;
ex:hasChildren xsd:boolean ;
ex:numberOfHouses xsd:integer
}

@ -0,0 +1,19 @@
PREFIX ex: <http://example.org/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
<TestObject> {
a ["TestObject"] ;
ex:stringValue xsd:string ;
ex:numValue xsd:integer ;
ex:boolValue xsd:boolean ;
ex:arrayValue xsd:integer* ;
ex:objectValue {
ex:nestedString xsd:string ;
ex:nestedNum xsd:integer ;
ex:nestedArray xsd:integer* ;
} ;
ex:anotherObject {
ex:prop1 xsd:string;
ex:prop2 xsd:integer
} * ;
}

@ -4,5 +4,7 @@
"jsx": "react-jsx", "jsx": "react-jsx",
"jsxImportSource": "react", "jsxImportSource": "react",
"baseUrl": "." "baseUrl": "."
} },
"include": [".astro/types.d.ts", "**/*"],
"exclude": ["dist"]
} }

Loading…
Cancel
Save