@hostlink/light 2.13.2 → 3.0.1
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/dist/apiClient.d.ts +4 -0
- package/dist/auth.d.ts +15 -7
- package/dist/config.d.ts +1 -4
- package/dist/createClient.d.ts +14 -17
- package/dist/createCollection.d.ts +3 -5
- package/dist/createList.d.ts +1 -2
- package/dist/drive.d.ts +62 -17
- package/dist/file.d.ts +17 -24
- package/dist/fileUtils.d.ts +20 -0
- package/dist/folder.d.ts +13 -0
- package/dist/index.d.ts +13 -7
- package/dist/light.js +684 -692
- package/dist/light.umd.cjs +1 -1
- package/dist/mail.d.ts +2 -2
- package/dist/model.d.ts +1 -2
- package/dist/{useModel.d.ts → models.d.ts} +4 -5
- package/dist/mutation.d.ts +1 -5
- package/dist/permission.d.ts +5 -0
- package/dist/query.d.ts +1 -2
- package/dist/role.d.ts +18 -0
- package/dist/toQuery.d.ts +1 -1
- package/dist/user.test.d.ts +1 -0
- package/dist/users.d.ts +25 -24
- package/dist/webauthn.d.ts +4 -6
- package/package.json +3 -3
- package/dist/fs.d.ts +0 -31
- package/dist/roles.d.ts +0 -13
- package/dist/useWebAuthn.d.ts +0 -6
- /package/dist/{fs.test.d.ts → config.test.d.ts} +0 -0
- /package/dist/{mutation.test.d.ts → query.processArgs.test.d.ts} +0 -0
- /package/dist/{roles.test.d.ts → role.test.d.ts} +0 -0
package/dist/auth.d.ts
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { QueryUserFieldsUserFields } from '.';
|
|
2
|
+
import * as webAuthn from "./webauthn";
|
|
3
|
+
export declare const getCurrentUser: (fields?: QueryUserFieldsUserFields) => Promise<any>;
|
|
4
|
+
export declare const login: (username: string, password: string, code?: string) => Promise<boolean>;
|
|
5
|
+
export declare const logout: () => Promise<boolean>;
|
|
6
|
+
export declare const changeExpiredPassword: (username: string, oldPassword: string, newPassword: string) => Promise<boolean>;
|
|
7
|
+
export declare const updatePassword: (oldPassword: string, newPassword: string) => Promise<boolean>;
|
|
8
|
+
export declare const resetPassword: (jwt: string, password: string, code: string) => Promise<boolean>;
|
|
9
|
+
export declare const forgetPassword: (username: string, email: string) => Promise<string>;
|
|
10
|
+
export declare const verifyCode: (jwt: string, code: string) => Promise<boolean>;
|
|
11
|
+
export declare const granted: (rights: string[]) => Promise<string[]>;
|
|
12
|
+
declare const _default: () => {
|
|
13
|
+
getCurrentUser: (fields?: QueryUserFieldsUserFields) => Promise<any>;
|
|
14
|
+
webAuthn: typeof webAuthn;
|
|
7
15
|
google: {
|
|
8
16
|
unlink: () => Promise<boolean>;
|
|
9
17
|
login: (credential: string) => Promise<boolean>;
|
|
@@ -25,7 +33,7 @@ declare const _default: (axios: AxiosInstance) => {
|
|
|
25
33
|
updatePassword: (oldPassword: string, newPassword: string) => Promise<boolean>;
|
|
26
34
|
resetPassword: (jwt: string, password: string, code: string) => Promise<boolean>;
|
|
27
35
|
forgetPassword: (username: string, email: string) => Promise<string>;
|
|
28
|
-
verifyCode(jwt: string, code: string)
|
|
36
|
+
verifyCode: (jwt: string, code: string) => Promise<boolean>;
|
|
29
37
|
granted: (rights: string[]) => Promise<string[]>;
|
|
30
38
|
};
|
|
31
39
|
export default _default;
|
package/dist/config.d.ts
CHANGED
package/dist/createClient.d.ts
CHANGED
|
@@ -1,39 +1,36 @@
|
|
|
1
1
|
import { default as auth } from './auth';
|
|
2
|
+
import { getDrive } from './drive';
|
|
2
3
|
import { AxiosInstance } from 'axios';
|
|
3
4
|
import { Fields } from '.';
|
|
4
|
-
import {
|
|
5
|
-
import { default as
|
|
6
|
-
import {
|
|
7
|
-
import { default as _fs } from './fs';
|
|
8
|
-
import { ModelManager } from './useModel';
|
|
5
|
+
import { getConfig } from './config';
|
|
6
|
+
import { default as mail } from './mail';
|
|
7
|
+
import { ModelManager } from './models';
|
|
9
8
|
import { default as model } from './model';
|
|
10
|
-
import { default as roles } from './
|
|
9
|
+
import { default as roles } from './role';
|
|
11
10
|
import { default as createCollection } from './createCollection';
|
|
12
|
-
import { default as drive } from './drive';
|
|
13
11
|
import { default as createList } from './createList';
|
|
12
|
+
import { default as users } from './users';
|
|
14
13
|
export interface LightClient {
|
|
15
14
|
baseURL: string;
|
|
16
15
|
axios: AxiosInstance;
|
|
17
16
|
auth: ReturnType<typeof auth>;
|
|
18
|
-
mutation: (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
mail: ReturnType<typeof _mail>;
|
|
24
|
-
users: ReturnType<typeof _users>;
|
|
25
|
-
fs: ReturnType<typeof _fs>;
|
|
17
|
+
mutation: (q: Record<string, any>) => Promise<any>;
|
|
18
|
+
query: (q: Record<string, any>) => Promise<any>;
|
|
19
|
+
config: typeof getConfig;
|
|
20
|
+
mail: typeof mail;
|
|
21
|
+
users: ReturnType<typeof users>;
|
|
26
22
|
models: ModelManager;
|
|
27
23
|
model(name: string): ReturnType<typeof model>;
|
|
28
24
|
roles: ReturnType<typeof roles>;
|
|
29
|
-
collect(name: string, fields:
|
|
30
|
-
drive(index: number): ReturnType<typeof
|
|
25
|
+
collect(name: string, fields: Record<string, any>): ReturnType<typeof createCollection>;
|
|
26
|
+
drive(index: number): ReturnType<typeof getDrive>;
|
|
31
27
|
collects(collections: {
|
|
32
28
|
[key: string]: any;
|
|
33
29
|
}): Promise<{
|
|
34
30
|
[key: string]: any;
|
|
35
31
|
}>;
|
|
36
32
|
list(entity: string, fields: Fields): ReturnType<typeof createList>;
|
|
33
|
+
post: AxiosInstance['post'];
|
|
37
34
|
}
|
|
38
35
|
declare const _default: (baseURL: string) => LightClient;
|
|
39
36
|
export default _default;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { AxiosInstance } from 'axios';
|
|
2
1
|
type Operator = '==' | '<' | '<=' | '>' | '>=' | '!==';
|
|
3
2
|
interface FilterValue {
|
|
4
3
|
lt?: any;
|
|
@@ -26,7 +25,7 @@ interface MetaData {
|
|
|
26
25
|
[key: string]: any;
|
|
27
26
|
}
|
|
28
27
|
interface Collection<Item> {
|
|
29
|
-
constructor(fields: Record<string, any
|
|
28
|
+
constructor(fields: Record<string, any>): void;
|
|
30
29
|
[key: string]: any;
|
|
31
30
|
/**
|
|
32
31
|
* The all method returns the underlying array represented by the collection.
|
|
@@ -435,7 +434,6 @@ interface Collection<Item> {
|
|
|
435
434
|
declare class Collection<Item> {
|
|
436
435
|
_batchData: any;
|
|
437
436
|
data_path: string;
|
|
438
|
-
axios: AxiosInstance;
|
|
439
437
|
filters: Filters;
|
|
440
438
|
steps: Step[];
|
|
441
439
|
fields: Record<string, any>;
|
|
@@ -446,7 +444,7 @@ declare class Collection<Item> {
|
|
|
446
444
|
_sort: string | null;
|
|
447
445
|
_sortDesc: boolean;
|
|
448
446
|
meta: MetaData;
|
|
449
|
-
constructor(fields: Record<string, any
|
|
447
|
+
constructor(fields: Record<string, any>);
|
|
450
448
|
}
|
|
451
|
-
declare const _default: (name: string,
|
|
449
|
+
declare const _default: (name: string, fields: Record<string, any>) => Collection<any>;
|
|
452
450
|
export default _default;
|
package/dist/createList.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { AxiosInstance } from 'axios';
|
|
2
1
|
type Fields = Record<string, any>;
|
|
3
|
-
export default function createList(
|
|
2
|
+
export default function createList(entity: string, fields: Fields): {
|
|
4
3
|
first(): Promise<any>;
|
|
5
4
|
all(): Promise<any[]>;
|
|
6
5
|
fetchFirst(): Promise<any>;
|
package/dist/drive.d.ts
CHANGED
|
@@ -1,26 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
path?:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
path
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
uploadTempFile: (file: File) => Promise<
|
|
1
|
+
export declare const listDrives: () => Promise<any>;
|
|
2
|
+
export declare const getDrive: (index: number) => {
|
|
3
|
+
listFiles: (path: string, fields?: import('./file').QueryFileFields) => Promise<any>;
|
|
4
|
+
getFile: (path: string, fields?: import('./file').QueryFileFields) => Promise<any>;
|
|
5
|
+
readFile: (path: string) => Promise<any>;
|
|
6
|
+
writeFile: (path: string, content: string) => Promise<any>;
|
|
7
|
+
deleteFile: (path: string) => Promise<any>;
|
|
8
|
+
renameFile: (path: string, name: string) => Promise<any>;
|
|
9
|
+
moveFile: (source: string, destination: string) => Promise<any>;
|
|
10
|
+
listFolders: (path: string, fields?: import('./folder').QueryFolderFields) => Promise<Record<keyof import('./folder').FolderFields, any>[]>;
|
|
11
|
+
createFolder: (path: string) => Promise<any>;
|
|
12
|
+
deleteFolder: (path: string) => Promise<any>;
|
|
13
|
+
renameFolder: (path: string, name: string) => Promise<any>;
|
|
14
|
+
uploadTempFile: (file: File) => Promise<{
|
|
15
|
+
name: string;
|
|
16
|
+
path: string;
|
|
17
|
+
size: number;
|
|
18
|
+
mime: string;
|
|
19
|
+
}>;
|
|
15
20
|
folders: {
|
|
16
|
-
list: (path: string, fields?:
|
|
21
|
+
list: (path: string, fields?: import('./folder').QueryFolderFields) => Promise<Record<keyof import('./folder').FolderFields, any>[]>;
|
|
17
22
|
create: (path: string) => Promise<any>;
|
|
18
23
|
delete: (path: string) => Promise<any>;
|
|
19
24
|
rename: (path: string, name: string) => Promise<any>;
|
|
20
25
|
};
|
|
21
26
|
files: {
|
|
22
|
-
list: (path: string, fields?:
|
|
23
|
-
get: (path: string, fields?:
|
|
27
|
+
list: (path: string, fields?: import('./file').QueryFileFields) => Promise<any>;
|
|
28
|
+
get: (path: string, fields?: import('./file').QueryFileFields) => Promise<any>;
|
|
24
29
|
read: (path: string) => Promise<any>;
|
|
25
30
|
write: (path: string, content: string) => Promise<any>;
|
|
26
31
|
delete: (path: string) => Promise<any>;
|
|
@@ -28,4 +33,44 @@ declare const _default: (index: number, axios: AxiosInstance) => {
|
|
|
28
33
|
move: (source: string, destination: string) => Promise<any>;
|
|
29
34
|
};
|
|
30
35
|
};
|
|
36
|
+
declare const _default: () => {
|
|
37
|
+
list: Promise<Array<{
|
|
38
|
+
index: number;
|
|
39
|
+
name: string;
|
|
40
|
+
}>>;
|
|
41
|
+
get: (index: number) => {
|
|
42
|
+
listFiles: (path: string, fields?: import('./file').QueryFileFields) => Promise<any>;
|
|
43
|
+
getFile: (path: string, fields?: import('./file').QueryFileFields) => Promise<any>;
|
|
44
|
+
readFile: (path: string) => Promise<any>;
|
|
45
|
+
writeFile: (path: string, content: string) => Promise<any>;
|
|
46
|
+
deleteFile: (path: string) => Promise<any>;
|
|
47
|
+
renameFile: (path: string, name: string) => Promise<any>;
|
|
48
|
+
moveFile: (source: string, destination: string) => Promise<any>;
|
|
49
|
+
listFolders: (path: string, fields?: import('./folder').QueryFolderFields) => Promise<Record<keyof import('./folder').FolderFields, any>[]>;
|
|
50
|
+
createFolder: (path: string) => Promise<any>;
|
|
51
|
+
deleteFolder: (path: string) => Promise<any>;
|
|
52
|
+
renameFolder: (path: string, name: string) => Promise<any>;
|
|
53
|
+
uploadTempFile: (file: File) => Promise<{
|
|
54
|
+
name: string;
|
|
55
|
+
path: string;
|
|
56
|
+
size: number;
|
|
57
|
+
mime: string;
|
|
58
|
+
}>;
|
|
59
|
+
folders: {
|
|
60
|
+
list: (path: string, fields?: import('./folder').QueryFolderFields) => Promise<Record<keyof import('./folder').FolderFields, any>[]>;
|
|
61
|
+
create: (path: string) => Promise<any>;
|
|
62
|
+
delete: (path: string) => Promise<any>;
|
|
63
|
+
rename: (path: string, name: string) => Promise<any>;
|
|
64
|
+
};
|
|
65
|
+
files: {
|
|
66
|
+
list: (path: string, fields?: import('./file').QueryFileFields) => Promise<any>;
|
|
67
|
+
get: (path: string, fields?: import('./file').QueryFileFields) => Promise<any>;
|
|
68
|
+
read: (path: string) => Promise<any>;
|
|
69
|
+
write: (path: string, content: string) => Promise<any>;
|
|
70
|
+
delete: (path: string) => Promise<any>;
|
|
71
|
+
rename: (path: string, name: string) => Promise<any>;
|
|
72
|
+
move: (source: string, destination: string) => Promise<any>;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
};
|
|
31
76
|
export default _default;
|
package/dist/file.d.ts
CHANGED
|
@@ -1,26 +1,19 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
export type FileFields = {
|
|
2
|
+
name?: string;
|
|
3
|
+
path?: string;
|
|
4
|
+
size?: number;
|
|
5
|
+
mime?: string;
|
|
6
|
+
url?: string;
|
|
6
7
|
};
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
download: (filename: string) => void;
|
|
18
|
-
open: (mime: string) => void;
|
|
19
|
-
};
|
|
20
|
-
fromString: (a: string) => {
|
|
21
|
-
getContent: () => string;
|
|
22
|
-
getURL: (mime?: string) => string;
|
|
23
|
-
download: (filename: string) => void;
|
|
24
|
-
open: (mime: string) => void;
|
|
25
|
-
};
|
|
8
|
+
export type QueryFileFields = Partial<Record<keyof FileFields, boolean>>;
|
|
9
|
+
export declare const listFiles: (index: number, path: string, fields?: QueryFileFields) => Promise<any>;
|
|
10
|
+
declare const _default: (index: number) => {
|
|
11
|
+
list: (path: string, fields?: QueryFileFields) => Promise<any>;
|
|
12
|
+
get: (path: string, fields?: QueryFileFields) => Promise<any>;
|
|
13
|
+
read: (path: string) => Promise<any>;
|
|
14
|
+
write: (path: string, content: string) => Promise<any>;
|
|
15
|
+
delete: (path: string) => Promise<any>;
|
|
16
|
+
rename: (path: string, name: string) => Promise<any>;
|
|
17
|
+
move: (source: string, destination: string) => Promise<any>;
|
|
26
18
|
};
|
|
19
|
+
export default _default;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare function arrayHasFile(arr: any[]): boolean;
|
|
2
|
+
export declare function objectHasFile(obj: any): boolean;
|
|
3
|
+
export declare const createFileFromString: (s?: string) => {
|
|
4
|
+
getContent: () => string;
|
|
5
|
+
getURL: (mime?: string) => string;
|
|
6
|
+
download: (filename: string) => void;
|
|
7
|
+
open: (mime: string) => void;
|
|
8
|
+
};
|
|
9
|
+
export declare const createFileFromBase64: (a: string) => {
|
|
10
|
+
getContent: () => string;
|
|
11
|
+
getURL: (mime?: string) => string;
|
|
12
|
+
download: (filename: string) => void;
|
|
13
|
+
open: (mime: string) => void;
|
|
14
|
+
};
|
|
15
|
+
export declare const createFileFromBase85: (a: string) => {
|
|
16
|
+
getContent: () => string;
|
|
17
|
+
getURL: (mime?: string) => string;
|
|
18
|
+
download: (filename: string) => void;
|
|
19
|
+
open: (mime: string) => void;
|
|
20
|
+
};
|
package/dist/folder.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type FolderFields = {
|
|
2
|
+
name?: string;
|
|
3
|
+
path?: string;
|
|
4
|
+
};
|
|
5
|
+
export type QueryFolderFields = Record<keyof FolderFields, boolean>;
|
|
6
|
+
export declare const listFolders: (index: number, path: string, fields?: QueryFolderFields) => Promise<Array<Record<keyof FolderFields, any>>>;
|
|
7
|
+
declare const _default: (index: number) => {
|
|
8
|
+
list: (path: string, fields?: QueryFolderFields) => Promise<Record<keyof FolderFields, any>[]>;
|
|
9
|
+
create: (path: string) => Promise<any>;
|
|
10
|
+
delete: (path: string) => Promise<any>;
|
|
11
|
+
rename: (path: string, name: string) => Promise<any>;
|
|
12
|
+
};
|
|
13
|
+
export default _default;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,23 @@
|
|
|
1
|
-
export { default as
|
|
2
|
-
export {
|
|
3
|
-
export
|
|
1
|
+
export { default as useModel, useGlobalModel, useGlobalModels, createModelManager } from './models';
|
|
2
|
+
export type { ModelManager } from './models';
|
|
3
|
+
export * from './permission';
|
|
4
|
+
export * as webAuthn from './webauthn';
|
|
4
5
|
export * from './auth';
|
|
6
|
+
export { default as auth } from './auth';
|
|
7
|
+
export * from './drive';
|
|
8
|
+
export * from './users';
|
|
9
|
+
export * from './config';
|
|
10
|
+
export * from './role';
|
|
5
11
|
export * from './model';
|
|
6
12
|
export * from './file';
|
|
13
|
+
export * from './mail';
|
|
7
14
|
export { default as query } from './query';
|
|
8
15
|
export { default as mutation } from './mutation';
|
|
9
16
|
export { default as toQuery } from './toQuery';
|
|
10
|
-
export type Fields =
|
|
11
|
-
export * from './fs';
|
|
17
|
+
export type Fields = Record<string, any>;
|
|
12
18
|
export { default as createClient } from './createClient';
|
|
13
19
|
export type { LightClient } from './createClient';
|
|
14
20
|
export { default as createCollection } from './createCollection';
|
|
15
21
|
export { default as createList } from './createList';
|
|
16
|
-
export type {
|
|
17
|
-
export
|
|
22
|
+
export type { RoleFields } from './role';
|
|
23
|
+
export { setApiClient, getApiClient, getApiClientOptional } from './apiClient';
|