@zhin.js/plugin-music 1.1.22 → 1.1.24
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/lib/runtime.d.ts +2 -1
- package/lib/runtime.d.ts.map +1 -1
- package/lib/runtime.js +3 -2
- package/lib/runtime.js.map +1 -1
- package/package.json +11 -11
- package/plugin.js +3 -4
- package/src/runtime.ts +3 -2
package/lib/runtime.d.ts
CHANGED
|
@@ -8,5 +8,6 @@ export interface MusicRuntime {
|
|
|
8
8
|
readonly sessions: MusicSearchSessions;
|
|
9
9
|
readonly logins: QrLoginRuntime;
|
|
10
10
|
}
|
|
11
|
-
export declare const
|
|
11
|
+
export declare const musicRuntimeStore: import("zhin.js").PluginStore<MusicRuntime, unknown>;
|
|
12
|
+
export declare const musicRuntimeToken: import("zhin.js").PluginStore<MusicRuntime, unknown>;
|
|
12
13
|
//# sourceMappingURL=runtime.d.ts.map
|
package/lib/runtime.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAClE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,WAAW,EAAE,eAAe,CAAC;IACtC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,kBAAkB,CAAC,CAAC,CAAC;IACrE,QAAQ,CAAC,QAAQ,EAAE,mBAAmB,CAAC;IACvC,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;CACjC;AAED,eAAO,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAClE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,WAAW,EAAE,eAAe,CAAC;IACtC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,kBAAkB,CAAC,CAAC,CAAC;IACrE,QAAQ,CAAC,QAAQ,EAAE,mBAAmB,CAAC;IACvC,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;CACjC;AAED,eAAO,MAAM,iBAAiB,sDAG7B,CAAC;AACF,eAAO,MAAM,iBAAiB,sDAAoB,CAAC"}
|
package/lib/runtime.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export const
|
|
1
|
+
import { definePluginStore } from 'zhin.js';
|
|
2
|
+
export const musicRuntimeStore = definePluginStore('zhin.music.runtime', 'Owner-scoped Music runtime');
|
|
3
|
+
export const musicRuntimeToken = musicRuntimeStore;
|
|
3
4
|
//# sourceMappingURL=runtime.js.map
|
package/lib/runtime.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAa5C,MAAM,CAAC,MAAM,iBAAiB,GAAG,iBAAiB,CAChD,oBAAoB,EACpB,4BAA4B,CAC7B,CAAC;AACF,MAAM,CAAC,MAAM,iBAAiB,GAAG,iBAAiB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhin.js/plugin-music",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.24",
|
|
4
4
|
"description": "Music search and sharing plugin for Zhin.js (Plugin Runtime)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -42,22 +42,22 @@
|
|
|
42
42
|
},
|
|
43
43
|
"license": "MIT",
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@zhin.js/core": "1.1.
|
|
46
|
-
"@zhin.js/im-contract": "1.1.
|
|
47
|
-
"@zhin.js/tool": "1.1.
|
|
48
|
-
"@zhin.js/skill": "1.1.
|
|
45
|
+
"@zhin.js/core": "1.1.59",
|
|
46
|
+
"@zhin.js/im-contract": "1.1.13",
|
|
47
|
+
"@zhin.js/tool": "1.1.18",
|
|
48
|
+
"@zhin.js/skill": "1.1.16"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"typescript": "^6.0.3",
|
|
52
52
|
"vitest": "^4.1.10",
|
|
53
|
-
"zhin.js": "1.1.
|
|
53
|
+
"zhin.js": "1.1.24"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"@zhin.js/adapter-icqq": "^1.1.
|
|
57
|
-
"@zhin.js/command": "^1.1.
|
|
58
|
-
"@zhin.js/component": "^1.1.
|
|
59
|
-
"@zhin.js/middleware": "^1.1.
|
|
60
|
-
"zhin.js": "^1.1.
|
|
56
|
+
"@zhin.js/adapter-icqq": "^1.1.25",
|
|
57
|
+
"@zhin.js/command": "^1.1.17",
|
|
58
|
+
"@zhin.js/component": "^1.1.16",
|
|
59
|
+
"@zhin.js/middleware": "^1.1.16",
|
|
60
|
+
"zhin.js": "^1.1.24"
|
|
61
61
|
},
|
|
62
62
|
"peerDependenciesMeta": {
|
|
63
63
|
"@zhin.js/adapter-icqq": {
|
package/plugin.js
CHANGED
|
@@ -4,7 +4,7 @@ import { MusicSearchSessions } from "./lib/session.js";
|
|
|
4
4
|
import { QrLoginRuntime } from "./lib/login/index.js";
|
|
5
5
|
import { CredentialStore, createInMemoryCredentialDb, MUSIC_CREDENTIALS_TABLE, } from "./lib/credential-store.js";
|
|
6
6
|
import { createMusicServices } from "./lib/sources/index.js";
|
|
7
|
-
import {
|
|
7
|
+
import { musicRuntimeStore } from "./lib/runtime.js";
|
|
8
8
|
function defineCredentialTable(db) {
|
|
9
9
|
db.define(MUSIC_CREDENTIALS_TABLE, {
|
|
10
10
|
source: { type: 'text', nullable: false },
|
|
@@ -25,13 +25,12 @@ export default definePlugin({
|
|
|
25
25
|
return host;
|
|
26
26
|
})() : createInMemoryCredentialDb();
|
|
27
27
|
const credentials = new CredentialStore(db);
|
|
28
|
-
const runtime = Object.freeze({
|
|
28
|
+
const runtime = musicRuntimeStore.provide(context, Object.freeze({
|
|
29
29
|
credentials,
|
|
30
30
|
services: Object.freeze(createMusicServices(credentials)),
|
|
31
31
|
sessions: new MusicSearchSessions(),
|
|
32
32
|
logins: new QrLoginRuntime(credentials),
|
|
33
|
-
});
|
|
34
|
-
context.resources.provide(musicRuntimeToken, runtime);
|
|
33
|
+
}));
|
|
35
34
|
const timer = setInterval(() => {
|
|
36
35
|
runtime.sessions.pruneExpired();
|
|
37
36
|
runtime.logins.pruneExpired();
|
package/src/runtime.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { definePluginStore } from 'zhin.js';
|
|
2
2
|
import type { CredentialStore } from './credential-store.js';
|
|
3
3
|
import type { MusicSearchService, MusicSource } from './types.js';
|
|
4
4
|
import type { MusicSearchSessions } from './session.js';
|
|
@@ -11,7 +11,8 @@ export interface MusicRuntime {
|
|
|
11
11
|
readonly logins: QrLoginRuntime;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
export const
|
|
14
|
+
export const musicRuntimeStore = definePluginStore<MusicRuntime>(
|
|
15
15
|
'zhin.music.runtime',
|
|
16
16
|
'Owner-scoped Music runtime',
|
|
17
17
|
);
|
|
18
|
+
export const musicRuntimeToken = musicRuntimeStore;
|