@hostlink/light 3.2.8 → 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/README.md CHANGED
@@ -1,7 +1,16 @@
1
- # HostLink Light Cient
1
+ # @hostlink/light
2
2
 
3
- A javascript library for Light Framework.
3
+ A lightweight JavaScript/TypeScript client library for the **Light Framework**, providing an easy-to-use API for GraphQL queries/mutations, authentication, file management, user management, and more.
4
4
 
5
+ ## Features
6
+
7
+ - 🔐 **Authentication** - Login/logout, password management, OAuth (Google, Facebook, Microsoft), WebAuthn support
8
+ - 📊 **GraphQL Client** - Simplified query and mutation APIs with automatic file upload handling
9
+ - 📁 **File System** - Complete file and folder management operations
10
+ - 👥 **User Management** - CRUD operations for users and roles
11
+ - 📧 **Email** - Send emails via the backend
12
+ - 🔄 **Token Refresh** - Automatic access token refresh with request queuing
13
+ - 🌐 **Universal** - Works in both browser and Node.js environments
5
14
 
6
15
  ## Installation
7
16
 
@@ -9,27 +18,430 @@ A javascript library for Light Framework.
9
18
  npm install @hostlink/light
10
19
  ```
11
20
 
12
- ## Usage
21
+ ## Quick Start
13
22
 
14
- ```javascript
23
+ ```typescript
15
24
  import { createClient } from '@hostlink/light';
16
25
 
17
- const api=createClient('https://example.com/api');
26
+ // Create a client instance
27
+ const api = createClient('https://your-api.com/graphql');
28
+
29
+ // Login
30
+ await api.auth.login('username', 'password');
18
31
 
32
+ // Query data
33
+ const users = await api.query({
34
+ app: {
35
+ users: {
36
+ user_id: true,
37
+ username: true,
38
+ first_name: true
39
+ }
40
+ }
41
+ });
42
+
43
+ // Logout
44
+ await api.auth.logout();
19
45
  ```
20
46
 
21
- ## Login
47
+ ## API Reference
22
48
 
23
- ```javascript
24
- await api.auth.login('username','password');
49
+ ### Creating a Client
50
+
51
+ ```typescript
52
+ import { createClient } from '@hostlink/light';
53
+
54
+ const api = createClient('https://your-api.com/graphql');
25
55
  ```
26
56
 
27
- ## Logout
57
+ The client provides:
58
+ - `api.auth` - Authentication methods
59
+ - `api.query` - GraphQL queries
60
+ - `api.mutation` - GraphQL mutations
61
+ - `api.users` - User management
62
+ - `api.roles` - Role management
63
+ - `api.mail` - Email sending
64
+ - `api.config` - Configuration access
65
+ - `api.collect` - Collection builder
66
+ - `api.list` - List builder
67
+
68
+ ---
28
69
 
29
- ```javascript
70
+ ### Authentication
71
+
72
+ #### Basic Login/Logout
73
+
74
+ ```typescript
75
+ // Login with username and password
76
+ await api.auth.login('username', 'password');
77
+
78
+ // Login with 2FA code
79
+ await api.auth.login('username', 'password', '123456');
80
+
81
+ // Logout
30
82
  await api.auth.logout();
31
83
  ```
32
84
 
85
+ #### Get Current User
86
+
87
+ ```typescript
88
+ const user = await api.auth.getCurrentUser();
89
+ // Returns: { user_id, username, first_name, last_name, status }
90
+
91
+ // With custom fields
92
+ const user = await api.auth.getCurrentUser({
93
+ user_id: true,
94
+ username: true,
95
+ email: true
96
+ });
97
+ ```
98
+
99
+ #### Password Management
100
+
101
+ ```typescript
102
+ // Update password
103
+ await api.auth.updatePassword('oldPassword', 'newPassword');
104
+
105
+ // Change expired password
106
+ await api.auth.changeExpiredPassword('username', 'oldPassword', 'newPassword');
107
+
108
+ // Forgot password flow
109
+ const jwt = await api.auth.forgetPassword('username', 'email@example.com');
110
+ await api.auth.verifyCode(jwt, '123456');
111
+ await api.auth.resetPassword(jwt, 'newPassword', '123456');
112
+ ```
113
+
114
+ #### OAuth Providers
115
+
116
+ ```typescript
117
+ // Google
118
+ await api.auth.google.login(credential);
119
+ await api.auth.google.register(credential);
120
+ await api.auth.google.unlink();
121
+
122
+ // Facebook
123
+ await api.auth.facebook.login(accessToken);
124
+ await api.auth.facebook.register(accessToken);
125
+ await api.auth.facebook.unlink();
126
+
127
+ // Microsoft
128
+ await api.auth.microsoft.login(accessToken);
129
+ await api.auth.microsoft.register(accountId);
130
+ await api.auth.microsoft.unlink();
131
+ ```
132
+
133
+ #### WebAuthn (Passkeys)
134
+
135
+ ```typescript
136
+ import { webAuthn } from '@hostlink/light';
137
+
138
+ // Register a new passkey
139
+ await webAuthn.register();
140
+
141
+ // Login with passkey
142
+ await webAuthn.login();
143
+ ```
144
+
145
+ #### Permission Checking
146
+
147
+ ```typescript
148
+ // Check single permission
149
+ const canEdit = await api.auth.isGranted('edit_users');
150
+
151
+ // Check multiple permissions
152
+ const rights = await api.auth.grantedRights(['edit_users', 'delete_users']);
153
+ ```
154
+
155
+ ---
156
+
157
+ ### GraphQL Queries & Mutations
158
+
159
+ #### Query
160
+
161
+ ```typescript
162
+ const result = await api.query({
163
+ app: {
164
+ users: {
165
+ user_id: true,
166
+ username: true,
167
+ profile: {
168
+ avatar: true,
169
+ bio: true
170
+ }
171
+ }
172
+ }
173
+ });
174
+ ```
175
+
176
+ #### Mutation
177
+
178
+ ```typescript
179
+ const result = await api.mutation({
180
+ createPost: {
181
+ __args: {
182
+ title: 'Hello World',
183
+ content: 'My first post'
184
+ }
185
+ }
186
+ });
187
+ ```
188
+
189
+ #### File Upload
190
+
191
+ File uploads are automatically handled in mutations:
192
+
193
+ ```typescript
194
+ // Single file upload
195
+ await api.mutation({
196
+ uploadAvatar: {
197
+ __args: {
198
+ file: fileInput.files[0]
199
+ }
200
+ }
201
+ });
202
+
203
+ // Multiple file upload
204
+ await api.mutation({
205
+ uploadImages: {
206
+ __args: {
207
+ files: Array.from(fileInput.files)
208
+ }
209
+ }
210
+ });
211
+ ```
212
+
213
+ ---
214
+
215
+ ### Collection & List Builders
216
+
217
+ #### createList - Simple List Queries
218
+
219
+ ```typescript
220
+ import { createList } from '@hostlink/light';
221
+
222
+ // Create a list query
223
+ const users = await createList('Users', {
224
+ user_id: true,
225
+ username: true,
226
+ first_name: true
227
+ })
228
+ .where('status', 1)
229
+ .where('role', 'admin')
230
+ .sort('-created_at')
231
+ .limit(10)
232
+ .fetch();
233
+
234
+ // Get first item
235
+ const user = await createList('Users', { user_id: true, username: true })
236
+ .where('username', 'john')
237
+ .first();
238
+ ```
239
+
240
+ #### Where Clauses
241
+
242
+ ```typescript
243
+ list
244
+ .where('status', 1) // Exact match
245
+ .where('age', '>', 18) // Greater than
246
+ .where('age', '>=', 18) // Greater than or equal
247
+ .where('age', '<', 65) // Less than
248
+ .where('age', '<=', 65) // Less than or equal
249
+ .where('status', '!=', 0) // Not equal
250
+ .whereIn('role', ['admin', 'moderator']) // In array
251
+ .whereContains('name', 'john') // Contains string
252
+ .whereBetween('age', 18, 65) // Between range
253
+ ```
254
+
255
+ #### createCollection - Advanced Collection Operations
256
+
257
+ ```typescript
258
+ import { createCollection } from '@hostlink/light';
259
+
260
+ const collection = createCollection('Products', {
261
+ id: true,
262
+ name: true,
263
+ price: true,
264
+ category: true
265
+ });
266
+
267
+ // Filter and transform data
268
+ const result = await collection
269
+ .where('category', '==', 'electronics')
270
+ .where('price', '<', 1000)
271
+ .sortBy('price')
272
+ .map(item => ({ ...item, discounted: item.price * 0.9 }))
273
+ .all();
274
+
275
+ // Aggregations
276
+ const avgPrice = await collection.avg('price');
277
+ const total = await collection.count();
278
+ const maxPrice = await collection.max('price');
279
+ ```
280
+
281
+ ---
282
+
283
+ ### User Management
284
+
285
+ ```typescript
286
+ // List users
287
+ const users = await api.users.list();
288
+
289
+ // Create user
290
+ await api.users.create({
291
+ username: 'newuser',
292
+ first_name: 'John',
293
+ last_name: 'Doe',
294
+ password: 'securepassword',
295
+ join_date: '2024-01-01'
296
+ });
297
+
298
+ // Update user
299
+ await api.users.update(userId, {
300
+ first_name: 'Jane'
301
+ });
302
+
303
+ // Delete user
304
+ await api.users.delete(userId);
305
+ ```
306
+
307
+ ---
308
+
309
+ ### Role Management
310
+
311
+ ```typescript
312
+ // List roles
313
+ const roles = await api.roles.list();
314
+
315
+ // Create role with child roles
316
+ await api.roles.create('admin', ['editor', 'viewer']);
317
+
318
+ // Delete role
319
+ await api.roles.delete('admin');
320
+ ```
321
+
322
+ ---
323
+
324
+ ### File System API
325
+
326
+ For direct filesystem access:
327
+
328
+ ```typescript
329
+ import { fs } from '@hostlink/light';
330
+
331
+ // Create folder
332
+ await fs.createFolder('local://path/to/folder');
333
+
334
+ // Delete folder
335
+ await fs.deleteFolder('local://path/to/folder');
336
+
337
+ // Rename folder
338
+ await fs.renameFolder('local://path/to/folder', 'newName');
339
+
340
+ // Write file
341
+ await fs.writeFile('local://path/to/file.txt', 'content');
342
+
343
+ // Upload file
344
+ await fs.uploadFile('local://path/to/destination', file);
345
+
346
+ // Delete file
347
+ await fs.deleteFile('local://path/to/file.txt');
348
+
349
+ // Check if exists
350
+ const exists = await fs.exists('local://path/to/file.txt');
351
+
352
+ // Move file/folder
353
+ await fs.move('local://from/path', 'local://to/path');
354
+
355
+ // Search files
356
+ const results = await fs.find('searchterm', 'document'); // labels: document, image, audio, video, archive
357
+ ```
358
+
359
+ ---
360
+
361
+ ### Email
362
+
363
+ ```typescript
364
+ await api.mail.send(
365
+ 'recipient@example.com',
366
+ 'Subject Line',
367
+ 'Email message body'
368
+ );
369
+ ```
370
+
371
+ ---
372
+
373
+ ### Model Helper
374
+
375
+ Create reusable model definitions:
376
+
377
+ ```typescript
378
+ import model from '@hostlink/light';
379
+
380
+ const Product = model('Product', {
381
+ id: { name: 'product_id' },
382
+ name: { gql: { name: true } },
383
+ price: { gql: { price: true, currency: true } }
384
+ });
385
+
386
+ // CRUD operations
387
+ await Product.add({ name: 'New Product', price: 99.99 });
388
+ await Product.update(1, { price: 89.99 });
389
+ await Product.delete(1);
390
+ const product = await Product.get({ id: 1 }, { name: true, price: true });
391
+ const products = await Product.list({ name: true, price: true }).fetch();
392
+ ```
393
+
394
+ ---
395
+
396
+ ## Advanced Configuration
397
+
398
+ ### Direct API Client Access
399
+
400
+ ```typescript
401
+ import { setApiClient, getApiClient } from '@hostlink/light';
402
+
403
+ // Set a custom API client
404
+ setApiClient(customClient);
405
+
406
+ // Get the current API client
407
+ const client = getApiClient();
408
+
409
+ // Access the underlying axios instance
410
+ const { axios } = getApiClient();
411
+ ```
412
+
413
+ ### Token Refresh
414
+
415
+ The client automatically handles token refresh when receiving `TOKEN_EXPIRED` errors. Failed requests are queued and retried after the token is refreshed.
416
+
417
+ ---
418
+
419
+ ## TypeScript Support
420
+
421
+ This library is written in TypeScript and includes full type definitions.
422
+
423
+ ```typescript
424
+ import type {
425
+ UserFields,
426
+ CreateUserFields,
427
+ QueryUserFieldsUserFields,
428
+ RoleFields,
429
+ FileFields,
430
+ FolderFields,
431
+ GraphQLQuery
432
+ } from '@hostlink/light';
433
+ ```
434
+
435
+ ---
436
+
437
+ ## License
438
+
439
+ MIT
440
+
441
+ ## Repository
442
+
443
+ [https://github.com/HostLink/light](https://github.com/HostLink/light)
444
+
33
445
 
34
446
 
35
447
 
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<{
@@ -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,7 +1,24 @@
1
+ import { query, mutation } from '.';
2
+ /**
3
+ * @deprecated Use `fs.listFolders` / `fs.listFiles` from `filesystem` instead.
4
+ */
1
5
  export declare const listDrives: () => Promise<any>;
6
+ /**
7
+ * @deprecated Use functions from `filesystem` (fs.*) instead.
8
+ * - listFiles → fs.listFiles(location)
9
+ * - listFolders → fs.listFolders(location)
10
+ * - writeFile → fs.writeFile(location, content)
11
+ * - deleteFile → fs.deleteFile(location)
12
+ * - renameFile → fs.renameFile(location, newName)
13
+ * - moveFile → fs.move(from, to)
14
+ * - createFolder → fs.createFolder(location)
15
+ * - deleteFolder → fs.deleteFolder(location)
16
+ * - renameFolder → fs.renameFolder(location, newName)
17
+ * - uploadTempFile → fs.uploadTempFile(location, file)
18
+ */
2
19
  export declare const getDrive: (index: number) => {
3
20
  folders: {
4
- list: (path: string, fields?: import('./folder').QueryFolderFields) => Promise<Record<keyof import('./folder').FolderFields, any>[]>;
21
+ list: (path: string, fields?: import('./folder').QueryFolderFields) => Promise<any>;
5
22
  create: (path: string) => Promise<any>;
6
23
  delete: (path: string) => Promise<any>;
7
24
  rename: (path: string, name: string) => Promise<any>;
@@ -23,7 +40,42 @@ export declare const getDrive: (index: number) => {
23
40
  deleteFile: (path: string) => Promise<any>;
24
41
  renameFile: (path: string, name: string) => Promise<any>;
25
42
  moveFile: (source: string, destination: string) => Promise<any>;
26
- 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>;
27
79
  createFolder: (path: string) => Promise<any>;
28
80
  deleteFolder: (path: string) => Promise<any>;
29
81
  renameFolder: (path: string, name: string) => Promise<any>;
@@ -41,7 +93,7 @@ declare const _default: () => {
41
93
  }>>;
42
94
  get: (index: number) => {
43
95
  folders: {
44
- list: (path: string, fields?: import('./folder').QueryFolderFields) => Promise<Record<keyof import('./folder').FolderFields, any>[]>;
96
+ list: (path: string, fields?: import('./folder').QueryFolderFields) => Promise<any>;
45
97
  create: (path: string) => Promise<any>;
46
98
  delete: (path: string) => Promise<any>;
47
99
  rename: (path: string, name: string) => Promise<any>;
@@ -63,7 +115,7 @@ declare const _default: () => {
63
115
  deleteFile: (path: string) => Promise<any>;
64
116
  renameFile: (path: string, name: string) => Promise<any>;
65
117
  moveFile: (source: string, destination: string) => Promise<any>;
66
- listFolders: (path: string, fields?: import('./folder').QueryFolderFields) => Promise<Record<keyof import('./folder').FolderFields, any>[]>;
118
+ listFolders: (path: string, fields?: import('./folder').QueryFolderFields) => Promise<any>;
67
119
  createFolder: (path: string) => Promise<any>;
68
120
  deleteFolder: (path: string) => Promise<any>;
69
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;
@@ -6,9 +7,19 @@ export type FileFields = {
6
7
  url?: string;
7
8
  };
8
9
  export type QueryFileFields = Partial<Record<keyof FileFields, boolean>>;
10
+ /**
11
+ * @deprecated Use `fs.listFiles` / `fs.readFile` from `filesystem` instead.
12
+ */
9
13
  export declare const listFiles: (index: number, path: string, fields?: QueryFileFields) => Promise<any>;
14
+ /**
15
+ * @deprecated Use `fs.readFile(location, 'base64')` from `filesystem` instead.
16
+ */
10
17
  export declare const readFileAsBase64: (index: number, path: string) => Promise<string>;
11
- declare const _default: (index: number) => {
18
+ /**
19
+ * @deprecated Use `fs.listFiles` from `filesystem` instead.
20
+ * The default export factory function is also deprecated — use `fs.*` directly.
21
+ */
22
+ declare const _default: (index: number, queryFn?: typeof query, mutationFn?: typeof mutation) => {
12
23
  list: (path: string, fields?: QueryFileFields) => Promise<any>;
13
24
  get: (path: string, fields?: QueryFileFields) => Promise<any>;
14
25
  readFileAsBase64(path: string): Promise<string>;