-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from desci-labs/m0ar/social-handles
Re-model social handles
- Loading branch information
Showing
17 changed files
with
266 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
![DeSci Codex logotype](./codex.png) | ||
|
||
This repo contains a reference implementation for the next generation of the protocol, built on [Ceramic](https://ceramic.network/) and [ComposeDB](https://composedb.js.org/docs/0.5.x/introduction). It includes data models and an extensive test suite to ensure correct functionality, but also example data population and a GraphiQL interface to explore the protocol structure. | ||
|
||
The repo consists of several packages: | ||
- [the codex integration library](./packages/lib/README.md) | ||
- [composedb models and test env](./packages/composedb/README.md) | ||
- [a codex CLI](./packages/cli/README.md) | ||
|
||
|
||
By default, the tests and scripts run against a local Ceramic/ComposeDB node with the bundled IPFS server, uses the `inmemory` network for anchoring, and writes all data and logs to `local-data`. | ||
|
||
The protocol documentation can be found [here](https://codex.desci.com)! | ||
|
||
## Getting started | ||
|
||
1. Install dependencies: | ||
|
||
```bash | ||
nvm use # or otherwise ensure the use of node v20 | ||
npm ci # install deps | ||
``` | ||
|
||
> At this point, `make test` can be run to automatically setup a local environment and run the test suite. | ||
2. Generate your own seed, admin DID, and ComposeDB configuration file: | ||
|
||
```bash | ||
npm run -w packages/composedb generate | ||
``` | ||
|
||
3. Finally, start the services: | ||
|
||
```bash | ||
npm run -w packages/composedb dev | ||
``` | ||
|
||
This will start a composeDB node, compile the models into composites, and deploy the composites to a local network. Now, you can open [http://localhost:5001](http://localhost:5001) for the GraphiQL interface and explore the data models. This environment is what is being used in the tests. | ||
|
||
> Without running this step, the composite runtime definitions will not be available and hence typescript may be temporarily sad | ||
4. If you want to experiment with some actual queries, you can run this command to publish a bit of data from a couple of random DID's: | ||
|
||
```bash | ||
npm run -w packages/lib populate | ||
``` | ||
|
||
After this is done, your GraphQL queries should return some actual data! | ||
|
||
|
||
## Test suite | ||
|
||
There is a test suite running through API operations demonstrating the functional protocol requirements, by generating random DID's and performing create and mutation operations. Before each run, it will remove the remains of the last test execution. | ||
|
||
The test setup clones your user configuration, but changes storage to `local-data/ceramic-test` not to interfere with prepopulated data. It will refuse to run if `npm run dev` is already active. | ||
|
||
```bash | ||
make test | ||
``` | ||
|
||
### Stop hung services | ||
If the test doesn't exit nicely, there may be IPFS and Ceramic daemons still hanging around. When restarting the tests, it may nag about not wanting to clobber those services. If this happens, run: | ||
|
||
```bash | ||
make test-stop | ||
``` | ||
|
||
## Reset | ||
|
||
To reset to a clean state, deleting everything except generated seed and user config: | ||
|
||
```bash | ||
make clean | ||
``` | ||
|
||
## Feedback | ||
|
||
If you want to discuss any part of the protocol from a practical or theoretical perspective, come on in to our [Discord](https://discord.gg/A5P9fgB5Cf)! This is a community effort, and your thoughts and opinions will help shape its future. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
![DeSci Codex logotype](../../codex.png) | ||
|
||
# Codex CLI | ||
|
||
This package is a stub for a codex CLI, demonstrating that interaction with | ||
the protocol is possible without relying on any particular gateway. The only | ||
thing necessary is contact with a ceramic node. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
src/__generated__/* | ||
!src/__generates__/*.d.ts | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
![DeSci Codex logotype](/codex.png) | ||
# DeSci Codex - models and local test environment | ||
|
||
This package contains ComposeDB models for the codex entities, together with scripts and config for setting up a local test environment and compiling composites. | ||
|
||
## Getting started | ||
Follow the instructions in the [repo root](/README.md) and run `make test`, and everything should be set up correctly. | ||
|
||
### Editing models | ||
Change models in the `composites` directory. When running `npm dev`, they will be automatically compiled and deployed. | ||
|
||
### Adding models | ||
Add the model file in the `composites` directory, and update [`scripts/composites.ts`](scripts/composites.ts) with the new model in the compile and deployment chain. | ||
|
||
> The digits prefixing the file names indicate its level in the deployment DAG, as they may have dependencies on other models. So, all models starting with `1` has no dependencies. All starting with `2` have at least one dependency from the previous layer, and so on. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,8 @@ | ||
type Profile | ||
@createModel(accountRelation: SINGLE, description: "An author profile") | ||
@createIndex(fields: [{ path: "orcid" }]) | ||
@createIndex(fields: [{ path: "googleScholar" }]) | ||
@createIndex(fields: [{ path: "publicKey" }]) { | ||
{ | ||
owner: DID! @documentAccount | ||
version: CommitID! @documentVersion | ||
displayName: String! @string(maxLength: 256) | ||
# Should probably be generic key-value pairs, but that won't work with indexing | ||
# for filter and sort | ||
orcid: String @string(maxLength: 256) | ||
googleScholar: String @string(maxLength: 256) | ||
publicKey: String @string(maxLength: 512) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
type SocialHandle | ||
@createModel(accountRelation: LIST, description: "A social handle on other platforms") | ||
@createIndex(fields: [{ path: "platform"}]) | ||
@createIndex(fields: [{ path: "handle"}]) | ||
{ | ||
owner: DID! @documentAccount | ||
version: CommitID! @documentVersion | ||
platform: String! @string(maxLength: 256) | ||
handle: String! @string(maxLength: 256) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.