@pulsesync/yamusic-types 0.0.5 → 0.2.0
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/LICENSE +21 -21
- package/README.md +17 -25
- package/dist/addonModules.d.ts +63 -0
- package/dist/addonModules.js +1 -0
- package/dist/index.d.ts +1 -0
- package/package.json +6 -1
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 PulseSync
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 PulseSync
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @pulsesync/yamusic-types
|
|
2
2
|
|
|
3
|
-
TypeScript
|
|
3
|
+
Типы TypeScript для API PulseSync и Яндекс Музыки. Для React-аддонов WebHost используйте [@pulsesync/addon-sdk](https://www.npmjs.com/package/@pulsesync/addon-sdk).
|
|
4
|
+
|
|
5
|
+
## Установка
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
yarn add --dev @pulsesync/yamusic-types
|
|
9
|
+
```
|
|
4
10
|
|
|
5
11
|
## Использование
|
|
6
12
|
|
|
@@ -8,36 +14,22 @@ TypeScript declaration package for PulseSync YaMusic addons.
|
|
|
8
14
|
import type { PulseSyncApi, SonataState } from '@pulsesync/yamusic-types'
|
|
9
15
|
```
|
|
10
16
|
|
|
17
|
+
Для типизации глобальных объектов `window` подключите отдельный модуль:
|
|
18
|
+
|
|
11
19
|
```ts
|
|
12
20
|
import '@pulsesync/yamusic-types/global'
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
## Уведомления
|
|
16
|
-
|
|
17
|
-
`showToast(message, options?)` показывает верхний тост ЯМ. `showNotification(message, 'info' | 'error', options?)` использует нижние нативные контейнеры. `NotificationOptions` и `PulseSyncToastOptions` принимают `durationMs` (по умолчанию 4000, от 1500 до 10000 мс).
|
|
18
21
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
`NotificationOptions` также принимает `icon` или `coverUrl` и `link: { label, href }`. Ссылки и обложки допускают HTTP(S) либо путь приложения. Для SDK имя иконки типизировано каталогом.
|
|
22
|
-
|
|
23
|
-
## Модалки
|
|
24
|
-
|
|
25
|
-
`showModal('alert' | 'confirm', options)` показывает нативную модалку ЯМ. `ModalOptions` содержит обязательные `title` (до 200 символов) и `message` (до 5000), а также необязательные `confirmLabel` и `cancelLabel` (до 80). В `alert` показывается одна основная кнопка, в `confirm` — основная и отмена. HTML не обрабатывается.
|
|
22
|
+
const api = window.pulsesyncApi
|
|
23
|
+
```
|
|
26
24
|
|
|
27
|
-
|
|
25
|
+
Пакет описывает API, но не устанавливает мод и не создаёт объекты во время выполнения. Доступность методов зависит от версии PulseSync и окружения; глобальные объекты могут отсутствовать.
|
|
28
26
|
|
|
29
27
|
## Разработка
|
|
30
28
|
|
|
31
29
|
```bash
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
## Публикация
|
|
38
|
-
|
|
39
|
-
```bash
|
|
40
|
-
npm run publish:public
|
|
30
|
+
yarn install
|
|
31
|
+
yarn run check
|
|
32
|
+
yarn build
|
|
41
33
|
```
|
|
42
34
|
|
|
43
|
-
|
|
35
|
+
Лицензия: GPL-3.0-or-later.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
export type AddonModuleKind = 'javascript' | 'wasm';
|
|
2
|
+
export type AddonModuleAccess = 'public' | 'protected';
|
|
3
|
+
export type AddonModuleStatus = 'draft' | 'pending' | 'accepted' | 'rejected' | 'revoked';
|
|
4
|
+
export type AddonModuleChannel = 'stable' | 'dev';
|
|
5
|
+
export type AddonModuleReference = Readonly<{
|
|
6
|
+
moduleId: string;
|
|
7
|
+
apiMajor: number;
|
|
8
|
+
optional?: boolean;
|
|
9
|
+
} & ({
|
|
10
|
+
channel: AddonModuleChannel;
|
|
11
|
+
version?: never;
|
|
12
|
+
} | {
|
|
13
|
+
version: string;
|
|
14
|
+
channel?: never;
|
|
15
|
+
})>;
|
|
16
|
+
export type AddonModuleReferences = Readonly<Record<string, AddonModuleReference>>;
|
|
17
|
+
export type AddonModuleErrorCode = 'unsupported-host' | 'undeclared-module' | 'unavailable' | 'revoked' | 'access-denied' | 'incompatible-api' | 'integrity-mismatch' | 'aborted' | 'initialization-failed' | 'reload-required';
|
|
18
|
+
export interface AddonModuleDescriptor {
|
|
19
|
+
readonly formatVersion: 1;
|
|
20
|
+
readonly moduleId: string;
|
|
21
|
+
readonly versionId: string;
|
|
22
|
+
readonly version: string;
|
|
23
|
+
readonly apiMajor: number;
|
|
24
|
+
readonly kind: AddonModuleKind;
|
|
25
|
+
readonly access: AddonModuleAccess;
|
|
26
|
+
readonly sha256: string;
|
|
27
|
+
readonly size: number;
|
|
28
|
+
}
|
|
29
|
+
export interface AddonModuleSecurityManifest {
|
|
30
|
+
readonly formatVersion: 1;
|
|
31
|
+
readonly runtime: 'isolated';
|
|
32
|
+
readonly kind: 'web-addon';
|
|
33
|
+
readonly apiVersion: number;
|
|
34
|
+
readonly capabilities: readonly ['modules-v1'];
|
|
35
|
+
readonly allowedUrls: readonly string[];
|
|
36
|
+
readonly modules: AddonModuleReferences;
|
|
37
|
+
}
|
|
38
|
+
export interface AddonModuleReleaseBinding {
|
|
39
|
+
readonly formatVersion: 1;
|
|
40
|
+
readonly catalogAddonId: string;
|
|
41
|
+
readonly releaseId: string;
|
|
42
|
+
readonly runtimeId: string;
|
|
43
|
+
readonly codeHash: string;
|
|
44
|
+
readonly manifestHash: string;
|
|
45
|
+
}
|
|
46
|
+
export interface AddonModuleResolution {
|
|
47
|
+
readonly activationId: string;
|
|
48
|
+
readonly releaseBinding: string;
|
|
49
|
+
readonly descriptors: Readonly<Record<string, AddonModuleDescriptor>>;
|
|
50
|
+
readonly errors: Readonly<Record<string, AddonModuleErrorCode>>;
|
|
51
|
+
}
|
|
52
|
+
export interface AddonModuleChallenge {
|
|
53
|
+
readonly challenge: string;
|
|
54
|
+
readonly moduleVersionId: string;
|
|
55
|
+
readonly expiresAt: number;
|
|
56
|
+
}
|
|
57
|
+
export interface AddonModuleLoadOptions {
|
|
58
|
+
readonly authorize?: (challenge: AddonModuleChallenge) => Promise<string>;
|
|
59
|
+
}
|
|
60
|
+
export interface AddonModules {
|
|
61
|
+
load<T = unknown>(alias: string, options?: AddonModuleLoadOptions): Promise<T>;
|
|
62
|
+
instantiateWasm<T = Readonly<Record<string, (...args: never[]) => unknown>>>(alias: string, options?: AddonModuleLoadOptions): Promise<T>;
|
|
63
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pulsesync/yamusic-types",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "TypeScript declaration package for PulseSync YaMusic addon development",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/PulseSync-LLC/PulseSync-yamusic-types.git"
|
|
8
|
+
},
|
|
5
9
|
"license": "GPL-3.0-or-later",
|
|
6
10
|
"type": "module",
|
|
11
|
+
"packageManager": "yarn@1.22.22",
|
|
7
12
|
"sideEffects": false,
|
|
8
13
|
"types": "./dist/index.d.ts",
|
|
9
14
|
"exports": {
|