TS SDK v6.0.0 Migration Guide
This guide is to provide information about breaking changes and how to migrate to the Social Plus TS SDK 6.0.0 version.
Installation
Using NPM
npm i @amityco/ts-sdk@^6.0.0
Using Yarn
yarn add @amityco/ts-sdk@^6.0.0
Deprecation of RunQuery / CreateQuery
Starting from 6.0.0
we recommend using API's async
hronously. As it will soon be deprecated. Example:
Real Time Events
The real time events are supported via MQTT, which has a crucial difference in how it works compared to web sockets. This is, events are not broadcast-ed to all users. So this means that you only get real time event updates to those topics that you subscribe to.
Note: Some exceptions to this are message events and smart feed events. If you are unsure if subscription is required for a particular topic, check the code-snippet for that particular API for details.
There are also other limitations to getting RTE's, example: you cannot subscribe to events for a community that you are not a member of. Check documentation for full details.
You can read more about MQTT here: https://mqtt.org/
Live Object
Although live objects were introduced prior to v6. All getter methods for singular objects (example getPost
) will now return a subscribe-able object.
This means that if an object gets updated and you have subscribed to real time events, the object will get updated automatically via real time events.
Getting Real Time Updates for an Object
Getting the object only once
Live Collection
Although live collections were introduced prior to v6. All query methods for collection of objects (example getPosts
) will now return a subscribe-able collection.
This means that if an object in the collection gets updated and you have subscribed to real time events, the collection will get updated automatically via real time events.
Getting Real Time updates for a collection
Getting paginated collection without and real time updates
Introducing Repositories
Starting from 6.0.0
, you will no longer be able to import individual SDK API's. You'll need to import the required API from it's respective Repositories.
Client
import { Client } from '@amityco/ts-sdk
UserRepository
import { UserRepository } from '@amityco/ts-sdk
FileRepository
import { FileRepository } from '@amityco/ts-sdk
ReactionRepository
import { ReactionRepository } from '@amityco/ts-sdk
CommunityRepository
import { CommunityRepository } from '@amityco/ts-sdk
StreamRepository
import { StreamRepository } from '@amityco/ts-sdk
PostRepository
import { PostRepository } from '@amityco/ts-sdk
CommentRepository
import { CommentRepository } from '@amityco/ts-sdk
PollRepository
import { PollRepository } from '@amityco/ts-sdk
ChannelRepository
import { ChannelRepository } from '@amityco/ts-sdk
MessageRepository
import { MessageRepository } from '@amityco/ts-sdk
Last updated