{"_id":"@ably-labs/uts-pubsub","_rev":"2-b84daf6bd88c67e8deba4f8d9af1339f","name":"@ably-labs/uts-pubsub","dist-tags":{"latest":"0.0.2"},"versions":{"0.0.1":{"name":"@ably-labs/uts-pubsub","version":"0.0.1","author":{"name":"Ably Ecosystems Team"},"license":"MIT","_id":"@ably-labs/uts-pubsub@0.0.1","maintainers":[{"name":"ttypic","email":"khokhlov.e.n@gmail.com"},{"name":"mschristensen","email":"mike@christensen.codes"},{"name":"ably-realtime","email":"account.owners@ably.com"},{"name":"owenpearson","email":"owen.pearson@ably.com"},{"name":"lmars","email":"lewis@lmars.net"},{"name":"ably-labs-user","email":"devrel@ably.com"}],"bin":{"uts-pubsub":"dist/bin.js"},"dist":{"shasum":"6bfc37befd6accd52823e0586debf33ed806d1ea","tarball":"https://registry.npmjs.org/@ably-labs/uts-pubsub/-/uts-pubsub-0.0.1.tgz","fileCount":80,"integrity":"sha512-UhKw6fSiMGVw6Sj0uteNkjsnzQyISs0Nz4ZgGiNmKRTSh8lNK1TVrGdQqHN7UMVMF1tfeHv/ud37MpD4s90D5A==","signatures":[{"sig":"MEUCIHr/YnOAKKCAPQnWWwEl3qnYCZXY3xbjrkH67Ly4mdslAiEA4kAleNBFsX3+KWJOu6fHBphtA2dKEX1TuVCvbGeVA7k=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":763007},"gitHead":"a777d6f559beff0642526ed86dbbc23462e44209","scripts":{"test":"mocha test/**/*.test.ts --exit","build":"tsc","start":"tsx src/dispatcher.ts","prepare":"npm run build"},"_npmUser":{"name":"ttypic","email":"khokhlov.e.n@gmail.com"},"_npmVersion":"9.8.1","description":"Unified test","directories":{},"_nodeVersion":"18.18.2","dependencies":{"ws":"^8.16.0","tsx":"^4.16.2","ably":"^2.0.4","chai":"^4.5.0","async":"^3.2.5","mocha":"^10.2.0","nanoid":"^3.3.7","express":"^4.18.2","typescript":"^5.3.3","json-rpc-2.0":"^1.7.0","sync-request":"^6.1.0"},"_hasShrinkwrap":false,"devDependencies":{"@types/ws":"^8.5.10","@types/chai":"^4.3.11","@types/mocha":"^10.0.6","@types/deasync":"^0.1.5","@types/express":"^4.17.21"},"_npmOperationalInternal":{"tmp":"tmp/uts-pubsub_0.0.1_1722415410956_0.5237358437880084","host":"s3://npm-registry-packages"}},"0.0.2":{"name":"@ably-labs/uts-pubsub","version":"0.0.2","author":{"name":"Ably Ecosystems Team"},"license":"MIT","_id":"@ably-labs/uts-pubsub@0.0.2","maintainers":[{"name":"ttypic","email":"khokhlov.e.n@gmail.com"},{"name":"mschristensen","email":"mike@christensen.codes"},{"name":"ably-realtime","email":"account.owners@ably.com"},{"name":"owenpearson","email":"owen.pearson@ably.com"},{"name":"lmars","email":"lewis@lmars.net"},{"name":"ably-labs-user","email":"devrel@ably.com"}],"bin":{"uts-pubsub":"dist/bin.js"},"dist":{"shasum":"c9e16b8e7736c8cded51946b4ca3d977d900915a","tarball":"https://registry.npmjs.org/@ably-labs/uts-pubsub/-/uts-pubsub-0.0.2.tgz","fileCount":64,"integrity":"sha512-Iob2lzVcwRDS29KIL+Pj/mHdPMfIJjUhCY5iY2Azyso4QGHNRjK98eM/GZHLEheKi3grexNSG6F0ueQtNFIJTw==","signatures":[{"sig":"MEYCIQCZc8z0bj43xPtO1IrwpqQPyCdBJ42IF+lFECVm5kl5JAIhAKNED7IdfYlH4wTo3azI/wDp9MvZbm8Ip5Cl2bUbCvqM","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":735046},"gitHead":"98ba260a85eb7a53ba8d24aedfb48e293f51bc7a","scripts":{"test":"mocha test/**/*.test.ts --exit","build":"tsc","start":"tsx src/dispatcher.ts","prepare":"npm run build"},"_npmUser":{"name":"ttypic","email":"khokhlov.e.n@gmail.com"},"_npmVersion":"9.8.1","description":"Unified test","directories":{},"_nodeVersion":"18.18.2","dependencies":{"ws":"^8.16.0","tsx":"^4.16.2","ably":"^2.0.4","chai":"^4.5.0","async":"^3.2.5","mocha":"^10.2.0","nanoid":"^3.3.7","express":"^4.18.2","typescript":"^5.3.3","json-rpc-2.0":"^1.7.0","sync-request":"^6.1.0"},"_hasShrinkwrap":false,"devDependencies":{"@types/ws":"^8.5.10","@types/chai":"^4.3.11","@types/mocha":"^10.0.6","@types/deasync":"^0.1.5","@types/express":"^4.17.21"},"_npmOperationalInternal":{"tmp":"tmp/uts-pubsub_0.0.2_1722433933161_0.39342823529044124","host":"s3://npm-registry-packages"}}},"time":{"created":"2024-07-31T08:43:30.864Z","modified":"2024-10-09T11:07:03.147Z","0.0.1":"2024-07-31T08:43:31.091Z","0.0.2":"2024-07-31T13:52:13.422Z"},"author":{"name":"Ably Ecosystems Team"},"license":"MIT","description":"Unified test","maintainers":[{"email":"andrii.bulat@ably.com","name":"andrii.bulat.ably"},{"email":"khokhlov.e.n@gmail.com","name":"ttypic"},{"email":"mike@christensen.codes","name":"mschristensen"},{"email":"account.owners@ably.com","name":"ably-realtime"},{"email":"owen.pearson@ably.com","name":"owenpearson"},{"email":"lewis@lmars.net","name":"lmars"},{"email":"devrel@ably.com","name":"ably-labs-user"}],"readme":"# Unified Test Suite For Ably SDKs\n\nThe idea of the project is to provide a standardized testing mechanism across all supported SDKs.\nThis can greatly benefit SDK development and maintenance processes.\nFor more information, you can find it here: https://ably.atlassian.net/wiki/spaces/SDK/pages/2825945127/SDKs+Unified+Test+Suite.\n\n**Note:** Right now project on research and proof-of-concept state, more information: https://ably.atlassian.net/wiki/spaces/SDK/pages/2833220568/Unified+Test+Suite+Research.\n\n## Implementation\n\n<img src=\"https://github.com/ably-labs/unified-test-suite/raw/main/docs/media/uts-schema.png\" alt=\"Unified Test Suite Implementation Schema\">\n\nIt has two main parts:\n\n- **Test Suite**\n- **SDK Adapter**\n\n**Test Suite** - implements Ably client using JSON-RPC calls, the main goal is to make it public interface exactly the same as Ably-js\n\n**SDK Adapter** - JSON-RPC bindings for the actual SDK\n\nPart of Test Suite is special server, that I called **dispatcher**. **Dispatcher** - Websocket Server that holds **Test Suite** and **SDK Adapter** communication.\n\nWe have 3 different types of processes required for unified test suites to run and their relationship is as follows:\n\n1. **Long-running WebSocket server (called Dispatcher)**:\n\n   - This entity runs continuously during testing, accepting WebSocket connections from both the Test Suite and SDK Adapters.\n\n2. Test Suite tests - launches mocha with tests covering aTest Suite tests:\n\n    - This process launches Mocha with tests that cover all items from the specification. Essentially, this part is currently repeated in every existing SDK. The Test Suite initiates RPC requests. To successfully complete, an SDK Adapter needs to be registered in the Dispatcher. This process performs necessary tests, provides a test report, and then exits.\n\n3. **SDK Adapter:**\n\n    - The SDK Adapter connects to the Dispatcher via websockets and enables the calling of Ably client methods. Once the Test Suite finishes, you can close the SDK Adapter as well.\n\n## What are the difficulties\n\n### Blocking calls\n\nA lot of methods are sync in the origin SDK and I don’t wanted to make any changes to the SDK and because JS is single-threaded it’s challenging to do.\nI tried to use deasync package to make it work, but it doesn’t work very well, especially with Websockets. That’s why I created special HTTP-endpoint that works over Websocket, and on **Test Suite** side I use blocking HTTP-call sync-request.\n\n### Subscriptions\n\nFor subscription we need to invoke our **Test Suite** with the callback, so basically both **Test Suite** and **SDK Adapter** have to be both RPC clients and servers.\nIt’s very well aligned with Websockets. To make it work I created special **dispatcher** in **Test Suite**. **Dispatcher** is a Websocket Server, it holds connections and make RPC communication between **Test Suite** and **SDK Adapter**.\n","readmeFilename":"README.md"}