@jokio/sdk 0.0.1 → 0.0.3
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/README.md +10 -0
- package/dist/auth.service.d.ts +3 -1
- package/dist/index.d.ts +4 -5
- package/dist/index.html +51 -8
- package/dist/jokio.sdk.es.js +1125 -1094
- package/dist/jokio.sdk.umd.js +24 -24
- package/dist/nats.service.d.ts +13 -4
- package/dist/tts.service.d.ts +11 -9
- package/dist/voicevoxTts.d.ts +11 -0
- package/package.json +3 -1
- package/src/auth.service.ts +37 -9
- package/src/index.ts +10 -8
- package/src/nats.service.ts +59 -38
- package/src/tts.service.ts +134 -75
- package/src/voicevoxTts.ts +94 -0
- package/test/index.html +51 -8
- package/dist/edgeTts.service.d.ts +0 -13
- package/src/edgeTts.service.ts +0 -153
package/README.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# @jokio/sdk
|
|
2
|
+
|
|
3
|
+
SDK for building decentralised localfirst web apps.
|
|
4
|
+
Provides tts ai model integrations, realtime p2p communication & crypto encryptions.
|
|
5
|
+
|
|
6
|
+
[](https://www.npmjs.com/package/@jokio/sdk)
|
|
7
|
+
|
|
8
|
+
[](https://www.npmjs.com/package/@jokio/sdk)
|
|
9
|
+
|
|
10
|
+
[](https://www.npmjs.com/package/@jokio/sdk)
|
package/dist/auth.service.d.ts
CHANGED
|
@@ -7,7 +7,9 @@ export declare class AuthService {
|
|
|
7
7
|
requestEmailLogin(email: string, returnUrl: string): Promise<boolean>;
|
|
8
8
|
completeEmailLogin(email: string, otpCode: string): Promise<IdentityUser>;
|
|
9
9
|
requestPasskeyLogin(displayName?: string, isRegistration?: boolean, addAsAdditionalDevice?: boolean): Promise<IdentityUser>;
|
|
10
|
-
|
|
10
|
+
guestSignIn(): Promise<IdentityUser>;
|
|
11
|
+
clearLoginData(): Promise<void>;
|
|
12
|
+
getLastLoginData(): any;
|
|
11
13
|
}
|
|
12
14
|
export type IdentityUser = {
|
|
13
15
|
name: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import { AuthService } from './auth.service';
|
|
2
2
|
import { CryptoService } from './crypto.service';
|
|
3
|
-
import { EdgeTtsService } from './edgeTts.service';
|
|
4
3
|
import { NatsService } from './nats.service';
|
|
5
|
-
import {
|
|
4
|
+
import { EdgeTtsService } from './tts.service';
|
|
6
5
|
export { NatsService } from './nats.service';
|
|
6
|
+
export { VoicevoxTtsService } from './voicevoxTts';
|
|
7
7
|
type Config = {
|
|
8
8
|
debug: boolean;
|
|
9
9
|
authUrl: string;
|
|
10
|
-
|
|
10
|
+
natsUrl: string;
|
|
11
11
|
};
|
|
12
12
|
export declare const jok: {
|
|
13
13
|
setup(config: Partial<Config>): void;
|
|
14
14
|
auth: AuthService;
|
|
15
|
-
|
|
16
|
-
voicevoxTts: VoicevoxTtsService;
|
|
15
|
+
tts: EdgeTtsService;
|
|
17
16
|
nats: NatsService<unknown>;
|
|
18
17
|
crypto: CryptoService;
|
|
19
18
|
};
|
package/dist/index.html
CHANGED
|
@@ -9,29 +9,72 @@
|
|
|
9
9
|
<body>
|
|
10
10
|
<h1>Library Test</h1>
|
|
11
11
|
|
|
12
|
-
<button onclick="playAudio()">
|
|
13
|
-
|
|
12
|
+
<button onclick="playAudio()">TTS</button>
|
|
14
13
|
<button onclick="playAudio2()">Voicevox TTS</button>
|
|
15
14
|
|
|
16
15
|
<script type="module">
|
|
17
|
-
import { jok } from '
|
|
16
|
+
// import { jok } from 'https://esm.run/@jokio/sdk';
|
|
17
|
+
import { jok, VoicevoxTtsService } from './dist/jokio.sdk.es.js';
|
|
18
|
+
|
|
18
19
|
window.jok = jok
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
|
|
21
|
+
window.getVoicevoxVoices = async function () {
|
|
22
|
+
const voices = await jok.voicevoxTts.getVoices()
|
|
23
|
+
|
|
24
|
+
console.log(voices)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
window.getVoices = async function () {
|
|
28
|
+
const voices = await jok.tts.getVoices()
|
|
29
|
+
|
|
30
|
+
console.log(voices)
|
|
31
|
+
}
|
|
21
32
|
|
|
22
33
|
window.playAudio = async function () {
|
|
23
|
-
const audio = await jok.
|
|
34
|
+
const audio = await jok.tts.getAudio("Hello there, how are you?", "en-US-AvaNeural")
|
|
24
35
|
|
|
25
36
|
audio.play()
|
|
26
37
|
}
|
|
27
38
|
|
|
28
|
-
|
|
29
39
|
window.playAudio2 = async function () {
|
|
30
|
-
const
|
|
40
|
+
const tts = new VoicevoxTtsService({ voicevoxUrl: 'https://voicevox.fly.dev' })
|
|
41
|
+
|
|
42
|
+
const audio = await tts.getAudio("こんにちわ、おげんきですか?あなたはあたまがいいですね。", 3)
|
|
31
43
|
|
|
32
44
|
audio.play()
|
|
33
45
|
}
|
|
34
46
|
|
|
47
|
+
window.requestEmailLogin = async function (email) {
|
|
48
|
+
const res = await jok.auth.requestEmailLogin(email, 'https://localhost:5173')
|
|
49
|
+
|
|
50
|
+
return res
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
window.completeEmailLogin = async function (email, otpCode) {
|
|
54
|
+
const res = await jok.auth.completeEmailLogin(email, otpCode)
|
|
55
|
+
|
|
56
|
+
return res
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
window.passkeyLogin = async function (displayName) {
|
|
60
|
+
const res = await jok.auth.requestPasskeyLogin(displayName)
|
|
61
|
+
|
|
62
|
+
return res
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
window.natsConnect = async function () {
|
|
66
|
+
await jok.nats.connect()
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
window.natsSubscribe = async function () {
|
|
70
|
+
await jok.nats.on('dev.test', (data, ctx) => {
|
|
71
|
+
console.lg({ data, ctx })
|
|
72
|
+
})
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
window.natsPublish = async function () {
|
|
76
|
+
await jok.nats.publish('dev.test', { name: 'User', age: 11 })
|
|
77
|
+
}
|
|
35
78
|
|
|
36
79
|
window.p2pChat = async function () {
|
|
37
80
|
const k1 = await jok.crypto.createSessionKeyPair()
|