{"id":20631174,"url":"https://github.com/solidlabresearch/solid-sdx-ts","last_synced_at":"2025-08-18T11:43:59.015Z","repository":{"id":206417312,"uuid":"716584944","full_name":"SolidLabResearch/solid-sdx-ts","owner":"SolidLabResearch","description":null,"archived":false,"fork":false,"pushed_at":"2023-11-17T15:06:05.000Z","size":67,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-02-19T00:19:53.356Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SolidLabResearch.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-09T12:52:54.000Z","updated_at":"2023-11-09T13:04:12.000Z","dependencies_parsed_at":"2024-11-16T14:11:33.836Z","dependency_job_id":"a18c8155-1945-4f4c-ac29-c3c1f81758a2","html_url":"https://github.com/SolidLabResearch/solid-sdx-ts","commit_stats":null,"previous_names":["solidlabresearch/solid-sdx-ts"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SolidLabResearch%2Fsolid-sdx-ts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SolidLabResearch%2Fsolid-sdx-ts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SolidLabResearch%2Fsolid-sdx-ts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SolidLabResearch%2Fsolid-sdx-ts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SolidLabResearch","download_url":"https://codeload.github.com/SolidLabResearch/solid-sdx-ts/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242588427,"owners_count":20154203,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-16T14:11:23.739Z","updated_at":"2025-03-08T17:57:16.715Z","avatar_url":"https://github.com/SolidLabResearch.png","language":"TypeScript","readme":"# Solid Development eXperience (SDX) SDK\r\n\r\nThis library is meant to facilitate easy development of Solid applications. The library uses a (SDL) GraphQL Schema as input and generates a client proxy sdk from it, that can be imported and used to interact with data on a Solid Pod. \r\n\r\nThis enables a couple of features:\r\n\r\n* The generated schema can be used by any of your favorite GraphQL IDE plugins.\r\n* You can write your own GraphQL queries against data hosted on a targeted Solid Pod.\r\n* Your IDE's plugins can leverage the GraphQL Schema to generate IntelliSense suggestions when writing GraphQL Queries.\r\n* Your IDE's plugins can leverage the type information in the `sdk.generated.ts` file to generate IntelliSense suggestions while writing TypeScript code.\r\n* A fully typed SolidClient generated from your queries, can be used in your application\r\n\r\n*This library ideally works in tandem with the SDX cli library (@solidlab/solid-sdx-cli)*\r\n\r\n## Install\r\n\r\n```bash\r\nnpm install @solidlab/solid-sdx-ts\r\n```\r\n\r\n## Usage\r\n\r\n### Init sdx project\r\n```bash\r\n# Setup project with sdx cli and then install a shape package.\r\n\r\n#\r\n\r\n```\r\n\r\n\r\nThis triggers the following steps:\r\n\r\n    * Once the SHACL is downloaded, it is put in the `/src/.sdx-gen/shacl` folder. \r\n    * The GraphQL schema will be generated and written to `/src/.sdx-gen/graphql/schema.graphqls`.\r\n    * You can write queries and mutations in your `/src/gql` folder.\r\n    * This the queries and schema will be used to generate the `/src/sdx-gen/sdk.generated.ts` file.\r\n    * To create a SolidClient, import this file in your code.\r\n\r\n### Instantiate SolidClient\r\n\r\n```ts\r\nimport { SolidLDPBackend, SolidLDPContext, StaticTargetResolver } from '@solidlab/sdx-sdk';\r\nimport { getSolidClient, Sdk } from 'src/.sdx-gen/sdk.generated';\r\n\r\n// Create a backend that statically resolves to one (Pod) URI.\r\nconst resolver = new StaticTargetResolver('http://localhost:3000/complex.ttl'); \r\nconst defaultContext = new SolidLDPContext(resolver);\r\nconst { requester } = new SolidLDPBackend({ defaultContext });\r\n// Create the client with fully types support\r\nconst client: Sdk = getSolidClient(requester);\r\n```\r\n\r\n### Using the client\r\n\r\nAfter running `sdx generate sdk`, given these sample queries: \r\n\r\n**Queries example**\r\n```graphql\r\nquery listContacts {\r\n    contactCollection {\r\n        id\r\n        givenName\r\n        familyName\r\n    }\r\n}\r\n\r\nquery getContact($id: String!) {\r\n    contact(id: $id) {\r\n        id\r\n        givenName\r\n        familyName\r\n        address {\r\n            streetLine\r\n            postalCode\r\n            city\r\n            country\r\n        }\r\n    }\r\n}\r\n\r\nmutation createContact($id: ID, $givenName: String!, $familyName: String!) {\r\n    createContact(input: {id: $id, givenName: $givenName, familyName: $familyName}) {\r\n        id\r\n        givenName\r\n        familyName\r\n    }\r\n}\r\n```\r\n\r\nThe client can be used like this:\r\n\r\n```ts\r\nimport { SolidLDPBackend, SolidLDPContext } from '@solidlab/sdx-sdk';\r\nimport { Contact, getSolidClient, Sdk } from 'src/.sdx-gen/sdk.generated';\r\n\r\n// Create a backend that statically resolves to one (Pod) URI.\r\nconst resolver = new StaticTargetResolver('http://localhost:3000/complex.ttl'); \r\nconst defaultContext = new SolidLDPContext(resolver);\r\nconst { requester } = new SolidLDPBackend({ defaultContext });\r\n// Create the client with fully types support\r\nconst client: Sdk = getSolidClient(requester);\r\n\r\n// Use the client to read\r\nconst contacts = (await client.listContacts()).data;\r\ncontacts.forEach({givenName, familyName} =\u003e console.log(`${givenName} ${familyName}`));\r\n\r\nconst contact = (await client.getContact('http://example.org/cont/tdupont')).data;\r\nconsole.log(`${contact.givenName} ${contact.familyName}`);\r\n\r\n// Use the client to write\r\nawait client.createContact({\r\n    id: 'http://example.org/cont/jdoe',\r\n    givenName: 'John',\r\n    familyName: 'Doe'\r\n});\r\n```\r\n\r\n## Configuration\r\n\r\n\r\n**.sdxconfig**\r\n\r\n*This is actually configuration of the cli library, but some options here will generate a different Sdk format.*\r\n\r\n```json\r\n{\r\n    \"formatVersion\": \"1.0.0\",   // Format version for backwards compatibility and migration\r\n    \"catalogs\": [               // Catalogs to contact for searching and installing\r\n        {\r\n            \"name\": \"SolidLab Catalog\",\r\n            \"uri\": \"https://catalog.solidlab.be\"\r\n        }\r\n    ],\r\n    \"options\": {\r\n        \"autoGenerate\": true,   // Autogenerate again after each shape (un)install\r\n        \"resultEnvelope\": false // If true:  wrap in an `ExecutionResult` envelope with `data` and `error` keys.\r\n                                // If false: output only `data` value.\r\n    }\r\n}\r\n\r\n```\r\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolidlabresearch%2Fsolid-sdx-ts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsolidlabresearch%2Fsolid-sdx-ts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolidlabresearch%2Fsolid-sdx-ts/lists"}