@jokio/sdk 0.1.10 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth.service.d.ts +25 -0
- package/dist/common/playAudioFromBuffer.d.ts +1 -0
- package/dist/crypto.service.d.ts +9 -0
- package/dist/index.d.ts +19 -0
- package/dist/jokio.sdk.es.js +8534 -0
- package/dist/nats.service.d.ts +45 -0
- package/dist/tts.service.d.ts +13 -0
- package/dist/voicevoxTts.d.ts +11 -0
- package/package.json +7 -3
- package/.prettierrc +0 -12
- package/package-lock.json +0 -1062
- package/src/auth.service.ts +0 -152
- package/src/common/playAudioFromBuffer.ts +0 -15
- package/src/crypto.service.ts +0 -100
- package/src/index.ts +0 -39
- package/src/nats.service.ts +0 -348
- package/src/tts.service.ts +0 -153
- package/src/voicevoxTts.ts +0 -94
- package/tsconfig.json +0 -14
- package/vite.config.ts +0 -23
- /package/{test → dist}/index.html +0 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
type Config = {
|
|
2
|
+
natsUrl: string;
|
|
3
|
+
};
|
|
4
|
+
export declare class NatsService<TApi> {
|
|
5
|
+
private config;
|
|
6
|
+
onStatusChange?: (isConnected: boolean) => void;
|
|
7
|
+
private nc?;
|
|
8
|
+
private sessionId;
|
|
9
|
+
private userId;
|
|
10
|
+
private globalPrefix;
|
|
11
|
+
private resolveConnected;
|
|
12
|
+
isConnected: Promise<unknown>;
|
|
13
|
+
constructor(config: Config);
|
|
14
|
+
connect(opts?: {
|
|
15
|
+
natsWsServerUrls?: string[];
|
|
16
|
+
user?: IdentityUser;
|
|
17
|
+
prefix?: string;
|
|
18
|
+
}): Promise<void>;
|
|
19
|
+
disconnect(): Promise<void>;
|
|
20
|
+
publish<TSubject extends keyof TApi & string>(subject: TSubject, data: InferReturnType<TApi, TSubject>): Promise<void>;
|
|
21
|
+
call<TSubject extends keyof TApi & string>(subject: TSubject, data: InferProps<TApi, TSubject>, opts?: {
|
|
22
|
+
timeoutInMs?: number;
|
|
23
|
+
}): Promise<InferReturnType<TApi, TSubject>>;
|
|
24
|
+
on<TSubject extends keyof TApi & string>(subject: TSubject, cb: (data: InferReturnType<TApi, TSubject>, ctx: {
|
|
25
|
+
subject: string;
|
|
26
|
+
userId: string;
|
|
27
|
+
sessionId: string;
|
|
28
|
+
}) => void): Promise<() => void>;
|
|
29
|
+
/**
|
|
30
|
+
* Reqiores permission to publish response in `_INBOX.>`. If you need to just listen events, use `on`.
|
|
31
|
+
*/
|
|
32
|
+
handler<TSubject extends keyof TApi & string>(subject: TSubject, cb: (data: InferProps<TApi, TSubject>, ctx: {
|
|
33
|
+
subject: string;
|
|
34
|
+
userId: string;
|
|
35
|
+
sessionId: string;
|
|
36
|
+
}) => Promise<InferReturnType<TApi, TSubject>>): Promise<() => void>;
|
|
37
|
+
private buildSubject;
|
|
38
|
+
}
|
|
39
|
+
type IdentityUser = {
|
|
40
|
+
userId: string;
|
|
41
|
+
sessionId: string;
|
|
42
|
+
};
|
|
43
|
+
type InferProps<TApi, TSubject extends keyof TApi> = TApi[TSubject] extends (args: infer TProps) => unknown ? TProps : {};
|
|
44
|
+
type InferReturnType<TApi, TSubject extends keyof TApi> = TApi[TSubject] extends (args: any) => infer TResult ? TResult : TApi[TSubject];
|
|
45
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare class EdgeTtsService {
|
|
2
|
+
getAudioBuffer(text: string, voice: string, options?: {
|
|
3
|
+
pitch?: string;
|
|
4
|
+
rate?: string;
|
|
5
|
+
volume?: string;
|
|
6
|
+
}): Promise<ArrayBuffer>;
|
|
7
|
+
getAudio(text: string, voice: string, options?: {
|
|
8
|
+
pitch?: string;
|
|
9
|
+
rate?: string;
|
|
10
|
+
volume?: string;
|
|
11
|
+
}): Promise<HTMLAudioElement>;
|
|
12
|
+
getVoices(): Promise<any[]>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type Config = {
|
|
2
|
+
voicevoxUrl: string;
|
|
3
|
+
};
|
|
4
|
+
export declare class VoicevoxTtsService {
|
|
5
|
+
private config;
|
|
6
|
+
constructor(config: Config);
|
|
7
|
+
getAudioBuffer(text: string, voice: string): Promise<ArrayBuffer | null>;
|
|
8
|
+
getAudio(text: string, voice: string): Promise<HTMLAudioElement | null>;
|
|
9
|
+
getVoices(): Promise<any[]>;
|
|
10
|
+
}
|
|
11
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jokio/sdk",
|
|
3
3
|
"description": "pure js/ts sdk for building decentralised localfirst web apps. Provides tts ai model integrations, realtime p2p communication & crypto encryptions.",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.12",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/jokio.sdk.umd.js",
|
|
7
|
+
"module": "dist/jokio.sdk.es.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
7
9
|
"keywords": [
|
|
8
10
|
"decentralised",
|
|
9
11
|
"localfirst",
|
|
@@ -18,8 +20,9 @@
|
|
|
18
20
|
"passkeys",
|
|
19
21
|
"webauthn"
|
|
20
22
|
],
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
+
"files": [
|
|
24
|
+
"dist"
|
|
25
|
+
],
|
|
23
26
|
"scripts": {
|
|
24
27
|
"start": "npm run build && vite",
|
|
25
28
|
"build": "vite build && tsc",
|
|
@@ -33,6 +36,7 @@
|
|
|
33
36
|
"vite": "6.3.5"
|
|
34
37
|
},
|
|
35
38
|
"dependencies": {
|
|
39
|
+
"@jokio/sdk": "^0.1.10",
|
|
36
40
|
"@simplewebauthn/browser": "13.1.0",
|
|
37
41
|
"nats.ws": "1.30.3"
|
|
38
42
|
}
|
package/.prettierrc
DELETED