From f1f72b9074810c7cd46178a54d4f3868fe52e98b Mon Sep 17 00:00:00 2001 From: Ankush523 Date: Fri, 8 Sep 2023 01:42:23 +0530 Subject: [PATCH 1/4] added core package to implement user --- packages/core/index.ts | 1 + packages/core/package.json | 11 +++++++++++ packages/core/src/users.ts | 15 +++++++++++++++ packages/core/tsconfig.json | 14 ++++++++++++++ .../messaging-push/src/baseclass/BasePushAPI.ts | 3 ++- packages/messaging-push/tsconfig.json | 2 ++ packages/messaging/tsconfig.json | 2 ++ yarn.lock | 6 ++++++ 8 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 packages/core/index.ts create mode 100644 packages/core/package.json create mode 100644 packages/core/src/users.ts create mode 100644 packages/core/tsconfig.json diff --git a/packages/core/index.ts b/packages/core/index.ts new file mode 100644 index 0000000..8758227 --- /dev/null +++ b/packages/core/index.ts @@ -0,0 +1 @@ +export {User} from "./src/users"; \ No newline at end of file diff --git a/packages/core/package.json b/packages/core/package.json new file mode 100644 index 0000000..8425754 --- /dev/null +++ b/packages/core/package.json @@ -0,0 +1,11 @@ +{ + "name": "core", + "version": "1.0.0", + "description": "", + "main": "index.ts", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC" +} diff --git a/packages/core/src/users.ts b/packages/core/src/users.ts new file mode 100644 index 0000000..8698281 --- /dev/null +++ b/packages/core/src/users.ts @@ -0,0 +1,15 @@ +import AbstractMessaging from "../../messaging-interface/src/index"; + +export abstract class User extends AbstractMessaging { + + abstract createUser(userInput: object | any): void; + abstract getUser(userInput: object | any): void; + abstract fetchChats(fetchChatInput: object | any): void; + abstract fetchChatRequest(fetchChatInput: object | any): void; + abstract conversationHash(conversationHashInput: object | any): void; + abstract latestChatBetweenTwoUsers(latestChatInput: object | any): void; + abstract chatHistoryBetweenTwoUsers(chatHistoryInput: object | any): void; + abstract getPgpPrivateKey(decryptPgpInput: any): void; + abstract sendMessages(sendMessageInput: object | any): void; + abstract approveRequest(approveRequestInput: object | any): void; +} diff --git a/packages/core/tsconfig.json b/packages/core/tsconfig.json new file mode 100644 index 0000000..cdaaf95 --- /dev/null +++ b/packages/core/tsconfig.json @@ -0,0 +1,14 @@ +{ + "extends": "@merokudao/tsconfig/corelib.json", + "include": [ + "./src/**/*.ts", + "./index.ts", + "./src/**/*.d.ts" + ], + "exclude": ["./dist", "./build", "./node_modules"], + "compilerOptions": { + "outDir": "dist", + "module": "NodeNext", + "moduleResolution": "NodeNext" + } +} \ No newline at end of file diff --git a/packages/messaging-push/src/baseclass/BasePushAPI.ts b/packages/messaging-push/src/baseclass/BasePushAPI.ts index c244890..6cdae74 100644 --- a/packages/messaging-push/src/baseclass/BasePushAPI.ts +++ b/packages/messaging-push/src/baseclass/BasePushAPI.ts @@ -5,8 +5,9 @@ import { conversationHashResponse, } from "../interfaces/pushinterfaces"; import AbstractMessaging from "../../../messaging-interface/src/index"; +import {User} from "../../../core/index" -export class BasePushAPI extends AbstractMessaging { +export class BasePushAPI extends User { config: IConfig; constructor(config: IConfig) { super(); diff --git a/packages/messaging-push/tsconfig.json b/packages/messaging-push/tsconfig.json index d131fa2..cdaaf95 100644 --- a/packages/messaging-push/tsconfig.json +++ b/packages/messaging-push/tsconfig.json @@ -8,5 +8,7 @@ "exclude": ["./dist", "./build", "./node_modules"], "compilerOptions": { "outDir": "dist", + "module": "NodeNext", + "moduleResolution": "NodeNext" } } \ No newline at end of file diff --git a/packages/messaging/tsconfig.json b/packages/messaging/tsconfig.json index d131fa2..cdaaf95 100644 --- a/packages/messaging/tsconfig.json +++ b/packages/messaging/tsconfig.json @@ -8,5 +8,7 @@ "exclude": ["./dist", "./build", "./node_modules"], "compilerOptions": { "outDir": "dist", + "module": "NodeNext", + "moduleResolution": "NodeNext" } } \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 3387d99..f92059f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3397,6 +3397,12 @@ __metadata: languageName: node linkType: hard +"core@workspace:packages/core": + version: 0.0.0-use.local + resolution: "core@workspace:packages/core" + languageName: unknown + linkType: soft + "cross-fetch@npm:^4.0.0": version: 4.0.0 resolution: "cross-fetch@npm:4.0.0" From c5f6eff59e8355065e86cd82af4868d6dff8c7dc Mon Sep 17 00:00:00 2001 From: Ankush523 Date: Sat, 9 Sep 2023 19:10:08 +0530 Subject: [PATCH 2/4] made User a standable class --- packages/core/index.ts | 2 +- packages/core/package.json | 19 +++++++++++++++---- packages/core/src/users.ts | 14 ++++++++------ packages/messaging-interface/src/index.ts | 4 ++-- packages/messaging-interface/tsconfig.json | 2 ++ yarn.lock | 12 ++++++------ 6 files changed, 34 insertions(+), 19 deletions(-) diff --git a/packages/core/index.ts b/packages/core/index.ts index 8758227..3bd9d5d 100644 --- a/packages/core/index.ts +++ b/packages/core/index.ts @@ -1 +1 @@ -export {User} from "./src/users"; \ No newline at end of file +export {User} from "./src/users"; diff --git a/packages/core/package.json b/packages/core/package.json index 8425754..875c97c 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,11 +1,22 @@ { - "name": "core", + "name": "@dapp-sdk/core", "version": "1.0.0", - "description": "", - "main": "index.ts", + "description": "Core package for users for dApp SDK", + "main": "dist/index.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "build": "tsc" }, + "keywords": [ + "meroku", + "dapp-sdk", + "core" + ], + "publishConfig": { + "access": "public" + }, + "files": [ + "dist/**/*" + ], "author": "", "license": "ISC" } diff --git a/packages/core/src/users.ts b/packages/core/src/users.ts index 8698281..8b3bb9e 100644 --- a/packages/core/src/users.ts +++ b/packages/core/src/users.ts @@ -1,15 +1,17 @@ -import AbstractMessaging from "../../messaging-interface/src/index"; +import * as PushAPI from "@pushprotocol/restapi"; -export abstract class User extends AbstractMessaging { +export abstract class User { abstract createUser(userInput: object | any): void; + abstract getUser(userInput: object | any): void; + abstract fetchChats(fetchChatInput: object | any): void; - abstract fetchChatRequest(fetchChatInput: object | any): void; - abstract conversationHash(conversationHashInput: object | any): void; + abstract latestChatBetweenTwoUsers(latestChatInput: object | any): void; + abstract chatHistoryBetweenTwoUsers(chatHistoryInput: object | any): void; - abstract getPgpPrivateKey(decryptPgpInput: any): void; + abstract sendMessages(sendMessageInput: object | any): void; - abstract approveRequest(approveRequestInput: object | any): void; + } diff --git a/packages/messaging-interface/src/index.ts b/packages/messaging-interface/src/index.ts index 594378b..31e7e06 100644 --- a/packages/messaging-interface/src/index.ts +++ b/packages/messaging-interface/src/index.ts @@ -1,6 +1,6 @@ -import * as PushAPI from "@pushprotocol/restapi"; +import { User } from "../../core/index"; -abstract class AbstractMessaging{ +abstract class AbstractMessaging extends User { abstract createUser( userInput: object | any ): void; diff --git a/packages/messaging-interface/tsconfig.json b/packages/messaging-interface/tsconfig.json index c760d55..fecab6c 100644 --- a/packages/messaging-interface/tsconfig.json +++ b/packages/messaging-interface/tsconfig.json @@ -7,5 +7,7 @@ "exclude": ["./dist", "./build", "./node_modules"], "compilerOptions": { "outDir": "dist", + "module": "NodeNext", + "moduleResolution": "NodeNext" } } \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index f92059f..bbbe78e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -491,6 +491,12 @@ __metadata: languageName: unknown linkType: soft +"@dapp-sdk/core@workspace:packages/core": + version: 0.0.0-use.local + resolution: "@dapp-sdk/core@workspace:packages/core" + languageName: unknown + linkType: soft + "@dapp-sdk/finance-interface@1.0.0, @dapp-sdk/finance-interface@workspace:packages/finance-interface": version: 0.0.0-use.local resolution: "@dapp-sdk/finance-interface@workspace:packages/finance-interface" @@ -3397,12 +3403,6 @@ __metadata: languageName: node linkType: hard -"core@workspace:packages/core": - version: 0.0.0-use.local - resolution: "core@workspace:packages/core" - languageName: unknown - linkType: soft - "cross-fetch@npm:^4.0.0": version: 4.0.0 resolution: "cross-fetch@npm:4.0.0" From e7d5ccb0658bcdbbbb10c425978127154ff82b01 Mon Sep 17 00:00:00 2001 From: Ankush523 Date: Sat, 9 Sep 2023 19:23:14 +0530 Subject: [PATCH 3/4] removed unnecessary functions from Users --- packages/core/package.json | 2 +- packages/core/src/users.ts | 8 -------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/packages/core/package.json b/packages/core/package.json index 875c97c..85e9f42 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,7 +1,7 @@ { "name": "@dapp-sdk/core", "version": "1.0.0", - "description": "Core package for users for dApp SDK", + "description": "The core components for dApp-SDK. These are required by almost every other package", "main": "dist/index.js", "scripts": { "build": "tsc" diff --git a/packages/core/src/users.ts b/packages/core/src/users.ts index 8b3bb9e..f9d5471 100644 --- a/packages/core/src/users.ts +++ b/packages/core/src/users.ts @@ -6,12 +6,4 @@ export abstract class User { abstract getUser(userInput: object | any): void; - abstract fetchChats(fetchChatInput: object | any): void; - - abstract latestChatBetweenTwoUsers(latestChatInput: object | any): void; - - abstract chatHistoryBetweenTwoUsers(chatHistoryInput: object | any): void; - - abstract sendMessages(sendMessageInput: object | any): void; - } From 514a1167b6500915769dd981a7dee6646d77c233 Mon Sep 17 00:00:00 2001 From: Ankush523 Date: Sat, 9 Sep 2023 19:44:07 +0530 Subject: [PATCH 4/4] updated license and versions --- packages/core/package.json | 2 +- packages/messaging-interface/package.json | 2 +- packages/messaging-push/package.json | 2 +- yarn.lock | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/core/package.json b/packages/core/package.json index 85e9f42..435f99d 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -18,5 +18,5 @@ "dist/**/*" ], "author": "", - "license": "ISC" + "license": "MIT" } diff --git a/packages/messaging-interface/package.json b/packages/messaging-interface/package.json index 745d844..e7bd48a 100644 --- a/packages/messaging-interface/package.json +++ b/packages/messaging-interface/package.json @@ -1,7 +1,7 @@ { "name": "@dapp-sdk/messaging-interface", "description": "Messaging Interface for dApp SDK", - "version": "1.0.0", + "version": "1.0.1", "main": "index.js", "scripts": { "build": "tsc" diff --git a/packages/messaging-push/package.json b/packages/messaging-push/package.json index 7584098..039e63d 100644 --- a/packages/messaging-push/package.json +++ b/packages/messaging-push/package.json @@ -1,6 +1,6 @@ { "name": "@dapp-sdk/messaging-push", - "version": "1.0.2", + "version": "1.0.3", "author": "Push Protocol", "description": "Push Protocol Implementation for Messaging in dapp-sdk", "main": "dist/messaging-push/src/index.js", diff --git a/yarn.lock b/yarn.lock index bbbe78e..b9fd9df 100644 --- a/yarn.lock +++ b/yarn.lock @@ -492,7 +492,7 @@ __metadata: linkType: soft "@dapp-sdk/core@workspace:packages/core": - version: 0.0.0-use.local + version: 1.0.0 resolution: "@dapp-sdk/core@workspace:packages/core" languageName: unknown linkType: soft