{"id":16189309,"url":"https://github.com/caolan/worker-shares","last_synced_at":"2025-04-07T13:51:07.238Z","repository":{"id":8005826,"uuid":"9413682","full_name":"caolan/worker-shares","owner":"caolan","description":"This worker handles sharing of objects between users or publicly.","archived":false,"fork":false,"pushed_at":"2013-05-02T15:44:49.000Z","size":681,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-13T16:46:14.809Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":false,"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/caolan.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":"2013-04-13T13:01:11.000Z","updated_at":"2024-12-25T13:33:16.000Z","dependencies_parsed_at":"2022-09-10T22:02:09.412Z","dependency_job_id":null,"html_url":"https://github.com/caolan/worker-shares","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caolan%2Fworker-shares","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caolan%2Fworker-shares/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caolan%2Fworker-shares/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caolan%2Fworker-shares/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/caolan","download_url":"https://codeload.github.com/caolan/worker-shares/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247666005,"owners_count":20975787,"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-10-10T07:35:01.169Z","updated_at":"2025-04-07T13:51:07.199Z","avatar_url":"https://github.com/caolan.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/hoodiehq/worker-shares.png?branch=master)](https://travis-ci.org/hoodiehq/worker-shares)\n\nHoodie Shares Worker\n======================\n\nThis worker handles sharing of objects between users or publicly.\n\n\n\nWhat happens behind the curtain\n---------------------------------\n\nThe worker follows all userdatabases.\nHere's an example (simplified) `$share` object created by a user:\n\n```json\n{\n  \"_id\"  : \"$share/uuid567\",\n  \"_ref\" : \"1-bl2xa#1346886508617\",\n  \"type\" : \"$share\"\n}\n```\n\nThe worker picks it up, creates a database \"share/uuid567\" and a \ncontinuous replication from user's database. \n\nWhenever the user adds an object to the sharing, the share id will be \nadded to $sharedAt attribute\n\n```json\n{\n  \"_id\"     : \"todo/abc4567\",\n  \"type\"    : \"todo\",\n  \"name\"    : \"Remeber the mild\",\n  \"owner\"   : \"joe@example.com\",\n  \"$sharedAt\" : \"uuid567\"\n}\n```\n```\n\n\nWhenever the user removes an object from a sharing, an `$unshared : true`\nproperty gets added, so that the worker can react on it and remove the object \nfrom the $shares database. Once the object has been removed, both the `$unshared`\nand the `$sharedAt` attributes will get removed\n\n\nThe shares database\n---------------------\n\nWhen a user creates a new share, the database gets not created directly.\nInstead, the $share object gets copied to the shares database. Once it\nwas copied successfully, the actuall database gets created. Same with\nremoving shares. \n\nThis has two benefits\n\n1. It provides a central place to follow all activity regarding shares\n2. Shares can be managed by directly interacting with the shares database,\n   e.g. as admin from pocket.\n\nIt also helps with debugging, wich should not be underestimate, as the\nshares worker is pretty complex.\n\nThe shares database does not only hold $share objects, but also $subscription\nobjects, that represent replications. They work the same way as middle man\nas the $share objects, for the same reason.\n\n\nThe access setting\n--------------------\n\nthe `access` setting  \nthe access setting defines who can read and/or write to the sharing. Default\nvalue is false, meaning only the creator has access. `true` means the sharing\nis public. More granular settings are possible as well:  \n\n`{read: true}` public sharing, but read only  \n`{read: [\"user1\", \"user2\"]}` private sharing, only user1 \u0026 user2 have read access  \n`{write: [\"user1\", \"user2\"]}` private sharing, user1 \u0026 user2 have read \u0026 write access  \n`{read: true, write: [\"user1\"]}` private sharing, but only user1 has write access  \n\ndepending on the access setting, a _design doc has to be created that prevents\nunauthorized users to make changes to the shared objects. And if the share allows\nchanges, they need to be replicated to users $shares database and the changes need\nto be incorporated into the \"real objects\".\n\n\n\n## To be done\n\n* The current implementation is not bidirectional yet.\n  I can read and subscribe to a share, but not make changes yet.\n* the `password` setting  \n  When the sharing is public and a password is set, the objects can be only accessed\n  with the password. Users that are liste\n\n\n  ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaolan%2Fworker-shares","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcaolan%2Fworker-shares","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaolan%2Fworker-shares/lists"}