chore: update wasm dep & release 1.0.7
This commit is contained in:
40
.github/workflows/release.yml
vendored
Normal file
40
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
release:
|
||||
name: Release
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '20'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
|
||||
- name: Build
|
||||
run: npm run build
|
||||
|
||||
- name: Authenticate with npm registry
|
||||
run: npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}
|
||||
|
||||
- name: Config npm
|
||||
run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
|
||||
env:
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
|
||||
- name: Publish
|
||||
env:
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
run: npm publish -r --access public --no-git-checks
|
||||
17
README.md
17
README.md
@@ -15,14 +15,14 @@ For the SDK reference, see [https://docs.openim.io/sdks/quickstart/electron](htt
|
||||
### Adding Dependencies
|
||||
|
||||
```shell
|
||||
npm install open-im-sdk-wasm @openim/electron-client-sdk --save
|
||||
npm install @openim/wasm-client-sdk @openim/electron-client-sdk --save
|
||||
```
|
||||
|
||||
### Obtaining Required Static Resources for WASM
|
||||
|
||||
Follow these steps to obtain the static resources required for WebAssembly (WASM):
|
||||
|
||||
1. Locate the `open-im-sdk-wasm` subdirectory in the `node_modules` directory of your project. Copy all the files in the `assets` folder to your project's public resource directory.
|
||||
1. Locate the `@openim/wasm-client-sdk` subdirectory in the `node_modules` directory of your project. Copy all the files in the `assets` folder to your project's public resource directory.
|
||||
|
||||
The files to be copied are:
|
||||
|
||||
@@ -34,7 +34,7 @@ Follow these steps to obtain the static resources required for WebAssembly (WASM
|
||||
|
||||
### Possible Issues ❗
|
||||
|
||||
> if you are using webpack4, you may flow this issue [How to import open-im-sdk-wasm in webpack4.x](https://github.com/openimsdk/open-im-sdk-web-wasm/issues/73).
|
||||
> if you are using webpack4, you may flow this issue [How to import @openim/wasm-client-sdk in webpack4.x](https://github.com/openimsdk/open-im-sdk-web-wasm/issues/73).
|
||||
|
||||
## Usage 🚀
|
||||
|
||||
@@ -73,8 +73,8 @@ export const IMSDK = instance;
|
||||
> Note: You need to [deploy](https://github.com/openimsdk/open-im-server#rocket-quick-start) OpenIM Server first, the default port of OpenIM Server is 10001, 10002.
|
||||
|
||||
```typescript
|
||||
import { CbEvents, LogLevel } from 'open-im-sdk-wasm';
|
||||
import type { WSEvent } from 'open-im-sdk-wasm/lib/types/entity';
|
||||
import { CbEvents, LogLevel } from '@openim/wasm-client-sdk';
|
||||
import type { WSEvent } from '@openim/wasm-client-sdk/lib/types/entity';
|
||||
|
||||
IMSDK.on(CbEvents.OnConnecting, handleConnecting);
|
||||
IMSDK.on(CbEvents.OnConnectFailed, handleConnectFailed);
|
||||
@@ -127,8 +127,11 @@ To log into the IM server, you need to create an account and obtain a user ID an
|
||||
OpenIM makes it easy to send and receive messages. By default, there is no restriction on having a friend relationship to send messages (although you can configure other policies on the server). If you know the user ID of the recipient, you can conveniently send a message to them.
|
||||
|
||||
```typescript
|
||||
import { CbEvents } from 'open-im-sdk-wasm';
|
||||
import type { WSEvent, MessageItem } from 'open-im-sdk-wasm/lib/types/entity';
|
||||
import { CbEvents } from '@openim/wasm-client-sdk';
|
||||
import type {
|
||||
WSEvent,
|
||||
MessageItem,
|
||||
} from '@openim/wasm-client-sdk/lib/types/entity';
|
||||
|
||||
// Listenfor new messages 📩
|
||||
IMSDK.on(CbEvents.OnRecvNewMessages, handleNewMessages);
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
27
package-lock.json
generated
27
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@openim/electron-client-sdk",
|
||||
"version": "1.0.2",
|
||||
"version": "1.0.6",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@openim/electron-client-sdk",
|
||||
"version": "1.0.2",
|
||||
"version": "1.0.6",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"koffi": "^2.8.0",
|
||||
@@ -31,7 +31,6 @@
|
||||
"husky": "^6.0.0",
|
||||
"jest": "^27.2.0",
|
||||
"lint-staged": "^10.5.4",
|
||||
"open-im-sdk-wasm": "^3.5.3-alpha.3",
|
||||
"prettier": "^2.2.1",
|
||||
"rollup": "^2.79.1",
|
||||
"rollup-plugin-typescript2": "^0.36.0",
|
||||
@@ -43,8 +42,8 @@
|
||||
"node": ">=12.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"electron": ">=12.0.0",
|
||||
"open-im-sdk-wasm": "^3.5.3-alpha.5"
|
||||
"@openim/wasm-client-sdk": "^3.8.0-rc.0",
|
||||
"electron": ">=12.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@aashutoshrathi/word-wrap": {
|
||||
@@ -1881,6 +1880,15 @@
|
||||
"@octokit/openapi-types": "^18.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@openim/wasm-client-sdk": {
|
||||
"version": "3.8.0-rc.0",
|
||||
"resolved": "https://registry.npmjs.org/@openim/wasm-client-sdk/-/wasm-client-sdk-3.8.0-rc.0.tgz",
|
||||
"integrity": "sha512-SGd0Yu4tUQfs9FDkR3x49NjX0jPO1W0ETxGYqKO1BMmIyhwVGeKQMpfHD2QXPh2yefhT4OLoNBffHihopUrK6Q==",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@pnpm/config.env-replace": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@pnpm/config.env-replace/-/config.env-replace-1.1.0.tgz",
|
||||
@@ -10172,15 +10180,6 @@
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/open-im-sdk-wasm": {
|
||||
"version": "3.5.3-alpha.3",
|
||||
"resolved": "https://registry.npmjs.org/open-im-sdk-wasm/-/open-im-sdk-wasm-3.5.3-alpha.3.tgz",
|
||||
"integrity": "sha512-J3NMi+G3LM1yjogl47dOR3LS4RD2fyTzn6NzVg9uKcgik2GD5zlopbX9IxH9AMBWEint/f9TpMe3qSF9+9NBBQ==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/optionator": {
|
||||
"version": "0.9.3",
|
||||
"resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@openim/electron-client-sdk",
|
||||
"version": "1.0.6",
|
||||
"version": "1.0.7",
|
||||
"description": "open im sdk for node",
|
||||
"source": "src/index.ts",
|
||||
"main": "lib/index.js",
|
||||
@@ -45,6 +45,7 @@
|
||||
"@commitlint/config-conventional": "^16.2.4",
|
||||
"@rollup/plugin-alias": "^5.1.0",
|
||||
"@rollup/plugin-terser": "^0.4.4",
|
||||
"@openim/wasm-client-sdk": "^3.8.0",
|
||||
"@types/ffi-napi": "^4.0.10",
|
||||
"@types/node": "^12.20.55",
|
||||
"@types/uuid": "^8.3.4",
|
||||
@@ -59,7 +60,6 @@
|
||||
"husky": "^6.0.0",
|
||||
"jest": "^27.2.0",
|
||||
"lint-staged": "^10.5.4",
|
||||
"open-im-sdk-wasm": "^3.5.3-alpha.6",
|
||||
"prettier": "^2.2.1",
|
||||
"rollup": "^2.79.1",
|
||||
"rollup-plugin-typescript2": "^0.36.0",
|
||||
@@ -80,7 +80,7 @@
|
||||
"uuid": "^9.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"electron": ">=12.0.0",
|
||||
"open-im-sdk-wasm": "^3.8.0-rc.8"
|
||||
"@openim/wasm-client-sdk": "^3.8.0",
|
||||
"electron": ">=12.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { CbEvents } from 'open-im-sdk-wasm';
|
||||
import { CbEvents } from '@openim/wasm-client-sdk';
|
||||
export enum NativeEvent {
|
||||
CONNECTING,
|
||||
CONNECT_SUCCESS,
|
||||
|
||||
@@ -14,13 +14,13 @@ import {
|
||||
setupConversationModule,
|
||||
} from './modules/conversation';
|
||||
import { type MessageModuleApi, setupMessageModule } from './modules/message';
|
||||
import { CbEvents, LoginStatus } from 'open-im-sdk-wasm';
|
||||
import { SelfUserInfo } from 'open-im-sdk-wasm/lib/types/entity';
|
||||
import { CbEvents, LoginStatus } from '@openim/wasm-client-sdk';
|
||||
import { SelfUserInfo } from '@openim/wasm-client-sdk/lib/types/entity';
|
||||
import {
|
||||
SetConversationExParams,
|
||||
SetFriendExParams,
|
||||
UploadFileParams,
|
||||
} from 'open-im-sdk-wasm/lib/types/params';
|
||||
} from '@openim/wasm-client-sdk/lib/types/params';
|
||||
import {
|
||||
type SignalingModuleApi,
|
||||
setupSignalingModule,
|
||||
|
||||
@@ -12,8 +12,8 @@ import {
|
||||
SetConversationExParams,
|
||||
SetConversationMsgDestructTimeParams,
|
||||
SetConversationMsgDestructParams,
|
||||
} from 'open-im-sdk-wasm/lib/types/params';
|
||||
import { ConversationItem } from 'open-im-sdk-wasm/lib/types/entity';
|
||||
} from '@openim/wasm-client-sdk/lib/types/params';
|
||||
import { ConversationItem } from '@openim/wasm-client-sdk/lib/types/entity';
|
||||
|
||||
export function setupConversationModule(openIMSDK: OpenIMSDK) {
|
||||
return {
|
||||
|
||||
@@ -10,14 +10,14 @@ import {
|
||||
RemarkFriendParams,
|
||||
SearchFriendParams,
|
||||
SetFriendExParams,
|
||||
} from 'open-im-sdk-wasm/lib/types/params';
|
||||
} from '@openim/wasm-client-sdk/lib/types/params';
|
||||
import {
|
||||
FriendshipInfo,
|
||||
BlackUserItem,
|
||||
FriendApplicationItem,
|
||||
FullUserItem,
|
||||
SearchedFriendsInfo,
|
||||
} from 'open-im-sdk-wasm/lib/types/entity';
|
||||
} from '@openim/wasm-client-sdk/lib/types/entity';
|
||||
|
||||
export function setupFriendModule(openIMSDK: OpenIMSDK) {
|
||||
return {
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
GroupItem,
|
||||
GroupApplicationItem,
|
||||
GroupMemberItem,
|
||||
} from 'open-im-sdk-wasm/lib/types/entity';
|
||||
} from '@openim/wasm-client-sdk/lib/types/entity';
|
||||
import {
|
||||
CreateGroupParams,
|
||||
JoinGroupParams,
|
||||
@@ -20,7 +20,7 @@ import {
|
||||
TransferGroupParams,
|
||||
AccessToGroupParams,
|
||||
OffsetParams,
|
||||
} from 'open-im-sdk-wasm/lib/types/params';
|
||||
} from '@openim/wasm-client-sdk/lib/types/params';
|
||||
|
||||
export function setupGroupModule(openIMSDK: OpenIMSDK) {
|
||||
return {
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
MessageItem,
|
||||
CardElem,
|
||||
AdvancedGetMessageResult,
|
||||
} from 'open-im-sdk-wasm/lib/types/entity';
|
||||
} from '@openim/wasm-client-sdk/lib/types/entity';
|
||||
import {
|
||||
AtMsgParams,
|
||||
LocationMsgParams,
|
||||
@@ -28,7 +28,7 @@ import {
|
||||
SoundMsgParamsByURL,
|
||||
SendGroupReadReceiptParams,
|
||||
GetGroupMessageReaderParams,
|
||||
} from 'open-im-sdk-wasm/lib/types/params';
|
||||
} from '@openim/wasm-client-sdk/lib/types/params';
|
||||
import {
|
||||
VideoMsgByPathParams,
|
||||
SoundMsgByPathParams,
|
||||
|
||||
@@ -8,12 +8,12 @@ import {
|
||||
RtcActionParams,
|
||||
SignalingInviteParams,
|
||||
UpdateMeetingParams,
|
||||
} from 'open-im-sdk-wasm/lib/types/params';
|
||||
} from '@openim/wasm-client-sdk/lib/types/params';
|
||||
import {
|
||||
RtcInviteResults,
|
||||
CallingRoomData,
|
||||
MeetingRecord,
|
||||
} from 'open-im-sdk-wasm/lib/types/entity';
|
||||
} from '@openim/wasm-client-sdk/lib/types/entity';
|
||||
|
||||
export function setupSignalingModule(openIMSDK: OpenIMSDK) {
|
||||
return {
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import { v4 as uuidV4 } from 'uuid';
|
||||
import { BaseResponse } from '@/types/entity';
|
||||
import OpenIMSDK from '..';
|
||||
import { MessageReceiveOptType } from 'open-im-sdk-wasm';
|
||||
import { MessageReceiveOptType } from '@openim/wasm-client-sdk';
|
||||
import {
|
||||
SelfUserInfo,
|
||||
FullUserItemWithCache,
|
||||
UserOnlineState,
|
||||
} from 'open-im-sdk-wasm/lib/types/entity';
|
||||
} from '@openim/wasm-client-sdk/lib/types/entity';
|
||||
import {
|
||||
GetUserInfoWithCacheParams,
|
||||
PartialUserItem,
|
||||
} from 'open-im-sdk-wasm/lib/types/params';
|
||||
} from '@openim/wasm-client-sdk/lib/types/params';
|
||||
|
||||
export function setupUserModule(openIMSDK: OpenIMSDK) {
|
||||
return {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ipcMain, WebContents } from 'electron';
|
||||
import { CbEvents } from 'open-im-sdk-wasm';
|
||||
import { CbEvents } from '@openim/wasm-client-sdk';
|
||||
import OpenIMSDK from './core';
|
||||
|
||||
class OpenIMSDKMain {
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
import { CbEvents, getSDK as WasmGetSDK } from 'open-im-sdk-wasm';
|
||||
import { MessageItem, WsResponse } from 'open-im-sdk-wasm/lib/types/entity';
|
||||
import { CbEvents, getSDK as WasmGetSDK } from '@openim/wasm-client-sdk';
|
||||
import {
|
||||
MessageItem,
|
||||
WsResponse,
|
||||
} from '@openim/wasm-client-sdk/lib/types/entity';
|
||||
import {
|
||||
WasmPathConfig,
|
||||
InitAndLoginConfig,
|
||||
} from 'open-im-sdk-wasm/lib/types/params';
|
||||
} from '@openim/wasm-client-sdk/lib/types/params';
|
||||
import Emitter from './utils/emitter';
|
||||
import {
|
||||
InitConfig,
|
||||
@@ -109,7 +112,7 @@ const methodCache = new WeakMap<Function, any>();
|
||||
|
||||
async function createWasmSDK(wasmConfig?: WasmPathConfig): Promise<void> {
|
||||
if (!wasmSDK) {
|
||||
const { getSDK } = await import('open-im-sdk-wasm');
|
||||
const { getSDK } = await import('@openim/wasm-client-sdk');
|
||||
wasmSDK = getSDK(wasmConfig) as unknown as IMSDKInterface;
|
||||
}
|
||||
}
|
||||
@@ -148,6 +151,7 @@ export function getWithRenderProcess(
|
||||
return cachedMethod(...args);
|
||||
}
|
||||
// @ts-ignore
|
||||
// eslint-disable-next-line
|
||||
const method = async (...args: any[]) => wasmSDK;
|
||||
methodCache.set(wasmSDK![prop], method);
|
||||
return method(...args);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { CbEvents } from 'open-im-sdk-wasm';
|
||||
import { CbEvents } from '@openim/wasm-client-sdk';
|
||||
|
||||
export type EmitProxy = (event: CbEvents, ...args: any[]) => void;
|
||||
|
||||
|
||||
2
src/types/global.d.ts
vendored
2
src/types/global.d.ts
vendored
@@ -1,4 +1,4 @@
|
||||
import { WsResponse } from 'open-im-sdk-wasm/lib/types/entity';
|
||||
import { WsResponse } from '@openim/wasm-client-sdk/lib/types/entity';
|
||||
|
||||
export interface IOpenIMRenderAPI {
|
||||
subscribe: (
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { LogLevel } from 'open-im-sdk-wasm';
|
||||
import { LogLevel } from '@openim/wasm-client-sdk';
|
||||
export interface InitConfig {
|
||||
apiAddr: string;
|
||||
wsAddr: string;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { CbEvents } from 'open-im-sdk-wasm';
|
||||
import { CbEvents } from '@openim/wasm-client-sdk';
|
||||
|
||||
interface Events {
|
||||
[key: string]: Cbfn[];
|
||||
|
||||
Reference in New Issue
Block a user