@hostlink/light 3.3.0 → 3.3.2

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/auth.d.ts CHANGED
@@ -1,5 +1,40 @@
1
- import { QueryUserFieldsUserFields } from '.';
1
+ import { mutation, query, QueryUserFieldsUserFields } from '.';
2
2
  import * as webAuthn from "./webauthn";
3
+ type QueryFn = typeof query;
4
+ type MutationFn = typeof mutation;
5
+ export declare const createAuth: (queryFn: QueryFn, mutationFn: MutationFn) => {
6
+ getCurrentUser: (fields?: QueryUserFieldsUserFields) => Promise<any>;
7
+ login: (username: string, password: string, code?: string) => Promise<boolean>;
8
+ logout: () => Promise<boolean>;
9
+ changeExpiredPassword: (username: string, oldPassword: string, newPassword: string) => Promise<boolean>;
10
+ updatePassword: (oldPassword: string, newPassword: string) => Promise<boolean>;
11
+ resetPassword: (jwt: string, password: string, code: string) => Promise<boolean>;
12
+ forgetPassword: (username: string, email: string) => Promise<string>;
13
+ verifyCode: (jwt: string, code: string) => Promise<boolean>;
14
+ grantedRights: (rights: string[]) => Promise<string[]>;
15
+ isGranted: (right: string) => Promise<boolean>;
16
+ webAuthn: {
17
+ assertion: () => Promise<PublicKeyCredential>;
18
+ attestation: () => Promise<PublicKeyCredential>;
19
+ login: () => Promise<any>;
20
+ register: () => Promise<any>;
21
+ };
22
+ google: {
23
+ unlink: () => Promise<boolean>;
24
+ login: (credential: string) => Promise<boolean>;
25
+ register: (credential: string) => Promise<boolean>;
26
+ };
27
+ facebook: {
28
+ unlink: () => Promise<boolean>;
29
+ login: (accessToken: string) => Promise<boolean>;
30
+ register: (accessToken: string) => Promise<boolean>;
31
+ };
32
+ microsoft: {
33
+ unlink: () => Promise<boolean>;
34
+ login: (accessToken: string) => Promise<boolean>;
35
+ register: (account_id: string) => Promise<boolean>;
36
+ };
37
+ };
3
38
  export declare const getCurrentUser: (fields?: QueryUserFieldsUserFields) => Promise<any>;
4
39
  export declare const login: (username: string, password: string, code?: string) => Promise<boolean>;
5
40
  export declare const logout: () => Promise<boolean>;
package/dist/config.d.ts CHANGED
@@ -1 +1,3 @@
1
+ import { query } from '.';
2
+ export declare const createConfig: (queryFn: typeof query) => (name: string) => Promise<any>;
1
3
  export declare const getConfig: (name: string) => Promise<any>;
@@ -1,32 +1,35 @@
1
- import { default as auth } from './auth';
2
- import { getDrive } from './drive';
1
+ import { createAuth } from './auth';
2
+ import { createDrive } from './drive';
3
3
  import { default as axios } from 'axios';
4
- import { default as mutation } from './mutation';
5
- import { default as query } from './query';
6
- import { getConfig } from './config';
7
- import { default as mail } from './mail';
4
+ import { createMutation } from './mutation';
5
+ import { createQuery } from './query';
6
+ import { createConfig } from './config';
7
+ import { createMail } from './mail';
8
8
  import { getModel } from './models';
9
- import { default as roles } from './role';
9
+ import { createRoles } from './role';
10
10
  import { default as createCollection } from './createCollection';
11
11
  import { default as createList } from './createList';
12
- import { default as users } from './users';
12
+ import { createUsers } from './users';
13
13
  type ClientType = {
14
14
  post: typeof axios.post;
15
15
  baseURL: string;
16
16
  axios: ReturnType<typeof axios.create>;
17
- auth: typeof auth;
18
- mutation: typeof mutation;
19
- query: typeof query;
20
- config: typeof getConfig;
21
- mail: typeof mail;
22
- users: typeof users;
17
+ auth: ReturnType<typeof createAuth>;
18
+ mutation: ReturnType<typeof createMutation>;
19
+ query: ReturnType<typeof createQuery>;
20
+ config: ReturnType<typeof createConfig>;
21
+ mail: ReturnType<typeof createMail>;
22
+ users: ReturnType<typeof createUsers>;
23
23
  model: (name: string) => ReturnType<typeof getModel>;
24
- roles: ReturnType<typeof roles>;
24
+ roles: ReturnType<typeof createRoles>;
25
25
  collect: (name: string, fields: Record<string, any>) => ReturnType<typeof createCollection> & {
26
26
  data_path: string;
27
27
  };
28
28
  list: (entity: string, fields: Record<string, any>) => ReturnType<typeof createList>;
29
- drive: typeof getDrive;
29
+ /**
30
+ * @deprecated Use `fs.*` from `filesystem` instead.
31
+ */
32
+ drive: ReturnType<typeof createDrive>;
30
33
  collects: (collections: {
31
34
  [key: string]: any;
32
35
  }) => Promise<{
@@ -0,0 +1 @@
1
+ export {};
@@ -1,3 +1,5 @@
1
+ import { GraphQLQuery } from '.';
2
+ type Query = (query: GraphQLQuery) => Promise<any>;
1
3
  type Operator = '==' | '<' | '<=' | '>' | '>=' | '!==';
2
4
  interface FilterValue {
3
5
  lt?: any;
@@ -446,5 +448,5 @@ declare class Collection<Item> {
446
448
  meta: MetaData;
447
449
  constructor(fields: Record<string, any>);
448
450
  }
449
- declare const _default: (name: string, fields: Record<string, any>) => Collection<any>;
451
+ declare const _default: (name: string, fields: Record<string, any>, queryFn?: Query) => Collection<any>;
450
452
  export default _default;
@@ -1,5 +1,7 @@
1
+ import { GraphQLQuery } from '.';
2
+ type Query = (query: GraphQLQuery) => Promise<any>;
1
3
  type Fields = Record<string, any>;
2
- export default function createList(entity: string, fields: Fields): {
4
+ export default function createList(entity: string, fields: Fields, queryFn?: Query): {
3
5
  first(): Promise<any>;
4
6
  all(): Promise<any[]>;
5
7
  fetchFirst(): Promise<any>;
package/dist/drive.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { query, mutation } from '.';
1
2
  /**
2
3
  * @deprecated Use `fs.listFolders` / `fs.listFiles` from `filesystem` instead.
3
4
  */
@@ -17,7 +18,7 @@ export declare const listDrives: () => Promise<any>;
17
18
  */
18
19
  export declare const getDrive: (index: number) => {
19
20
  folders: {
20
- list: (path: string, fields?: import('./folder').QueryFolderFields) => Promise<Record<keyof import('./folder').FolderFields, any>[]>;
21
+ list: (path: string, fields?: import('./folder').QueryFolderFields) => Promise<any>;
21
22
  create: (path: string) => Promise<any>;
22
23
  delete: (path: string) => Promise<any>;
23
24
  rename: (path: string, name: string) => Promise<any>;
@@ -39,7 +40,42 @@ export declare const getDrive: (index: number) => {
39
40
  deleteFile: (path: string) => Promise<any>;
40
41
  renameFile: (path: string, name: string) => Promise<any>;
41
42
  moveFile: (source: string, destination: string) => Promise<any>;
42
- listFolders: (path: string, fields?: import('./folder').QueryFolderFields) => Promise<Record<keyof import('./folder').FolderFields, any>[]>;
43
+ listFolders: (path: string, fields?: import('./folder').QueryFolderFields) => Promise<any>;
44
+ createFolder: (path: string) => Promise<any>;
45
+ deleteFolder: (path: string) => Promise<any>;
46
+ renameFolder: (path: string, name: string) => Promise<any>;
47
+ uploadTempFile: (file: File) => Promise<{
48
+ name: string;
49
+ path: string;
50
+ size: number;
51
+ mime: string;
52
+ }>;
53
+ };
54
+ export declare const createDrive: (queryFn: typeof query, mutationFn: typeof mutation) => (index: number) => {
55
+ folders: {
56
+ list: (path: string, fields?: import('./folder').QueryFolderFields) => Promise<any>;
57
+ create: (path: string) => Promise<any>;
58
+ delete: (path: string) => Promise<any>;
59
+ rename: (path: string, name: string) => Promise<any>;
60
+ };
61
+ files: {
62
+ list: (path: string, fields?: import('./file').QueryFileFields) => Promise<any>;
63
+ get: (path: string, fields?: import('./file').QueryFileFields) => Promise<any>;
64
+ readFileAsBase64(path: string): Promise<string>;
65
+ read: (path: string) => Promise<any>;
66
+ write: (path: string, content: string) => Promise<any>;
67
+ delete: (path: string) => Promise<any>;
68
+ rename: (path: string, name: string) => Promise<any>;
69
+ move: (source: string, destination: string) => Promise<any>;
70
+ };
71
+ listFiles: (path: string, fields?: import('./file').QueryFileFields) => Promise<any>;
72
+ getFile: (path: string, fields?: import('./file').QueryFileFields) => Promise<any>;
73
+ readFile: (path: string) => Promise<any>;
74
+ writeFile: (path: string, content: string) => Promise<any>;
75
+ deleteFile: (path: string) => Promise<any>;
76
+ renameFile: (path: string, name: string) => Promise<any>;
77
+ moveFile: (source: string, destination: string) => Promise<any>;
78
+ listFolders: (path: string, fields?: import('./folder').QueryFolderFields) => Promise<any>;
43
79
  createFolder: (path: string) => Promise<any>;
44
80
  deleteFolder: (path: string) => Promise<any>;
45
81
  renameFolder: (path: string, name: string) => Promise<any>;
@@ -57,7 +93,7 @@ declare const _default: () => {
57
93
  }>>;
58
94
  get: (index: number) => {
59
95
  folders: {
60
- list: (path: string, fields?: import('./folder').QueryFolderFields) => Promise<Record<keyof import('./folder').FolderFields, any>[]>;
96
+ list: (path: string, fields?: import('./folder').QueryFolderFields) => Promise<any>;
61
97
  create: (path: string) => Promise<any>;
62
98
  delete: (path: string) => Promise<any>;
63
99
  rename: (path: string, name: string) => Promise<any>;
@@ -79,7 +115,7 @@ declare const _default: () => {
79
115
  deleteFile: (path: string) => Promise<any>;
80
116
  renameFile: (path: string, name: string) => Promise<any>;
81
117
  moveFile: (source: string, destination: string) => Promise<any>;
82
- listFolders: (path: string, fields?: import('./folder').QueryFolderFields) => Promise<Record<keyof import('./folder').FolderFields, any>[]>;
118
+ listFolders: (path: string, fields?: import('./folder').QueryFolderFields) => Promise<any>;
83
119
  createFolder: (path: string) => Promise<any>;
84
120
  deleteFolder: (path: string) => Promise<any>;
85
121
  renameFolder: (path: string, name: string) => Promise<any>;
package/dist/file.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { query, mutation } from '.';
1
2
  export type FileFields = {
2
3
  name?: string;
3
4
  path?: string;
@@ -18,7 +19,7 @@ export declare const readFileAsBase64: (index: number, path: string) => Promise<
18
19
  * @deprecated Use `fs.listFiles` from `filesystem` instead.
19
20
  * The default export factory function is also deprecated — use `fs.*` directly.
20
21
  */
21
- declare const _default: (index: number) => {
22
+ declare const _default: (index: number, queryFn?: typeof query, mutationFn?: typeof mutation) => {
22
23
  list: (path: string, fields?: QueryFileFields) => Promise<any>;
23
24
  get: (path: string, fields?: QueryFileFields) => Promise<any>;
24
25
  readFileAsBase64(path: string): Promise<string>;
@@ -3,7 +3,7 @@ export declare const deleteFolder: (location: string) => Promise<any>;
3
3
  export declare const renameFolder: (location: string, newName: string) => Promise<any>;
4
4
  export declare const renameFile: (location: string, newName: string) => Promise<any>;
5
5
  export declare const writeFile: (location: string, content: string) => Promise<any>;
6
- export declare const uploadFile: (location: string, file: File) => Promise<any>;
6
+ export declare const uploadFile: (location: string, file: File, rename?: boolean) => Promise<any>;
7
7
  export declare const deleteFile: (location: string) => Promise<any>;
8
8
  export declare const move: (from: string, to: string) => Promise<any>;
9
9
  export declare const exists: (location: string) => Promise<any>;
package/dist/folder.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { query, mutation } from '.';
1
2
  export type FolderFields = {
2
3
  name?: string;
3
4
  path?: string;
@@ -10,8 +11,8 @@ export declare const listFolders: (index: number, path: string, fields?: QueryFo
10
11
  /**
11
12
  * @deprecated Use `fs.createFolder` / `fs.deleteFolder` / `fs.renameFolder` from `filesystem` instead.
12
13
  */
13
- declare const _default: (index: number) => {
14
- list: (path: string, fields?: QueryFolderFields) => Promise<Record<keyof FolderFields, any>[]>;
14
+ declare const _default: (index: number, queryFn?: typeof query, mutationFn?: typeof mutation) => {
15
+ list: (path: string, fields?: QueryFolderFields) => Promise<any>;
15
16
  create: (path: string) => Promise<any>;
16
17
  delete: (path: string) => Promise<any>;
17
18
  rename: (path: string, name: string) => Promise<any>;