next-box 2.1.83 → 2.1.84
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 +211 -0
- package/app/api/storage-api.d.ts +20 -4
- package/app/api/user-api.d.ts +48 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -43,3 +43,214 @@ nb.init((state) => {
|
|
|
43
43
|
|
|
44
44
|
- Перейти на **/** `Transport.navigate('/', {}, '_self')`
|
|
45
45
|
- Перейти на **/** и добавить **queryParams** `Transport.navigate('/', {'key': 'value'}, '_self')`
|
|
46
|
+
|
|
47
|
+
## Инстанс NextBox
|
|
48
|
+
|
|
49
|
+
```javascript
|
|
50
|
+
export declare class NextBox extends EventEmitter {
|
|
51
|
+
/**
|
|
52
|
+
* Хранит актуальное состояние подключения
|
|
53
|
+
*/
|
|
54
|
+
state?: AppState;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Метод подключения к приложению, будет вызван после получения актуального состояния
|
|
58
|
+
*/
|
|
59
|
+
init(handler?: (state: AppState) => void): void;
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Инстанс StorageApi
|
|
64
|
+
|
|
65
|
+
```javascript
|
|
66
|
+
export declare class StorageApi extends Api {
|
|
67
|
+
/**
|
|
68
|
+
* Получить список файлов
|
|
69
|
+
*/
|
|
70
|
+
list(params: StorageRequestListParams): Promise<ResponseList<StorageElement>>;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Информация о файле (модель)
|
|
74
|
+
*/
|
|
75
|
+
info(path: string): Promise<StorageElement>;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Создать файл или папку
|
|
79
|
+
*/
|
|
80
|
+
create(name: string, path: string, type: 'dir' | 'file'): Promise<ResponseItem<StorageElement>>;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Удалить файл или папку
|
|
84
|
+
*/
|
|
85
|
+
delete(path: string, hard?: boolean): Promise<any>;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Возвращает полный путь для загрузки файла
|
|
89
|
+
*/
|
|
90
|
+
makeDownloadPath(path?: string, options?: MakePathOption): string;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Возвращает полный путь к изображению предварительного просмотра
|
|
94
|
+
*/
|
|
95
|
+
makeImagePreview(path?: string, options?: MakePathOption): string;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Получить тело файла
|
|
99
|
+
*/
|
|
100
|
+
download(path?: string): Promise<Response>;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Отправьте запрос на изменение файла
|
|
104
|
+
*/
|
|
105
|
+
replace(body: any, path?: string): Promise<Response | null>;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Синхронная запись в файлы
|
|
109
|
+
*/
|
|
110
|
+
liveReplace(body: any, path?: string): void;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Загрузить файл
|
|
114
|
+
*/
|
|
115
|
+
upload(path: string, file: File): Promise<{
|
|
116
|
+
row: StorageElement;
|
|
117
|
+
}>;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Загрузить файл по URL-адресу
|
|
121
|
+
*/
|
|
122
|
+
uploadNet(path: string, url: string, overwrite?: boolean): Promise<StorageElement>;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Создать файд метаданных для расширения
|
|
126
|
+
*/
|
|
127
|
+
createMeta(name?: string, path?: string): Promise<{
|
|
128
|
+
row: StorageElement;
|
|
129
|
+
}>;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Прочитать метаданные расширения
|
|
133
|
+
*/
|
|
134
|
+
readMeta(path?: string): Promise<any>;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Сохранить метаданные расширения
|
|
138
|
+
*/
|
|
139
|
+
saveMeta(body: any, path?: string): Promise<any>;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Относительный путь (откуда вызывается редактор)
|
|
143
|
+
*/
|
|
144
|
+
relativePath(path?: string, defaultPath?: string): string;
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Возвращает действительный URL-адрес в API (storage или FCA)
|
|
148
|
+
*/
|
|
149
|
+
makeApiPath(...arg: string[]): URL;
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Возвращает имя метафайла расширения (берется из extenstion.name.ru)
|
|
153
|
+
*/
|
|
154
|
+
get metaName(): string;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Инстанс UserApi
|
|
160
|
+
|
|
161
|
+
```javascript
|
|
162
|
+
export declare class UserApi extends Api {
|
|
163
|
+
/**
|
|
164
|
+
* Выход из системы
|
|
165
|
+
*/
|
|
166
|
+
logout(): Promise<void>;
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Получить данные пользователя по его id
|
|
170
|
+
*/
|
|
171
|
+
get(id: number): Promise<User>;
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Список пользователей
|
|
175
|
+
*/
|
|
176
|
+
list(params: RequestUserListParams): Promise<ResponseList<User>>;
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Вернуть удаленного пользователя
|
|
180
|
+
*/
|
|
181
|
+
restore(id: number): Promise<void>;
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Удалить пользователя
|
|
185
|
+
*/
|
|
186
|
+
delete(id: number, params?: {
|
|
187
|
+
hard: boolean;
|
|
188
|
+
}): Promise<void>;
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Обновить данные пользователя
|
|
192
|
+
*/
|
|
193
|
+
update(data: UpdateUserParams): Promise<ResponseItem<User>>;
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Создать нового пользователя
|
|
197
|
+
*/
|
|
198
|
+
create(data: CreateUserParams): Promise<ResponseItem<User>>;
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Создать API токен
|
|
202
|
+
*/
|
|
203
|
+
createToken(data: {
|
|
204
|
+
name: string;
|
|
205
|
+
expire_in: string | null;
|
|
206
|
+
}): Promise<UserToken>;
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Получить список пользователей
|
|
210
|
+
*/
|
|
211
|
+
listToken(params: RequestBaseParams): Promise<ResponseList<UserToken>>;
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Удалить токен
|
|
215
|
+
*/
|
|
216
|
+
deleteToken(id: number): Promise<void>;
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Изменить пароль
|
|
220
|
+
*/
|
|
221
|
+
changePassword(data: {
|
|
222
|
+
new_password: string;
|
|
223
|
+
old_password: string;
|
|
224
|
+
}): Promise<{
|
|
225
|
+
success: boolean;
|
|
226
|
+
}>;
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Получить данные о себе
|
|
230
|
+
*/
|
|
231
|
+
me(): Promise<ResponseItem<User>>;
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Загрузить аватар
|
|
235
|
+
*/
|
|
236
|
+
meUploadAvatar(file: Blob, fileName: string): Promise<{
|
|
237
|
+
file_path: string;
|
|
238
|
+
}>;
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Удалить аватар
|
|
242
|
+
*/
|
|
243
|
+
meDeleteAvatar(): Promise<void>;
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Получить список активных сессий
|
|
247
|
+
*/
|
|
248
|
+
meListSession(params: RequestBaseParams): Promise<ResponseList<UserSession>>;
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Удалить сессию по id или все
|
|
252
|
+
*/
|
|
253
|
+
meDeleteSession(id?: number): Promise<void>;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
```
|
package/app/api/storage-api.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Api } from '../classes/api';
|
|
2
2
|
import { StorageElement, StorageElementType } from '../types/storage-element';
|
|
3
|
-
import { RequestBaseParams, ResponseList } from './types/base';
|
|
3
|
+
import { RequestBaseParams, ResponseItem, ResponseList } from './types/base';
|
|
4
4
|
import { RequestStatus } from '../types';
|
|
5
5
|
export interface StorageRequestListParams extends RequestBaseParams {
|
|
6
6
|
path?: string;
|
|
@@ -36,14 +36,18 @@ export declare class StorageApi extends Api {
|
|
|
36
36
|
/**
|
|
37
37
|
* Create empty file
|
|
38
38
|
*/
|
|
39
|
-
create(name: string, path: string, type: 'dir' | 'file'): Promise<
|
|
40
|
-
row: StorageElement;
|
|
41
|
-
}>;
|
|
39
|
+
create(name: string, path: string, type: 'dir' | 'file'): Promise<ResponseItem<StorageElement>>;
|
|
42
40
|
/**
|
|
43
41
|
* Delete file
|
|
44
42
|
*/
|
|
45
43
|
delete(path: string, hard?: boolean): Promise<any>;
|
|
44
|
+
/**
|
|
45
|
+
* Returns the full path to download the file
|
|
46
|
+
*/
|
|
46
47
|
makeDownloadPath(path?: string, options?: MakePathOption): string;
|
|
48
|
+
/**
|
|
49
|
+
* Returns the full path for the preview image
|
|
50
|
+
*/
|
|
47
51
|
makeImagePreview(path?: string, options?: MakePathOption): string;
|
|
48
52
|
/**
|
|
49
53
|
* Submit a file download request
|
|
@@ -53,6 +57,9 @@ export declare class StorageApi extends Api {
|
|
|
53
57
|
* Submit a file change request
|
|
54
58
|
*/
|
|
55
59
|
replace(body: any, path?: string): Promise<Response | null>;
|
|
60
|
+
/**
|
|
61
|
+
* Synchronous writing to files
|
|
62
|
+
*/
|
|
56
63
|
liveReplace(body: any, path?: string): void;
|
|
57
64
|
/**
|
|
58
65
|
* Upload file
|
|
@@ -78,7 +85,16 @@ export declare class StorageApi extends Api {
|
|
|
78
85
|
* Saving metadata extension
|
|
79
86
|
*/
|
|
80
87
|
saveMeta(body: any, path?: string): Promise<any>;
|
|
88
|
+
/**
|
|
89
|
+
* Relative path (where the editor is called from)
|
|
90
|
+
*/
|
|
81
91
|
relativePath(path?: string, defaultPath?: string): string;
|
|
92
|
+
/**
|
|
93
|
+
* Returns a valid URL to the API (storage or fca)
|
|
94
|
+
*/
|
|
82
95
|
makeApiPath(...arg: string[]): URL;
|
|
96
|
+
/**
|
|
97
|
+
* Returns the name for the extension meta file (taken from extenstion.name.ru)
|
|
98
|
+
*/
|
|
83
99
|
get metaName(): string;
|
|
84
100
|
}
|
package/app/api/user-api.d.ts
CHANGED
|
@@ -22,32 +22,80 @@ export interface UserSession {
|
|
|
22
22
|
id: number;
|
|
23
23
|
}
|
|
24
24
|
export declare class UserApi extends Api {
|
|
25
|
+
/**
|
|
26
|
+
* Logout from the system
|
|
27
|
+
*/
|
|
25
28
|
logout(): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Get user data by his id
|
|
31
|
+
*/
|
|
26
32
|
get(id: number): Promise<User>;
|
|
33
|
+
/**
|
|
34
|
+
* List users
|
|
35
|
+
*/
|
|
27
36
|
list(params: RequestUserListParams): Promise<ResponseList<User>>;
|
|
37
|
+
/**
|
|
38
|
+
* Return deleted user
|
|
39
|
+
*/
|
|
28
40
|
restore(id: number): Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* Delete user
|
|
43
|
+
*/
|
|
29
44
|
delete(id: number, params?: {
|
|
30
45
|
hard: boolean;
|
|
31
46
|
}): Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Update user details
|
|
49
|
+
*/
|
|
32
50
|
update(data: UpdateUserParams): Promise<ResponseItem<User>>;
|
|
51
|
+
/**
|
|
52
|
+
* Create a new user
|
|
53
|
+
*/
|
|
33
54
|
create(data: CreateUserParams): Promise<ResponseItem<User>>;
|
|
55
|
+
/**
|
|
56
|
+
* Create an API token
|
|
57
|
+
*/
|
|
34
58
|
createToken(data: {
|
|
35
59
|
name: string;
|
|
36
60
|
expire_in: string | null;
|
|
37
61
|
}): Promise<UserToken>;
|
|
62
|
+
/**
|
|
63
|
+
* Get list of users
|
|
64
|
+
*/
|
|
38
65
|
listToken(params: RequestBaseParams): Promise<ResponseList<UserToken>>;
|
|
66
|
+
/**
|
|
67
|
+
* Delete token
|
|
68
|
+
*/
|
|
39
69
|
deleteToken(id: number): Promise<void>;
|
|
70
|
+
/**
|
|
71
|
+
* Change password
|
|
72
|
+
*/
|
|
40
73
|
changePassword(data: {
|
|
41
74
|
new_password: string;
|
|
42
75
|
old_password: string;
|
|
43
76
|
}): Promise<{
|
|
44
77
|
success: boolean;
|
|
45
78
|
}>;
|
|
79
|
+
/**
|
|
80
|
+
* Get information about yourself
|
|
81
|
+
*/
|
|
46
82
|
me(): Promise<ResponseItem<User>>;
|
|
83
|
+
/**
|
|
84
|
+
* Upload avatar
|
|
85
|
+
*/
|
|
47
86
|
meUploadAvatar(file: Blob, fileName: string): Promise<{
|
|
48
87
|
file_path: string;
|
|
49
88
|
}>;
|
|
89
|
+
/**
|
|
90
|
+
* Delete avatar
|
|
91
|
+
*/
|
|
50
92
|
meDeleteAvatar(): Promise<void>;
|
|
93
|
+
/**
|
|
94
|
+
* Get a list of active sessions
|
|
95
|
+
*/
|
|
51
96
|
meListSession(params: RequestBaseParams): Promise<ResponseList<UserSession>>;
|
|
97
|
+
/**
|
|
98
|
+
* Delete session by id or all
|
|
99
|
+
*/
|
|
52
100
|
meDeleteSession(id?: number): Promise<void>;
|
|
53
101
|
}
|