npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@tenfold/client-sdk

v1.0.0-alpha.104

Published

Typescript type definitions for client-side integration libraries

Downloads

205

Readme

Tenfold Client SDK

This repo contains typescript types and definitions to help guiding client side integration development. As integrations will be developed as standalone typescript libraries, they will not have access to Tenfold's source code, and this SDK should act as a bridge between the two parties. The interfaces exposed here will provide information about the methods that expected by the Tenfold App, what parameters each method will receive and what is the return type expected for each.

One important thing to notice is that the types exposed by this repo is a mix of types that are exclusive to client integrations and types re-exported by other libraries. The reason for re-exporting them is to simplify development purpose and not force developers to add multiple libraries in your package json when only interested in type definitions.

The Client Integration Descriptor

The client integration descriptor is the core of the integration. The ClientIntegrationDescriptor type is what is exported by your library and represents the concrete instance that is consumed by the Tenfold app. It is the contract that is used by Tenfold App and the integration to talk to each other. While this section will not go into specific details of each method that needs to be implemented by the integration descriptor (you can see it in the JSDocs in the ClientIntegrationDescriptor itself), it will provide a high level overview of how the integration happens. In summary,

  • Tenfold App will use information about the user/customer using the app to know what integrations to instantiate
  • The integration will be dynamically loaded and will provide an instance of ClientIntegrationDescriptor
  • Tenfold App will create an instance of a container of dependencies and will invoke the optional method onBindDependencies in the integration to optionally bind more dependencies in the container (see the Dependency Injection section below)
  • Tenfold App will invoke the various methods of the integration descriptor with the relevant parameters, plus the injector created in the previous step

Dependency Injection

For details regarding Dependency Injection such as how to use it, what information is available out of the box in the projected injector, etc, see the dependency-injection guide.

Integration aspects

The integration being developed needs to take care of two fundamental aspects:

  • Passing commands from the Tenfold app over to the provider: This is handled by the adaptors that will be implemented by the integration. The methods on each adaptor will be invoked by the Tenfold App in different occasions with different parameters, and usually represent an action taken by the agent (such as an interaction control - answer, transfer, hangup, etc). See Adaptors for an in-depth explanation on how adaptors work and how they should behave

  • Passing incoming data from the provider to Tenfold: your integration code should handle any events published by the provider, transform those events by the formatted required by Tenfold and forward those events to the Tenfold App. See Events for a thorough explanation on that.

Other relevant aspects to keep in mind while creating your integration are:

  • It's important that the integration descriptor returned by your integration is the default export of the entry point of your package
  • Be mindful that your integration will be used in a front end context, which means that it will be downloaded in end-user's browser, so bundle sizes are very important. Be mindful of the dependencies you add in your library and keep an eye for libraries that can leverage on tree-shaking. A very good example is comparing lodash with lodash-es, where the later one can be tree-shaked and the first one can't.
  • As you develop your integration, please keep in mind error handling. The ask is to handle errors internally to the integration as best as possible, and convert integration errors to Tenfold Errors to give us most context possible about an error, with a type that can be directly consumed by Tenfold.

Client Integration example

For an example on how to use the client sdk, see https://github.com/tenfold/client-integration-template