{"id":28396222,"url":"https://github.com/ssbc/ssb-thread-schema","last_synced_at":"2025-06-23T06:31:06.550Z","repository":{"id":35047653,"uuid":"200452409","full_name":"ssbc/ssb-thread-schema","owner":"ssbc","description":null,"archived":false,"fork":false,"pushed_at":"2022-02-12T11:12:23.000Z","size":150,"stargazers_count":4,"open_issues_count":7,"forks_count":0,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-06-09T15:53:13.166Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/ssbc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-08-04T05:09:48.000Z","updated_at":"2021-12-01T22:38:47.000Z","dependencies_parsed_at":"2022-08-08T04:01:27.996Z","dependency_job_id":null,"html_url":"https://github.com/ssbc/ssb-thread-schema","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/ssbc/ssb-thread-schema","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssbc%2Fssb-thread-schema","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssbc%2Fssb-thread-schema/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssbc%2Fssb-thread-schema/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssbc%2Fssb-thread-schema/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ssbc","download_url":"https://codeload.github.com/ssbc/ssb-thread-schema/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssbc%2Fssb-thread-schema/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260090012,"owners_count":22957166,"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":"2025-05-31T21:37:26.526Z","updated_at":"2025-06-23T06:31:06.539Z","avatar_url":"https://github.com/ssbc.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ssb-thread-schema\n\na module which provides you schemas and validators for messages involved in threads.\n\n## Example Usage\n\n```js\nvar { isRoot, isReply } = require('ssb-thread-schema')\n\nconst testMsg = {\n  type: 'post',\n  text: 'oh choice, finally a less janky way to check our stuff',\n  root: '%+fBXl12aV1wpAdD62RMl1WRhwthDMuAuHH4iNWgB7jA=.sha256',\n  branch: [\n    '%PK5aWmXVYJLcmRQTc/6EQE1ht9T5Kb+wi6NgTReMKXI=.sha256'\n  ]\n}\n// can be the content of a message or the whole thing\n\nisRoot(testMsg)\n// =\u003e false\nisRoot.errors\n// =\u003e helpful errors\n\nisReply(testMsg)\n// =\u003e true\n```\n\n## API\n\n### `isRoot(Object) -\u003e Boolean`\n\n`Object` can be a full message from the log, or just the content from the message, the validator will take care of it.\n\nIf the test Object fails the validation, errors are attached to the function (i.e. `isRoot.errors`, see [Example Usage](#example-usage))\n\nAn optional second argument can be passed to the validator if you want to tell the validator to attach errors to the test Object (this mutates the test Object):\n\n```js\nisRoot(Object, { attachErrors: true })\n```\n\n### `isReply(Object) -\u003e Boolean`\nsame pattern ^\n\n\n## TOTALLY UNSTABLE\n\nThese methods are based on experimental schema which need massive review and are going to be totally over-hauled.\nDo not use them!\n\nIf you reeeeaaallly want to, require mehthods out from the files directly yourself.\n\n### `isNestedReply(Object) -\u003e Boolean`\nsame pattern ^\n\n### `isFork(Object) -\u003e Boolean`\nsame pattern ^\n\n\n\n## See also\n\n- the README in each folder with a little more about each message type\n- the birth of forks / nested replies spec : `%+fBXl12aV1wpAdD62RMl1WRhwthDMuAuHH4iNWgB7jA=.sha256`\n  - note it's turned out this 'spec' is way sloppy - has holes in it, and has been implemented differently in Patchwork\n\n## TODO\n\n- votes (a.k.a. likes)\n- behaviour / flags\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fssbc%2Fssb-thread-schema","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fssbc%2Fssb-thread-schema","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fssbc%2Fssb-thread-schema/lists"}