{"id":21343753,"url":"https://github.com/catalystcode/3dtoolkit-server-store","last_synced_at":"2025-03-16T03:14:26.793Z","repository":{"id":73516821,"uuid":"132944794","full_name":"CatalystCode/3dtoolkit-server-store","owner":"CatalystCode","description":"Maintains state around the VMs deployed to serve 3dtoolkit streams","archived":false,"fork":false,"pushed_at":"2018-05-10T19:28:36.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-01-22T15:48:01.168Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CatalystCode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2018-05-10T19:22:21.000Z","updated_at":"2018-05-10T19:28:37.000Z","dependencies_parsed_at":"2023-06-01T06:30:41.062Z","dependency_job_id":null,"html_url":"https://github.com/CatalystCode/3dtoolkit-server-store","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/CatalystCode%2F3dtoolkit-server-store","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CatalystCode%2F3dtoolkit-server-store/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CatalystCode%2F3dtoolkit-server-store/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CatalystCode%2F3dtoolkit-server-store/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CatalystCode","download_url":"https://codeload.github.com/CatalystCode/3dtoolkit-server-store/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243818199,"owners_count":20352629,"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-22T01:15:08.920Z","updated_at":"2025-03-16T03:14:26.778Z","avatar_url":"https://github.com/CatalystCode.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# server-store\n\n[![Build Status](https://travis-ci.com/CatalystCode/3dtoolkit-server-store.svg?branch=master)](https://travis-ci.com/CatalystCode/3dtoolkit-server-store)\n\nA module used by the orchestration service of the [3dtoolkit](https://github.com/CatalystCode/3dtoolkit) to managed the shared state around active vms handing webrtc servers.\n\n## Installation\n\n```\n$ npm install --save 3dtoolkit-server-store\n```\n\n## Initialization\n\nThe module exposes a class, ServerStore. Instances of this class requires initialization to setup the database client via the init method with the options below. Only cosmosDbEndpoint and cosmosDbKey are required, the others, if not provided, will default to the values below.\n\n```\nlet serverStore = new ServerStore();\n\nlet options = {\n    cosmosDbEndpoint: \u003cCosmosDB endpoint\u003e,\n    cosmosDbKey: \u003cCosmosDB key\u003e,\n    databaseName: \u003cDatabase Name\u003e, // defaults to '3dtoolkit'\n    collectionName: \u003cCollection Name\u003e, // defaults to 'servers'\n    collectionRUs: \u003c# of request units to provision for collection\u003e // defaults to 1000\n};\n\nserverStore.init(options, err =\u003e {\n\n    // ... perform actions on serverStore per below\n\n});\n```\n\n## serverStore.upsert(server, callback)\n\nYou can upsert servers into the store via 'upsert'. If a server exists it will be updated, otherwise it will be inserted.\n\n```\n// server is of the form { serverId: \"...\", azureServerId: \"...\", turnServerId: \"...\" }\nserverStore.upsert(server, err =\u003e {\n    // server has been upserted.\n});\n```\n\n## serverStore.delete(serverId, callback)\n\nDeletes a server from the store.\n\n```\nserverStore.delete(serverId, err =\u003e {\n    // server has been deleted.\n}\n```\n\n## getByServerId(serverId, callback)\n\nGets a server's entry by server id.\n\n```\nserverStore.getByServerId((err, servers =\u003e {\n    // servers is an array of server entries\n})\n```\n\nMore usage details can be found in the unit tests.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcatalystcode%2F3dtoolkit-server-store","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcatalystcode%2F3dtoolkit-server-store","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcatalystcode%2F3dtoolkit-server-store/lists"}