@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 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
+ [![npm version](https://img.shields.io/npm/v/@jokio/sdk.svg?color=brightgreen)](https://www.npmjs.com/package/@jokio/sdk)
7
+
8
+ [![npm downloads](https://img.shields.io/npm/dm/@jokio/sdk.svg)](https://www.npmjs.com/package/@jokio/sdk)
9
+
10
+ [![npm license](https://img.shields.io/npm/l/@jokio/sdk.svg)](https://www.npmjs.com/package/@jokio/sdk)
@@ -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
- signOut(): Promise<IdentityUser>;
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 { VoicevoxTtsService } from './tts.service';
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
- voicevoxUrl: string;
10
+ natsUrl: string;
11
11
  };
12
12
  export declare const jok: {
13
13
  setup(config: Partial<Config>): void;
14
14
  auth: AuthService;
15
- edgeTts: EdgeTtsService;
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()">Edge TTS</button>
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 './dist/jokio.sdk.es.js';
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
- // jok.voicevoxTts.getVoices().then(console.log)
20
- // document.body.innerHTML += `<p>${}</p>`;
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.edgeTts.getAudio("Hello there, how are you?", "en-US-AvaNeural")
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 audio = await jok.voicevoxTts.getAudio("こんにちわ、おげんきですか?あなたはあたまがいいですね。", 3)
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()