@stagware/nocodb-sdk 0.1.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.
@@ -0,0 +1,2118 @@
1
+ /**
2
+ * Type definitions for NocoDB API entities.
3
+ *
4
+ * This module provides TypeScript interfaces for all core NocoDB entities
5
+ * including bases, tables, views, columns, filters, sorts, and rows.
6
+ */
7
+ /**
8
+ * Represents a NocoDB base (database/project).
9
+ */
10
+ interface Base {
11
+ /** Unique identifier for the base */
12
+ id: string;
13
+ /** Display title of the base */
14
+ title: string;
15
+ /** Type of the base (e.g., 'database') */
16
+ type?: string;
17
+ /** Whether this is a meta base */
18
+ is_meta?: boolean;
19
+ /** Base description */
20
+ description?: string;
21
+ /** Base color (hex string) */
22
+ color?: string;
23
+ /** Display order of the base */
24
+ order?: number;
25
+ /** Base status */
26
+ status?: string;
27
+ /** Table name prefix */
28
+ prefix?: string;
29
+ /** Whether the base is deleted (soft delete) */
30
+ deleted?: boolean;
31
+ /** Additional metadata */
32
+ meta?: Record<string, unknown> | string | null;
33
+ /** Data sources associated with this base */
34
+ sources?: Source[];
35
+ /** Whether the base is external */
36
+ external?: boolean;
37
+ /** Timestamp when the base was created */
38
+ created_at?: string;
39
+ /** Timestamp when the base was last updated */
40
+ updated_at?: string;
41
+ }
42
+ /**
43
+ * Supported source/connection types in NocoDB.
44
+ */
45
+ type SourceType = 'mysql2' | 'pg' | 'sqlite3' | 'mssql' | 'snowflake' | 'databricks';
46
+ /**
47
+ * Represents a data source (database connection) within a NocoDB base.
48
+ */
49
+ interface Source {
50
+ /** Unique identifier for the source */
51
+ id: string;
52
+ /** ID of the base this source belongs to */
53
+ base_id: string;
54
+ /** Display alias for the source */
55
+ alias?: string;
56
+ /** Source type (database driver) */
57
+ type?: SourceType | string;
58
+ /** Whether the source is enabled */
59
+ enabled?: boolean;
60
+ /** Whether this is the meta source */
61
+ is_meta?: boolean;
62
+ /** Connection configuration (encrypted) */
63
+ config?: Record<string, unknown> | string | null;
64
+ /** Column name inflection rule */
65
+ inflection_column?: string;
66
+ /** Table name inflection rule */
67
+ inflection_table?: string;
68
+ /** Display order of the source */
69
+ order?: number;
70
+ /** Additional metadata */
71
+ meta?: Record<string, unknown> | string | null;
72
+ /** Timestamp when the source was created */
73
+ created_at?: string;
74
+ /** Timestamp when the source was last updated */
75
+ updated_at?: string;
76
+ }
77
+ /**
78
+ * Represents a table within a NocoDB base.
79
+ */
80
+ interface Table {
81
+ /** Unique identifier for the table */
82
+ id: string;
83
+ /** ID of the base this table belongs to */
84
+ base_id: string;
85
+ /** Display title of the table */
86
+ title: string;
87
+ /** Actual database table name */
88
+ table_name: string;
89
+ /** Type of the table */
90
+ type?: string;
91
+ /** Whether the table is enabled */
92
+ enabled?: boolean;
93
+ /** Display order of the table */
94
+ order?: number;
95
+ /** Columns in this table */
96
+ columns?: Column[];
97
+ /** Timestamp when the table was created */
98
+ created_at?: string;
99
+ /** Timestamp when the table was last updated */
100
+ updated_at?: string;
101
+ }
102
+ /**
103
+ * Supported view types in NocoDB.
104
+ */
105
+ type ViewType = 'grid' | 'form' | 'gallery' | 'kanban' | 'calendar';
106
+ /**
107
+ * Represents a view of a table (grid, form, gallery, etc.).
108
+ */
109
+ interface View {
110
+ /** Unique identifier for the view */
111
+ id: string;
112
+ /** Display title of the view */
113
+ title: string;
114
+ /** Type of the view */
115
+ type: ViewType;
116
+ /** ID of the table this view belongs to */
117
+ fk_model_id: string;
118
+ /** Whether the view is visible */
119
+ show?: boolean;
120
+ /** Display order of the view */
121
+ order?: number;
122
+ /** Timestamp when the view was created */
123
+ created_at?: string;
124
+ /** Timestamp when the view was last updated */
125
+ updated_at?: string;
126
+ }
127
+ /**
128
+ * Supported column types in NocoDB.
129
+ *
130
+ * Includes basic types (text, number, date), advanced types (formula, lookup),
131
+ * and special types (attachments, links).
132
+ */
133
+ type ColumnType = 'SingleLineText' | 'LongText' | 'Number' | 'Decimal' | 'Currency' | 'Percent' | 'Duration' | 'Rating' | 'Date' | 'DateTime' | 'Time' | 'Year' | 'Checkbox' | 'SingleSelect' | 'MultiSelect' | 'Email' | 'URL' | 'PhoneNumber' | 'LinkToAnotherRecord' | 'Lookup' | 'Rollup' | 'Formula' | 'Attachment' | 'Barcode' | 'QrCode' | 'JSON';
134
+ /**
135
+ * Represents a column in a table.
136
+ */
137
+ interface Column {
138
+ /** Unique identifier for the column */
139
+ id: string;
140
+ /** Display title of the column */
141
+ title: string;
142
+ /** Actual database column name */
143
+ column_name: string;
144
+ /** UI data type of the column */
145
+ uidt: ColumnType;
146
+ /** Database data type */
147
+ dt?: string;
148
+ /** Whether this is a primary key column */
149
+ pk?: boolean;
150
+ /** Whether this is a primary value column */
151
+ pv?: boolean;
152
+ /** Whether this column is required */
153
+ rqd?: boolean;
154
+ /** Whether this is a system column */
155
+ system?: boolean;
156
+ /** ID of the table this column belongs to */
157
+ fk_model_id: string;
158
+ /** Timestamp when the column was created */
159
+ created_at?: string;
160
+ /** Timestamp when the column was last updated */
161
+ updated_at?: string;
162
+ }
163
+ /**
164
+ * Comparison operators for filter conditions.
165
+ *
166
+ * Includes equality, comparison, pattern matching, and set operations.
167
+ */
168
+ type ComparisonOperator = 'eq' | 'neq' | 'like' | 'nlike' | 'empty' | 'notempty' | 'null' | 'notnull' | 'gt' | 'lt' | 'gte' | 'lte' | 'allof' | 'anyof' | 'nallof' | 'nanyof';
169
+ /**
170
+ * Represents a filter condition on a view.
171
+ *
172
+ * Filters can be simple conditions or groups of conditions combined with
173
+ * logical operators (AND/OR).
174
+ */
175
+ interface Filter {
176
+ /** Unique identifier for the filter */
177
+ id: string;
178
+ /** ID of the view this filter belongs to */
179
+ fk_view_id: string;
180
+ /** ID of the column to filter on (not set for filter groups) */
181
+ fk_column_id?: string;
182
+ /** Logical operator for combining filters (and/or) */
183
+ logical_op?: 'and' | 'or';
184
+ /** Comparison operator for the filter condition */
185
+ comparison_op?: ComparisonOperator;
186
+ /** Value to compare against */
187
+ value?: string | number | boolean | null;
188
+ /** ID of the parent filter group (for nested filters) */
189
+ fk_parent_id?: string;
190
+ /** Whether this is a filter group */
191
+ is_group?: boolean;
192
+ /** Timestamp when the filter was created */
193
+ created_at?: string;
194
+ /** Timestamp when the filter was last updated */
195
+ updated_at?: string;
196
+ }
197
+ /**
198
+ * Represents a sort order on a view.
199
+ */
200
+ interface Sort {
201
+ /** Unique identifier for the sort */
202
+ id: string;
203
+ /** ID of the view this sort belongs to */
204
+ fk_view_id: string;
205
+ /** ID of the column to sort by */
206
+ fk_column_id: string;
207
+ /** Sort direction */
208
+ direction: 'asc' | 'desc';
209
+ /** Order of this sort in the sort list */
210
+ order?: number;
211
+ /** Timestamp when the sort was created */
212
+ created_at?: string;
213
+ /** Timestamp when the sort was last updated */
214
+ updated_at?: string;
215
+ }
216
+ /**
217
+ * Represents a webhook/hook on a table.
218
+ */
219
+ interface Hook {
220
+ /** Unique identifier for the hook */
221
+ id: string;
222
+ /** ID of the table this hook belongs to */
223
+ fk_model_id: string;
224
+ /** Display title of the hook */
225
+ title: string;
226
+ /** Description of the hook */
227
+ description?: string;
228
+ /** Event type (after/before) */
229
+ event: 'after' | 'before';
230
+ /** Operation that triggers the hook */
231
+ operation: 'insert' | 'update' | 'delete' | 'bulkInsert' | 'bulkUpdate' | 'bulkDelete';
232
+ /** Whether the hook is active */
233
+ active?: boolean;
234
+ /** Notification configuration (URL, method, headers, body, etc.) */
235
+ notification?: Record<string, unknown>;
236
+ /** Retry count on failure */
237
+ retries?: number;
238
+ /** Retry interval in milliseconds */
239
+ retry_interval?: number;
240
+ /** Timeout in milliseconds */
241
+ timeout?: number;
242
+ /** Timestamp when the hook was created */
243
+ created_at?: string;
244
+ /** Timestamp when the hook was last updated */
245
+ updated_at?: string;
246
+ }
247
+ /**
248
+ * Represents an API token.
249
+ */
250
+ interface ApiToken {
251
+ /** Unique identifier for the token */
252
+ id?: string;
253
+ /** Token string */
254
+ token?: string;
255
+ /** Description/label for the token */
256
+ description?: string;
257
+ /** ID of the user who created the token */
258
+ fk_user_id?: string;
259
+ /** Timestamp when the token was created */
260
+ created_at?: string;
261
+ /** Timestamp when the token was last updated */
262
+ updated_at?: string;
263
+ }
264
+ /**
265
+ * Represents a user associated with a base (collaborator).
266
+ */
267
+ interface BaseUser {
268
+ /** Unique identifier for the user */
269
+ id?: string;
270
+ /** User email address */
271
+ email: string;
272
+ /** User display name */
273
+ display_name?: string;
274
+ /** User role in the base */
275
+ roles?: string;
276
+ /** Timestamp when the user was created */
277
+ created_at?: string;
278
+ /** Timestamp when the user was last updated */
279
+ updated_at?: string;
280
+ }
281
+ /**
282
+ * Represents a comment on a row.
283
+ */
284
+ interface Comment {
285
+ /** Unique identifier for the comment */
286
+ id: string;
287
+ /** ID of the row this comment belongs to */
288
+ row_id: string;
289
+ /** ID of the table (model) this comment belongs to */
290
+ fk_model_id: string;
291
+ /** Comment text content */
292
+ comment?: string;
293
+ /** ID of the user who created the comment */
294
+ created_by?: string;
295
+ /** Email of the user who created the comment */
296
+ created_by_email?: string;
297
+ /** ID of the user who resolved the comment */
298
+ resolved_by?: string;
299
+ /** Timestamp when the comment was created */
300
+ created_at?: string;
301
+ /** Timestamp when the comment was last updated */
302
+ updated_at?: string;
303
+ }
304
+ /**
305
+ * Represents a shared view (public link to a view).
306
+ */
307
+ interface SharedView {
308
+ /** Unique identifier for the shared view */
309
+ id: string;
310
+ /** ID of the view being shared */
311
+ fk_view_id: string;
312
+ /** Password protection for the shared view */
313
+ password?: string;
314
+ /** Additional metadata */
315
+ meta?: Record<string, unknown> | string | null;
316
+ /** Timestamp when the shared view was created */
317
+ created_at?: string;
318
+ /** Timestamp when the shared view was last updated */
319
+ updated_at?: string;
320
+ }
321
+ /**
322
+ * Represents a shared base (public link to an entire base).
323
+ */
324
+ interface SharedBase {
325
+ /** UUID for the shared base link */
326
+ uuid?: string;
327
+ /** Public URL for the shared base */
328
+ url?: string;
329
+ /** Roles granted to shared base users */
330
+ roles?: string;
331
+ /** Password protection for the shared base */
332
+ password?: string;
333
+ }
334
+ /**
335
+ * Represents a column's settings within a specific view.
336
+ */
337
+ interface ViewColumn {
338
+ /** Unique identifier for the view column */
339
+ id: string;
340
+ /** ID of the view */
341
+ fk_view_id: string;
342
+ /** ID of the column */
343
+ fk_column_id: string;
344
+ /** Whether the column is visible in this view */
345
+ show?: boolean;
346
+ /** Display order of the column in this view */
347
+ order?: number;
348
+ /** Column width (for grid views) */
349
+ width?: string;
350
+ }
351
+ /**
352
+ * Form view-specific configuration.
353
+ */
354
+ interface FormView {
355
+ /** Unique identifier */
356
+ id?: string;
357
+ /** Form heading */
358
+ heading?: string;
359
+ /** Form subheading */
360
+ subheading?: string;
361
+ /** Success message after form submission */
362
+ success_msg?: string;
363
+ /** Redirect URL after form submission */
364
+ redirect_url?: string;
365
+ /** Whether to show a banner image */
366
+ banner_image_url?: string;
367
+ /** Whether to show the logo */
368
+ logo_url?: string;
369
+ /** Additional metadata */
370
+ meta?: Record<string, unknown> | string | null;
371
+ }
372
+ /**
373
+ * Gallery view-specific configuration.
374
+ */
375
+ interface GalleryView {
376
+ /** Unique identifier */
377
+ id?: string;
378
+ /** ID of the cover image column */
379
+ fk_cover_image_col_id?: string;
380
+ /** Additional metadata */
381
+ meta?: Record<string, unknown> | string | null;
382
+ }
383
+ /**
384
+ * Kanban view-specific configuration.
385
+ */
386
+ interface KanbanView {
387
+ /** Unique identifier */
388
+ id?: string;
389
+ /** ID of the grouping column */
390
+ fk_grp_col_id?: string;
391
+ /** ID of the cover image column */
392
+ fk_cover_image_col_id?: string;
393
+ /** Additional metadata */
394
+ meta?: Record<string, unknown> | string | null;
395
+ }
396
+ /**
397
+ * Grid view-specific configuration.
398
+ */
399
+ interface GridView {
400
+ /** Unique identifier */
401
+ id?: string;
402
+ /** Row height setting */
403
+ row_height?: number;
404
+ /** Additional metadata */
405
+ meta?: Record<string, unknown> | string | null;
406
+ }
407
+ /**
408
+ * NocoDB server application info.
409
+ */
410
+ interface AppInfo {
411
+ /** NocoDB version */
412
+ version?: string;
413
+ /** Authentication type */
414
+ authType?: string;
415
+ /** Whether the instance is a Docker deployment */
416
+ isDocker?: boolean;
417
+ /** Default language */
418
+ defaultLanguage?: string;
419
+ /** Project page default limit */
420
+ projectPageDefaultLimit?: number;
421
+ /** Whether invite-only signup is enabled */
422
+ inviteOnlySignup?: boolean;
423
+ /** Type of the NocoDB instance */
424
+ type?: string;
425
+ /** First user email (if applicable) */
426
+ firstUser?: string;
427
+ /** Whether telemetry is enabled */
428
+ telemetry?: boolean;
429
+ /** Whether audit is enabled */
430
+ auditEnabled?: boolean;
431
+ /** Additional properties */
432
+ [key: string]: unknown;
433
+ }
434
+ /**
435
+ * Visibility rule for a view (UI ACL).
436
+ */
437
+ interface VisibilityRule {
438
+ /** View ID */
439
+ id?: string;
440
+ /** View title */
441
+ title?: string;
442
+ /** Table ID */
443
+ fk_model_id?: string;
444
+ /** View type */
445
+ type?: number;
446
+ /** Whether the view is disabled for the role */
447
+ disabled?: Record<string, boolean>;
448
+ /** Display order */
449
+ order?: number;
450
+ /** Additional properties */
451
+ [key: string]: unknown;
452
+ }
453
+ /**
454
+ * Options for duplicate operations.
455
+ */
456
+ interface DuplicateOptions {
457
+ /** Exclude row data from the duplicate */
458
+ excludeData?: boolean;
459
+ /** Exclude views from the duplicate */
460
+ excludeViews?: boolean;
461
+ /** Exclude hooks/webhooks from the duplicate */
462
+ excludeHooks?: boolean;
463
+ }
464
+ /**
465
+ * Represents a NocoDB Cloud workspace (☁ cloud-only).
466
+ *
467
+ * Workspaces are organizational containers for bases in NocoDB Cloud.
468
+ * Self-hosted NocoDB does not have workspaces.
469
+ */
470
+ interface NcWorkspace {
471
+ /** Unique identifier for the workspace */
472
+ id: string;
473
+ /** Display title of the workspace */
474
+ title?: string;
475
+ /** Workspace description */
476
+ description?: string;
477
+ /** ID of the user who owns the workspace */
478
+ fk_user_id?: string;
479
+ /** ID of the organization */
480
+ fk_org_id?: string;
481
+ /** Display order */
482
+ order?: number;
483
+ /** Whether the workspace is deleted (soft delete) */
484
+ deleted?: boolean;
485
+ /** Whether SSO-only access is enforced */
486
+ sso_only_access?: boolean;
487
+ /** Additional metadata */
488
+ meta?: Record<string, unknown> | string | null;
489
+ /** Timestamp when the workspace was created */
490
+ created_at?: string;
491
+ /** Timestamp when the workspace was last updated */
492
+ updated_at?: string;
493
+ /** Timestamp when the workspace was deleted */
494
+ deleted_at?: string;
495
+ }
496
+ /**
497
+ * Represents a user within a NocoDB Cloud workspace (☁ cloud-only).
498
+ */
499
+ interface NcWorkspaceUser {
500
+ /** User email address */
501
+ email?: string;
502
+ /** ID of the user */
503
+ fk_user_id?: string;
504
+ /** Whether the user has accepted the invite */
505
+ invite_accepted?: boolean;
506
+ /** Invite token (for pending invitations) */
507
+ invite_token?: string;
508
+ /** User role in the workspace */
509
+ roles?: string;
510
+ }
511
+ /**
512
+ * Represents a row of data in a table.
513
+ *
514
+ * Rows have an Id field and arbitrary additional fields based on the table schema.
515
+ */
516
+ interface Row {
517
+ /** Unique identifier for the row (may be string or number depending on PK type) */
518
+ Id?: string | number;
519
+ /** Additional fields based on table columns */
520
+ [key: string]: unknown;
521
+ }
522
+
523
+ /**
524
+ * Type definitions for NocoDB API responses.
525
+ *
526
+ * This module provides TypeScript interfaces for API response structures
527
+ * including paginated lists, bulk operations, and error responses.
528
+ */
529
+
530
+ /**
531
+ * Pagination metadata for list responses.
532
+ *
533
+ * Provides information about the current page, total rows, and navigation state.
534
+ */
535
+ interface PageInfo {
536
+ /** Total number of rows across all pages */
537
+ totalRows?: number;
538
+ /** Current page number (1-indexed) */
539
+ page?: number;
540
+ /** Number of items per page */
541
+ pageSize?: number;
542
+ /** Whether this is the first page */
543
+ isFirstPage?: boolean;
544
+ /** Whether this is the last page */
545
+ isLastPage?: boolean;
546
+ }
547
+ /**
548
+ * Generic paginated list response.
549
+ *
550
+ * Used for endpoints that return lists of items with pagination support.
551
+ *
552
+ * @template T - The type of items in the list
553
+ *
554
+ * @example
555
+ * ```typescript
556
+ * const response: ListResponse<Table> = await client.listTables(baseId);
557
+ * console.log(`Found ${response.pageInfo.totalRows} tables`);
558
+ * for (const table of response.list) {
559
+ * console.log(table.title);
560
+ * }
561
+ * ```
562
+ */
563
+ interface ListResponse<T> {
564
+ /** Array of items in the current page */
565
+ list: T[];
566
+ /** Pagination metadata */
567
+ pageInfo: PageInfo;
568
+ }
569
+ /**
570
+ * Response from bulk create operations.
571
+ *
572
+ * Indicates how many rows were successfully created and optionally
573
+ * includes the created row data.
574
+ */
575
+ interface BulkCreateResponse {
576
+ /** Number of rows successfully created */
577
+ created: number;
578
+ /** Optional array of created row data */
579
+ data?: Row[];
580
+ }
581
+ /**
582
+ * Response from bulk update operations.
583
+ *
584
+ * Indicates how many rows were successfully updated and optionally
585
+ * includes the updated row data.
586
+ */
587
+ interface BulkUpdateResponse {
588
+ /** Number of rows successfully updated */
589
+ updated: number;
590
+ /** Optional array of updated row data */
591
+ data?: Row[];
592
+ }
593
+ /**
594
+ * Response from bulk delete operations.
595
+ *
596
+ * Indicates how many rows were successfully deleted.
597
+ */
598
+ interface BulkDeleteResponse {
599
+ /** Number of rows successfully deleted */
600
+ deleted: number;
601
+ }
602
+ /**
603
+ * Details about a failed item in a bulk operation.
604
+ *
605
+ * Provides information about which item failed and why.
606
+ */
607
+ interface BulkOperationError {
608
+ /** Index of the failed item in the input array */
609
+ index: number;
610
+ /** The item that failed */
611
+ item: Row;
612
+ /** Error message describing the failure */
613
+ error: string;
614
+ /** Error code if available */
615
+ code?: string;
616
+ }
617
+ /**
618
+ * Enhanced response from bulk create operations with error tracking.
619
+ *
620
+ * Includes success/failure counts and details about failed items.
621
+ */
622
+ interface BulkCreateResponseWithErrors extends BulkCreateResponse {
623
+ /** Number of rows that failed to create */
624
+ failed?: number;
625
+ /** Details about failed items */
626
+ errors?: BulkOperationError[];
627
+ }
628
+ /**
629
+ * Enhanced response from bulk update operations with error tracking.
630
+ *
631
+ * Includes success/failure counts and details about failed items.
632
+ */
633
+ interface BulkUpdateResponseWithErrors extends BulkUpdateResponse {
634
+ /** Number of rows that failed to update */
635
+ failed?: number;
636
+ /** Details about failed items */
637
+ errors?: BulkOperationError[];
638
+ }
639
+ /**
640
+ * Enhanced response from bulk delete operations with error tracking.
641
+ *
642
+ * Includes success/failure counts and details about failed items.
643
+ */
644
+ interface BulkDeleteResponseWithErrors extends BulkDeleteResponse {
645
+ /** Number of rows that failed to delete */
646
+ failed?: number;
647
+ /** Details about failed items */
648
+ errors?: BulkOperationError[];
649
+ }
650
+ /**
651
+ * Error response structure from NocoDB API.
652
+ *
653
+ * The API may return error messages in different fields depending
654
+ * on the endpoint and error type.
655
+ */
656
+ interface ErrorResponse {
657
+ /** Error message (some endpoints use 'msg') */
658
+ msg?: string;
659
+ /** Error message (some endpoints use 'message') */
660
+ message?: string;
661
+ /** Error message (some endpoints use 'error') */
662
+ error?: string;
663
+ }
664
+
665
+ /**
666
+ * Base error class for all NocoDB SDK errors.
667
+ * Provides structured error information including error codes, status codes, and additional data.
668
+ */
669
+ declare class NocoDBError extends Error {
670
+ code: string;
671
+ statusCode?: number | undefined;
672
+ data?: unknown | undefined;
673
+ /**
674
+ * Creates a new NocoDBError instance.
675
+ *
676
+ * @param message - Human-readable error message
677
+ * @param code - Machine-readable error code for programmatic handling
678
+ * @param statusCode - HTTP status code if applicable
679
+ * @param data - Additional error data (e.g., response body, validation details)
680
+ *
681
+ * @example
682
+ * ```typescript
683
+ * throw new NocoDBError('Operation failed', 'OPERATION_FAILED', 500, { details: 'Server error' });
684
+ * ```
685
+ */
686
+ constructor(message: string, code: string, statusCode?: number | undefined, data?: unknown | undefined);
687
+ }
688
+ /**
689
+ * Error thrown when network connectivity issues occur.
690
+ * This includes connection timeouts, DNS failures, and other network-level problems.
691
+ */
692
+ declare class NetworkError extends NocoDBError {
693
+ /**
694
+ * Creates a new NetworkError instance.
695
+ *
696
+ * @param message - Human-readable error message
697
+ * @param cause - The underlying error that caused this network error
698
+ *
699
+ * @example
700
+ * ```typescript
701
+ * try {
702
+ * await fetch('https://api.example.com');
703
+ * } catch (err) {
704
+ * throw new NetworkError('Failed to connect to server', err);
705
+ * }
706
+ * ```
707
+ */
708
+ constructor(message: string, cause?: Error);
709
+ }
710
+ /**
711
+ * Error thrown when authentication or authorization fails.
712
+ * This includes invalid tokens, expired credentials, and insufficient permissions.
713
+ */
714
+ declare class AuthenticationError extends NocoDBError {
715
+ /**
716
+ * Creates a new AuthenticationError instance.
717
+ *
718
+ * @param message - Human-readable error message
719
+ * @param statusCode - HTTP status code (typically 401 or 403)
720
+ * @param data - Additional error data from the server response
721
+ *
722
+ * @example
723
+ * ```typescript
724
+ * throw new AuthenticationError('Invalid API token', 401, { error: 'Token expired' });
725
+ * ```
726
+ */
727
+ constructor(message: string, statusCode: number, data?: unknown);
728
+ }
729
+ /**
730
+ * Error thrown when request validation fails.
731
+ * This includes schema validation errors, missing required fields, and invalid field values.
732
+ */
733
+ declare class ValidationError extends NocoDBError {
734
+ fieldErrors?: Record<string, string[]> | undefined;
735
+ /**
736
+ * Creates a new ValidationError instance.
737
+ *
738
+ * @param message - Human-readable error message
739
+ * @param fieldErrors - Optional map of field names to validation error messages
740
+ *
741
+ * @example
742
+ * ```typescript
743
+ * throw new ValidationError('Invalid request data', {
744
+ * email: ['Must be a valid email address'],
745
+ * age: ['Must be a positive number']
746
+ * });
747
+ * ```
748
+ */
749
+ constructor(message: string, fieldErrors?: Record<string, string[]> | undefined);
750
+ }
751
+ /**
752
+ * Error thrown when a requested resource is not found.
753
+ * This typically corresponds to HTTP 404 responses.
754
+ */
755
+ declare class NotFoundError extends NocoDBError {
756
+ /**
757
+ * Creates a new NotFoundError instance.
758
+ *
759
+ * @param resource - The type of resource that was not found (e.g., 'Base', 'Table', 'Row')
760
+ * @param id - The identifier of the resource that was not found
761
+ *
762
+ * @example
763
+ * ```typescript
764
+ * throw new NotFoundError('Table', 'tbl_abc123');
765
+ * // Error message: "Table not found: tbl_abc123"
766
+ * ```
767
+ */
768
+ constructor(resource: string, id: string);
769
+ }
770
+ /**
771
+ * Error thrown when a resource conflict occurs.
772
+ * This includes duplicate key violations, concurrent modification conflicts, and other state conflicts.
773
+ */
774
+ declare class ConflictError extends NocoDBError {
775
+ /**
776
+ * Creates a new ConflictError instance.
777
+ *
778
+ * @param message - Human-readable error message
779
+ * @param data - Additional error data from the server response
780
+ *
781
+ * @example
782
+ * ```typescript
783
+ * throw new ConflictError('Row already exists with this unique key', { key: 'email', value: 'user@example.com' });
784
+ * ```
785
+ */
786
+ constructor(message: string, data?: unknown);
787
+ }
788
+
789
+ /**
790
+ * Map of HTTP header names to values.
791
+ */
792
+ type HeadersMap = Record<string, string>;
793
+ /**
794
+ * Configuration options for request retry behavior.
795
+ */
796
+ interface RetryOptions {
797
+ /** Number of retry attempts, or false to disable retries */
798
+ retry?: number | false;
799
+ /** Delay in milliseconds between retry attempts */
800
+ retryDelay?: number;
801
+ /** HTTP status codes that should trigger a retry */
802
+ retryStatusCodes?: number[];
803
+ }
804
+ /**
805
+ * Options for individual HTTP requests.
806
+ */
807
+ interface RequestOptions {
808
+ /** Additional headers to include in the request */
809
+ headers?: HeadersMap;
810
+ /** Query parameters to append to the URL */
811
+ query?: Record<string, string | number | boolean | null | undefined>;
812
+ /** Request body (will be JSON-serialized) */
813
+ body?: unknown;
814
+ /** Request timeout in milliseconds */
815
+ timeoutMs?: number;
816
+ /** Retry configuration for this request */
817
+ retry?: RetryOptions;
818
+ }
819
+ /**
820
+ * Configuration options for creating a NocoClient instance.
821
+ */
822
+ interface ClientOptions {
823
+ /** Base URL of the NocoDB instance (e.g., 'https://app.nocodb.com') */
824
+ baseUrl: string;
825
+ /** Default headers to include in all requests (e.g., authentication token) */
826
+ headers?: HeadersMap;
827
+ /** Default timeout in milliseconds for all requests */
828
+ timeoutMs?: number;
829
+ /** Default retry configuration for all requests */
830
+ retry?: RetryOptions;
831
+ }
832
+ /**
833
+ * HTTP client for making requests to NocoDB APIs.
834
+ *
835
+ * Provides low-level HTTP request functionality with automatic error mapping,
836
+ * retry logic, and timeout handling. Most users should use MetaApi or DataApi
837
+ * instead of calling this directly.
838
+ *
839
+ * @example
840
+ * ```typescript
841
+ * const client = new NocoClient({
842
+ * baseUrl: 'https://app.nocodb.com',
843
+ * headers: { 'xc-token': 'your-api-token' },
844
+ * timeoutMs: 30000,
845
+ * retry: {
846
+ * retry: 3,
847
+ * retryDelay: 1000,
848
+ * retryStatusCodes: [408, 429, 500, 502, 503, 504]
849
+ * }
850
+ * });
851
+ * ```
852
+ */
853
+ declare class NocoClient {
854
+ private baseUrl;
855
+ private headers;
856
+ private timeoutMs?;
857
+ private retryOptions?;
858
+ /**
859
+ * Creates a new NocoClient instance.
860
+ *
861
+ * @param options - Client configuration options
862
+ */
863
+ constructor(options: ClientOptions);
864
+ /**
865
+ * Sets a default header that will be included in all requests.
866
+ *
867
+ * @param name - Header name
868
+ * @param value - Header value
869
+ *
870
+ * @example
871
+ * ```typescript
872
+ * client.setHeader('xc-token', 'new-api-token');
873
+ * ```
874
+ */
875
+ setHeader(name: string, value: string): void;
876
+ /**
877
+ * Removes a default header.
878
+ *
879
+ * @param name - Header name to remove
880
+ *
881
+ * @example
882
+ * ```typescript
883
+ * client.removeHeader('xc-token');
884
+ * ```
885
+ */
886
+ removeHeader(name: string): void;
887
+ /**
888
+ * Makes an HTTP request to the NocoDB API.
889
+ *
890
+ * Automatically handles error mapping, retry logic, and timeout handling.
891
+ * Throws typed errors (AuthenticationError, NotFoundError, etc.) based on
892
+ * HTTP status codes.
893
+ *
894
+ * @template T - Expected response type
895
+ * @param method - HTTP method (GET, POST, PATCH, DELETE, etc.)
896
+ * @param path - API endpoint path (e.g., '/api/v2/meta/bases')
897
+ * @param options - Request options (headers, query params, body, etc.)
898
+ * @returns Promise resolving to the typed response
899
+ * @throws {AuthenticationError} When authentication fails (401, 403)
900
+ * @throws {NotFoundError} When resource is not found (404)
901
+ * @throws {ConflictError} When a conflict occurs (409)
902
+ * @throws {ValidationError} When request validation fails (400)
903
+ * @throws {NetworkError} For network-level errors or other HTTP errors
904
+ *
905
+ * @example
906
+ * ```typescript
907
+ * const bases = await client.request<ListResponse<Base>>(
908
+ * 'GET',
909
+ * '/api/v2/meta/bases'
910
+ * );
911
+ *
912
+ * const newBase = await client.request<Base>(
913
+ * 'POST',
914
+ * '/api/v2/meta/bases',
915
+ * { body: { title: 'My Base' } }
916
+ * );
917
+ * ```
918
+ */
919
+ request<T>(method: string, path: string, options?: RequestOptions): Promise<T>;
920
+ /**
921
+ * Fetches all pages of a paginated list endpoint and returns the combined results.
922
+ *
923
+ * Automatically handles offset-based pagination by making sequential requests
924
+ * until all rows are retrieved. Useful for large datasets where a single request
925
+ * would only return a partial result.
926
+ *
927
+ * @template T - The type of items in the list
928
+ * @param method - HTTP method (typically 'GET')
929
+ * @param path - API endpoint path
930
+ * @param options - Request options (query params, headers, etc.)
931
+ * @param pageSize - Number of items per page (default: 1000)
932
+ * @returns Promise resolving to a ListResponse containing all items
933
+ *
934
+ * @example
935
+ * ```typescript
936
+ * // Fetch all rows from a table
937
+ * const allRows = await client.fetchAllPages<Row>(
938
+ * 'GET',
939
+ * '/api/v2/tables/tbl123/records'
940
+ * );
941
+ * console.log(`Total: ${allRows.list.length} rows`);
942
+ *
943
+ * // Fetch all with a filter
944
+ * const filtered = await client.fetchAllPages<Row>(
945
+ * 'GET',
946
+ * '/api/v2/tables/tbl123/records',
947
+ * { query: { where: '(Status,eq,Active)' } }
948
+ * );
949
+ * ```
950
+ */
951
+ fetchAllPages<T>(method: string, path: string, options?: RequestOptions, pageSize?: number): Promise<ListResponse<T>>;
952
+ }
953
+ /**
954
+ * Reference to a base by ID and optional title.
955
+ * Used for identifying bases in API operations.
956
+ */
957
+ interface BaseRef {
958
+ /** Unique identifier for the base */
959
+ id: string;
960
+ /** Optional display title */
961
+ title?: string;
962
+ }
963
+ /**
964
+ * Reference to a table by ID and optional title.
965
+ * Used for identifying tables in API operations.
966
+ */
967
+ interface TableRef {
968
+ /** Unique identifier for the table */
969
+ id: string;
970
+ /** Optional display title */
971
+ title?: string;
972
+ }
973
+ /**
974
+ * Reference to a view by ID and optional title.
975
+ * Used for identifying views in API operations.
976
+ */
977
+ interface ViewRef {
978
+ /** Unique identifier for the view */
979
+ id: string;
980
+ /** Optional display title */
981
+ title?: string;
982
+ }
983
+ /**
984
+ * Reference to a filter by ID.
985
+ * Used for identifying filters in API operations.
986
+ */
987
+ interface FilterRef {
988
+ /** Unique identifier for the filter */
989
+ id: string;
990
+ }
991
+ /**
992
+ * Reference to a sort by ID.
993
+ * Used for identifying sorts in API operations.
994
+ */
995
+ interface SortRef {
996
+ /** Unique identifier for the sort */
997
+ id: string;
998
+ }
999
+ /**
1000
+ * Reference to a column by ID.
1001
+ * Used for identifying columns in API operations.
1002
+ */
1003
+ interface ColumnRef {
1004
+ /** Unique identifier for the column */
1005
+ id: string;
1006
+ }
1007
+ /**
1008
+ * API methods for metadata operations (bases, tables, views, columns, filters, sorts).
1009
+ *
1010
+ * Provides typed methods for all CRUD operations on NocoDB metadata entities.
1011
+ * All methods return strongly-typed responses and throw typed errors on failure.
1012
+ *
1013
+ * @example
1014
+ * ```typescript
1015
+ * const client = new NocoClient({ baseUrl: '...', headers: { 'xc-token': '...' } });
1016
+ * const metaApi = new MetaApi(client);
1017
+ *
1018
+ * // List all bases
1019
+ * const bases = await metaApi.listBases();
1020
+ *
1021
+ * // Create a new table
1022
+ * const table = await metaApi.createTable('base_id', {
1023
+ * title: 'Users',
1024
+ * table_name: 'users'
1025
+ * });
1026
+ * ```
1027
+ */
1028
+ declare class MetaApi {
1029
+ private client;
1030
+ /**
1031
+ * Creates a new MetaApi instance.
1032
+ *
1033
+ * @param client - NocoClient instance for making HTTP requests
1034
+ */
1035
+ constructor(client: NocoClient);
1036
+ /**
1037
+ * Lists all bases accessible to the authenticated user.
1038
+ *
1039
+ * @returns Promise resolving to paginated list of bases
1040
+ * @throws {AuthenticationError} If authentication fails
1041
+ * @throws {NetworkError} If the request fails
1042
+ *
1043
+ * @example
1044
+ * ```typescript
1045
+ * const response = await metaApi.listBases();
1046
+ * console.log(`Found ${response.pageInfo.totalRows} bases`);
1047
+ * ```
1048
+ */
1049
+ listBases(): Promise<ListResponse<Base>>;
1050
+ /**
1051
+ * Creates a new base.
1052
+ *
1053
+ * @param body - Base properties (title is required)
1054
+ * @returns Promise resolving to the created base
1055
+ * @throws {ValidationError} If the request data is invalid
1056
+ * @throws {AuthenticationError} If authentication fails
1057
+ *
1058
+ * @example
1059
+ * ```typescript
1060
+ * const base = await metaApi.createBase({ title: 'My Project' });
1061
+ * console.log(`Created base: ${base.id}`);
1062
+ * ```
1063
+ */
1064
+ createBase(body: Partial<Base>): Promise<Base>;
1065
+ /**
1066
+ * Gets detailed information about a specific base.
1067
+ *
1068
+ * @param baseId - ID of the base to retrieve
1069
+ * @returns Promise resolving to the base details
1070
+ * @throws {NotFoundError} If the base doesn't exist
1071
+ * @throws {AuthenticationError} If authentication fails
1072
+ *
1073
+ * @example
1074
+ * ```typescript
1075
+ * const base = await metaApi.getBase('base_abc123');
1076
+ * console.log(`Base title: ${base.title}`);
1077
+ * ```
1078
+ */
1079
+ getBase(baseId: string): Promise<Base>;
1080
+ /**
1081
+ * Gets base information including metadata.
1082
+ *
1083
+ * @param baseId - ID of the base
1084
+ * @returns Promise resolving to the base info
1085
+ * @throws {NotFoundError} If the base doesn't exist
1086
+ *
1087
+ * @example
1088
+ * ```typescript
1089
+ * const info = await metaApi.getBaseInfo('base_abc123');
1090
+ * ```
1091
+ */
1092
+ getBaseInfo(baseId: string): Promise<Base>;
1093
+ /**
1094
+ * Updates a base's properties.
1095
+ *
1096
+ * @param baseId - ID of the base to update
1097
+ * @param body - Properties to update
1098
+ * @returns Promise resolving to the updated base
1099
+ * @throws {NotFoundError} If the base doesn't exist
1100
+ * @throws {ValidationError} If the update data is invalid
1101
+ *
1102
+ * @example
1103
+ * ```typescript
1104
+ * const updated = await metaApi.updateBase('base_abc123', { title: 'New Title' });
1105
+ * ```
1106
+ */
1107
+ updateBase(baseId: string, body: Partial<Base>): Promise<Base>;
1108
+ /**
1109
+ * Deletes a base permanently.
1110
+ *
1111
+ * @param baseId - ID of the base to delete
1112
+ * @returns Promise that resolves when deletion is complete
1113
+ * @throws {NotFoundError} If the base doesn't exist
1114
+ * @throws {AuthenticationError} If authentication fails
1115
+ *
1116
+ * @example
1117
+ * ```typescript
1118
+ * await metaApi.deleteBase('base_abc123');
1119
+ * console.log('Base deleted');
1120
+ * ```
1121
+ */
1122
+ deleteBase(baseId: string): Promise<void>;
1123
+ /**
1124
+ * Lists all data sources for a base.
1125
+ *
1126
+ * @param baseId - ID of the base
1127
+ * @returns Promise resolving to paginated list of sources
1128
+ * @throws {NotFoundError} If the base doesn't exist
1129
+ */
1130
+ listSources(baseId: string): Promise<ListResponse<Source>>;
1131
+ /**
1132
+ * Creates a new data source in a base.
1133
+ *
1134
+ * @param baseId - ID of the base
1135
+ * @param body - Source properties (alias, type, config, etc.)
1136
+ * @returns Promise resolving to the created source
1137
+ * @throws {ValidationError} If the request data is invalid
1138
+ */
1139
+ createSource(baseId: string, body: Partial<Source>): Promise<Source>;
1140
+ /**
1141
+ * Gets detailed information about a specific data source.
1142
+ *
1143
+ * @param baseId - ID of the base
1144
+ * @param sourceId - ID of the source to retrieve
1145
+ * @returns Promise resolving to the source details
1146
+ * @throws {NotFoundError} If the source doesn't exist
1147
+ */
1148
+ getSource(baseId: string, sourceId: string): Promise<Source>;
1149
+ /**
1150
+ * Updates a data source's properties.
1151
+ *
1152
+ * @param baseId - ID of the base
1153
+ * @param sourceId - ID of the source to update
1154
+ * @param body - Properties to update
1155
+ * @returns Promise resolving to the updated source
1156
+ * @throws {NotFoundError} If the source doesn't exist
1157
+ */
1158
+ updateSource(baseId: string, sourceId: string, body: Partial<Source>): Promise<Source>;
1159
+ /**
1160
+ * Deletes a data source permanently.
1161
+ *
1162
+ * @param baseId - ID of the base
1163
+ * @param sourceId - ID of the source to delete
1164
+ * @returns Promise that resolves when deletion is complete
1165
+ * @throws {NotFoundError} If the source doesn't exist
1166
+ */
1167
+ deleteSource(baseId: string, sourceId: string): Promise<void>;
1168
+ /**
1169
+ * Lists all tables in a base.
1170
+ *
1171
+ * @param baseId - ID of the base
1172
+ * @returns Promise resolving to paginated list of tables
1173
+ * @throws {NotFoundError} If the base doesn't exist
1174
+ *
1175
+ * @example
1176
+ * ```typescript
1177
+ * const response = await metaApi.listTables('base_abc123');
1178
+ * for (const table of response.list) {
1179
+ * console.log(`Table: ${table.title}`);
1180
+ * }
1181
+ * ```
1182
+ */
1183
+ listTables(baseId: string): Promise<ListResponse<Table>>;
1184
+ /**
1185
+ * Creates a new table in a base.
1186
+ *
1187
+ * @param baseId - ID of the base
1188
+ * @param body - Table properties (title and table_name are required)
1189
+ * @returns Promise resolving to the created table
1190
+ * @throws {ValidationError} If the request data is invalid
1191
+ * @throws {ConflictError} If a table with the same name already exists
1192
+ *
1193
+ * @example
1194
+ * ```typescript
1195
+ * const table = await metaApi.createTable('base_abc123', {
1196
+ * title: 'Users',
1197
+ * table_name: 'users'
1198
+ * });
1199
+ * ```
1200
+ */
1201
+ createTable(baseId: string, body: Partial<Table>): Promise<Table>;
1202
+ /**
1203
+ * Gets detailed information about a specific table.
1204
+ *
1205
+ * @param tableId - ID of the table to retrieve
1206
+ * @returns Promise resolving to the table details including columns
1207
+ * @throws {NotFoundError} If the table doesn't exist
1208
+ *
1209
+ * @example
1210
+ * ```typescript
1211
+ * const table = await metaApi.getTable('tbl_abc123');
1212
+ * console.log(`Table has ${table.columns?.length} columns`);
1213
+ * ```
1214
+ */
1215
+ getTable(tableId: string): Promise<Table>;
1216
+ /**
1217
+ * Updates a table's properties.
1218
+ *
1219
+ * @param tableId - ID of the table to update
1220
+ * @param body - Properties to update
1221
+ * @returns Promise resolving to the updated table
1222
+ * @throws {NotFoundError} If the table doesn't exist
1223
+ * @throws {ValidationError} If the update data is invalid
1224
+ *
1225
+ * @example
1226
+ * ```typescript
1227
+ * const updated = await metaApi.updateTable('tbl_abc123', { title: 'New Title' });
1228
+ * ```
1229
+ */
1230
+ updateTable(tableId: string, body: Partial<Table>): Promise<Table>;
1231
+ /**
1232
+ * Deletes a table permanently.
1233
+ *
1234
+ * @param tableId - ID of the table to delete
1235
+ * @returns Promise that resolves when deletion is complete
1236
+ * @throws {NotFoundError} If the table doesn't exist
1237
+ *
1238
+ * @example
1239
+ * ```typescript
1240
+ * await metaApi.deleteTable('tbl_abc123');
1241
+ * ```
1242
+ */
1243
+ deleteTable(tableId: string): Promise<void>;
1244
+ /**
1245
+ * Lists all views for a table.
1246
+ *
1247
+ * @param tableId - ID of the table
1248
+ * @returns Promise resolving to paginated list of views
1249
+ * @throws {NotFoundError} If the table doesn't exist
1250
+ *
1251
+ * @example
1252
+ * ```typescript
1253
+ * const response = await metaApi.listViews('tbl_abc123');
1254
+ * for (const view of response.list) {
1255
+ * console.log(`View: ${view.title} (${view.type})`);
1256
+ * }
1257
+ * ```
1258
+ */
1259
+ listViews(tableId: string): Promise<ListResponse<View>>;
1260
+ /**
1261
+ * Creates a new view for a table.
1262
+ *
1263
+ * @param tableId - ID of the table
1264
+ * @param body - View properties (title and type are required)
1265
+ * @returns Promise resolving to the created view
1266
+ * @throws {ValidationError} If the request data is invalid
1267
+ *
1268
+ * @example
1269
+ * ```typescript
1270
+ * const view = await metaApi.createView('tbl_abc123', {
1271
+ * title: 'Active Users',
1272
+ * type: 'grid'
1273
+ * });
1274
+ * ```
1275
+ */
1276
+ createView(tableId: string, body: Partial<View>): Promise<View>;
1277
+ /**
1278
+ * Gets detailed information about a specific view.
1279
+ *
1280
+ * @param viewId - ID of the view to retrieve
1281
+ * @returns Promise resolving to the view details
1282
+ * @throws {NotFoundError} If the view doesn't exist
1283
+ *
1284
+ * @example
1285
+ * ```typescript
1286
+ * const view = await metaApi.getView('vw_abc123');
1287
+ * ```
1288
+ */
1289
+ getView(viewId: string): Promise<View>;
1290
+ /**
1291
+ * Updates a view's properties.
1292
+ *
1293
+ * @param viewId - ID of the view to update
1294
+ * @param body - Properties to update
1295
+ * @returns Promise resolving to the updated view
1296
+ * @throws {NotFoundError} If the view doesn't exist
1297
+ * @throws {ValidationError} If the update data is invalid
1298
+ *
1299
+ * @example
1300
+ * ```typescript
1301
+ * const updated = await metaApi.updateView('vw_abc123', { title: 'New Title' });
1302
+ * ```
1303
+ */
1304
+ updateView(viewId: string, body: Partial<View>): Promise<View>;
1305
+ /**
1306
+ * Deletes a view permanently.
1307
+ *
1308
+ * @param viewId - ID of the view to delete
1309
+ * @returns Promise that resolves when deletion is complete
1310
+ * @throws {NotFoundError} If the view doesn't exist
1311
+ *
1312
+ * @example
1313
+ * ```typescript
1314
+ * await metaApi.deleteView('vw_abc123');
1315
+ * ```
1316
+ */
1317
+ deleteView(viewId: string): Promise<void>;
1318
+ /**
1319
+ * Lists all filters for a view.
1320
+ *
1321
+ * @param viewId - ID of the view
1322
+ * @returns Promise resolving to paginated list of filters
1323
+ * @throws {NotFoundError} If the view doesn't exist
1324
+ *
1325
+ * @example
1326
+ * ```typescript
1327
+ * const response = await metaApi.listViewFilters('vw_abc123');
1328
+ * ```
1329
+ */
1330
+ listViewFilters(viewId: string): Promise<ListResponse<Filter>>;
1331
+ /**
1332
+ * Creates a new filter for a view.
1333
+ *
1334
+ * @param viewId - ID of the view
1335
+ * @param body - Filter properties
1336
+ * @returns Promise resolving to the created filter
1337
+ * @throws {ValidationError} If the request data is invalid
1338
+ *
1339
+ * @example
1340
+ * ```typescript
1341
+ * const filter = await metaApi.createViewFilter('vw_abc123', {
1342
+ * fk_column_id: 'col_xyz',
1343
+ * comparison_op: 'eq',
1344
+ * value: 'active'
1345
+ * });
1346
+ * ```
1347
+ */
1348
+ createViewFilter(viewId: string, body: Partial<Filter>): Promise<Filter>;
1349
+ /**
1350
+ * Gets detailed information about a specific filter.
1351
+ *
1352
+ * @param filterId - ID of the filter to retrieve
1353
+ * @returns Promise resolving to the filter details
1354
+ * @throws {NotFoundError} If the filter doesn't exist
1355
+ *
1356
+ * @example
1357
+ * ```typescript
1358
+ * const filter = await metaApi.getFilter('flt_abc123');
1359
+ * ```
1360
+ */
1361
+ getFilter(filterId: string): Promise<Filter>;
1362
+ /**
1363
+ * Updates a filter's properties.
1364
+ *
1365
+ * @param filterId - ID of the filter to update
1366
+ * @param body - Properties to update
1367
+ * @returns Promise resolving to the updated filter
1368
+ * @throws {NotFoundError} If the filter doesn't exist
1369
+ * @throws {ValidationError} If the update data is invalid
1370
+ *
1371
+ * @example
1372
+ * ```typescript
1373
+ * const updated = await metaApi.updateFilter('flt_abc123', { value: 'inactive' });
1374
+ * ```
1375
+ */
1376
+ updateFilter(filterId: string, body: Partial<Filter>): Promise<Filter>;
1377
+ /**
1378
+ * Deletes a filter permanently.
1379
+ *
1380
+ * @param filterId - ID of the filter to delete
1381
+ * @returns Promise that resolves when deletion is complete
1382
+ * @throws {NotFoundError} If the filter doesn't exist
1383
+ *
1384
+ * @example
1385
+ * ```typescript
1386
+ * await metaApi.deleteFilter('flt_abc123');
1387
+ * ```
1388
+ */
1389
+ deleteFilter(filterId: string): Promise<void>;
1390
+ /**
1391
+ * Lists all sorts for a view.
1392
+ *
1393
+ * @param viewId - ID of the view
1394
+ * @returns Promise resolving to paginated list of sorts
1395
+ * @throws {NotFoundError} If the view doesn't exist
1396
+ *
1397
+ * @example
1398
+ * ```typescript
1399
+ * const response = await metaApi.listViewSorts('vw_abc123');
1400
+ * ```
1401
+ */
1402
+ listViewSorts(viewId: string): Promise<ListResponse<Sort>>;
1403
+ /**
1404
+ * Creates a new sort for a view.
1405
+ *
1406
+ * @param viewId - ID of the view
1407
+ * @param body - Sort properties (fk_column_id and direction are required)
1408
+ * @returns Promise resolving to the created sort
1409
+ * @throws {ValidationError} If the request data is invalid
1410
+ *
1411
+ * @example
1412
+ * ```typescript
1413
+ * const sort = await metaApi.createViewSort('vw_abc123', {
1414
+ * fk_column_id: 'col_xyz',
1415
+ * direction: 'asc'
1416
+ * });
1417
+ * ```
1418
+ */
1419
+ createViewSort(viewId: string, body: Partial<Sort>): Promise<Sort>;
1420
+ /**
1421
+ * Gets detailed information about a specific sort.
1422
+ *
1423
+ * @param sortId - ID of the sort to retrieve
1424
+ * @returns Promise resolving to the sort details
1425
+ * @throws {NotFoundError} If the sort doesn't exist
1426
+ *
1427
+ * @example
1428
+ * ```typescript
1429
+ * const sort = await metaApi.getSort('srt_abc123');
1430
+ * ```
1431
+ */
1432
+ getSort(sortId: string): Promise<Sort>;
1433
+ /**
1434
+ * Updates a sort's properties.
1435
+ *
1436
+ * @param sortId - ID of the sort to update
1437
+ * @param body - Properties to update
1438
+ * @returns Promise resolving to the updated sort
1439
+ * @throws {NotFoundError} If the sort doesn't exist
1440
+ * @throws {ValidationError} If the update data is invalid
1441
+ *
1442
+ * @example
1443
+ * ```typescript
1444
+ * const updated = await metaApi.updateSort('srt_abc123', { direction: 'desc' });
1445
+ * ```
1446
+ */
1447
+ updateSort(sortId: string, body: Partial<Sort>): Promise<Sort>;
1448
+ /**
1449
+ * Deletes a sort permanently.
1450
+ *
1451
+ * @param sortId - ID of the sort to delete
1452
+ * @returns Promise that resolves when deletion is complete
1453
+ * @throws {NotFoundError} If the sort doesn't exist
1454
+ *
1455
+ * @example
1456
+ * ```typescript
1457
+ * await metaApi.deleteSort('srt_abc123');
1458
+ * ```
1459
+ */
1460
+ deleteSort(sortId: string): Promise<void>;
1461
+ /**
1462
+ * Lists all columns for a table.
1463
+ *
1464
+ * @param tableId - ID of the table
1465
+ * @returns Promise resolving to paginated list of columns
1466
+ * @throws {NotFoundError} If the table doesn't exist
1467
+ *
1468
+ * @example
1469
+ * ```typescript
1470
+ * const response = await metaApi.listColumns('tbl_abc123');
1471
+ * for (const col of response.list) {
1472
+ * console.log(`Column: ${col.title} (${col.uidt})`);
1473
+ * }
1474
+ * ```
1475
+ */
1476
+ listColumns(tableId: string): Promise<ListResponse<Column>>;
1477
+ /**
1478
+ * Creates a new column in a table.
1479
+ *
1480
+ * @param tableId - ID of the table
1481
+ * @param body - Column properties (title, column_name, and uidt are required)
1482
+ * @returns Promise resolving to the created column
1483
+ * @throws {ValidationError} If the request data is invalid
1484
+ * @throws {ConflictError} If a column with the same name already exists
1485
+ *
1486
+ * @example
1487
+ * ```typescript
1488
+ * const column = await metaApi.createColumn('tbl_abc123', {
1489
+ * title: 'Email',
1490
+ * column_name: 'email',
1491
+ * uidt: 'Email'
1492
+ * });
1493
+ * ```
1494
+ */
1495
+ createColumn(tableId: string, body: Partial<Column>): Promise<Column>;
1496
+ /**
1497
+ * Gets detailed information about a specific column.
1498
+ *
1499
+ * @param columnId - ID of the column to retrieve
1500
+ * @returns Promise resolving to the column details
1501
+ * @throws {NotFoundError} If the column doesn't exist
1502
+ *
1503
+ * @example
1504
+ * ```typescript
1505
+ * const column = await metaApi.getColumn('col_abc123');
1506
+ * ```
1507
+ */
1508
+ getColumn(columnId: string): Promise<Column>;
1509
+ /**
1510
+ * Updates a column's properties.
1511
+ *
1512
+ * @param columnId - ID of the column to update
1513
+ * @param body - Properties to update
1514
+ * @returns Promise resolving to the updated column
1515
+ * @throws {NotFoundError} If the column doesn't exist
1516
+ * @throws {ValidationError} If the update data is invalid
1517
+ *
1518
+ * @example
1519
+ * ```typescript
1520
+ * const updated = await metaApi.updateColumn('col_abc123', { title: 'New Title' });
1521
+ * ```
1522
+ */
1523
+ updateColumn(columnId: string, body: Partial<Column>): Promise<Column>;
1524
+ /**
1525
+ * Deletes a column permanently.
1526
+ *
1527
+ * @param columnId - ID of the column to delete
1528
+ * @returns Promise that resolves when deletion is complete
1529
+ * @throws {NotFoundError} If the column doesn't exist
1530
+ *
1531
+ * @example
1532
+ * ```typescript
1533
+ * await metaApi.deleteColumn('col_abc123');
1534
+ * ```
1535
+ */
1536
+ deleteColumn(columnId: string): Promise<void>;
1537
+ /**
1538
+ * Lists all hooks for a table.
1539
+ *
1540
+ * @param tableId - ID of the table
1541
+ * @returns Promise resolving to paginated list of hooks
1542
+ * @throws {NotFoundError} If the table doesn't exist
1543
+ */
1544
+ listHooks(tableId: string): Promise<ListResponse<Hook>>;
1545
+ /**
1546
+ * Creates a new hook (webhook) for a table.
1547
+ *
1548
+ * @param tableId - ID of the table
1549
+ * @param body - Hook properties
1550
+ * @returns Promise resolving to the created hook
1551
+ * @throws {ValidationError} If the request data is invalid
1552
+ */
1553
+ createHook(tableId: string, body: Partial<Hook>): Promise<Hook>;
1554
+ /**
1555
+ * Gets detailed information about a specific hook.
1556
+ *
1557
+ * @param hookId - ID of the hook to retrieve
1558
+ * @returns Promise resolving to the hook details
1559
+ * @throws {NotFoundError} If the hook doesn't exist
1560
+ */
1561
+ getHook(hookId: string): Promise<Hook>;
1562
+ /**
1563
+ * Updates a hook's properties.
1564
+ *
1565
+ * @param hookId - ID of the hook to update
1566
+ * @param body - Properties to update
1567
+ * @returns Promise resolving to the updated hook
1568
+ * @throws {NotFoundError} If the hook doesn't exist
1569
+ */
1570
+ updateHook(hookId: string, body: Partial<Hook>): Promise<Hook>;
1571
+ /**
1572
+ * Deletes a hook permanently.
1573
+ *
1574
+ * @param hookId - ID of the hook to delete
1575
+ * @returns Promise that resolves when deletion is complete
1576
+ * @throws {NotFoundError} If the hook doesn't exist
1577
+ */
1578
+ deleteHook(hookId: string): Promise<void>;
1579
+ /**
1580
+ * Tests a hook by triggering a sample notification.
1581
+ *
1582
+ * @param hookId - ID of the hook to test
1583
+ * @param body - Optional test payload
1584
+ * @returns Promise resolving to the test result
1585
+ * @throws {NotFoundError} If the hook doesn't exist
1586
+ */
1587
+ testHook(hookId: string, body?: Record<string, unknown>): Promise<unknown>;
1588
+ /**
1589
+ * Lists all API tokens for a base.
1590
+ *
1591
+ * @param baseId - ID of the base
1592
+ * @returns Promise resolving to a list of API tokens
1593
+ */
1594
+ listTokens(baseId: string): Promise<ListResponse<ApiToken>>;
1595
+ /**
1596
+ * Creates a new API token for a base.
1597
+ *
1598
+ * @param baseId - ID of the base
1599
+ * @param body - Token properties (description is recommended)
1600
+ * @returns Promise resolving to the created token (includes the token string)
1601
+ */
1602
+ createToken(baseId: string, body: Partial<ApiToken>): Promise<ApiToken>;
1603
+ /**
1604
+ * Deletes an API token from a base.
1605
+ *
1606
+ * @param baseId - ID of the base
1607
+ * @param tokenId - ID of the token to delete
1608
+ * @returns Promise that resolves when deletion is complete
1609
+ */
1610
+ deleteToken(baseId: string, tokenId: string): Promise<void>;
1611
+ /**
1612
+ * Lists all users (collaborators) for a base.
1613
+ *
1614
+ * @param baseId - ID of the base
1615
+ * @returns Promise resolving to a list of base users
1616
+ * @throws {NotFoundError} If the base doesn't exist
1617
+ */
1618
+ listBaseUsers(baseId: string): Promise<ListResponse<BaseUser>>;
1619
+ /**
1620
+ * Invites a user to a base.
1621
+ *
1622
+ * @param baseId - ID of the base
1623
+ * @param body - User properties (email and roles are required)
1624
+ * @returns Promise resolving to the invite result
1625
+ * @throws {ValidationError} If the request data is invalid
1626
+ */
1627
+ inviteBaseUser(baseId: string, body: Partial<BaseUser>): Promise<unknown>;
1628
+ /**
1629
+ * Updates a user's role in a base.
1630
+ *
1631
+ * @param baseId - ID of the base
1632
+ * @param userId - ID of the user to update
1633
+ * @param body - Properties to update (typically roles)
1634
+ * @returns Promise resolving to the updated user
1635
+ */
1636
+ updateBaseUser(baseId: string, userId: string, body: Partial<BaseUser>): Promise<unknown>;
1637
+ /**
1638
+ * Removes a user from a base.
1639
+ *
1640
+ * @param baseId - ID of the base
1641
+ * @param userId - ID of the user to remove
1642
+ * @returns Promise that resolves when removal is complete
1643
+ */
1644
+ removeBaseUser(baseId: string, userId: string): Promise<void>;
1645
+ /**
1646
+ * Lists comments for a specific row.
1647
+ *
1648
+ * @param tableId - ID of the table (fk_model_id)
1649
+ * @param rowId - ID of the row
1650
+ * @returns Promise resolving to a list of comments
1651
+ */
1652
+ listComments(tableId: string, rowId: string): Promise<ListResponse<Comment>>;
1653
+ /**
1654
+ * Creates a comment on a row.
1655
+ *
1656
+ * @param body - Comment properties (fk_model_id, row_id, comment are required)
1657
+ * @returns Promise resolving to the created comment
1658
+ */
1659
+ createComment(body: Partial<Comment>): Promise<Comment>;
1660
+ /**
1661
+ * Updates a comment.
1662
+ *
1663
+ * @param commentId - ID of the comment to update
1664
+ * @param body - Properties to update (typically comment text)
1665
+ * @returns Promise resolving to the updated comment
1666
+ */
1667
+ updateComment(commentId: string, body: Partial<Comment>): Promise<Comment>;
1668
+ /**
1669
+ * Deletes a comment.
1670
+ *
1671
+ * @param commentId - ID of the comment to delete
1672
+ * @returns Promise that resolves when deletion is complete
1673
+ */
1674
+ deleteComment(commentId: string): Promise<void>;
1675
+ /**
1676
+ * Lists shared views for a table.
1677
+ *
1678
+ * @param tableId - ID of the table
1679
+ * @returns Promise resolving to a list of shared views
1680
+ */
1681
+ listSharedViews(tableId: string): Promise<ListResponse<SharedView>>;
1682
+ /**
1683
+ * Creates a shared view (public link) for a view.
1684
+ *
1685
+ * @param viewId - ID of the view to share
1686
+ * @param body - Optional shared view properties (password, meta)
1687
+ * @returns Promise resolving to the created shared view
1688
+ */
1689
+ createSharedView(viewId: string, body?: Partial<SharedView>): Promise<SharedView>;
1690
+ /**
1691
+ * Updates a shared view's properties.
1692
+ *
1693
+ * @param viewId - ID of the view whose share to update
1694
+ * @param body - Properties to update (password, meta)
1695
+ * @returns Promise resolving to the updated shared view
1696
+ */
1697
+ updateSharedView(viewId: string, body: Partial<SharedView>): Promise<SharedView>;
1698
+ /**
1699
+ * Deletes a shared view (removes public link).
1700
+ *
1701
+ * @param viewId - ID of the view whose share to delete
1702
+ * @returns Promise that resolves when deletion is complete
1703
+ */
1704
+ deleteSharedView(viewId: string): Promise<void>;
1705
+ /**
1706
+ * Gets shared base info (uuid, url, roles).
1707
+ *
1708
+ * @param baseId - ID of the base
1709
+ * @returns Promise resolving to the shared base info
1710
+ */
1711
+ getSharedBase(baseId: string): Promise<SharedBase>;
1712
+ /**
1713
+ * Creates a shared base (enables public sharing).
1714
+ *
1715
+ * @param baseId - ID of the base
1716
+ * @param body - Shared base properties (roles, password)
1717
+ * @returns Promise resolving to the created shared base
1718
+ */
1719
+ createSharedBase(baseId: string, body?: Partial<SharedBase>): Promise<SharedBase>;
1720
+ /**
1721
+ * Updates a shared base's properties.
1722
+ *
1723
+ * @param baseId - ID of the base
1724
+ * @param body - Properties to update (roles, password)
1725
+ * @returns Promise resolving to the updated shared base
1726
+ */
1727
+ updateSharedBase(baseId: string, body: Partial<SharedBase>): Promise<SharedBase>;
1728
+ /**
1729
+ * Disables shared base (removes public sharing).
1730
+ *
1731
+ * @param baseId - ID of the base
1732
+ * @returns Promise that resolves when sharing is disabled
1733
+ */
1734
+ deleteSharedBase(baseId: string): Promise<void>;
1735
+ /**
1736
+ * Creates a grid view for a table.
1737
+ *
1738
+ * @param tableId - ID of the table
1739
+ * @param body - View properties (title is required)
1740
+ * @returns Promise resolving to the created view
1741
+ */
1742
+ createGridView(tableId: string, body: Partial<View>): Promise<View>;
1743
+ /**
1744
+ * Creates a form view for a table.
1745
+ *
1746
+ * @param tableId - ID of the table
1747
+ * @param body - View properties (title is required)
1748
+ * @returns Promise resolving to the created view
1749
+ */
1750
+ createFormView(tableId: string, body: Partial<View>): Promise<View>;
1751
+ /**
1752
+ * Creates a gallery view for a table.
1753
+ *
1754
+ * @param tableId - ID of the table
1755
+ * @param body - View properties (title is required)
1756
+ * @returns Promise resolving to the created view
1757
+ */
1758
+ createGalleryView(tableId: string, body: Partial<View>): Promise<View>;
1759
+ /**
1760
+ * Creates a kanban view for a table.
1761
+ *
1762
+ * @param tableId - ID of the table
1763
+ * @param body - View properties (title is required)
1764
+ * @returns Promise resolving to the created view
1765
+ */
1766
+ createKanbanView(tableId: string, body: Partial<View>): Promise<View>;
1767
+ /**
1768
+ * Gets form view-specific configuration.
1769
+ *
1770
+ * @param formViewId - ID of the form view
1771
+ * @returns Promise resolving to the form view config
1772
+ */
1773
+ getFormView(formViewId: string): Promise<FormView>;
1774
+ /**
1775
+ * Updates form view-specific configuration.
1776
+ *
1777
+ * @param formViewId - ID of the form view
1778
+ * @param body - Form-specific properties to update
1779
+ * @returns Promise resolving to the updated form view config
1780
+ */
1781
+ updateFormView(formViewId: string, body: Partial<FormView>): Promise<FormView>;
1782
+ /**
1783
+ * Gets gallery view-specific configuration.
1784
+ *
1785
+ * @param galleryViewId - ID of the gallery view
1786
+ * @returns Promise resolving to the gallery view config
1787
+ */
1788
+ getGalleryView(galleryViewId: string): Promise<GalleryView>;
1789
+ /**
1790
+ * Updates gallery view-specific configuration.
1791
+ *
1792
+ * @param galleryViewId - ID of the gallery view
1793
+ * @param body - Gallery-specific properties to update
1794
+ * @returns Promise resolving to the updated gallery view config
1795
+ */
1796
+ updateGalleryView(galleryViewId: string, body: Partial<GalleryView>): Promise<GalleryView>;
1797
+ /**
1798
+ * Gets kanban view-specific configuration.
1799
+ *
1800
+ * @param kanbanViewId - ID of the kanban view
1801
+ * @returns Promise resolving to the kanban view config
1802
+ */
1803
+ getKanbanView(kanbanViewId: string): Promise<KanbanView>;
1804
+ /**
1805
+ * Updates kanban view-specific configuration.
1806
+ *
1807
+ * @param kanbanViewId - ID of the kanban view
1808
+ * @param body - Kanban-specific properties to update
1809
+ * @returns Promise resolving to the updated kanban view config
1810
+ */
1811
+ updateKanbanView(kanbanViewId: string, body: Partial<KanbanView>): Promise<KanbanView>;
1812
+ /**
1813
+ * Updates grid view-specific configuration.
1814
+ *
1815
+ * @param gridViewId - ID of the grid view
1816
+ * @param body - Grid-specific properties to update
1817
+ * @returns Promise resolving to the updated grid view config
1818
+ */
1819
+ updateGridView(gridViewId: string, body: Partial<GridView>): Promise<GridView>;
1820
+ /**
1821
+ * Lists columns for a view (field visibility/order settings).
1822
+ *
1823
+ * @param viewId - ID of the view
1824
+ * @returns Promise resolving to a list of view columns
1825
+ */
1826
+ listViewColumns(viewId: string): Promise<ListResponse<ViewColumn>>;
1827
+ /**
1828
+ * Lists child filters of a filter group.
1829
+ *
1830
+ * @param filterGroupId - ID of the parent filter group
1831
+ * @returns Promise resolving to a list of child filters
1832
+ */
1833
+ listFilterChildren(filterGroupId: string): Promise<ListResponse<Filter>>;
1834
+ /**
1835
+ * Lists filters for a hook (webhook).
1836
+ *
1837
+ * @param hookId - ID of the hook
1838
+ * @returns Promise resolving to a list of hook filters
1839
+ */
1840
+ listHookFilters(hookId: string): Promise<ListResponse<Filter>>;
1841
+ /**
1842
+ * Creates a filter for a hook (webhook).
1843
+ *
1844
+ * @param hookId - ID of the hook
1845
+ * @param body - Filter properties
1846
+ * @returns Promise resolving to the created filter
1847
+ */
1848
+ createHookFilter(hookId: string, body: Partial<Filter>): Promise<Filter>;
1849
+ /**
1850
+ * Sets a column as the primary/display column for its table.
1851
+ *
1852
+ * @param columnId - ID of the column to set as primary
1853
+ * @returns Promise resolving when the column is set as primary
1854
+ */
1855
+ setColumnPrimary(columnId: string): Promise<unknown>;
1856
+ /**
1857
+ * Duplicates a base.
1858
+ *
1859
+ * @param baseId - ID of the base to duplicate
1860
+ * @param options - Optional duplicate options (excludeData, excludeViews, excludeHooks)
1861
+ * @returns Promise resolving to the duplicate operation result
1862
+ */
1863
+ duplicateBase(baseId: string, options?: DuplicateOptions): Promise<unknown>;
1864
+ /**
1865
+ * Duplicates a base source.
1866
+ *
1867
+ * @param baseId - ID of the base
1868
+ * @param sourceId - ID of the source to duplicate
1869
+ * @param options - Optional duplicate options
1870
+ * @returns Promise resolving to the duplicate operation result
1871
+ */
1872
+ duplicateSource(baseId: string, sourceId: string, options?: DuplicateOptions): Promise<unknown>;
1873
+ /**
1874
+ * Duplicates a table within a base.
1875
+ *
1876
+ * @param baseId - ID of the base
1877
+ * @param tableId - ID of the table to duplicate
1878
+ * @param options - Optional duplicate options
1879
+ * @returns Promise resolving to the duplicate operation result
1880
+ */
1881
+ duplicateTable(baseId: string, tableId: string, options?: DuplicateOptions): Promise<unknown>;
1882
+ /**
1883
+ * Gets view visibility rules for a base (UI ACL).
1884
+ *
1885
+ * @param baseId - ID of the base
1886
+ * @returns Promise resolving to the visibility rules
1887
+ */
1888
+ getVisibilityRules(baseId: string): Promise<VisibilityRule[]>;
1889
+ /**
1890
+ * Sets view visibility rules for a base (UI ACL).
1891
+ *
1892
+ * @param baseId - ID of the base
1893
+ * @param body - Visibility rules to set
1894
+ * @returns Promise resolving when rules are set
1895
+ */
1896
+ setVisibilityRules(baseId: string, body: VisibilityRule[]): Promise<unknown>;
1897
+ /**
1898
+ * Gets NocoDB server application info (version, etc.).
1899
+ *
1900
+ * @returns Promise resolving to the app info
1901
+ */
1902
+ getAppInfo(): Promise<AppInfo>;
1903
+ /**
1904
+ * Lists all workspaces (☁ cloud-only).
1905
+ *
1906
+ * @returns Promise resolving to paginated list of workspaces
1907
+ * @throws {NetworkError} If the instance doesn't support workspaces (self-hosted)
1908
+ */
1909
+ listWorkspaces(): Promise<ListResponse<NcWorkspace>>;
1910
+ /**
1911
+ * Gets a workspace by ID (☁ cloud-only).
1912
+ *
1913
+ * @param workspaceId - ID of the workspace
1914
+ * @returns Promise resolving to the workspace details and user count
1915
+ * @throws {NotFoundError} If the workspace doesn't exist
1916
+ */
1917
+ getWorkspace(workspaceId: string): Promise<{
1918
+ workspace: NcWorkspace;
1919
+ workspaceUserCount: number;
1920
+ }>;
1921
+ /**
1922
+ * Creates a new workspace (☁ cloud-only).
1923
+ *
1924
+ * @param body - Workspace properties (title is required)
1925
+ * @returns Promise resolving to the created workspace
1926
+ * @throws {ValidationError} If the request data is invalid
1927
+ */
1928
+ createWorkspace(body: Partial<NcWorkspace>): Promise<NcWorkspace>;
1929
+ /**
1930
+ * Updates a workspace (☁ cloud-only).
1931
+ *
1932
+ * @param workspaceId - ID of the workspace to update
1933
+ * @param body - Properties to update
1934
+ * @returns Promise resolving when the update is complete
1935
+ */
1936
+ updateWorkspace(workspaceId: string, body: Partial<NcWorkspace>): Promise<void>;
1937
+ /**
1938
+ * Deletes a workspace (☁ cloud-only).
1939
+ *
1940
+ * @param workspaceId - ID of the workspace to delete
1941
+ * @returns Promise resolving when deletion is complete
1942
+ */
1943
+ deleteWorkspace(workspaceId: string): Promise<void>;
1944
+ /**
1945
+ * Lists users in a workspace (☁ cloud-only).
1946
+ *
1947
+ * @param workspaceId - ID of the workspace
1948
+ * @returns Promise resolving to a list of workspace users
1949
+ */
1950
+ listWorkspaceUsers(workspaceId: string): Promise<ListResponse<NcWorkspaceUser>>;
1951
+ /**
1952
+ * Gets a specific user in a workspace (☁ cloud-only).
1953
+ *
1954
+ * @param workspaceId - ID of the workspace
1955
+ * @param userId - ID of the user
1956
+ * @returns Promise resolving to the workspace user details
1957
+ */
1958
+ getWorkspaceUser(workspaceId: string, userId: string): Promise<NcWorkspaceUser>;
1959
+ /**
1960
+ * Invites a user to a workspace (☁ cloud-only).
1961
+ *
1962
+ * @param workspaceId - ID of the workspace
1963
+ * @param body - Invite properties (email and roles are required)
1964
+ * @returns Promise resolving to the invite result
1965
+ */
1966
+ inviteWorkspaceUser(workspaceId: string, body: Partial<NcWorkspaceUser>): Promise<unknown>;
1967
+ /**
1968
+ * Updates a user's role in a workspace (☁ cloud-only).
1969
+ *
1970
+ * @param workspaceId - ID of the workspace
1971
+ * @param userId - ID of the user to update
1972
+ * @param body - Properties to update (typically roles)
1973
+ * @returns Promise resolving when the update is complete
1974
+ */
1975
+ updateWorkspaceUser(workspaceId: string, userId: string, body: Partial<NcWorkspaceUser>): Promise<void>;
1976
+ /**
1977
+ * Removes a user from a workspace (☁ cloud-only).
1978
+ *
1979
+ * @param workspaceId - ID of the workspace
1980
+ * @param userId - ID of the user to remove
1981
+ * @returns Promise resolving when removal is complete
1982
+ */
1983
+ deleteWorkspaceUser(workspaceId: string, userId: string): Promise<void>;
1984
+ /**
1985
+ * Lists bases in a workspace (☁ cloud-only).
1986
+ *
1987
+ * @param workspaceId - ID of the workspace
1988
+ * @returns Promise resolving to a paginated list of bases
1989
+ */
1990
+ listWorkspaceBases(workspaceId: string): Promise<ListResponse<Base>>;
1991
+ /**
1992
+ * Creates a base in a workspace (☁ cloud-only).
1993
+ *
1994
+ * @param workspaceId - ID of the workspace
1995
+ * @param body - Base properties (title is required)
1996
+ * @returns Promise resolving to the created base
1997
+ */
1998
+ createWorkspaceBase(workspaceId: string, body: Partial<Base>): Promise<Base>;
1999
+ /**
2000
+ * Gets the Swagger/OpenAPI specification for a base.
2001
+ *
2002
+ * Returns the complete API documentation for all tables and operations
2003
+ * in the specified base.
2004
+ *
2005
+ * @param baseId - ID of the base
2006
+ * @returns Promise resolving to the Swagger document
2007
+ * @throws {NotFoundError} If the base doesn't exist
2008
+ *
2009
+ * @example
2010
+ * ```typescript
2011
+ * const swagger = await metaApi.getBaseSwagger('base_abc123');
2012
+ * console.log(`API version: ${swagger.info.version}`);
2013
+ * ```
2014
+ */
2015
+ getBaseSwagger(baseId: string): Promise<unknown>;
2016
+ /**
2017
+ * Uploads a file attachment.
2018
+ *
2019
+ * Uploads a file from the local filesystem to NocoDB storage.
2020
+ * The returned data can be used in attachment column fields.
2021
+ *
2022
+ * @param filePath - Path to the file to upload
2023
+ * @returns Promise resolving to upload response with file metadata
2024
+ * @throws {ValidationError} If the file doesn't exist or is invalid
2025
+ * @throws {NetworkError} If the upload fails
2026
+ *
2027
+ * @example
2028
+ * ```typescript
2029
+ * const result = await metaApi.uploadAttachment('/path/to/image.png');
2030
+ * // Use result in an attachment column
2031
+ * ```
2032
+ */
2033
+ uploadAttachment(filePath: string): Promise<unknown>;
2034
+ }
2035
+ /**
2036
+ * API methods for data operations (links between records).
2037
+ *
2038
+ * Provides methods for managing relationships between records in linked tables.
2039
+ */
2040
+ declare class DataApi {
2041
+ private client;
2042
+ constructor(client: NocoClient);
2043
+ /**
2044
+ * List linked records for a specific record and link field.
2045
+ *
2046
+ * @param tableId - ID of the table containing the record
2047
+ * @param linkFieldId - ID of the link field (column)
2048
+ * @param recordId - ID of the record to get links for
2049
+ * @param query - Optional query parameters for filtering/pagination
2050
+ * @returns Paginated list of linked rows
2051
+ *
2052
+ * @example
2053
+ * ```typescript
2054
+ * const links = await dataApi.listLinks('tbl123', 'col456', 'rec789');
2055
+ * console.log(`Found ${links.pageInfo.totalRows} linked records`);
2056
+ * ```
2057
+ */
2058
+ listLinks(tableId: string, linkFieldId: string, recordId: string, query?: Record<string, any>): Promise<ListResponse<Row>>;
2059
+ /**
2060
+ * Link records together via a link field.
2061
+ *
2062
+ * @param tableId - ID of the table containing the record
2063
+ * @param linkFieldId - ID of the link field (column)
2064
+ * @param recordId - ID of the record to link from
2065
+ * @param body - Array of record IDs or objects to link
2066
+ * @returns Success response
2067
+ *
2068
+ * @example
2069
+ * ```typescript
2070
+ * await dataApi.linkRecords('tbl123', 'col456', 'rec789', [{ Id: 'rec999' }]);
2071
+ * ```
2072
+ */
2073
+ linkRecords(tableId: string, linkFieldId: string, recordId: string, body: unknown): Promise<unknown>;
2074
+ /**
2075
+ * Unlink records from a link field.
2076
+ *
2077
+ * @param tableId - ID of the table containing the record
2078
+ * @param linkFieldId - ID of the link field (column)
2079
+ * @param recordId - ID of the record to unlink from
2080
+ * @param body - Array of record IDs or objects to unlink
2081
+ * @returns Success response
2082
+ *
2083
+ * @example
2084
+ * ```typescript
2085
+ * await dataApi.unlinkRecords('tbl123', 'col456', 'rec789', [{ Id: 'rec999' }]);
2086
+ * ```
2087
+ */
2088
+ unlinkRecords(tableId: string, linkFieldId: string, recordId: string, body: unknown): Promise<unknown>;
2089
+ }
2090
+ /**
2091
+ * Normalizes a base URL by removing trailing slashes.
2092
+ *
2093
+ * @param input - Base URL to normalize
2094
+ * @returns Normalized URL without trailing slashes
2095
+ *
2096
+ * @example
2097
+ * ```typescript
2098
+ * normalizeBaseUrl('https://app.nocodb.com/') // 'https://app.nocodb.com'
2099
+ * normalizeBaseUrl('https://app.nocodb.com') // 'https://app.nocodb.com'
2100
+ * ```
2101
+ */
2102
+ declare function normalizeBaseUrl(input: string): string;
2103
+ /**
2104
+ * Parses a header string in 'Name: Value' format.
2105
+ *
2106
+ * @param input - Header string to parse
2107
+ * @returns Tuple of [name, value]
2108
+ * @throws {Error} If the header format is invalid
2109
+ *
2110
+ * @example
2111
+ * ```typescript
2112
+ * const [name, value] = parseHeader('xc-token: my-api-token');
2113
+ * // name = 'xc-token', value = 'my-api-token'
2114
+ * ```
2115
+ */
2116
+ declare function parseHeader(input: string): [string, string];
2117
+
2118
+ export { type ApiToken, type AppInfo, AuthenticationError, type Base, type BaseRef, type BaseUser, type BulkCreateResponse, type BulkCreateResponseWithErrors, type BulkDeleteResponse, type BulkDeleteResponseWithErrors, type BulkOperationError, type BulkUpdateResponse, type BulkUpdateResponseWithErrors, type ClientOptions, type Column, type ColumnRef, type ColumnType, type Comment, type ComparisonOperator, ConflictError, DataApi, type DuplicateOptions, type ErrorResponse, type Filter, type FilterRef, type FormView, type GalleryView, type GridView, type HeadersMap, type Hook, type KanbanView, type ListResponse, MetaApi, type NcWorkspace, type NcWorkspaceUser, NetworkError, NocoClient, NocoDBError, NotFoundError, type PageInfo, type RequestOptions, type RetryOptions, type Row, type SharedBase, type SharedView, type Sort, type SortRef, type Source, type SourceType, type Table, type TableRef, ValidationError, type View, type ViewColumn, type ViewRef, type ViewType, type VisibilityRule, normalizeBaseUrl, parseHeader };