From 5d0197f186ac130e052c21ba812c4d9885f6b597 Mon Sep 17 00:00:00 2001 From: Mohammed S Date: Tue, 14 Nov 2023 19:12:22 +0530 Subject: [PATCH] Deployment (#840) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ci(restapi): 🎉 cut release to restapi-v1.0.0 * fix(component): dummy * ci(restapi): 🎉 cut release to restapi-v1.0.0 * fix(component): dummy * ci(restapi): 🎉 cut release to restapi-v1.0.1 * ci(restapi): 🎉 cut release to restapi-v1.0.1 * fix(component): dummy * ci(restapi): 🎉 cut release to restapi-v1.0.2 * fix(component): dummy * ci(restapi): 🎉 cut release to restapi-v1.0.2 * fix(component): dummy * ci(restapi): 🎉 cut release to restapi-v1.0.3 * fix: success progressHook * ci(restapi): 🎉 cut release to restapi-v1.0.4 * ci(restapi): 🎉 cut release to restapi-v1.1.0 * ci(restapi): 🎉 cut release to restapi-v1.2.0 * ci(restapi): 🎉 cut release to restapi-v1.2.0 * ci(restapi): 🎉 cut release to restapi-v1.0.0 * fix(component): dummy * fix(component): dummy * fix(component): dummy * ci(restapi): 🎉 cut release to restapi-v1.0.2 * fix(component): dummy * ci(restapi): 🎉 cut release to restapi-v1.0.3 * ci(restapi): 🎉 cut release to restapi-v1.0.4 * ci(restapi): 🎉 cut release to restapi-v1.2.1 * fix: local for local development (#295) Co-Authored-By: aman035 * fix: version update * ci(restapi): 🎉 cut release to restapi-v1.2.2 * ci(restapi): 🎉 cut release to restapi-v1.2.3 * ci(restapi): 🎉 cut release to restapi-v1.2.4 * ci(restapi): 🎉 cut release to restapi-v1.2.5 * ci(restapi): 🎉 cut release to restapi-v1.2.6 * ci(restapi): 🎉 cut release to restapi-v1.2.7 * ci(socket): 🎉 cut release to socket-v0.5.0 * fix: test commit * ci(restapi): 🎉 cut release to restapi-v1.2.8 * ci(uiweb): 🎉 cut release to uiweb-v1.0.0 * ci(uiweb): 🎉 cut release to uiweb-v1.0.0 * ci(uiweb): 🎉 cut release to uiweb-v1.0.1 * fix: added ci-version-beta * fix: added ci-version-beta * ci(restapi): 🎉 cut beta release to restapi-v1.2.9 * fix: added releaseType * ci(restapi): 🎉 cut beta release to restapi-v0.0.1-beta.0 * ci(restapi): 🎉 cut beta release to restapi-v0.0.1-beta.0 * ci(restapi): 🎉 cut release to restapi-v1.2.10 * ci(restapi): 🎉 cut release to restapi-v1.2.10 * ci(restapi): 🎉 cut beta release to restapi-v0.0.1-beta.1 * ci(restapi): 🎉 cut release to restapi-v1.2.11 * fix: linkedListHash test cases removed & CI version corrected * fix: update name to beta * ci(restapi): 🎉 cut release to restapi-v1.2.12 * ci(restapi): 🎉 cut release to restapi-v1.2.12 * ci(restapi): 🎉 cut release to restapi-v1.2.13 * ci(restapi): 🎉 cut release to restapi-v1.2.14 * ci(restapi): 🎉 cut release to restapi-v1.2.15 * fix: update package json * fix: updated socket version * ci(uiweb): 🎉 cut release to uiweb-v1.0.2 * fix: socket lib update * ci(uiweb): 🎉 cut release to uiweb-v1.0.2 * ci(restapi): 🎉 cut release to restapi-v1.2.16 * ci(restapi): 🎉 cut release to restapi-v1.3.0 * ci(restapi): 🎉 cut release to restapi-v1.3.1 * ci(socket): 🎉 cut release to socket-v0.5.1 * ci(restapi): 🎉 cut release to restapi-v1.3.2 * ci(restapi): 🎉 cut release to restapi-v1.3.3 * ci(restapi): 🎉 cut release to restapi-v1.3.4 * ci(restapi): 🎉 cut release to restapi-v1.3.5 * ci(restapi): 🎉 cut release to restapi-v1.3.6 * ci(restapi): 🎉 cut release to restapi-v1.3.7 * ci(restapi): 🎉 cut release to restapi-v1.3.8 * ci(restapi): 🎉 cut release to restapi-v1.3.9 * ci(uiweb): 🎉 cut release to uiweb-v1.1.0 * ci(uiweb): 🎉 cut release to uiweb-v1.1.1 * ci(restapi): 🎉 cut release to restapi-v1.4.0 * ci(restapi): 🎉 cut release to restapi-v1.4.1 * fix: corrections * ci(uiweb): 🎉 cut release to uiweb-v1.1.2 * ci(uiweb): 🎉 cut release to uiweb-v1.1.3 * ci(uiweb): 🎉 cut release to uiweb-v1.1.4 * ci(restapi): 🎉 cut release to restapi-v1.4.2 * Update README.md * Update README.md * ci(restapi): 🎉 cut release to restapi-v1.4.3 * ci(restapi): 🎉 cut release to restapi-v1.4.4 * ci(uiweb): 🎉 cut release to uiweb-v1.1.5 * ci(uiweb): 🎉 cut release to uiweb-v1.1.6 * ci(uiweb): 🎉 cut release to uiweb-v1.1.7 * ci(socket): 🎉 cut release to socket-v0.5.2 * ci(restapi): 🎉 cut release to restapi-v1.4.5 * ci(uiweb): 🎉 cut release to uiweb-v1.1.8 * ci(restapi): 🎉 cut release to restapi-v1.4.6 * ci(uiweb): 🎉 cut release to uiweb-v1.1.9 * ci(restapi): 🎉 cut release to restapi-v1.4.7 * ci(restapi): 🎉 cut release to restapi-v1.4.8 * ci(uiweb): 🎉 cut release to uiweb-v1.1.10 * ci(restapi): 🎉 cut release to restapi-v1.4.9 * ci(restapi): 🎉 cut release to restapi-v1.4.10 * ci(restapi): 🎉 cut release to restapi-v1.4.11 * ci(restapi): 🎉 cut release to restapi-v1.4.12 * ci(uiweb): 🎉 cut release to uiweb-v1.1.11 * ci(restapi): 🎉 cut release to restapi-v1.4.13 * fix: update read me file * ci(restapi): 🎉 cut release to restapi-v1.4.14 * ci(restapi): 🎉 cut release to restapi-v1.4.15 * ci(uiweb): 🎉 cut release to uiweb-v1.1.12 * fix: dummy change * ci(uiweb): 🎉 cut release to uiweb-v1.1.13 * ci(restapi): 🎉 cut release to restapi-v1.4.16 * ci(restapi): 🎉 cut release to restapi-v1.4.17 * ci(restapi): 🎉 cut release to restapi-v1.4.18 * ci(restapi): 🎉 cut release to restapi-v1.4.19 * ci(restapi): 🎉 cut release to restapi-v1.4.20 * ci(restapi): 🎉 cut release to restapi-v1.4.21 * ci(uiweb): 🎉 cut release to uiweb-v1.1.14 * ci(restapi): 🎉 cut release to restapi-v1.4.22 * fix: build fix * ci(restapi): 🎉 cut release to restapi-v1.4.23 * ci(restapi): 🎉 cut release to restapi-v1.4.24 * ci(restapi): 🎉 cut release to restapi-v1.4.25 * ci(restapi): 🎉 cut release to restapi-v1.4.26 * ci(restapi): 🎉 cut release to restapi-v1.4.27 * ci(restapi): 🎉 cut release to restapi-v1.4.28 * ci(uiweb): 🎉 cut release to uiweb-v1.1.15 * ci(restapi): 🎉 cut release to restapi-v1.4.29 * ci(restapi): 🎉 cut release to restapi-v1.4.30 * ci(restapi): 🎉 cut release to restapi-v1.4.31 * ci(restapi): 🎉 cut release to restapi-v1.4.32 * ci(restapi): 🎉 cut release to restapi-v1.4.33 * ci(uiweb): 🎉 cut release to uiweb-v1.1.16 * ci(restapi): 🎉 cut release to restapi-v1.4.34 * fix: GroupMember type fix * ci(restapi): 🎉 cut release to restapi-v1.4.35 * fix: bump examples SDK version * fix: stream test cases fix --------- Co-authored-by: aman035 --- .../examples/sdk-backend-node/chat/chat.ts | 50 +++++++++++-------- .../notification/notification.ts | 43 +++++++++++----- .../sdk-backend-node/pushAPI/stream.ts | 41 +++++++++++++-- .../tests/lib/pushstream/initialize.test.ts | 4 +- 4 files changed, 101 insertions(+), 37 deletions(-) diff --git a/packages/examples/sdk-backend-node/chat/chat.ts b/packages/examples/sdk-backend-node/chat/chat.ts index 4c21f5a72..e1499985b 100644 --- a/packages/examples/sdk-backend-node/chat/chat.ts +++ b/packages/examples/sdk-backend-node/chat/chat.ts @@ -60,7 +60,7 @@ const eventlistener = async ( stream: PushStream, eventName: string ): Promise => { - stream.on(eventName, (data: any) => { + stream.on(eventName, (data: any) => { if (showAPIResponse) { console.log('Stream Event Received'); console.log(data); @@ -72,25 +72,33 @@ const eventlistener = async ( export const runChatClassUseCases = async (): Promise => { const userAlice = await PushAPI.initialize(signer, { env }); - const stream = await userAlice.initStream( - [CONSTANTS.STREAM.CHAT, CONSTANTS.STREAM.CHAT_OPS], - { - // stream supports other products as well, such as STREAM.CHAT, STREAM.CHAT_OPS - // more info can be found at push.org/docs/chat + const stream = await userAlice.initStream( + [CONSTANTS.STREAM.CHAT, CONSTANTS.STREAM.CHAT_OPS], + { + // stream supports other products as well, such as STREAM.CHAT, STREAM.CHAT_OPS + // more info can be found at push.org/docs/chat - filter: { - channels: ['*'], - chats: ['*'], - }, - connection: { - auto: true, // should connection be automatic, else need to call stream.connect(); - retries: 3, // number of retries in case of error - }, - raw: true, // enable true to show all data - } - ); - - await stream.connect(); + filter: { + channels: ['*'], + chats: ['*'], + }, + connection: { + auto: true, // should connection be automatic, else need to call stream.connect(); + retries: 3, // number of retries in case of error + }, + raw: true, // enable true to show all data + } + ); + + stream.on(CONSTANTS.STREAM.CONNECT, (a) => { + console.log('Stream Connected'); + }); + + await stream.connect(); + + stream.on(CONSTANTS.STREAM.DISCONNECT, () => { + console.log('Stream Disconnected'); + }); const userBob = await PushAPI.initialize(secondSigner, { env }); const userKate = await PushAPI.initialize(thirdSigner, { env }); @@ -106,7 +114,9 @@ export const runChatClassUseCases = async (): Promise => { // ------------------------------------------------------------------- console.log('PushAPI.chat.list'); const aliceChats = await userAlice.chat.list(CONSTANTS.CHAT.LIST_TYPE.CHATS); - const aliceRequests = await userAlice.chat.list(CONSTANTS.CHAT.LIST_TYPE.REQUESTS); + const aliceRequests = await userAlice.chat.list( + CONSTANTS.CHAT.LIST_TYPE.REQUESTS + ); if (showAPIResponse) { console.log(aliceChats); console.log(aliceRequests); diff --git a/packages/examples/sdk-backend-node/notification/notification.ts b/packages/examples/sdk-backend-node/notification/notification.ts index 00e8872c6..40d0f213e 100644 --- a/packages/examples/sdk-backend-node/notification/notification.ts +++ b/packages/examples/sdk-backend-node/notification/notification.ts @@ -45,19 +45,38 @@ export const runNotificationClassUseCases = async (): Promise => { // ------------------------------------------------------------------- const userAlice = await PushAPI.initialize(signer, { env }); - const stream = await userAlice.stream([CONSTANTS.STREAM.NOTIF], { - // stream supports other products as well, such as STREAM.CHAT, STREAM.CHAT_OPS - // more info can be found at push.org/docs/chat + const stream = await userAlice.initStream( + [ + CONSTANTS.STREAM.NOTIF, + CONSTANTS.STREAM.CHAT_OPS, + CONSTANTS.STREAM.CHAT, + CONSTANTS.STREAM.CONNECT, + CONSTANTS.STREAM.DISCONNECT, + ], + { + // stream supports other products as well, such as STREAM.CHAT, STREAM.CHAT_OPS + // more info can be found at push.org/docs/chat - filter: { - channels: ['*'], - chats: ['*'], - }, - connection: { - auto: true, // should connection be automatic, else need to call stream.connect(); - retries: 3, // number of retries in case of error - }, - raw: true, // enable true to show all data + filter: { + channels: ['*'], + chats: ['*'], + }, + connection: { + auto: true, // should connection be automatic, else need to call stream.connect(); + retries: 3, // number of retries in case of error + }, + raw: true, // enable true to show all data + } + ); + + stream.on(CONSTANTS.STREAM.CONNECT, (a) => { + console.log('Stream Connected'); + }); + + await stream.connect(); + + stream.on(CONSTANTS.STREAM.DISCONNECT, () => { + console.log('Stream Disconnected'); }); // Listen Stream Events for getting websocket events diff --git a/packages/examples/sdk-backend-node/pushAPI/stream.ts b/packages/examples/sdk-backend-node/pushAPI/stream.ts index 8b00ad1e2..36358115f 100644 --- a/packages/examples/sdk-backend-node/pushAPI/stream.ts +++ b/packages/examples/sdk-backend-node/pushAPI/stream.ts @@ -1,4 +1,4 @@ -import { PushAPI } from '@pushprotocol/restapi'; +import { CONSTANTS, PushAPI } from '@pushprotocol/restapi'; import { config } from '../config'; import { generatePrivateKey, privateKeyToAccount } from 'viem/accounts'; import { createWalletClient, http } from 'viem'; @@ -36,7 +36,7 @@ const eventlistener = async ( pushAPI: PushAPI, eventName: string ): Promise => { - pushAPI._stream.on(eventName, (data: any) => { + pushAPI.stream.on(eventName, (data: any) => { if (showAPIResponse) { console.log(data); } @@ -47,11 +47,46 @@ const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); export const runPushAPIStreamCases = async (): Promise => { const userAlice = await PushAPI.initialize(signer, { env }); + + const stream = await userAlice.initStream( + [ + CONSTANTS.STREAM.NOTIF, + CONSTANTS.STREAM.CHAT_OPS, + CONSTANTS.STREAM.CHAT, + CONSTANTS.STREAM.CONNECT, + CONSTANTS.STREAM.DISCONNECT, + ], + { + // stream supports other products as well, such as STREAM.CHAT, STREAM.CHAT_OPS + // more info can be found at push.org/docs/chat + + filter: { + channels: ['*'], + chats: ['*'], + }, + connection: { + auto: true, // should connection be automatic, else need to call stream.connect(); + retries: 3, // number of retries in case of error + }, + raw: true, // enable true to show all data + } + ); + + stream.on(CONSTANTS.STREAM.CONNECT, (a) => { + console.log('Stream Connected'); + }); + + await stream.connect(); + + stream.on(CONSTANTS.STREAM.DISCONNECT, () => { + console.log('Stream Disconnected'); + }); + const userBob = await PushAPI.initialize(secondSigner, { env }); const userKate = await PushAPI.initialize(thirdSigner, { env }); // ------------------------------------------------------------------- // ------------------------------------------------------------------- - console.log(`Listening ${STREAM.PROFILE} Events`); + console.log(`Listening ${CONSTANTS.STREAM.PROFILE} Events`); eventlistener(userAlice, STREAM.PROFILE); console.log(`Listening ${STREAM.ENCRYPTION} Events`); eventlistener(userAlice, STREAM.ENCRYPTION); diff --git a/packages/restapi/tests/lib/pushstream/initialize.test.ts b/packages/restapi/tests/lib/pushstream/initialize.test.ts index 9f761acfc..0e797f415 100644 --- a/packages/restapi/tests/lib/pushstream/initialize.test.ts +++ b/packages/restapi/tests/lib/pushstream/initialize.test.ts @@ -172,9 +172,9 @@ describe('PushStream.initialize functionality', () => { content: "Gm gm! It's a me... Mario", }); }); - + await stream.connect(); - + stream.on(CONSTANTS.STREAM.DISCONNECT, () => { console.log('Stream Disconnected'); });